]> git.droids-corp.org - dpdk.git/commitdiff
eal: add internal function to get base address
authorSrikanth Yalavarthi <syalavarthi@marvell.com>
Tue, 18 Jan 2022 13:33:40 +0000 (05:33 -0800)
committerThomas Monjalon <thomas@monjalon.net>
Tue, 8 Feb 2022 22:59:10 +0000 (23:59 +0100)
Added an internal helper to get OS-specific EAL mapping base address

This helper can be used by the drivers to program offload / accelerator
devices, where the base address can be used as a reference address by
the accelerator to access the host memory

An address can also be represented as an offset relative to the base
address using smaller data types

Signed-off-by: Srikanth Yalavarthi <syalavarthi@marvell.com>
Acked-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
lib/eal/common/eal_common_config.c
lib/eal/include/rte_eal.h
lib/eal/version.map

index 1c4c4dd585d08ffd7dc12c47d49a89daf93ac073..6d19aadb20574d75eb9ba5314cf44d95d01f4229 100644 (file)
@@ -62,6 +62,15 @@ rte_eal_iova_mode(void)
        return rte_eal_get_configuration()->iova_mode;
 }
 
+/* Get the EAL base address */
+uint64_t
+rte_eal_get_baseaddr(void)
+{
+       return (internal_config.base_virtaddr != 0) ?
+                      (uint64_t) internal_config.base_virtaddr :
+                      eal_get_baseaddr();
+}
+
 enum rte_proc_type_t
 rte_eal_process_type(void)
 {
index 5a34a6acd9d9e794bf502e172ace95de61e12a34..5dfc50e9879b411e4b95ea7119742629993fa4cb 100644 (file)
@@ -449,6 +449,15 @@ static inline int rte_gettid(void)
        return RTE_PER_LCORE(_thread_id);
 }
 
+/**
+ * Get the OS-specific EAL base address.
+ *
+ * @return
+ *    The base address.
+ */
+__rte_internal
+uint64_t rte_eal_get_baseaddr(void);
+
 /**
  * Get the iova mode
  *
index ab28c2279150d5ac9e7cca6cfaea78bdb62b04dc..b53eeb30d74f43f49584926b182882cc6147225b 100644 (file)
@@ -425,6 +425,7 @@ EXPERIMENTAL {
 INTERNAL {
        global:
 
+       rte_eal_get_baseaddr;
        rte_firmware_read;
        rte_intr_allow_others;
        rte_intr_cap_multiple;