Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'mlx5-fixes-2020-04-08' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux

Saeed Mahameed says:

====================
Mellanox, mlx5 fixes 2020-04-08

This series introduces some fixes to mlx5 driver.

Please pull and let me know if there is any problem.

For -stable v5.3
('net/mlx5: Fix frequent ioread PCI access during recovery')
('net/mlx5e: Add missing release firmware call')

For -stable v5.4
('net/mlx5e: Fix nest_level for vlan pop action')
('net/mlx5e: Fix pfnum in devlink port attribute')
====================

Signed-off-by: David S. Miller <davem@davemloft.net>

+26 -32
+4 -1
drivers/net/ethernet/mellanox/mlx5/core/devlink.c
··· 23 23 if (err) 24 24 return err; 25 25 26 - return mlx5_firmware_flash(dev, fw, extack); 26 + err = mlx5_firmware_flash(dev, fw, extack); 27 + release_firmware(fw); 28 + 29 + return err; 27 30 } 28 31 29 32 static u8 mlx5_fw_ver_major(u32 version)
+7 -12
drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
··· 67 67 struct nf_flowtable *nf_ft; 68 68 struct mlx5_tc_ct_priv *ct_priv; 69 69 struct rhashtable ct_entries_ht; 70 - struct list_head ct_entries_list; 71 70 }; 72 71 73 72 struct mlx5_ct_entry { 74 - struct list_head list; 75 73 u16 zone; 76 74 struct rhash_head node; 77 75 struct flow_rule *flow_rule; ··· 615 617 if (err) 616 618 goto err_insert; 617 619 618 - list_add(&entry->list, &ft->ct_entries_list); 619 - 620 620 return 0; 621 621 622 622 err_insert: ··· 642 646 WARN_ON(rhashtable_remove_fast(&ft->ct_entries_ht, 643 647 &entry->node, 644 648 cts_ht_params)); 645 - list_del(&entry->list); 646 649 kfree(entry); 647 650 648 651 return 0; ··· 813 818 ft->zone = zone; 814 819 ft->nf_ft = nf_ft; 815 820 ft->ct_priv = ct_priv; 816 - INIT_LIST_HEAD(&ft->ct_entries_list); 817 821 refcount_set(&ft->refcount, 1); 818 822 819 823 err = rhashtable_init(&ft->ct_entries_ht, &cts_ht_params); ··· 841 847 } 842 848 843 849 static void 844 - mlx5_tc_ct_flush_ft(struct mlx5_tc_ct_priv *ct_priv, struct mlx5_ct_ft *ft) 850 + mlx5_tc_ct_flush_ft_entry(void *ptr, void *arg) 845 851 { 846 - struct mlx5_ct_entry *entry; 852 + struct mlx5_tc_ct_priv *ct_priv = arg; 853 + struct mlx5_ct_entry *entry = ptr; 847 854 848 - list_for_each_entry(entry, &ft->ct_entries_list, list) 849 - mlx5_tc_ct_entry_del_rules(ft->ct_priv, entry); 855 + mlx5_tc_ct_entry_del_rules(ct_priv, entry); 850 856 } 851 857 852 858 static void ··· 857 863 858 864 nf_flow_table_offload_del_cb(ft->nf_ft, 859 865 mlx5_tc_ct_block_flow_offload, ft); 860 - mlx5_tc_ct_flush_ft(ct_priv, ft); 861 866 rhashtable_remove_fast(&ct_priv->zone_ht, &ft->node, zone_params); 862 - rhashtable_destroy(&ft->ct_entries_ht); 867 + rhashtable_free_and_destroy(&ft->ct_entries_ht, 868 + mlx5_tc_ct_flush_ft_entry, 869 + ct_priv); 863 870 kfree(ft); 864 871 } 865 872
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
··· 5526 5526 #ifdef CONFIG_MLX5_CORE_EN_DCB 5527 5527 mlx5e_dcbnl_delete_app(priv); 5528 5528 #endif 5529 - mlx5e_devlink_port_unregister(priv); 5530 5529 unregister_netdev(priv->netdev); 5530 + mlx5e_devlink_port_unregister(priv); 5531 5531 mlx5e_detach(mdev, vpriv); 5532 5532 mlx5e_destroy_netdev(priv); 5533 5533 }
+5 -4
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
··· 2050 2050 struct mlx5_eswitch_rep *rep = rpriv->rep; 2051 2051 struct netdev_phys_item_id ppid = {}; 2052 2052 unsigned int dl_port_index = 0; 2053 + u16 pfnum; 2053 2054 2054 2055 if (!is_devlink_port_supported(dev, rpriv)) 2055 2056 return 0; 2056 2057 2057 2058 mlx5e_rep_get_port_parent_id(rpriv->netdev, &ppid); 2059 + pfnum = PCI_FUNC(dev->pdev->devfn); 2058 2060 2059 2061 if (rep->vport == MLX5_VPORT_UPLINK) { 2060 2062 devlink_port_attrs_set(&rpriv->dl_port, 2061 2063 DEVLINK_PORT_FLAVOUR_PHYSICAL, 2062 - PCI_FUNC(dev->pdev->devfn), false, 0, 2064 + pfnum, false, 0, 2063 2065 &ppid.id[0], ppid.id_len); 2064 2066 dl_port_index = vport_to_devlink_port_index(dev, rep->vport); 2065 2067 } else if (rep->vport == MLX5_VPORT_PF) { 2066 2068 devlink_port_attrs_pci_pf_set(&rpriv->dl_port, 2067 2069 &ppid.id[0], ppid.id_len, 2068 - dev->pdev->devfn); 2070 + pfnum); 2069 2071 dl_port_index = rep->vport; 2070 2072 } else if (mlx5_eswitch_is_vf_vport(dev->priv.eswitch, 2071 2073 rpriv->rep->vport)) { 2072 2074 devlink_port_attrs_pci_vf_set(&rpriv->dl_port, 2073 2075 &ppid.id[0], ppid.id_len, 2074 - dev->pdev->devfn, 2075 - rep->vport - 1); 2076 + pfnum, rep->vport - 1); 2076 2077 dl_port_index = vport_to_devlink_port_index(dev, rep->vport); 2077 2078 } 2078 2079
+5 -3
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
··· 1343 1343 if (err) 1344 1344 return err; 1345 1345 1346 - if (attr->action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR) { 1346 + if (attr->action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR && 1347 + !(attr->ct_attr.ct_action & TCA_CT_ACT_CLEAR)) { 1347 1348 err = mlx5e_attach_mod_hdr(priv, flow, parse_attr); 1348 1349 dealloc_mod_hdr_actions(&parse_attr->mod_hdr_acts); 1349 1350 if (err) ··· 3559 3558 struct mlx5_esw_flow_attr *attr, 3560 3559 u32 *action) 3561 3560 { 3562 - int nest_level = attr->parse_attr->filter_dev->lower_level; 3563 3561 struct flow_action_entry vlan_act = { 3564 3562 .id = FLOW_ACTION_VLAN_POP, 3565 3563 }; 3566 - int err = 0; 3564 + int nest_level, err = 0; 3567 3565 3566 + nest_level = attr->parse_attr->filter_dev->lower_level - 3567 + priv->netdev->lower_level; 3568 3568 while (nest_level--) { 3569 3569 err = parse_tc_vlan_action(priv, &vlan_act, attr, action); 3570 3570 if (err)
-1
drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
··· 403 403 MLX5_ESW_ATTR_FLAG_VLAN_HANDLED = BIT(0), 404 404 MLX5_ESW_ATTR_FLAG_SLOW_PATH = BIT(1), 405 405 MLX5_ESW_ATTR_FLAG_NO_IN_PORT = BIT(2), 406 - MLX5_ESW_ATTR_FLAG_HAIRPIN = BIT(3), 407 406 }; 408 407 409 408 struct mlx5_esw_flow_attr {
+3 -9
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
··· 300 300 bool split = !!(attr->split_count); 301 301 struct mlx5_flow_handle *rule; 302 302 struct mlx5_flow_table *fdb; 303 - bool hairpin = false; 304 303 int j, i = 0; 305 304 306 305 if (esw->mode != MLX5_ESWITCH_OFFLOADS) ··· 397 398 goto err_esw_get; 398 399 } 399 400 400 - if (mlx5_eswitch_termtbl_required(esw, attr, &flow_act, spec)) { 401 + if (mlx5_eswitch_termtbl_required(esw, attr, &flow_act, spec)) 401 402 rule = mlx5_eswitch_add_termtbl_rule(esw, fdb, spec, attr, 402 403 &flow_act, dest, i); 403 - hairpin = true; 404 - } else { 404 + else 405 405 rule = mlx5_add_flow_rules(fdb, spec, &flow_act, dest, i); 406 - } 407 406 if (IS_ERR(rule)) 408 407 goto err_add_rule; 409 408 else 410 409 atomic64_inc(&esw->offloads.num_flows); 411 - 412 - if (hairpin) 413 - attr->flags |= MLX5_ESW_ATTR_FLAG_HAIRPIN; 414 410 415 411 return rule; 416 412 ··· 495 501 496 502 mlx5_del_flow_rules(rule); 497 503 498 - if (attr->flags & MLX5_ESW_ATTR_FLAG_HAIRPIN) { 504 + if (!(attr->flags & MLX5_ESW_ATTR_FLAG_SLOW_PATH)) { 499 505 /* unref the term table */ 500 506 for (i = 0; i < MLX5_MAX_FLOW_FWD_VPORTS; i++) { 501 507 if (attr->dests[i].termtbl)
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/health.c
··· 243 243 if (mlx5_get_nic_state(dev) == MLX5_NIC_IFC_DISABLED) 244 244 break; 245 245 246 - cond_resched(); 246 + msleep(20); 247 247 } while (!time_after(jiffies, end)); 248 248 249 249 if (mlx5_get_nic_state(dev) != MLX5_NIC_IFC_DISABLED) {