mbox series

[net-next,00/12] mlxsw: Preparations for XDP support

Message ID cover.1738665783.git.petrm@nvidia.com (mailing list archive)
Headers show
Series mlxsw: Preparations for XDP support | expand

Message

Petr Machata Feb. 4, 2025, 11:04 a.m. UTC
Amit Cohen writes:

A future patch set will add support for XDP in mlxsw driver. This set adds
some preparations.

Patch set overview:
Patch #1 removes debug prints
Patch #2 handles local port from LAG in PCI driver
Patches #3-#4 add rx_pkt_info and use it
Patch #5 adds a separate function for syncing buffer
Patches #6-#8 store mapping between local port to netdevice in PCI driver
Patch #9 initializes XDP Rx queue info
Patch #10 initializes PCI port
Patch #11 handles some SKB fields in PCI driver
Patch #12 moves local port validation to PCI driver

Amit Cohen (12):
  mlxsw: core: Remove debug prints
  mlxsw: Check Rx local port in PCI code
  mlxsw: Add struct mlxsw_pci_rx_pkt_info
  mlxsw: pci: Use mlxsw_pci_rx_pkt_info
  mlxsw: pci: Add a separate function for syncing buffers for CPU
  mlxsw: pci: Store maximum number of ports
  mlxsw: pci: Add PCI ports array
  mlxsw: Add APIs to init/fini PCI port
  mlxsw: pci: Initialize XDP Rx queue info per RDQ
  mlxsw: spectrum: Initialize PCI port with the relevant netdevice
  mlxsw: Set some SKB fields in bus driver
  mlxsw: Validate local port from CQE in PCI code

 drivers/net/ethernet/mellanox/mlxsw/core.c    |  38 ++-
 drivers/net/ethernet/mellanox/mlxsw/core.h    |  13 +-
 drivers/net/ethernet/mellanox/mlxsw/pci.c     | 249 +++++++++++++-----
 drivers/net/ethernet/mellanox/mlxsw/pci.h     |   8 +
 drivers/net/ethernet/mellanox/mlxsw/pci_hw.h  |   1 -
 .../net/ethernet/mellanox/mlxsw/spectrum.c    |   8 +-
 .../ethernet/mellanox/mlxsw/spectrum_trap.c   |   6 +-
 7 files changed, 218 insertions(+), 105 deletions(-)

Comments

Alexei Starovoitov Feb. 4, 2025, 3:56 p.m. UTC | #1
On Tue, Feb 4, 2025 at 11:06 AM Petr Machata <petrm@nvidia.com> wrote:
>
> Amit Cohen writes:
>
> A future patch set will add support for XDP in mlxsw driver. This set adds
> some preparations.

Why?
What is the goal here?
My understanding is that mlxsw is a hw switch and skb-s are used to
implement tap functionality for few listeners.
The volume of such packets is supposed to be small.
Even if XDP is added there is a huge mismatch in packet rates.
Hence the question. Why bother?
Amit Cohen Feb. 4, 2025, 3:59 p.m. UTC | #2
> -----Original Message-----
> From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
> Sent: Tuesday, 4 February 2025 17:56
> To: Petr Machata <petrm@nvidia.com>
> Cc: David S. Miller <davem@davemloft.net>; Eric Dumazet <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>; Paolo Abeni
> <pabeni@redhat.com>; Andrew Lunn <andrew+netdev@lunn.ch>; Network Development <netdev@vger.kernel.org>; Amit Cohen
> <amcohen@nvidia.com>; Ido Schimmel <idosch@nvidia.com>; Alexei Starovoitov <ast@kernel.org>; Daniel Borkmann
> <daniel@iogearbox.net>; Jesper Dangaard Brouer <hawk@kernel.org>; John Fastabend <john.fastabend@gmail.com>; bpf
> <bpf@vger.kernel.org>; mlxsw <mlxsw@nvidia.com>
> Subject: Re: [PATCH net-next 00/12] mlxsw: Preparations for XDP support
> 
> On Tue, Feb 4, 2025 at 11:06 AM Petr Machata <petrm@nvidia.com> wrote:
> >
> > Amit Cohen writes:
> >
> > A future patch set will add support for XDP in mlxsw driver. This set adds
> > some preparations.
> 
> Why?
> What is the goal here?
> My understanding is that mlxsw is a hw switch and skb-s are used to
> implement tap functionality for few listeners.
> The volume of such packets is supposed to be small.
> Even if XDP is added there is a huge mismatch in packet rates.
> Hence the question. Why bother?

You're right, most of packets should be handled by HW, XDP is mainly useful for telemetry.
Alexei Starovoitov Feb. 4, 2025, 4:02 p.m. UTC | #3
On Tue, Feb 4, 2025 at 3:59 PM Amit Cohen <amcohen@nvidia.com> wrote:
>
>
>
> > -----Original Message-----
> > From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
> > Sent: Tuesday, 4 February 2025 17:56
> > To: Petr Machata <petrm@nvidia.com>
> > Cc: David S. Miller <davem@davemloft.net>; Eric Dumazet <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>; Paolo Abeni
> > <pabeni@redhat.com>; Andrew Lunn <andrew+netdev@lunn.ch>; Network Development <netdev@vger.kernel.org>; Amit Cohen
> > <amcohen@nvidia.com>; Ido Schimmel <idosch@nvidia.com>; Alexei Starovoitov <ast@kernel.org>; Daniel Borkmann
> > <daniel@iogearbox.net>; Jesper Dangaard Brouer <hawk@kernel.org>; John Fastabend <john.fastabend@gmail.com>; bpf
> > <bpf@vger.kernel.org>; mlxsw <mlxsw@nvidia.com>
> > Subject: Re: [PATCH net-next 00/12] mlxsw: Preparations for XDP support
> >
> > On Tue, Feb 4, 2025 at 11:06 AM Petr Machata <petrm@nvidia.com> wrote:
> > >
> > > Amit Cohen writes:
> > >
> > > A future patch set will add support for XDP in mlxsw driver. This set adds
> > > some preparations.
> >
> > Why?
> > What is the goal here?
> > My understanding is that mlxsw is a hw switch and skb-s are used to
> > implement tap functionality for few listeners.
> > The volume of such packets is supposed to be small.
> > Even if XDP is added there is a huge mismatch in packet rates.
> > Hence the question. Why bother?
>
> You're right, most of packets should be handled by HW, XDP is mainly useful for telemetry.

Why skb path is not enough?
Amit Cohen Feb. 4, 2025, 5:26 p.m. UTC | #4
> -----Original Message-----
> From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
> Sent: Tuesday, 4 February 2025 18:02
> To: Amit Cohen <amcohen@nvidia.com>
> Cc: Petr Machata <petrm@nvidia.com>; David S. Miller <davem@davemloft.net>; Eric Dumazet <edumazet@google.com>; Jakub Kicinski
> <kuba@kernel.org>; Paolo Abeni <pabeni@redhat.com>; Andrew Lunn <andrew+netdev@lunn.ch>; Network Development
> <netdev@vger.kernel.org>; Ido Schimmel <idosch@nvidia.com>; Alexei Starovoitov <ast@kernel.org>; Daniel Borkmann
> <daniel@iogearbox.net>; Jesper Dangaard Brouer <hawk@kernel.org>; John Fastabend <john.fastabend@gmail.com>; bpf
> <bpf@vger.kernel.org>; mlxsw <mlxsw@nvidia.com>
> Subject: Re: [PATCH net-next 00/12] mlxsw: Preparations for XDP support
> 
> On Tue, Feb 4, 2025 at 3:59 PM Amit Cohen <amcohen@nvidia.com> wrote:
> >
> >
> >
> > > -----Original Message-----
> > > From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
> > > Sent: Tuesday, 4 February 2025 17:56
> > > To: Petr Machata <petrm@nvidia.com>
> > > Cc: David S. Miller <davem@davemloft.net>; Eric Dumazet <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>; Paolo Abeni
> > > <pabeni@redhat.com>; Andrew Lunn <andrew+netdev@lunn.ch>; Network Development <netdev@vger.kernel.org>; Amit Cohen
> > > <amcohen@nvidia.com>; Ido Schimmel <idosch@nvidia.com>; Alexei Starovoitov <ast@kernel.org>; Daniel Borkmann
> > > <daniel@iogearbox.net>; Jesper Dangaard Brouer <hawk@kernel.org>; John Fastabend <john.fastabend@gmail.com>; bpf
> > > <bpf@vger.kernel.org>; mlxsw <mlxsw@nvidia.com>
> > > Subject: Re: [PATCH net-next 00/12] mlxsw: Preparations for XDP support
> > >
> > > On Tue, Feb 4, 2025 at 11:06 AM Petr Machata <petrm@nvidia.com> wrote:
> > > >
> > > > Amit Cohen writes:
> > > >
> > > > A future patch set will add support for XDP in mlxsw driver. This set adds
> > > > some preparations.
> > >
> > > Why?
> > > What is the goal here?
> > > My understanding is that mlxsw is a hw switch and skb-s are used to
> > > implement tap functionality for few listeners.
> > > The volume of such packets is supposed to be small.
> > > Even if XDP is added there is a huge mismatch in packet rates.
> > > Hence the question. Why bother?
> >
> > You're right, most of packets should be handled by HW, XDP is mainly useful for telemetry.
> 
> Why skb path is not enough?

We get better packet rates using XDP, this can be useful to redirect packets to a server for analysis for example.