mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Brett Creeley <bcreeley@amd.com>
To: Thomas Fourier <fourier.thomas@gmail.com>
Cc: Shannon Nelson <shannon.nelson@amd.com>,
	Brett Creeley <brett.creeley@amd.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Jesper Dangaard Brouer <hawk@kernel.org>,
	John Fastabend <john.fastabend@gmail.com>,
	Stanislav Fomichev <sdf@fomichev.me>,
	Vladimir Oltean <vladimir.oltean@nxp.com>,
	Caleb Sander Mateos <csander@purestorage.com>,
	Taehee Yoo <ap420073@gmail.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	bpf@vger.kernel.org
Subject: Re: [PATCH net v3] ethernet: ionic: Fix DMA mapping tests
Date: Thu, 19 Jun 2025 15:28:06 -0700	[thread overview]
Message-ID: <bb84f844-ac16-4a35-9abf-614bbf576551@amd.com> (raw)
In-Reply-To: <20250619094538.283723-2-fourier.thomas@gmail.com>



On 6/19/2025 2:45 AM, Thomas Fourier wrote:
> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
> 
> 
> Change error values of `ionic_tx_map_single()` and `ionic_tx_map_frag()`
> from 0 to `DMA_MAPPING_ERROR` to prevent collision with 0 as a valid
> address.
> 
> This also fixes the use of `dma_mapping_error()` to test against 0 in
> `ionic_xdp_post_frame()`
> 
> Fixes: 0f3154e6bcb3 ("ionic: Add Tx and Rx handling")

I'm not sure the Fixes commit above should be in the list. Functionally 
it's correct, except there being multiple calls to dma_mapping_error() 
on the same dma_addr.

Other than the minor nit above the commit looks good. Thanks again for 
fixing this.

Reviewed-by: Brett Creeley <brett.creeley@amd.com>

> Fixes: 56e41ee12d2d ("ionic: better dma-map error handling")
> Fixes: ac8813c0ab7d ("ionic: convert Rx queue buffers to use page_pool")
> Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
> ---
>   drivers/net/ethernet/pensando/ionic/ionic_txrx.c | 12 ++++++------
>   1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_txrx.c b/drivers/net/ethernet/pensando/ionic/ionic_txrx.c
> index 2ac59564ded1..d10b58ebf603 100644
> --- a/drivers/net/ethernet/pensando/ionic/ionic_txrx.c
> +++ b/drivers/net/ethernet/pensando/ionic/ionic_txrx.c
> @@ -321,7 +321,7 @@ static int ionic_xdp_post_frame(struct ionic_queue *q, struct xdp_frame *frame,
>                                             len, DMA_TO_DEVICE);
>          } else /* XDP_REDIRECT */ {
>                  dma_addr = ionic_tx_map_single(q, frame->data, len);
> -               if (!dma_addr)
> +               if (dma_addr == DMA_MAPPING_ERROR)
>                          return -EIO;
>          }
> 
> @@ -357,7 +357,7 @@ static int ionic_xdp_post_frame(struct ionic_queue *q, struct xdp_frame *frame,
>                          } else {
>                                  dma_addr = ionic_tx_map_frag(q, frag, 0,
>                                                               skb_frag_size(frag));
> -                               if (dma_mapping_error(q->dev, dma_addr)) {
> +                               if (dma_addr == DMA_MAPPING_ERROR) {
>                                          ionic_tx_desc_unmap_bufs(q, desc_info);
>                                          return -EIO;
>                                  }
> @@ -1083,7 +1083,7 @@ static dma_addr_t ionic_tx_map_single(struct ionic_queue *q,
>                  net_warn_ratelimited("%s: DMA single map failed on %s!\n",
>                                       dev_name(dev), q->name);
>                  q_to_tx_stats(q)->dma_map_err++;
> -               return 0;
> +               return DMA_MAPPING_ERROR;
>          }
>          return dma_addr;
>   }
> @@ -1100,7 +1100,7 @@ static dma_addr_t ionic_tx_map_frag(struct ionic_queue *q,
>                  net_warn_ratelimited("%s: DMA frag map failed on %s!\n",
>                                       dev_name(dev), q->name);
>                  q_to_tx_stats(q)->dma_map_err++;
> -               return 0;
> +               return DMA_MAPPING_ERROR;
>          }
>          return dma_addr;
>   }
> @@ -1116,7 +1116,7 @@ static int ionic_tx_map_skb(struct ionic_queue *q, struct sk_buff *skb,
>          int frag_idx;
> 
>          dma_addr = ionic_tx_map_single(q, skb->data, skb_headlen(skb));
> -       if (!dma_addr)
> +       if (dma_addr == DMA_MAPPING_ERROR)
>                  return -EIO;
>          buf_info->dma_addr = dma_addr;
>          buf_info->len = skb_headlen(skb);
> @@ -1126,7 +1126,7 @@ static int ionic_tx_map_skb(struct ionic_queue *q, struct sk_buff *skb,
>          nfrags = skb_shinfo(skb)->nr_frags;
>          for (frag_idx = 0; frag_idx < nfrags; frag_idx++, frag++) {
>                  dma_addr = ionic_tx_map_frag(q, frag, 0, skb_frag_size(frag));
> -               if (!dma_addr)
> +               if (dma_addr == DMA_MAPPING_ERROR)
>                          goto dma_fail;
>                  buf_info->dma_addr = dma_addr;
>                  buf_info->len = skb_frag_size(frag);
> --
> 2.43.0
> 


  reply	other threads:[~2025-06-19 22:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-19  9:45 Thomas Fourier
2025-06-19 22:28 ` Brett Creeley [this message]
2025-06-20 10:51   ` Simon Horman
2025-06-23 15:44     ` Brett Creeley
2025-06-23 23:44       ` Jakub Kicinski
2025-06-23 23:50 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bb84f844-ac16-4a35-9abf-614bbf576551@amd.com \
    --to=bcreeley@amd.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=ap420073@gmail.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=brett.creeley@amd.com \
    --cc=csander@purestorage.com \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=fourier.thomas@gmail.com \
    --cc=hawk@kernel.org \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sdf@fomichev.me \
    --cc=shannon.nelson@amd.com \
    --cc=vladimir.oltean@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®