netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* ndo_xdp_xmit - on which queue to transmit the packet (if core_id >= total_xdp_queues ) ?
@ 2019-09-06 20:49 Manish Chopra
  2019-09-06 22:56 ` Toke Høiland-Jørgensen
  0 siblings, 1 reply; 2+ messages in thread
From: Manish Chopra @ 2019-09-06 20:49 UTC (permalink / raw)
  To: netdev

Hello,

I am working on XDP_REDIRECT implementation and got a query. Some of the ethernet drivers decide the xdp queue index on which xdp packet should be redirected based
on smp_processor_id() in their ndo_xdp_xmit() handler, if smp_processor_id() >= total_num_xdp_queues, they decide to drop the packets and return error from the handler.
I am hitting the same condition where using 8 XDP queues, I get CPU id 8 to redirect the XDP packet and I am not sure if it should be dropped or can be transmitted on a
queue (= smp_processor_id() % total_num_xdp_queues) safely ?.

freescale/dpaa2 seems to be handling this case by sending the packet on the queue (= smp_processor_id() % total_num_xdp_queues) but unsure what should be the expected behavior. 

Regards,
Manish Chopra.

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

* Re: ndo_xdp_xmit - on which queue to transmit the packet (if core_id >= total_xdp_queues ) ?
  2019-09-06 20:49 ndo_xdp_xmit - on which queue to transmit the packet (if core_id >= total_xdp_queues ) ? Manish Chopra
@ 2019-09-06 22:56 ` Toke Høiland-Jørgensen
  0 siblings, 0 replies; 2+ messages in thread
From: Toke Høiland-Jørgensen @ 2019-09-06 22:56 UTC (permalink / raw)
  To: Manish Chopra, netdev

Manish Chopra <manishc@marvell.com> writes:

> Hello,
>
> I am working on XDP_REDIRECT implementation and got a query. Some of
> the ethernet drivers decide the xdp queue index on which xdp packet
> should be redirected based on smp_processor_id() in their
> ndo_xdp_xmit() handler, if smp_processor_id() >= total_num_xdp_queues,
> they decide to drop the packets and return error from the handler.

Congratulations, you've hit upon one of the major usability issues with
XDP_REDIRECT! ;)

> I am hitting the same condition where using 8 XDP queues, I get CPU id
> 8 to redirect the XDP packet and I am not sure if it should be dropped
> or can be transmitted on a queue (= smp_processor_id() %
> total_num_xdp_queues) safely ?.

I would expect you would at least need some kind of locking to do this
safely, but I guess it depends on how your driver is structured...

> freescale/dpaa2 seems to be handling this case by sending the packet
> on the queue (= smp_processor_id() % total_num_xdp_queues) but unsure
> what should be the expected behavior.

As you've noted, this varies somewhat between drivers, and there's
really no "expected behaviour" today. Drivers basically do what they
think makes sense for their hardware.

We're trying to fix this, and make the behaviour configurable; if you
happen to be at LPC, please come discuss it with us at this session:

https://linuxplumbersconf.org/event/4/contributions/462/

-Toke

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

end of thread, other threads:[~2019-09-06 22:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-06 20:49 ndo_xdp_xmit - on which queue to transmit the packet (if core_id >= total_xdp_queues ) ? Manish Chopra
2019-09-06 22:56 ` Toke Høiland-Jørgensen

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).