Skip to content

Commit 4b52416

Browse files
committed
Merge branch 'mlx5-fixes'
Saeed Mahameed says: ==================== Mellanox 100G mlx5 fixes 28-12-2016 Some fixes for mlx5 core and ethernet driver. for -stable: net/mlx5: Check FW limitations on log_max_qp before setting it net/mlx5: Cancel recovery work in remove flow net/mlx5: Avoid shadowing numa_node net/mlx5: Mask destination mac value in ethtool steering rules net/mlx5: Prevent setting multicast macs for VFs net/mlx5e: Don't sync netdev state when not registered net/mlx5e: Disable netdev after close ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents 0df0f20 + 37f304d commit 4b52416

File tree

12 files changed

+45
-187
lines changed

12 files changed

+45
-187
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,9 @@ static void mlx5e_ets_init(struct mlx5e_priv *priv)
723723
int i;
724724
struct ieee_ets ets;
725725

726+
if (!MLX5_CAP_GEN(priv->mdev, ets))
727+
return;
728+
726729
memset(&ets, 0, sizeof(ets));
727730
ets.ets_cap = mlx5_max_tc(priv->mdev) + 1;
728731
for (i = 0; i < ets.ets_cap; i++) {

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

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ static int mlx5e_get_sset_count(struct net_device *dev, int sset)
171171
return NUM_SW_COUNTERS +
172172
MLX5E_NUM_Q_CNTRS(priv) +
173173
NUM_VPORT_COUNTERS + NUM_PPORT_COUNTERS +
174-
NUM_PCIE_COUNTERS +
175174
MLX5E_NUM_RQ_STATS(priv) +
176175
MLX5E_NUM_SQ_STATS(priv) +
177176
MLX5E_NUM_PFC_COUNTERS(priv) +
@@ -219,14 +218,6 @@ static void mlx5e_fill_stats_strings(struct mlx5e_priv *priv, uint8_t *data)
219218
strcpy(data + (idx++) * ETH_GSTRING_LEN,
220219
pport_2819_stats_desc[i].format);
221220

222-
for (i = 0; i < NUM_PCIE_PERF_COUNTERS; i++)
223-
strcpy(data + (idx++) * ETH_GSTRING_LEN,
224-
pcie_perf_stats_desc[i].format);
225-
226-
for (i = 0; i < NUM_PCIE_TAS_COUNTERS; i++)
227-
strcpy(data + (idx++) * ETH_GSTRING_LEN,
228-
pcie_tas_stats_desc[i].format);
229-
230221
for (prio = 0; prio < NUM_PPORT_PRIO; prio++) {
231222
for (i = 0; i < NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS; i++)
232223
sprintf(data + (idx++) * ETH_GSTRING_LEN,
@@ -339,14 +330,6 @@ static void mlx5e_get_ethtool_stats(struct net_device *dev,
339330
data[idx++] = MLX5E_READ_CTR64_BE(&priv->stats.pport.RFC_2819_counters,
340331
pport_2819_stats_desc, i);
341332

342-
for (i = 0; i < NUM_PCIE_PERF_COUNTERS; i++)
343-
data[idx++] = MLX5E_READ_CTR32_BE(&priv->stats.pcie.pcie_perf_counters,
344-
pcie_perf_stats_desc, i);
345-
346-
for (i = 0; i < NUM_PCIE_TAS_COUNTERS; i++)
347-
data[idx++] = MLX5E_READ_CTR32_BE(&priv->stats.pcie.pcie_tas_counters,
348-
pcie_tas_stats_desc, i);
349-
350333
for (prio = 0; prio < NUM_PPORT_PRIO; prio++) {
351334
for (i = 0; i < NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS; i++)
352335
data[idx++] = MLX5E_READ_CTR64_BE(&priv->stats.pport.per_prio_counters[prio],

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ static int set_flow_attrs(u32 *match_c, u32 *match_v,
247247
}
248248
if (fs->flow_type & FLOW_MAC_EXT &&
249249
!is_zero_ether_addr(fs->m_ext.h_dest)) {
250+
mask_spec(fs->m_ext.h_dest, fs->h_ext.h_dest, ETH_ALEN);
250251
ether_addr_copy(MLX5_ADDR_OF(fte_match_set_lyr_2_4,
251252
outer_headers_c, dmac_47_16),
252253
fs->m_ext.h_dest);

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

Lines changed: 16 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -291,36 +291,12 @@ static void mlx5e_update_q_counter(struct mlx5e_priv *priv)
291291
&qcnt->rx_out_of_buffer);
292292
}
293293

294-
static void mlx5e_update_pcie_counters(struct mlx5e_priv *priv)
295-
{
296-
struct mlx5e_pcie_stats *pcie_stats = &priv->stats.pcie;
297-
struct mlx5_core_dev *mdev = priv->mdev;
298-
int sz = MLX5_ST_SZ_BYTES(mpcnt_reg);
299-
void *out;
300-
u32 *in;
301-
302-
in = mlx5_vzalloc(sz);
303-
if (!in)
304-
return;
305-
306-
out = pcie_stats->pcie_perf_counters;
307-
MLX5_SET(mpcnt_reg, in, grp, MLX5_PCIE_PERFORMANCE_COUNTERS_GROUP);
308-
mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_MPCNT, 0, 0);
309-
310-
out = pcie_stats->pcie_tas_counters;
311-
MLX5_SET(mpcnt_reg, in, grp, MLX5_PCIE_TIMERS_AND_STATES_COUNTERS_GROUP);
312-
mlx5_core_access_reg(mdev, in, sz, out, sz, MLX5_REG_MPCNT, 0, 0);
313-
314-
kvfree(in);
315-
}
316-
317294
void mlx5e_update_stats(struct mlx5e_priv *priv)
318295
{
319296
mlx5e_update_q_counter(priv);
320297
mlx5e_update_vport_counters(priv);
321298
mlx5e_update_pport_counters(priv);
322299
mlx5e_update_sw_counters(priv);
323-
mlx5e_update_pcie_counters(priv);
324300
}
325301

326302
void mlx5e_update_stats_work(struct work_struct *work)
@@ -3805,14 +3781,7 @@ static void mlx5e_nic_enable(struct mlx5e_priv *priv)
38053781

38063782
mlx5_lag_add(mdev, netdev);
38073783

3808-
if (mlx5e_vxlan_allowed(mdev)) {
3809-
rtnl_lock();
3810-
udp_tunnel_get_rx_info(netdev);
3811-
rtnl_unlock();
3812-
}
3813-
38143784
mlx5e_enable_async_events(priv);
3815-
queue_work(priv->wq, &priv->set_rx_mode_work);
38163785

38173786
if (MLX5_CAP_GEN(mdev, vport_group_manager)) {
38183787
mlx5_query_nic_vport_mac_address(mdev, 0, rep.hw_id);
@@ -3822,6 +3791,18 @@ static void mlx5e_nic_enable(struct mlx5e_priv *priv)
38223791
rep.netdev = netdev;
38233792
mlx5_eswitch_register_vport_rep(esw, 0, &rep);
38243793
}
3794+
3795+
if (netdev->reg_state != NETREG_REGISTERED)
3796+
return;
3797+
3798+
/* Device already registered: sync netdev system state */
3799+
if (mlx5e_vxlan_allowed(mdev)) {
3800+
rtnl_lock();
3801+
udp_tunnel_get_rx_info(netdev);
3802+
rtnl_unlock();
3803+
}
3804+
3805+
queue_work(priv->wq, &priv->set_rx_mode_work);
38253806
}
38263807

38273808
static void mlx5e_nic_disable(struct mlx5e_priv *priv)
@@ -3966,17 +3947,17 @@ void mlx5e_detach_netdev(struct mlx5_core_dev *mdev, struct net_device *netdev)
39663947
const struct mlx5e_profile *profile = priv->profile;
39673948

39683949
set_bit(MLX5E_STATE_DESTROYING, &priv->state);
3969-
if (profile->disable)
3970-
profile->disable(priv);
3971-
3972-
flush_workqueue(priv->wq);
39733950

39743951
rtnl_lock();
39753952
if (netif_running(netdev))
39763953
mlx5e_close(netdev);
39773954
netif_device_detach(netdev);
39783955
rtnl_unlock();
39793956

3957+
if (profile->disable)
3958+
profile->disable(priv);
3959+
flush_workqueue(priv->wq);
3960+
39803961
mlx5e_destroy_q_counter(priv);
39813962
profile->cleanup_rx(priv);
39823963
mlx5e_close_drop_rq(priv);

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

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
#define MLX5E_READ_CTR32_CPU(ptr, dsc, i) \
4040
(*(u32 *)((char *)ptr + dsc[i].offset))
4141
#define MLX5E_READ_CTR32_BE(ptr, dsc, i) \
42-
be32_to_cpu(*(__be32 *)((char *)ptr + dsc[i].offset))
42+
be64_to_cpu(*(__be32 *)((char *)ptr + dsc[i].offset))
4343

4444
#define MLX5E_DECLARE_STAT(type, fld) #fld, offsetof(type, fld)
4545
#define MLX5E_DECLARE_RX_STAT(type, fld) "rx%d_"#fld, offsetof(type, fld)
@@ -276,32 +276,6 @@ static const struct counter_desc pport_per_prio_pfc_stats_desc[] = {
276276
{ "rx_%s_pause_transition", PPORT_PER_PRIO_OFF(rx_pause_transition) },
277277
};
278278

279-
#define PCIE_PERF_OFF(c) \
280-
MLX5_BYTE_OFF(mpcnt_reg, counter_set.pcie_perf_cntrs_grp_data_layout.c)
281-
#define PCIE_PERF_GET(pcie_stats, c) \
282-
MLX5_GET(mpcnt_reg, pcie_stats->pcie_perf_counters, \
283-
counter_set.pcie_perf_cntrs_grp_data_layout.c)
284-
#define PCIE_TAS_OFF(c) \
285-
MLX5_BYTE_OFF(mpcnt_reg, counter_set.pcie_tas_cntrs_grp_data_layout.c)
286-
#define PCIE_TAS_GET(pcie_stats, c) \
287-
MLX5_GET(mpcnt_reg, pcie_stats->pcie_tas_counters, \
288-
counter_set.pcie_tas_cntrs_grp_data_layout.c)
289-
290-
struct mlx5e_pcie_stats {
291-
__be64 pcie_perf_counters[MLX5_ST_SZ_QW(mpcnt_reg)];
292-
__be64 pcie_tas_counters[MLX5_ST_SZ_QW(mpcnt_reg)];
293-
};
294-
295-
static const struct counter_desc pcie_perf_stats_desc[] = {
296-
{ "rx_pci_signal_integrity", PCIE_PERF_OFF(rx_errors) },
297-
{ "tx_pci_signal_integrity", PCIE_PERF_OFF(tx_errors) },
298-
};
299-
300-
static const struct counter_desc pcie_tas_stats_desc[] = {
301-
{ "tx_pci_transport_nonfatal_msg", PCIE_TAS_OFF(non_fatal_err_msg_sent) },
302-
{ "tx_pci_transport_fatal_msg", PCIE_TAS_OFF(fatal_err_msg_sent) },
303-
};
304-
305279
struct mlx5e_rq_stats {
306280
u64 packets;
307281
u64 bytes;
@@ -386,8 +360,6 @@ static const struct counter_desc sq_stats_desc[] = {
386360
#define NUM_PPORT_802_3_COUNTERS ARRAY_SIZE(pport_802_3_stats_desc)
387361
#define NUM_PPORT_2863_COUNTERS ARRAY_SIZE(pport_2863_stats_desc)
388362
#define NUM_PPORT_2819_COUNTERS ARRAY_SIZE(pport_2819_stats_desc)
389-
#define NUM_PCIE_PERF_COUNTERS ARRAY_SIZE(pcie_perf_stats_desc)
390-
#define NUM_PCIE_TAS_COUNTERS ARRAY_SIZE(pcie_tas_stats_desc)
391363
#define NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS \
392364
ARRAY_SIZE(pport_per_prio_traffic_stats_desc)
393365
#define NUM_PPORT_PER_PRIO_PFC_COUNTERS \
@@ -397,7 +369,6 @@ static const struct counter_desc sq_stats_desc[] = {
397369
NUM_PPORT_2819_COUNTERS + \
398370
NUM_PPORT_PER_PRIO_TRAFFIC_COUNTERS * \
399371
NUM_PPORT_PRIO)
400-
#define NUM_PCIE_COUNTERS (NUM_PCIE_PERF_COUNTERS + NUM_PCIE_TAS_COUNTERS)
401372
#define NUM_RQ_STATS ARRAY_SIZE(rq_stats_desc)
402373
#define NUM_SQ_STATS ARRAY_SIZE(sq_stats_desc)
403374

@@ -406,7 +377,6 @@ struct mlx5e_stats {
406377
struct mlx5e_qcounter_stats qcnt;
407378
struct mlx5e_vport_stats vport;
408379
struct mlx5e_pport_stats pport;
409-
struct mlx5e_pcie_stats pcie;
410380
struct rtnl_link_stats64 vf_vport;
411381
};
412382

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1860,7 +1860,7 @@ int mlx5_eswitch_set_vport_mac(struct mlx5_eswitch *esw,
18601860

18611861
if (!ESW_ALLOWED(esw))
18621862
return -EPERM;
1863-
if (!LEGAL_VPORT(esw, vport))
1863+
if (!LEGAL_VPORT(esw, vport) || is_multicast_ether_addr(mac))
18641864
return -EINVAL;
18651865

18661866
mutex_lock(&esw->state_lock);

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,12 @@ int esw_offloads_init(struct mlx5_eswitch *esw, int nvports)
695695
if (err)
696696
goto err_reps;
697697
}
698+
699+
/* disable PF RoCE so missed packets don't go through RoCE steering */
700+
mlx5_dev_list_lock();
701+
mlx5_remove_dev_by_protocol(esw->dev, MLX5_INTERFACE_PROTOCOL_IB);
702+
mlx5_dev_list_unlock();
703+
698704
return 0;
699705

700706
err_reps:
@@ -718,6 +724,11 @@ static int esw_offloads_stop(struct mlx5_eswitch *esw)
718724
{
719725
int err, err1, num_vfs = esw->dev->priv.sriov.num_vfs;
720726

727+
/* enable back PF RoCE */
728+
mlx5_dev_list_lock();
729+
mlx5_add_dev_by_protocol(esw->dev, MLX5_INTERFACE_PROTOCOL_IB);
730+
mlx5_dev_list_unlock();
731+
721732
mlx5_eswitch_disable_sriov(esw);
722733
err = mlx5_eswitch_enable_sriov(esw, num_vfs, SRIOV_LEGACY);
723734
if (err) {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,6 +1263,7 @@ static struct mlx5_flow_handle *add_rule_fg(struct mlx5_flow_group *fg,
12631263
nested_lock_ref_node(&fte->node, FS_MUTEX_CHILD);
12641264
handle = add_rule_fte(fte, fg, dest, dest_num, false);
12651265
if (IS_ERR(handle)) {
1266+
unlock_ref_node(&fte->node);
12661267
kfree(fte);
12671268
goto unlock_fg;
12681269
}

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

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,13 @@ static int handle_hca_cap(struct mlx5_core_dev *dev)
503503
MLX5_SET(cmd_hca_cap, set_hca_cap, pkey_table_size,
504504
to_fw_pkey_sz(dev, 128));
505505

506+
/* Check log_max_qp from HCA caps to set in current profile */
507+
if (MLX5_CAP_GEN_MAX(dev, log_max_qp) < profile[prof_sel].log_max_qp) {
508+
mlx5_core_warn(dev, "log_max_qp value in current profile is %d, changing it to HCA capability limit (%d)\n",
509+
profile[prof_sel].log_max_qp,
510+
MLX5_CAP_GEN_MAX(dev, log_max_qp));
511+
profile[prof_sel].log_max_qp = MLX5_CAP_GEN_MAX(dev, log_max_qp);
512+
}
506513
if (prof->mask & MLX5_PROF_MASK_QP_SIZE)
507514
MLX5_SET(cmd_hca_cap, set_hca_cap, log_max_qp,
508515
prof->log_max_qp);
@@ -575,15 +582,14 @@ static int mlx5_irq_set_affinity_hint(struct mlx5_core_dev *mdev, int i)
575582
struct mlx5_priv *priv = &mdev->priv;
576583
struct msix_entry *msix = priv->msix_arr;
577584
int irq = msix[i + MLX5_EQ_VEC_COMP_BASE].vector;
578-
int numa_node = priv->numa_node;
579585
int err;
580586

581587
if (!zalloc_cpumask_var(&priv->irq_info[i].mask, GFP_KERNEL)) {
582588
mlx5_core_warn(mdev, "zalloc_cpumask_var failed");
583589
return -ENOMEM;
584590
}
585591

586-
cpumask_set_cpu(cpumask_local_spread(i, numa_node),
592+
cpumask_set_cpu(cpumask_local_spread(i, priv->numa_node),
587593
priv->irq_info[i].mask);
588594

589595
err = irq_set_affinity_hint(irq, priv->irq_info[i].mask);
@@ -1189,6 +1195,8 @@ static int mlx5_unload_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv,
11891195
{
11901196
int err = 0;
11911197

1198+
mlx5_drain_health_wq(dev);
1199+
11921200
mutex_lock(&dev->intf_state_mutex);
11931201
if (test_bit(MLX5_INTERFACE_STATE_DOWN, &dev->intf_state)) {
11941202
dev_warn(&dev->pdev->dev, "%s: interface is down, NOP\n",
@@ -1351,10 +1359,9 @@ static pci_ers_result_t mlx5_pci_err_detected(struct pci_dev *pdev,
13511359

13521360
mlx5_enter_error_state(dev);
13531361
mlx5_unload_one(dev, priv, false);
1354-
/* In case of kernel call save the pci state and drain health wq */
1362+
/* In case of kernel call save the pci state */
13551363
if (state) {
13561364
pci_save_state(pdev);
1357-
mlx5_drain_health_wq(dev);
13581365
mlx5_pci_disable_device(dev);
13591366
}
13601367

include/linux/mlx5/device.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,11 +1071,6 @@ enum {
10711071
MLX5_INFINIBAND_PORT_COUNTERS_GROUP = 0x20,
10721072
};
10731073

1074-
enum {
1075-
MLX5_PCIE_PERFORMANCE_COUNTERS_GROUP = 0x0,
1076-
MLX5_PCIE_TIMERS_AND_STATES_COUNTERS_GROUP = 0x2,
1077-
};
1078-
10791074
static inline u16 mlx5_to_sw_pkey_sz(int pkey_sz)
10801075
{
10811076
if (pkey_sz > MLX5_MAX_LOG_PKEY_TABLE)

include/linux/mlx5/driver.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ enum {
123123
MLX5_REG_HOST_ENDIANNESS = 0x7004,
124124
MLX5_REG_MCIA = 0x9014,
125125
MLX5_REG_MLCR = 0x902b,
126-
MLX5_REG_MPCNT = 0x9051,
127126
};
128127

129128
enum mlx5_dcbx_oper_mode {

0 commit comments

Comments
 (0)