Skip to content

Commit 5f75a18

Browse files
committed
Merge tag 'mlx5-updates-2018-03-22' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux
Saeed Mahameed says: ==================== mlx5-updates-2018-03-22 (Misc updates) This series includes misc updates for mlx5 core and netdev dirver, Highlights: From Inbar, three patches to add support for PFC stall prevention statistics and enable/disable through new ethtool tunable, as requested from previous submission. From Moshe, four patches, added more drop counters: - drop counter for netdev steering miss - drop counter for when VF logical link is down - drop counter for when netdev logical link is down. From Or, three patches to support vlan push/pop offload via tc HW action, for newer HW (Connectx-5 and onward) via HW steering flow actions rather than the emulated path for the older HW brands. And five more misc small trivial patches. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 4171ec0 + 7118617 commit 5f75a18

File tree

23 files changed

+531
-90
lines changed

23 files changed

+531
-90
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,7 @@ static int mlx5_internal_err_ret_value(struct mlx5_core_dev *dev, u16 op,
359359
case MLX5_CMD_OP_MODIFY_HCA_VPORT_CONTEXT:
360360
case MLX5_CMD_OP_QUERY_HCA_VPORT_GID:
361361
case MLX5_CMD_OP_QUERY_HCA_VPORT_PKEY:
362+
case MLX5_CMD_OP_QUERY_VNIC_ENV:
362363
case MLX5_CMD_OP_QUERY_VPORT_COUNTER:
363364
case MLX5_CMD_OP_ALLOC_Q_COUNTER:
364365
case MLX5_CMD_OP_QUERY_Q_COUNTER:
@@ -501,6 +502,7 @@ const char *mlx5_command_str(int command)
501502
MLX5_COMMAND_STR_CASE(MODIFY_HCA_VPORT_CONTEXT);
502503
MLX5_COMMAND_STR_CASE(QUERY_HCA_VPORT_GID);
503504
MLX5_COMMAND_STR_CASE(QUERY_HCA_VPORT_PKEY);
505+
MLX5_COMMAND_STR_CASE(QUERY_VNIC_ENV);
504506
MLX5_COMMAND_STR_CASE(QUERY_VPORT_COUNTER);
505507
MLX5_COMMAND_STR_CASE(ALLOC_Q_COUNTER);
506508
MLX5_COMMAND_STR_CASE(DEALLOC_Q_COUNTER);
@@ -1802,7 +1804,7 @@ int mlx5_cmd_init(struct mlx5_core_dev *dev)
18021804

18031805
cmd->checksum_disabled = 1;
18041806
cmd->max_reg_cmds = (1 << cmd->log_sz) - 1;
1805-
cmd->bitmask = (1 << cmd->max_reg_cmds) - 1;
1807+
cmd->bitmask = (1UL << cmd->max_reg_cmds) - 1;
18061808

18071809
cmd->cmdif_rev = ioread32be(&dev->iseg->cmdif_rev_fw_sub) >> 16;
18081810
if (cmd->cmdif_rev > CMD_IF_REV) {

drivers/net/ethernet/mellanox/mlx5/core/diag/fs_tracepoint.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ TRACE_EVENT(mlx5_fs_del_fg,
136136
{MLX5_FLOW_CONTEXT_ACTION_ENCAP, "ENCAP"},\
137137
{MLX5_FLOW_CONTEXT_ACTION_DECAP, "DECAP"},\
138138
{MLX5_FLOW_CONTEXT_ACTION_MOD_HDR, "MOD_HDR"},\
139+
{MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH, "VLAN_PUSH"},\
140+
{MLX5_FLOW_CONTEXT_ACTION_VLAN_POP, "VLAN_POP"},\
139141
{MLX5_FLOW_CONTEXT_ACTION_FWD_NEXT_PRIO, "NEXT_PRIO"}
140142

141143
TRACE_EVENT(mlx5_fs_set_fte,

drivers/net/ethernet/mellanox/mlx5/core/en.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,8 @@ struct mlx5e_priv {
781781
struct net_device *netdev;
782782
struct mlx5e_stats stats;
783783
struct hwtstamp_config tstamp;
784-
u16 q_counter;
784+
u16 q_counter;
785+
u16 drop_rq_q_counter;
785786
#ifdef CONFIG_MLX5_CORE_EN_DCB
786787
struct mlx5e_dcbx dcbx;
787788
#endif
@@ -1061,7 +1062,6 @@ void mlx5e_cleanup_nic_tx(struct mlx5e_priv *priv);
10611062
int mlx5e_close(struct net_device *netdev);
10621063
int mlx5e_open(struct net_device *netdev);
10631064
void mlx5e_update_stats_work(struct work_struct *work);
1064-
u32 mlx5e_choose_lro_timeout(struct mlx5_core_dev *mdev, u32 wanted_timeout);
10651065

10661066
int mlx5e_bits_invert(unsigned long a, int size);
10671067

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

Lines changed: 57 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,6 @@ void mlx5e_ethtool_get_ethtool_stats(struct mlx5e_priv *priv,
203203
{
204204
int i, idx = 0;
205205

206-
if (!data)
207-
return;
208-
209206
mutex_lock(&priv->state_lock);
210207
mlx5e_update_stats(priv);
211208
mutex_unlock(&priv->state_lock);
@@ -1066,6 +1063,57 @@ static int mlx5e_get_rxnfc(struct net_device *netdev,
10661063
return err;
10671064
}
10681065

1066+
#define MLX5E_PFC_PREVEN_AUTO_TOUT_MSEC 100
1067+
#define MLX5E_PFC_PREVEN_TOUT_MAX_MSEC 8000
1068+
#define MLX5E_PFC_PREVEN_MINOR_PRECENT 85
1069+
#define MLX5E_PFC_PREVEN_TOUT_MIN_MSEC 80
1070+
#define MLX5E_DEVICE_STALL_MINOR_WATERMARK(critical_tout) \
1071+
max_t(u16, MLX5E_PFC_PREVEN_TOUT_MIN_MSEC, \
1072+
(critical_tout * MLX5E_PFC_PREVEN_MINOR_PRECENT) / 100)
1073+
1074+
static int mlx5e_get_pfc_prevention_tout(struct net_device *netdev,
1075+
u16 *pfc_prevention_tout)
1076+
{
1077+
struct mlx5e_priv *priv = netdev_priv(netdev);
1078+
struct mlx5_core_dev *mdev = priv->mdev;
1079+
1080+
if (!MLX5_CAP_PCAM_FEATURE((priv)->mdev, pfcc_mask) ||
1081+
!MLX5_CAP_DEBUG((priv)->mdev, stall_detect))
1082+
return -EOPNOTSUPP;
1083+
1084+
return mlx5_query_port_stall_watermark(mdev, pfc_prevention_tout, NULL);
1085+
}
1086+
1087+
static int mlx5e_set_pfc_prevention_tout(struct net_device *netdev,
1088+
u16 pfc_preven)
1089+
{
1090+
struct mlx5e_priv *priv = netdev_priv(netdev);
1091+
struct mlx5_core_dev *mdev = priv->mdev;
1092+
u16 critical_tout;
1093+
u16 minor;
1094+
1095+
if (!MLX5_CAP_PCAM_FEATURE((priv)->mdev, pfcc_mask) ||
1096+
!MLX5_CAP_DEBUG((priv)->mdev, stall_detect))
1097+
return -EOPNOTSUPP;
1098+
1099+
critical_tout = (pfc_preven == PFC_STORM_PREVENTION_AUTO) ?
1100+
MLX5E_PFC_PREVEN_AUTO_TOUT_MSEC :
1101+
pfc_preven;
1102+
1103+
if (critical_tout != PFC_STORM_PREVENTION_DISABLE &&
1104+
(critical_tout > MLX5E_PFC_PREVEN_TOUT_MAX_MSEC ||
1105+
critical_tout < MLX5E_PFC_PREVEN_TOUT_MIN_MSEC)) {
1106+
netdev_info(netdev, "%s: pfc prevention tout not in range (%d-%d)\n",
1107+
__func__, MLX5E_PFC_PREVEN_TOUT_MIN_MSEC,
1108+
MLX5E_PFC_PREVEN_TOUT_MAX_MSEC);
1109+
return -EINVAL;
1110+
}
1111+
1112+
minor = MLX5E_DEVICE_STALL_MINOR_WATERMARK(critical_tout);
1113+
return mlx5_set_port_stall_watermark(mdev, critical_tout,
1114+
minor);
1115+
}
1116+
10691117
static int mlx5e_get_tunable(struct net_device *dev,
10701118
const struct ethtool_tunable *tuna,
10711119
void *data)
@@ -1077,6 +1125,9 @@ static int mlx5e_get_tunable(struct net_device *dev,
10771125
case ETHTOOL_TX_COPYBREAK:
10781126
*(u32 *)data = priv->channels.params.tx_max_inline;
10791127
break;
1128+
case ETHTOOL_PFC_PREVENTION_TOUT:
1129+
err = mlx5e_get_pfc_prevention_tout(dev, data);
1130+
break;
10801131
default:
10811132
err = -EINVAL;
10821133
break;
@@ -1118,6 +1169,9 @@ static int mlx5e_set_tunable(struct net_device *dev,
11181169
break;
11191170
mlx5e_switch_priv_channels(priv, &new_channels, NULL);
11201171

1172+
break;
1173+
case ETHTOOL_PFC_PREVENTION_TOUT:
1174+
err = mlx5e_set_pfc_prevention_tout(dev, *(u16 *)data);
11211175
break;
11221176
default:
11231177
err = -EINVAL;

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

Lines changed: 45 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -615,8 +615,7 @@ static int mlx5e_create_rq(struct mlx5e_rq *rq,
615615
static int mlx5e_modify_rq_state(struct mlx5e_rq *rq, int curr_state,
616616
int next_state)
617617
{
618-
struct mlx5e_channel *c = rq->channel;
619-
struct mlx5_core_dev *mdev = c->mdev;
618+
struct mlx5_core_dev *mdev = rq->mdev;
620619

621620
void *in;
622621
void *rqc;
@@ -1768,14 +1767,16 @@ static void mlx5e_build_rq_param(struct mlx5e_priv *priv,
17681767
param->wq.linear = 1;
17691768
}
17701769

1771-
static void mlx5e_build_drop_rq_param(struct mlx5_core_dev *mdev,
1770+
static void mlx5e_build_drop_rq_param(struct mlx5e_priv *priv,
17721771
struct mlx5e_rq_param *param)
17731772
{
1773+
struct mlx5_core_dev *mdev = priv->mdev;
17741774
void *rqc = param->rqc;
17751775
void *wq = MLX5_ADDR_OF(rqc, rqc, wq);
17761776

17771777
MLX5_SET(wq, wq, wq_type, MLX5_WQ_TYPE_LINKED_LIST);
17781778
MLX5_SET(wq, wq, log_wq_stride, ilog2(sizeof(struct mlx5e_rx_wqe)));
1779+
MLX5_SET(rqc, rqc, counter_set_id, priv->drop_rq_q_counter);
17791780

17801781
param->wq.buf_numa_node = dev_to_node(&mdev->pdev->dev);
17811782
}
@@ -2643,15 +2644,16 @@ static int mlx5e_alloc_drop_cq(struct mlx5_core_dev *mdev,
26432644
return mlx5e_alloc_cq_common(mdev, param, cq);
26442645
}
26452646

2646-
static int mlx5e_open_drop_rq(struct mlx5_core_dev *mdev,
2647+
static int mlx5e_open_drop_rq(struct mlx5e_priv *priv,
26472648
struct mlx5e_rq *drop_rq)
26482649
{
2650+
struct mlx5_core_dev *mdev = priv->mdev;
26492651
struct mlx5e_cq_param cq_param = {};
26502652
struct mlx5e_rq_param rq_param = {};
26512653
struct mlx5e_cq *cq = &drop_rq->cq;
26522654
int err;
26532655

2654-
mlx5e_build_drop_rq_param(mdev, &rq_param);
2656+
mlx5e_build_drop_rq_param(priv, &rq_param);
26552657

26562658
err = mlx5e_alloc_drop_cq(mdev, cq, &cq_param);
26572659
if (err)
@@ -2669,6 +2671,10 @@ static int mlx5e_open_drop_rq(struct mlx5_core_dev *mdev,
26692671
if (err)
26702672
goto err_free_rq;
26712673

2674+
err = mlx5e_modify_rq_state(drop_rq, MLX5_RQC_STATE_RST, MLX5_RQC_STATE_RDY);
2675+
if (err)
2676+
mlx5_core_warn(priv->mdev, "modify_rq_state failed, rx_if_down_packets won't be counted %d\n", err);
2677+
26722678
return 0;
26732679

26742680
err_free_rq:
@@ -3236,24 +3242,20 @@ static int mlx5e_set_features(struct net_device *netdev,
32363242
netdev_features_t features)
32373243
{
32383244
netdev_features_t oper_features = netdev->features;
3239-
int err;
3245+
int err = 0;
32403246

3241-
err = mlx5e_handle_feature(netdev, &oper_features, features,
3242-
NETIF_F_LRO, set_feature_lro);
3243-
err |= mlx5e_handle_feature(netdev, &oper_features, features,
3244-
NETIF_F_HW_VLAN_CTAG_FILTER,
3247+
#define MLX5E_HANDLE_FEATURE(feature, handler) \
3248+
mlx5e_handle_feature(netdev, &oper_features, features, feature, handler)
3249+
3250+
err |= MLX5E_HANDLE_FEATURE(NETIF_F_LRO, set_feature_lro);
3251+
err |= MLX5E_HANDLE_FEATURE(NETIF_F_HW_VLAN_CTAG_FILTER,
32453252
set_feature_cvlan_filter);
3246-
err |= mlx5e_handle_feature(netdev, &oper_features, features,
3247-
NETIF_F_HW_TC, set_feature_tc_num_filters);
3248-
err |= mlx5e_handle_feature(netdev, &oper_features, features,
3249-
NETIF_F_RXALL, set_feature_rx_all);
3250-
err |= mlx5e_handle_feature(netdev, &oper_features, features,
3251-
NETIF_F_RXFCS, set_feature_rx_fcs);
3252-
err |= mlx5e_handle_feature(netdev, &oper_features, features,
3253-
NETIF_F_HW_VLAN_CTAG_RX, set_feature_rx_vlan);
3253+
err |= MLX5E_HANDLE_FEATURE(NETIF_F_HW_TC, set_feature_tc_num_filters);
3254+
err |= MLX5E_HANDLE_FEATURE(NETIF_F_RXALL, set_feature_rx_all);
3255+
err |= MLX5E_HANDLE_FEATURE(NETIF_F_RXFCS, set_feature_rx_fcs);
3256+
err |= MLX5E_HANDLE_FEATURE(NETIF_F_HW_VLAN_CTAG_RX, set_feature_rx_vlan);
32543257
#ifdef CONFIG_RFS_ACCEL
3255-
err |= mlx5e_handle_feature(netdev, &oper_features, features,
3256-
NETIF_F_NTUPLE, set_feature_arfs);
3258+
err |= MLX5E_HANDLE_FEATURE(NETIF_F_NTUPLE, set_feature_arfs);
32573259
#endif
32583260

32593261
if (err) {
@@ -3961,7 +3963,7 @@ void mlx5e_set_rx_cq_mode_params(struct mlx5e_params *params, u8 cq_period_mode)
39613963
MLX5_CQ_PERIOD_MODE_START_FROM_CQE);
39623964
}
39633965

3964-
u32 mlx5e_choose_lro_timeout(struct mlx5_core_dev *mdev, u32 wanted_timeout)
3966+
static u32 mlx5e_choose_lro_timeout(struct mlx5_core_dev *mdev, u32 wanted_timeout)
39653967
{
39663968
int i;
39673969

@@ -4104,6 +4106,9 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev)
41044106
netdev->vlan_features |= NETIF_F_RXCSUM;
41054107
netdev->vlan_features |= NETIF_F_RXHASH;
41064108

4109+
netdev->hw_enc_features |= NETIF_F_HW_VLAN_CTAG_TX;
4110+
netdev->hw_enc_features |= NETIF_F_HW_VLAN_CTAG_RX;
4111+
41074112
if (!!MLX5_CAP_ETH(mdev, lro_cap))
41084113
netdev->vlan_features |= NETIF_F_LRO;
41094114

@@ -4183,7 +4188,7 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev)
41834188
mlx5e_ipsec_build_netdev(priv);
41844189
}
41854190

4186-
static void mlx5e_create_q_counter(struct mlx5e_priv *priv)
4191+
static void mlx5e_create_q_counters(struct mlx5e_priv *priv)
41874192
{
41884193
struct mlx5_core_dev *mdev = priv->mdev;
41894194
int err;
@@ -4193,14 +4198,21 @@ static void mlx5e_create_q_counter(struct mlx5e_priv *priv)
41934198
mlx5_core_warn(mdev, "alloc queue counter failed, %d\n", err);
41944199
priv->q_counter = 0;
41954200
}
4201+
4202+
err = mlx5_core_alloc_q_counter(mdev, &priv->drop_rq_q_counter);
4203+
if (err) {
4204+
mlx5_core_warn(mdev, "alloc drop RQ counter failed, %d\n", err);
4205+
priv->drop_rq_q_counter = 0;
4206+
}
41964207
}
41974208

4198-
static void mlx5e_destroy_q_counter(struct mlx5e_priv *priv)
4209+
static void mlx5e_destroy_q_counters(struct mlx5e_priv *priv)
41994210
{
4200-
if (!priv->q_counter)
4201-
return;
4211+
if (priv->q_counter)
4212+
mlx5_core_dealloc_q_counter(priv->mdev, priv->q_counter);
42024213

4203-
mlx5_core_dealloc_q_counter(priv->mdev, priv->q_counter);
4214+
if (priv->drop_rq_q_counter)
4215+
mlx5_core_dealloc_q_counter(priv->mdev, priv->drop_rq_q_counter);
42044216
}
42054217

42064218
static void mlx5e_nic_init(struct mlx5_core_dev *mdev,
@@ -4439,18 +4451,18 @@ int mlx5e_attach_netdev(struct mlx5e_priv *priv)
44394451
if (err)
44404452
goto out;
44414453

4442-
err = mlx5e_open_drop_rq(mdev, &priv->drop_rq);
4454+
mlx5e_create_q_counters(priv);
4455+
4456+
err = mlx5e_open_drop_rq(priv, &priv->drop_rq);
44434457
if (err) {
44444458
mlx5_core_err(mdev, "open drop rq failed, %d\n", err);
4445-
goto err_cleanup_tx;
4459+
goto err_destroy_q_counters;
44464460
}
44474461

44484462
err = profile->init_rx(priv);
44494463
if (err)
44504464
goto err_close_drop_rq;
44514465

4452-
mlx5e_create_q_counter(priv);
4453-
44544466
if (profile->enable)
44554467
profile->enable(priv);
44564468

@@ -4459,7 +4471,8 @@ int mlx5e_attach_netdev(struct mlx5e_priv *priv)
44594471
err_close_drop_rq:
44604472
mlx5e_close_drop_rq(&priv->drop_rq);
44614473

4462-
err_cleanup_tx:
4474+
err_destroy_q_counters:
4475+
mlx5e_destroy_q_counters(priv);
44634476
profile->cleanup_tx(priv);
44644477

44654478
out:
@@ -4476,9 +4489,9 @@ void mlx5e_detach_netdev(struct mlx5e_priv *priv)
44764489
profile->disable(priv);
44774490
flush_workqueue(priv->wq);
44784491

4479-
mlx5e_destroy_q_counter(priv);
44804492
profile->cleanup_rx(priv);
44814493
mlx5e_close_drop_rq(&priv->drop_rq);
4494+
mlx5e_destroy_q_counters(priv);
44824495
profile->cleanup_tx(priv);
44834496
cancel_delayed_work_sync(&priv->update_stats_work);
44844497
}

0 commit comments

Comments
 (0)