From: Saeed Mahameed <saeedm@nvidia.com>
Hi Dave, Jakub,
This series provides some fixes to mlx5 driver.
Please pull and let me know if there is any problem.
For -stable v5.2
('net/mlx5: Use port_num 1 instead of 0 when delete a RoCE address')
For -stable v5.5
('net/mlx5e: ethtool, Fix restriction of autoneg with 56G')
For -stable v5.8
('net/mlx5e: In skb build skip setting mark in switchdev mode')
For -stable v5.10
('net/mlx5: Check if lag is supported before creating one')
('net/mlx5e: Fix SWP offsets when vlan inserted by driver')
Thanks,
Saeed.
---
The following changes since commit 5316a7c0130acf09bfc8bb0092407006010fcccc:
tools: selftests: add test for changing routes with PTMU exceptions (2021-01-07 12:03:36 -0800)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git tags/mlx5-fixes-2021-01-07
for you to fetch changes up to 5b0bb12c58ac7d22e05b5bfdaa30a116c8c32e32:
net/mlx5e: Fix memleak in mlx5e_create_l2_table_groups (2021-01-07 12:22:51 -0800)
----------------------------------------------------------------
mlx5-fixes-2021-01-07
----------------------------------------------------------------
Alaa Hleihel (1):
net/mlx5: E-Switch, fix changing vf VLANID
Aya Levin (2):
net/mlx5e: Add missing capability check for uplink follow
net/mlx5e: ethtool, Fix restriction of autoneg with 56G
Dinghao Liu (2):
net/mlx5e: Fix two double free cases
net/mlx5e: Fix memleak in mlx5e_create_l2_table_groups
Leon Romanovsky (1):
net/mlx5: Release devlink object if adev fails
Maor Dickman (1):
net/mlx5e: In skb build skip setting mark in switchdev mode
Mark Zhang (2):
net/mlx5: Check if lag is supported before creating one
net/mlx5: Use port_num 1 instead of 0 when delete a RoCE address
Moshe Shemesh (1):
net/mlx5e: Fix SWP offsets when vlan inserted by driver
Oz Shlomo (1):
net/mlx5e: CT: Use per flow counter when CT flow accounting is enabled
.../net/ethernet/mellanox/mlx5/core/en/rep/tc.c | 5 ++
drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c | 77 ++++++++++++++--------
drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h | 9 +++
.../mellanox/mlx5/core/en_accel/en_accel.h | 8 ++-
.../net/ethernet/mellanox/mlx5/core/en_ethtool.c | 24 +++++--
drivers/net/ethernet/mellanox/mlx5/core/en_fs.c | 3 +
drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 3 +-
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | 9 +--
.../mellanox/mlx5/core/esw/acl/egress_lgcy.c | 27 ++++----
drivers/net/ethernet/mellanox/mlx5/core/lag.c | 11 ++--
drivers/net/ethernet/mellanox/mlx5/core/main.c | 7 +-
drivers/net/ethernet/mellanox/mlx5/core/rdma.c | 2 +-
include/linux/mlx5/mlx5_ifc.h | 3 +-
13 files changed, 122 insertions(+), 66 deletions(-)
From: Aya Levin <redacted>
Expose firmware indication that it supports setting eswitch uplink state
to follow (follow the physical link). Condition setting the eswitch
uplink admin-state with this capability bit. Older FW may not support
the uplink state setting.
Fixes: 7d0314b11cdd ("net/mlx5e: Modify uplink state on interface up/down")
Signed-off-by: Aya Levin <redacted>
Reviewed-by: Moshe Shemesh <redacted>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 3 ++-
include/linux/mlx5/mlx5_ifc.h | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
From: Oz Shlomo <redacted>
Connection counters may be shared for both directions when the counter
is used for connection aging purposes. However, if TC flow
accounting is enabled then a unique counter is required per direction.
Instantiate a unique counter per direction if the conntrack accounting
extension is enabled. Use a shared counter when the connection accounting
extension is disabled.
Fixes: 1edae2335adf ("net/mlx5e: CT: Use the same counter for both directions")
Signed-off-by: Oz Shlomo <redacted>
Reported-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Reviewed-by: Roi Dayan <redacted>
Reviewed-by: Paul Blakey <redacted>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
.../ethernet/mellanox/mlx5/core/en/tc_ct.c | 77 ++++++++++++-------
1 file changed, 49 insertions(+), 28 deletions(-)
From: Alaa Hleihel <redacted>
Adding vf VLANID for the first time, or after having cleared previously
defined VLANID works fine, however, attempting to change an existing vf
VLANID clears the rules on the firmware, but does not add new rules for
the new vf VLANID.
Fix this by changing the logic in function esw_acl_egress_lgcy_setup()
so that it will always configure egress rules.
Fixes: ea651a86d468 ("net/mlx5: E-Switch, Refactor eswitch egress acl codes")
Signed-off-by: Alaa Hleihel <redacted>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
.../mellanox/mlx5/core/esw/acl/egress_lgcy.c | 27 +++++++++----------
1 file changed, 13 insertions(+), 14 deletions(-)
From: Moshe Shemesh <redacted>
In case WQE includes inline header the vlan is inserted by driver even
if vlan offload is set. On geneve over vlan interface where software
parser is used the SWP offsets should be updated according to the added
vlan.
Fixes: e3cfc7e6b7bd ("net/mlx5e: TX, Add geneve tunnel stateless offload support")
Signed-off-by: Moshe Shemesh <redacted>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h | 9 +++++++++
.../net/ethernet/mellanox/mlx5/core/en_accel/en_accel.h | 8 +++++---
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | 9 +++++----
3 files changed, 19 insertions(+), 7 deletions(-)
@@ -371,6 +371,15 @@ struct mlx5e_swp_spec {u8tun_l4_proto;};+staticinlinevoidmlx5e_eseg_swp_offsets_add_vlan(structmlx5_wqe_eth_seg*eseg)+{+/* SWP offsets are in 2-bytes words */+eseg->swp_outer_l3_offset+=VLAN_HLEN/2;+eseg->swp_outer_l4_offset+=VLAN_HLEN/2;+eseg->swp_inner_l3_offset+=VLAN_HLEN/2;+eseg->swp_inner_l4_offset+=VLAN_HLEN/2;+}+staticinlinevoidmlx5e_set_eseg_swp(structsk_buff*skb,structmlx5_wqe_eth_seg*eseg,structmlx5e_swp_spec*swp_spec)
@@ -731,7 +732,7 @@ netdev_tx_t mlx5e_xmit(struct sk_buff *skb, struct net_device *dev)/* May update the WQE, but may not post other WQEs. */mlx5e_accel_tx_finish(sq,wqe,&accel,(structmlx5_wqe_inline_seg*)(wqe->data+wqe_attr.ds_cnt_inl));-if(unlikely(!mlx5e_txwqe_build_eseg(priv,sq,skb,&accel,&wqe->eth)))+if(unlikely(!mlx5e_txwqe_build_eseg(priv,sq,skb,&accel,&wqe->eth,attr.ihs)))returnNETDEV_TX_OK;mlx5e_sq_xmit_wqe(sq,skb,&attr,&wqe_attr,wqe,pi,netdev_xmit_more());
From: Maor Dickman <redacted>
sop_drop_qpn field in the cqe is used by two features, in SWITCHDEV mode
to restore the chain id in case of a miss and in LEGACY mode to support
skbedit mark action. In build RX skb, the skb mark field is set regardless
of the configured mode which cause a corruption of the mark field in case
of switchdev mode.
Fix by overriding the mark value back to 0 in the representor tc update
skb flow.
Fixes: 8f1e0b97cc70 ("net/mlx5: E-Switch, Mark miss packets with new chain id mapping")
Signed-off-by: Maor Dickman <redacted>
Reviewed-by: Raed Salem <redacted>
Reviewed-by: Oz Shlomo <redacted>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c | 5 +++++
1 file changed, 5 insertions(+)
@@ -626,6 +626,11 @@ bool mlx5e_rep_tc_update_skb(struct mlx5_cqe64 *cqe,if(!reg_c0)returntrue;+/* If reg_c0 is not equal to the default flow tag then skb->mark+*isnotsupportedandmustberesetbackto0.+*/+skb->mark=0;+priv=netdev_priv(skb->dev);esw=priv->mdev->priv.eswitch;
From: Dinghao Liu <redacted>
mlx5e_create_ttc_table_groups() frees ft->g on failure of
kvzalloc(), but such failure will be caught by its caller
in mlx5e_create_ttc_table() and ft->g will be freed again
in mlx5e_destroy_flow_table(). The same issue also occurs
in mlx5e_create_ttc_table_groups(). Set ft->g to NULL after
kfree() to avoid double free.
Fixes: 7b3722fa9ef6 ("net/mlx5e: Support RSS for GRE tunneled packets")
Fixes: 33cfaaa8f36f ("net/mlx5e: Split the main flow steering table")
Signed-off-by: Dinghao Liu <redacted>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en_fs.c | 2 ++
1 file changed, 2 insertions(+)
From: Dinghao Liu <redacted>
When mlx5_create_flow_group() fails, ft->g should be
freed just like when kvzalloc() fails. The caller of
mlx5e_create_l2_table_groups() does not catch this
issue on failure, which leads to memleak.
Fixes: 33cfaaa8f36f ("net/mlx5e: Split the main flow steering table")
Signed-off-by: Dinghao Liu <redacted>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en_fs.c | 1 +
1 file changed, 1 insertion(+)
From: Aya Levin <redacted>
Prior to this patch, configuring speed to 50G with autoneg off over
devices supporting 50G per lane failed.
Support for 50G per lane introduced a new set of link-modes, on which
driver always performed a speed validation as if only legacy link-modes
were configured. Fix driver speed validation to force setting autoneg
over 56G only if in legacy link-mode.
Fixes: 3d7cadae51f1 ("net/mlx5e: ethtool, Fix analysis of speed setting")
Signed-off-by: Aya Levin <redacted>
Reviewed-by: Eran Ben Elisha <redacted>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
.../ethernet/mellanox/mlx5/core/en_ethtool.c | 24 ++++++++++++++-----
1 file changed, 18 insertions(+), 6 deletions(-)
On Thu, Jan 07, 2021 at 12:28:38PM -0800, Saeed Mahameed wrote:
From: Oz Shlomo <redacted>
Connection counters may be shared for both directions when the counter
is used for connection aging purposes. However, if TC flow
accounting is enabled then a unique counter is required per direction.
Instantiate a unique counter per direction if the conntrack accounting
extension is enabled. Use a shared counter when the connection accounting
extension is disabled.
Fixes: 1edae2335adf ("net/mlx5e: CT: Use the same counter for both directions")
Signed-off-by: Oz Shlomo <redacted>
Reported-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
From: Jakub Kicinski <kuba@kernel.org> Date: 2021-01-08 03:18:44
On Thu, 7 Jan 2021 12:28:34 -0800 Saeed Mahameed wrote:
From: Saeed Mahameed <saeedm@nvidia.com>
Hi Dave, Jakub,
This series provides some fixes to mlx5 driver.
Please pull and let me know if there is any problem.
From: Jakub Kicinski <kuba@kernel.org> Date: 2021-01-08 04:41:56
On Thu, 07 Jan 2021 20:18:36 -0800 Saeed Mahameed wrote:
On Thu, 2021-01-07 at 20:06 -0800, Saeed Mahameed wrote:
quoted
On Thu, 2021-01-07 at 19:07 -0800, Jakub Kicinski wrote:
quoted
On Thu, 7 Jan 2021 12:28:38 -0800 Saeed Mahameed wrote:
quoted
+ int ret;
+
+ counter = kzalloc(sizeof(*counter), GFP_KERNEL);
+ if (!counter)
+ return ERR_PTR(-ENOMEM);
+
+ counter->is_shared = false;
+ counter->counter = mlx5_fc_create(ct_priv->dev, true);
+ if (IS_ERR(counter->counter)) {
+ ct_dbg("Failed to create counter for ct entry");
+ ret = PTR_ERR(counter->counter);
+ kfree(counter);
+ return ERR_PTR(ret);
The err ptr -> ret -> err ptr conversion seems entirely pointless,
no?
Indeed, will address this in a net-next patch
Actually no, because counter is being kfreed so we must return
ERR_PTR(ret).
Ah, good point, just the other one then:
+ shared_counter = mlx5_tc_ct_counter_create(ct_priv);
+ if (IS_ERR(shared_counter)) {
+ ret = PTR_ERR(shared_counter);
return ERR_PTR(ret);
}
On Thu, 2021-01-07 at 20:40 -0800, Jakub Kicinski wrote:
On Thu, 07 Jan 2021 20:18:36 -0800 Saeed Mahameed wrote:
quoted
On Thu, 2021-01-07 at 20:06 -0800, Saeed Mahameed wrote:
quoted
On Thu, 2021-01-07 at 19:07 -0800, Jakub Kicinski wrote:
quoted
On Thu, 7 Jan 2021 12:28:38 -0800 Saeed Mahameed wrote:
quoted
+ int ret;
+
+ counter = kzalloc(sizeof(*counter), GFP_KERNEL);
+ if (!counter)
+ return ERR_PTR(-ENOMEM);
+
+ counter->is_shared = false;
+ counter->counter = mlx5_fc_create(ct_priv->dev, true);
+ if (IS_ERR(counter->counter)) {
+ ct_dbg("Failed to create counter for ct
entry");
+ ret = PTR_ERR(counter->counter);
+ kfree(counter);
+ return ERR_PTR(ret);
The err ptr -> ret -> err ptr conversion seems entirely
pointless,
no?
Indeed, will address this in a net-next patch
Actually no, because counter is being kfreed so we must return
ERR_PTR(ret).
Ah, good point, just the other one then:
+ shared_counter = mlx5_tc_ct_counter_create(ct_priv);
+ if (IS_ERR(shared_counter)) {
+ ret = PTR_ERR(shared_counter);
return ERR_PTR(ret);
}
Done, will send to net-next once this is back merged.
Thanks.