Skip to content

Commit

Permalink
net/cnxk: fix later skip to include mbuf private data
Browse files Browse the repository at this point in the history
[ upstream commit 480b03b ]

Fix later skip to include mbuf priv data as mbuf->buf_addr
is populated based on calculation including per-mbuf priv area.

Fixes: 706eeae ("net/cnxk: add multi-segment Rx for CN10K")

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
  • Loading branch information
nithind1988 authored and kevintraynor committed Nov 7, 2022
1 parent af41fb3 commit 0f3f7b9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion drivers/net/cnxk/cn10k_rx.h
Expand Up @@ -244,6 +244,7 @@ nix_cqe_xtract_mseg(const union nix_rx_parse_u *rx, struct rte_mbuf *mbuf,
uint64_t rearm, const uint16_t flags)
{
const rte_iova_t *iova_list;
uint16_t later_skip = 0;
struct rte_mbuf *head;
const rte_iova_t *eol;
uint8_t nb_segs;
Expand All @@ -270,10 +271,11 @@ nix_cqe_xtract_mseg(const union nix_rx_parse_u *rx, struct rte_mbuf *mbuf,
nb_segs--;

rearm = rearm & ~0xFFFF;
later_skip = (uintptr_t)mbuf->buf_addr - (uintptr_t)mbuf;

head = mbuf;
while (nb_segs) {
mbuf->next = ((struct rte_mbuf *)*iova_list) - 1;
mbuf->next = (struct rte_mbuf *)(*iova_list - later_skip);
mbuf = mbuf->next;

RTE_MEMPOOL_CHECK_COOKIES(mbuf->pool, (void **)&mbuf, 1, 1);
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/cnxk/cnxk_ethdev.c
Expand Up @@ -567,7 +567,7 @@ cnxk_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid,
first_skip += RTE_PKTMBUF_HEADROOM;
first_skip += rte_pktmbuf_priv_size(mp);
rq->first_skip = first_skip;
rq->later_skip = sizeof(struct rte_mbuf);
rq->later_skip = sizeof(struct rte_mbuf) + rte_pktmbuf_priv_size(mp);
rq->lpb_size = mp->elt_size;

/* Enable Inline IPSec on RQ, will not be used for Poll mode */
Expand Down

0 comments on commit 0f3f7b9

Please sign in to comment.