patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Abdelfattah Chehab <abdelfattah.chehab-ext@ekinops.com>
To: "dev@dpdk.org" <dev@dpdk.org>
Cc: "stable@dpdk.org" <stable@dpdk.org>
Subject: [PATCH] vmbus: get current rte_vmbus_bus struct
Date: Mon, 11 Apr 2022 14:54:59 +0000	[thread overview]
Message-ID: <PR1P264MB2030EB80D45C19826E935ADFDFEA9@PR1P264MB2030.FRAP264.PROD.OUTLOOK.COM> (raw)

[-- 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 --]

             reply	other threads:[~2022-04-13  7:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-11 14:54 Abdelfattah Chehab [this message]
2022-04-13  8:10 ` David Marchand
2022-04-14  9:58   ` Abdelfattah Chehab
2022-07-09  7:54     ` David Marchand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=PR1P264MB2030EB80D45C19826E935ADFDFEA9@PR1P264MB2030.FRAP264.PROD.OUTLOOK.COM \
    --to=abdelfattah.chehab-ext@ekinops.com \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).