netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stanislav Fomichev <stfomichev@gmail.com>
To: Magnus Karlsson <magnus.karlsson@gmail.com>
Cc: Wang Liang <wangliang74@huawei.com>,
	bjorn@kernel.org, magnus.karlsson@intel.com,
	maciej.fijalkowski@intel.com, jonathan.lemon@gmail.com,
	davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, horms@kernel.org, ast@kernel.org,
	daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com,
	yuehaibing@huawei.com, zhangchangzhong@huawei.com,
	netdev@vger.kernel.org, bpf@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] xsk: fix __xsk_generic_xmit() error code when cq is full
Date: Mon, 24 Feb 2025 08:00:04 -0800	[thread overview]
Message-ID: <Z7yXhHezJTgYh76T@mini-arch> (raw)
In-Reply-To: <CAJ8uoz1fZ3zYVKergPn-QYRQEpPfC_jNgtY3wzoxxJWFF22LKA@mail.gmail.com>

On 02/24, Magnus Karlsson wrote:
> On Sat, 22 Feb 2025 at 10:18, Wang Liang <wangliang74@huawei.com> wrote:
> >
> > When the cq reservation is failed, the error code is not set which is
> > initialized to zero in __xsk_generic_xmit(). That means the packet is not
> > send successfully but sendto() return ok.
> >
> > Set the error code and make xskq_prod_reserve_addr()/xskq_prod_reserve()
> > return values more meaningful when the queue is full.
> 
> Hi Wang,
> 
> I agree that this would have been a really good idea if it was
> implemented from day one, but now I do not dare to change this since
> it would be changing the uapi. Let us say you have the following quite
> common code snippet for sending a packet with AF_XDP in skb mode:
> 
> err = sendmsg();
> if (err && err != -EAGAIN && err != -EBUSY)
>     goto die_due_to_error;
> continue with code
> 
> This code would with your change go and die suddenly when the
> completion ring is full instead of working. Maybe there is a piece of
> code that cleans the completion ring after these lines of code and
> next time sendmsg() is called, the packet will get sent, so the
> application used to work.
> 
> So I say: let us not do this. But if anyone has another opinion, please share.

Can we return -EBUSY from this 'if (xsk_cq_reserve_addr_locked())' case as
well?

  reply	other threads:[~2025-02-24 16:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-22  9:30 [PATCH net] xsk: fix __xsk_generic_xmit() error code when cq is full Wang Liang
2025-02-24 12:55 ` Magnus Karlsson
2025-02-24 16:00   ` Stanislav Fomichev [this message]
2025-02-24 17:14     ` Magnus Karlsson
2025-02-25  1:45       ` Wang Liang

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=Z7yXhHezJTgYh76T@mini-arch \
    --to=stfomichev@gmail.com \
    --cc=ast@kernel.org \
    --cc=bjorn@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hawk@kernel.org \
    --cc=horms@kernel.org \
    --cc=john.fastabend@gmail.com \
    --cc=jonathan.lemon@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maciej.fijalkowski@intel.com \
    --cc=magnus.karlsson@gmail.com \
    --cc=magnus.karlsson@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=wangliang74@huawei.com \
    --cc=yuehaibing@huawei.com \
    --cc=zhangchangzhong@huawei.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;
as well as URLs for NNTP newsgroup(s).