From: Petr Machata <petrm@nvidia.com>
To: "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>, <netdev@vger.kernel.org>
Cc: Amit Cohen <amcohen@nvidia.com>, Ido Schimmel <idosch@nvidia.com>,
"Petr Machata" <petrm@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@vger.kernel.org>,
<mlxsw@nvidia.com>
Subject: [PATCH net-next 10/12] mlxsw: spectrum: Initialize PCI port with the relevant netdevice
Date: Tue, 4 Feb 2025 12:05:05 +0100 [thread overview]
Message-ID: <d78893cf20ae2bf899f474c458998a850a14d27f.1738665783.git.petrm@nvidia.com> (raw)
In-Reply-To: <cover.1738665783.git.petrm@nvidia.com>
From: Amit Cohen <amcohen@nvidia.com>
When a netdevice is associated with local port, set the netdevice as part
of PCI ports array. When a port is removed, unset the relevant netdevice.
This will be useful for XDP support, to allow quick access to the relevant
netdevice given local port from CQE.
Init is done before the netdevice is registered and de-init is done after
the netdevice is unregistered, so there is never concurrent access to the
array between the control path and the data path.
Signed-off-by: Amit Cohen <amcohen@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Petr Machata <petrm@nvidia.com>
---
drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
index d714311fd884..6b77e087fe47 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
@@ -1543,6 +1543,7 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u16 local_port,
mlxsw_core_port_netdev_link(mlxsw_sp->core, local_port,
mlxsw_sp_port, dev);
mlxsw_sp_port->dev = dev;
+ mlxsw_core_bus_port_init(mlxsw_sp->core, local_port, dev);
mlxsw_sp_port->mlxsw_sp = mlxsw_sp;
mlxsw_sp_port->local_port = local_port;
mlxsw_sp_port->pvid = MLXSW_SP_DEFAULT_VID;
@@ -1758,6 +1759,7 @@ static int mlxsw_sp_port_create(struct mlxsw_sp *mlxsw_sp, u16 local_port,
err_dev_addr_init:
free_percpu(mlxsw_sp_port->pcpu_stats);
err_alloc_stats:
+ mlxsw_core_bus_port_fini(mlxsw_sp->core, local_port);
free_netdev(dev);
err_alloc_etherdev:
mlxsw_core_port_fini(mlxsw_sp->core, local_port);
@@ -1793,6 +1795,7 @@ static void mlxsw_sp_port_remove(struct mlxsw_sp *mlxsw_sp, u16 local_port)
mlxsw_sp_port_buffers_fini(mlxsw_sp_port);
free_percpu(mlxsw_sp_port->pcpu_stats);
WARN_ON_ONCE(!list_empty(&mlxsw_sp_port->vlans_list));
+ mlxsw_core_bus_port_fini(mlxsw_sp->core, local_port);
free_netdev(mlxsw_sp_port->dev);
mlxsw_core_port_fini(mlxsw_sp->core, local_port);
mlxsw_sp_port_swid_set(mlxsw_sp, local_port,
--
2.47.0
next prev parent reply other threads:[~2025-02-04 11:07 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-04 11:04 [PATCH net-next 00/12] mlxsw: Preparations for XDP support Petr Machata
2025-02-04 11:04 ` [PATCH net-next 01/12] mlxsw: core: Remove debug prints Petr Machata
2025-02-04 11:04 ` [PATCH net-next 02/12] mlxsw: Check Rx local port in PCI code Petr Machata
2025-02-04 11:04 ` [PATCH net-next 03/12] mlxsw: Add struct mlxsw_pci_rx_pkt_info Petr Machata
2025-02-04 11:04 ` [PATCH net-next 04/12] mlxsw: pci: Use mlxsw_pci_rx_pkt_info Petr Machata
2025-02-04 11:05 ` [PATCH net-next 05/12] mlxsw: pci: Add a separate function for syncing buffers for CPU Petr Machata
2025-02-04 11:05 ` [PATCH net-next 06/12] mlxsw: pci: Store maximum number of ports Petr Machata
2025-02-04 11:05 ` [PATCH net-next 07/12] mlxsw: pci: Add PCI ports array Petr Machata
2025-02-04 11:05 ` [PATCH net-next 08/12] mlxsw: Add APIs to init/fini PCI port Petr Machata
2025-02-04 11:05 ` [PATCH net-next 09/12] mlxsw: pci: Initialize XDP Rx queue info per RDQ Petr Machata
2025-02-04 11:05 ` Petr Machata [this message]
2025-02-04 11:05 ` [PATCH net-next 11/12] mlxsw: Set some SKB fields in bus driver Petr Machata
2025-02-04 11:05 ` [PATCH net-next 12/12] mlxsw: Validate local port from CQE in PCI code Petr Machata
2025-02-04 15:56 ` [PATCH net-next 00/12] mlxsw: Preparations for XDP support Alexei Starovoitov
2025-02-04 15:59 ` Amit Cohen
2025-02-04 16:02 ` Alexei Starovoitov
2025-02-04 17:26 ` Amit Cohen
2025-02-05 17:09 ` Jakub Kicinski
2025-02-15 14:02 ` Simon Horman
2025-02-15 16:10 ` Jakub Kicinski
2025-02-16 9:26 ` Simon Horman
2025-02-17 9:35 ` Ido Schimmel
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=d78893cf20ae2bf899f474c458998a850a14d27f.1738665783.git.petrm@nvidia.com \
--to=petrm@nvidia.com \
--cc=amcohen@nvidia.com \
--cc=andrew+netdev@lunn.ch \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hawk@kernel.org \
--cc=idosch@nvidia.com \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=mlxsw@nvidia.com \
--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