Skip to content

Commit 64f45c0

Browse files
kliteynSaeed Mahameed
authored andcommitted
net/mlx5: DR, Allow SW steering for sw_owner_v2 devices
Allow sw_owner_v2 based on sw_format_version. Signed-off-by: Alex Vesker <[email protected]> Signed-off-by: Yevgeny Kliteynik <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent 8fdac12 commit 64f45c0

File tree

4 files changed

+29
-16
lines changed

4 files changed

+29
-16
lines changed

drivers/net/ethernet/mellanox/mlx5/core/steering/dr_cmd.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ int mlx5dr_cmd_query_esw_caps(struct mlx5_core_dev *mdev,
7878
caps->uplink_icm_address_tx =
7979
MLX5_CAP64_ESW_FLOWTABLE(mdev,
8080
sw_steering_uplink_icm_address_tx);
81-
caps->sw_owner =
82-
MLX5_CAP_ESW_FLOWTABLE_FDB(mdev,
83-
sw_owner);
81+
caps->sw_owner_v2 = MLX5_CAP_ESW_FLOWTABLE_FDB(mdev, sw_owner_v2);
82+
if (!caps->sw_owner_v2)
83+
caps->sw_owner = MLX5_CAP_ESW_FLOWTABLE_FDB(mdev, sw_owner);
8484

8585
return 0;
8686
}
@@ -113,10 +113,15 @@ int mlx5dr_cmd_query_device(struct mlx5_core_dev *mdev,
113113
caps->nic_tx_allow_address =
114114
MLX5_CAP64_FLOWTABLE(mdev, sw_steering_nic_tx_action_allow_icm_address);
115115

116-
caps->rx_sw_owner = MLX5_CAP_FLOWTABLE_NIC_RX(mdev, sw_owner);
117-
caps->max_ft_level = MLX5_CAP_FLOWTABLE_NIC_RX(mdev, max_ft_level);
116+
caps->rx_sw_owner_v2 = MLX5_CAP_FLOWTABLE_NIC_RX(mdev, sw_owner_v2);
117+
caps->tx_sw_owner_v2 = MLX5_CAP_FLOWTABLE_NIC_TX(mdev, sw_owner_v2);
118+
119+
if (!caps->rx_sw_owner_v2)
120+
caps->rx_sw_owner = MLX5_CAP_FLOWTABLE_NIC_RX(mdev, sw_owner);
121+
if (!caps->tx_sw_owner_v2)
122+
caps->tx_sw_owner = MLX5_CAP_FLOWTABLE_NIC_TX(mdev, sw_owner);
118123

119-
caps->tx_sw_owner = MLX5_CAP_FLOWTABLE_NIC_TX(mdev, sw_owner);
124+
caps->max_ft_level = MLX5_CAP_FLOWTABLE_NIC_RX(mdev, max_ft_level);
120125

121126
caps->log_icm_size = MLX5_CAP_DEV_MEM(mdev, log_steering_sw_icm_size);
122127
caps->hdr_modify_icm_addr =

drivers/net/ethernet/mellanox/mlx5/core/steering/dr_domain.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
#include <linux/mlx5/eswitch.h>
55
#include "dr_types.h"
66

7+
#define DR_DOMAIN_SW_STEERING_SUPPORTED(dmn, dmn_type) \
8+
((dmn)->info.caps.dmn_type##_sw_owner || \
9+
((dmn)->info.caps.dmn_type##_sw_owner_v2 && \
10+
(dmn)->info.caps.sw_format_ver <= MLX5_STEERING_FORMAT_CONNECTX_6DX))
11+
712
static int dr_domain_init_cache(struct mlx5dr_domain *dmn)
813
{
914
/* Per vport cached FW FT for checksum recalculation, this
@@ -187,6 +192,7 @@ static int dr_domain_query_fdb_caps(struct mlx5_core_dev *mdev,
187192
return ret;
188193

189194
dmn->info.caps.fdb_sw_owner = dmn->info.caps.esw_caps.sw_owner;
195+
dmn->info.caps.fdb_sw_owner_v2 = dmn->info.caps.esw_caps.sw_owner_v2;
190196
dmn->info.caps.esw_rx_drop_address = dmn->info.caps.esw_caps.drop_icm_address_rx;
191197
dmn->info.caps.esw_tx_drop_address = dmn->info.caps.esw_caps.drop_icm_address_tx;
192198

@@ -229,18 +235,13 @@ static int dr_domain_caps_init(struct mlx5_core_dev *mdev,
229235
if (ret)
230236
return ret;
231237

232-
if (dmn->info.caps.sw_format_ver != MLX5_STEERING_FORMAT_CONNECTX_5) {
233-
mlx5dr_err(dmn, "SW steering is not supported on this device\n");
234-
return -EOPNOTSUPP;
235-
}
236-
237238
ret = dr_domain_query_fdb_caps(mdev, dmn);
238239
if (ret)
239240
return ret;
240241

241242
switch (dmn->type) {
242243
case MLX5DR_DOMAIN_TYPE_NIC_RX:
243-
if (!dmn->info.caps.rx_sw_owner)
244+
if (!DR_DOMAIN_SW_STEERING_SUPPORTED(dmn, rx))
244245
return -ENOTSUPP;
245246

246247
dmn->info.supp_sw_steering = true;
@@ -249,7 +250,7 @@ static int dr_domain_caps_init(struct mlx5_core_dev *mdev,
249250
dmn->info.rx.drop_icm_addr = dmn->info.caps.nic_rx_drop_address;
250251
break;
251252
case MLX5DR_DOMAIN_TYPE_NIC_TX:
252-
if (!dmn->info.caps.tx_sw_owner)
253+
if (!DR_DOMAIN_SW_STEERING_SUPPORTED(dmn, tx))
253254
return -ENOTSUPP;
254255

255256
dmn->info.supp_sw_steering = true;
@@ -261,7 +262,7 @@ static int dr_domain_caps_init(struct mlx5_core_dev *mdev,
261262
if (!dmn->info.caps.eswitch_manager)
262263
return -ENOTSUPP;
263264

264-
if (!dmn->info.caps.fdb_sw_owner)
265+
if (!DR_DOMAIN_SW_STEERING_SUPPORTED(dmn, fdb))
265266
return -ENOTSUPP;
266267

267268
dmn->info.rx.ste_type = MLX5DR_STE_TYPE_RX;

drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,8 @@ struct mlx5dr_esw_caps {
666666
u64 drop_icm_address_tx;
667667
u64 uplink_icm_address_rx;
668668
u64 uplink_icm_address_tx;
669-
bool sw_owner;
669+
u8 sw_owner:1;
670+
u8 sw_owner_v2:1;
670671
};
671672

672673
struct mlx5dr_cmd_vport_cap {
@@ -699,6 +700,9 @@ struct mlx5dr_cmd_caps {
699700
bool rx_sw_owner;
700701
bool tx_sw_owner;
701702
bool fdb_sw_owner;
703+
u8 rx_sw_owner_v2:1;
704+
u8 tx_sw_owner_v2:1;
705+
u8 fdb_sw_owner_v2:1;
702706
u32 num_vports;
703707
struct mlx5dr_esw_caps esw_caps;
704708
struct mlx5dr_cmd_vport_cap *vports_caps;

drivers/net/ethernet/mellanox/mlx5/core/steering/mlx5dr.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,10 @@ int mlx5dr_action_destroy(struct mlx5dr_action *action);
124124
static inline bool
125125
mlx5dr_is_supported(struct mlx5_core_dev *dev)
126126
{
127-
return MLX5_CAP_ESW_FLOWTABLE_FDB(dev, sw_owner);
127+
return MLX5_CAP_ESW_FLOWTABLE_FDB(dev, sw_owner) ||
128+
(MLX5_CAP_ESW_FLOWTABLE_FDB(dev, sw_owner_v2) &&
129+
(MLX5_CAP_GEN(dev, steering_format_version) <=
130+
MLX5_STEERING_FORMAT_CONNECTX_6DX));
128131
}
129132

130133
/* buddy functions & structure */

0 commit comments

Comments
 (0)