diff options
author | David S. Miller <davem@davemloft.net> | 2016-04-24 14:51:50 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-04-24 14:51:50 -0400 |
commit | 91e019de2ff85fdcadacacb7623dac7a7c522258 (patch) | |
tree | 21c40ba8cda98f95f20a47f60d9c5d73b0180408 | |
parent | 45c78e0219405af1b0f31b06952dfd9bcf7ad1f6 (diff) | |
parent | 5fc7197d3a256d9c5de3134870304b24892a4908 (diff) |
Merge branch 'mlx5-fixes'
Saeed Mahameed says:
====================
mlx5 driver updates and fixes
Changes from V0:
- Dropped: ("net/mlx5e: Reset link modes upon setting speed to zero")
- Fixed compilation issue introduced to mlx5_ib driver.
- Rebased to df637193906a ('Revert "Prevent NUll pointer dereference with two PHYs on cpsw"')
This series has few bug fixes for mlx5 core and ethernet driver.
Eli fixed a wrong static local variable declaration in flow steering API.
Majd added the support of ConnectX-5 PF and VF and added the support
for kernel shutdown pci callback for more robust reboot procedures.
Maor fixed a soft lockup in flow steering.
Rana fixed a wrog speed define in mlx5 EN driver.
I also had the chance to introduce some bug fixes in mlx5 EN mtu
reporting and handling.
For -stable:
net/mlx5_core: Fix soft lockup in steering error flow
net/mlx5e: Device's mtu field is u16 and not int
net/mlx5e: Fix minimum MTU
net/mlx5e: Use vport MTU rather than physical port MTU
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/infiniband/hw/mlx5/main.c | 4 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/en.h | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 8 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 72 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 48 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/main.c | 25 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/port.c | 10 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/vport.c | 40 | ||||
-rw-r--r-- | include/linux/mlx5/driver.h | 7 | ||||
-rw-r--r-- | include/linux/mlx5/port.h | 6 | ||||
-rw-r--r-- | include/linux/mlx5/vport.h | 2 |
11 files changed, 157 insertions, 67 deletions
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c index 5acf346e048e..99eb1c1a3b7b 100644 --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c | |||
@@ -671,8 +671,8 @@ static int mlx5_query_hca_port(struct ib_device *ibdev, u8 port, | |||
671 | struct mlx5_ib_dev *dev = to_mdev(ibdev); | 671 | struct mlx5_ib_dev *dev = to_mdev(ibdev); |
672 | struct mlx5_core_dev *mdev = dev->mdev; | 672 | struct mlx5_core_dev *mdev = dev->mdev; |
673 | struct mlx5_hca_vport_context *rep; | 673 | struct mlx5_hca_vport_context *rep; |
674 | int max_mtu; | 674 | u16 max_mtu; |
675 | int oper_mtu; | 675 | u16 oper_mtu; |
676 | int err; | 676 | int err; |
677 | u8 ib_link_width_oper; | 677 | u8 ib_link_width_oper; |
678 | u8 vl_hw_cap; | 678 | u8 vl_hw_cap; |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h index 879e6276c473..e80ce94b5dcf 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h | |||
@@ -609,7 +609,7 @@ enum mlx5e_link_mode { | |||
609 | MLX5E_100GBASE_KR4 = 22, | 609 | MLX5E_100GBASE_KR4 = 22, |
610 | MLX5E_100GBASE_LR4 = 23, | 610 | MLX5E_100GBASE_LR4 = 23, |
611 | MLX5E_100BASE_TX = 24, | 611 | MLX5E_100BASE_TX = 24, |
612 | MLX5E_100BASE_T = 25, | 612 | MLX5E_1000BASE_T = 25, |
613 | MLX5E_10GBASE_T = 26, | 613 | MLX5E_10GBASE_T = 26, |
614 | MLX5E_25GBASE_CR = 27, | 614 | MLX5E_25GBASE_CR = 27, |
615 | MLX5E_25GBASE_KR = 28, | 615 | MLX5E_25GBASE_KR = 28, |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c index 68834b715f6c..3476ab844634 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | |||
@@ -138,10 +138,10 @@ static const struct { | |||
138 | [MLX5E_100BASE_TX] = { | 138 | [MLX5E_100BASE_TX] = { |
139 | .speed = 100, | 139 | .speed = 100, |
140 | }, | 140 | }, |
141 | [MLX5E_100BASE_T] = { | 141 | [MLX5E_1000BASE_T] = { |
142 | .supported = SUPPORTED_100baseT_Full, | 142 | .supported = SUPPORTED_1000baseT_Full, |
143 | .advertised = ADVERTISED_100baseT_Full, | 143 | .advertised = ADVERTISED_1000baseT_Full, |
144 | .speed = 100, | 144 | .speed = 1000, |
145 | }, | 145 | }, |
146 | [MLX5E_10GBASE_T] = { | 146 | [MLX5E_10GBASE_T] = { |
147 | .supported = SUPPORTED_10000baseT_Full, | 147 | .supported = SUPPORTED_10000baseT_Full, |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index e0adb604f461..67d548b70e14 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c | |||
@@ -1404,24 +1404,50 @@ static int mlx5e_refresh_tirs_self_loopback_enable(struct mlx5e_priv *priv) | |||
1404 | return 0; | 1404 | return 0; |
1405 | } | 1405 | } |
1406 | 1406 | ||
1407 | static int mlx5e_set_dev_port_mtu(struct net_device *netdev) | 1407 | static int mlx5e_set_mtu(struct mlx5e_priv *priv, u16 mtu) |
1408 | { | 1408 | { |
1409 | struct mlx5e_priv *priv = netdev_priv(netdev); | ||
1410 | struct mlx5_core_dev *mdev = priv->mdev; | 1409 | struct mlx5_core_dev *mdev = priv->mdev; |
1411 | int hw_mtu; | 1410 | u16 hw_mtu = MLX5E_SW2HW_MTU(mtu); |
1412 | int err; | 1411 | int err; |
1413 | 1412 | ||
1414 | err = mlx5_set_port_mtu(mdev, MLX5E_SW2HW_MTU(netdev->mtu), 1); | 1413 | err = mlx5_set_port_mtu(mdev, hw_mtu, 1); |
1415 | if (err) | 1414 | if (err) |
1416 | return err; | 1415 | return err; |
1417 | 1416 | ||
1418 | mlx5_query_port_oper_mtu(mdev, &hw_mtu, 1); | 1417 | /* Update vport context MTU */ |
1418 | mlx5_modify_nic_vport_mtu(mdev, hw_mtu); | ||
1419 | return 0; | ||
1420 | } | ||
1419 | 1421 | ||
1420 | if (MLX5E_HW2SW_MTU(hw_mtu) != netdev->mtu) | 1422 | static void mlx5e_query_mtu(struct mlx5e_priv *priv, u16 *mtu) |
1421 | netdev_warn(netdev, "%s: Port MTU %d is different than netdev mtu %d\n", | 1423 | { |
1422 | __func__, MLX5E_HW2SW_MTU(hw_mtu), netdev->mtu); | 1424 | struct mlx5_core_dev *mdev = priv->mdev; |
1425 | u16 hw_mtu = 0; | ||
1426 | int err; | ||
1423 | 1427 | ||
1424 | netdev->mtu = MLX5E_HW2SW_MTU(hw_mtu); | 1428 | err = mlx5_query_nic_vport_mtu(mdev, &hw_mtu); |
1429 | if (err || !hw_mtu) /* fallback to port oper mtu */ | ||
1430 | mlx5_query_port_oper_mtu(mdev, &hw_mtu, 1); | ||
1431 | |||
1432 | *mtu = MLX5E_HW2SW_MTU(hw_mtu); | ||
1433 | } | ||
1434 | |||
1435 | static int mlx5e_set_dev_port_mtu(struct net_device *netdev) | ||
1436 | { | ||
1437 | struct mlx5e_priv *priv = netdev_priv(netdev); | ||
1438 | u16 mtu; | ||
1439 | int err; | ||
1440 | |||
1441 | err = mlx5e_set_mtu(priv, netdev->mtu); | ||
1442 | if (err) | ||
1443 | return err; | ||
1444 | |||
1445 | mlx5e_query_mtu(priv, &mtu); | ||
1446 | if (mtu != netdev->mtu) | ||
1447 | netdev_warn(netdev, "%s: VPort MTU %d is different than netdev mtu %d\n", | ||
1448 | __func__, mtu, netdev->mtu); | ||
1449 | |||
1450 | netdev->mtu = mtu; | ||
1425 | return 0; | 1451 | return 0; |
1426 | } | 1452 | } |
1427 | 1453 | ||
@@ -1999,22 +2025,27 @@ static int mlx5e_set_features(struct net_device *netdev, | |||
1999 | return err; | 2025 | return err; |
2000 | } | 2026 | } |
2001 | 2027 | ||
2028 | #define MXL5_HW_MIN_MTU 64 | ||
2029 | #define MXL5E_MIN_MTU (MXL5_HW_MIN_MTU + ETH_FCS_LEN) | ||
2030 | |||
2002 | static int mlx5e_change_mtu(struct net_device *netdev, int new_mtu) | 2031 | static int mlx5e_change_mtu(struct net_device *netdev, int new_mtu) |
2003 | { | 2032 | { |
2004 | struct mlx5e_priv *priv = netdev_priv(netdev); | 2033 | struct mlx5e_priv *priv = netdev_priv(netdev); |
2005 | struct mlx5_core_dev *mdev = priv->mdev; | 2034 | struct mlx5_core_dev *mdev = priv->mdev; |
2006 | bool was_opened; | 2035 | bool was_opened; |
2007 | int max_mtu; | 2036 | u16 max_mtu; |
2037 | u16 min_mtu; | ||
2008 | int err = 0; | 2038 | int err = 0; |
2009 | 2039 | ||
2010 | mlx5_query_port_max_mtu(mdev, &max_mtu, 1); | 2040 | mlx5_query_port_max_mtu(mdev, &max_mtu, 1); |
2011 | 2041 | ||
2012 | max_mtu = MLX5E_HW2SW_MTU(max_mtu); | 2042 | max_mtu = MLX5E_HW2SW_MTU(max_mtu); |
2043 | min_mtu = MLX5E_HW2SW_MTU(MXL5E_MIN_MTU); | ||
2013 | 2044 | ||
2014 | if (new_mtu > max_mtu) { | 2045 | if (new_mtu > max_mtu || new_mtu < min_mtu) { |
2015 | netdev_err(netdev, | 2046 | netdev_err(netdev, |
2016 | "%s: Bad MTU (%d) > (%d) Max\n", | 2047 | "%s: Bad MTU (%d), valid range is: [%d..%d]\n", |
2017 | __func__, new_mtu, max_mtu); | 2048 | __func__, new_mtu, min_mtu, max_mtu); |
2018 | return -EINVAL; | 2049 | return -EINVAL; |
2019 | } | 2050 | } |
2020 | 2051 | ||
@@ -2602,7 +2633,16 @@ static void mlx5e_destroy_netdev(struct mlx5_core_dev *mdev, void *vpriv) | |||
2602 | schedule_work(&priv->set_rx_mode_work); | 2633 | schedule_work(&priv->set_rx_mode_work); |
2603 | mlx5e_disable_async_events(priv); | 2634 | mlx5e_disable_async_events(priv); |
2604 | flush_scheduled_work(); | 2635 | flush_scheduled_work(); |
2605 | unregister_netdev(netdev); | 2636 | if (test_bit(MLX5_INTERFACE_STATE_SHUTDOWN, &mdev->intf_state)) { |
2637 | netif_device_detach(netdev); | ||
2638 | mutex_lock(&priv->state_lock); | ||
2639 | if (test_bit(MLX5E_STATE_OPENED, &priv->state)) | ||
2640 | mlx5e_close_locked(netdev); | ||
2641 | mutex_unlock(&priv->state_lock); | ||
2642 | } else { | ||
2643 | unregister_netdev(netdev); | ||
2644 | } | ||
2645 | |||
2606 | mlx5e_tc_cleanup(priv); | 2646 | mlx5e_tc_cleanup(priv); |
2607 | mlx5e_vxlan_cleanup(priv); | 2647 | mlx5e_vxlan_cleanup(priv); |
2608 | mlx5e_destroy_flow_tables(priv); | 2648 | mlx5e_destroy_flow_tables(priv); |
@@ -2615,7 +2655,9 @@ static void mlx5e_destroy_netdev(struct mlx5_core_dev *mdev, void *vpriv) | |||
2615 | mlx5_core_dealloc_transport_domain(priv->mdev, priv->tdn); | 2655 | mlx5_core_dealloc_transport_domain(priv->mdev, priv->tdn); |
2616 | mlx5_core_dealloc_pd(priv->mdev, priv->pdn); | 2656 | mlx5_core_dealloc_pd(priv->mdev, priv->pdn); |
2617 | mlx5_unmap_free_uar(priv->mdev, &priv->cq_uar); | 2657 | mlx5_unmap_free_uar(priv->mdev, &priv->cq_uar); |
2618 | free_netdev(netdev); | 2658 | |
2659 | if (!test_bit(MLX5_INTERFACE_STATE_SHUTDOWN, &mdev->intf_state)) | ||
2660 | free_netdev(netdev); | ||
2619 | } | 2661 | } |
2620 | 2662 | ||
2621 | static void *mlx5e_get_netdev(void *vpriv) | 2663 | static void *mlx5e_get_netdev(void *vpriv) |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c index 5121be4675d1..89cce97d46c6 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | |||
@@ -1065,33 +1065,6 @@ unlock_fg: | |||
1065 | return rule; | 1065 | return rule; |
1066 | } | 1066 | } |
1067 | 1067 | ||
1068 | static struct mlx5_flow_rule *add_rule_to_auto_fg(struct mlx5_flow_table *ft, | ||
1069 | u8 match_criteria_enable, | ||
1070 | u32 *match_criteria, | ||
1071 | u32 *match_value, | ||
1072 | u8 action, | ||
1073 | u32 flow_tag, | ||
1074 | struct mlx5_flow_destination *dest) | ||
1075 | { | ||
1076 | struct mlx5_flow_rule *rule; | ||
1077 | struct mlx5_flow_group *g; | ||
1078 | |||
1079 | g = create_autogroup(ft, match_criteria_enable, match_criteria); | ||
1080 | if (IS_ERR(g)) | ||
1081 | return (void *)g; | ||
1082 | |||
1083 | rule = add_rule_fg(g, match_value, | ||
1084 | action, flow_tag, dest); | ||
1085 | if (IS_ERR(rule)) { | ||
1086 | /* Remove assumes refcount > 0 and autogroup creates a group | ||
1087 | * with a refcount = 0. | ||
1088 | */ | ||
1089 | tree_get_node(&g->node); | ||
1090 | tree_remove_node(&g->node); | ||
1091 | } | ||
1092 | return rule; | ||
1093 | } | ||
1094 | |||
1095 | static struct mlx5_flow_rule * | 1068 | static struct mlx5_flow_rule * |
1096 | _mlx5_add_flow_rule(struct mlx5_flow_table *ft, | 1069 | _mlx5_add_flow_rule(struct mlx5_flow_table *ft, |
1097 | u8 match_criteria_enable, | 1070 | u8 match_criteria_enable, |
@@ -1119,8 +1092,23 @@ _mlx5_add_flow_rule(struct mlx5_flow_table *ft, | |||
1119 | goto unlock; | 1092 | goto unlock; |
1120 | } | 1093 | } |
1121 | 1094 | ||
1122 | rule = add_rule_to_auto_fg(ft, match_criteria_enable, match_criteria, | 1095 | g = create_autogroup(ft, match_criteria_enable, match_criteria); |
1123 | match_value, action, flow_tag, dest); | 1096 | if (IS_ERR(g)) { |
1097 | rule = (void *)g; | ||
1098 | goto unlock; | ||
1099 | } | ||
1100 | |||
1101 | rule = add_rule_fg(g, match_value, | ||
1102 | action, flow_tag, dest); | ||
1103 | if (IS_ERR(rule)) { | ||
1104 | /* Remove assumes refcount > 0 and autogroup creates a group | ||
1105 | * with a refcount = 0. | ||
1106 | */ | ||
1107 | unlock_ref_node(&ft->node); | ||
1108 | tree_get_node(&g->node); | ||
1109 | tree_remove_node(&g->node); | ||
1110 | return rule; | ||
1111 | } | ||
1124 | unlock: | 1112 | unlock: |
1125 | unlock_ref_node(&ft->node); | 1113 | unlock_ref_node(&ft->node); |
1126 | return rule; | 1114 | return rule; |
@@ -1288,7 +1276,7 @@ struct mlx5_flow_namespace *mlx5_get_flow_namespace(struct mlx5_core_dev *dev, | |||
1288 | { | 1276 | { |
1289 | struct mlx5_flow_root_namespace *root_ns = dev->priv.root_ns; | 1277 | struct mlx5_flow_root_namespace *root_ns = dev->priv.root_ns; |
1290 | int prio; | 1278 | int prio; |
1291 | static struct fs_prio *fs_prio; | 1279 | struct fs_prio *fs_prio; |
1292 | struct mlx5_flow_namespace *ns; | 1280 | struct mlx5_flow_namespace *ns; |
1293 | 1281 | ||
1294 | if (!root_ns) | 1282 | if (!root_ns) |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c index 3f3b2fae4991..6892746fd10d 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c | |||
@@ -966,7 +966,7 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv) | |||
966 | int err; | 966 | int err; |
967 | 967 | ||
968 | mutex_lock(&dev->intf_state_mutex); | 968 | mutex_lock(&dev->intf_state_mutex); |
969 | if (dev->interface_state == MLX5_INTERFACE_STATE_UP) { | 969 | if (test_bit(MLX5_INTERFACE_STATE_UP, &dev->intf_state)) { |
970 | dev_warn(&dev->pdev->dev, "%s: interface is up, NOP\n", | 970 | dev_warn(&dev->pdev->dev, "%s: interface is up, NOP\n", |
971 | __func__); | 971 | __func__); |
972 | goto out; | 972 | goto out; |
@@ -1133,7 +1133,8 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv) | |||
1133 | if (err) | 1133 | if (err) |
1134 | pr_info("failed request module on %s\n", MLX5_IB_MOD); | 1134 | pr_info("failed request module on %s\n", MLX5_IB_MOD); |
1135 | 1135 | ||
1136 | dev->interface_state = MLX5_INTERFACE_STATE_UP; | 1136 | clear_bit(MLX5_INTERFACE_STATE_DOWN, &dev->intf_state); |
1137 | set_bit(MLX5_INTERFACE_STATE_UP, &dev->intf_state); | ||
1137 | out: | 1138 | out: |
1138 | mutex_unlock(&dev->intf_state_mutex); | 1139 | mutex_unlock(&dev->intf_state_mutex); |
1139 | 1140 | ||
@@ -1207,7 +1208,7 @@ static int mlx5_unload_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv) | |||
1207 | } | 1208 | } |
1208 | 1209 | ||
1209 | mutex_lock(&dev->intf_state_mutex); | 1210 | mutex_lock(&dev->intf_state_mutex); |
1210 | if (dev->interface_state == MLX5_INTERFACE_STATE_DOWN) { | 1211 | if (test_bit(MLX5_INTERFACE_STATE_DOWN, &dev->intf_state)) { |
1211 | dev_warn(&dev->pdev->dev, "%s: interface is down, NOP\n", | 1212 | dev_warn(&dev->pdev->dev, "%s: interface is down, NOP\n", |
1212 | __func__); | 1213 | __func__); |
1213 | goto out; | 1214 | goto out; |
@@ -1241,7 +1242,8 @@ static int mlx5_unload_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv) | |||
1241 | mlx5_cmd_cleanup(dev); | 1242 | mlx5_cmd_cleanup(dev); |
1242 | 1243 | ||
1243 | out: | 1244 | out: |
1244 | dev->interface_state = MLX5_INTERFACE_STATE_DOWN; | 1245 | clear_bit(MLX5_INTERFACE_STATE_UP, &dev->intf_state); |
1246 | set_bit(MLX5_INTERFACE_STATE_DOWN, &dev->intf_state); | ||
1245 | mutex_unlock(&dev->intf_state_mutex); | 1247 | mutex_unlock(&dev->intf_state_mutex); |
1246 | return err; | 1248 | return err; |
1247 | } | 1249 | } |
@@ -1452,6 +1454,18 @@ static const struct pci_error_handlers mlx5_err_handler = { | |||
1452 | .resume = mlx5_pci_resume | 1454 | .resume = mlx5_pci_resume |
1453 | }; | 1455 | }; |
1454 | 1456 | ||
1457 | static void shutdown(struct pci_dev *pdev) | ||
1458 | { | ||
1459 | struct mlx5_core_dev *dev = pci_get_drvdata(pdev); | ||
1460 | struct mlx5_priv *priv = &dev->priv; | ||
1461 | |||
1462 | dev_info(&pdev->dev, "Shutdown was called\n"); | ||
1463 | /* Notify mlx5 clients that the kernel is being shut down */ | ||
1464 | set_bit(MLX5_INTERFACE_STATE_SHUTDOWN, &dev->intf_state); | ||
1465 | mlx5_unload_one(dev, priv); | ||
1466 | mlx5_pci_disable_device(dev); | ||
1467 | } | ||
1468 | |||
1455 | static const struct pci_device_id mlx5_core_pci_table[] = { | 1469 | static const struct pci_device_id mlx5_core_pci_table[] = { |
1456 | { PCI_VDEVICE(MELLANOX, 0x1011) }, /* Connect-IB */ | 1470 | { PCI_VDEVICE(MELLANOX, 0x1011) }, /* Connect-IB */ |
1457 | { PCI_VDEVICE(MELLANOX, 0x1012), MLX5_PCI_DEV_IS_VF}, /* Connect-IB VF */ | 1471 | { PCI_VDEVICE(MELLANOX, 0x1012), MLX5_PCI_DEV_IS_VF}, /* Connect-IB VF */ |
@@ -1459,6 +1473,8 @@ static const struct pci_device_id mlx5_core_pci_table[] = { | |||
1459 | { PCI_VDEVICE(MELLANOX, 0x1014), MLX5_PCI_DEV_IS_VF}, /* ConnectX-4 VF */ | 1473 | { PCI_VDEVICE(MELLANOX, 0x1014), MLX5_PCI_DEV_IS_VF}, /* ConnectX-4 VF */ |
1460 | { PCI_VDEVICE(MELLANOX, 0x1015) }, /* ConnectX-4LX */ | 1474 | { PCI_VDEVICE(MELLANOX, 0x1015) }, /* ConnectX-4LX */ |
1461 | { PCI_VDEVICE(MELLANOX, 0x1016), MLX5_PCI_DEV_IS_VF}, /* ConnectX-4LX VF */ | 1475 | { PCI_VDEVICE(MELLANOX, 0x1016), MLX5_PCI_DEV_IS_VF}, /* ConnectX-4LX VF */ |
1476 | { PCI_VDEVICE(MELLANOX, 0x1017) }, /* ConnectX-5 */ | ||
1477 | { PCI_VDEVICE(MELLANOX, 0x1018), MLX5_PCI_DEV_IS_VF}, /* ConnectX-5 VF */ | ||
1462 | { 0, } | 1478 | { 0, } |
1463 | }; | 1479 | }; |
1464 | 1480 | ||
@@ -1469,6 +1485,7 @@ static struct pci_driver mlx5_core_driver = { | |||
1469 | .id_table = mlx5_core_pci_table, | 1485 | .id_table = mlx5_core_pci_table, |
1470 | .probe = init_one, | 1486 | .probe = init_one, |
1471 | .remove = remove_one, | 1487 | .remove = remove_one, |
1488 | .shutdown = shutdown, | ||
1472 | .err_handler = &mlx5_err_handler, | 1489 | .err_handler = &mlx5_err_handler, |
1473 | .sriov_configure = mlx5_core_sriov_configure, | 1490 | .sriov_configure = mlx5_core_sriov_configure, |
1474 | }; | 1491 | }; |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/port.c b/drivers/net/ethernet/mellanox/mlx5/core/port.c index ae378c575deb..53cc1e2c693b 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/port.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/port.c | |||
@@ -247,8 +247,8 @@ int mlx5_query_port_admin_status(struct mlx5_core_dev *dev, | |||
247 | } | 247 | } |
248 | EXPORT_SYMBOL_GPL(mlx5_query_port_admin_status); | 248 | EXPORT_SYMBOL_GPL(mlx5_query_port_admin_status); |
249 | 249 | ||
250 | static void mlx5_query_port_mtu(struct mlx5_core_dev *dev, int *admin_mtu, | 250 | static void mlx5_query_port_mtu(struct mlx5_core_dev *dev, u16 *admin_mtu, |
251 | int *max_mtu, int *oper_mtu, u8 port) | 251 | u16 *max_mtu, u16 *oper_mtu, u8 port) |
252 | { | 252 | { |
253 | u32 in[MLX5_ST_SZ_DW(pmtu_reg)]; | 253 | u32 in[MLX5_ST_SZ_DW(pmtu_reg)]; |
254 | u32 out[MLX5_ST_SZ_DW(pmtu_reg)]; | 254 | u32 out[MLX5_ST_SZ_DW(pmtu_reg)]; |
@@ -268,7 +268,7 @@ static void mlx5_query_port_mtu(struct mlx5_core_dev *dev, int *admin_mtu, | |||
268 | *admin_mtu = MLX5_GET(pmtu_reg, out, admin_mtu); | 268 | *admin_mtu = MLX5_GET(pmtu_reg, out, admin_mtu); |
269 | } | 269 | } |
270 | 270 | ||
271 | int mlx5_set_port_mtu(struct mlx5_core_dev *dev, int mtu, u8 port) | 271 | int mlx5_set_port_mtu(struct mlx5_core_dev *dev, u16 mtu, u8 port) |
272 | { | 272 | { |
273 | u32 in[MLX5_ST_SZ_DW(pmtu_reg)]; | 273 | u32 in[MLX5_ST_SZ_DW(pmtu_reg)]; |
274 | u32 out[MLX5_ST_SZ_DW(pmtu_reg)]; | 274 | u32 out[MLX5_ST_SZ_DW(pmtu_reg)]; |
@@ -283,14 +283,14 @@ int mlx5_set_port_mtu(struct mlx5_core_dev *dev, int mtu, u8 port) | |||
283 | } | 283 | } |
284 | EXPORT_SYMBOL_GPL(mlx5_set_port_mtu); | 284 | EXPORT_SYMBOL_GPL(mlx5_set_port_mtu); |
285 | 285 | ||
286 | void mlx5_query_port_max_mtu(struct mlx5_core_dev *dev, int *max_mtu, | 286 | void mlx5_query_port_max_mtu(struct mlx5_core_dev *dev, u16 *max_mtu, |
287 | u8 port) | 287 | u8 port) |
288 | { | 288 | { |
289 | mlx5_query_port_mtu(dev, NULL, max_mtu, NULL, port); | 289 | mlx5_query_port_mtu(dev, NULL, max_mtu, NULL, port); |
290 | } | 290 | } |
291 | EXPORT_SYMBOL_GPL(mlx5_query_port_max_mtu); | 291 | EXPORT_SYMBOL_GPL(mlx5_query_port_max_mtu); |
292 | 292 | ||
293 | void mlx5_query_port_oper_mtu(struct mlx5_core_dev *dev, int *oper_mtu, | 293 | void mlx5_query_port_oper_mtu(struct mlx5_core_dev *dev, u16 *oper_mtu, |
294 | u8 port) | 294 | u8 port) |
295 | { | 295 | { |
296 | mlx5_query_port_mtu(dev, NULL, NULL, oper_mtu, port); | 296 | mlx5_query_port_mtu(dev, NULL, NULL, oper_mtu, port); |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/vport.c b/drivers/net/ethernet/mellanox/mlx5/core/vport.c index bd518405859e..b69dadcfb897 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/vport.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/vport.c | |||
@@ -196,6 +196,46 @@ int mlx5_modify_nic_vport_mac_address(struct mlx5_core_dev *mdev, | |||
196 | } | 196 | } |
197 | EXPORT_SYMBOL_GPL(mlx5_modify_nic_vport_mac_address); | 197 | EXPORT_SYMBOL_GPL(mlx5_modify_nic_vport_mac_address); |
198 | 198 | ||
199 | int mlx5_query_nic_vport_mtu(struct mlx5_core_dev *mdev, u16 *mtu) | ||
200 | { | ||
201 | int outlen = MLX5_ST_SZ_BYTES(query_nic_vport_context_out); | ||
202 | u32 *out; | ||
203 | int err; | ||
204 | |||
205 | out = mlx5_vzalloc(outlen); | ||
206 | if (!out) | ||
207 | return -ENOMEM; | ||
208 | |||
209 | err = mlx5_query_nic_vport_context(mdev, 0, out, outlen); | ||
210 | if (!err) | ||
211 | *mtu = MLX5_GET(query_nic_vport_context_out, out, | ||
212 | nic_vport_context.mtu); | ||
213 | |||
214 | kvfree(out); | ||
215 | return err; | ||
216 | } | ||
217 | EXPORT_SYMBOL_GPL(mlx5_query_nic_vport_mtu); | ||
218 | |||
219 | int mlx5_modify_nic_vport_mtu(struct mlx5_core_dev *mdev, u16 mtu) | ||
220 | { | ||
221 | int inlen = MLX5_ST_SZ_BYTES(modify_nic_vport_context_in); | ||
222 | void *in; | ||
223 | int err; | ||
224 | |||
225 | in = mlx5_vzalloc(inlen); | ||
226 | if (!in) | ||
227 | return -ENOMEM; | ||
228 | |||
229 | MLX5_SET(modify_nic_vport_context_in, in, field_select.mtu, 1); | ||
230 | MLX5_SET(modify_nic_vport_context_in, in, nic_vport_context.mtu, mtu); | ||
231 | |||
232 | err = mlx5_modify_nic_vport_context(mdev, in, inlen); | ||
233 | |||
234 | kvfree(in); | ||
235 | return err; | ||
236 | } | ||
237 | EXPORT_SYMBOL_GPL(mlx5_modify_nic_vport_mtu); | ||
238 | |||
199 | int mlx5_query_nic_vport_mac_list(struct mlx5_core_dev *dev, | 239 | int mlx5_query_nic_vport_mac_list(struct mlx5_core_dev *dev, |
200 | u32 vport, | 240 | u32 vport, |
201 | enum mlx5_list_type list_type, | 241 | enum mlx5_list_type list_type, |
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h index dcd5ac8d3b14..369c837d40f5 100644 --- a/include/linux/mlx5/driver.h +++ b/include/linux/mlx5/driver.h | |||
@@ -519,8 +519,9 @@ enum mlx5_device_state { | |||
519 | }; | 519 | }; |
520 | 520 | ||
521 | enum mlx5_interface_state { | 521 | enum mlx5_interface_state { |
522 | MLX5_INTERFACE_STATE_DOWN, | 522 | MLX5_INTERFACE_STATE_DOWN = BIT(0), |
523 | MLX5_INTERFACE_STATE_UP, | 523 | MLX5_INTERFACE_STATE_UP = BIT(1), |
524 | MLX5_INTERFACE_STATE_SHUTDOWN = BIT(2), | ||
524 | }; | 525 | }; |
525 | 526 | ||
526 | enum mlx5_pci_status { | 527 | enum mlx5_pci_status { |
@@ -544,7 +545,7 @@ struct mlx5_core_dev { | |||
544 | enum mlx5_device_state state; | 545 | enum mlx5_device_state state; |
545 | /* sync interface state */ | 546 | /* sync interface state */ |
546 | struct mutex intf_state_mutex; | 547 | struct mutex intf_state_mutex; |
547 | enum mlx5_interface_state interface_state; | 548 | unsigned long intf_state; |
548 | void (*event) (struct mlx5_core_dev *dev, | 549 | void (*event) (struct mlx5_core_dev *dev, |
549 | enum mlx5_dev_event event, | 550 | enum mlx5_dev_event event, |
550 | unsigned long param); | 551 | unsigned long param); |
diff --git a/include/linux/mlx5/port.h b/include/linux/mlx5/port.h index a1d145abd4eb..b30250ab7604 100644 --- a/include/linux/mlx5/port.h +++ b/include/linux/mlx5/port.h | |||
@@ -54,9 +54,9 @@ int mlx5_set_port_admin_status(struct mlx5_core_dev *dev, | |||
54 | int mlx5_query_port_admin_status(struct mlx5_core_dev *dev, | 54 | int mlx5_query_port_admin_status(struct mlx5_core_dev *dev, |
55 | enum mlx5_port_status *status); | 55 | enum mlx5_port_status *status); |
56 | 56 | ||
57 | int mlx5_set_port_mtu(struct mlx5_core_dev *dev, int mtu, u8 port); | 57 | int mlx5_set_port_mtu(struct mlx5_core_dev *dev, u16 mtu, u8 port); |
58 | void mlx5_query_port_max_mtu(struct mlx5_core_dev *dev, int *max_mtu, u8 port); | 58 | void mlx5_query_port_max_mtu(struct mlx5_core_dev *dev, u16 *max_mtu, u8 port); |
59 | void mlx5_query_port_oper_mtu(struct mlx5_core_dev *dev, int *oper_mtu, | 59 | void mlx5_query_port_oper_mtu(struct mlx5_core_dev *dev, u16 *oper_mtu, |
60 | u8 port); | 60 | u8 port); |
61 | 61 | ||
62 | int mlx5_query_port_vl_hw_cap(struct mlx5_core_dev *dev, | 62 | int mlx5_query_port_vl_hw_cap(struct mlx5_core_dev *dev, |
diff --git a/include/linux/mlx5/vport.h b/include/linux/mlx5/vport.h index bd93e6323603..301da4a5e6bf 100644 --- a/include/linux/mlx5/vport.h +++ b/include/linux/mlx5/vport.h | |||
@@ -45,6 +45,8 @@ int mlx5_query_nic_vport_mac_address(struct mlx5_core_dev *mdev, | |||
45 | u16 vport, u8 *addr); | 45 | u16 vport, u8 *addr); |
46 | int mlx5_modify_nic_vport_mac_address(struct mlx5_core_dev *dev, | 46 | int mlx5_modify_nic_vport_mac_address(struct mlx5_core_dev *dev, |
47 | u16 vport, u8 *addr); | 47 | u16 vport, u8 *addr); |
48 | int mlx5_query_nic_vport_mtu(struct mlx5_core_dev *mdev, u16 *mtu); | ||
49 | int mlx5_modify_nic_vport_mtu(struct mlx5_core_dev *mdev, u16 mtu); | ||
48 | int mlx5_query_nic_vport_system_image_guid(struct mlx5_core_dev *mdev, | 50 | int mlx5_query_nic_vport_system_image_guid(struct mlx5_core_dev *mdev, |
49 | u64 *system_image_guid); | 51 | u64 *system_image_guid); |
50 | int mlx5_query_nic_vport_node_guid(struct mlx5_core_dev *mdev, u64 *node_guid); | 52 | int mlx5_query_nic_vport_node_guid(struct mlx5_core_dev *mdev, u64 *node_guid); |