Skip to content

Commit 495716b

Browse files
Saeed Mahameeddavem330
authored andcommitted
net/mlx5: E-Switch, Introduce FDB hardware capabilities
Define needed hardware structures and capabilities needed for E-Switch FDB flow tables and read them on driver load. Signed-off-by: Saeed Mahameed <[email protected]> Signed-off-by: Or Gerlitz <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 073bb18 commit 495716b

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,19 @@ int mlx5_query_hca_caps(struct mlx5_core_dev *dev)
160160
if (err)
161161
return err;
162162
}
163+
164+
if (MLX5_CAP_GEN(dev, vport_group_manager) &&
165+
MLX5_CAP_GEN(dev, eswitch_flow_table)) {
166+
err = mlx5_core_get_caps(dev, MLX5_CAP_ESWITCH_FLOW_TABLE,
167+
HCA_CAP_OPMOD_GET_CUR);
168+
if (err)
169+
return err;
170+
err = mlx5_core_get_caps(dev, MLX5_CAP_ESWITCH_FLOW_TABLE,
171+
HCA_CAP_OPMOD_GET_MAX);
172+
if (err)
173+
return err;
174+
}
175+
163176
return 0;
164177
}
165178

include/linux/mlx5/device.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,6 +1138,7 @@ enum mlx5_cap_type {
11381138
MLX5_CAP_IPOIB_OFFLOADS,
11391139
MLX5_CAP_EOIB_OFFLOADS,
11401140
MLX5_CAP_FLOW_TABLE,
1141+
MLX5_CAP_ESWITCH_FLOW_TABLE,
11411142
/* NUM OF CAP Types */
11421143
MLX5_CAP_NUM
11431144
};
@@ -1175,6 +1176,20 @@ enum mlx5_cap_type {
11751176
#define MLX5_CAP_FLOWTABLE_MAX(mdev, cap) \
11761177
MLX5_GET(flow_table_nic_cap, mdev->hca_caps_max[MLX5_CAP_FLOW_TABLE], cap)
11771178

1179+
#define MLX5_CAP_ESW_FLOWTABLE(mdev, cap) \
1180+
MLX5_GET(flow_table_eswitch_cap, \
1181+
mdev->hca_caps_cur[MLX5_CAP_ESWITCH_FLOW_TABLE], cap)
1182+
1183+
#define MLX5_CAP_ESW_FLOWTABLE_MAX(mdev, cap) \
1184+
MLX5_GET(flow_table_eswitch_cap, \
1185+
mdev->hca_caps_max[MLX5_CAP_ESWITCH_FLOW_TABLE], cap)
1186+
1187+
#define MLX5_CAP_ESW_FLOWTABLE_FDB(mdev, cap) \
1188+
MLX5_CAP_ESW_FLOWTABLE(mdev, flow_table_properties_nic_esw_fdb.cap)
1189+
1190+
#define MLX5_CAP_ESW_FLOWTABLE_FDB_MAX(mdev, cap) \
1191+
MLX5_CAP_ESW_FLOWTABLE_MAX(mdev, flow_table_properties_nic_esw_fdb.cap)
1192+
11781193
#define MLX5_CAP_ODP(mdev, cap)\
11791194
MLX5_GET(odp_cap, mdev->hca_caps_cur[MLX5_CAP_ODP], cap)
11801195

include/linux/mlx5/mlx5_ifc.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,18 @@ struct mlx5_ifc_flow_table_nic_cap_bits {
447447
u8 reserved_3[0x7200];
448448
};
449449

450+
struct mlx5_ifc_flow_table_eswitch_cap_bits {
451+
u8 reserved_0[0x200];
452+
453+
struct mlx5_ifc_flow_table_prop_layout_bits flow_table_properties_nic_esw_fdb;
454+
455+
struct mlx5_ifc_flow_table_prop_layout_bits flow_table_properties_esw_acl_ingress;
456+
457+
struct mlx5_ifc_flow_table_prop_layout_bits flow_table_properties_esw_acl_egress;
458+
459+
u8 reserved_1[0x7800];
460+
};
461+
450462
struct mlx5_ifc_per_protocol_networking_offload_caps_bits {
451463
u8 csum_cap[0x1];
452464
u8 vlan_cap[0x1];
@@ -1846,6 +1858,7 @@ union mlx5_ifc_hca_cap_union_bits {
18461858
struct mlx5_ifc_roce_cap_bits roce_cap;
18471859
struct mlx5_ifc_per_protocol_networking_offload_caps_bits per_protocol_networking_offload_caps;
18481860
struct mlx5_ifc_flow_table_nic_cap_bits flow_table_nic_cap;
1861+
struct mlx5_ifc_flow_table_eswitch_cap_bits flow_table_eswitch_cap;
18491862
u8 reserved_0[0x8000];
18501863
};
18511864

0 commit comments

Comments
 (0)