From: Saeed Mahameed <saeedm@nvidia.com>
Hi Dave, Jakub,
This series introduces some fixes to mlx5 driver.
Please pull and let me know if there is any problem.
Thanks,
Saeed.
---
The following changes since commit 4d4a223a86afe658cd878800f09458e8bb54415d:
ice: fix locking for Tx timestamp tracking flush (2021-10-12 12:10:39 +0100)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git tags/mlx5-fixes-2021-10-12
for you to fetch changes up to 84c8a87402cf073ba7948dd62d4815a3f4a224c8:
net/mlx5e: Fix division by 0 in mlx5e_select_queue for representors (2021-10-12 13:52:03 -0700)
----------------------------------------------------------------
mlx5-fixes-2021-10-12
----------------------------------------------------------------
Aya Levin (1):
net/mlx5e: Mutually exclude RX-FCS and RX-port-timestamp
Maxim Mikityanskiy (1):
net/mlx5e: Fix division by 0 in mlx5e_select_queue for representors
Saeed Mahameed (1):
net/mlx5e: Switchdev representors are not vlan challenged
Shay Drory (1):
net/mlx5: Fix cleanup of bridge delayed work
Tariq Toukan (1):
net/mlx5e: Allow only complete TXQs partition in MQPRIO channel mode
Valentine Fatiev (1):
net/mlx5e: Fix memory leak in mlx5_core_destroy_cq() error path
drivers/net/ethernet/mellanox/mlx5/core/cq.c | 7 ++-
.../ethernet/mellanox/mlx5/core/en/rep/bridge.c | 8 +--
drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 61 +++++++++++++++++++---
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 6 ++-
include/linux/mlx5/mlx5_ifc.h | 10 +++-
5 files changed, 74 insertions(+), 18 deletions(-)
@@ -2981,8 +2981,8 @@ static int mlx5e_mqprio_channel_validate(struct mlx5e_priv *priv,agg_count+=mqprio->qopt.count[i];}-if(priv->channels.params.num_channels<agg_count){-netdev_err(netdev,"Num of queues (%d) exceeds available (%d)\n",+if(priv->channels.params.num_channels!=agg_count){+netdev_err(netdev,"Num of queues (%d) does not match available (%d)\n",agg_count,priv->channels.params.num_channels);return-EINVAL;}
From: Saeed Mahameed <saeedm@nvidia.com>
Before this patch, mlx5 representors advertised the
NETIF_F_VLAN_CHALLENGED bit, this could lead to missing features when
using reps with vxlan/bridge and maybe other virtual interfaces,
when such interfaces inherit this bit and block vlan usage in their
topology.
Example:
$ip link add dev bridge type bridge
# add representor interface to the bridge
$ip link set dev pf0hpf master
$ip link add link bridge name vlan10 type vlan id 10 protocol 802.1q
Error: 8021q: VLANs not supported on device.
Reps are perfectly capable of handling vlan traffic, although they don't
implement vlan_{add,kill}_vid ndos, hence, remove
NETIF_F_VLAN_CHALLENGED advertisement.
Fixes: cb67b832921c ("net/mlx5e: Introduce SRIOV VF representors")
Reported-by: Roopa Prabhu <redacted>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Reviewed-by: Roi Dayan <redacted>
---
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 1 -
1 file changed, 1 deletion(-)
From: Aya Levin <redacted>
Due to current HW arch limitations, RX-FCS (scattering FCS frame field
to software) and RX-port-timestamp (improved timestamp accuracy on the
receive side) can't work together.
RX-port-timestamp is not controlled by the user and it is enabled by
default when supported by the HW/FW.
This patch sets RX-port-timestamp opposite to RX-FCS configuration.
Fixes: 102722fc6832 ("net/mlx5e: Add support for RXFCS feature flag")
Signed-off-by: Aya Levin <redacted>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Reviewed-by: Moshe Shemesh <redacted>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
.../net/ethernet/mellanox/mlx5/core/en_main.c | 57 +++++++++++++++++--
include/linux/mlx5/mlx5_ifc.h | 10 +++-
2 files changed, 60 insertions(+), 7 deletions(-)
@@ -3325,20 +3325,67 @@ static int set_feature_rx_all(struct net_device *netdev, bool enable)returnmlx5_set_port_fcs(mdev,!enable);}+staticintmlx5e_set_rx_port_ts(structmlx5_core_dev*mdev,boolenable)+{+u32in[MLX5_ST_SZ_DW(pcmr_reg)]={};+boolsupported,curr_state;+interr;++if(!MLX5_CAP_GEN(mdev,ports_check))+return0;++err=mlx5_query_ports_check(mdev,in,sizeof(in));+if(err)+returnerr;++supported=MLX5_GET(pcmr_reg,in,rx_ts_over_crc_cap);+curr_state=MLX5_GET(pcmr_reg,in,rx_ts_over_crc);++if(!supported||enable==curr_state)+return0;++MLX5_SET(pcmr_reg,in,local_port,1);+MLX5_SET(pcmr_reg,in,rx_ts_over_crc,enable);++returnmlx5_set_ports_check(mdev,in,sizeof(in));+}+staticintset_feature_rx_fcs(structnet_device*netdev,boolenable){structmlx5e_priv*priv=netdev_priv(netdev);+structmlx5e_channels*chs=&priv->channels;+structmlx5_core_dev*mdev=priv->mdev;interr;mutex_lock(&priv->state_lock);-priv->channels.params.scatter_fcs_en=enable;-err=mlx5e_modify_channels_scatter_fcs(&priv->channels,enable);-if(err)-priv->channels.params.scatter_fcs_en=!enable;+if(enable){+err=mlx5e_set_rx_port_ts(mdev,false);+if(err)+gotoout;-mutex_unlock(&priv->state_lock);+chs->params.scatter_fcs_en=true;+err=mlx5e_modify_channels_scatter_fcs(chs,true);+if(err){+chs->params.scatter_fcs_en=false;+mlx5e_set_rx_port_ts(mdev,true);+}+}else{+chs->params.scatter_fcs_en=false;+err=mlx5e_modify_channels_scatter_fcs(chs,false);+if(err){+chs->params.scatter_fcs_en=true;+gotoout;+}+err=mlx5e_set_rx_port_ts(mdev,true);+if(err){+mlx5_core_warn(mdev,"Failed to set RX port timestamp %d\n",err);+err=0;+}+}+out:+mutex_unlock(&priv->state_lock);returnerr;}
From: Maxim Mikityanskiy <redacted>
Commit 846d6da1fcdb ("net/mlx5e: Fix division by 0 in
mlx5e_select_queue") makes mlx5e_build_nic_params assign a non-zero
initial value to priv->num_tc_x_num_ch, so that mlx5e_select_queue
doesn't fail with division by 0 if called before the first activation of
channels. However, the initialization flow of representors doesn't call
mlx5e_build_nic_params, so this bug can still happen with representors.
This commit fixes the bug by adding the missing assignment to
mlx5e_build_rep_params.
Fixes: 846d6da1fcdb ("net/mlx5e: Fix division by 0 in mlx5e_select_queue")
Signed-off-by: Maxim Mikityanskiy <redacted>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 5 +++++
1 file changed, 5 insertions(+)
@@ -618,6 +618,11 @@ static void mlx5e_build_rep_params(struct net_device *netdev)params->mqprio.num_tc=1;params->tunneled_offload_en=false;+/* Set an initial non-zero value, so that mlx5e_select_queue won't+*dividebyzeroifcalledbeforefirstactivatingchannels.+*/+priv->num_tc_x_num_ch=params->num_channels*params->mqprio.num_tc;+mlx5_query_min_inline(mdev,¶ms->tx_min_inline_mode);}
Hello:
This series was applied to netdev/net.git (master)
by Saeed Mahameed [off-list ref]:
On Tue, 12 Oct 2021 13:53:18 -0700 you wrote:
From: Shay Drory <redacted>
Currently, bridge cleanup is calling to cancel_delayed_work(). When this
function is finished, there is a chance that the delayed work is still
running. Also, the delayed work is queueing itself.
As a result, we might execute the delayed work after the bridge cleanup
have finished and hit a null-ptr oops[1].
[...]