public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Horatiu Vultur <horatiu.vultur@microchip.com>
To: Alexander Lobakin <aleksander.lobakin@intel.com>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<bpf@vger.kernel.org>, <davem@davemloft.net>,
	<edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>,
	<ast@kernel.org>, <daniel@iogearbox.net>, <hawk@kernel.org>,
	<john.fastabend@gmail.com>, <richardcochran@gmail.com>,
	<UNGLinuxDriver@microchip.com>, <alexandr.lobakin@intel.com>,
	<maciej.fijalkowski@intel.com>
Subject: Re: [PATCH net-next v2] lan966x: Don't use xdp_frame when action is XDP_TX
Date: Fri, 21 Apr 2023 20:32:48 +0200	[thread overview]
Message-ID: <20230421183248.n7a2c67umthlm3fg@soft-dev3-1> (raw)
In-Reply-To: <714b6bd0-014f-a5ab-af02-d4d9e4390454@intel.com>

The 04/21/2023 15:34, Alexander Lobakin wrote:
> 
> From: Horatiu Vultur <horatiu.vultur@microchip.com>
> Date: Fri, 21 Apr 2023 15:14:22 +0200
> 
> [...]
> 
> > @@ -699,15 +701,14 @@ static void lan966x_fdma_tx_start(struct lan966x_tx *tx, int next_to_use)
> >       tx->last_in_use = next_to_use;
> >  }
> >
> > -int lan966x_fdma_xmit_xdpf(struct lan966x_port *port,
> > -                        struct xdp_frame *xdpf,
> > -                        struct page *page,
> > -                        bool dma_map)
> > +int lan966x_fdma_xmit_xdpf(struct lan966x_port *port, void *ptr, u32 len)
> >  {
> >       struct lan966x *lan966x = port->lan966x;
> >       struct lan966x_tx_dcb_buf *next_dcb_buf;
> >       struct lan966x_tx *tx = &lan966x->tx;
> > +     struct xdp_frame *xdpf;
> >       dma_addr_t dma_addr;
> > +     struct page *page;
> >       int next_to_use;
> >       __be32 *ifh;
> >       int ret = 0;
> > @@ -722,8 +723,19 @@ int lan966x_fdma_xmit_xdpf(struct lan966x_port *port,
> >               goto out;
> >       }
> >
> > +     /* Fill up the buffer */
> > +     next_dcb_buf = &tx->dcbs_buf[next_to_use];
> > +     next_dcb_buf->use_skb = false;
> > +     next_dcb_buf->xdp_ndo = !len;
> > +     next_dcb_buf->len = len + IFH_LEN_BYTES;
> 
> Is it intended that for .ndo_xdp_xmit cases this field will equal just
> %IFH_LEN_BYTES as @len is zero?

Argh, no it is a mistake. For that case it should be xdpf->len +
IFH_LEN_BYTES. As I focus on the XDP_TX, I fogot to test also
XDP_REDIRECT. :(
Thanks for the good catch!

I will fix this in the next version.

> 
> > +     next_dcb_buf->used = true;
> > +     next_dcb_buf->ptp = false;
> > +     next_dcb_buf->dev = port->dev;
> > +
> >       /* Generate new IFH */
> > -     if (dma_map) {
> > +     if (!len) {
> > +             xdpf = ptr;
> > +
> >               if (xdpf->headroom < IFH_LEN_BYTES) {
> >                       ret = NETDEV_TX_OK;
> >                       goto out;
> [...]
> 
> Thanks,
> Olek

-- 
/Horatiu

      reply	other threads:[~2023-04-21 18:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-21 13:14 [PATCH net-next v2] lan966x: Don't use xdp_frame when action is XDP_TX Horatiu Vultur
2023-04-21 13:34 ` Alexander Lobakin
2023-04-21 18:32   ` Horatiu Vultur [this message]

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=20230421183248.n7a2c67umthlm3fg@soft-dev3-1 \
    --to=horatiu.vultur@microchip.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=aleksander.lobakin@intel.com \
    --cc=alexandr.lobakin@intel.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hawk@kernel.org \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maciej.fijalkowski@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=richardcochran@gmail.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