aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2018-03-27 11:41:56 -0400
committerDavid S. Miller <davem@davemloft.net>2018-03-27 11:41:56 -0400
commit2a7fdec98f74cc305c1247cbe67307d504a3223d (patch)
treeca2955992a2edbabc8af9169f2c246f829fe7aa8
parentcd00edc179863848abab5cc5683de5b7b5f70954 (diff)
parenta117f73dc2430443f23e18367fa545981129c1a6 (diff)
Merge tag 'mlx5-fixes-2018-03-23' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux
Saeed Mahameed says: ==================== Mellanox, mlx5 fixes 2018-03-23 The following series includes fixes for mlx5 netdev and eswitch. v1->v2: - Fixed commit message quotation marks in patch #7 For -stable v4.12 ('net/mlx5e: Avoid using the ipv6 stub in the TC offload neigh update path') ('net/mlx5e: Fix traffic being dropped on VF representor') For -stable v4.13 ('net/mlx5e: Fix memory usage issues in offloading TC flows') ('net/mlx5e: Verify coalescing parameters in range') For -stable v4.14 ('net/mlx5e: Don't override vport admin link state in switchdev mode') For -stable v4.15 ('108b2b6d5c02 net/mlx5e: Sync netdev vxlan ports at open') Please pull and let me know if there's any problem. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/Kconfig2
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c17
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_main.c13
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_rep.c34
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_tc.c18
5 files changed, 51 insertions, 33 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/Kconfig b/drivers/net/ethernet/mellanox/mlx5/core/Kconfig
index 25deaa5a534c..c032319f1cb9 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/Kconfig
+++ b/drivers/net/ethernet/mellanox/mlx5/core/Kconfig
@@ -46,7 +46,7 @@ config MLX5_MPFS
46 46
47config MLX5_ESWITCH 47config MLX5_ESWITCH
48 bool "Mellanox Technologies MLX5 SRIOV E-Switch support" 48 bool "Mellanox Technologies MLX5 SRIOV E-Switch support"
49 depends on MLX5_CORE_EN 49 depends on MLX5_CORE_EN && NET_SWITCHDEV
50 default y 50 default y
51 ---help--- 51 ---help---
52 Mellanox Technologies Ethernet SRIOV E-Switch support in ConnectX NIC. 52 Mellanox Technologies Ethernet SRIOV E-Switch support in ConnectX NIC.
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
index cc8048f68f11..59ebfdae6695 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
@@ -477,6 +477,9 @@ static int mlx5e_get_coalesce(struct net_device *netdev,
477 return mlx5e_ethtool_get_coalesce(priv, coal); 477 return mlx5e_ethtool_get_coalesce(priv, coal);
478} 478}
479 479
480#define MLX5E_MAX_COAL_TIME MLX5_MAX_CQ_PERIOD
481#define MLX5E_MAX_COAL_FRAMES MLX5_MAX_CQ_COUNT
482
480static void 483static void
481mlx5e_set_priv_channels_coalesce(struct mlx5e_priv *priv, struct ethtool_coalesce *coal) 484mlx5e_set_priv_channels_coalesce(struct mlx5e_priv *priv, struct ethtool_coalesce *coal)
482{ 485{
@@ -511,6 +514,20 @@ int mlx5e_ethtool_set_coalesce(struct mlx5e_priv *priv,
511 if (!MLX5_CAP_GEN(mdev, cq_moderation)) 514 if (!MLX5_CAP_GEN(mdev, cq_moderation))
512 return -EOPNOTSUPP; 515 return -EOPNOTSUPP;
513 516
517 if (coal->tx_coalesce_usecs > MLX5E_MAX_COAL_TIME ||
518 coal->rx_coalesce_usecs > MLX5E_MAX_COAL_TIME) {
519 netdev_info(priv->netdev, "%s: maximum coalesce time supported is %lu usecs\n",
520 __func__, MLX5E_MAX_COAL_TIME);
521 return -ERANGE;
522 }
523
524 if (coal->tx_max_coalesced_frames > MLX5E_MAX_COAL_FRAMES ||
525 coal->rx_max_coalesced_frames > MLX5E_MAX_COAL_FRAMES) {
526 netdev_info(priv->netdev, "%s: maximum coalesced frames supported is %lu\n",
527 __func__, MLX5E_MAX_COAL_FRAMES);
528 return -ERANGE;
529 }
530
514 mutex_lock(&priv->state_lock); 531 mutex_lock(&priv->state_lock);
515 new_channels.params = priv->channels.params; 532 new_channels.params = priv->channels.params;
516 533
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index da94c8cba5ee..9b4827d36e3e 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -2572,6 +2572,9 @@ int mlx5e_open(struct net_device *netdev)
2572 mlx5_set_port_admin_status(priv->mdev, MLX5_PORT_UP); 2572 mlx5_set_port_admin_status(priv->mdev, MLX5_PORT_UP);
2573 mutex_unlock(&priv->state_lock); 2573 mutex_unlock(&priv->state_lock);
2574 2574
2575 if (mlx5e_vxlan_allowed(priv->mdev))
2576 udp_tunnel_get_rx_info(netdev);
2577
2575 return err; 2578 return err;
2576} 2579}
2577 2580
@@ -4069,7 +4072,7 @@ static void mlx5e_set_netdev_dev_addr(struct net_device *netdev)
4069 } 4072 }
4070} 4073}
4071 4074
4072#if IS_ENABLED(CONFIG_NET_SWITCHDEV) && IS_ENABLED(CONFIG_MLX5_ESWITCH) 4075#if IS_ENABLED(CONFIG_MLX5_ESWITCH)
4073static const struct switchdev_ops mlx5e_switchdev_ops = { 4076static const struct switchdev_ops mlx5e_switchdev_ops = {
4074 .switchdev_port_attr_get = mlx5e_attr_get, 4077 .switchdev_port_attr_get = mlx5e_attr_get,
4075}; 4078};
@@ -4175,7 +4178,7 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev)
4175 4178
4176 mlx5e_set_netdev_dev_addr(netdev); 4179 mlx5e_set_netdev_dev_addr(netdev);
4177 4180
4178#if IS_ENABLED(CONFIG_NET_SWITCHDEV) && IS_ENABLED(CONFIG_MLX5_ESWITCH) 4181#if IS_ENABLED(CONFIG_MLX5_ESWITCH)
4179 if (MLX5_VPORT_MANAGER(mdev)) 4182 if (MLX5_VPORT_MANAGER(mdev))
4180 netdev->switchdev_ops = &mlx5e_switchdev_ops; 4183 netdev->switchdev_ops = &mlx5e_switchdev_ops;
4181#endif 4184#endif
@@ -4327,12 +4330,6 @@ static void mlx5e_nic_enable(struct mlx5e_priv *priv)
4327#ifdef CONFIG_MLX5_CORE_EN_DCB 4330#ifdef CONFIG_MLX5_CORE_EN_DCB
4328 mlx5e_dcbnl_init_app(priv); 4331 mlx5e_dcbnl_init_app(priv);
4329#endif 4332#endif
4330 /* Device already registered: sync netdev system state */
4331 if (mlx5e_vxlan_allowed(mdev)) {
4332 rtnl_lock();
4333 udp_tunnel_get_rx_info(netdev);
4334 rtnl_unlock();
4335 }
4336 4333
4337 queue_work(priv->wq, &priv->set_rx_mode_work); 4334 queue_work(priv->wq, &priv->set_rx_mode_work);
4338 4335
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
index 363d8dcb7f17..500d817d2b0a 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
@@ -44,6 +44,11 @@
44#include "en_tc.h" 44#include "en_tc.h"
45#include "fs_core.h" 45#include "fs_core.h"
46 46
47#define MLX5E_REP_PARAMS_LOG_SQ_SIZE \
48 max(0x6, MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE)
49#define MLX5E_REP_PARAMS_LOG_RQ_SIZE \
50 max(0x6, MLX5E_PARAMS_MINIMUM_LOG_RQ_SIZE)
51
47static const char mlx5e_rep_driver_name[] = "mlx5e_rep"; 52static const char mlx5e_rep_driver_name[] = "mlx5e_rep";
48 53
49static void mlx5e_rep_get_drvinfo(struct net_device *dev, 54static void mlx5e_rep_get_drvinfo(struct net_device *dev,
@@ -209,7 +214,7 @@ static void mlx5e_sqs2vport_stop(struct mlx5_eswitch *esw,
209 214
210static int mlx5e_sqs2vport_start(struct mlx5_eswitch *esw, 215static int mlx5e_sqs2vport_start(struct mlx5_eswitch *esw,
211 struct mlx5_eswitch_rep *rep, 216 struct mlx5_eswitch_rep *rep,
212 u16 *sqns_array, int sqns_num) 217 u32 *sqns_array, int sqns_num)
213{ 218{
214 struct mlx5_flow_handle *flow_rule; 219 struct mlx5_flow_handle *flow_rule;
215 struct mlx5e_rep_priv *rpriv; 220 struct mlx5e_rep_priv *rpriv;
@@ -255,9 +260,9 @@ int mlx5e_add_sqs_fwd_rules(struct mlx5e_priv *priv)
255 struct mlx5e_channel *c; 260 struct mlx5e_channel *c;
256 int n, tc, num_sqs = 0; 261 int n, tc, num_sqs = 0;
257 int err = -ENOMEM; 262 int err = -ENOMEM;
258 u16 *sqs; 263 u32 *sqs;
259 264
260 sqs = kcalloc(priv->channels.num * priv->channels.params.num_tc, sizeof(u16), GFP_KERNEL); 265 sqs = kcalloc(priv->channels.num * priv->channels.params.num_tc, sizeof(*sqs), GFP_KERNEL);
261 if (!sqs) 266 if (!sqs)
262 goto out; 267 goto out;
263 268
@@ -288,7 +293,7 @@ void mlx5e_remove_sqs_fwd_rules(struct mlx5e_priv *priv)
288static void mlx5e_rep_neigh_update_init_interval(struct mlx5e_rep_priv *rpriv) 293static void mlx5e_rep_neigh_update_init_interval(struct mlx5e_rep_priv *rpriv)
289{ 294{
290#if IS_ENABLED(CONFIG_IPV6) 295#if IS_ENABLED(CONFIG_IPV6)
291 unsigned long ipv6_interval = NEIGH_VAR(&ipv6_stub->nd_tbl->parms, 296 unsigned long ipv6_interval = NEIGH_VAR(&nd_tbl.parms,
292 DELAY_PROBE_TIME); 297 DELAY_PROBE_TIME);
293#else 298#else
294 unsigned long ipv6_interval = ~0UL; 299 unsigned long ipv6_interval = ~0UL;
@@ -424,7 +429,7 @@ static int mlx5e_rep_netevent_event(struct notifier_block *nb,
424 case NETEVENT_NEIGH_UPDATE: 429 case NETEVENT_NEIGH_UPDATE:
425 n = ptr; 430 n = ptr;
426#if IS_ENABLED(CONFIG_IPV6) 431#if IS_ENABLED(CONFIG_IPV6)
427 if (n->tbl != ipv6_stub->nd_tbl && n->tbl != &arp_tbl) 432 if (n->tbl != &nd_tbl && n->tbl != &arp_tbl)
428#else 433#else
429 if (n->tbl != &arp_tbl) 434 if (n->tbl != &arp_tbl)
430#endif 435#endif
@@ -472,7 +477,7 @@ static int mlx5e_rep_netevent_event(struct notifier_block *nb,
472 * done per device delay prob time parameter. 477 * done per device delay prob time parameter.
473 */ 478 */
474#if IS_ENABLED(CONFIG_IPV6) 479#if IS_ENABLED(CONFIG_IPV6)
475 if (!p->dev || (p->tbl != ipv6_stub->nd_tbl && p->tbl != &arp_tbl)) 480 if (!p->dev || (p->tbl != &nd_tbl && p->tbl != &arp_tbl))
476#else 481#else
477 if (!p->dev || p->tbl != &arp_tbl) 482 if (!p->dev || p->tbl != &arp_tbl)
478#endif 483#endif
@@ -668,7 +673,6 @@ static int mlx5e_rep_open(struct net_device *dev)
668 struct mlx5e_priv *priv = netdev_priv(dev); 673 struct mlx5e_priv *priv = netdev_priv(dev);
669 struct mlx5e_rep_priv *rpriv = priv->ppriv; 674 struct mlx5e_rep_priv *rpriv = priv->ppriv;
670 struct mlx5_eswitch_rep *rep = rpriv->rep; 675 struct mlx5_eswitch_rep *rep = rpriv->rep;
671 struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
672 int err; 676 int err;
673 677
674 mutex_lock(&priv->state_lock); 678 mutex_lock(&priv->state_lock);
@@ -676,8 +680,9 @@ static int mlx5e_rep_open(struct net_device *dev)
676 if (err) 680 if (err)
677 goto unlock; 681 goto unlock;
678 682
679 if (!mlx5_eswitch_set_vport_state(esw, rep->vport, 683 if (!mlx5_modify_vport_admin_state(priv->mdev,
680 MLX5_ESW_VPORT_ADMIN_STATE_UP)) 684 MLX5_QUERY_VPORT_STATE_IN_OP_MOD_ESW_VPORT,
685 rep->vport, MLX5_ESW_VPORT_ADMIN_STATE_UP))
681 netif_carrier_on(dev); 686 netif_carrier_on(dev);
682 687
683unlock: 688unlock:
@@ -690,11 +695,12 @@ static int mlx5e_rep_close(struct net_device *dev)
690 struct mlx5e_priv *priv = netdev_priv(dev); 695 struct mlx5e_priv *priv = netdev_priv(dev);
691 struct mlx5e_rep_priv *rpriv = priv->ppriv; 696 struct mlx5e_rep_priv *rpriv = priv->ppriv;
692 struct mlx5_eswitch_rep *rep = rpriv->rep; 697 struct mlx5_eswitch_rep *rep = rpriv->rep;
693 struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
694 int ret; 698 int ret;
695 699
696 mutex_lock(&priv->state_lock); 700 mutex_lock(&priv->state_lock);
697 (void)mlx5_eswitch_set_vport_state(esw, rep->vport, MLX5_ESW_VPORT_ADMIN_STATE_DOWN); 701 mlx5_modify_vport_admin_state(priv->mdev,
702 MLX5_QUERY_VPORT_STATE_IN_OP_MOD_ESW_VPORT,
703 rep->vport, MLX5_ESW_VPORT_ADMIN_STATE_DOWN);
698 ret = mlx5e_close_locked(dev); 704 ret = mlx5e_close_locked(dev);
699 mutex_unlock(&priv->state_lock); 705 mutex_unlock(&priv->state_lock);
700 return ret; 706 return ret;
@@ -877,9 +883,9 @@ static void mlx5e_build_rep_params(struct mlx5_core_dev *mdev,
877 MLX5_CQ_PERIOD_MODE_START_FROM_CQE : 883 MLX5_CQ_PERIOD_MODE_START_FROM_CQE :
878 MLX5_CQ_PERIOD_MODE_START_FROM_EQE; 884 MLX5_CQ_PERIOD_MODE_START_FROM_EQE;
879 885
880 params->log_sq_size = MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE; 886 params->log_sq_size = MLX5E_REP_PARAMS_LOG_SQ_SIZE;
881 params->rq_wq_type = MLX5_WQ_TYPE_LINKED_LIST; 887 params->rq_wq_type = MLX5_WQ_TYPE_LINKED_LIST;
882 params->log_rq_size = MLX5E_PARAMS_MINIMUM_LOG_RQ_SIZE; 888 params->log_rq_size = MLX5E_REP_PARAMS_LOG_RQ_SIZE;
883 889
884 params->rx_dim_enabled = MLX5_CAP_GEN(mdev, cq_moderation); 890 params->rx_dim_enabled = MLX5_CAP_GEN(mdev, cq_moderation);
885 mlx5e_set_rx_cq_mode_params(params, cq_period_mode); 891 mlx5e_set_rx_cq_mode_params(params, cq_period_mode);
@@ -899,9 +905,7 @@ static void mlx5e_build_rep_netdev(struct net_device *netdev)
899 905
900 netdev->ethtool_ops = &mlx5e_rep_ethtool_ops; 906 netdev->ethtool_ops = &mlx5e_rep_ethtool_ops;
901 907
902#ifdef CONFIG_NET_SWITCHDEV
903 netdev->switchdev_ops = &mlx5e_rep_switchdev_ops; 908 netdev->switchdev_ops = &mlx5e_rep_switchdev_ops;
904#endif
905 909
906 netdev->features |= NETIF_F_VLAN_CHALLENGED | NETIF_F_HW_TC | NETIF_F_NETNS_LOCAL; 910 netdev->features |= NETIF_F_VLAN_CHALLENGED | NETIF_F_HW_TC | NETIF_F_NETNS_LOCAL;
907 netdev->hw_features |= NETIF_F_HW_TC; 911 netdev->hw_features |= NETIF_F_HW_TC;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index fa86a1466718..43234cabf444 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -963,7 +963,7 @@ void mlx5e_tc_update_neigh_used_value(struct mlx5e_neigh_hash_entry *nhe)
963 tbl = &arp_tbl; 963 tbl = &arp_tbl;
964#if IS_ENABLED(CONFIG_IPV6) 964#if IS_ENABLED(CONFIG_IPV6)
965 else if (m_neigh->family == AF_INET6) 965 else if (m_neigh->family == AF_INET6)
966 tbl = ipv6_stub->nd_tbl; 966 tbl = &nd_tbl;
967#endif 967#endif
968 else 968 else
969 return; 969 return;
@@ -2608,19 +2608,19 @@ int mlx5e_configure_flower(struct mlx5e_priv *priv,
2608 if (err != -EAGAIN) 2608 if (err != -EAGAIN)
2609 flow->flags |= MLX5E_TC_FLOW_OFFLOADED; 2609 flow->flags |= MLX5E_TC_FLOW_OFFLOADED;
2610 2610
2611 if (!(flow->flags & MLX5E_TC_FLOW_ESWITCH) ||
2612 !(flow->esw_attr->action & MLX5_FLOW_CONTEXT_ACTION_ENCAP))
2613 kvfree(parse_attr);
2614
2611 err = rhashtable_insert_fast(&tc->ht, &flow->node, 2615 err = rhashtable_insert_fast(&tc->ht, &flow->node,
2612 tc->ht_params); 2616 tc->ht_params);
2613 if (err) 2617 if (err) {
2614 goto err_del_rule; 2618 mlx5e_tc_del_flow(priv, flow);
2619 kfree(flow);
2620 }
2615 2621
2616 if (flow->flags & MLX5E_TC_FLOW_ESWITCH &&
2617 !(flow->esw_attr->action & MLX5_FLOW_CONTEXT_ACTION_ENCAP))
2618 kvfree(parse_attr);
2619 return err; 2622 return err;
2620 2623
2621err_del_rule:
2622 mlx5e_tc_del_flow(priv, flow);
2623
2624err_free: 2624err_free:
2625 kvfree(parse_attr); 2625 kvfree(parse_attr);
2626 kfree(flow); 2626 kfree(flow);