All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC] xdp, multiple rss objects
@ 2019-03-29 16:14 Jonathan Lemon
  2019-03-29 21:24 ` Jakub Kicinski
  2019-03-30 15:52 ` William Tu
  0 siblings, 2 replies; 5+ messages in thread
From: Jonathan Lemon @ 2019-03-29 16:14 UTC (permalink / raw)
  To: netdev
  Cc: Magnus Karlsson, Björn Töpel, jakub.kicinski, Saeed Mahameed

Background:

With AF_XDP, packets are placed on queues which are serviced directly from
an application running in user space, which promises greatly increased
performance.  However, not all incoming packets should be delivered to the
application; there may be management traffic, or packets which should be
handled by normal Linux networking applications.

Having the AF_XDP application handle the packets and return them to the
kernel for processing is not ideal, nor is adding a bpf filter at the kernel
level which performs the redirection.  It would be nicer if the redirection
was done in the NIC itself.  Fortunately, there is a facility for this: the
RX network flow classification.

Unfortunately, the target of the classification is currently a single queue.

Traffic arriving at a NIC which is not steered to a specific queue can be
distributed across a set of queues through the RX flow hash redirection
table (RSS steering).  But being able to target a separate RSS object would
allow arbitrary distribution of previously classified traffic.

Ask:

It would be nice to have more than one RSS table, which would be the target
of a classifier or default packet stream.

Queues would be attached to an RSS object, and flow classifiers could target
the RSS object for further distribution.  For example, something like:

  ethtool -X eth0 rss 0 queue 0-13
  ethtool -X eth0 rss 1 queue 14-55
  ethtool -N eth0 flow-type udp6 dst-port 4242 rss 1

This would set up a default RSS object (rss 0), which sprays traffic to 14
queues; this would be equivalent to "ethtool -X eth0 equal 14".  At the same
time, a second object (rss 1) is set up, distributing traffic across another
set of queues.

Is there interest in adding this type of feature?  Having the ability to
express this concept (not necessarily in ethtool) should facilitate having
HW vendors add this to their products.  I believe that some vendors have
hardware which may be capable of this already.
-- 
Jonathan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFC] xdp, multiple rss objects
  2019-03-29 16:14 [RFC] xdp, multiple rss objects Jonathan Lemon
@ 2019-03-29 21:24 ` Jakub Kicinski
  2019-03-29 21:57   ` Jonathan Lemon
  2019-03-30 15:52 ` William Tu
  1 sibling, 1 reply; 5+ messages in thread
From: Jakub Kicinski @ 2019-03-29 21:24 UTC (permalink / raw)
  To: Jonathan Lemon
  Cc: netdev, Magnus Karlsson, Björn Töpel, Saeed Mahameed

On Fri, 29 Mar 2019 16:14:57 +0000, Jonathan Lemon wrote:
> Background:
> 
> With AF_XDP, packets are placed on queues which are serviced directly from
> an application running in user space, which promises greatly increased
> performance.  However, not all incoming packets should be delivered to the
> application; there may be management traffic, or packets which should be
> handled by normal Linux networking applications.
> 
> Having the AF_XDP application handle the packets and return them to the
> kernel for processing is not ideal, nor is adding a bpf filter at the kernel
> level which performs the redirection.  It would be nicer if the redirection
> was done in the NIC itself.  Fortunately, there is a facility for this: the
> RX network flow classification.
> 
> Unfortunately, the target of the classification is currently a single queue.
> 
> Traffic arriving at a NIC which is not steered to a specific queue can be
> distributed across a set of queues through the RX flow hash redirection
> table (RSS steering).  But being able to target a separate RSS object would
> allow arbitrary distribution of previously classified traffic.
> 
> Ask:
> 
> It would be nice to have more than one RSS table, which would be the target
> of a classifier or default packet stream.
> 
> Queues would be attached to an RSS object, and flow classifiers could target
> the RSS object for further distribution.  For example, something like:
> 
>   ethtool -X eth0 rss 0 queue 0-13
>   ethtool -X eth0 rss 1 queue 14-55
>   ethtool -N eth0 flow-type udp6 dst-port 4242 rss 1
> 
> This would set up a default RSS object (rss 0), which sprays traffic to 14
> queues; this would be equivalent to "ethtool -X eth0 equal 14".  At the same
> time, a second object (rss 1) is set up, distributing traffic across another
> set of queues.
> 
> Is there interest in adding this type of feature?  Having the ability to
> express this concept (not necessarily in ethtool) should facilitate having
> HW vendors add this to their products.  I believe that some vendors have
> hardware which may be capable of this already.

I thought Ed Cree added something like that to ethtool - multiple RSS
contexts that is: commit 84a1d9c48200 ("net: ethtool: extend RXNFC API
to support RSS spreading of filter matches").

With Netronome NICs you could also program your RSS with offloaded BPF.

Unfortunately only Intel supports AF_XDP right now so that probably
doesn't help you :(

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFC] xdp, multiple rss objects
  2019-03-29 21:24 ` Jakub Kicinski
@ 2019-03-29 21:57   ` Jonathan Lemon
  0 siblings, 0 replies; 5+ messages in thread
From: Jonathan Lemon @ 2019-03-29 21:57 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: netdev, Magnus Karlsson, Björn Töpel, Saeed Mahameed


On 29 Mar 2019, at 14:24, Jakub Kicinski wrote:

> On Fri, 29 Mar 2019 16:14:57 +0000, Jonathan Lemon wrote:
>> Background:
>>
>> With AF_XDP, packets are placed on queues which are serviced directly 
>> from
>> an application running in user space, which promises greatly 
>> increased
>> performance.  However, not all incoming packets should be delivered 
>> to the
>> application; there may be management traffic, or packets which should 
>> be
>> handled by normal Linux networking applications.
>>
>> Having the AF_XDP application handle the packets and return them to 
>> the
>> kernel for processing is not ideal, nor is adding a bpf filter at the 
>> kernel
>> level which performs the redirection.  It would be nicer if the 
>> redirection
>> was done in the NIC itself.  Fortunately, there is a facility for 
>> this: the
>> RX network flow classification.
>>
>> Unfortunately, the target of the classification is currently a single 
>> queue.
>>
>> Traffic arriving at a NIC which is not steered to a specific queue 
>> can be
>> distributed across a set of queues through the RX flow hash 
>> redirection
>> table (RSS steering).  But being able to target a separate RSS object 
>> would
>> allow arbitrary distribution of previously classified traffic.
>>
>> Ask:
>>
>> It would be nice to have more than one RSS table, which would be the 
>> target
>> of a classifier or default packet stream.
>>
>> Queues would be attached to an RSS object, and flow classifiers could 
>> target
>> the RSS object for further distribution.  For example, something 
>> like:
>>
>>   ethtool -X eth0 rss 0 queue 0-13
>>   ethtool -X eth0 rss 1 queue 14-55
>>   ethtool -N eth0 flow-type udp6 dst-port 4242 rss 1
>>
>> This would set up a default RSS object (rss 0), which sprays traffic 
>> to 14
>> queues; this would be equivalent to "ethtool -X eth0 equal 14".  At 
>> the same
>> time, a second object (rss 1) is set up, distributing traffic across 
>> another
>> set of queues.
>>
>> Is there interest in adding this type of feature?  Having the ability 
>> to
>> express this concept (not necessarily in ethtool) should facilitate 
>> having
>> HW vendors add this to their products.  I believe that some vendors 
>> have
>> hardware which may be capable of this already.
>
> I thought Ed Cree added something like that to ethtool - multiple RSS
> contexts that is: commit 84a1d9c48200 ("net: ethtool: extend RXNFC API
> to support RSS spreading of filter matches").
>
> With Netronome NICs you could also program your RSS with offloaded 
> BPF.
>
> Unfortunately only Intel supports AF_XDP right now so that probably
> doesn't help you :(

Thanks - I didn't know about the ethtool changes.  This does look fairly
close to what I'm looking for, but I'm not seeing the ability to specify
a distribution of (start, length).
-- 
Jonathan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFC] xdp, multiple rss objects
  2019-03-29 16:14 [RFC] xdp, multiple rss objects Jonathan Lemon
  2019-03-29 21:24 ` Jakub Kicinski
@ 2019-03-30 15:52 ` William Tu
  2019-04-01 16:25   ` Jonathan Lemon
  1 sibling, 1 reply; 5+ messages in thread
From: William Tu @ 2019-03-30 15:52 UTC (permalink / raw)
  To: Jonathan Lemon
  Cc: netdev, Magnus Karlsson, Björn Töpel, jakub.kicinski,
	Saeed Mahameed

Hi Jonathan,

Sorry I don't have good suggestions but I have a couple of questions.

On Fri, Mar 29, 2019 at 9:17 AM Jonathan Lemon <bsd@fb.com> wrote:
>
> Background:
>
> With AF_XDP, packets are placed on queues which are serviced directly from
> an application running in user space, which promises greatly increased
> performance.  However, not all incoming packets should be delivered to the
> application; there may be management traffic, or packets which should be
> handled by normal Linux networking applications.

I thought we can put a XDP program to filter for AF_XDP.
So pass the management traffic to normal linux networking stack, and
other traffic to AF_XDP socket. Does this help?

>
> Having the AF_XDP application handle the packets and return them to the
> kernel for processing is not ideal, nor is adding a bpf filter at the kernel
> level which performs the redirection.  It would be nicer if the redirection
> was done in the NIC itself.  Fortunately, there is a facility for this: the
> RX network flow classification.
>
May I know your use case for packets handled in AF_XDP, and then
return/re-inject to kernel?
Our case is that when packets received from AF_XDP netdev, we want
to forward to a vm (tun/tap) or container (veth), so have to reinject to kernel.

Regards,
William

> Unfortunately, the target of the classification is currently a single queue.
>
> Traffic arriving at a NIC which is not steered to a specific queue can be
> distributed across a set of queues through the RX flow hash redirection
> table (RSS steering).  But being able to target a separate RSS object would
> allow arbitrary distribution of previously classified traffic.
>
> Ask:
>
> It would be nice to have more than one RSS table, which would be the target
> of a classifier or default packet stream.
>
> Queues would be attached to an RSS object, and flow classifiers could target
> the RSS object for further distribution.  For example, something like:
>
>   ethtool -X eth0 rss 0 queue 0-13
>   ethtool -X eth0 rss 1 queue 14-55
>   ethtool -N eth0 flow-type udp6 dst-port 4242 rss 1
>
> This would set up a default RSS object (rss 0), which sprays traffic to 14
> queues; this would be equivalent to "ethtool -X eth0 equal 14".  At the same
> time, a second object (rss 1) is set up, distributing traffic across another
> set of queues.
>
> Is there interest in adding this type of feature?  Having the ability to
> express this concept (not necessarily in ethtool) should facilitate having
> HW vendors add this to their products.  I believe that some vendors have
> hardware which may be capable of this already.
> --
> Jonathan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFC] xdp, multiple rss objects
  2019-03-30 15:52 ` William Tu
@ 2019-04-01 16:25   ` Jonathan Lemon
  0 siblings, 0 replies; 5+ messages in thread
From: Jonathan Lemon @ 2019-04-01 16:25 UTC (permalink / raw)
  To: William Tu
  Cc: netdev, Magnus Karlsson, Björn Töpel, jakub.kicinski,
	Saeed Mahameed



On 30 Mar 2019, at 8:52, William Tu wrote:

> Hi Jonathan,
>
> Sorry I don't have good suggestions but I have a couple of questions.
>
> On Fri, Mar 29, 2019 at 9:17 AM Jonathan Lemon <bsd@fb.com> wrote:
>>
>> Background:
>>
>> With AF_XDP, packets are placed on queues which are serviced directly 
>> from
>> an application running in user space, which promises greatly 
>> increased
>> performance.  However, not all incoming packets should be delivered 
>> to the
>> application; there may be management traffic, or packets which should 
>> be
>> handled by normal Linux networking applications.
>
> I thought we can put a XDP program to filter for AF_XDP.
> So pass the management traffic to normal linux networking stack, and
> other traffic to AF_XDP socket. Does this help?

It's not an ideal situation - the CPU still has to handle the redirected
traffic.


>> Having the AF_XDP application handle the packets and return them to 
>> the
>> kernel for processing is not ideal, nor is adding a bpf filter at the 
>> kernel
>> level which performs the redirection.  It would be nicer if the 
>> redirection
>> was done in the NIC itself.  Fortunately, there is a facility for 
>> this: the
>> RX network flow classification.
>>
> May I know your use case for packets handled in AF_XDP, and then
> return/re-inject to kernel?
> Our case is that when packets received from AF_XDP netdev, we want
> to forward to a vm (tun/tap) or container (veth), so have to reinject 
> to kernel.

One of the cases I'm targeting is QUIC, another is a custom application. 
  In
both cases these AF_XDP applications are not the only thing running on 
the box.
Packets for these applications would be received, and then sent out 
directly,
while packets for other apps would be handled via the kernel normally.
-- 
Jonathan

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-04-01 16:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-29 16:14 [RFC] xdp, multiple rss objects Jonathan Lemon
2019-03-29 21:24 ` Jakub Kicinski
2019-03-29 21:57   ` Jonathan Lemon
2019-03-30 15:52 ` William Tu
2019-04-01 16:25   ` Jonathan Lemon

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.