[v8,11/13] bus/dpaa: change netcfg access as function

Message ID 20200515094752.28490-12-hemant.agrawal@nxp.com
State New
Headers show
Series
  • NXP DPAAx: move internal symbols to INTERNAL
Related show

Commit Message

Hemant Agrawal May 15, 2020, 9:47 a.m.
This patch changes the export of fman port config
as function call instead of direct variable access.
This is in control path, so it will not impact perf.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>

---
 drivers/bus/dpaa/dpaa_bus.c               | 6 ++++++
 drivers/bus/dpaa/rte_bus_dpaa_version.map | 1 +
 drivers/bus/dpaa/rte_dpaa_bus.h           | 6 +++---
 drivers/net/dpaa/dpaa_ethdev.c            | 2 +-
 4 files changed, 11 insertions(+), 4 deletions(-)

-- 
2.17.1

Comments

Ray Kinsella May 19, 2020, 11:22 a.m. | #1
On 15/05/2020 10:47, Hemant Agrawal wrote:
> This patch changes the export of fman port config

> as function call instead of direct variable access.

> This is in control path, so it will not impact perf.

> 

> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>

> ---

>  drivers/bus/dpaa/dpaa_bus.c               | 6 ++++++

>  drivers/bus/dpaa/rte_bus_dpaa_version.map | 1 +

>  drivers/bus/dpaa/rte_dpaa_bus.h           | 6 +++---

>  drivers/net/dpaa/dpaa_ethdev.c            | 2 +-

>  4 files changed, 11 insertions(+), 4 deletions(-)

> 

> diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c

> index 41d42b0c30..d53fe6083a 100644

> --- a/drivers/bus/dpaa/dpaa_bus.c

> +++ b/drivers/bus/dpaa/dpaa_bus.c

> @@ -57,6 +57,12 @@ unsigned int dpaa_svr_family;

>  RTE_DEFINE_PER_LCORE(bool, dpaa_io);

>  RTE_DEFINE_PER_LCORE(struct dpaa_portal_dqrr, held_bufs);

>  

> +struct fm_eth_port_cfg *

> +dpaa_get_eth_port_cfg(int dev_id)

> +{

> +	return &dpaa_netcfg->port_cfg[dev_id];

> +}

> +

>  static int

>  compare_dpaa_devices(struct rte_dpaa_device *dev1,

>  		     struct rte_dpaa_device *dev2)

> diff --git a/drivers/bus/dpaa/rte_bus_dpaa_version.map b/drivers/bus/dpaa/rte_bus_dpaa_version.map

> index e53e8fa222..46d42f7d64 100644

> --- a/drivers/bus/dpaa/rte_bus_dpaa_version.map

> +++ b/drivers/bus/dpaa/rte_bus_dpaa_version.map

> @@ -12,6 +12,7 @@ INTERNAL {

>  	bman_query_free_buffers;

>  	bman_release;

>  	bman_thread_irq;

> +	dpaa_get_eth_port_cfg;

>  	dpaa_get_qm_channel_caam;

>  	dpaa_get_qm_channel_pool;

>  	dpaa_svr_family;

> diff --git a/drivers/bus/dpaa/rte_dpaa_bus.h b/drivers/bus/dpaa/rte_dpaa_bus.h

> index d4aee132ef..2a186d83fb 100644

> --- a/drivers/bus/dpaa/rte_dpaa_bus.h

> +++ b/drivers/bus/dpaa/rte_dpaa_bus.h

> @@ -44,9 +44,6 @@ struct rte_dpaa_driver;

>  TAILQ_HEAD(rte_dpaa_device_list, rte_dpaa_device);

>  TAILQ_HEAD(rte_dpaa_driver_list, rte_dpaa_driver);

>  

> -/* Configuration variables exported from DPAA bus */

> -extern struct netcfg_info *dpaa_netcfg;

> -

>  enum rte_dpaa_type {

>  	FSL_DPAA_ETH = 1,

>  	FSL_DPAA_CRYPTO,

> @@ -217,6 +214,9 @@ RTE_DECLARE_PER_LCORE(struct dpaa_portal_dqrr, held_bufs);

>  #define DPAA_PER_LCORE_DQRR_HELD       RTE_PER_LCORE(held_bufs).dqrr_held

>  #define DPAA_PER_LCORE_DQRR_MBUF(i)    RTE_PER_LCORE(held_bufs).mbuf[i]

>  

> +__rte_internal

> +struct fm_eth_port_cfg *dpaa_get_eth_port_cfg(int dev_id);

> +

>  #ifdef __cplusplus

>  }

>  #endif

> diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c

> index c97f3042be..13d1c6a1fc 100644

> --- a/drivers/net/dpaa/dpaa_ethdev.c

> +++ b/drivers/net/dpaa/dpaa_ethdev.c

> @@ -1332,7 +1332,7 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)

>  	dpaa_device = DEV_TO_DPAA_DEVICE(eth_dev->device);

>  	dev_id = dpaa_device->id.dev_id;

>  	dpaa_intf = eth_dev->data->dev_private;

> -	cfg = &dpaa_netcfg->port_cfg[dev_id];

> +	cfg = dpaa_get_eth_port_cfg(dev_id);

>  	fman_intf = cfg->fman_if;

>  

>  	dpaa_intf->name = dpaa_device->name;

> 

Acked-by: Ray Kinsella <mdr@ashroe.eu>

Patch

diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index 41d42b0c30..d53fe6083a 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -57,6 +57,12 @@  unsigned int dpaa_svr_family;
 RTE_DEFINE_PER_LCORE(bool, dpaa_io);
 RTE_DEFINE_PER_LCORE(struct dpaa_portal_dqrr, held_bufs);
 
+struct fm_eth_port_cfg *
+dpaa_get_eth_port_cfg(int dev_id)
+{
+	return &dpaa_netcfg->port_cfg[dev_id];
+}
+
 static int
 compare_dpaa_devices(struct rte_dpaa_device *dev1,
 		     struct rte_dpaa_device *dev2)
diff --git a/drivers/bus/dpaa/rte_bus_dpaa_version.map b/drivers/bus/dpaa/rte_bus_dpaa_version.map
index e53e8fa222..46d42f7d64 100644
--- a/drivers/bus/dpaa/rte_bus_dpaa_version.map
+++ b/drivers/bus/dpaa/rte_bus_dpaa_version.map
@@ -12,6 +12,7 @@  INTERNAL {
 	bman_query_free_buffers;
 	bman_release;
 	bman_thread_irq;
+	dpaa_get_eth_port_cfg;
 	dpaa_get_qm_channel_caam;
 	dpaa_get_qm_channel_pool;
 	dpaa_svr_family;
diff --git a/drivers/bus/dpaa/rte_dpaa_bus.h b/drivers/bus/dpaa/rte_dpaa_bus.h
index d4aee132ef..2a186d83fb 100644
--- a/drivers/bus/dpaa/rte_dpaa_bus.h
+++ b/drivers/bus/dpaa/rte_dpaa_bus.h
@@ -44,9 +44,6 @@  struct rte_dpaa_driver;
 TAILQ_HEAD(rte_dpaa_device_list, rte_dpaa_device);
 TAILQ_HEAD(rte_dpaa_driver_list, rte_dpaa_driver);
 
-/* Configuration variables exported from DPAA bus */
-extern struct netcfg_info *dpaa_netcfg;
-
 enum rte_dpaa_type {
 	FSL_DPAA_ETH = 1,
 	FSL_DPAA_CRYPTO,
@@ -217,6 +214,9 @@  RTE_DECLARE_PER_LCORE(struct dpaa_portal_dqrr, held_bufs);
 #define DPAA_PER_LCORE_DQRR_HELD       RTE_PER_LCORE(held_bufs).dqrr_held
 #define DPAA_PER_LCORE_DQRR_MBUF(i)    RTE_PER_LCORE(held_bufs).mbuf[i]
 
+__rte_internal
+struct fm_eth_port_cfg *dpaa_get_eth_port_cfg(int dev_id);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index c97f3042be..13d1c6a1fc 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -1332,7 +1332,7 @@  dpaa_dev_init(struct rte_eth_dev *eth_dev)
 	dpaa_device = DEV_TO_DPAA_DEVICE(eth_dev->device);
 	dev_id = dpaa_device->id.dev_id;
 	dpaa_intf = eth_dev->data->dev_private;
-	cfg = &dpaa_netcfg->port_cfg[dev_id];
+	cfg = dpaa_get_eth_port_cfg(dev_id);
 	fman_intf = cfg->fman_if;
 
 	dpaa_intf->name = dpaa_device->name;