From patchwork Mon Apr 11 14:54:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abdelfattah Chehab X-Patchwork-Id: 109628 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D112DA0508; Wed, 13 Apr 2022 09:32:10 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8C80F40694; Wed, 13 Apr 2022 09:32:10 +0200 (CEST) Received: from FRA01-PR2-obe.outbound.protection.outlook.com (mail-eopbgr120095.outbound.protection.outlook.com [40.107.12.95]) by mails.dpdk.org (Postfix) with ESMTP id 7B900415D7; Mon, 11 Apr 2022 16:55:01 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lQ56VYWvb0hiXwjB4cdxKtdRJMXbU87jN2RkPQ+hh7XyKQgAGMJOl6G+geacd1TzHbaZ4e98FYkLcv7i2PZy6nwLMgoj/bAy3FnMzYQXjwM0Rb+0KenYG55gq9EIDQEFED4TSqFQ1+WQGucML+GdDU7ZiTZFH2SS/t8843rzuakssoNWCHTbEDjo3J7qhKZP2nXO9v650psF6CgQXZw9/oWEI5UforZUkRNFJNbSy6tA9otTkTBYSZz3sIYAiLxLseFVxk+pm+IdDAzfRzXPVqAVs1Y/Cy/rNh/imi2WTx13MEmbCOkvZ9/QbaV8rbk9aqKz4OddJJsqpKhVnAsHGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ra0CxRAbOLsjuBEkxFUMBBs4T6twxy7O6VsV9g1VZmw=; b=ICQuAtRBE3OmeRgupQV5pcouNXSWQe49Ow3HsZm9NsDCtPPhByFLi5KDkM4Cq/M8is7AZpkOaSeil8PC8NrlLfImz5BVN5xB24A2BTkt+JKgbzkpDBkqagDJrLDDaeplqiPOBf39SEREJ1w7ADqcjymBDD2Z2lc4QhJcei5FElyfDp07/ENPqpxUA/aVCLfamtSfHPTQ/xXaSp8PHhgwFL3SQ4724vh9Z9nPyOPOkhPa3sFZDD9V3UudYxQZvY2spq21qCf2u2801IOhWhDFu+0z0IqBPuSRoSMT/HE2JhGGMvCb/S2ZrXEScWvxBKVVNtp5qz7sR+v6/tKS8s+Ykw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=ekinops.com; dmarc=pass action=none header.from=ekinops.com; dkim=pass header.d=ekinops.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ekinops.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ra0CxRAbOLsjuBEkxFUMBBs4T6twxy7O6VsV9g1VZmw=; b=g9Xt8VGEtleIeNwQ5gj6shLPW2rpBDJw8pNZyeVkplP4MH3Xa2HftoiB6UFkR5UrcpuYAYGKFzcOZaHTwqjHWHitaPhSP2qq/JLrbgpJWHvRi6h6E8IjgB99Tx60E9+CUh7ZrBRU94vrVOJBl9ZsciWnb0/pXoVo6SRlkqWswW4= Received: from PR1P264MB2030.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:1b0::22) by PAZP264MB3749.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:12b::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5144.29; Mon, 11 Apr 2022 14:55:00 +0000 Received: from PR1P264MB2030.FRAP264.PROD.OUTLOOK.COM ([fe80::38d4:2647:f3af:9e57]) by PR1P264MB2030.FRAP264.PROD.OUTLOOK.COM ([fe80::38d4:2647:f3af:9e57%9]) with mapi id 15.20.5144.029; Mon, 11 Apr 2022 14:55:00 +0000 From: Abdelfattah Chehab To: "dev@dpdk.org" CC: "stable@dpdk.org" Subject: [PATCH] vmbus: get current rte_vmbus_bus struct Thread-Topic: [PATCH] vmbus: get current rte_vmbus_bus struct Thread-Index: AdhNs06mJ2zGT2tgQlyLgQGzR9HS6w== Date: Mon, 11 Apr 2022 14:54:59 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=ekinops.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: cefb48a6-b5a5-406a-5327-08da1bcb4079 x-ms-traffictypediagnostic: PAZP264MB3749:EE_ x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: h3jARHTAOhyYJGKT1u+deZ5aD7hsDY4+Fo+FizyzI1z7ivDAixzOatApR/fLLaxLZO6iqDxXCKZtf0Ca+/5K//zzpBLL8D3dcsLY4uvv5Gpbr2H7j+UPoDGVTe2tU91ZkiYYm8A+Q27ZES0FXviweRQ28MKuX82kjlHkTyZXNrcE5tp4XoUri0vtFa/pxzQspVcHMYGneW5ZkOly9zJny3c2fqi5r7IrOfqU2n8+MVGVWzlOyizBVI2JInVsv+48nj4C3MUQLxKZt86Td6zTcOiBfiOZEqPWaMz/JsHKT0ptGNBSONWeoC5+oFC14egvj+2iPbR/qoNWGIyEmhvrLPwuAevfcCwx0VhIvvay+K01yq9w1tCma1+C7RD63J8AoersUjNV7AHHJaLaehulPrK8dUEIqpOWHt41/Dn2JI79uWwZfnnjAsZqXcApZVU4NCvu9mvcp6QRszZpxVX0yW5jhiy3eM4AEWvNZ0WoeqFDcQa5jTWXoYrWTdnFD8nELo/1wnw29N7oPMKVK6s6LG61n8JJw+w/rfOFESfaxI4JMJcPhTXyGXYiRPooMODfnfo/DORmcCX7jgxuVw9kDgPfFi0iS3gomtHEXI8H7oxbRZmOoKeF2uUDQZHOqAr2FnJSvsbqzl2AP7psE662l7REg/FfwV9Q7xhO38Bxy5Y+Jt+3MiVWsh6JzSa6UeNhpVxs70xuLbfEisgqAjJLgw== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PR1P264MB2030.FRAP264.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(13230001)(366004)(5660300002)(6916009)(8676002)(2906002)(66946007)(8936002)(66476007)(66556008)(9326002)(76116006)(55016003)(122000001)(83380400001)(52536014)(86362001)(66446008)(316002)(38070700005)(7696005)(9686003)(6506007)(186003)(38100700002)(450100002)(4326008)(64756008)(71200400001)(26005)(508600001)(33656002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: Xqzf5eK59pihrAjtnV0R304g7FzSGmC0vext87w2bSEiFzOY0DsjJxYC+DUPidoaGlC3iQMz69DcMi3MfrlemWZeTfus0g8FOS2Tgx1flBx5MeuWTh4LVfEA6MsV757dqAi3qoMex+xs5Yfpo7mSa6WRaNxTnmVkIA9k/XkqEUEJs9X3J3XOn3l8D6U0/K3ropG1swxZ14LeE6xGEYElVcRUzdjDFywdsjWwewLEENdOdS1YEWYZ8key8ptb3s+W+paWcmoseifmuyoz7+TOmR9M9n/H2kDbS5tqMjmFIvxogwh83Ji3mo6mSDHYXz5pqEwkbJXCUjfNt3YXeG7JT3pLqhRNsQv7n4WUeCyhgDoB80zIKA1q4HVXDqx3uRTjhFzC5wV6XlcElFAbSDelBZqGWto4uDWB9YQCh8JjoJFxF/a3iXjNt941FL+ptCpLszufyIgpQ8rrCAAsrcUm1U84etpxoWrQCQz3gSimekNbPXvdUJMpOX/iI2+nLcysMUxOvfQA0znGQguw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a9jHRb3YDxRAasaGd3PjmCqrR5hO0sKUkU//o/qvBJW/W7pIFUAtRQLecGp9ATB4yocQtphHdFKTWl2DBv9U/O+NIc/lMwkZVKI94zqpXt4taZCArehBG1kISG5QBhkzFPek91gi/g0E4hKQTLVnTsPMQ/sdhfEIS/g7T5hwJZyoyxtSmjgTK94p7L64kTthSnsGQQT MIME-Version: 1.0 X-OriginatorOrg: ekinops.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PR1P264MB2030.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: cefb48a6-b5a5-406a-5327-08da1bcb4079 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Apr 2022 14:54:59.8944 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f57b78a6-c654-4771-a72f-837275f46179 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: bFsOdEcLL25hWM8anr1X9ohVkhCvT/EgDKI2opYe5pOGBeRVuFBNtSlh75SWAS/ZawsFreu7R8GJ2LN7PJXGW8r6RshCRMhKFIN0aNb3wI+bI73j4dnHmQkJyN4+r+Ug X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAZP264MB3749 X-Mailman-Approved-At: Wed, 13 Apr 2022 09:32:08 +0200 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Hi All, FOREACH_DEVICE_ON_VMBUS needs rte_vmbus_bus to work on If static link to libdpdk.a : no issues If dynamic link to *.so: linker issue, global variable not found. I suggest this patch to get a current rte_vmbus_bus struct: Thanks. diff --git a/dpdk-20.11/drivers/bus/vmbus/rte_bus_vmbus.h b/dpdk-20.11/drivers/bus/vmbus/rte_bus_vmbus.h --- a/dpdk-20.11/drivers/bus/vmbus/rte_bus_vmbus.h +++ b/dpdk-20.11/drivers/bus/vmbus/rte_bus_vmbus.h @@ -414,6 +414,16 @@ } \ RTE_PMD_EXPORT_NAME(nm, __COUNTER__) +/** + * Gets the global rte_vmbus_bus struct + * + * @param bus + * Pointer to rte_vmbus_bus structure. + * @return + * Return 0 if success. + */ +int rte_vmbus_get_bus(struct rte_vmbus_bus *bus); + #ifdef __cplusplus } #endif diff --git a/dpdk-20.11/drivers/bus/vmbus/version.map b/dpdk-20.11/drivers/bus/vmbus/version.map --- a/dpdk-20.11/drivers/bus/vmbus/version.map +++ b/dpdk-20.11/drivers/bus/vmbus/version.map @@ -23,6 +23,7 @@ rte_vmbus_subchan_open; rte_vmbus_unmap_device; rte_vmbus_unregister; + rte_vmbus_get_bus; local: *; }; diff --git a/dpdk-20.11/drivers/bus/vmbus/vmbus_common.c b/dpdk-20.11/drivers/bus/vmbus/vmbus_common.c --- a/dpdk-20.11/drivers/bus/vmbus/vmbus_common.c +++ b/dpdk-20.11/drivers/bus/vmbus/vmbus_common.c @@ -25,6 +25,17 @@ extern struct rte_vmbus_bus rte_vmbus_bus; +/* Gets the global rte_vmbus_bus struct*/ +int rte_vmbus_get_bus(struct rte_vmbus_bus *bus){ + + if (!bus) + return 1; + + memcpy(bus, &rte_vmbus_bus, sizeof(struct rte_vmbus_bus)); + + return 0; +} + /* map a particular resource from a file */ void * vmbus_map_resource(void *requested_addr, int fd, off_t offset, size_t size,