xdp-newbies.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* XDP redirect - ping fail
@ 2023-05-04 17:38 team lnx
  2023-05-04 18:05 ` Shaw, Jeffrey B
  2023-05-16  8:36 ` Marco
  0 siblings, 2 replies; 11+ messages in thread
From: team lnx @ 2023-05-04 17:38 UTC (permalink / raw)
  To: xdp-newbies; +Cc: Toke Høiland-Jørgensen

Hello,

I see a ping not working in below topology with xdp redirect


IFACE1 <--------->   IFACE2      IFACE3    <------------------> IFACE4

IFACE2 and IFACE3 are on same host machine

IFACE1 and IFACE2 are  on static ip
IFACE3 and IFACE4 are on dynamic ip, IFACE4 runs dhcp server

steps
1. assign static ip between IFACE1 and IFACE2 (ex: 172.168.2.x)
2. dynamic ip between IFACE3 and IFACE4 (ex: 192.168.2.x)
3. Run xdp redirect on IFACE2 and IFACE3
4. start ping from IFACE1 to IFACE4

Are some of the assumptions not right here leading to ping failure ?

Regards,
teamlnx

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

* Re: XDP redirect - ping fail
  2023-05-04 17:38 XDP redirect - ping fail team lnx
@ 2023-05-04 18:05 ` Shaw, Jeffrey B
       [not found]   ` <CA+t96KCemTbqamJezLJ0sn0nN8EUrYd365iLmmv10qEVrF1_bQ@mail.gmail.com>
  2023-05-12 18:49   ` XDP redirect - ping fail team lnx
  2023-05-16  8:36 ` Marco
  1 sibling, 2 replies; 11+ messages in thread
From: Shaw, Jeffrey B @ 2023-05-04 18:05 UTC (permalink / raw)
  To: team lnx, xdp-newbies; +Cc: Toke Høiland-Jørgensen

On 5/4/2023 10:38 AM, team lnx wrote:
> Hello,
> 
> I see a ping not working in below topology with xdp redirect
> 
> 
> IFACE1 <--------->   IFACE2      IFACE3    <------------------> IFACE4
> 
> IFACE2 and IFACE3 are on same host machine
> 
> IFACE1 and IFACE2 are  on static ip
> IFACE3 and IFACE4 are on dynamic ip, IFACE4 runs dhcp server
> 
> steps
> 1. assign static ip between IFACE1 and IFACE2 (ex: 172.168.2.x)
> 2. dynamic ip between IFACE3 and IFACE4 (ex: 192.168.2.x)
> 3. Run xdp redirect on IFACE2 and IFACE3
> 4. start ping from IFACE1 to IFACE4

Does IFACE1 have a route to 192.168.2.x and is the next hop resolved? 
You can use `tcpdump` on IFACE1 and IFACE4 to see what packets are sent 
and received.

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

* XDP-REDIRECT cpu affinity
       [not found]   ` <CA+t96KCemTbqamJezLJ0sn0nN8EUrYd365iLmmv10qEVrF1_bQ@mail.gmail.com>
@ 2023-05-04 18:28     ` Sanjay Rao
  2023-05-04 19:28       ` Zvi Effron
  0 siblings, 1 reply; 11+ messages in thread
From: Sanjay Rao @ 2023-05-04 18:28 UTC (permalink / raw)
  Cc: xdp-newbies

I am looking at the implementation of ndo_xdp_xmit() in
mlx5/core/en/xdp.c (most other drivers also have similar
implementations). This function is called for XDP-REDIRECT.

int mlx5e_xdp_xmit(struct net_device *dev, int n, struct xdp_frame
**frames, u32 flags)
{
   ------
   ------

   sq_num = smp_processor_id();
   if (unlikely(sq_num >= priv->channels.num))
       return -ENXIO;

   --------
}


Doesn't this restrict all ports to be bound to the same CPUs via
smp_affinity? In my setup, one port has CPUs 1-63 and the other has
65-127 for a 63 queue configuration. XDP_REDIRECT will fail because
65-127 will exceed the channel count. Is that by design, or am I
missing something? We can find a similar implementation for the i40e
driver as well.

Regards,
Sanjay

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

* Re: XDP-REDIRECT cpu affinity
  2023-05-04 18:28     ` XDP-REDIRECT cpu affinity Sanjay Rao
@ 2023-05-04 19:28       ` Zvi Effron
  0 siblings, 0 replies; 11+ messages in thread
From: Zvi Effron @ 2023-05-04 19:28 UTC (permalink / raw)
  To: Sanjay Rao; +Cc: xdp-newbies

On Thu, May 4, 2023 at 11:28 AM Sanjay Rao <srao@fastly.com> wrote:
>
> I am looking at the implementation of ndo_xdp_xmit() in
> mlx5/core/en/xdp.c (most other drivers also have similar
> implementations). This function is called for XDP-REDIRECT.
>
> int mlx5e_xdp_xmit(struct net_device *dev, int n, struct xdp_frame
> **frames, u32 flags)
> {
> ------
> ------
>
> sq_num = smp_processor_id();
> if (unlikely(sq_num >= priv->channels.num))
> return -ENXIO;
>
> --------
> }
>
>
> Doesn't this restrict all ports to be bound to the same CPUs via
> smp_affinity? In my setup, one port has CPUs 1-63 and the other has
> 65-127 for a 63 queue configuration. XDP_REDIRECT will fail because
> 65-127 will exceed the channel count. Is that by design, or am I
> missing something? We can find a similar implementation for the i40e
> driver as well.

We had previously brought this up for the i40e driver[0]. My take on the
resulting conversation is that this behavior being a bug, but there is no clear
idea of how to solve it without introducing locks, which would be an
unacceptable performance hit.

>
> Regards,
> Sanjay

--Zvi

[0]: https://lore.kernel.org/xdp-newbies/CAC1LvL1NHj6n+RNYRmja2YDhkcCwREuhjaBz_k255rU1jdO8Sw@mail.gmail.com/

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

* Re: XDP redirect - ping fail
  2023-05-04 18:05 ` Shaw, Jeffrey B
       [not found]   ` <CA+t96KCemTbqamJezLJ0sn0nN8EUrYd365iLmmv10qEVrF1_bQ@mail.gmail.com>
@ 2023-05-12 18:49   ` team lnx
  2023-05-13  8:44     ` Marco
  1 sibling, 1 reply; 11+ messages in thread
From: team lnx @ 2023-05-12 18:49 UTC (permalink / raw)
  To: Shaw, Jeffrey B; +Cc: xdp-newbies, Toke Høiland-Jørgensen

Yes, IFACE1 has a route(static) to IFACE3 and ping succeeds.
Ping fails to IFACE4 from IFACE1, Do I need NAT and does XDP have support ?


On Thu, May 4, 2023 at 11:05 AM Shaw, Jeffrey B
<jeffrey.b.shaw@intel.com> wrote:
>
> On 5/4/2023 10:38 AM, team lnx wrote:
> > Hello,
> >
> > I see a ping not working in below topology with xdp redirect
> >
> >
> > IFACE1 <--------->   IFACE2      IFACE3    <------------------> IFACE4
> >
> > IFACE2 and IFACE3 are on same host machine
> >
> > IFACE1 and IFACE2 are  on static ip
> > IFACE3 and IFACE4 are on dynamic ip, IFACE4 runs dhcp server
> >
> > steps
> > 1. assign static ip between IFACE1 and IFACE2 (ex: 172.168.2.x)
> > 2. dynamic ip between IFACE3 and IFACE4 (ex: 192.168.2.x)
> > 3. Run xdp redirect on IFACE2 and IFACE3
> > 4. start ping from IFACE1 to IFACE4
>
> Does IFACE1 have a route to 192.168.2.x and is the next hop resolved?
> You can use `tcpdump` on IFACE1 and IFACE4 to see what packets are sent
> and received.

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

* Re: XDP redirect - ping fail
  2023-05-12 18:49   ` XDP redirect - ping fail team lnx
@ 2023-05-13  8:44     ` Marco
       [not found]       ` <CAOLRUnCX=aDjsH56GP8MLXuA5dZ7NYi7OLBaXCpx26Q2j689Zw@mail.gmail.com>
  0 siblings, 1 reply; 11+ messages in thread
From: Marco @ 2023-05-13  8:44 UTC (permalink / raw)
  To: team lnx; +Cc: Shaw, Jeffrey B, xdp-newbies, Toke Høiland-Jørgensen

Hi Teaminx

Have you already tried to send an icmp packet with zero payload to see
with bpf_printk what happens before redirection?

Il giorno ven 12 mag 2023 alle ore 21:17 team lnx
<teamlnxi8@gmail.com> ha scritto:
>
> Yes, IFACE1 has a route(static) to IFACE3 and ping succeeds.
> Ping fails to IFACE4 from IFACE1, Do I need NAT and does XDP have support ?
>
>
> On Thu, May 4, 2023 at 11:05 AM Shaw, Jeffrey B
> <jeffrey.b.shaw@intel.com> wrote:
> >
> > On 5/4/2023 10:38 AM, team lnx wrote:
> > > Hello,
> > >
> > > I see a ping not working in below topology with xdp redirect
> > >
> > >
> > > IFACE1 <--------->   IFACE2      IFACE3    <------------------> IFACE4
> > >
> > > IFACE2 and IFACE3 are on same host machine
> > >
> > > IFACE1 and IFACE2 are  on static ip
> > > IFACE3 and IFACE4 are on dynamic ip, IFACE4 runs dhcp server
> > >
> > > steps
> > > 1. assign static ip between IFACE1 and IFACE2 (ex: 172.168.2.x)
> > > 2. dynamic ip between IFACE3 and IFACE4 (ex: 192.168.2.x)
> > > 3. Run xdp redirect on IFACE2 and IFACE3
> > > 4. start ping from IFACE1 to IFACE4
> >
> > Does IFACE1 have a route to 192.168.2.x and is the next hop resolved?
> > You can use `tcpdump` on IFACE1 and IFACE4 to see what packets are sent
> > and received.



-- 
E' meglio coltivare GNU/Linux... tanto Windows si pianta da solo!!

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

* Re: XDP redirect - ping fail
       [not found]       ` <CAOLRUnCX=aDjsH56GP8MLXuA5dZ7NYi7OLBaXCpx26Q2j689Zw@mail.gmail.com>
@ 2023-05-15 23:14         ` team lnx
  0 siblings, 0 replies; 11+ messages in thread
From: team lnx @ 2023-05-15 23:14 UTC (permalink / raw)
  To: ctxspi; +Cc: Shaw, Jeffrey B, xdp-newbies

Hello Marco,

I am working on that but I could see a couple of discussions where it
has been mentioned we may have to
enhance xdp to have support NAT.

As an experiment in the same topology, adding masquerade NAT rules (ip
translation) without XDP doesn't have a ping issue.
Does this mean we need to have something like xdp-iptables to add NAT rules ?


On Mon, May 15, 2023 at 4:04 PM team lnx <teamlnxi8@gmail.com> wrote:
>
> Hello Marco,
>
> I am working on that but I could see a couple of discussions where it has been mentioned we may have to
> enhance xdp to have support NAT.
>
> As an experiment in the same topology, adding masquerade NAT rules (ip translation) without XDP doesn't have a ping issue.
> Does this mean we need to have something like xdp-iptables to add NAT rules ?
>
>
>
> On Sat, May 13, 2023 at 12:41 AM Marco <ctxspi@gmail.com> wrote:
>>
>> Hi Teaminx
>>
>> Have you already tried to send an icmp packet with zero payload to see
>> with bpf_printk what happens before redirection?
>>
>> Il giorno ven 12 mag 2023 alle ore 21:17 team lnx
>> <teamlnxi8@gmail.com> ha scritto:
>> >
>> > Yes, IFACE1 has a route(static) to IFACE3 and ping succeeds.
>> > Ping fails to IFACE4 from IFACE1, Do I need NAT and does XDP have support ?
>> >
>> >
>> > On Thu, May 4, 2023 at 11:05 AM Shaw, Jeffrey B
>> > <jeffrey.b.shaw@intel.com> wrote:
>> > >
>> > > On 5/4/2023 10:38 AM, team lnx wrote:
>> > > > Hello,
>> > > >
>> > > > I see a ping not working in below topology with xdp redirect
>> > > >
>> > > >
>> > > > IFACE1 <--------->   IFACE2      IFACE3    <------------------> IFACE4
>> > > >
>> > > > IFACE2 and IFACE3 are on same host machine
>> > > >
>> > > > IFACE1 and IFACE2 are  on static ip
>> > > > IFACE3 and IFACE4 are on dynamic ip, IFACE4 runs dhcp server
>> > > >
>> > > > steps
>> > > > 1. assign static ip between IFACE1 and IFACE2 (ex: 172.168.2.x)
>> > > > 2. dynamic ip between IFACE3 and IFACE4 (ex: 192.168.2.x)
>> > > > 3. Run xdp redirect on IFACE2 and IFACE3
>> > > > 4. start ping from IFACE1 to IFACE4
>> > >
>> > > Does IFACE1 have a route to 192.168.2.x and is the next hop resolved?
>> > > You can use `tcpdump` on IFACE1 and IFACE4 to see what packets are sent
>> > > and received.
>>
>>
>>
>> --
>> E' meglio coltivare GNU/Linux... tanto Windows si pianta da solo!!

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

* Re: XDP redirect - ping fail
  2023-05-04 17:38 XDP redirect - ping fail team lnx
  2023-05-04 18:05 ` Shaw, Jeffrey B
@ 2023-05-16  8:36 ` Marco
  2023-05-16  8:46   ` Marco
  1 sibling, 1 reply; 11+ messages in thread
From: Marco @ 2023-05-16  8:36 UTC (permalink / raw)
  To: team lnx; +Cc: xdp-newbies, Toke Høiland-Jørgensen

I have not much experience with dhcp but ensure first that dhcp
packets are not blocked from the xdp program.
So as already mentioned, try pinging with zero payloads and check if
they get redirected.

Il giorno gio 4 mag 2023 alle ore 19:41 team lnx <teamlnxi8@gmail.com>
ha scritto:
>
> Hello,
>
> I see a ping not working in below topology with xdp redirect
>
>
> IFACE1 <--------->   IFACE2      IFACE3    <------------------> IFACE4
>
> IFACE2 and IFACE3 are on same host machine
>
> IFACE1 and IFACE2 are  on static ip
> IFACE3 and IFACE4 are on dynamic ip, IFACE4 runs dhcp server
>
> steps
> 1. assign static ip between IFACE1 and IFACE2 (ex: 172.168.2.x)
> 2. dynamic ip between IFACE3 and IFACE4 (ex: 192.168.2.x)
> 3. Run xdp redirect on IFACE2 and IFACE3
> 4. start ping from IFACE1 to IFACE4
>
> Are some of the assumptions not right here leading to ping failure ?
>
> Regards,
> teamlnx



-- 
E' meglio coltivare GNU/Linux... tanto Windows si pianta da solo!!

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

* Re: XDP redirect - ping fail
  2023-05-16  8:36 ` Marco
@ 2023-05-16  8:46   ` Marco
  2023-05-16 16:33     ` team lnx
  0 siblings, 1 reply; 11+ messages in thread
From: Marco @ 2023-05-16  8:46 UTC (permalink / raw)
  To: team lnx; +Cc: xdp-newbies, Toke Høiland-Jørgensen

Sorry, I answered the dhcp part earlier.
Regarding the Nat, I can tell you that it also works with your XDP
program if properly configured.

Il giorno mar 16 mag 2023 alle ore 10:36 Marco <ctxspi@gmail.com> ha scritto:
>
> I have not much experience with dhcp but ensure first that dhcp
> packets are not blocked from the xdp program.
> So as already mentioned, try pinging with zero payloads and check if
> they get redirected.
>
> Il giorno gio 4 mag 2023 alle ore 19:41 team lnx <teamlnxi8@gmail.com>
> ha scritto:
> >
> > Hello,
> >
> > I see a ping not working in below topology with xdp redirect
> >
> >
> > IFACE1 <--------->   IFACE2      IFACE3    <------------------> IFACE4
> >
> > IFACE2 and IFACE3 are on same host machine
> >
> > IFACE1 and IFACE2 are  on static ip
> > IFACE3 and IFACE4 are on dynamic ip, IFACE4 runs dhcp server
> >
> > steps
> > 1. assign static ip between IFACE1 and IFACE2 (ex: 172.168.2.x)
> > 2. dynamic ip between IFACE3 and IFACE4 (ex: 192.168.2.x)
> > 3. Run xdp redirect on IFACE2 and IFACE3
> > 4. start ping from IFACE1 to IFACE4
> >
> > Are some of the assumptions not right here leading to ping failure ?
> >
> > Regards,
> > teamlnx
>
>
>
> --
> E' meglio coltivare GNU/Linux... tanto Windows si pianta da solo!!



-- 
E' meglio coltivare GNU/Linux... tanto Windows si pianta da solo!!

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

* Re: XDP redirect - ping fail
  2023-05-16  8:46   ` Marco
@ 2023-05-16 16:33     ` team lnx
  0 siblings, 0 replies; 11+ messages in thread
From: team lnx @ 2023-05-16 16:33 UTC (permalink / raw)
  To: ctxspi; +Cc: xdp-newbies, Toke Høiland-Jørgensen

Thank you, I am using "xdp_fwd"  and I believe this alone wouldn't be
sufficient Is that correct ?


On Tue, May 16, 2023 at 12:43 AM Marco <ctxspi@gmail.com> wrote:
>
> Sorry, I answered the dhcp part earlier.
> Regarding the Nat, I can tell you that it also works with your XDP
> program if properly configured.
>
> Il giorno mar 16 mag 2023 alle ore 10:36 Marco <ctxspi@gmail.com> ha scritto:
> >
> > I have not much experience with dhcp but ensure first that dhcp
> > packets are not blocked from the xdp program.
> > So as already mentioned, try pinging with zero payloads and check if
> > they get redirected.
> >
> > Il giorno gio 4 mag 2023 alle ore 19:41 team lnx <teamlnxi8@gmail.com>
> > ha scritto:
> > >
> > > Hello,
> > >
> > > I see a ping not working in below topology with xdp redirect
> > >
> > >
> > > IFACE1 <--------->   IFACE2      IFACE3    <------------------> IFACE4
> > >
> > > IFACE2 and IFACE3 are on same host machine
> > >
> > > IFACE1 and IFACE2 are  on static ip
> > > IFACE3 and IFACE4 are on dynamic ip, IFACE4 runs dhcp server
> > >
> > > steps
> > > 1. assign static ip between IFACE1 and IFACE2 (ex: 172.168.2.x)
> > > 2. dynamic ip between IFACE3 and IFACE4 (ex: 192.168.2.x)
> > > 3. Run xdp redirect on IFACE2 and IFACE3
> > > 4. start ping from IFACE1 to IFACE4
> > >
> > > Are some of the assumptions not right here leading to ping failure ?
> > >
> > > Regards,
> > > teamlnx
> >
> >
> >
> > --
> > E' meglio coltivare GNU/Linux... tanto Windows si pianta da solo!!
>
>
>
> --
> E' meglio coltivare GNU/Linux... tanto Windows si pianta da solo!!

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

* XDP Redirect - Ping fail
@ 2023-05-04 17:35 team lnx
  0 siblings, 0 replies; 11+ messages in thread
From: team lnx @ 2023-05-04 17:35 UTC (permalink / raw)
  To: xdp-newbies; +Cc: Toke Høiland-Jørgensen

Hello,

I see a ping not working in below topology with xdp redirect

                               --------------------------------------
IFACE1 <--------->  |  IFACE2                  IFACE3 |
<------------------> IFACE4
                              ----------------------------------------

IFACE2 and IFACE3 are on same host machine

IFACE1 and IFACE2 are  on static ip
IFACE3 and IFACE4 are on dynamic ip, IFACE4 runs dhcp server

steps
1. assign static ip between IFACE1 and IFACE2 (ex: 172.168.2.x)
2. dynamic ip between IFACE3 and IFACE4 (ex: 192.168.2.x)
3. Run xdp redirect on IFACE2 and IFACE3
4. start ping from IFACE1 to IFACE4

Are some of the assumptions not right here leading to ping failure ?

Regards,
teamlnx

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

end of thread, other threads:[~2023-05-16 16:34 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-04 17:38 XDP redirect - ping fail team lnx
2023-05-04 18:05 ` Shaw, Jeffrey B
     [not found]   ` <CA+t96KCemTbqamJezLJ0sn0nN8EUrYd365iLmmv10qEVrF1_bQ@mail.gmail.com>
2023-05-04 18:28     ` XDP-REDIRECT cpu affinity Sanjay Rao
2023-05-04 19:28       ` Zvi Effron
2023-05-12 18:49   ` XDP redirect - ping fail team lnx
2023-05-13  8:44     ` Marco
     [not found]       ` <CAOLRUnCX=aDjsH56GP8MLXuA5dZ7NYi7OLBaXCpx26Q2j689Zw@mail.gmail.com>
2023-05-15 23:14         ` team lnx
2023-05-16  8:36 ` Marco
2023-05-16  8:46   ` Marco
2023-05-16 16:33     ` team lnx
  -- strict thread matches above, loose matches on Subject: below --
2023-05-04 17:35 XDP Redirect - Ping fail team lnx

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