All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
To: Jesper Dangaard Brouer <jbrouer@redhat.com>
Cc: "Ong, Boon Leong" <boon.leong.ong@intel.com>,
	"Karlsson, Magnus" <magnus.karlsson@intel.com>,
	brouer@redhat.com, "Björn Töpel" <bjorn@kernel.org>,
	"Desouza, Ederson" <ederson.desouza@intel.com>,
	Xdp <xdp-newbies@vger.kernel.org>,
	"Joao Pedro Barros Silva" <jopbs@vestas.com>,
	"Diogo Alexandre Da Silva Lima" <dioli@vestas.com>
Subject: Re: AF_XDP not transmitting frames immediately
Date: Tue, 14 Dec 2021 17:05:44 +0100	[thread overview]
Message-ID: <YbjA2DggYcrytkTp@boxer> (raw)
In-Reply-To: <7a888c6c-1f54-6e82-a4d0-794465cf17c3@redhat.com>

On Tue, Dec 14, 2021 at 04:42:18PM +0100, Jesper Dangaard Brouer wrote:
> 
> On 14/12/2021 15.57, Ong, Boon Leong wrote:
> > > I suspected Boon Leong (cc) would have this hardware.
> >
> > Unfortunately, my current setup in lab does not have I225 hooked-up
> > and I am working remotely due to control access to intel facility.
> > Perhaps, Ederson may have ready system to test?
> > 
> > For ZC mode, the igc driver (also true to stmmac) depends on the XSK wakeup
> > to trigger the NAPI poll (igc_poll) to first clean-up Tx ring and eventually call
> > igc_xdp_xmit_zc() to start submitting Tx frame into DMA engine. We have
> > used busy-poll to ensure in smaller Tx frame latency/jitter.
> > 
> > There was another issue in stmmac that was patched [1] recently to ensure
> > the driver does not perform MAC reset whenever XDP program is added
> > so that between XDP socket creation, the Tx transmit does not take extra
> > 2-3s due to link down/up. Jesper, are you seeing something similar in your
> > app?
> 
> Yes, and it is quite annoying.
> 
> In my setup, if I AF_XDP transmit packets too early they are simply lost...
> that confused me a bit.
> 
> I wanted to ask AF_XDP maintainers:
>  - What is the best way to know when AF_XDP is ready to Tx packets?
> 
> E.g. what API should I call, e.g. that blocks, until XSK socket is ready to
> transmit on?

Not a maintainer, but anyway.
From a driver POV xsk_tx_peek_desc() (or batching variant) is used to make
sure that user space produced entries in the XSK Tx ring so that driver
can consume it and place it onto HW descriptors.

From the top of my head I'm not aware of any blocking calls, maybe you
could spin on xsk_tx_peek_desc.

For igc maybe it would be worth returning some status from
igc_xdp_xmit_zc(). Like, imagine that you consumed all the budget but
there are still descriptors in the XSK Tx ring. You'd like to signal to
NAPI that there is still work to be done.

> 
> 
> > If yes, then it is likely because of the implementation of igc driver in mainline
> > that is doing igc_down(), a little bit too aggressive in reseting MAC completely.
> > 
> 
> It would be good to fix igc too, like[1].
> BUT afaik it will only make the window smaller when XSK is not ready for TX
> packets.
> 
> 
> > [1]https://patchwork.kernel.org/project/netdevbpf/patch/20211111143949.2806049-1-boon.leong.ong@intel.com/
> > 
> 
> Thanks for the link
> --Jesper
> 

  reply	other threads:[~2021-12-14 16:07 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-13 21:04 AF_XDP not transmitting frames immediately Jesper Dangaard Brouer
2021-12-14  8:07 ` Karlsson, Magnus
2021-12-14 10:32   ` Jesper Dangaard Brouer
2021-12-14 10:40     ` Karlsson, Magnus
2021-12-14 11:25       ` Maciej Fijalkowski
2021-12-14 14:04         ` Jesper Dangaard Brouer
2021-12-14 14:57           ` Ong, Boon Leong
2021-12-14 15:42             ` Jesper Dangaard Brouer
2021-12-14 16:05               ` Maciej Fijalkowski [this message]
2021-12-15  1:08       ` Desouza, Ederson
2021-12-15  8:41         ` Jesper Dangaard Brouer
2021-12-15 10:17   ` Jesper Dangaard Brouer
2021-12-15 11:07     ` Karlsson, Magnus
2021-12-15 17:11       ` Jesper Dangaard Brouer
2021-12-16  8:34         ` Karlsson, Magnus
2021-12-16 15:28           ` Jakub Kicinski

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=YbjA2DggYcrytkTp@boxer \
    --to=maciej.fijalkowski@intel.com \
    --cc=bjorn@kernel.org \
    --cc=boon.leong.ong@intel.com \
    --cc=brouer@redhat.com \
    --cc=dioli@vestas.com \
    --cc=ederson.desouza@intel.com \
    --cc=jbrouer@redhat.com \
    --cc=jopbs@vestas.com \
    --cc=magnus.karlsson@intel.com \
    --cc=xdp-newbies@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.