Skip to content

Commit 073bb18

Browse files
Saeed Mahameeddavem330
authored andcommitted
net/mlx5: Introducing E-Switch and l2 table
E-Switch is the software entity that represents and manages ConnectX4 inter-HCA ethernet l2 switching. E-Switch has its own Virtual Ports, each Vport/vNIC/VF can be connected to the device through a vport of an e-switch. Each e-switch is managed by one vNIC identified by HCA_CAP.vport_group_manager (usually it is the PF/vport[0]), and its main responsibility is to forward each packet to the right vport. e-Switch needs to manage its own l2-table and FDB tables. L2 table is a flow table that is managed by FW, it is needed for Multi-host (Multi PF) configuration for inter HCA switching between PFs. FDB table is a flow table that is totally managed by e-Switch driver, its main responsibility is to switch packets between e-Swtich internal vports and uplink vport that belong to the same. This patch introduces only e-Swtich l2 table management, FDB managemnt will come later when ethernet SRIOV/VFs will be enabled. preperation for ethernet sriov and l2 table management. Signed-off-by: Saeed Mahameed <[email protected]> Signed-off-by: Or Gerlitz <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent aad9e6e commit 073bb18

File tree

7 files changed

+666
-1
lines changed

7 files changed

+666
-1
lines changed

drivers/net/ethernet/mellanox/mlx5/core/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ obj-$(CONFIG_MLX5_CORE) += mlx5_core.o
33
mlx5_core-y := main.o cmd.o debugfs.o fw.o eq.o uar.o pagealloc.o \
44
health.o mcg.o cq.o srq.o alloc.o qp.o port.o mr.o pd.o \
55
mad.o transobj.o vport.o sriov.o
6-
mlx5_core-$(CONFIG_MLX5_CORE_EN) += wq.o flow_table.o \
6+
mlx5_core-$(CONFIG_MLX5_CORE_EN) += wq.o flow_table.o eswitch.o \
77
en_main.o en_flow_table.o en_ethtool.o en_tx.o en_rx.o \
88
en_txrx.o

drivers/net/ethernet/mellanox/mlx5/core/eq.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@
3535
#include <linux/mlx5/driver.h>
3636
#include <linux/mlx5/cmd.h>
3737
#include "mlx5_core.h"
38+
#ifdef CONFIG_MLX5_CORE_EN
39+
#include "eswitch.h"
40+
#endif
3841

3942
enum {
4043
MLX5_EQE_SIZE = sizeof(struct mlx5_eqe),
@@ -287,6 +290,11 @@ static int mlx5_eq_int(struct mlx5_core_dev *dev, struct mlx5_eq *eq)
287290
break;
288291
#endif
289292

293+
#ifdef CONFIG_MLX5_CORE_EN
294+
case MLX5_EVENT_TYPE_NIC_VPORT_CHANGE:
295+
mlx5_eswitch_vport_event(dev->priv.eswitch, eqe);
296+
break;
297+
#endif
290298
default:
291299
mlx5_core_warn(dev, "Unhandled event 0x%x on EQ 0x%x\n",
292300
eqe->type, eq->eqn);
@@ -459,6 +467,11 @@ int mlx5_start_eqs(struct mlx5_core_dev *dev)
459467
if (MLX5_CAP_GEN(dev, pg))
460468
async_event_mask |= (1ull << MLX5_EVENT_TYPE_PAGE_FAULT);
461469

470+
if (MLX5_CAP_GEN(dev, port_type) == MLX5_CAP_PORT_TYPE_ETH &&
471+
MLX5_CAP_GEN(dev, vport_group_manager) &&
472+
mlx5_core_is_pf(dev))
473+
async_event_mask |= (1ull << MLX5_EVENT_TYPE_NIC_VPORT_CHANGE);
474+
462475
err = mlx5_create_map_eq(dev, &table->cmd_eq, MLX5_EQ_VEC_CMD,
463476
MLX5_NUM_CMD_EQE, 1ull << MLX5_EVENT_TYPE_CMD,
464477
"mlx5_cmd_eq", &dev->priv.uuari.uars[0]);

0 commit comments

Comments
 (0)