Commit 4172eadb authored by David S. Miller's avatar David S. Miller

Merge tag 'mlx5-fixes-2019-06-07' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux

Saeed Mahameed says:

====================
Mellanox, mlx5 fixes 2019-06-07

This series introduces some fixes to mlx5 driver.

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

For -stable v4.17
  ('net/mlx5: Avoid reloading already removed devices')

For -stable v5.0
  ('net/mlx5e: Avoid detaching non-existing netdev under switchdev mode')

For -stable v5.1
  ('net/mlx5e: Fix source port matching in fdb peer flow rule')
  ('net/mlx5e: Support tagged tunnel over bond')
  ('net/mlx5e: Add ndo_set_feature for uplink representor')
  ('net/mlx5: Update pci error handler entries and command translation')
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 62f42a11 45e7d4c0
...@@ -441,6 +441,10 @@ static int mlx5_internal_err_ret_value(struct mlx5_core_dev *dev, u16 op, ...@@ -441,6 +441,10 @@ static int mlx5_internal_err_ret_value(struct mlx5_core_dev *dev, u16 op,
case MLX5_CMD_OP_CREATE_GENERAL_OBJECT: case MLX5_CMD_OP_CREATE_GENERAL_OBJECT:
case MLX5_CMD_OP_MODIFY_GENERAL_OBJECT: case MLX5_CMD_OP_MODIFY_GENERAL_OBJECT:
case MLX5_CMD_OP_QUERY_GENERAL_OBJECT: case MLX5_CMD_OP_QUERY_GENERAL_OBJECT:
case MLX5_CMD_OP_CREATE_UCTX:
case MLX5_CMD_OP_DESTROY_UCTX:
case MLX5_CMD_OP_CREATE_UMEM:
case MLX5_CMD_OP_DESTROY_UMEM:
case MLX5_CMD_OP_ALLOC_MEMIC: case MLX5_CMD_OP_ALLOC_MEMIC:
*status = MLX5_DRIVER_STATUS_ABORTED; *status = MLX5_DRIVER_STATUS_ABORTED;
*synd = MLX5_DRIVER_SYND; *synd = MLX5_DRIVER_SYND;
...@@ -629,6 +633,10 @@ const char *mlx5_command_str(int command) ...@@ -629,6 +633,10 @@ const char *mlx5_command_str(int command)
MLX5_COMMAND_STR_CASE(ALLOC_MEMIC); MLX5_COMMAND_STR_CASE(ALLOC_MEMIC);
MLX5_COMMAND_STR_CASE(DEALLOC_MEMIC); MLX5_COMMAND_STR_CASE(DEALLOC_MEMIC);
MLX5_COMMAND_STR_CASE(QUERY_HOST_PARAMS); MLX5_COMMAND_STR_CASE(QUERY_HOST_PARAMS);
MLX5_COMMAND_STR_CASE(CREATE_UCTX);
MLX5_COMMAND_STR_CASE(DESTROY_UCTX);
MLX5_COMMAND_STR_CASE(CREATE_UMEM);
MLX5_COMMAND_STR_CASE(DESTROY_UMEM);
default: return "unknown command opcode"; default: return "unknown command opcode";
} }
} }
......
...@@ -248,11 +248,32 @@ void mlx5_unregister_interface(struct mlx5_interface *intf) ...@@ -248,11 +248,32 @@ void mlx5_unregister_interface(struct mlx5_interface *intf)
} }
EXPORT_SYMBOL(mlx5_unregister_interface); EXPORT_SYMBOL(mlx5_unregister_interface);
/* Must be called with intf_mutex held */
static bool mlx5_has_added_dev_by_protocol(struct mlx5_core_dev *mdev, int protocol)
{
struct mlx5_device_context *dev_ctx;
struct mlx5_interface *intf;
bool found = false;
list_for_each_entry(intf, &intf_list, list) {
if (intf->protocol == protocol) {
dev_ctx = mlx5_get_device(intf, &mdev->priv);
if (dev_ctx && test_bit(MLX5_INTERFACE_ADDED, &dev_ctx->state))
found = true;
break;
}
}
return found;
}
void mlx5_reload_interface(struct mlx5_core_dev *mdev, int protocol) void mlx5_reload_interface(struct mlx5_core_dev *mdev, int protocol)
{ {
mutex_lock(&mlx5_intf_mutex); mutex_lock(&mlx5_intf_mutex);
mlx5_remove_dev_by_protocol(mdev, protocol); if (mlx5_has_added_dev_by_protocol(mdev, protocol)) {
mlx5_add_dev_by_protocol(mdev, protocol); mlx5_remove_dev_by_protocol(mdev, protocol);
mlx5_add_dev_by_protocol(mdev, protocol);
}
mutex_unlock(&mlx5_intf_mutex); mutex_unlock(&mlx5_intf_mutex);
} }
......
...@@ -385,6 +385,7 @@ struct mlx5e_txqsq { ...@@ -385,6 +385,7 @@ struct mlx5e_txqsq {
/* control path */ /* control path */
struct mlx5_wq_ctrl wq_ctrl; struct mlx5_wq_ctrl wq_ctrl;
struct mlx5e_channel *channel; struct mlx5e_channel *channel;
int ch_ix;
int txq_ix; int txq_ix;
u32 rate_limit; u32 rate_limit;
struct work_struct recover_work; struct work_struct recover_work;
...@@ -1112,6 +1113,7 @@ void mlx5e_del_vxlan_port(struct net_device *netdev, struct udp_tunnel_info *ti) ...@@ -1112,6 +1113,7 @@ void mlx5e_del_vxlan_port(struct net_device *netdev, struct udp_tunnel_info *ti)
netdev_features_t mlx5e_features_check(struct sk_buff *skb, netdev_features_t mlx5e_features_check(struct sk_buff *skb,
struct net_device *netdev, struct net_device *netdev,
netdev_features_t features); netdev_features_t features);
int mlx5e_set_features(struct net_device *netdev, netdev_features_t features);
#ifdef CONFIG_MLX5_ESWITCH #ifdef CONFIG_MLX5_ESWITCH
int mlx5e_set_vf_mac(struct net_device *dev, int vf, u8 *mac); int mlx5e_set_vf_mac(struct net_device *dev, int vf, u8 *mac);
int mlx5e_set_vf_rate(struct net_device *dev, int vf, int min_tx_rate, int max_tx_rate); int mlx5e_set_vf_rate(struct net_device *dev, int vf, int min_tx_rate, int max_tx_rate);
......
...@@ -11,24 +11,25 @@ static int get_route_and_out_devs(struct mlx5e_priv *priv, ...@@ -11,24 +11,25 @@ static int get_route_and_out_devs(struct mlx5e_priv *priv,
struct net_device **route_dev, struct net_device **route_dev,
struct net_device **out_dev) struct net_device **out_dev)
{ {
struct net_device *uplink_dev, *uplink_upper, *real_dev;
struct mlx5_eswitch *esw = priv->mdev->priv.eswitch; struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
struct net_device *uplink_dev, *uplink_upper;
bool dst_is_lag_dev; bool dst_is_lag_dev;
real_dev = is_vlan_dev(dev) ? vlan_dev_real_dev(dev) : dev;
uplink_dev = mlx5_eswitch_uplink_get_proto_dev(esw, REP_ETH); uplink_dev = mlx5_eswitch_uplink_get_proto_dev(esw, REP_ETH);
uplink_upper = netdev_master_upper_dev_get(uplink_dev); uplink_upper = netdev_master_upper_dev_get(uplink_dev);
dst_is_lag_dev = (uplink_upper && dst_is_lag_dev = (uplink_upper &&
netif_is_lag_master(uplink_upper) && netif_is_lag_master(uplink_upper) &&
dev == uplink_upper && real_dev == uplink_upper &&
mlx5_lag_is_sriov(priv->mdev)); mlx5_lag_is_sriov(priv->mdev));
/* if the egress device isn't on the same HW e-switch or /* if the egress device isn't on the same HW e-switch or
* it's a LAG device, use the uplink * it's a LAG device, use the uplink
*/ */
if (!netdev_port_same_parent_id(priv->netdev, dev) || if (!netdev_port_same_parent_id(priv->netdev, real_dev) ||
dst_is_lag_dev) { dst_is_lag_dev) {
*route_dev = uplink_dev; *route_dev = dev;
*out_dev = *route_dev; *out_dev = uplink_dev;
} else { } else {
*route_dev = dev; *route_dev = dev;
if (is_vlan_dev(*route_dev)) if (is_vlan_dev(*route_dev))
......
...@@ -1082,6 +1082,7 @@ static int mlx5e_alloc_txqsq(struct mlx5e_channel *c, ...@@ -1082,6 +1082,7 @@ static int mlx5e_alloc_txqsq(struct mlx5e_channel *c,
sq->clock = &mdev->clock; sq->clock = &mdev->clock;
sq->mkey_be = c->mkey_be; sq->mkey_be = c->mkey_be;
sq->channel = c; sq->channel = c;
sq->ch_ix = c->ix;
sq->txq_ix = txq_ix; sq->txq_ix = txq_ix;
sq->uar_map = mdev->mlx5e_res.bfreg.map; sq->uar_map = mdev->mlx5e_res.bfreg.map;
sq->min_inline_mode = params->tx_min_inline_mode; sq->min_inline_mode = params->tx_min_inline_mode;
...@@ -3635,8 +3636,7 @@ static int mlx5e_handle_feature(struct net_device *netdev, ...@@ -3635,8 +3636,7 @@ static int mlx5e_handle_feature(struct net_device *netdev,
return 0; return 0;
} }
static int mlx5e_set_features(struct net_device *netdev, int mlx5e_set_features(struct net_device *netdev, netdev_features_t features)
netdev_features_t features)
{ {
netdev_features_t oper_features = netdev->features; netdev_features_t oper_features = netdev->features;
int err = 0; int err = 0;
...@@ -5108,6 +5108,11 @@ static void mlx5e_detach(struct mlx5_core_dev *mdev, void *vpriv) ...@@ -5108,6 +5108,11 @@ static void mlx5e_detach(struct mlx5_core_dev *mdev, void *vpriv)
struct mlx5e_priv *priv = vpriv; struct mlx5e_priv *priv = vpriv;
struct net_device *netdev = priv->netdev; struct net_device *netdev = priv->netdev;
#ifdef CONFIG_MLX5_ESWITCH
if (MLX5_ESWITCH_MANAGER(mdev) && vpriv == mdev)
return;
#endif
if (!netif_device_present(netdev)) if (!netif_device_present(netdev))
return; return;
......
...@@ -1351,6 +1351,7 @@ static const struct net_device_ops mlx5e_netdev_ops_uplink_rep = { ...@@ -1351,6 +1351,7 @@ static const struct net_device_ops mlx5e_netdev_ops_uplink_rep = {
.ndo_get_vf_stats = mlx5e_get_vf_stats, .ndo_get_vf_stats = mlx5e_get_vf_stats,
.ndo_set_vf_vlan = mlx5e_uplink_rep_set_vf_vlan, .ndo_set_vf_vlan = mlx5e_uplink_rep_set_vf_vlan,
.ndo_get_port_parent_id = mlx5e_rep_get_port_parent_id, .ndo_get_port_parent_id = mlx5e_rep_get_port_parent_id,
.ndo_set_features = mlx5e_set_features,
}; };
bool mlx5e_eswitch_rep(struct net_device *netdev) bool mlx5e_eswitch_rep(struct net_device *netdev)
...@@ -1425,10 +1426,9 @@ static void mlx5e_build_rep_netdev(struct net_device *netdev) ...@@ -1425,10 +1426,9 @@ static void mlx5e_build_rep_netdev(struct net_device *netdev)
netdev->watchdog_timeo = 15 * HZ; netdev->watchdog_timeo = 15 * HZ;
netdev->features |= NETIF_F_NETNS_LOCAL;
netdev->features |= NETIF_F_HW_TC | NETIF_F_NETNS_LOCAL; netdev->hw_features |= NETIF_F_HW_TC;
netdev->hw_features |= NETIF_F_HW_TC;
netdev->hw_features |= NETIF_F_SG; netdev->hw_features |= NETIF_F_SG;
netdev->hw_features |= NETIF_F_IP_CSUM; netdev->hw_features |= NETIF_F_IP_CSUM;
netdev->hw_features |= NETIF_F_IPV6_CSUM; netdev->hw_features |= NETIF_F_IPV6_CSUM;
...@@ -1437,7 +1437,9 @@ static void mlx5e_build_rep_netdev(struct net_device *netdev) ...@@ -1437,7 +1437,9 @@ static void mlx5e_build_rep_netdev(struct net_device *netdev)
netdev->hw_features |= NETIF_F_TSO6; netdev->hw_features |= NETIF_F_TSO6;
netdev->hw_features |= NETIF_F_RXCSUM; netdev->hw_features |= NETIF_F_RXCSUM;
if (rep->vport != MLX5_VPORT_UPLINK) if (rep->vport == MLX5_VPORT_UPLINK)
netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_RX;
else
netdev->features |= NETIF_F_VLAN_CHALLENGED; netdev->features |= NETIF_F_VLAN_CHALLENGED;
netdev->features |= netdev->hw_features; netdev->features |= netdev->hw_features;
......
...@@ -2812,9 +2812,6 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, ...@@ -2812,9 +2812,6 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv,
if (!flow_action_has_entries(flow_action)) if (!flow_action_has_entries(flow_action))
return -EINVAL; return -EINVAL;
attr->in_rep = rpriv->rep;
attr->in_mdev = priv->mdev;
flow_action_for_each(i, act, flow_action) { flow_action_for_each(i, act, flow_action) {
switch (act->id) { switch (act->id) {
case FLOW_ACTION_DROP: case FLOW_ACTION_DROP:
......
...@@ -113,13 +113,13 @@ static inline int mlx5e_get_dscp_up(struct mlx5e_priv *priv, struct sk_buff *skb ...@@ -113,13 +113,13 @@ static inline int mlx5e_get_dscp_up(struct mlx5e_priv *priv, struct sk_buff *skb
u16 mlx5e_select_queue(struct net_device *dev, struct sk_buff *skb, u16 mlx5e_select_queue(struct net_device *dev, struct sk_buff *skb,
struct net_device *sb_dev) struct net_device *sb_dev)
{ {
int channel_ix = netdev_pick_tx(dev, skb, NULL); int txq_ix = netdev_pick_tx(dev, skb, NULL);
struct mlx5e_priv *priv = netdev_priv(dev); struct mlx5e_priv *priv = netdev_priv(dev);
u16 num_channels; u16 num_channels;
int up = 0; int up = 0;
if (!netdev_get_num_tc(dev)) if (!netdev_get_num_tc(dev))
return channel_ix; return txq_ix;
#ifdef CONFIG_MLX5_CORE_EN_DCB #ifdef CONFIG_MLX5_CORE_EN_DCB
if (priv->dcbx_dp.trust_state == MLX5_QPTS_TRUST_DSCP) if (priv->dcbx_dp.trust_state == MLX5_QPTS_TRUST_DSCP)
...@@ -129,14 +129,14 @@ u16 mlx5e_select_queue(struct net_device *dev, struct sk_buff *skb, ...@@ -129,14 +129,14 @@ u16 mlx5e_select_queue(struct net_device *dev, struct sk_buff *skb,
if (skb_vlan_tag_present(skb)) if (skb_vlan_tag_present(skb))
up = skb_vlan_tag_get_prio(skb); up = skb_vlan_tag_get_prio(skb);
/* channel_ix can be larger than num_channels since /* txq_ix can be larger than num_channels since
* dev->num_real_tx_queues = num_channels * num_tc * dev->num_real_tx_queues = num_channels * num_tc
*/ */
num_channels = priv->channels.params.num_channels; num_channels = priv->channels.params.num_channels;
if (channel_ix >= num_channels) if (txq_ix >= num_channels)
channel_ix = reciprocal_scale(channel_ix, num_channels); txq_ix = priv->txq2sq[txq_ix]->ch_ix;
return priv->channel_tc2txq[channel_ix][up]; return priv->channel_tc2txq[txq_ix][up];
} }
static inline int mlx5e_skb_l2_header_offset(struct sk_buff *skb) static inline int mlx5e_skb_l2_header_offset(struct sk_buff *skb)
......
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