From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (unknown [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C6AF9460A4; Thu, 16 Jan 2025 23:36:45 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BA5DD40F35; Thu, 16 Jan 2025 23:36:27 +0100 (CET) Received: from mail-il1-f173.google.com (mail-il1-f173.google.com [209.85.166.173]) by mails.dpdk.org (Postfix) with ESMTP id 93E2E40EF0 for ; Thu, 16 Jan 2025 23:36:26 +0100 (CET) Received: by mail-il1-f173.google.com with SMTP id e9e14a558f8ab-3ce7a77e5a1so4269015ab.0 for ; Thu, 16 Jan 2025 14:36:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google; t=1737066986; x=1737671786; darn=dpdk.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=0aDcWeHAeOlWfTLwg17L6z0kT7fPfy9ChwvAzdvItF8=; b=H1qE7WtnrBNIRzfD7JnrgJsgILdr1bkGm396h3rhULU1PSIVfo9G9rA7S7smxFTxE3 kZaYiLdNjtjTSYztwlCPdwCJjKHC6vjQTK02YCrZ38e8jJMZW9nAI/W+Xrb8MXPCSsa3 5SSB4y9XwegH4u1hT+i04822whfTEPF1e+Oxd6QLSRZZtH2C5X0yR4mN0hXIM7IIlLT6 1vzpfp3u+0PlwsIRJY4V2E1h1JdiWqFAQRIfQRNiF9hnZtTKXXFZCK2mS4/OUUO5ZVrz Q30Hgb4T4ocS1KPiGBQOAFAu0W52a/DhBtJoo4WeUoU7NxoVkJ77k+CH6a6Z0/vyfIqG 1EKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737066986; x=1737671786; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=0aDcWeHAeOlWfTLwg17L6z0kT7fPfy9ChwvAzdvItF8=; b=EqxrP1rCtfThaI5PmgnU/3UzRQiwOw88E3OqlbDv/1bwk7rdRTw/WmxoLRGRBHKCku ec1DF4xudXxW9cGje4I3zm+v7Gvv/ya/85WBh5qPKI4dfBWhIlrBo2rMehkb9ZsMreeZ ZBDGkHqFrivZXBpW+oF27ItemcZC1rHe6ziiI/ckcH7eyIRGTy0vqO9m6up+B4N0EPz6 OlaQYZJ6elscE7JPdnUJW485AINyDYZjfkpvdq+IlO+nrFo6vrg+zJ5geczctgBHbr9G cRbkq4a9uw+sX2PBBFfxYoqohpQqpzNH7lb1vy7OOOijzF1ilGC8ZGVrtBXIRL0Wy0sT PTCw== X-Gm-Message-State: AOJu0YzqIeHjndDa3CBOlX/hq/2PNIXOEdKOuOzo4NqWbjRYfTDcAEJF +56ukvfG/N1rQCoh1+xlvP928YDT68cEz6EuOdDgRNbxDSlglGqLZwrCuIhMD5GA/MvHb7IbjnQ IXw8u8jpXFNtdtE52reyGSgF9dnOvC2SyWZn35Q== X-Gm-Gg: ASbGncvcmWF8c7xSggkyfp1n+HSErp0apfPnQgX+uWorfCPDgZ50/kC56Rb5PbMHpyH 0lExnHXxCmLIkp2VDpmUMoJQbNTFSYjAVymfb/9a828SusVb0Vw0Q+ntwQfNCr0M2/a3a7Q== X-Google-Smtp-Source: AGHT+IHuqZQmxk+nPTaOftezTpCQwfR/lKmq0AlnOy7YBBlGf4RFky6zSvi9dbWObHE6Yhh0sMVdyublgVvAHR2L/zc= X-Received: by 2002:a05:6e02:1748:b0:3a6:b445:dc92 with SMTP id e9e14a558f8ab-3cf743e919fmr2872525ab.10.1737066985740; Thu, 16 Jan 2025 14:36:25 -0800 (PST) MIME-Version: 1.0 References: <20250116195640.68885-1-ariel.otilibili@6wind.com> <20250116195640.68885-3-ariel.otilibili@6wind.com> <20250116134746.2c0b1a7e@hermes.local> <20250116142640.26391bf0@hermes.local> In-Reply-To: <20250116142640.26391bf0@hermes.local> From: Ariel Otilibili Date: Thu, 16 Jan 2025 23:36:13 +0100 X-Gm-Features: AbW1kvbZh-lPurXjYYTOUbp_9B2mxzqk_13llKyay3pLjcT2sGJCIIImVZ8S4TY Message-ID: Subject: Re: [PATCH 2/2] net/af_xdp: Refactor af_xdp_tx_zc() To: Stephen Hemminger Cc: dev@dpdk.org, stable@dpdk.org, Thomas Monjalon , David Marchand , Ciara Loftus , Maryam Tahhan Content-Type: multipart/alternative; boundary="000000000000a2ff21062bda6c30" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org --000000000000a2ff21062bda6c30 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Jan 16, 2025 at 11:26=E2=80=AFPM Stephen Hemminger < stephen@networkplumber.org> wrote: > On Thu, 16 Jan 2025 23:20:06 +0100 > Ariel Otilibili wrote: > > > Hi Stephen, > > > > On Thu, Jan 16, 2025 at 10:47=E2=80=AFPM Stephen Hemminger < > > stephen@networkplumber.org> wrote: > > > > > On Thu, 16 Jan 2025 20:56:39 +0100 > > > Ariel Otilibili wrote: > > > > > > > Both branches of the loop share the same logic. Now each one is a > > > > goto dispatcher; either to out (end of function), or to > > > > stats (continuation of the loop). > > > > > > > > Bugzilla ID: 1440 > > > > Depends-on: patch-1 ("net/af_xdp: fix use after free in > af_xdp_tx_zc()") > > > > Signed-off-by: Ariel Otilibili > > > > --- > > > > drivers/net/af_xdp/rte_eth_af_xdp.c | 57 > ++++++++++++++--------------- > > > > 1 file changed, 27 insertions(+), 30 deletions(-) > > > > > > > > diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c > > > b/drivers/net/af_xdp/rte_eth_af_xdp.c > > > > index 4326a29f7042..8b42704b6d9f 100644 > > > > --- a/drivers/net/af_xdp/rte_eth_af_xdp.c > > > > +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c > > > > @@ -551,6 +551,7 @@ af_xdp_tx_zc(void *queue, struct rte_mbuf > **bufs, > > > uint16_t nb_pkts) > > > > uint64_t addr, offset; > > > > struct xsk_ring_cons *cq =3D &txq->pair->cq; > > > > uint32_t free_thresh =3D cq->size >> 1; > > > > + struct rte_mbuf *local_mbuf =3D NULL; > > > > > > > > if (xsk_cons_nb_avail(cq, free_thresh) >=3D free_thresh) > > > > pull_umem_cq(umem, XSK_RING_CONS__DEFAULT_NUM_DESCS, > cq); > > > > @@ -565,21 +566,10 @@ af_xdp_tx_zc(void *queue, struct rte_mbuf > **bufs, > > > uint16_t nb_pkts) > > > > &idx_tx)) > > > > goto out; > > > > } > > > > - desc =3D xsk_ring_prod__tx_desc(&txq->tx, > idx_tx); > > > > - desc->len =3D mbuf->pkt_len; > > > > - addr =3D (uint64_t)mbuf - (uint64_t)umem->buf= fer > - > > > > - umem->mb_pool->header_size; > > > > - offset =3D rte_pktmbuf_mtod(mbuf, uint64_t) - > > > > - (uint64_t)mbuf + > > > > - umem->mb_pool->header_size; > > > > - offset =3D offset << > XSK_UNALIGNED_BUF_OFFSET_SHIFT; > > > > - desc->addr =3D addr | offset; > > > > - tx_bytes +=3D mbuf->pkt_len; > > > > - count++; > > > > + > > > > + goto stats; > > > > } else { > > > > - struct rte_mbuf *local_mbuf =3D > > > > - > rte_pktmbuf_alloc(umem->mb_pool); > > > > - void *pkt; > > > > + local_mbuf =3D rte_pktmbuf_alloc(umem->mb_poo= l); > > > > > > > > if (local_mbuf =3D=3D NULL) > > > > goto out; > > > > @@ -589,23 +579,30 @@ af_xdp_tx_zc(void *queue, struct rte_mbuf > **bufs, > > > uint16_t nb_pkts) > > > > goto out; > > > > } > > > > > > > > - desc =3D xsk_ring_prod__tx_desc(&txq->tx, > idx_tx); > > > > - desc->len =3D mbuf->pkt_len; > > > > - > > > > - addr =3D (uint64_t)local_mbuf - > > > (uint64_t)umem->buffer - > > > > - umem->mb_pool->header_size; > > > > - offset =3D rte_pktmbuf_mtod(local_mbuf, > uint64_t) - > > > > - (uint64_t)local_mbuf + > > > > - umem->mb_pool->header_size; > > > > - pkt =3D xsk_umem__get_data(umem->buffer, addr= + > > > offset); > > > > - offset =3D offset << > XSK_UNALIGNED_BUF_OFFSET_SHIFT; > > > > - desc->addr =3D addr | offset; > > > > - rte_memcpy(pkt, rte_pktmbuf_mtod(mbuf, void *= ), > > > > - desc->len); > > > > - tx_bytes +=3D mbuf->pkt_len; > > > > - rte_pktmbuf_free(mbuf); > > > > - count++; > > > > + goto stats; > > > > } > > > > +stats: > > > > + struct rte_mbuf *tmp; > > > > + void *pkt; > > > > + tmp =3D mbuf->pool =3D=3D umem->mb_pool ? mbuf : local_mbuf; > > > > + > > > > + desc =3D xsk_ring_prod__tx_desc(&txq->tx, idx_tx); > > > > + desc->len =3D mbuf->pkt_len; > > > > + > > > > + addr =3D (uint64_t)tmp - (uint64_t)umem->buffer - > > > umem->mb_pool->header_size; > > > > + offset =3D rte_pktmbuf_mtod(tmp, uint64_t) - (uint64_t)tmp + > > > umem->mb_pool->header_size; > > > > + offset =3D offset << XSK_UNALIGNED_BUF_OFFSET_SHIFT; > > > > + desc->addr =3D addr | offset; > > > > + > > > > + if (mbuf->pool =3D=3D umem->mb_pool) { > > > > + tx_bytes +=3D mbuf->pkt_len; > > > > + } else { > > > > + pkt =3D xsk_umem__get_data(umem->buffer, addr + offse= t); > > > > + rte_memcpy(pkt, rte_pktmbuf_mtod(mbuf, void *), > desc->len); > > > > + tx_bytes +=3D mbuf->pkt_len; > > > > + rte_pktmbuf_free(mbuf); > > > > + } > > > > + count++; > > > > } > > > > > > > > out: > > > > > > Indentation here is wrong, and looks suspect. > > > Either stats tag should be outside of loop > > > Or stats is inside loop, and both of those goto's are unnecessary > > > > > Thanks for the feedback; I am pushing a new series with an extra tab. > > So it be obvious that stats belongs to the the loop. > > > But the the goto;s aren't needed? Both legs of the If would fall through > to that location. > You are right, Stephen; thanks for the heads up. I am pushing that change, without any goto in each leg, so fall through. Bear with me for some time. --000000000000a2ff21062bda6c30 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Thu, Jan 16,= 2025 at 11:26=E2=80=AFPM Stephen Hemminger <stephen@networkplumber.org> wrote:
On Thu, 16 Jan 2025 23:20:06 += 0100
Ariel Otilibili <ariel.otilibili@6wind.com> wrote:

> Hi Stephen,
>
> On Thu, Jan 16, 2025 at 10:47=E2=80=AFPM Stephen Hemminger <
> stephe= n@networkplumber.org> wrote:=C2=A0
>
> > On Thu, 16 Jan 2025 20:56:39 +0100
> > Ariel Otilibili <ariel.otilibili@6wind.com> wrote:
> >=C2=A0
> > > Both branches of the loop share the same logic. Now each one= is a
> > > goto dispatcher; either to out (end of function), or to
> > > stats (continuation of the loop).
> > >
> > > Bugzilla ID: 1440
> > > Depends-on: patch-1 ("net/af_xdp: fix use after free in= af_xdp_tx_zc()")
> > > Signed-off-by: Ariel Otilibili <ariel.otilibili@6wind.com>
> > > ---
> > >=C2=A0 drivers/net/af_xdp/rte_eth_af_xdp.c | 57 +++++++++++++= +---------------
> > >=C2=A0 1 file changed, 27 insertions(+), 30 deletions(-)
> > >
> > > diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c=C2=A0
> > b/drivers/net/af_xdp/rte_eth_af_xdp.c=C2=A0
> > > index 4326a29f7042..8b42704b6d9f 100644
> > > --- a/drivers/net/af_xdp/rte_eth_af_xdp.c
> > > +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
> > > @@ -551,6 +551,7 @@ af_xdp_tx_zc(void *queue, struct rte_mbu= f **bufs,=C2=A0
> > uint16_t nb_pkts)=C2=A0
> > >=C2=A0 =C2=A0 =C2=A0 =C2=A0uint64_t addr, offset;
> > >=C2=A0 =C2=A0 =C2=A0 =C2=A0struct xsk_ring_cons *cq =3D &= txq->pair->cq;
> > >=C2=A0 =C2=A0 =C2=A0 =C2=A0uint32_t free_thresh =3D cq->si= ze >> 1;
> > > +=C2=A0 =C2=A0 =C2=A0struct rte_mbuf *local_mbuf =3D NULL; > > >
> > >=C2=A0 =C2=A0 =C2=A0 =C2=A0if (xsk_cons_nb_avail(cq, free_thr= esh) >=3D free_thresh)
> > >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0pull_u= mem_cq(umem, XSK_RING_CONS__DEFAULT_NUM_DESCS, cq);
> > > @@ -565,21 +566,10 @@ af_xdp_tx_zc(void *queue, struct rte_m= buf **bufs,=C2=A0
> > uint16_t nb_pkts)=C2=A0
> > >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0&idx_tx))
> > >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0goto out;
> > >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0}
> > > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0desc =3D xsk_ring_prod__tx_desc(&txq->tx, idx_tx);<= br> > > > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0desc->len =3D mbuf->pkt_len;
> > > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0addr =3D (uint64_t)mbuf - (uint64_t)umem->buffer -
> > > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0um= em->mb_pool->header_size;
> > > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0offset =3D rte_pktmbuf_mtod(mbuf, uint64_t) -
> > > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(u= int64_t)mbuf +
> > > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0um= em->mb_pool->header_size;
> > > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0offset =3D offset << XSK_UNALIGNED_BUF_OFFSET_SHIFT;=
> > > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0desc->addr =3D addr | offset;
> > > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0tx_bytes +=3D mbuf->pkt_len;
> > > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0count++;
> > > +
> > > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0goto stats;
> > >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0} else= {
> > > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0struct rte_mbuf *local_mbuf =3D
> > > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0rt= e_pktmbuf_alloc(umem->mb_pool);
> > > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0void *pkt;
> > > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0local_mbuf =3D rte_pktmbuf_alloc(umem->mb_pool);
> > >
> > >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0if (local_mbuf =3D=3D NULL)
> > >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0goto out;
> > > @@ -589,23 +579,30 @@ af_xdp_tx_zc(void *queue, struct rte_m= buf **bufs,=C2=A0
> > uint16_t nb_pkts)=C2=A0
> > >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0goto out;
> > >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0}
> > >
> > > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0desc =3D xsk_ring_prod__tx_desc(&txq->tx, idx_tx);<= br> > > > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0desc->len =3D mbuf->pkt_len;
> > > -
> > > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0addr =3D (uint64_t)local_mbuf -=C2=A0
> > (uint64_t)umem->buffer -=C2=A0
> > > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0um= em->mb_pool->header_size;
> > > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0offset =3D rte_pktmbuf_mtod(local_mbuf, uint64_t) -
> > > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(u= int64_t)local_mbuf +
> > > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0um= em->mb_pool->header_size;
> > > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0pkt =3D xsk_umem__get_data(umem->buffer, addr +=C2=A0 <= br> > > offset);=C2=A0
> > > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0offset =3D offset << XSK_UNALIGNED_BUF_OFFSET_SHIFT;=
> > > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0desc->addr =3D addr | offset;
> > > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0rte_memcpy(pkt, rte_pktmbuf_mtod(mbuf, void *),
> > > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0de= sc->len);
> > > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0tx_bytes +=3D mbuf->pkt_len;
> > > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0rte_pktmbuf_free(mbuf);
> > > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0count++;
> > > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0goto stats;
> > >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}
> > > +stats:
> > > +=C2=A0 =C2=A0 =C2=A0struct rte_mbuf *tmp;
> > > +=C2=A0 =C2=A0 =C2=A0void *pkt;
> > > +=C2=A0 =C2=A0 =C2=A0tmp =3D mbuf->pool =3D=3D umem->m= b_pool ? mbuf : local_mbuf;
> > > +
> > > +=C2=A0 =C2=A0 =C2=A0desc =3D xsk_ring_prod__tx_desc(&tx= q->tx, idx_tx);
> > > +=C2=A0 =C2=A0 =C2=A0desc->len =3D mbuf->pkt_len;
> > > +
> > > +=C2=A0 =C2=A0 =C2=A0addr =3D (uint64_t)tmp - (uint64_t)umem= ->buffer -=C2=A0
> > umem->mb_pool->header_size;=C2=A0
> > > +=C2=A0 =C2=A0 =C2=A0offset =3D rte_pktmbuf_mtod(tmp, uint64= _t) - (uint64_t)tmp +=C2=A0
> > umem->mb_pool->header_size;=C2=A0
> > > +=C2=A0 =C2=A0 =C2=A0offset =3D offset << XSK_UNALIGNE= D_BUF_OFFSET_SHIFT;
> > > +=C2=A0 =C2=A0 =C2=A0desc->addr =3D addr | offset;
> > > +
> > > +=C2=A0 =C2=A0 =C2=A0if (mbuf->pool =3D=3D umem->mb_po= ol) {
> > > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0tx_bytes += =3D mbuf->pkt_len;
> > > +=C2=A0 =C2=A0 =C2=A0} else {
> > > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0pkt =3D xsk= _umem__get_data(umem->buffer, addr + offset);
> > > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0rte_memcpy(= pkt, rte_pktmbuf_mtod(mbuf, void *), desc->len);
> > > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0tx_bytes += =3D mbuf->pkt_len;
> > > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0rte_pktmbuf= _free(mbuf);
> > > +=C2=A0 =C2=A0 =C2=A0}
> > > +=C2=A0 =C2=A0 =C2=A0count++;
> > >=C2=A0 =C2=A0 =C2=A0 =C2=A0}
> > >
> > >=C2=A0 out:=C2=A0
> >
> > Indentation here is wrong, and looks suspect.
> > Either stats tag should be outside of loop
> > Or stats is inside loop, and both of those goto's are unneces= sary
> >=C2=A0
> Thanks for the feedback; I am pushing a new series with an extra tab.<= br> > So it be obvious that stats belongs to the the loop.


But the the goto;s aren't needed? Both legs of the If would fall throug= h
to that location.
You are right, Stephen; thanks for t= he heads up. I am pushing that change, without any goto in each leg, so fal= l through.
Bear with me for some time.
--000000000000a2ff21062bda6c30--