From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E8CED461AD for ; Thu, 6 Feb 2025 18:56:23 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DFD8840E72; Thu, 6 Feb 2025 18:56:23 +0100 (CET) Received: from mail-il1-f176.google.com (mail-il1-f176.google.com [209.85.166.176]) by mails.dpdk.org (Postfix) with ESMTP id 717C8402BC for ; Thu, 6 Feb 2025 18:56:21 +0100 (CET) Received: by mail-il1-f176.google.com with SMTP id e9e14a558f8ab-3ce886a2d5bso10249055ab.1 for ; Thu, 06 Feb 2025 09:56:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google; t=1738864580; x=1739469380; 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=UvxZxivncBueIxHdasICpkShHGNyF22oVr/HMCzx1tA=; b=IcQqsuo2rZ+0J9junuvNSvqIx4DZAke8NV8ttJeQalQ1qnHtpw4xJ3LlTONVjuHp19 8U5LaXY/9exaWLMLnzIS6Do7Sl00sh2eD6mklcvOwgj+hrhJBRb01kEjATelA9qR2I44 3oDvLPQz0GvrXddf6TWYIunfmUGmTf9w/wMjK7+kuvJ4+nd1CU/Vw3Sl/eStGAi6GrwK Kxba5/3kLZu56W29fiDO1Vg7NAtLD5rAQ0c5j18jjv+M668bZExLEoEy7z0G+HJXGaiu Y9eA9KOHfpb5aY4bYHLyuGd1QqDKbzPOnzXxXhRVXLvOgEufrAAvhtGg4atM+rySePS0 MmUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738864580; x=1739469380; 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=UvxZxivncBueIxHdasICpkShHGNyF22oVr/HMCzx1tA=; b=Etay21EROptci2/OwFiM2+kzBwzH1a8GsK+iXVgk+8hGEBn5sDrOCkXG39kAEwLBi+ gPShB2IksuJRaskfFWPtxgzCP4b+HHrDm/4RjzBRTKwbpqSxAm66IispG3o/BaezwhUp iEA5ioVysuXw6E+jtjIPofkk9mwBWdpUWjRHmSi23ladWKJ6Leb5srKusvmAZez2iI/+ E5lS/iMxSY/lUBDrgiMTHoA/QHDn8PalzdXsGHtxZOhw62CZ2IS0Tv8H05HRSugbVnBW e4i6aWJOftcU+vJHbglzRHGLYQQeLy40f6vsMGSgKnWLCcbi0g502GmAHMX6ARSCYQYS SSAg== X-Forwarded-Encrypted: i=1; AJvYcCV3Keo+D4c/NSrC3t/dl8ThNEM0KnwLEr2AqiKurFl7r5IjIuehP+E3KYByXloOapFVeCgaw88=@dpdk.org X-Gm-Message-State: AOJu0Yz5C7Q0zAJsRsmsc0V1G9CUY4F/Zwhk//111+jarwN75gWOFnBl ud2bWxVvV/GhXeYIz1Kn1ZE2LS6i5I6RB+z8simjIgyFs1XjagdRBE02XbN4AKxZvBjYOpnbXzw viP58YtrFKlyuMZRLrieJgkjyPJPVe8T4cRrAsw== X-Gm-Gg: ASbGnctLLF0n6CdIys1F9iwIaVL/w/qZvUbJkzgyCLmK7Uw9Z4cqEzc86NMC7tDDc9k jp5Z9iFGOjv+cVHgRwKo8I7u1R8RW7JhF+9Q7J05o05/ADlrdMwaAu2e3kiguxg89xM0/59Hvz6 NFyOHjx0ViSQW18lLBMYbYi/9e9Pjn X-Google-Smtp-Source: AGHT+IFbSvFng7wdYqW2Pv0S1IKckoK7QWQKlgbZEoeOWh4fH2eSheTGCRa7pm/yxFEROi7/mlmybtpPDT2Suy8LQUY= X-Received: by 2002:a05:6e02:12e8:b0:3d0:2477:83ec with SMTP id e9e14a558f8ab-3d04f917cbdmr58042865ab.14.1738864580652; Thu, 06 Feb 2025 09:56:20 -0800 (PST) MIME-Version: 1.0 References: <20250116195640.68885-1-ariel.otilibili@6wind.com> <20250201100300.2194018-1-ariel.otilibili@6wind.com> <20250201100300.2194018-3-ariel.otilibili@6wind.com> In-Reply-To: From: Ariel Otilibili Date: Thu, 6 Feb 2025 18:56:09 +0100 X-Gm-Features: AWEUYZnMFyThafupN6QAceXOxoiGX4A3uXyKHhcqaUsGMmZyWpzs0agXv7SDyks Message-ID: Subject: Re: [PATCH v7 2/2] net/af_xdp: Refactor af_xdp_tx_zc To: Maryam Tahhan Cc: "dev@dpdk.org" , "stable@dpdk.org" , Thomas Monjalon , David Marchand , Stephen Hemminger , Ciara Loftus Content-Type: multipart/alternative; boundary="000000000000a49359062d7cf567" X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org --000000000000a49359062d7cf567 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Maryam, On Thu, Feb 6, 2025 at 3:09=E2=80=AFAM Maryam Tahhan w= rote: > > > On Sat 1 Feb 2025, 10:03 Ariel Otilibili, > wrote: > >> diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c >> b/drivers/net/af_xdp/rte_eth_af_xdp.c >> index 092bcb73aa0a..840a12dbf508 100644 >> --- a/drivers/net/af_xdp/rte_eth_af_xdp.c >> +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c >> @@ -536,6 +536,31 @@ kick_tx(struct pkt_tx_queue *txq, struct >> xsk_ring_cons *cq) >> } >> } >> >> +static inline struct xdp_desc * >> +reserve_and_fill(struct pkt_tx_queue *txq, struct rte_mbuf *mbuf, >> + struct xsk_umem_info *umem) >> +{ >> + struct xdp_desc *desc =3D NULL; >> + uint32_t *idx_tx =3D NULL; >> > > Took me a while to spot this but this needs to be a uint32_t not a pointe= r > to uint32_t, because xsk_ring_prod__reserve() does not allocate memory fo= r > idx_tx it just expects to dereference a pointer to a uint32_t to store th= e > index... > Only now could I answer back; sorry the late response. And thanks for your thorough investigation. I didn't get the chance to use *testpmd;* which arguments did you pass? I ran a scan-build while compiling, as well as a compilation with sanitized flags. And I saw no error in af_xdp source files. meson --wipe build -Db_sanitize=3Daddress ninja -C build 2>&1 san_`date -Iseconds`.log ninja -C build 2>&1 | tee --append san_`date -Iseconds`.log ninja -C build scan-build 2>&1 | tee --append san_`date -Iseconds`.log How did you spot the error? > > + uint64_t addr, offset; >> + >> + if (!xsk_ring_prod__reserve(&txq->tx, 1, 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->buffer >> + - 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; >> + >> +out: >> + return desc; >> +} >> + >> > > --000000000000a49359062d7cf567 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Maryam,

On Th= u, Feb 6, 2025 at 3:09=E2=80=AFAM Maryam Tahhan <mtahhan@redhat.com> wrote:


On Sat 1 Feb 2025, 1= 0:03 Ariel Otilibili, <ariel.otilibili@6wind.com> wrote:
diff --git a/drivers/net/af_xdp/rte_= eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
index 092bcb73aa0a..840a12dbf508 100644
--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
@@ -536,6 +536,31 @@ kick_tx(struct pkt_tx_queue *txq, struct xsk_ring_cons= *cq)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }
=C2=A0}

+static inline struct xdp_desc *
+reserve_and_fill(struct pkt_tx_queue *txq, struct rte_mbuf *mbuf,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 struct xsk_umem_in= fo *umem)
+{
+=C2=A0 =C2=A0 =C2=A0 =C2=A0struct xdp_desc *desc =3D NULL;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uint32_t *idx_tx =3D NULL;

Took me a while to sp= ot this but this needs to be a uint32_t not a pointer to uint32_t, because = xsk_ring_prod__reserve() does not allocate memory for idx_tx it just expect= s to dereference a pointer to a uint32_t to store the index...
<= /blockquote>

Only now could I answer back; sorry the lat= e response.=C2=A0And thanks for your thorough investigation.

=
I didn't get the chance to use testpmd; which argumen= ts did you pass?

I ran a scan-build while comp= iling, as well as a compilation with sanitized flags. And I saw no error in= af_xdp source files.

meson --wipe build -Db_sanit= ize=3Daddress
ninja -C build 2>&1 san_`date -Iseconds`.log
nin= ja -C build 2>&1 | tee --append san_`date -Iseconds`.log
ninja -C= build scan-build 2>&1 | tee --append san_`date -Iseconds`.log=C2=A0=

How did you spot the error?

<= /div>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uint64_t addr, offset;
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (!xsk_ring_prod__reserve(&txq->tx, 1,= idx_tx))
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0goto out;
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0desc =3D xsk_ring_prod__tx_desc(&txq->tx= , *idx_tx);
+=C2=A0 =C2=A0 =C2=A0 =C2=A0desc->len =3D mbuf->pkt_len;
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0addr =3D (uint64_t)mbuf - (uint64_t)umem->bu= ffer
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0- umem->mb_pool-= >header_size;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0offset =3D rte_pktmbuf_mtod(mbuf, uint64_t) - (= uint64_t)mbuf
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0+ umem->mb_pool-= >header_size;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0offset =3D offset << XSK_UNALIGNED_BUF_OF= FSET_SHIFT;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0desc->addr =3D addr | offset;
+
+out:
+=C2=A0 =C2=A0 =C2=A0 =C2=A0return desc;
+}
+
<snip>
--000000000000a49359062d7cf567--