[v4,1/3] net/enetc: add macro for BD ring alignment

Message ID 20191021105027.14792-2-g.singh@nxp.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers
Series enetc PMD specific changes |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-intel-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-compilation success Compile Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS

Commit Message

Gagandeep Singh Oct. 21, 2019, 10:50 a.m. UTC
  enetc BD rings should be aligned to 128
instead of RTE_CACHE_LINE_SIZE.

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
---
 drivers/net/enetc/base/enetc_hw.h | 3 +++
 drivers/net/enetc/enetc_ethdev.c  | 8 ++++----
 2 files changed, 7 insertions(+), 4 deletions(-)
  

Comments

Ferruh Yigit Oct. 21, 2019, 3:54 p.m. UTC | #1
On 10/21/2019 11:50 AM, Gagandeep Singh wrote:
> enetc BD rings should be aligned to 128
> instead of RTE_CACHE_LINE_SIZE.

This looks like a fix, if so can you please update commit log according, via
fixes line etc..

> 
> Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
> ---
>  drivers/net/enetc/base/enetc_hw.h | 3 +++
>  drivers/net/enetc/enetc_ethdev.c  | 8 ++++----
>  2 files changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/enetc/base/enetc_hw.h b/drivers/net/enetc/base/enetc_hw.h
> index fd71155ee..2fe7ccb5b 100644
> --- a/drivers/net/enetc/base/enetc_hw.h
> +++ b/drivers/net/enetc/base/enetc_hw.h
> @@ -12,6 +12,9 @@
>  #define ENETC_DEV_ID_VF		0xef00
>  #define ENETC_DEV_ID		0xe100
>  
> +/* BD RING ALIGNMENT */
> +#define ENETC_BD_RING_ALIGN	128
> +
>  /* ENETC register block BAR */
>  #define ENETC_BAR_REGS			0x0
>  
> diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c
> index dc05c00ff..4e978348c 100644
> --- a/drivers/net/enetc/enetc_ethdev.c
> +++ b/drivers/net/enetc/enetc_ethdev.c
> @@ -178,12 +178,12 @@ enetc_alloc_txbdr(struct enetc_bdr *txr, uint16_t nb_desc)
>  	int size;
>  
>  	size = nb_desc * sizeof(struct enetc_swbd);
> -	txr->q_swbd = rte_malloc(NULL, size, RTE_CACHE_LINE_SIZE);
> +	txr->q_swbd = rte_malloc(NULL, size, ENETC_BD_RING_ALIGN);
>  	if (txr->q_swbd == NULL)
>  		return -ENOMEM;
>  
>  	size = nb_desc * sizeof(struct enetc_tx_bd);
> -	txr->bd_base = rte_malloc(NULL, size, RTE_CACHE_LINE_SIZE);
> +	txr->bd_base = rte_malloc(NULL, size, ENETC_BD_RING_ALIGN);
>  	if (txr->bd_base == NULL) {
>  		rte_free(txr->q_swbd);
>  		txr->q_swbd = NULL;
> @@ -325,12 +325,12 @@ enetc_alloc_rxbdr(struct enetc_bdr *rxr,
>  	int size;
>  
>  	size = nb_rx_desc * sizeof(struct enetc_swbd);
> -	rxr->q_swbd = rte_malloc(NULL, size, RTE_CACHE_LINE_SIZE);
> +	rxr->q_swbd = rte_malloc(NULL, size, ENETC_BD_RING_ALIGN);
>  	if (rxr->q_swbd == NULL)
>  		return -ENOMEM;
>  
>  	size = nb_rx_desc * sizeof(union enetc_rx_bd);
> -	rxr->bd_base = rte_malloc(NULL, size, RTE_CACHE_LINE_SIZE);
> +	rxr->bd_base = rte_malloc(NULL, size, ENETC_BD_RING_ALIGN);
>  	if (rxr->bd_base == NULL) {
>  		rte_free(rxr->q_swbd);
>  		rxr->q_swbd = NULL;
>
  
Gagandeep Singh Oct. 22, 2019, 5:32 a.m. UTC | #2
> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@intel.com>
> Sent: Monday, October 21, 2019 9:24 PM
> To: Gagandeep Singh <G.Singh@nxp.com>; dev@dpdk.org
> Subject: Re: [PATCH v4 1/3] net/enetc: add macro for BD ring alignment
> 
> On 10/21/2019 11:50 AM, Gagandeep Singh wrote:
> > enetc BD rings should be aligned to 128
> > instead of RTE_CACHE_LINE_SIZE.
> 
> This looks like a fix, if so can you please update commit log according, via
> fixes line etc..
> 
Yes, this is kind a bug fix, I will add the fixes line.

> >
> > Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
> > ---
> >  drivers/net/enetc/base/enetc_hw.h | 3 +++
> >  drivers/net/enetc/enetc_ethdev.c  | 8 ++++----
> >  2 files changed, 7 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/net/enetc/base/enetc_hw.h
> b/drivers/net/enetc/base/enetc_hw.h
> > index fd71155ee..2fe7ccb5b 100644
> > --- a/drivers/net/enetc/base/enetc_hw.h
> > +++ b/drivers/net/enetc/base/enetc_hw.h
> > @@ -12,6 +12,9 @@
> >  #define ENETC_DEV_ID_VF		0xef00
> >  #define ENETC_DEV_ID		0xe100
> >
> > +/* BD RING ALIGNMENT */
> > +#define ENETC_BD_RING_ALIGN	128
> > +
> >  /* ENETC register block BAR */
> >  #define ENETC_BAR_REGS			0x0
> >
> > diff --git a/drivers/net/enetc/enetc_ethdev.c
> b/drivers/net/enetc/enetc_ethdev.c
> > index dc05c00ff..4e978348c 100644
> > --- a/drivers/net/enetc/enetc_ethdev.c
> > +++ b/drivers/net/enetc/enetc_ethdev.c
> > @@ -178,12 +178,12 @@ enetc_alloc_txbdr(struct enetc_bdr *txr, uint16_t
> nb_desc)
> >  	int size;
> >
> >  	size = nb_desc * sizeof(struct enetc_swbd);
> > -	txr->q_swbd = rte_malloc(NULL, size, RTE_CACHE_LINE_SIZE);
> > +	txr->q_swbd = rte_malloc(NULL, size, ENETC_BD_RING_ALIGN);
> >  	if (txr->q_swbd == NULL)
> >  		return -ENOMEM;
> >
> >  	size = nb_desc * sizeof(struct enetc_tx_bd);
> > -	txr->bd_base = rte_malloc(NULL, size, RTE_CACHE_LINE_SIZE);
> > +	txr->bd_base = rte_malloc(NULL, size, ENETC_BD_RING_ALIGN);
> >  	if (txr->bd_base == NULL) {
> >  		rte_free(txr->q_swbd);
> >  		txr->q_swbd = NULL;
> > @@ -325,12 +325,12 @@ enetc_alloc_rxbdr(struct enetc_bdr *rxr,
> >  	int size;
> >
> >  	size = nb_rx_desc * sizeof(struct enetc_swbd);
> > -	rxr->q_swbd = rte_malloc(NULL, size, RTE_CACHE_LINE_SIZE);
> > +	rxr->q_swbd = rte_malloc(NULL, size, ENETC_BD_RING_ALIGN);
> >  	if (rxr->q_swbd == NULL)
> >  		return -ENOMEM;
> >
> >  	size = nb_rx_desc * sizeof(union enetc_rx_bd);
> > -	rxr->bd_base = rte_malloc(NULL, size, RTE_CACHE_LINE_SIZE);
> > +	rxr->bd_base = rte_malloc(NULL, size, ENETC_BD_RING_ALIGN);
> >  	if (rxr->bd_base == NULL) {
> >  		rte_free(rxr->q_swbd);
> >  		rxr->q_swbd = NULL;
> >
  

Patch

diff --git a/drivers/net/enetc/base/enetc_hw.h b/drivers/net/enetc/base/enetc_hw.h
index fd71155ee..2fe7ccb5b 100644
--- a/drivers/net/enetc/base/enetc_hw.h
+++ b/drivers/net/enetc/base/enetc_hw.h
@@ -12,6 +12,9 @@ 
 #define ENETC_DEV_ID_VF		0xef00
 #define ENETC_DEV_ID		0xe100
 
+/* BD RING ALIGNMENT */
+#define ENETC_BD_RING_ALIGN	128
+
 /* ENETC register block BAR */
 #define ENETC_BAR_REGS			0x0
 
diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c
index dc05c00ff..4e978348c 100644
--- a/drivers/net/enetc/enetc_ethdev.c
+++ b/drivers/net/enetc/enetc_ethdev.c
@@ -178,12 +178,12 @@  enetc_alloc_txbdr(struct enetc_bdr *txr, uint16_t nb_desc)
 	int size;
 
 	size = nb_desc * sizeof(struct enetc_swbd);
-	txr->q_swbd = rte_malloc(NULL, size, RTE_CACHE_LINE_SIZE);
+	txr->q_swbd = rte_malloc(NULL, size, ENETC_BD_RING_ALIGN);
 	if (txr->q_swbd == NULL)
 		return -ENOMEM;
 
 	size = nb_desc * sizeof(struct enetc_tx_bd);
-	txr->bd_base = rte_malloc(NULL, size, RTE_CACHE_LINE_SIZE);
+	txr->bd_base = rte_malloc(NULL, size, ENETC_BD_RING_ALIGN);
 	if (txr->bd_base == NULL) {
 		rte_free(txr->q_swbd);
 		txr->q_swbd = NULL;
@@ -325,12 +325,12 @@  enetc_alloc_rxbdr(struct enetc_bdr *rxr,
 	int size;
 
 	size = nb_rx_desc * sizeof(struct enetc_swbd);
-	rxr->q_swbd = rte_malloc(NULL, size, RTE_CACHE_LINE_SIZE);
+	rxr->q_swbd = rte_malloc(NULL, size, ENETC_BD_RING_ALIGN);
 	if (rxr->q_swbd == NULL)
 		return -ENOMEM;
 
 	size = nb_rx_desc * sizeof(union enetc_rx_bd);
-	rxr->bd_base = rte_malloc(NULL, size, RTE_CACHE_LINE_SIZE);
+	rxr->bd_base = rte_malloc(NULL, size, ENETC_BD_RING_ALIGN);
 	if (rxr->bd_base == NULL) {
 		rte_free(rxr->q_swbd);
 		rxr->q_swbd = NULL;