Commit f2b122d3 authored by David S. Miller's avatar David S. Miller

Merge tag 'mlx5-fixes-2020-05-28' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux

Saeed Mahameed says:

====================
mlx5 fixes 2020-05-28

This series introduces some fixes to mlx5 driver.

v1->v2:
 - Fix bad sha1, Jakub.
 - Added one more patch by Pablo.
   net/mlx5e: replace EINVAL in mlx5e_flower_parse_meta()

Nothing major, the only patch worth mentioning is the suspend/resume crash
fix by adding the missing pci device handlers, the fix is very straight
forward and as Dexuan already expressed, the patch is important for Azure
users to avoid crash on VM hibernation, patch is marked for -stable v4.6
below.

Conflict note:
('net/mlx5e: Fix MLX5_TC_CT dependencies') has a trivial one line conflict
with current net-next, which can be resolved by simply using the line from
net-next.

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

For -stable v4.6
 ('net/mlx5: Fix crash upon suspend/resume')

For -stable v5.6
 ('net/mlx5e: replace EINVAL in mlx5e_flower_parse_meta()')
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents f9e0ce3d a683012a
...@@ -80,7 +80,7 @@ config MLX5_ESWITCH ...@@ -80,7 +80,7 @@ config MLX5_ESWITCH
config MLX5_TC_CT config MLX5_TC_CT
bool "MLX5 TC connection tracking offload support" bool "MLX5 TC connection tracking offload support"
depends on MLX5_CORE_EN && NET_SWITCHDEV && NF_FLOW_TABLE && NET_ACT_CT && NET_TC_SKB_EXT depends on MLX5_ESWITCH && NF_FLOW_TABLE && NET_ACT_CT && NET_TC_SKB_EXT
default y default y
help help
Say Y here if you want to support offloading connection tracking rules Say Y here if you want to support offloading connection tracking rules
......
...@@ -1068,10 +1068,12 @@ void mlx5e_deactivate_priv_channels(struct mlx5e_priv *priv); ...@@ -1068,10 +1068,12 @@ void mlx5e_deactivate_priv_channels(struct mlx5e_priv *priv);
void mlx5e_build_default_indir_rqt(u32 *indirection_rqt, int len, void mlx5e_build_default_indir_rqt(u32 *indirection_rqt, int len,
int num_channels); int num_channels);
void mlx5e_set_tx_cq_mode_params(struct mlx5e_params *params,
u8 cq_period_mode); void mlx5e_reset_tx_moderation(struct mlx5e_params *params, u8 cq_period_mode);
void mlx5e_set_rx_cq_mode_params(struct mlx5e_params *params, void mlx5e_reset_rx_moderation(struct mlx5e_params *params, u8 cq_period_mode);
u8 cq_period_mode); void mlx5e_set_tx_cq_mode_params(struct mlx5e_params *params, u8 cq_period_mode);
void mlx5e_set_rx_cq_mode_params(struct mlx5e_params *params, u8 cq_period_mode);
void mlx5e_set_rq_type(struct mlx5_core_dev *mdev, struct mlx5e_params *params); void mlx5e_set_rq_type(struct mlx5_core_dev *mdev, struct mlx5e_params *params);
void mlx5e_init_rq_type_params(struct mlx5_core_dev *mdev, void mlx5e_init_rq_type_params(struct mlx5_core_dev *mdev,
struct mlx5e_params *params); struct mlx5e_params *params);
......
...@@ -369,17 +369,19 @@ enum mlx5e_fec_supported_link_mode { ...@@ -369,17 +369,19 @@ enum mlx5e_fec_supported_link_mode {
*_policy = MLX5_GET(pplm_reg, _buf, fec_override_admin_##link); \ *_policy = MLX5_GET(pplm_reg, _buf, fec_override_admin_##link); \
} while (0) } while (0)
#define MLX5E_FEC_OVERRIDE_ADMIN_50G_POLICY(buf, policy, write, link) \ #define MLX5E_FEC_OVERRIDE_ADMIN_50G_POLICY(buf, policy, write, link) \
do { \ do { \
u16 *__policy = &(policy); \ unsigned long policy_long; \
bool _write = (write); \ u16 *__policy = &(policy); \
\ bool _write = (write); \
if (_write && *__policy) \ \
*__policy = find_first_bit((u_long *)__policy, \ policy_long = *__policy; \
sizeof(u16) * BITS_PER_BYTE);\ if (_write && *__policy) \
MLX5E_FEC_OVERRIDE_ADMIN_POLICY(buf, *__policy, _write, link); \ *__policy = find_first_bit(&policy_long, \
if (!_write && *__policy) \ sizeof(policy_long) * BITS_PER_BYTE);\
*__policy = 1 << *__policy; \ MLX5E_FEC_OVERRIDE_ADMIN_POLICY(buf, *__policy, _write, link); \
if (!_write && *__policy) \
*__policy = 1 << *__policy; \
} while (0) } while (0)
/* get/set FEC admin field for a given speed */ /* get/set FEC admin field for a given speed */
......
...@@ -527,8 +527,8 @@ int mlx5e_ethtool_set_coalesce(struct mlx5e_priv *priv, ...@@ -527,8 +527,8 @@ int mlx5e_ethtool_set_coalesce(struct mlx5e_priv *priv,
struct dim_cq_moder *rx_moder, *tx_moder; struct dim_cq_moder *rx_moder, *tx_moder;
struct mlx5_core_dev *mdev = priv->mdev; struct mlx5_core_dev *mdev = priv->mdev;
struct mlx5e_channels new_channels = {}; struct mlx5e_channels new_channels = {};
bool reset_rx, reset_tx;
int err = 0; int err = 0;
bool reset;
if (!MLX5_CAP_GEN(mdev, cq_moderation)) if (!MLX5_CAP_GEN(mdev, cq_moderation))
return -EOPNOTSUPP; return -EOPNOTSUPP;
...@@ -566,15 +566,28 @@ int mlx5e_ethtool_set_coalesce(struct mlx5e_priv *priv, ...@@ -566,15 +566,28 @@ int mlx5e_ethtool_set_coalesce(struct mlx5e_priv *priv,
} }
/* we are opened */ /* we are opened */
reset = (!!coal->use_adaptive_rx_coalesce != priv->channels.params.rx_dim_enabled) || reset_rx = !!coal->use_adaptive_rx_coalesce != priv->channels.params.rx_dim_enabled;
(!!coal->use_adaptive_tx_coalesce != priv->channels.params.tx_dim_enabled); reset_tx = !!coal->use_adaptive_tx_coalesce != priv->channels.params.tx_dim_enabled;
if (!reset) { if (!reset_rx && !reset_tx) {
mlx5e_set_priv_channels_coalesce(priv, coal); mlx5e_set_priv_channels_coalesce(priv, coal);
priv->channels.params = new_channels.params; priv->channels.params = new_channels.params;
goto out; goto out;
} }
if (reset_rx) {
u8 mode = MLX5E_GET_PFLAG(&new_channels.params,
MLX5E_PFLAG_RX_CQE_BASED_MODER);
mlx5e_reset_rx_moderation(&new_channels.params, mode);
}
if (reset_tx) {
u8 mode = MLX5E_GET_PFLAG(&new_channels.params,
MLX5E_PFLAG_TX_CQE_BASED_MODER);
mlx5e_reset_tx_moderation(&new_channels.params, mode);
}
err = mlx5e_safe_switch_channels(priv, &new_channels, NULL, NULL); err = mlx5e_safe_switch_channels(priv, &new_channels, NULL, NULL);
out: out:
...@@ -665,11 +678,12 @@ static const u32 pplm_fec_2_ethtool_linkmodes[] = { ...@@ -665,11 +678,12 @@ static const u32 pplm_fec_2_ethtool_linkmodes[] = {
static int get_fec_supported_advertised(struct mlx5_core_dev *dev, static int get_fec_supported_advertised(struct mlx5_core_dev *dev,
struct ethtool_link_ksettings *link_ksettings) struct ethtool_link_ksettings *link_ksettings)
{ {
u_long active_fec = 0; unsigned long active_fec_long;
u32 active_fec;
u32 bitn; u32 bitn;
int err; int err;
err = mlx5e_get_fec_mode(dev, (u32 *)&active_fec, NULL); err = mlx5e_get_fec_mode(dev, &active_fec, NULL);
if (err) if (err)
return (err == -EOPNOTSUPP) ? 0 : err; return (err == -EOPNOTSUPP) ? 0 : err;
...@@ -682,10 +696,11 @@ static int get_fec_supported_advertised(struct mlx5_core_dev *dev, ...@@ -682,10 +696,11 @@ static int get_fec_supported_advertised(struct mlx5_core_dev *dev,
MLX5E_ADVERTISE_SUPPORTED_FEC(MLX5E_FEC_LLRS_272_257_1, MLX5E_ADVERTISE_SUPPORTED_FEC(MLX5E_FEC_LLRS_272_257_1,
ETHTOOL_LINK_MODE_FEC_LLRS_BIT); ETHTOOL_LINK_MODE_FEC_LLRS_BIT);
active_fec_long = active_fec;
/* active fec is a bit set, find out which bit is set and /* active fec is a bit set, find out which bit is set and
* advertise the corresponding ethtool bit * advertise the corresponding ethtool bit
*/ */
bitn = find_first_bit(&active_fec, sizeof(u32) * BITS_PER_BYTE); bitn = find_first_bit(&active_fec_long, sizeof(active_fec_long) * BITS_PER_BYTE);
if (bitn < ARRAY_SIZE(pplm_fec_2_ethtool_linkmodes)) if (bitn < ARRAY_SIZE(pplm_fec_2_ethtool_linkmodes))
__set_bit(pplm_fec_2_ethtool_linkmodes[bitn], __set_bit(pplm_fec_2_ethtool_linkmodes[bitn],
link_ksettings->link_modes.advertising); link_ksettings->link_modes.advertising);
...@@ -1517,8 +1532,8 @@ static int mlx5e_get_fecparam(struct net_device *netdev, ...@@ -1517,8 +1532,8 @@ static int mlx5e_get_fecparam(struct net_device *netdev,
{ {
struct mlx5e_priv *priv = netdev_priv(netdev); struct mlx5e_priv *priv = netdev_priv(netdev);
struct mlx5_core_dev *mdev = priv->mdev; struct mlx5_core_dev *mdev = priv->mdev;
u16 fec_configured = 0; u16 fec_configured;
u32 fec_active = 0; u32 fec_active;
int err; int err;
err = mlx5e_get_fec_mode(mdev, &fec_active, &fec_configured); err = mlx5e_get_fec_mode(mdev, &fec_active, &fec_configured);
...@@ -1526,14 +1541,14 @@ static int mlx5e_get_fecparam(struct net_device *netdev, ...@@ -1526,14 +1541,14 @@ static int mlx5e_get_fecparam(struct net_device *netdev,
if (err) if (err)
return err; return err;
fecparam->active_fec = pplm2ethtool_fec((u_long)fec_active, fecparam->active_fec = pplm2ethtool_fec((unsigned long)fec_active,
sizeof(u32) * BITS_PER_BYTE); sizeof(unsigned long) * BITS_PER_BYTE);
if (!fecparam->active_fec) if (!fecparam->active_fec)
return -EOPNOTSUPP; return -EOPNOTSUPP;
fecparam->fec = pplm2ethtool_fec((u_long)fec_configured, fecparam->fec = pplm2ethtool_fec((unsigned long)fec_configured,
sizeof(u16) * BITS_PER_BYTE); sizeof(unsigned long) * BITS_PER_BYTE);
return 0; return 0;
} }
......
...@@ -4716,7 +4716,7 @@ static u8 mlx5_to_net_dim_cq_period_mode(u8 cq_period_mode) ...@@ -4716,7 +4716,7 @@ static u8 mlx5_to_net_dim_cq_period_mode(u8 cq_period_mode)
DIM_CQ_PERIOD_MODE_START_FROM_EQE; DIM_CQ_PERIOD_MODE_START_FROM_EQE;
} }
void mlx5e_set_tx_cq_mode_params(struct mlx5e_params *params, u8 cq_period_mode) void mlx5e_reset_tx_moderation(struct mlx5e_params *params, u8 cq_period_mode)
{ {
if (params->tx_dim_enabled) { if (params->tx_dim_enabled) {
u8 dim_period_mode = mlx5_to_net_dim_cq_period_mode(cq_period_mode); u8 dim_period_mode = mlx5_to_net_dim_cq_period_mode(cq_period_mode);
...@@ -4725,13 +4725,9 @@ void mlx5e_set_tx_cq_mode_params(struct mlx5e_params *params, u8 cq_period_mode) ...@@ -4725,13 +4725,9 @@ void mlx5e_set_tx_cq_mode_params(struct mlx5e_params *params, u8 cq_period_mode)
} else { } else {
params->tx_cq_moderation = mlx5e_get_def_tx_moderation(cq_period_mode); params->tx_cq_moderation = mlx5e_get_def_tx_moderation(cq_period_mode);
} }
MLX5E_SET_PFLAG(params, MLX5E_PFLAG_TX_CQE_BASED_MODER,
params->tx_cq_moderation.cq_period_mode ==
MLX5_CQ_PERIOD_MODE_START_FROM_CQE);
} }
void mlx5e_set_rx_cq_mode_params(struct mlx5e_params *params, u8 cq_period_mode) void mlx5e_reset_rx_moderation(struct mlx5e_params *params, u8 cq_period_mode)
{ {
if (params->rx_dim_enabled) { if (params->rx_dim_enabled) {
u8 dim_period_mode = mlx5_to_net_dim_cq_period_mode(cq_period_mode); u8 dim_period_mode = mlx5_to_net_dim_cq_period_mode(cq_period_mode);
...@@ -4740,7 +4736,19 @@ void mlx5e_set_rx_cq_mode_params(struct mlx5e_params *params, u8 cq_period_mode) ...@@ -4740,7 +4736,19 @@ void mlx5e_set_rx_cq_mode_params(struct mlx5e_params *params, u8 cq_period_mode)
} else { } else {
params->rx_cq_moderation = mlx5e_get_def_rx_moderation(cq_period_mode); params->rx_cq_moderation = mlx5e_get_def_rx_moderation(cq_period_mode);
} }
}
void mlx5e_set_tx_cq_mode_params(struct mlx5e_params *params, u8 cq_period_mode)
{
mlx5e_reset_tx_moderation(params, cq_period_mode);
MLX5E_SET_PFLAG(params, MLX5E_PFLAG_TX_CQE_BASED_MODER,
params->tx_cq_moderation.cq_period_mode ==
MLX5_CQ_PERIOD_MODE_START_FROM_CQE);
}
void mlx5e_set_rx_cq_mode_params(struct mlx5e_params *params, u8 cq_period_mode)
{
mlx5e_reset_rx_moderation(params, cq_period_mode);
MLX5E_SET_PFLAG(params, MLX5E_PFLAG_RX_CQE_BASED_MODER, MLX5E_SET_PFLAG(params, MLX5E_PFLAG_RX_CQE_BASED_MODER,
params->rx_cq_moderation.cq_period_mode == params->rx_cq_moderation.cq_period_mode ==
MLX5_CQ_PERIOD_MODE_START_FROM_CQE); MLX5_CQ_PERIOD_MODE_START_FROM_CQE);
......
...@@ -2068,7 +2068,7 @@ static int mlx5e_flower_parse_meta(struct net_device *filter_dev, ...@@ -2068,7 +2068,7 @@ static int mlx5e_flower_parse_meta(struct net_device *filter_dev,
flow_rule_match_meta(rule, &match); flow_rule_match_meta(rule, &match);
if (match.mask->ingress_ifindex != 0xFFFFFFFF) { if (match.mask->ingress_ifindex != 0xFFFFFFFF) {
NL_SET_ERR_MSG_MOD(extack, "Unsupported ingress ifindex mask"); NL_SET_ERR_MSG_MOD(extack, "Unsupported ingress ifindex mask");
return -EINVAL; return -EOPNOTSUPP;
} }
ingress_dev = __dev_get_by_index(dev_net(filter_dev), ingress_dev = __dev_get_by_index(dev_net(filter_dev),
...@@ -2076,13 +2076,13 @@ static int mlx5e_flower_parse_meta(struct net_device *filter_dev, ...@@ -2076,13 +2076,13 @@ static int mlx5e_flower_parse_meta(struct net_device *filter_dev,
if (!ingress_dev) { if (!ingress_dev) {
NL_SET_ERR_MSG_MOD(extack, NL_SET_ERR_MSG_MOD(extack,
"Can't find the ingress port to match on"); "Can't find the ingress port to match on");
return -EINVAL; return -ENOENT;
} }
if (ingress_dev != filter_dev) { if (ingress_dev != filter_dev) {
NL_SET_ERR_MSG_MOD(extack, NL_SET_ERR_MSG_MOD(extack,
"Can't match on the ingress filter port"); "Can't match on the ingress filter port");
return -EINVAL; return -EOPNOTSUPP;
} }
return 0; return 0;
...@@ -3849,10 +3849,6 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, ...@@ -3849,10 +3849,6 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv,
if (!mlx5e_is_valid_eswitch_fwd_dev(priv, out_dev)) { if (!mlx5e_is_valid_eswitch_fwd_dev(priv, out_dev)) {
NL_SET_ERR_MSG_MOD(extack, NL_SET_ERR_MSG_MOD(extack,
"devices are not on same switch HW, can't offload forwarding"); "devices are not on same switch HW, can't offload forwarding");
netdev_warn(priv->netdev,
"devices %s %s not on same switch HW, can't offload forwarding\n",
priv->netdev->name,
out_dev->name);
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
...@@ -4614,7 +4610,7 @@ void mlx5e_tc_stats_matchall(struct mlx5e_priv *priv, ...@@ -4614,7 +4610,7 @@ void mlx5e_tc_stats_matchall(struct mlx5e_priv *priv,
dpkts = cur_stats.rx_packets - rpriv->prev_vf_vport_stats.rx_packets; dpkts = cur_stats.rx_packets - rpriv->prev_vf_vport_stats.rx_packets;
dbytes = cur_stats.rx_bytes - rpriv->prev_vf_vport_stats.rx_bytes; dbytes = cur_stats.rx_bytes - rpriv->prev_vf_vport_stats.rx_bytes;
rpriv->prev_vf_vport_stats = cur_stats; rpriv->prev_vf_vport_stats = cur_stats;
flow_stats_update(&ma->stats, dpkts, dbytes, jiffies, flow_stats_update(&ma->stats, dbytes, dpkts, jiffies,
FLOW_ACTION_HW_STATS_DELAYED); FLOW_ACTION_HW_STATS_DELAYED);
} }
......
...@@ -1549,6 +1549,22 @@ static void shutdown(struct pci_dev *pdev) ...@@ -1549,6 +1549,22 @@ static void shutdown(struct pci_dev *pdev)
mlx5_pci_disable_device(dev); mlx5_pci_disable_device(dev);
} }
static int mlx5_suspend(struct pci_dev *pdev, pm_message_t state)
{
struct mlx5_core_dev *dev = pci_get_drvdata(pdev);
mlx5_unload_one(dev, false);
return 0;
}
static int mlx5_resume(struct pci_dev *pdev)
{
struct mlx5_core_dev *dev = pci_get_drvdata(pdev);
return mlx5_load_one(dev, false);
}
static const struct pci_device_id mlx5_core_pci_table[] = { static const struct pci_device_id mlx5_core_pci_table[] = {
{ PCI_VDEVICE(MELLANOX, PCI_DEVICE_ID_MELLANOX_CONNECTIB) }, { PCI_VDEVICE(MELLANOX, PCI_DEVICE_ID_MELLANOX_CONNECTIB) },
{ PCI_VDEVICE(MELLANOX, 0x1012), MLX5_PCI_DEV_IS_VF}, /* Connect-IB VF */ { PCI_VDEVICE(MELLANOX, 0x1012), MLX5_PCI_DEV_IS_VF}, /* Connect-IB VF */
...@@ -1592,6 +1608,8 @@ static struct pci_driver mlx5_core_driver = { ...@@ -1592,6 +1608,8 @@ static struct pci_driver mlx5_core_driver = {
.id_table = mlx5_core_pci_table, .id_table = mlx5_core_pci_table,
.probe = init_one, .probe = init_one,
.remove = remove_one, .remove = remove_one,
.suspend = mlx5_suspend,
.resume = mlx5_resume,
.shutdown = shutdown, .shutdown = shutdown,
.err_handler = &mlx5_err_handler, .err_handler = &mlx5_err_handler,
.sriov_configure = mlx5_core_sriov_configure, .sriov_configure = mlx5_core_sriov_configure,
......
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