Commit 2a7fdec9 authored by David S. Miller's avatar David S. Miller

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: default avatarDavid S. Miller <davem@davemloft.net>
parents cd00edc1 a117f73d
...@@ -46,7 +46,7 @@ config MLX5_MPFS ...@@ -46,7 +46,7 @@ config MLX5_MPFS
config MLX5_ESWITCH config MLX5_ESWITCH
bool "Mellanox Technologies MLX5 SRIOV E-Switch support" bool "Mellanox Technologies MLX5 SRIOV E-Switch support"
depends on MLX5_CORE_EN depends on MLX5_CORE_EN && NET_SWITCHDEV
default y default y
---help--- ---help---
Mellanox Technologies Ethernet SRIOV E-Switch support in ConnectX NIC. Mellanox Technologies Ethernet SRIOV E-Switch support in ConnectX NIC.
......
...@@ -477,6 +477,9 @@ static int mlx5e_get_coalesce(struct net_device *netdev, ...@@ -477,6 +477,9 @@ static int mlx5e_get_coalesce(struct net_device *netdev,
return mlx5e_ethtool_get_coalesce(priv, coal); return mlx5e_ethtool_get_coalesce(priv, coal);
} }
#define MLX5E_MAX_COAL_TIME MLX5_MAX_CQ_PERIOD
#define MLX5E_MAX_COAL_FRAMES MLX5_MAX_CQ_COUNT
static void static void
mlx5e_set_priv_channels_coalesce(struct mlx5e_priv *priv, struct ethtool_coalesce *coal) mlx5e_set_priv_channels_coalesce(struct mlx5e_priv *priv, struct ethtool_coalesce *coal)
{ {
...@@ -511,6 +514,20 @@ int mlx5e_ethtool_set_coalesce(struct mlx5e_priv *priv, ...@@ -511,6 +514,20 @@ int mlx5e_ethtool_set_coalesce(struct mlx5e_priv *priv,
if (!MLX5_CAP_GEN(mdev, cq_moderation)) if (!MLX5_CAP_GEN(mdev, cq_moderation))
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (coal->tx_coalesce_usecs > MLX5E_MAX_COAL_TIME ||
coal->rx_coalesce_usecs > MLX5E_MAX_COAL_TIME) {
netdev_info(priv->netdev, "%s: maximum coalesce time supported is %lu usecs\n",
__func__, MLX5E_MAX_COAL_TIME);
return -ERANGE;
}
if (coal->tx_max_coalesced_frames > MLX5E_MAX_COAL_FRAMES ||
coal->rx_max_coalesced_frames > MLX5E_MAX_COAL_FRAMES) {
netdev_info(priv->netdev, "%s: maximum coalesced frames supported is %lu\n",
__func__, MLX5E_MAX_COAL_FRAMES);
return -ERANGE;
}
mutex_lock(&priv->state_lock); mutex_lock(&priv->state_lock);
new_channels.params = priv->channels.params; new_channels.params = priv->channels.params;
......
...@@ -2572,6 +2572,9 @@ int mlx5e_open(struct net_device *netdev) ...@@ -2572,6 +2572,9 @@ int mlx5e_open(struct net_device *netdev)
mlx5_set_port_admin_status(priv->mdev, MLX5_PORT_UP); mlx5_set_port_admin_status(priv->mdev, MLX5_PORT_UP);
mutex_unlock(&priv->state_lock); mutex_unlock(&priv->state_lock);
if (mlx5e_vxlan_allowed(priv->mdev))
udp_tunnel_get_rx_info(netdev);
return err; return err;
} }
...@@ -4069,7 +4072,7 @@ static void mlx5e_set_netdev_dev_addr(struct net_device *netdev) ...@@ -4069,7 +4072,7 @@ static void mlx5e_set_netdev_dev_addr(struct net_device *netdev)
} }
} }
#if IS_ENABLED(CONFIG_NET_SWITCHDEV) && IS_ENABLED(CONFIG_MLX5_ESWITCH) #if IS_ENABLED(CONFIG_MLX5_ESWITCH)
static const struct switchdev_ops mlx5e_switchdev_ops = { static const struct switchdev_ops mlx5e_switchdev_ops = {
.switchdev_port_attr_get = mlx5e_attr_get, .switchdev_port_attr_get = mlx5e_attr_get,
}; };
...@@ -4175,7 +4178,7 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev) ...@@ -4175,7 +4178,7 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev)
mlx5e_set_netdev_dev_addr(netdev); mlx5e_set_netdev_dev_addr(netdev);
#if IS_ENABLED(CONFIG_NET_SWITCHDEV) && IS_ENABLED(CONFIG_MLX5_ESWITCH) #if IS_ENABLED(CONFIG_MLX5_ESWITCH)
if (MLX5_VPORT_MANAGER(mdev)) if (MLX5_VPORT_MANAGER(mdev))
netdev->switchdev_ops = &mlx5e_switchdev_ops; netdev->switchdev_ops = &mlx5e_switchdev_ops;
#endif #endif
...@@ -4327,12 +4330,6 @@ static void mlx5e_nic_enable(struct mlx5e_priv *priv) ...@@ -4327,12 +4330,6 @@ static void mlx5e_nic_enable(struct mlx5e_priv *priv)
#ifdef CONFIG_MLX5_CORE_EN_DCB #ifdef CONFIG_MLX5_CORE_EN_DCB
mlx5e_dcbnl_init_app(priv); mlx5e_dcbnl_init_app(priv);
#endif #endif
/* Device already registered: sync netdev system state */
if (mlx5e_vxlan_allowed(mdev)) {
rtnl_lock();
udp_tunnel_get_rx_info(netdev);
rtnl_unlock();
}
queue_work(priv->wq, &priv->set_rx_mode_work); queue_work(priv->wq, &priv->set_rx_mode_work);
......
...@@ -44,6 +44,11 @@ ...@@ -44,6 +44,11 @@
#include "en_tc.h" #include "en_tc.h"
#include "fs_core.h" #include "fs_core.h"
#define MLX5E_REP_PARAMS_LOG_SQ_SIZE \
max(0x6, MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE)
#define MLX5E_REP_PARAMS_LOG_RQ_SIZE \
max(0x6, MLX5E_PARAMS_MINIMUM_LOG_RQ_SIZE)
static const char mlx5e_rep_driver_name[] = "mlx5e_rep"; static const char mlx5e_rep_driver_name[] = "mlx5e_rep";
static void mlx5e_rep_get_drvinfo(struct net_device *dev, static void mlx5e_rep_get_drvinfo(struct net_device *dev,
...@@ -209,7 +214,7 @@ static void mlx5e_sqs2vport_stop(struct mlx5_eswitch *esw, ...@@ -209,7 +214,7 @@ static void mlx5e_sqs2vport_stop(struct mlx5_eswitch *esw,
static int mlx5e_sqs2vport_start(struct mlx5_eswitch *esw, static int mlx5e_sqs2vport_start(struct mlx5_eswitch *esw,
struct mlx5_eswitch_rep *rep, struct mlx5_eswitch_rep *rep,
u16 *sqns_array, int sqns_num) u32 *sqns_array, int sqns_num)
{ {
struct mlx5_flow_handle *flow_rule; struct mlx5_flow_handle *flow_rule;
struct mlx5e_rep_priv *rpriv; struct mlx5e_rep_priv *rpriv;
...@@ -255,9 +260,9 @@ int mlx5e_add_sqs_fwd_rules(struct mlx5e_priv *priv) ...@@ -255,9 +260,9 @@ int mlx5e_add_sqs_fwd_rules(struct mlx5e_priv *priv)
struct mlx5e_channel *c; struct mlx5e_channel *c;
int n, tc, num_sqs = 0; int n, tc, num_sqs = 0;
int err = -ENOMEM; int err = -ENOMEM;
u16 *sqs; u32 *sqs;
sqs = kcalloc(priv->channels.num * priv->channels.params.num_tc, sizeof(u16), GFP_KERNEL); sqs = kcalloc(priv->channels.num * priv->channels.params.num_tc, sizeof(*sqs), GFP_KERNEL);
if (!sqs) if (!sqs)
goto out; goto out;
...@@ -288,7 +293,7 @@ void mlx5e_remove_sqs_fwd_rules(struct mlx5e_priv *priv) ...@@ -288,7 +293,7 @@ void mlx5e_remove_sqs_fwd_rules(struct mlx5e_priv *priv)
static void mlx5e_rep_neigh_update_init_interval(struct mlx5e_rep_priv *rpriv) static void mlx5e_rep_neigh_update_init_interval(struct mlx5e_rep_priv *rpriv)
{ {
#if IS_ENABLED(CONFIG_IPV6) #if IS_ENABLED(CONFIG_IPV6)
unsigned long ipv6_interval = NEIGH_VAR(&ipv6_stub->nd_tbl->parms, unsigned long ipv6_interval = NEIGH_VAR(&nd_tbl.parms,
DELAY_PROBE_TIME); DELAY_PROBE_TIME);
#else #else
unsigned long ipv6_interval = ~0UL; unsigned long ipv6_interval = ~0UL;
...@@ -424,7 +429,7 @@ static int mlx5e_rep_netevent_event(struct notifier_block *nb, ...@@ -424,7 +429,7 @@ static int mlx5e_rep_netevent_event(struct notifier_block *nb,
case NETEVENT_NEIGH_UPDATE: case NETEVENT_NEIGH_UPDATE:
n = ptr; n = ptr;
#if IS_ENABLED(CONFIG_IPV6) #if IS_ENABLED(CONFIG_IPV6)
if (n->tbl != ipv6_stub->nd_tbl && n->tbl != &arp_tbl) if (n->tbl != &nd_tbl && n->tbl != &arp_tbl)
#else #else
if (n->tbl != &arp_tbl) if (n->tbl != &arp_tbl)
#endif #endif
...@@ -472,7 +477,7 @@ static int mlx5e_rep_netevent_event(struct notifier_block *nb, ...@@ -472,7 +477,7 @@ static int mlx5e_rep_netevent_event(struct notifier_block *nb,
* done per device delay prob time parameter. * done per device delay prob time parameter.
*/ */
#if IS_ENABLED(CONFIG_IPV6) #if IS_ENABLED(CONFIG_IPV6)
if (!p->dev || (p->tbl != ipv6_stub->nd_tbl && p->tbl != &arp_tbl)) if (!p->dev || (p->tbl != &nd_tbl && p->tbl != &arp_tbl))
#else #else
if (!p->dev || p->tbl != &arp_tbl) if (!p->dev || p->tbl != &arp_tbl)
#endif #endif
...@@ -668,7 +673,6 @@ static int mlx5e_rep_open(struct net_device *dev) ...@@ -668,7 +673,6 @@ static int mlx5e_rep_open(struct net_device *dev)
struct mlx5e_priv *priv = netdev_priv(dev); struct mlx5e_priv *priv = netdev_priv(dev);
struct mlx5e_rep_priv *rpriv = priv->ppriv; struct mlx5e_rep_priv *rpriv = priv->ppriv;
struct mlx5_eswitch_rep *rep = rpriv->rep; struct mlx5_eswitch_rep *rep = rpriv->rep;
struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
int err; int err;
mutex_lock(&priv->state_lock); mutex_lock(&priv->state_lock);
...@@ -676,8 +680,9 @@ static int mlx5e_rep_open(struct net_device *dev) ...@@ -676,8 +680,9 @@ static int mlx5e_rep_open(struct net_device *dev)
if (err) if (err)
goto unlock; goto unlock;
if (!mlx5_eswitch_set_vport_state(esw, rep->vport, if (!mlx5_modify_vport_admin_state(priv->mdev,
MLX5_ESW_VPORT_ADMIN_STATE_UP)) MLX5_QUERY_VPORT_STATE_IN_OP_MOD_ESW_VPORT,
rep->vport, MLX5_ESW_VPORT_ADMIN_STATE_UP))
netif_carrier_on(dev); netif_carrier_on(dev);
unlock: unlock:
...@@ -690,11 +695,12 @@ static int mlx5e_rep_close(struct net_device *dev) ...@@ -690,11 +695,12 @@ static int mlx5e_rep_close(struct net_device *dev)
struct mlx5e_priv *priv = netdev_priv(dev); struct mlx5e_priv *priv = netdev_priv(dev);
struct mlx5e_rep_priv *rpriv = priv->ppriv; struct mlx5e_rep_priv *rpriv = priv->ppriv;
struct mlx5_eswitch_rep *rep = rpriv->rep; struct mlx5_eswitch_rep *rep = rpriv->rep;
struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
int ret; int ret;
mutex_lock(&priv->state_lock); mutex_lock(&priv->state_lock);
(void)mlx5_eswitch_set_vport_state(esw, rep->vport, MLX5_ESW_VPORT_ADMIN_STATE_DOWN); mlx5_modify_vport_admin_state(priv->mdev,
MLX5_QUERY_VPORT_STATE_IN_OP_MOD_ESW_VPORT,
rep->vport, MLX5_ESW_VPORT_ADMIN_STATE_DOWN);
ret = mlx5e_close_locked(dev); ret = mlx5e_close_locked(dev);
mutex_unlock(&priv->state_lock); mutex_unlock(&priv->state_lock);
return ret; return ret;
...@@ -877,9 +883,9 @@ static void mlx5e_build_rep_params(struct mlx5_core_dev *mdev, ...@@ -877,9 +883,9 @@ static void mlx5e_build_rep_params(struct mlx5_core_dev *mdev,
MLX5_CQ_PERIOD_MODE_START_FROM_CQE : MLX5_CQ_PERIOD_MODE_START_FROM_CQE :
MLX5_CQ_PERIOD_MODE_START_FROM_EQE; MLX5_CQ_PERIOD_MODE_START_FROM_EQE;
params->log_sq_size = MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE; params->log_sq_size = MLX5E_REP_PARAMS_LOG_SQ_SIZE;
params->rq_wq_type = MLX5_WQ_TYPE_LINKED_LIST; params->rq_wq_type = MLX5_WQ_TYPE_LINKED_LIST;
params->log_rq_size = MLX5E_PARAMS_MINIMUM_LOG_RQ_SIZE; params->log_rq_size = MLX5E_REP_PARAMS_LOG_RQ_SIZE;
params->rx_dim_enabled = MLX5_CAP_GEN(mdev, cq_moderation); params->rx_dim_enabled = MLX5_CAP_GEN(mdev, cq_moderation);
mlx5e_set_rx_cq_mode_params(params, cq_period_mode); 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,9 +905,7 @@ static void mlx5e_build_rep_netdev(struct net_device *netdev)
netdev->ethtool_ops = &mlx5e_rep_ethtool_ops; netdev->ethtool_ops = &mlx5e_rep_ethtool_ops;
#ifdef CONFIG_NET_SWITCHDEV
netdev->switchdev_ops = &mlx5e_rep_switchdev_ops; netdev->switchdev_ops = &mlx5e_rep_switchdev_ops;
#endif
netdev->features |= NETIF_F_VLAN_CHALLENGED | NETIF_F_HW_TC | NETIF_F_NETNS_LOCAL; netdev->features |= NETIF_F_VLAN_CHALLENGED | NETIF_F_HW_TC | NETIF_F_NETNS_LOCAL;
netdev->hw_features |= NETIF_F_HW_TC; netdev->hw_features |= NETIF_F_HW_TC;
......
...@@ -963,7 +963,7 @@ void mlx5e_tc_update_neigh_used_value(struct mlx5e_neigh_hash_entry *nhe) ...@@ -963,7 +963,7 @@ void mlx5e_tc_update_neigh_used_value(struct mlx5e_neigh_hash_entry *nhe)
tbl = &arp_tbl; tbl = &arp_tbl;
#if IS_ENABLED(CONFIG_IPV6) #if IS_ENABLED(CONFIG_IPV6)
else if (m_neigh->family == AF_INET6) else if (m_neigh->family == AF_INET6)
tbl = ipv6_stub->nd_tbl; tbl = &nd_tbl;
#endif #endif
else else
return; return;
...@@ -2608,19 +2608,19 @@ int mlx5e_configure_flower(struct mlx5e_priv *priv, ...@@ -2608,19 +2608,19 @@ int mlx5e_configure_flower(struct mlx5e_priv *priv,
if (err != -EAGAIN) if (err != -EAGAIN)
flow->flags |= MLX5E_TC_FLOW_OFFLOADED; flow->flags |= MLX5E_TC_FLOW_OFFLOADED;
if (!(flow->flags & MLX5E_TC_FLOW_ESWITCH) ||
!(flow->esw_attr->action & MLX5_FLOW_CONTEXT_ACTION_ENCAP))
kvfree(parse_attr);
err = rhashtable_insert_fast(&tc->ht, &flow->node, err = rhashtable_insert_fast(&tc->ht, &flow->node,
tc->ht_params); tc->ht_params);
if (err) if (err) {
goto err_del_rule; mlx5e_tc_del_flow(priv, flow);
kfree(flow);
}
if (flow->flags & MLX5E_TC_FLOW_ESWITCH &&
!(flow->esw_attr->action & MLX5_FLOW_CONTEXT_ACTION_ENCAP))
kvfree(parse_attr);
return err; return err;
err_del_rule:
mlx5e_tc_del_flow(priv, flow);
err_free: err_free:
kvfree(parse_attr); kvfree(parse_attr);
kfree(flow); kfree(flow);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment