* [PATCH] vmbus: get current rte_vmbus_bus struct
@ 2022-04-11 14:54 Abdelfattah Chehab
2022-04-13 8:10 ` David Marchand
0 siblings, 1 reply; 4+ messages in thread
From: Abdelfattah Chehab @ 2022-04-11 14:54 UTC (permalink / raw)
To: dev; +Cc: stable
[-- Attachment #1: Type: text/plain, Size: 1922 bytes --]
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,
[-- Attachment #2: Type: text/html, Size: 6904 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] vmbus: get current rte_vmbus_bus struct
2022-04-11 14:54 [PATCH] vmbus: get current rte_vmbus_bus struct Abdelfattah Chehab
@ 2022-04-13 8:10 ` David Marchand
2022-04-14 9:58 ` Abdelfattah Chehab
0 siblings, 1 reply; 4+ messages in thread
From: David Marchand @ 2022-04-13 8:10 UTC (permalink / raw)
To: Abdelfattah Chehab; +Cc: dev, stable
On Wed, Apr 13, 2022 at 9:32 AM Abdelfattah Chehab
<abdelfattah.chehab-ext@ekinops.com> wrote:
>
> 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.
Not sure I really get your usecase, but this probably is a linking
issue on your side.
--
David Marchand
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] vmbus: get current rte_vmbus_bus struct
2022-04-13 8:10 ` David Marchand
@ 2022-04-14 9:58 ` Abdelfattah Chehab
2022-07-09 7:54 ` David Marchand
0 siblings, 1 reply; 4+ messages in thread
From: Abdelfattah Chehab @ 2022-04-14 9:58 UTC (permalink / raw)
To: David Marchand; +Cc: dev, stable
The global variable is not accessible from libdpdk.so
I don't really see how the linker can find it in this case.
-----Original Message-----
From: David Marchand <david.marchand@redhat.com>
Sent: 13 April 2022 10:11
To: Abdelfattah Chehab <abdelfattah.chehab-ext@ekinops.com>
Cc: dev@dpdk.org; stable@dpdk.org
Subject: Re: [PATCH] vmbus: get current rte_vmbus_bus struct
On Wed, Apr 13, 2022 at 9:32 AM Abdelfattah Chehab <abdelfattah.chehab-ext@ekinops.com> wrote:
>
> 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.
Not sure I really get your usecase, but this probably is a linking issue on your side.
--
David Marchand
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] vmbus: get current rte_vmbus_bus struct
2022-04-14 9:58 ` Abdelfattah Chehab
@ 2022-07-09 7:54 ` David Marchand
0 siblings, 0 replies; 4+ messages in thread
From: David Marchand @ 2022-07-09 7:54 UTC (permalink / raw)
To: Abdelfattah Chehab; +Cc: dev, stable
On Thu, Apr 14, 2022 at 11:58 AM Abdelfattah Chehab
<abdelfattah.chehab-ext@ekinops.com> wrote:
>
> The global variable is not accessible from libdpdk.so
> I don't really see how the linker can find it in this case.
Well, the initial mail was missing a description of the problem.
The patch is badly formatted and sent against 20.11, I did not read it.
The code for iterating over a bus specific object is internal.
We will probably remove this iterator macro from the public API in 22.11.
--
David Marchand
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-07-09 7:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-11 14:54 [PATCH] vmbus: get current rte_vmbus_bus struct Abdelfattah Chehab
2022-04-13 8:10 ` David Marchand
2022-04-14 9:58 ` Abdelfattah Chehab
2022-07-09 7:54 ` David Marchand
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).