net/octeontx2: fix buffer size assignment

Message ID 1589977210-31046-1-git-send-email-adwivedi@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series net/octeontx2: fix buffer size assignment |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/travis-robot success Travis build: passed
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-nxp-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-testing fail Testing issues

Commit Message

Ankur Dwivedi May 20, 2020, 12:20 p.m. UTC
  The elt_size field in mempool holds the size of one packet buffer.
It can be used to set the lpm_sizem1 field in rq context.

The lpb_sizem1 field in rq context is 12 bit, direct assignment
to it was causing overflow of value. Because of this errors
were observed while trying inline inbound with large packets.
This patch resolves the errors.

Fixes: 094fc8a3a1e2 ("net/octeontx2: add Rx queue setup and release")

Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
Reviewed-by: Nithin Kumar Dabilpuram <ndabilpuram@marvell.com>
Reviewed-by: Jerin Jacob Kollanukkaran <jerinj@marvell.com>
---
 drivers/net/octeontx2/otx2_ethdev.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
  

Comments

Jerin Jacob May 21, 2020, 10:18 a.m. UTC | #1
On Wed, May 20, 2020 at 5:51 PM Ankur Dwivedi <adwivedi@marvell.com> wrote:
>
> The elt_size field in mempool holds the size of one packet buffer.
> It can be used to set the lpm_sizem1 field in rq context.
>
> The lpb_sizem1 field in rq context is 12 bit, direct assignment
> to it was causing overflow of value. Because of this errors
> were observed while trying inline inbound with large packets.
> This patch resolves the errors.
>
> Fixes: 094fc8a3a1e2 ("net/octeontx2: add Rx queue setup and release")

Cc: stable@dpdk.org


>
> Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
> Reviewed-by: Nithin Kumar Dabilpuram <ndabilpuram@marvell.com>
> Reviewed-by: Jerin Jacob Kollanukkaran <jerinj@marvell.com>

Fixed the name and Applied to dpdk-next-net-mrvl/master. Thanks


> ---
>  drivers/net/octeontx2/otx2_ethdev.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/net/octeontx2/otx2_ethdev.c b/drivers/net/octeontx2/otx2_ethdev.c
> index 3116e5c..3f3f0a6 100644
> --- a/drivers/net/octeontx2/otx2_ethdev.c
> +++ b/drivers/net/octeontx2/otx2_ethdev.c
> @@ -373,10 +373,7 @@
>         aq->rq.first_skip = first_skip;
>         aq->rq.later_skip = (sizeof(struct rte_mbuf) / 8);
>         aq->rq.flow_tagw = 32; /* 32-bits */
> -       aq->rq.lpb_sizem1 = rte_pktmbuf_data_room_size(mp);
> -       aq->rq.lpb_sizem1 += rte_pktmbuf_priv_size(mp);
> -       aq->rq.lpb_sizem1 += sizeof(struct rte_mbuf);
> -       aq->rq.lpb_sizem1 /= 8;
> +       aq->rq.lpb_sizem1 = mp->elt_size / 8;
>         aq->rq.lpb_sizem1 -= 1; /* Expressed in size minus one */
>         aq->rq.ena = 1;
>         aq->rq.pb_caching = 0x2; /* First cache aligned block to LLC */
> --
> 1.9.3
>
  

Patch

diff --git a/drivers/net/octeontx2/otx2_ethdev.c b/drivers/net/octeontx2/otx2_ethdev.c
index 3116e5c..3f3f0a6 100644
--- a/drivers/net/octeontx2/otx2_ethdev.c
+++ b/drivers/net/octeontx2/otx2_ethdev.c
@@ -373,10 +373,7 @@ 
 	aq->rq.first_skip = first_skip;
 	aq->rq.later_skip = (sizeof(struct rte_mbuf) / 8);
 	aq->rq.flow_tagw = 32; /* 32-bits */
-	aq->rq.lpb_sizem1 = rte_pktmbuf_data_room_size(mp);
-	aq->rq.lpb_sizem1 += rte_pktmbuf_priv_size(mp);
-	aq->rq.lpb_sizem1 += sizeof(struct rte_mbuf);
-	aq->rq.lpb_sizem1 /= 8;
+	aq->rq.lpb_sizem1 = mp->elt_size / 8;
 	aq->rq.lpb_sizem1 -= 1; /* Expressed in size minus one */
 	aq->rq.ena = 1;
 	aq->rq.pb_caching = 0x2; /* First cache aligned block to LLC */