[RFC,19.11,2/2] ethdev: hide DPDK internal struct from public API

Message ID 20190730124950.1293-3-marcinx.a.zapolski@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers
Series Hide DPDK internal struct from public API |

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Marcin Zapolski July 30, 2019, 12:49 p.m. UTC
  Remove rte_eth_dev, rte_eth_dev_data and rte_eth_dev_ops from
public API (make rte_ethdev_core APIs private). They are DPDK internal
structures and as such should not be accessed by user applications
directly.

Signed-off-by: Marcin Zapolski <marcinx.a.zapolski@intel.com>
---
 drivers/net/cxgbe/base/adapter.h               | 1 +
 drivers/net/netvsc/hn_nvs.c                    | 1 +
 drivers/net/netvsc/hn_rxtx.c                   | 1 +
 lib/librte_ethdev/ethdev_private.h             | 1 +
 lib/librte_ethdev/ethdev_profile.h             | 1 +
 lib/librte_ethdev/rte_ethdev.h                 | 3 ---
 lib/librte_ethdev/rte_ethdev_driver.h          | 1 +
 lib/librte_ethdev/rte_flow.c                   | 1 +
 lib/librte_ethdev/rte_flow_driver.h            | 1 +
 lib/librte_ethdev/rte_mtr.c                    | 1 +
 lib/librte_ethdev/rte_mtr_driver.h             | 1 +
 lib/librte_ethdev/rte_tm.c                     | 1 +
 lib/librte_ethdev/rte_tm_driver.h              | 1 +
 lib/librte_eventdev/rte_event_eth_rx_adapter.c | 1 +
 lib/librte_eventdev/rte_event_eth_tx_adapter.c | 1 +
 lib/librte_eventdev/rte_eventdev.c             | 1 +
 lib/librte_telemetry/rte_telemetry.c           | 1 +
 17 files changed, 16 insertions(+), 3 deletions(-)
  

Comments

Ferruh Yigit July 30, 2019, 2:53 p.m. UTC | #1
On 7/30/2019 1:49 PM, Marcin Zapolski wrote:
> Remove rte_eth_dev, rte_eth_dev_data and rte_eth_dev_ops from
> public API (make rte_ethdev_core APIs private). They are DPDK internal
> structures and as such should not be accessed by user applications
> directly.
> 
> Signed-off-by: Marcin Zapolski <marcinx.a.zapolski@intel.com>

Hi Marcin,

"rte_ethdev_core.h" has been created explicitly to hold the code that should be
private but needs to be public because of the static inline functions.

Since static inline functions removed, I think we should remove
"rte_ethdev_core.h" too.

And split its content to "ethdev_private.h" & "rte_ethdev_driver.h".
I didn't investigate details but code should go as much as possible to
"ethdev_private.h" and if it has to it should go to "rte_ethdev_driver.h"
  

Patch

diff --git a/drivers/net/cxgbe/base/adapter.h b/drivers/net/cxgbe/base/adapter.h
index e548f9f63..f303030ab 100644
--- a/drivers/net/cxgbe/base/adapter.h
+++ b/drivers/net/cxgbe/base/adapter.h
@@ -13,6 +13,7 @@ 
 #include <rte_io.h>
 #include <rte_rwlock.h>
 #include <rte_ethdev.h>
+#include <rte_ethdev_driver.h>
 
 #include "../cxgbe_compat.h"
 #include "../cxgbe_ofld.h"
diff --git a/drivers/net/netvsc/hn_nvs.c b/drivers/net/netvsc/hn_nvs.c
index 6b518685a..1c1a5cf05 100644
--- a/drivers/net/netvsc/hn_nvs.c
+++ b/drivers/net/netvsc/hn_nvs.c
@@ -17,6 +17,7 @@ 
 #include <unistd.h>
 
 #include <rte_ethdev.h>
+#include <rte_ethdev_driver.h>
 #include <rte_string_fns.h>
 #include <rte_memzone.h>
 #include <rte_malloc.h>
diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c
index 7212780c1..d744976dc 100644
--- a/drivers/net/netvsc/hn_rxtx.c
+++ b/drivers/net/netvsc/hn_rxtx.c
@@ -13,6 +13,7 @@ 
 #include <malloc.h>
 
 #include <rte_ethdev.h>
+#include <rte_ethdev_driver.h>
 #include <rte_memcpy.h>
 #include <rte_string_fns.h>
 #include <rte_memzone.h>
diff --git a/lib/librte_ethdev/ethdev_private.h b/lib/librte_ethdev/ethdev_private.h
index 7b787bf97..9dca7600b 100644
--- a/lib/librte_ethdev/ethdev_private.h
+++ b/lib/librte_ethdev/ethdev_private.h
@@ -6,6 +6,7 @@ 
 #define _RTE_ETH_PRIVATE_H_
 
 #include "rte_ethdev.h"
+#include "rte_ethdev_core.h"
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/lib/librte_ethdev/ethdev_profile.h b/lib/librte_ethdev/ethdev_profile.h
index 65031e6f3..99edb96b0 100644
--- a/lib/librte_ethdev/ethdev_profile.h
+++ b/lib/librte_ethdev/ethdev_profile.h
@@ -6,6 +6,7 @@ 
 #define _RTE_ETHDEV_PROFILE_H_
 
 #include "rte_ethdev.h"
+#include "rte_ethdev_core.h"
 
 /**
  * Initialization of the Ethernet device profiling.
diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
index 3438cb681..a8559ca2d 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -3993,9 +3993,6 @@  rte_eth_dev_pool_ops_supported(uint16_t port_id, const char *pool);
 void *
 rte_eth_dev_get_sec_ctx(uint16_t port_id);
 
-
-#include <rte_ethdev_core.h>
-
 /**
  *
  * Retrieve a burst of input packets from a receive queue of an Ethernet
diff --git a/lib/librte_ethdev/rte_ethdev_driver.h b/lib/librte_ethdev/rte_ethdev_driver.h
index 936ff8c98..be6720949 100644
--- a/lib/librte_ethdev/rte_ethdev_driver.h
+++ b/lib/librte_ethdev/rte_ethdev_driver.h
@@ -16,6 +16,7 @@ 
  */
 
 #include <rte_ethdev.h>
+#include <rte_ethdev_core.h>
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c
index 18fcb018e..1ecc03fef 100644
--- a/lib/librte_ethdev/rte_flow.c
+++ b/lib/librte_ethdev/rte_flow.c
@@ -13,6 +13,7 @@ 
 #include <rte_branch_prediction.h>
 #include <rte_string_fns.h>
 #include "rte_ethdev.h"
+#include "rte_ethdev_core.h"
 #include "rte_flow_driver.h"
 #include "rte_flow.h"
 
diff --git a/lib/librte_ethdev/rte_flow_driver.h b/lib/librte_ethdev/rte_flow_driver.h
index a0359853e..ad6eb7b5a 100644
--- a/lib/librte_ethdev/rte_flow_driver.h
+++ b/lib/librte_ethdev/rte_flow_driver.h
@@ -18,6 +18,7 @@ 
 #include <stdint.h>
 
 #include "rte_ethdev.h"
+#include "rte_ethdev_core.h"
 #include "rte_flow.h"
 
 #ifdef __cplusplus
diff --git a/lib/librte_ethdev/rte_mtr.c b/lib/librte_ethdev/rte_mtr.c
index 3073ac03f..485489262 100644
--- a/lib/librte_ethdev/rte_mtr.c
+++ b/lib/librte_ethdev/rte_mtr.c
@@ -7,6 +7,7 @@ 
 #include <rte_errno.h>
 #include "rte_compat.h"
 #include "rte_ethdev.h"
+#include "rte_ethdev_core.h"
 #include "rte_mtr_driver.h"
 #include "rte_mtr.h"
 
diff --git a/lib/librte_ethdev/rte_mtr_driver.h b/lib/librte_ethdev/rte_mtr_driver.h
index 3ec7ffa2a..2fae4cace 100644
--- a/lib/librte_ethdev/rte_mtr_driver.h
+++ b/lib/librte_ethdev/rte_mtr_driver.h
@@ -18,6 +18,7 @@ 
 
 #include <rte_errno.h>
 #include "rte_ethdev.h"
+#include "rte_ethdev_core.h"
 #include "rte_mtr.h"
 
 #ifdef __cplusplus
diff --git a/lib/librte_ethdev/rte_tm.c b/lib/librte_ethdev/rte_tm.c
index 9709454f3..b32329060 100644
--- a/lib/librte_ethdev/rte_tm.c
+++ b/lib/librte_ethdev/rte_tm.c
@@ -6,6 +6,7 @@ 
 
 #include <rte_errno.h>
 #include "rte_ethdev.h"
+#include "rte_ethdev_core.h"
 #include "rte_tm_driver.h"
 #include "rte_tm.h"
 
diff --git a/lib/librte_ethdev/rte_tm_driver.h b/lib/librte_ethdev/rte_tm_driver.h
index 90114ff53..675e0c371 100644
--- a/lib/librte_ethdev/rte_tm_driver.h
+++ b/lib/librte_ethdev/rte_tm_driver.h
@@ -18,6 +18,7 @@ 
 
 #include <rte_errno.h>
 #include "rte_ethdev.h"
+#include "rte_ethdev_core.h"
 #include "rte_tm.h"
 
 #ifdef __cplusplus
diff --git a/lib/librte_eventdev/rte_event_eth_rx_adapter.c b/lib/librte_eventdev/rte_event_eth_rx_adapter.c
index 95dd47820..b0b642eb6 100644
--- a/lib/librte_eventdev/rte_event_eth_rx_adapter.c
+++ b/lib/librte_eventdev/rte_event_eth_rx_adapter.c
@@ -12,6 +12,7 @@ 
 #include <rte_dev.h>
 #include <rte_errno.h>
 #include <rte_ethdev.h>
+#include <rte_ethdev_core.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
 #include <rte_service_component.h>
diff --git a/lib/librte_eventdev/rte_event_eth_tx_adapter.c b/lib/librte_eventdev/rte_event_eth_tx_adapter.c
index d02ef57f4..52f3f3c55 100644
--- a/lib/librte_eventdev/rte_event_eth_tx_adapter.c
+++ b/lib/librte_eventdev/rte_event_eth_tx_adapter.c
@@ -4,6 +4,7 @@ 
 #include <rte_spinlock.h>
 #include <rte_service_component.h>
 #include <rte_ethdev.h>
+#include <rte_ethdev_core.h>
 
 #include "rte_eventdev_pmd.h"
 #include "rte_event_eth_tx_adapter.h"
diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c
index f44c869cb..d29a8d7d9 100644
--- a/lib/librte_eventdev/rte_eventdev.c
+++ b/lib/librte_eventdev/rte_eventdev.c
@@ -30,6 +30,7 @@ 
 #include <rte_malloc.h>
 #include <rte_errno.h>
 #include <rte_ethdev.h>
+#include <rte_ethdev_core.h>
 #include <rte_cryptodev.h>
 #include <rte_cryptodev_pmd.h>
 
diff --git a/lib/librte_telemetry/rte_telemetry.c b/lib/librte_telemetry/rte_telemetry.c
index eb20cc651..a544728e1 100644
--- a/lib/librte_telemetry/rte_telemetry.c
+++ b/lib/librte_telemetry/rte_telemetry.c
@@ -11,6 +11,7 @@ 
 
 #include <rte_eal.h>
 #include <rte_ethdev.h>
+#include <rte_ethdev_core.h>
 #include <rte_metrics.h>
 #include <rte_option.h>
 #include <rte_string_fns.h>