[v8,09/13] bus/dpaa: share qman portal ids as function calls

Message ID 20200515094752.28490-10-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.
qman caam and pool portal ids are only used in control
path. This patch changes their inter library access to
function call instead of direct shared variable.

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

---
 drivers/bus/dpaa/base/qbman/qman_driver.c | 10 ++++++++++
 drivers/bus/dpaa/include/fsl_qman.h       |  8 +++++++-
 drivers/bus/dpaa/rte_bus_dpaa_version.map |  4 ++--
 drivers/crypto/dpaa_sec/dpaa_sec.c        |  2 +-
 4 files changed, 20 insertions(+), 4 deletions(-)

-- 
2.17.1

Comments

Ray Kinsella May 19, 2020, 11:20 a.m. | #1
On 15/05/2020 10:47, Hemant Agrawal wrote:
> qman caam and pool portal ids are only used in control

> path. This patch changes their inter library access to

> function call instead of direct shared variable.

> 

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

> ---

>  drivers/bus/dpaa/base/qbman/qman_driver.c | 10 ++++++++++

>  drivers/bus/dpaa/include/fsl_qman.h       |  8 +++++++-

>  drivers/bus/dpaa/rte_bus_dpaa_version.map |  4 ++--

>  drivers/crypto/dpaa_sec/dpaa_sec.c        |  2 +-

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

> 

> diff --git a/drivers/bus/dpaa/base/qbman/qman_driver.c b/drivers/bus/dpaa/base/qbman/qman_driver.c

> index 69244ef701..1166d68e21 100644

> --- a/drivers/bus/dpaa/base/qbman/qman_driver.c

> +++ b/drivers/bus/dpaa/base/qbman/qman_driver.c

> @@ -30,6 +30,16 @@ static __thread struct dpaa_ioctl_portal_map map = {

>  	.type = dpaa_portal_qman

>  };

>  

> +u16 dpaa_get_qm_channel_caam(void)

> +{

> +	return qm_channel_caam;

> +}

> +

> +u16 dpaa_get_qm_channel_pool(void)

> +{

> +	return qm_channel_pool1;

> +}

> +

>  static int fsl_qman_portal_init(uint32_t index, int is_shared)

>  {

>  	struct qman_portal *portal;

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

> index 4411bb0a79..78b698f393 100644

> --- a/drivers/bus/dpaa/include/fsl_qman.h

> +++ b/drivers/bus/dpaa/include/fsl_qman.h

> @@ -44,6 +44,12 @@ enum qm_dc_portal {

>  	qm_dc_portal_pme = 3

>  };

>  

> +__rte_internal

> +u16 dpaa_get_qm_channel_caam(void);

> +

> +__rte_internal

> +u16 dpaa_get_qm_channel_pool(void);

> +

>  /* Portal processing (interrupt) sources */

>  #define QM_PIRQ_CCSCI	0x00200000	/* CEETM Congestion State Change */

>  #define QM_PIRQ_CSCI	0x00100000	/* Congestion State Change */

> @@ -65,7 +71,7 @@ enum qm_dc_portal {

>  /* for conversion from n of qm_channel */

>  static inline u32 QM_SDQCR_CHANNELS_POOL_CONV(u16 channel)

>  {

> -	return QM_SDQCR_CHANNELS_POOL(channel + 1 - qm_channel_pool1);

> +	return QM_SDQCR_CHANNELS_POOL(channel + 1 - dpaa_get_qm_channel_pool());

>  }

>  

>  /* For qman_volatile_dequeue(); Choose one PRECEDENCE. EXACT is optional. Use

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

> index 53732289d3..8bb2757e04 100644

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

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

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

>  	bman_query_free_buffers;

>  	bman_release;

>  	bman_thread_irq;

> +	dpaa_get_qm_channel_caam;

> +	dpaa_get_qm_channel_pool;

>  	dpaa_logtype_eventdev;

>  	dpaa_logtype_mempool;

>  	dpaa_logtype_pmd;

> @@ -50,8 +52,6 @@ INTERNAL {

>  	netcfg_release;

>  	per_lcore_dpaa_io;

>  	per_lcore_held_bufs;

> -	qm_channel_caam;

> -	qm_channel_pool1;

>  	qman_alloc_cgrid_range;

>  	qman_alloc_pool_range;

>  	qman_clear_irq;

> diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c

> index 25dcbd259a..4af9024a00 100644

> --- a/drivers/crypto/dpaa_sec/dpaa_sec.c

> +++ b/drivers/crypto/dpaa_sec/dpaa_sec.c

> @@ -123,7 +123,7 @@ dpaa_sec_init_rx(struct qman_fq *fq_in, rte_iova_t hwdesc,

>  

>  	qm_fqd_context_a_set64(&fq_opts.fqd, hwdesc);

>  	fq_opts.fqd.context_b = fqid_out;

> -	fq_opts.fqd.dest.channel = qm_channel_caam;

> +	fq_opts.fqd.dest.channel = dpaa_get_qm_channel_caam();

>  	fq_opts.fqd.dest.wq = 0;

>  

>  	fq_in->cb.ern  = ern_sec_fq_handler;

>

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

Patch

diff --git a/drivers/bus/dpaa/base/qbman/qman_driver.c b/drivers/bus/dpaa/base/qbman/qman_driver.c
index 69244ef701..1166d68e21 100644
--- a/drivers/bus/dpaa/base/qbman/qman_driver.c
+++ b/drivers/bus/dpaa/base/qbman/qman_driver.c
@@ -30,6 +30,16 @@  static __thread struct dpaa_ioctl_portal_map map = {
 	.type = dpaa_portal_qman
 };
 
+u16 dpaa_get_qm_channel_caam(void)
+{
+	return qm_channel_caam;
+}
+
+u16 dpaa_get_qm_channel_pool(void)
+{
+	return qm_channel_pool1;
+}
+
 static int fsl_qman_portal_init(uint32_t index, int is_shared)
 {
 	struct qman_portal *portal;
diff --git a/drivers/bus/dpaa/include/fsl_qman.h b/drivers/bus/dpaa/include/fsl_qman.h
index 4411bb0a79..78b698f393 100644
--- a/drivers/bus/dpaa/include/fsl_qman.h
+++ b/drivers/bus/dpaa/include/fsl_qman.h
@@ -44,6 +44,12 @@  enum qm_dc_portal {
 	qm_dc_portal_pme = 3
 };
 
+__rte_internal
+u16 dpaa_get_qm_channel_caam(void);
+
+__rte_internal
+u16 dpaa_get_qm_channel_pool(void);
+
 /* Portal processing (interrupt) sources */
 #define QM_PIRQ_CCSCI	0x00200000	/* CEETM Congestion State Change */
 #define QM_PIRQ_CSCI	0x00100000	/* Congestion State Change */
@@ -65,7 +71,7 @@  enum qm_dc_portal {
 /* for conversion from n of qm_channel */
 static inline u32 QM_SDQCR_CHANNELS_POOL_CONV(u16 channel)
 {
-	return QM_SDQCR_CHANNELS_POOL(channel + 1 - qm_channel_pool1);
+	return QM_SDQCR_CHANNELS_POOL(channel + 1 - dpaa_get_qm_channel_pool());
 }
 
 /* For qman_volatile_dequeue(); Choose one PRECEDENCE. EXACT is optional. Use
diff --git a/drivers/bus/dpaa/rte_bus_dpaa_version.map b/drivers/bus/dpaa/rte_bus_dpaa_version.map
index 53732289d3..8bb2757e04 100644
--- a/drivers/bus/dpaa/rte_bus_dpaa_version.map
+++ b/drivers/bus/dpaa/rte_bus_dpaa_version.map
@@ -12,6 +12,8 @@  INTERNAL {
 	bman_query_free_buffers;
 	bman_release;
 	bman_thread_irq;
+	dpaa_get_qm_channel_caam;
+	dpaa_get_qm_channel_pool;
 	dpaa_logtype_eventdev;
 	dpaa_logtype_mempool;
 	dpaa_logtype_pmd;
@@ -50,8 +52,6 @@  INTERNAL {
 	netcfg_release;
 	per_lcore_dpaa_io;
 	per_lcore_held_bufs;
-	qm_channel_caam;
-	qm_channel_pool1;
 	qman_alloc_cgrid_range;
 	qman_alloc_pool_range;
 	qman_clear_irq;
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
index 25dcbd259a..4af9024a00 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -123,7 +123,7 @@  dpaa_sec_init_rx(struct qman_fq *fq_in, rte_iova_t hwdesc,
 
 	qm_fqd_context_a_set64(&fq_opts.fqd, hwdesc);
 	fq_opts.fqd.context_b = fqid_out;
-	fq_opts.fqd.dest.channel = qm_channel_caam;
+	fq_opts.fqd.dest.channel = dpaa_get_qm_channel_caam();
 	fq_opts.fqd.dest.wq = 0;
 
 	fq_in->cb.ern  = ern_sec_fq_handler;