From: Horatiu Vultur <horatiu.vultur@microchip.com>
To: Alexander Lobakin <alexandr.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>, <UNGLinuxDriver@microchip.com>
Subject: Re: [PATCH net-next 1/5] net: lan966x: Add XDP_PACKET_HEADROOM
Date: Mon, 14 Nov 2022 20:39:40 +0100 [thread overview]
Message-ID: <20221114193940.whiwpojrwast7tnl@soft-dev3-1> (raw)
In-Reply-To: <20221114141633.699268-1-alexandr.lobakin@intel.com>
The 11/14/2022 15:16, Alexander Lobakin wrote:
> [Some people who received this message don't often get email from alexandr.lobakin@intel.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> From: Horatiu Vultur <horatiu.vultur@microchip.com>
> Date: Sun, 13 Nov 2022 12:15:55 +0100
Hi Olek,
>
> > Update the page_pool params to allocate XDP_PACKET_HEADROOM space as
> > headroom for all received frames.
> > This is needed for when the XDP_TX and XDP_REDIRECT are implemented.
> >
> > Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
> > ---
>
> [...]
>
> > @@ -466,7 +472,8 @@ static struct sk_buff *lan966x_fdma_rx_get_frame(struct lan966x_rx *rx,
> >
> > skb_mark_for_recycle(skb);
> >
> > - skb_put(skb, FDMA_DCB_STATUS_BLOCKL(db->status));
> > + skb_put(skb, FDMA_DCB_STATUS_BLOCKL(db->status) + XDP_PACKET_HEADROOM);
> > + skb_pull(skb, XDP_PACKET_HEADROOM);
>
> These two must be:
>
> + skb_reserve(skb, XDP_PACKET_HEADROOM);
> skb_put(skb, FDMA_DCB_STATUS_BLOCKL(db->status));
>
> i.e. you only need to add reserve, and that's it. It's not only
> faster, but also moves ::tail, which is essential.
Thanks for the suggestion. I will do that in the next version.
>
> >
> > lan966x_ifh_get_timestamp(skb->data, ×tamp);
> >
>
> [...]
>
> > --- a/drivers/net/ethernet/microchip/lan966x/lan966x_xdp.c
> > +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_xdp.c
> > @@ -44,8 +44,9 @@ int lan966x_xdp_run(struct lan966x_port *port, struct page *page, u32 data_len)
> >
> > xdp_init_buff(&xdp, PAGE_SIZE << lan966x->rx.page_order,
> > &port->xdp_rxq);
> > - xdp_prepare_buff(&xdp, page_address(page), IFH_LEN_BYTES,
> > - data_len - IFH_LEN_BYTES, false);
> > + xdp_prepare_buff(&xdp, page_address(page),
> > + IFH_LEN_BYTES + XDP_PACKET_HEADROOM,
> > + data_len - IFH_LEN_BYTES - XDP_PACKET_HEADROOM, false);
>
> Are you sure you need to substract %XDP_PACKET_HEADROOM from
> @data_len? I think @data_len is the frame length, so headroom is not
> included?
Actually @data_len contains also the XDP_PACKET_HEADROOM. I am calling
lan966x_xdp_run like this:
---
return lan966x_xdp_run(port, page,
FDMA_DCB_STATUS_BLOCKL(db->status) + XDP_PACKET_HEADROOM);
---
But from what I can see, that doesn't make too much sense.
Because I am adding here the XDP_PACKET_HEADROOM and then remove it in
xdp_prepare_buff. So it would be better not to add it at all.
>
> > act = bpf_prog_run_xdp(xdp_prog, &xdp);
> > switch (act) {
> > case XDP_PASS:
> > --
> > 2.38.0
>
> Thanks,
> Olek
--
/Horatiu
next prev parent reply other threads:[~2022-11-14 19:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-13 11:15 [PATCH net-next 0/5] net: lan966x: Extend xdp support Horatiu Vultur
2022-11-13 11:15 ` [PATCH net-next 1/5] net: lan966x: Add XDP_PACKET_HEADROOM Horatiu Vultur
2022-11-14 14:16 ` Alexander Lobakin
2022-11-14 19:39 ` Horatiu Vultur [this message]
2022-11-13 11:15 ` [PATCH net-next 2/5] net: lan966x: Introduce helper functions Horatiu Vultur
2022-11-13 11:15 ` [PATCH net-next 3/5] net: lan966x: Add len field to lan966x_tx_dcb_buf Horatiu Vultur
2022-11-13 11:15 ` [PATCH net-next 4/5] net: lan966x: Add support for XDP_TX Horatiu Vultur
2022-11-13 11:15 ` [PATCH net-next 5/5] net: lan966x: Add support for XDP_REDIRECT Horatiu Vultur
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=20221114193940.whiwpojrwast7tnl@soft-dev3-1 \
--to=horatiu.vultur@microchip.com \
--cc=UNGLinuxDriver@microchip.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=netdev@vger.kernel.org \
--cc=pabeni@redhat.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