From: "Nguyen, Anthony L" <anthony.l.nguyen@intel.com>
To: "Lobakin, Alexandr" <alexandr.lobakin@intel.com>,
"jbrouer@redhat.com" <jbrouer@redhat.com>
Cc: "borkmann@iogearbox.net" <borkmann@iogearbox.net>,
"Karlsson, Magnus" <magnus.karlsson@intel.com>,
"davem@davemloft.net" <davem@davemloft.net>,
"bjorn@kernel.org" <bjorn@kernel.org>,
"brouer@redhat.com" <brouer@redhat.com>,
"Brandeburg, Jesse" <jesse.brandeburg@intel.com>,
"kuba@kernel.org" <kuba@kernel.org>,
"intel-wired-lan@lists.osuosl.org"
<intel-wired-lan@lists.osuosl.org>,
"bpf@vger.kernel.org" <bpf@vger.kernel.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [PATCH net-next 2/2] igc: enable XDP metadata in driver
Date: Mon, 29 Nov 2021 19:03:15 +0000 [thread overview]
Message-ID: <9948428f33d013105108872d51f7e6ebec21203c.camel@intel.com> (raw)
In-Reply-To: <20211129181320.579477-1-alexandr.lobakin@intel.com>
On Mon, 2021-11-29 at 19:13 +0100, Alexander Lobakin wrote:
> From: Alexander Lobakin <alexandr.lobakin@intel.com>
> Date: Mon, 29 Nov 2021 15:53:03 +0100
>
> > From: Jesper Dangaard Brouer <jbrouer@redhat.com>
> > Date: Mon, 29 Nov 2021 15:39:04 +0100
> >
> > > On 26/11/2021 17.16, Alexander Lobakin wrote:
> > > > From: Jesper Dangaard Brouer <brouer@redhat.com>
> > > > Date: Mon, 15 Nov 2021 21:36:30 +0100
> > > >
> > > > > Enabling the XDP bpf_prog access to data_meta area is a very
> > > > > small
> > > > > change. Hint passing 'true' to xdp_prepare_buff().
>
> [ snip ]
>
> > > Prefetch works for "full" cachelines. Intel CPUs often prefect
> > > two
> > > cache-lines, when doing this, thus I guess we still get xdp-
> > > >data.
> >
> > Sure. I mean, net_prefetch() prefetches 128 bytes in a row.
> > xdp->data is usually aligned to XDP_PACKET_HEADROOM (or two bytes
> > to the right). If our CL is 64 and the meta is present, then... ah
> > right, 64 to the left and 64 starting from data to the right.
> >
> > > I don't mind prefetching xdp->data_meta, but (1) I tried to keep
> > > the
> > > xdp->data starts on a cacheline and we know NIC hardware have
> > > touched
> > > that, it is not a full-cache-miss due to DDIO/DCA it is known to
> > > be in
> > > L3 cache (gain is around 2-3 ns in my machine for data prefetch).
> > > Given this is only a 2.5 Gbit/s driver/HW I doubt this make any
> > > difference.
> >
> > Code constistency at least. On 10+ Gbps we prefetch meta, and I
> > plan
> > to continue doing this in my series.
> >
> > > Tony is it worth resending a V2 of this patch?
> >
> > Tony, you can take it as it is if you want, I'll correct it later
> > in
> > mine. Up to you.
>
> My "fixup" looks like (in case of v2 needed or so):
Thanks Al. If Jesper is ok with this, I'll incorporate it in before
sending the pull request to netdev. Otherwise, you can do it as follow
on in the other series you previously referenced.
Thanks,
Tony
> diff --git a/drivers/net/ethernet/intel/igc/igc_main.c
> b/drivers/net/ethernet/intel/igc/igc_main.c
> index b516f1b301b4..142c57b7a451 100644
> --- a/drivers/net/ethernet/intel/igc/igc_main.c
> +++ b/drivers/net/ethernet/intel/igc/igc_main.c
> @@ -1726,7 +1726,7 @@ static struct sk_buff *igc_build_skb(struct
> igc_ring *rx_ring,
> struct sk_buff *skb;
>
> /* prefetch first cache line of first page */
> - net_prefetch(xdp->data);
> + net_prefetch(xdp->data_meta);
>
> /* build an skb around the page buffer */
> skb = build_skb(xdp->data_hard_start, truesize);
> @@ -1756,10 +1756,11 @@ static struct sk_buff
> *igc_construct_skb(struct igc_ring *rx_ring,
> struct sk_buff *skb;
>
> /* prefetch first cache line of first page */
> - net_prefetch(va);
> + net_prefetch(xdp->data_meta);
>
> /* allocate a skb to store the frags */
> - skb = napi_alloc_skb(&rx_ring->q_vector->napi, IGC_RX_HDR_LEN
> + metasize);
> + skb = napi_alloc_skb(&rx_ring->q_vector->napi,
> + IGC_RX_HDR_LEN + metasize);
> if (unlikely(!skb))
> return NULL;
>
> @@ -2363,7 +2364,8 @@ static int igc_clean_rx_irq(struct igc_q_vector
> *q_vector, const int budget)
> if (!skb) {
> xdp_init_buff(&xdp, truesize, &rx_ring-
> >xdp_rxq);
> xdp_prepare_buff(&xdp, pktbuf -
> igc_rx_offset(rx_ring),
> - igc_rx_offset(rx_ring) +
> pkt_offset, size, true);
> + igc_rx_offset(rx_ring) +
> pkt_offset,
> + size, true);
>
> skb = igc_xdp_run_prog(adapter, &xdp);
> }
next prev parent reply other threads:[~2021-11-29 19:05 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-15 20:36 [PATCH net-next 0/2] igc: driver change to support XDP metadata Jesper Dangaard Brouer
2021-11-15 20:36 ` [PATCH net-next 1/2] igc: AF_XDP zero-copy metadata adjust breaks SKBs on XDP_PASS Jesper Dangaard Brouer
2021-11-21 10:32 ` [Intel-wired-lan] " Kraus, NechamaX
2021-11-26 15:25 ` Maciej Fijalkowski
2021-11-26 15:32 ` Jesper Dangaard Brouer
2021-11-26 15:54 ` Alexander Lobakin
2021-11-15 20:36 ` [PATCH net-next 2/2] igc: enable XDP metadata in driver Jesper Dangaard Brouer
2021-11-21 10:33 ` [Intel-wired-lan] " Kraus, NechamaX
2021-11-26 16:16 ` Alexander Lobakin
2021-11-29 14:39 ` Jesper Dangaard Brouer
2021-11-29 14:53 ` Alexander Lobakin
2021-11-29 18:13 ` Alexander Lobakin
2021-11-29 19:03 ` Nguyen, Anthony L [this message]
2021-11-30 11:25 ` Jesper Dangaard Brouer
2021-11-29 14:10 ` [PATCH net-next 0/2] igc: driver change to support XDP metadata Alexander Lobakin
2021-11-29 14:29 ` Jesper Dangaard Brouer
2021-11-29 14:41 ` Alexander Lobakin
-- strict thread matches above, loose matches on Subject: below --
2021-11-30 17:59 [PATCH net-next 0/2][pull request] 1GbE Intel Wired LAN Driver Updates 2021-11-30 Tony Nguyen
2021-11-30 17:59 ` [PATCH net-next 2/2] igc: enable XDP metadata in driver Tony Nguyen
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=9948428f33d013105108872d51f7e6ebec21203c.camel@intel.com \
--to=anthony.l.nguyen@intel.com \
--cc=alexandr.lobakin@intel.com \
--cc=bjorn@kernel.org \
--cc=borkmann@iogearbox.net \
--cc=bpf@vger.kernel.org \
--cc=brouer@redhat.com \
--cc=davem@davemloft.net \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=jbrouer@redhat.com \
--cc=jesse.brandeburg@intel.com \
--cc=kuba@kernel.org \
--cc=magnus.karlsson@intel.com \
--cc=netdev@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox