From: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
To: Jesper Dangaard Brouer <jbrouer@redhat.com>
Cc: Lorenzo Bianconi <lorenzo@kernel.org>,
bpf@vger.kernel.org, brouer@redhat.com, ast@kernel.org,
daniel@iogearbox.net, andrii@kernel.org, netdev@vger.kernel.org,
davem@davemloft.net, kuba@kernel.org, edumazet@google.com,
pabeni@redhat.com, hawk@kernel.org, john.fastabend@gmail.com
Subject: Re: [PATCH v2 bpf-next] xdp: report rx queue index in xdp_frame
Date: Tue, 23 Aug 2022 14:28:17 +0200 [thread overview]
Message-ID: <YwTH4c/Mk82LIWNM@lore-desk> (raw)
In-Reply-To: <1a22e7e9-e6ef-028f-dffa-e954207dc24d@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 2494 bytes --]
>
> On 17/08/2022 09.40, Lorenzo Bianconi wrote:
> > Report rx queue index in xdp_frame according to the xdp_buff xdp_rxq_info
> > pointer. xdp_frame queue_index is currently used in cpumap code to convert
> > the xdp_frame into a xdp_buff and allow the ebpf program attached to the
> > map entry to differentiate traffic according to the receiving hw queue.
> > xdp_frame size is not increased adding queue_index since an alignment
> > padding in the structure is used to insert queue_index field.
> >
> > Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
>
> (Sorry, I replied to v1 and not this v2.)
>
> I'm still unsure about this change, because the XDP-hints will also
> contain the rx_queue number. And placing it in XDP-hints automatically
> makes it avail for AF_XDP consumers.
>
> I do think it is relevant for the BPF-prog to get access to the rx_queue
> index, because it can be used for scaling the workload.
ack, I agree. Then we can implement it with xdp hw-hints.
Regards,
Lorenzo
>
>
> > ---
> > Changes since v1:
> > - rebase on top of bpf-next
> > ---
> > include/net/xdp.h | 2 ++
> > kernel/bpf/cpumap.c | 2 +-
> > 2 files changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/include/net/xdp.h b/include/net/xdp.h
> > index 04c852c7a77f..3567866b0af5 100644
> > --- a/include/net/xdp.h
> > +++ b/include/net/xdp.h
> > @@ -172,6 +172,7 @@ struct xdp_frame {
> > struct xdp_mem_info mem;
> > struct net_device *dev_rx; /* used by cpumap */
> > u32 flags; /* supported values defined in xdp_buff_flags */
> > + u32 queue_index;
> > };
> > static __always_inline bool xdp_frame_has_frags(struct xdp_frame *frame)
> > @@ -301,6 +302,7 @@ struct xdp_frame *xdp_convert_buff_to_frame(struct xdp_buff *xdp)
> > /* rxq only valid until napi_schedule ends, convert to xdp_mem_info */
> > xdp_frame->mem = xdp->rxq->mem;
> > + xdp_frame->queue_index = xdp->rxq->queue_index;
> > return xdp_frame;
> > }
> > diff --git a/kernel/bpf/cpumap.c b/kernel/bpf/cpumap.c
> > index b5ba34ddd4b6..48003450c98c 100644
> > --- a/kernel/bpf/cpumap.c
> > +++ b/kernel/bpf/cpumap.c
> > @@ -228,7 +228,7 @@ static int cpu_map_bpf_prog_run_xdp(struct bpf_cpu_map_entry *rcpu,
> > rxq.dev = xdpf->dev_rx;
> > rxq.mem = xdpf->mem;
> > - /* TODO: report queue_index to xdp_rxq_info */
> > + rxq.queue_index = xdpf->queue_index;
> > xdp_convert_frame_to_buff(xdpf, &xdp);
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
prev parent reply other threads:[~2022-08-23 15:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-17 7:40 [PATCH v2 bpf-next] xdp: report rx queue index in xdp_frame Lorenzo Bianconi
2022-08-17 12:39 ` Jesper Dangaard Brouer
2022-08-23 12:28 ` Lorenzo Bianconi [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=YwTH4c/Mk82LIWNM@lore-desk \
--to=lorenzo.bianconi@redhat.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=brouer@redhat.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hawk@kernel.org \
--cc=jbrouer@redhat.com \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=lorenzo@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;
as well as URLs for NNTP newsgroup(s).