diff options
author | David S. Miller <davem@davemloft.net> | 2018-08-08 22:34:55 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-08-08 22:34:55 -0400 |
commit | 82b94f5d6891a8e58efdb9b054bdadbbdddec9d9 (patch) | |
tree | cd48df3febdd05b0f84c512c1993797c6f221dc7 | |
parent | 13403d6952a5adf80d3d5668c290490852b4def2 (diff) | |
parent | 269d26f47f6f7d4275b0e225c9ee80cf4a31aa8c (diff) |
Merge branch 'mlx5-next'
Saeed Mahameed says:
====================
Mellanox, mlx5 next updates 2018-08-09
This series includes mlx5 core driver updates and mostly simple
cleanups.
From Denis: Use max #EQs reported by firmware to request MSIX vectors.
From Eli: Trivial cleanups, unused arguments/functions and reduce
command polling interval when command interface is in polling mode.
From Eran: Rename vport state enums, to better reflect their actual
usage.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 12 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 8 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 14 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/main.c | 4 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/vport.c | 12 | ||||
-rw-r--r-- | include/linux/mlx5/device.h | 6 | ||||
-rw-r--r-- | include/linux/mlx5/mlx5_ifc.h | 9 | ||||
-rw-r--r-- | include/linux/mlx5/vport.h | 2 |
10 files changed, 31 insertions, 40 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c index f498c7730c5b..fe4ac40dbade 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c | |||
@@ -211,7 +211,7 @@ static void poll_timeout(struct mlx5_cmd_work_ent *ent) | |||
211 | ent->ret = 0; | 211 | ent->ret = 0; |
212 | return; | 212 | return; |
213 | } | 213 | } |
214 | usleep_range(5000, 10000); | 214 | cond_resched(); |
215 | } while (time_before(jiffies, poll_end)); | 215 | } while (time_before(jiffies, poll_end)); |
216 | 216 | ||
217 | ent->ret = -ETIMEDOUT; | 217 | ent->ret = -ETIMEDOUT; |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index a2fb21ca5767..2731ba2d8049 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c | |||
@@ -228,7 +228,7 @@ static void mlx5e_update_carrier(struct mlx5e_priv *priv) | |||
228 | u8 port_state; | 228 | u8 port_state; |
229 | 229 | ||
230 | port_state = mlx5_query_vport_state(mdev, | 230 | port_state = mlx5_query_vport_state(mdev, |
231 | MLX5_QUERY_VPORT_STATE_IN_OP_MOD_VNIC_VPORT, | 231 | MLX5_VPORT_STATE_OP_MOD_VNIC_VPORT, |
232 | 0); | 232 | 0); |
233 | 233 | ||
234 | if (port_state == VPORT_STATE_UP) { | 234 | if (port_state == VPORT_STATE_UP) { |
@@ -3916,9 +3916,9 @@ static int mlx5e_set_vf_rate(struct net_device *dev, int vf, int min_tx_rate, | |||
3916 | static int mlx5_vport_link2ifla(u8 esw_link) | 3916 | static int mlx5_vport_link2ifla(u8 esw_link) |
3917 | { | 3917 | { |
3918 | switch (esw_link) { | 3918 | switch (esw_link) { |
3919 | case MLX5_ESW_VPORT_ADMIN_STATE_DOWN: | 3919 | case MLX5_VPORT_ADMIN_STATE_DOWN: |
3920 | return IFLA_VF_LINK_STATE_DISABLE; | 3920 | return IFLA_VF_LINK_STATE_DISABLE; |
3921 | case MLX5_ESW_VPORT_ADMIN_STATE_UP: | 3921 | case MLX5_VPORT_ADMIN_STATE_UP: |
3922 | return IFLA_VF_LINK_STATE_ENABLE; | 3922 | return IFLA_VF_LINK_STATE_ENABLE; |
3923 | } | 3923 | } |
3924 | return IFLA_VF_LINK_STATE_AUTO; | 3924 | return IFLA_VF_LINK_STATE_AUTO; |
@@ -3928,11 +3928,11 @@ static int mlx5_ifla_link2vport(u8 ifla_link) | |||
3928 | { | 3928 | { |
3929 | switch (ifla_link) { | 3929 | switch (ifla_link) { |
3930 | case IFLA_VF_LINK_STATE_DISABLE: | 3930 | case IFLA_VF_LINK_STATE_DISABLE: |
3931 | return MLX5_ESW_VPORT_ADMIN_STATE_DOWN; | 3931 | return MLX5_VPORT_ADMIN_STATE_DOWN; |
3932 | case IFLA_VF_LINK_STATE_ENABLE: | 3932 | case IFLA_VF_LINK_STATE_ENABLE: |
3933 | return MLX5_ESW_VPORT_ADMIN_STATE_UP; | 3933 | return MLX5_VPORT_ADMIN_STATE_UP; |
3934 | } | 3934 | } |
3935 | return MLX5_ESW_VPORT_ADMIN_STATE_AUTO; | 3935 | return MLX5_VPORT_ADMIN_STATE_AUTO; |
3936 | } | 3936 | } |
3937 | 3937 | ||
3938 | static int mlx5e_set_vf_link_state(struct net_device *dev, int vf, | 3938 | static int mlx5e_set_vf_link_state(struct net_device *dev, int vf, |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c index 8e3c5b4b90ab..c9cc9747d21d 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | |||
@@ -698,8 +698,8 @@ static int mlx5e_rep_open(struct net_device *dev) | |||
698 | goto unlock; | 698 | goto unlock; |
699 | 699 | ||
700 | if (!mlx5_modify_vport_admin_state(priv->mdev, | 700 | if (!mlx5_modify_vport_admin_state(priv->mdev, |
701 | MLX5_QUERY_VPORT_STATE_IN_OP_MOD_ESW_VPORT, | 701 | MLX5_VPORT_STATE_OP_MOD_ESW_VPORT, |
702 | rep->vport, MLX5_ESW_VPORT_ADMIN_STATE_UP)) | 702 | rep->vport, MLX5_VPORT_ADMIN_STATE_UP)) |
703 | netif_carrier_on(dev); | 703 | netif_carrier_on(dev); |
704 | 704 | ||
705 | unlock: | 705 | unlock: |
@@ -716,8 +716,8 @@ static int mlx5e_rep_close(struct net_device *dev) | |||
716 | 716 | ||
717 | mutex_lock(&priv->state_lock); | 717 | mutex_lock(&priv->state_lock); |
718 | mlx5_modify_vport_admin_state(priv->mdev, | 718 | mlx5_modify_vport_admin_state(priv->mdev, |
719 | MLX5_QUERY_VPORT_STATE_IN_OP_MOD_ESW_VPORT, | 719 | MLX5_VPORT_STATE_OP_MOD_ESW_VPORT, |
720 | rep->vport, MLX5_ESW_VPORT_ADMIN_STATE_DOWN); | 720 | rep->vport, MLX5_VPORT_ADMIN_STATE_DOWN); |
721 | ret = mlx5e_close_locked(dev); | 721 | ret = mlx5e_close_locked(dev); |
722 | mutex_unlock(&priv->state_lock); | 722 | mutex_unlock(&priv->state_lock); |
723 | return ret; | 723 | return ret; |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c b/drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c index 4d316cc9b008..35ded91203f5 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c | |||
@@ -74,7 +74,7 @@ static int mlx5e_test_link_state(struct mlx5e_priv *priv) | |||
74 | if (!netif_carrier_ok(priv->netdev)) | 74 | if (!netif_carrier_ok(priv->netdev)) |
75 | return 1; | 75 | return 1; |
76 | 76 | ||
77 | port_state = mlx5_query_vport_state(priv->mdev, MLX5_QUERY_VPORT_STATE_IN_OP_MOD_VNIC_VPORT, 0); | 77 | port_state = mlx5_query_vport_state(priv->mdev, MLX5_VPORT_STATE_OP_MOD_VNIC_VPORT, 0); |
78 | return port_state == VPORT_STATE_UP ? 0 : 1; | 78 | return port_state == VPORT_STATE_UP ? 0 : 1; |
79 | } | 79 | } |
80 | 80 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c index 40dba9e8af92..2b252cde5cc2 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | |||
@@ -246,7 +246,7 @@ esw_fdb_set_vport_promisc_rule(struct mlx5_eswitch *esw, u32 vport) | |||
246 | return __esw_fdb_set_vport_rule(esw, vport, true, mac_c, mac_v); | 246 | return __esw_fdb_set_vport_rule(esw, vport, true, mac_c, mac_v); |
247 | } | 247 | } |
248 | 248 | ||
249 | static int esw_create_legacy_fdb_table(struct mlx5_eswitch *esw, int nvports) | 249 | static int esw_create_legacy_fdb_table(struct mlx5_eswitch *esw) |
250 | { | 250 | { |
251 | int inlen = MLX5_ST_SZ_BYTES(create_flow_group_in); | 251 | int inlen = MLX5_ST_SZ_BYTES(create_flow_group_in); |
252 | struct mlx5_flow_table_attr ft_attr = {}; | 252 | struct mlx5_flow_table_attr ft_attr = {}; |
@@ -1469,7 +1469,7 @@ static void esw_apply_vport_conf(struct mlx5_eswitch *esw, | |||
1469 | return; | 1469 | return; |
1470 | 1470 | ||
1471 | mlx5_modify_vport_admin_state(esw->dev, | 1471 | mlx5_modify_vport_admin_state(esw->dev, |
1472 | MLX5_QUERY_VPORT_STATE_IN_OP_MOD_ESW_VPORT, | 1472 | MLX5_VPORT_STATE_OP_MOD_ESW_VPORT, |
1473 | vport_num, | 1473 | vport_num, |
1474 | vport->info.link_state); | 1474 | vport->info.link_state); |
1475 | mlx5_modify_nic_vport_mac_address(esw->dev, vport_num, vport->info.mac); | 1475 | mlx5_modify_nic_vport_mac_address(esw->dev, vport_num, vport->info.mac); |
@@ -1582,9 +1582,9 @@ static void esw_disable_vport(struct mlx5_eswitch *esw, int vport_num) | |||
1582 | esw_vport_disable_qos(esw, vport_num); | 1582 | esw_vport_disable_qos(esw, vport_num); |
1583 | if (vport_num && esw->mode == SRIOV_LEGACY) { | 1583 | if (vport_num && esw->mode == SRIOV_LEGACY) { |
1584 | mlx5_modify_vport_admin_state(esw->dev, | 1584 | mlx5_modify_vport_admin_state(esw->dev, |
1585 | MLX5_QUERY_VPORT_STATE_IN_OP_MOD_ESW_VPORT, | 1585 | MLX5_VPORT_STATE_OP_MOD_ESW_VPORT, |
1586 | vport_num, | 1586 | vport_num, |
1587 | MLX5_ESW_VPORT_ADMIN_STATE_DOWN); | 1587 | MLX5_VPORT_ADMIN_STATE_DOWN); |
1588 | esw_vport_disable_egress_acl(esw, vport); | 1588 | esw_vport_disable_egress_acl(esw, vport); |
1589 | esw_vport_disable_ingress_acl(esw, vport); | 1589 | esw_vport_disable_ingress_acl(esw, vport); |
1590 | esw_vport_destroy_drop_counters(vport); | 1590 | esw_vport_destroy_drop_counters(vport); |
@@ -1618,7 +1618,7 @@ int mlx5_eswitch_enable_sriov(struct mlx5_eswitch *esw, int nvfs, int mode) | |||
1618 | esw->mode = mode; | 1618 | esw->mode = mode; |
1619 | 1619 | ||
1620 | if (mode == SRIOV_LEGACY) { | 1620 | if (mode == SRIOV_LEGACY) { |
1621 | err = esw_create_legacy_fdb_table(esw, nvfs + 1); | 1621 | err = esw_create_legacy_fdb_table(esw); |
1622 | } else { | 1622 | } else { |
1623 | mlx5_reload_interface(esw->dev, MLX5_INTERFACE_PROTOCOL_IB); | 1623 | mlx5_reload_interface(esw->dev, MLX5_INTERFACE_PROTOCOL_IB); |
1624 | 1624 | ||
@@ -1736,7 +1736,7 @@ int mlx5_eswitch_init(struct mlx5_core_dev *dev) | |||
1736 | struct mlx5_vport *vport = &esw->vports[vport_num]; | 1736 | struct mlx5_vport *vport = &esw->vports[vport_num]; |
1737 | 1737 | ||
1738 | vport->vport = vport_num; | 1738 | vport->vport = vport_num; |
1739 | vport->info.link_state = MLX5_ESW_VPORT_ADMIN_STATE_AUTO; | 1739 | vport->info.link_state = MLX5_VPORT_ADMIN_STATE_AUTO; |
1740 | vport->dev = dev; | 1740 | vport->dev = dev; |
1741 | INIT_WORK(&vport->vport_change_handler, | 1741 | INIT_WORK(&vport->vport_change_handler, |
1742 | esw_vport_change_handler); | 1742 | esw_vport_change_handler); |
@@ -1860,7 +1860,7 @@ int mlx5_eswitch_set_vport_state(struct mlx5_eswitch *esw, | |||
1860 | evport = &esw->vports[vport]; | 1860 | evport = &esw->vports[vport]; |
1861 | 1861 | ||
1862 | err = mlx5_modify_vport_admin_state(esw->dev, | 1862 | err = mlx5_modify_vport_admin_state(esw->dev, |
1863 | MLX5_QUERY_VPORT_STATE_IN_OP_MOD_ESW_VPORT, | 1863 | MLX5_VPORT_STATE_OP_MOD_ESW_VPORT, |
1864 | vport, link_state); | 1864 | vport, link_state); |
1865 | if (err) { | 1865 | if (err) { |
1866 | mlx5_core_warn(esw->dev, | 1866 | mlx5_core_warn(esw->dev, |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c index 03b9c6733eed..cf3e4a659052 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c | |||
@@ -323,7 +323,9 @@ static int mlx5_alloc_irq_vectors(struct mlx5_core_dev *dev) | |||
323 | { | 323 | { |
324 | struct mlx5_priv *priv = &dev->priv; | 324 | struct mlx5_priv *priv = &dev->priv; |
325 | struct mlx5_eq_table *table = &priv->eq_table; | 325 | struct mlx5_eq_table *table = &priv->eq_table; |
326 | int num_eqs = 1 << MLX5_CAP_GEN(dev, log_max_eq); | 326 | int num_eqs = MLX5_CAP_GEN(dev, max_num_eqs) ? |
327 | MLX5_CAP_GEN(dev, max_num_eqs) : | ||
328 | 1 << MLX5_CAP_GEN(dev, log_max_eq); | ||
327 | int nvec; | 329 | int nvec; |
328 | int err; | 330 | int err; |
329 | 331 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/vport.c b/drivers/net/ethernet/mellanox/mlx5/core/vport.c index 7eecd5b07bb1..b02af317c125 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/vport.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/vport.c | |||
@@ -62,17 +62,6 @@ u8 mlx5_query_vport_state(struct mlx5_core_dev *mdev, u8 opmod, u16 vport) | |||
62 | 62 | ||
63 | return MLX5_GET(query_vport_state_out, out, state); | 63 | return MLX5_GET(query_vport_state_out, out, state); |
64 | } | 64 | } |
65 | EXPORT_SYMBOL_GPL(mlx5_query_vport_state); | ||
66 | |||
67 | u8 mlx5_query_vport_admin_state(struct mlx5_core_dev *mdev, u8 opmod, u16 vport) | ||
68 | { | ||
69 | u32 out[MLX5_ST_SZ_DW(query_vport_state_out)] = {0}; | ||
70 | |||
71 | _mlx5_query_vport_state(mdev, opmod, vport, out, sizeof(out)); | ||
72 | |||
73 | return MLX5_GET(query_vport_state_out, out, admin_state); | ||
74 | } | ||
75 | EXPORT_SYMBOL_GPL(mlx5_query_vport_admin_state); | ||
76 | 65 | ||
77 | int mlx5_modify_vport_admin_state(struct mlx5_core_dev *mdev, u8 opmod, | 66 | int mlx5_modify_vport_admin_state(struct mlx5_core_dev *mdev, u8 opmod, |
78 | u16 vport, u8 state) | 67 | u16 vport, u8 state) |
@@ -90,7 +79,6 @@ int mlx5_modify_vport_admin_state(struct mlx5_core_dev *mdev, u8 opmod, | |||
90 | 79 | ||
91 | return mlx5_cmd_exec(mdev, in, sizeof(in), out, sizeof(out)); | 80 | return mlx5_cmd_exec(mdev, in, sizeof(in), out, sizeof(out)); |
92 | } | 81 | } |
93 | EXPORT_SYMBOL_GPL(mlx5_modify_vport_admin_state); | ||
94 | 82 | ||
95 | static int mlx5_query_nic_vport_context(struct mlx5_core_dev *mdev, u16 vport, | 83 | static int mlx5_query_nic_vport_context(struct mlx5_core_dev *mdev, u16 vport, |
96 | u32 *out, int outlen) | 84 | u32 *out, int outlen) |
diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h index d489494b0a84..11fa4e66afc5 100644 --- a/include/linux/mlx5/device.h +++ b/include/linux/mlx5/device.h | |||
@@ -946,9 +946,9 @@ enum { | |||
946 | }; | 946 | }; |
947 | 947 | ||
948 | enum { | 948 | enum { |
949 | MLX5_ESW_VPORT_ADMIN_STATE_DOWN = 0x0, | 949 | MLX5_VPORT_ADMIN_STATE_DOWN = 0x0, |
950 | MLX5_ESW_VPORT_ADMIN_STATE_UP = 0x1, | 950 | MLX5_VPORT_ADMIN_STATE_UP = 0x1, |
951 | MLX5_ESW_VPORT_ADMIN_STATE_AUTO = 0x2, | 951 | MLX5_VPORT_ADMIN_STATE_AUTO = 0x2, |
952 | }; | 952 | }; |
953 | 953 | ||
954 | enum { | 954 | enum { |
diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h index 60c2308fe062..6ead9c1a5396 100644 --- a/include/linux/mlx5/mlx5_ifc.h +++ b/include/linux/mlx5/mlx5_ifc.h | |||
@@ -1133,7 +1133,10 @@ struct mlx5_ifc_cmd_hca_cap_bits { | |||
1133 | 1133 | ||
1134 | u8 general_obj_types[0x40]; | 1134 | u8 general_obj_types[0x40]; |
1135 | 1135 | ||
1136 | u8 reserved_at_440[0x40]; | 1136 | u8 reserved_at_440[0x20]; |
1137 | |||
1138 | u8 reserved_at_460[0x10]; | ||
1139 | u8 max_num_eqs[0x10]; | ||
1137 | 1140 | ||
1138 | u8 reserved_at_480[0x3]; | 1141 | u8 reserved_at_480[0x3]; |
1139 | u8 log_max_l2_table[0x5]; | 1142 | u8 log_max_l2_table[0x5]; |
@@ -3761,8 +3764,8 @@ struct mlx5_ifc_query_vport_state_out_bits { | |||
3761 | }; | 3764 | }; |
3762 | 3765 | ||
3763 | enum { | 3766 | enum { |
3764 | MLX5_QUERY_VPORT_STATE_IN_OP_MOD_VNIC_VPORT = 0x0, | 3767 | MLX5_VPORT_STATE_OP_MOD_VNIC_VPORT = 0x0, |
3765 | MLX5_QUERY_VPORT_STATE_IN_OP_MOD_ESW_VPORT = 0x1, | 3768 | MLX5_VPORT_STATE_OP_MOD_ESW_VPORT = 0x1, |
3766 | }; | 3769 | }; |
3767 | 3770 | ||
3768 | struct mlx5_ifc_query_vport_state_in_bits { | 3771 | struct mlx5_ifc_query_vport_state_in_bits { |
diff --git a/include/linux/mlx5/vport.h b/include/linux/mlx5/vport.h index 9208cb8809ac..7e7c6dfcfb09 100644 --- a/include/linux/mlx5/vport.h +++ b/include/linux/mlx5/vport.h | |||
@@ -43,8 +43,6 @@ enum { | |||
43 | }; | 43 | }; |
44 | 44 | ||
45 | u8 mlx5_query_vport_state(struct mlx5_core_dev *mdev, u8 opmod, u16 vport); | 45 | u8 mlx5_query_vport_state(struct mlx5_core_dev *mdev, u8 opmod, u16 vport); |
46 | u8 mlx5_query_vport_admin_state(struct mlx5_core_dev *mdev, u8 opmod, | ||
47 | u16 vport); | ||
48 | int mlx5_modify_vport_admin_state(struct mlx5_core_dev *mdev, u8 opmod, | 46 | int mlx5_modify_vport_admin_state(struct mlx5_core_dev *mdev, u8 opmod, |
49 | u16 vport, u8 state); | 47 | u16 vport, u8 state); |
50 | int mlx5_query_nic_vport_mac_address(struct mlx5_core_dev *mdev, | 48 | int mlx5_query_nic_vport_mac_address(struct mlx5_core_dev *mdev, |