diff options
author | David S. Miller <davem@davemloft.net> | 2017-03-10 13:03:27 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-03-10 13:03:27 -0500 |
commit | 609a807a95301cec7edb446241a35b402f85b4c3 (patch) | |
tree | 5c4804aa27c132c410a5d8029db4fe7ec6d20c97 | |
parent | 702f2ac87a9a8da23bf8506466bc70175fc970b2 (diff) | |
parent | ea29bd304d7b522f6162a36f394e690c579b5a63 (diff) |
Merge branch 'mlx5-fixes'
Saeed Mahameed says:
====================
Mellanox mlx5 fixes 2017-03-09
This series contains some mlx5 core and ethernet driver fixes.
For -stable:
net/mlx5e: remove IEEE/CEE mode check when setting DCBX mode (for kernel >= 4.10)
net/mlx5e: Avoid wrong identification of rules on deletion (for kernel >= 4.9)
net/mlx5: Don't save PCI state when PCI error is detected (for kernel >= 4.9)
net/mlx5: Fix create autogroup prev initializer (for kernel >=4.9)
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
5 files changed, 28 insertions, 27 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c b/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c index 0523ed47f597..8fa23f6a1f67 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c | |||
@@ -302,6 +302,9 @@ static u8 mlx5e_dcbnl_setdcbx(struct net_device *dev, u8 mode) | |||
302 | struct mlx5e_priv *priv = netdev_priv(dev); | 302 | struct mlx5e_priv *priv = netdev_priv(dev); |
303 | struct mlx5e_dcbx *dcbx = &priv->dcbx; | 303 | struct mlx5e_dcbx *dcbx = &priv->dcbx; |
304 | 304 | ||
305 | if (mode & DCB_CAP_DCBX_LLD_MANAGED) | ||
306 | return 1; | ||
307 | |||
305 | if ((!mode) && MLX5_CAP_GEN(priv->mdev, dcbx)) { | 308 | if ((!mode) && MLX5_CAP_GEN(priv->mdev, dcbx)) { |
306 | if (dcbx->mode == MLX5E_DCBX_PARAM_VER_OPER_AUTO) | 309 | if (dcbx->mode == MLX5E_DCBX_PARAM_VER_OPER_AUTO) |
307 | return 0; | 310 | return 0; |
@@ -315,13 +318,10 @@ static u8 mlx5e_dcbnl_setdcbx(struct net_device *dev, u8 mode) | |||
315 | return 1; | 318 | return 1; |
316 | } | 319 | } |
317 | 320 | ||
318 | if (mlx5e_dcbnl_switch_to_host_mode(netdev_priv(dev))) | 321 | if (!(mode & DCB_CAP_DCBX_HOST)) |
319 | return 1; | 322 | return 1; |
320 | 323 | ||
321 | if ((mode & DCB_CAP_DCBX_LLD_MANAGED) || | 324 | if (mlx5e_dcbnl_switch_to_host_mode(netdev_priv(dev))) |
322 | !(mode & DCB_CAP_DCBX_VER_CEE) || | ||
323 | !(mode & DCB_CAP_DCBX_VER_IEEE) || | ||
324 | !(mode & DCB_CAP_DCBX_HOST)) | ||
325 | return 1; | 325 | return 1; |
326 | 326 | ||
327 | return 0; | 327 | return 0; |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c b/drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c index 31e3cb7ee5fe..5621dcfda4f1 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c | |||
@@ -204,9 +204,6 @@ mlx5e_test_loopback_validate(struct sk_buff *skb, | |||
204 | struct iphdr *iph; | 204 | struct iphdr *iph; |
205 | 205 | ||
206 | /* We are only going to peek, no need to clone the SKB */ | 206 | /* We are only going to peek, no need to clone the SKB */ |
207 | if (skb->protocol != htons(ETH_P_IP)) | ||
208 | goto out; | ||
209 | |||
210 | if (MLX5E_TEST_PKT_SIZE - ETH_HLEN > skb_headlen(skb)) | 207 | if (MLX5E_TEST_PKT_SIZE - ETH_HLEN > skb_headlen(skb)) |
211 | goto out; | 208 | goto out; |
212 | 209 | ||
@@ -249,7 +246,7 @@ static int mlx5e_test_loopback_setup(struct mlx5e_priv *priv, | |||
249 | lbtp->loopback_ok = false; | 246 | lbtp->loopback_ok = false; |
250 | init_completion(&lbtp->comp); | 247 | init_completion(&lbtp->comp); |
251 | 248 | ||
252 | lbtp->pt.type = htons(ETH_P_ALL); | 249 | lbtp->pt.type = htons(ETH_P_IP); |
253 | lbtp->pt.func = mlx5e_test_loopback_validate; | 250 | lbtp->pt.func = mlx5e_test_loopback_validate; |
254 | lbtp->pt.dev = priv->netdev; | 251 | lbtp->pt.dev = priv->netdev; |
255 | lbtp->pt.af_packet_priv = lbtp; | 252 | lbtp->pt.af_packet_priv = lbtp; |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c index 44406a5ec15d..79481f4cf264 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | |||
@@ -48,9 +48,14 @@ | |||
48 | #include "eswitch.h" | 48 | #include "eswitch.h" |
49 | #include "vxlan.h" | 49 | #include "vxlan.h" |
50 | 50 | ||
51 | enum { | ||
52 | MLX5E_TC_FLOW_ESWITCH = BIT(0), | ||
53 | }; | ||
54 | |||
51 | struct mlx5e_tc_flow { | 55 | struct mlx5e_tc_flow { |
52 | struct rhash_head node; | 56 | struct rhash_head node; |
53 | u64 cookie; | 57 | u64 cookie; |
58 | u8 flags; | ||
54 | struct mlx5_flow_handle *rule; | 59 | struct mlx5_flow_handle *rule; |
55 | struct list_head encap; /* flows sharing the same encap */ | 60 | struct list_head encap; /* flows sharing the same encap */ |
56 | struct mlx5_esw_flow_attr *attr; | 61 | struct mlx5_esw_flow_attr *attr; |
@@ -177,7 +182,7 @@ static void mlx5e_tc_del_flow(struct mlx5e_priv *priv, | |||
177 | mlx5_fc_destroy(priv->mdev, counter); | 182 | mlx5_fc_destroy(priv->mdev, counter); |
178 | } | 183 | } |
179 | 184 | ||
180 | if (esw && esw->mode == SRIOV_OFFLOADS) { | 185 | if (flow->flags & MLX5E_TC_FLOW_ESWITCH) { |
181 | mlx5_eswitch_del_vlan_action(esw, flow->attr); | 186 | mlx5_eswitch_del_vlan_action(esw, flow->attr); |
182 | if (flow->attr->action & MLX5_FLOW_CONTEXT_ACTION_ENCAP) | 187 | if (flow->attr->action & MLX5_FLOW_CONTEXT_ACTION_ENCAP) |
183 | mlx5e_detach_encap(priv, flow); | 188 | mlx5e_detach_encap(priv, flow); |
@@ -598,6 +603,7 @@ static int __parse_cls_flower(struct mlx5e_priv *priv, | |||
598 | } | 603 | } |
599 | 604 | ||
600 | static int parse_cls_flower(struct mlx5e_priv *priv, | 605 | static int parse_cls_flower(struct mlx5e_priv *priv, |
606 | struct mlx5e_tc_flow *flow, | ||
601 | struct mlx5_flow_spec *spec, | 607 | struct mlx5_flow_spec *spec, |
602 | struct tc_cls_flower_offload *f) | 608 | struct tc_cls_flower_offload *f) |
603 | { | 609 | { |
@@ -609,7 +615,7 @@ static int parse_cls_flower(struct mlx5e_priv *priv, | |||
609 | 615 | ||
610 | err = __parse_cls_flower(priv, spec, f, &min_inline); | 616 | err = __parse_cls_flower(priv, spec, f, &min_inline); |
611 | 617 | ||
612 | if (!err && esw->mode == SRIOV_OFFLOADS && | 618 | if (!err && (flow->flags & MLX5E_TC_FLOW_ESWITCH) && |
613 | rep->vport != FDB_UPLINK_VPORT) { | 619 | rep->vport != FDB_UPLINK_VPORT) { |
614 | if (min_inline > esw->offloads.inline_mode) { | 620 | if (min_inline > esw->offloads.inline_mode) { |
615 | netdev_warn(priv->netdev, | 621 | netdev_warn(priv->netdev, |
@@ -1132,23 +1138,19 @@ int mlx5e_configure_flower(struct mlx5e_priv *priv, __be16 protocol, | |||
1132 | struct tc_cls_flower_offload *f) | 1138 | struct tc_cls_flower_offload *f) |
1133 | { | 1139 | { |
1134 | struct mlx5e_tc_table *tc = &priv->fs.tc; | 1140 | struct mlx5e_tc_table *tc = &priv->fs.tc; |
1135 | int err = 0; | 1141 | int err, attr_size = 0; |
1136 | bool fdb_flow = false; | ||
1137 | u32 flow_tag, action; | 1142 | u32 flow_tag, action; |
1138 | struct mlx5e_tc_flow *flow; | 1143 | struct mlx5e_tc_flow *flow; |
1139 | struct mlx5_flow_spec *spec; | 1144 | struct mlx5_flow_spec *spec; |
1140 | struct mlx5_eswitch *esw = priv->mdev->priv.eswitch; | 1145 | struct mlx5_eswitch *esw = priv->mdev->priv.eswitch; |
1146 | u8 flow_flags = 0; | ||
1141 | 1147 | ||
1142 | if (esw && esw->mode == SRIOV_OFFLOADS) | 1148 | if (esw && esw->mode == SRIOV_OFFLOADS) { |
1143 | fdb_flow = true; | 1149 | flow_flags = MLX5E_TC_FLOW_ESWITCH; |
1144 | 1150 | attr_size = sizeof(struct mlx5_esw_flow_attr); | |
1145 | if (fdb_flow) | 1151 | } |
1146 | flow = kzalloc(sizeof(*flow) + | ||
1147 | sizeof(struct mlx5_esw_flow_attr), | ||
1148 | GFP_KERNEL); | ||
1149 | else | ||
1150 | flow = kzalloc(sizeof(*flow), GFP_KERNEL); | ||
1151 | 1152 | ||
1153 | flow = kzalloc(sizeof(*flow) + attr_size, GFP_KERNEL); | ||
1152 | spec = mlx5_vzalloc(sizeof(*spec)); | 1154 | spec = mlx5_vzalloc(sizeof(*spec)); |
1153 | if (!spec || !flow) { | 1155 | if (!spec || !flow) { |
1154 | err = -ENOMEM; | 1156 | err = -ENOMEM; |
@@ -1156,12 +1158,13 @@ int mlx5e_configure_flower(struct mlx5e_priv *priv, __be16 protocol, | |||
1156 | } | 1158 | } |
1157 | 1159 | ||
1158 | flow->cookie = f->cookie; | 1160 | flow->cookie = f->cookie; |
1161 | flow->flags = flow_flags; | ||
1159 | 1162 | ||
1160 | err = parse_cls_flower(priv, spec, f); | 1163 | err = parse_cls_flower(priv, flow, spec, f); |
1161 | if (err < 0) | 1164 | if (err < 0) |
1162 | goto err_free; | 1165 | goto err_free; |
1163 | 1166 | ||
1164 | if (fdb_flow) { | 1167 | if (flow->flags & MLX5E_TC_FLOW_ESWITCH) { |
1165 | flow->attr = (struct mlx5_esw_flow_attr *)(flow + 1); | 1168 | flow->attr = (struct mlx5_esw_flow_attr *)(flow + 1); |
1166 | err = parse_tc_fdb_actions(priv, f->exts, flow); | 1169 | err = parse_tc_fdb_actions(priv, f->exts, flow); |
1167 | if (err < 0) | 1170 | if (err < 0) |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c index 2478516a61e2..ded27bb9a3b6 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | |||
@@ -1136,7 +1136,7 @@ static struct mlx5_flow_group *create_autogroup(struct mlx5_flow_table *ft, | |||
1136 | u32 *match_criteria) | 1136 | u32 *match_criteria) |
1137 | { | 1137 | { |
1138 | int inlen = MLX5_ST_SZ_BYTES(create_flow_group_in); | 1138 | int inlen = MLX5_ST_SZ_BYTES(create_flow_group_in); |
1139 | struct list_head *prev = ft->node.children.prev; | 1139 | struct list_head *prev = &ft->node.children; |
1140 | unsigned int candidate_index = 0; | 1140 | unsigned int candidate_index = 0; |
1141 | struct mlx5_flow_group *fg; | 1141 | struct mlx5_flow_group *fg; |
1142 | void *match_criteria_addr; | 1142 | void *match_criteria_addr; |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c index c4242a4e8130..e2bd600d19de 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c | |||
@@ -1352,6 +1352,7 @@ static int init_one(struct pci_dev *pdev, | |||
1352 | if (err) | 1352 | if (err) |
1353 | goto clean_load; | 1353 | goto clean_load; |
1354 | 1354 | ||
1355 | pci_save_state(pdev); | ||
1355 | return 0; | 1356 | return 0; |
1356 | 1357 | ||
1357 | clean_load: | 1358 | clean_load: |
@@ -1407,9 +1408,8 @@ static pci_ers_result_t mlx5_pci_err_detected(struct pci_dev *pdev, | |||
1407 | 1408 | ||
1408 | mlx5_enter_error_state(dev); | 1409 | mlx5_enter_error_state(dev); |
1409 | mlx5_unload_one(dev, priv, false); | 1410 | mlx5_unload_one(dev, priv, false); |
1410 | /* In case of kernel call save the pci state and drain the health wq */ | 1411 | /* In case of kernel call drain the health wq */ |
1411 | if (state) { | 1412 | if (state) { |
1412 | pci_save_state(pdev); | ||
1413 | mlx5_drain_health_wq(dev); | 1413 | mlx5_drain_health_wq(dev); |
1414 | mlx5_pci_disable_device(dev); | 1414 | mlx5_pci_disable_device(dev); |
1415 | } | 1415 | } |
@@ -1461,6 +1461,7 @@ static pci_ers_result_t mlx5_pci_slot_reset(struct pci_dev *pdev) | |||
1461 | 1461 | ||
1462 | pci_set_master(pdev); | 1462 | pci_set_master(pdev); |
1463 | pci_restore_state(pdev); | 1463 | pci_restore_state(pdev); |
1464 | pci_save_state(pdev); | ||
1464 | 1465 | ||
1465 | if (wait_vital(pdev)) { | 1466 | if (wait_vital(pdev)) { |
1466 | dev_err(&pdev->dev, "%s: wait_vital timed out\n", __func__); | 1467 | dev_err(&pdev->dev, "%s: wait_vital timed out\n", __func__); |