diff options
author | David S. Miller <davem@davemloft.net> | 2019-06-09 22:45:54 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-06-09 22:45:54 -0400 |
commit | 4172eadb086407ac571f5e5be640b07b1a66ae87 (patch) | |
tree | c253cd86e162d82f169f28110fdf003ca9778bda | |
parent | 62f42a114b920548bbb536b3a8363bc1310f3cd7 (diff) | |
parent | 45e7d4c0c1727d362012a62eb57254ea71a2d591 (diff) |
Merge tag 'mlx5-fixes-2019-06-07' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux
Saeed Mahameed says:
====================
Mellanox, mlx5 fixes 2019-06-07
This series introduces some fixes to mlx5 driver.
Please pull and let me know if there is any problem.
For -stable v4.17
('net/mlx5: Avoid reloading already removed devices')
For -stable v5.0
('net/mlx5e: Avoid detaching non-existing netdev under switchdev mode')
For -stable v5.1
('net/mlx5e: Fix source port matching in fdb peer flow rule')
('net/mlx5e: Support tagged tunnel over bond')
('net/mlx5e: Add ndo_set_feature for uplink representor')
('net/mlx5: Update pci error handler entries and command translation')
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 8 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/dev.c | 25 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/en.h | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c | 11 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 9 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 10 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 3 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | 12 |
8 files changed, 58 insertions, 22 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c index d2ab8cd8ad9f..e94686c42000 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c | |||
@@ -441,6 +441,10 @@ static int mlx5_internal_err_ret_value(struct mlx5_core_dev *dev, u16 op, | |||
441 | case MLX5_CMD_OP_CREATE_GENERAL_OBJECT: | 441 | case MLX5_CMD_OP_CREATE_GENERAL_OBJECT: |
442 | case MLX5_CMD_OP_MODIFY_GENERAL_OBJECT: | 442 | case MLX5_CMD_OP_MODIFY_GENERAL_OBJECT: |
443 | case MLX5_CMD_OP_QUERY_GENERAL_OBJECT: | 443 | case MLX5_CMD_OP_QUERY_GENERAL_OBJECT: |
444 | case MLX5_CMD_OP_CREATE_UCTX: | ||
445 | case MLX5_CMD_OP_DESTROY_UCTX: | ||
446 | case MLX5_CMD_OP_CREATE_UMEM: | ||
447 | case MLX5_CMD_OP_DESTROY_UMEM: | ||
444 | case MLX5_CMD_OP_ALLOC_MEMIC: | 448 | case MLX5_CMD_OP_ALLOC_MEMIC: |
445 | *status = MLX5_DRIVER_STATUS_ABORTED; | 449 | *status = MLX5_DRIVER_STATUS_ABORTED; |
446 | *synd = MLX5_DRIVER_SYND; | 450 | *synd = MLX5_DRIVER_SYND; |
@@ -629,6 +633,10 @@ const char *mlx5_command_str(int command) | |||
629 | MLX5_COMMAND_STR_CASE(ALLOC_MEMIC); | 633 | MLX5_COMMAND_STR_CASE(ALLOC_MEMIC); |
630 | MLX5_COMMAND_STR_CASE(DEALLOC_MEMIC); | 634 | MLX5_COMMAND_STR_CASE(DEALLOC_MEMIC); |
631 | MLX5_COMMAND_STR_CASE(QUERY_HOST_PARAMS); | 635 | MLX5_COMMAND_STR_CASE(QUERY_HOST_PARAMS); |
636 | MLX5_COMMAND_STR_CASE(CREATE_UCTX); | ||
637 | MLX5_COMMAND_STR_CASE(DESTROY_UCTX); | ||
638 | MLX5_COMMAND_STR_CASE(CREATE_UMEM); | ||
639 | MLX5_COMMAND_STR_CASE(DESTROY_UMEM); | ||
632 | default: return "unknown command opcode"; | 640 | default: return "unknown command opcode"; |
633 | } | 641 | } |
634 | } | 642 | } |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/dev.c b/drivers/net/ethernet/mellanox/mlx5/core/dev.c index ebc046fa97d3..f6b1da99e6c2 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/dev.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/dev.c | |||
@@ -248,11 +248,32 @@ void mlx5_unregister_interface(struct mlx5_interface *intf) | |||
248 | } | 248 | } |
249 | EXPORT_SYMBOL(mlx5_unregister_interface); | 249 | EXPORT_SYMBOL(mlx5_unregister_interface); |
250 | 250 | ||
251 | /* Must be called with intf_mutex held */ | ||
252 | static bool mlx5_has_added_dev_by_protocol(struct mlx5_core_dev *mdev, int protocol) | ||
253 | { | ||
254 | struct mlx5_device_context *dev_ctx; | ||
255 | struct mlx5_interface *intf; | ||
256 | bool found = false; | ||
257 | |||
258 | list_for_each_entry(intf, &intf_list, list) { | ||
259 | if (intf->protocol == protocol) { | ||
260 | dev_ctx = mlx5_get_device(intf, &mdev->priv); | ||
261 | if (dev_ctx && test_bit(MLX5_INTERFACE_ADDED, &dev_ctx->state)) | ||
262 | found = true; | ||
263 | break; | ||
264 | } | ||
265 | } | ||
266 | |||
267 | return found; | ||
268 | } | ||
269 | |||
251 | void mlx5_reload_interface(struct mlx5_core_dev *mdev, int protocol) | 270 | void mlx5_reload_interface(struct mlx5_core_dev *mdev, int protocol) |
252 | { | 271 | { |
253 | mutex_lock(&mlx5_intf_mutex); | 272 | mutex_lock(&mlx5_intf_mutex); |
254 | mlx5_remove_dev_by_protocol(mdev, protocol); | 273 | if (mlx5_has_added_dev_by_protocol(mdev, protocol)) { |
255 | mlx5_add_dev_by_protocol(mdev, protocol); | 274 | mlx5_remove_dev_by_protocol(mdev, protocol); |
275 | mlx5_add_dev_by_protocol(mdev, protocol); | ||
276 | } | ||
256 | mutex_unlock(&mlx5_intf_mutex); | 277 | mutex_unlock(&mlx5_intf_mutex); |
257 | } | 278 | } |
258 | 279 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h index 3a183d690e23..cc6797e24571 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h | |||
@@ -385,6 +385,7 @@ struct mlx5e_txqsq { | |||
385 | /* control path */ | 385 | /* control path */ |
386 | struct mlx5_wq_ctrl wq_ctrl; | 386 | struct mlx5_wq_ctrl wq_ctrl; |
387 | struct mlx5e_channel *channel; | 387 | struct mlx5e_channel *channel; |
388 | int ch_ix; | ||
388 | int txq_ix; | 389 | int txq_ix; |
389 | u32 rate_limit; | 390 | u32 rate_limit; |
390 | struct work_struct recover_work; | 391 | struct work_struct recover_work; |
@@ -1112,6 +1113,7 @@ void mlx5e_del_vxlan_port(struct net_device *netdev, struct udp_tunnel_info *ti) | |||
1112 | netdev_features_t mlx5e_features_check(struct sk_buff *skb, | 1113 | netdev_features_t mlx5e_features_check(struct sk_buff *skb, |
1113 | struct net_device *netdev, | 1114 | struct net_device *netdev, |
1114 | netdev_features_t features); | 1115 | netdev_features_t features); |
1116 | int mlx5e_set_features(struct net_device *netdev, netdev_features_t features); | ||
1115 | #ifdef CONFIG_MLX5_ESWITCH | 1117 | #ifdef CONFIG_MLX5_ESWITCH |
1116 | int mlx5e_set_vf_mac(struct net_device *dev, int vf, u8 *mac); | 1118 | int mlx5e_set_vf_mac(struct net_device *dev, int vf, u8 *mac); |
1117 | int mlx5e_set_vf_rate(struct net_device *dev, int vf, int min_tx_rate, int max_tx_rate); | 1119 | int mlx5e_set_vf_rate(struct net_device *dev, int vf, int min_tx_rate, int max_tx_rate); |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c index fe5d4d7f15ed..231e7cdfc6f7 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c | |||
@@ -11,24 +11,25 @@ static int get_route_and_out_devs(struct mlx5e_priv *priv, | |||
11 | struct net_device **route_dev, | 11 | struct net_device **route_dev, |
12 | struct net_device **out_dev) | 12 | struct net_device **out_dev) |
13 | { | 13 | { |
14 | struct net_device *uplink_dev, *uplink_upper, *real_dev; | ||
14 | struct mlx5_eswitch *esw = priv->mdev->priv.eswitch; | 15 | struct mlx5_eswitch *esw = priv->mdev->priv.eswitch; |
15 | struct net_device *uplink_dev, *uplink_upper; | ||
16 | bool dst_is_lag_dev; | 16 | bool dst_is_lag_dev; |
17 | 17 | ||
18 | real_dev = is_vlan_dev(dev) ? vlan_dev_real_dev(dev) : dev; | ||
18 | uplink_dev = mlx5_eswitch_uplink_get_proto_dev(esw, REP_ETH); | 19 | uplink_dev = mlx5_eswitch_uplink_get_proto_dev(esw, REP_ETH); |
19 | uplink_upper = netdev_master_upper_dev_get(uplink_dev); | 20 | uplink_upper = netdev_master_upper_dev_get(uplink_dev); |
20 | dst_is_lag_dev = (uplink_upper && | 21 | dst_is_lag_dev = (uplink_upper && |
21 | netif_is_lag_master(uplink_upper) && | 22 | netif_is_lag_master(uplink_upper) && |
22 | dev == uplink_upper && | 23 | real_dev == uplink_upper && |
23 | mlx5_lag_is_sriov(priv->mdev)); | 24 | mlx5_lag_is_sriov(priv->mdev)); |
24 | 25 | ||
25 | /* if the egress device isn't on the same HW e-switch or | 26 | /* if the egress device isn't on the same HW e-switch or |
26 | * it's a LAG device, use the uplink | 27 | * it's a LAG device, use the uplink |
27 | */ | 28 | */ |
28 | if (!netdev_port_same_parent_id(priv->netdev, dev) || | 29 | if (!netdev_port_same_parent_id(priv->netdev, real_dev) || |
29 | dst_is_lag_dev) { | 30 | dst_is_lag_dev) { |
30 | *route_dev = uplink_dev; | 31 | *route_dev = dev; |
31 | *out_dev = *route_dev; | 32 | *out_dev = uplink_dev; |
32 | } else { | 33 | } else { |
33 | *route_dev = dev; | 34 | *route_dev = dev; |
34 | if (is_vlan_dev(*route_dev)) | 35 | if (is_vlan_dev(*route_dev)) |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index c65cefd84eda..a8e8350b38aa 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c | |||
@@ -1082,6 +1082,7 @@ static int mlx5e_alloc_txqsq(struct mlx5e_channel *c, | |||
1082 | sq->clock = &mdev->clock; | 1082 | sq->clock = &mdev->clock; |
1083 | sq->mkey_be = c->mkey_be; | 1083 | sq->mkey_be = c->mkey_be; |
1084 | sq->channel = c; | 1084 | sq->channel = c; |
1085 | sq->ch_ix = c->ix; | ||
1085 | sq->txq_ix = txq_ix; | 1086 | sq->txq_ix = txq_ix; |
1086 | sq->uar_map = mdev->mlx5e_res.bfreg.map; | 1087 | sq->uar_map = mdev->mlx5e_res.bfreg.map; |
1087 | sq->min_inline_mode = params->tx_min_inline_mode; | 1088 | sq->min_inline_mode = params->tx_min_inline_mode; |
@@ -3635,8 +3636,7 @@ static int mlx5e_handle_feature(struct net_device *netdev, | |||
3635 | return 0; | 3636 | return 0; |
3636 | } | 3637 | } |
3637 | 3638 | ||
3638 | static int mlx5e_set_features(struct net_device *netdev, | 3639 | int mlx5e_set_features(struct net_device *netdev, netdev_features_t features) |
3639 | netdev_features_t features) | ||
3640 | { | 3640 | { |
3641 | netdev_features_t oper_features = netdev->features; | 3641 | netdev_features_t oper_features = netdev->features; |
3642 | int err = 0; | 3642 | int err = 0; |
@@ -5108,6 +5108,11 @@ static void mlx5e_detach(struct mlx5_core_dev *mdev, void *vpriv) | |||
5108 | struct mlx5e_priv *priv = vpriv; | 5108 | struct mlx5e_priv *priv = vpriv; |
5109 | struct net_device *netdev = priv->netdev; | 5109 | struct net_device *netdev = priv->netdev; |
5110 | 5110 | ||
5111 | #ifdef CONFIG_MLX5_ESWITCH | ||
5112 | if (MLX5_ESWITCH_MANAGER(mdev) && vpriv == mdev) | ||
5113 | return; | ||
5114 | #endif | ||
5115 | |||
5111 | if (!netif_device_present(netdev)) | 5116 | if (!netif_device_present(netdev)) |
5112 | return; | 5117 | return; |
5113 | 5118 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c index 9aea9c5b2ce8..2f406b161bcf 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | |||
@@ -1351,6 +1351,7 @@ static const struct net_device_ops mlx5e_netdev_ops_uplink_rep = { | |||
1351 | .ndo_get_vf_stats = mlx5e_get_vf_stats, | 1351 | .ndo_get_vf_stats = mlx5e_get_vf_stats, |
1352 | .ndo_set_vf_vlan = mlx5e_uplink_rep_set_vf_vlan, | 1352 | .ndo_set_vf_vlan = mlx5e_uplink_rep_set_vf_vlan, |
1353 | .ndo_get_port_parent_id = mlx5e_rep_get_port_parent_id, | 1353 | .ndo_get_port_parent_id = mlx5e_rep_get_port_parent_id, |
1354 | .ndo_set_features = mlx5e_set_features, | ||
1354 | }; | 1355 | }; |
1355 | 1356 | ||
1356 | bool mlx5e_eswitch_rep(struct net_device *netdev) | 1357 | bool mlx5e_eswitch_rep(struct net_device *netdev) |
@@ -1425,10 +1426,9 @@ static void mlx5e_build_rep_netdev(struct net_device *netdev) | |||
1425 | 1426 | ||
1426 | netdev->watchdog_timeo = 15 * HZ; | 1427 | netdev->watchdog_timeo = 15 * HZ; |
1427 | 1428 | ||
1429 | netdev->features |= NETIF_F_NETNS_LOCAL; | ||
1428 | 1430 | ||
1429 | netdev->features |= NETIF_F_HW_TC | NETIF_F_NETNS_LOCAL; | 1431 | netdev->hw_features |= NETIF_F_HW_TC; |
1430 | netdev->hw_features |= NETIF_F_HW_TC; | ||
1431 | |||
1432 | netdev->hw_features |= NETIF_F_SG; | 1432 | netdev->hw_features |= NETIF_F_SG; |
1433 | netdev->hw_features |= NETIF_F_IP_CSUM; | 1433 | netdev->hw_features |= NETIF_F_IP_CSUM; |
1434 | netdev->hw_features |= NETIF_F_IPV6_CSUM; | 1434 | netdev->hw_features |= NETIF_F_IPV6_CSUM; |
@@ -1437,7 +1437,9 @@ static void mlx5e_build_rep_netdev(struct net_device *netdev) | |||
1437 | netdev->hw_features |= NETIF_F_TSO6; | 1437 | netdev->hw_features |= NETIF_F_TSO6; |
1438 | netdev->hw_features |= NETIF_F_RXCSUM; | 1438 | netdev->hw_features |= NETIF_F_RXCSUM; |
1439 | 1439 | ||
1440 | if (rep->vport != MLX5_VPORT_UPLINK) | 1440 | if (rep->vport == MLX5_VPORT_UPLINK) |
1441 | netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_RX; | ||
1442 | else | ||
1441 | netdev->features |= NETIF_F_VLAN_CHALLENGED; | 1443 | netdev->features |= NETIF_F_VLAN_CHALLENGED; |
1442 | 1444 | ||
1443 | netdev->features |= netdev->hw_features; | 1445 | netdev->features |= netdev->hw_features; |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c index 31cd02f11499..e40c60d1631f 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | |||
@@ -2812,9 +2812,6 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, | |||
2812 | if (!flow_action_has_entries(flow_action)) | 2812 | if (!flow_action_has_entries(flow_action)) |
2813 | return -EINVAL; | 2813 | return -EINVAL; |
2814 | 2814 | ||
2815 | attr->in_rep = rpriv->rep; | ||
2816 | attr->in_mdev = priv->mdev; | ||
2817 | |||
2818 | flow_action_for_each(i, act, flow_action) { | 2815 | flow_action_for_each(i, act, flow_action) { |
2819 | switch (act->id) { | 2816 | switch (act->id) { |
2820 | case FLOW_ACTION_DROP: | 2817 | case FLOW_ACTION_DROP: |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c index 195a7d903cec..701e5dc75bb0 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | |||
@@ -113,13 +113,13 @@ static inline int mlx5e_get_dscp_up(struct mlx5e_priv *priv, struct sk_buff *skb | |||
113 | u16 mlx5e_select_queue(struct net_device *dev, struct sk_buff *skb, | 113 | u16 mlx5e_select_queue(struct net_device *dev, struct sk_buff *skb, |
114 | struct net_device *sb_dev) | 114 | struct net_device *sb_dev) |
115 | { | 115 | { |
116 | int channel_ix = netdev_pick_tx(dev, skb, NULL); | 116 | int txq_ix = netdev_pick_tx(dev, skb, NULL); |
117 | struct mlx5e_priv *priv = netdev_priv(dev); | 117 | struct mlx5e_priv *priv = netdev_priv(dev); |
118 | u16 num_channels; | 118 | u16 num_channels; |
119 | int up = 0; | 119 | int up = 0; |
120 | 120 | ||
121 | if (!netdev_get_num_tc(dev)) | 121 | if (!netdev_get_num_tc(dev)) |
122 | return channel_ix; | 122 | return txq_ix; |
123 | 123 | ||
124 | #ifdef CONFIG_MLX5_CORE_EN_DCB | 124 | #ifdef CONFIG_MLX5_CORE_EN_DCB |
125 | if (priv->dcbx_dp.trust_state == MLX5_QPTS_TRUST_DSCP) | 125 | if (priv->dcbx_dp.trust_state == MLX5_QPTS_TRUST_DSCP) |
@@ -129,14 +129,14 @@ u16 mlx5e_select_queue(struct net_device *dev, struct sk_buff *skb, | |||
129 | if (skb_vlan_tag_present(skb)) | 129 | if (skb_vlan_tag_present(skb)) |
130 | up = skb_vlan_tag_get_prio(skb); | 130 | up = skb_vlan_tag_get_prio(skb); |
131 | 131 | ||
132 | /* channel_ix can be larger than num_channels since | 132 | /* txq_ix can be larger than num_channels since |
133 | * dev->num_real_tx_queues = num_channels * num_tc | 133 | * dev->num_real_tx_queues = num_channels * num_tc |
134 | */ | 134 | */ |
135 | num_channels = priv->channels.params.num_channels; | 135 | num_channels = priv->channels.params.num_channels; |
136 | if (channel_ix >= num_channels) | 136 | if (txq_ix >= num_channels) |
137 | channel_ix = reciprocal_scale(channel_ix, num_channels); | 137 | txq_ix = priv->txq2sq[txq_ix]->ch_ix; |
138 | 138 | ||
139 | return priv->channel_tc2txq[channel_ix][up]; | 139 | return priv->channel_tc2txq[txq_ix][up]; |
140 | } | 140 | } |
141 | 141 | ||
142 | static inline int mlx5e_skb_l2_header_offset(struct sk_buff *skb) | 142 | static inline int mlx5e_skb_l2_header_offset(struct sk_buff *skb) |