mlx5 updates 2023-03-13
Subsystems (7)
From: Saeed Mahameed <[email protected]>
This series adds misc updates.
For more information please see tag log below.
Please pull and let me know if there is any problem.
Thanks,
Saeed.
The following changes since commit bcc858689db5f2e5a8d4d6e8bc5bb9736cd80626:
net: Use of_property_present() for testing DT property presence (2023-03-13 17:07:52 -0700)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git tags/mlx5-updates-2023-03-13
for you to fetch changes up to 1a8bcf10679345c624c656e113796f14473db1e9:
net/mlx5e: Enable TC offload for egress MACVLAN over bond (2023-03-13 22:39:06 -0700)
----------------------------------------------------------------
mlx5-updates-2023-03-13
1) Trivial cleanup patches
2) By Sandipan Patra: Implement thermal zone to report NIC temperature
3) Adham Faris, Improves devlink health diagnostics for netdev objects
4) From Maor, Enable TC offload for egress and engress MACVLAN over bond
5) From Gal, add devlink hairpin queues parameters to replace debugfs as was discussed in [1]:
[1] https://lore.kernel.org/all/[email protected]/
----------------------------------------------------------------
Adham Faris (4):
net/mlx5e: Rename RQ/SQ adaptive moderation state flag net/mlx5e: Stringify RQ SW state in RQ devlink health diagnostics net/mlx5e: Expose SQ SW state as part of SQ health diagnostics net/mlx5e: Add XSK RQ state flag for RQ devlink health diagnostics
Gal Pressman (3):
net/mlx5: Move needed PTYS functions to core layer net/mlx5e: Add devlink hairpin queues parameters net/mlx5e: Add more information to hairpin table dump
Jiri Pirko (1):
net/mlx5: Add comment to mlx5_devlink_params_register()
Maor Dickman (3):
net/mlx5e: TC, Extract indr setup block checks to function net/mlx5e: Enable TC offload for ingress MACVLAN over bond net/mlx5e: Enable TC offload for egress MACVLAN over bond
Moshe Shemesh (2):
net/mlx5: remove redundant clear_bit
net/mlx5: Stop waiting for PCI up if teardown was triggered
Rahul Rameshbabu (1):
net/mlx5e: Correct SKB room check to use all room in the fifo
Sandipan Patra (1):
net/mlx5: Implement thermal zone
.../ethernet/mellanox/mlx5/devlink.rst | 35 +++++ Documentation/networking/devlink/mlx5.rst | 12 ++ drivers/net/ethernet/mellanox/mlx5/core/Makefile | 1 + drivers/net/ethernet/mellanox/mlx5/core/devlink.c | 71 ++++++++++ drivers/net/ethernet/mellanox/mlx5/core/devlink.h | 2 + drivers/net/ethernet/mellanox/mlx5/core/en.h | 17 ++- .../net/ethernet/mellanox/mlx5/core/en/params.c | 2 +- drivers/net/ethernet/mellanox/mlx5/core/en/port.c | 157 +-------------------- drivers/net/ethernet/mellanox/mlx5/core/en/port.h | 14 -- .../net/ethernet/mellanox/mlx5/core/en/rep/tc.c | 63 ++++++--- .../ethernet/mellanox/mlx5/core/en/reporter_rx.c | 50 ++++++- .../ethernet/mellanox/mlx5/core/en/reporter_tx.c | 46 ++++++ .../ethernet/mellanox/mlx5/core/en/tc/act/mirred.c | 6 +- drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h | 2 +- .../net/ethernet/mellanox/mlx5/core/en/xsk/setup.c | 10 +- .../net/ethernet/mellanox/mlx5/core/en_ethtool.c | 12 +- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 4 +- drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 58 ++++---- drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c | 4 +- drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c | 2 +- drivers/net/ethernet/mellanox/mlx5/core/health.c | 4 + drivers/net/ethernet/mellanox/mlx5/core/main.c | 8 +- drivers/net/ethernet/mellanox/mlx5/core/port.c | 151 ++++++++++++++++++++ drivers/net/ethernet/mellanox/mlx5/core/thermal.c | 108 ++++++++++++++ drivers/net/ethernet/mellanox/mlx5/core/thermal.h | 20 +++ include/linux/mlx5/driver.h | 3 + include/linux/mlx5/mlx5_ifc.h | 26 ++++ include/linux/mlx5/port.h | 16 +++ 28 files changed, 654 insertions(+), 250 deletions(-) create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/thermal.c create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/thermal.h
PATCH 1/15 net/mlx5: remove redundant clear_bit
From: Moshe Shemesh <[email protected]>
When shutdown or remove callbacks are called the driver sets the flag MLX5_BREAK_FW_WAIT, to stop waiting for FW as teardown was called. There is no need to clear the bit as once shutdown or remove were called as there is no way back, the driver is going down. Furthermore, if not cleared the flag can be used also in other loops where we may wait while teardown was already called.
Use test_bit() instead of test_and_clear_bit() as there is no need to clear the flag.
--- drivers/net/ethernet/mellanox/mlx5/core/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/main.c +1 -1
@@ -191,7 +191,7 @@ static int wait_fw_init(struct mlx5_core_dev *dev, u32 max_wait_mili,if (!(fw_initializing >>31 ))break ;if (time_after (jiffies, end) || -test_and_clear_bit (MLX5_BREAK_FW_WAIT , &dev->intf_state)) { +test_bit (MLX5_BREAK_FW_WAIT , &dev->intf_state)) { err = -EBUSY ;break ; }
Signature · 1 line
2.39.2
Re: [net-next 01/15] net/mlx5: remove redundant clear_bit
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 10 lines · On Mon, 13 Mar 2023 22:42:20 -0700 you wrote:
From: Moshe Shemesh <[email protected]>
When shutdown or remove callbacks are called the driver sets the flag
MLX5_BREAK_FW_WAIT, to stop waiting for FW as teardown was called. There is no need to clear the bit as once shutdown or remove were called as there is no way back, the driver is going down. Furthermore, if not cleared the flag can be used also in other loops where we may wait while teardown was already called.[...]
Here is the summary with links:
- [net-next,01/15] net/mlx5: remove redundant clear_bit
https://git.kernel.org/netdev/net-next/c/c05d145abea1 - [net-next,02/15] net/mlx5: Stop waiting for PCI up if teardown was triggered https://git.kernel.org/netdev/net-next/c/8ff38e730c3f - [net-next,03/15] net/mlx5: Add comment to mlx5_devlink_params_register() https://git.kernel.org/netdev/net-next/c/ceefcfb8a375 - [net-next,04/15] net/mlx5: Implement thermal zone https://git.kernel.org/netdev/net-next/c/c1fef618d611 - [net-next,05/15] net/mlx5e: Correct SKB room check to use all room in the fifo https://git.kernel.org/netdev/net-next/c/aa98d15ea40b - [net-next,06/15] net/mlx5e: Rename RQ/SQ adaptive moderation state flag https://git.kernel.org/netdev/net-next/c/2b5bd5b1611b - [net-next,07/15] net/mlx5e: Stringify RQ SW state in RQ devlink health diagnostics https://git.kernel.org/netdev/net-next/c/1fe7bc109e3e - [net-next,08/15] net/mlx5e: Expose SQ SW state as part of SQ health diagnostics https://git.kernel.org/netdev/net-next/c/fc9d982a2512 - [net-next,09/15] net/mlx5e: Add XSK RQ state flag for RQ devlink health diagnostics https://git.kernel.org/netdev/net-next/c/bb76d250e55c - [net-next,10/15] net/mlx5: Move needed PTYS functions to core layer https://git.kernel.org/netdev/net-next/c/028522e28443 - [net-next,11/15] net/mlx5e: Add devlink hairpin queues parameters https://git.kernel.org/netdev/net-next/c/1bffcea42926 - [net-next,12/15] net/mlx5e: Add more information to hairpin table dump https://git.kernel.org/netdev/net-next/c/8a0594c09610 - [net-next,13/15] net/mlx5e: TC, Extract indr setup block checks to function https://git.kernel.org/netdev/net-next/c/244fd698207f - [net-next,14/15] net/mlx5e: Enable TC offload for ingress MACVLAN over bond https://git.kernel.org/netdev/net-next/c/d5d006bb27ad - [net-next,15/15] net/mlx5e: Enable TC offload for egress MACVLAN over bond https://git.kernel.org/netdev/net-next/c/63b02048f9a7
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
PATCH 2/15 net/mlx5: Stop waiting for PCI up if teardown was triggered
In reply to Saeed MahameedFrom: Moshe Shemesh <[email protected]>
If driver teardown is called while PCI is turned off, there is a race between health recovery and teardown. If health recovery already started it will wait 60 sec trying to see if PCI gets back and it can recover, but actually there is no need to wait anymore once teardown was called.
Use the MLX5_BREAK_FW_WAIT flag which is set on driver teardown to break waiting for PCI up.
--- drivers/net/ethernet/mellanox/mlx5/core/health.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/health.c +4 -0
@@ -325,6 +325,10 @@ int mlx5_health_wait_pci_up(struct mlx5_core_dev *dev)while (sensor_pci_not_working (dev)) {if (time_after (jiffies, end))return -ETIMEDOUT ; +if (test_bit (MLX5_BREAK_FW_WAIT , &dev->intf_state)) { +mlx5_core_warn (dev,"device is being removed, stop waiting for PCI\n" ); +return -ENODEV ; + }msleep (100 ); }return 0 ;
Signature · 1 line
2.39.2
PATCH 3/15 net/mlx5: Add comment to mlx5_devlink_params_register()
In reply to Saeed MahameedFrom: Jiri Pirko <[email protected]>
Add comment to mlx5_devlink_params_register() functions so it is clear that only driver init params should be registered here.
--- drivers/net/ethernet/mellanox/mlx5/core/devlink.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/devlink.c +5 -0
@@ -805,6 +805,11 @@ int mlx5_devlink_params_register(struct devlink *devlink) {int err; +/* Here only the driver init params should be registered. +* Runtime params should be registered by the code which +* behaviour they configure. +*/ + err =devl_params_register (devlink, mlx5_devlink_params,ARRAY_SIZE (mlx5_devlink_params));if (err)
Signature · 1 line
2.39.2
PATCH 4/15 net/mlx5: Implement thermal zone
In reply to Saeed MahameedFrom: Sandipan Patra <[email protected]>
Implement thermal zone support for mlx5 based HW. The NIC uses temperature sensor provided by ASIC to report current temperature to thermal core.
--- .../net/ethernet/mellanox/mlx5/core/Makefile | 1 + .../net/ethernet/mellanox/mlx5/core/main.c | 6 + .../net/ethernet/mellanox/mlx5/core/thermal.c | 108 ++++++++++++++++++ .../net/ethernet/mellanox/mlx5/core/thermal.h | 20 ++++ include/linux/mlx5/driver.h | 3 + include/linux/mlx5/mlx5_ifc.h | 26 +++++ 6 files changed, 164 insertions(+) create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/thermal.c create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/thermal.h
drivers/net/ethernet/mellanox/mlx5/core/Makefile +1 -0
@@ -77,6 +77,7 @@ mlx5_core-$(CONFIG_MLX5_ESWITCH) += esw/acl/helper.o \ mlx5_core-$(CONFIG_MLX5_BRIDGE) += esw/bridge.o en/rep/bridge.o +mlx5_core-$(CONFIG_THERMAL) += thermal.o mlx5_core-$(CONFIG_MLX5_MPFS) += lib/mpfs.o mlx5_core-$(CONFIG_VXLAN) += lib/vxlan.o mlx5_core-$(CONFIG_PTP_1588_CLOCK) += lib/clock.o
drivers/net/ethernet/mellanox/mlx5/core/main.c +6 -0
@@ -52,6 +52,7 @@#include <linux/version.h> #include <net/devlink.h> #include "mlx5_core.h" +#include "thermal.h" #include "lib/eq.h" #include "fs_core.h" #include "lib/mpfs.h"
@@ -1768,6 +1769,10 @@ static int probe_one(struct pci_dev *pdev, const struct pci_device_id *id)if (err)dev_err (&pdev->dev,"mlx5_crdump_enable failed with error code %d\n" , err); + err =mlx5_thermal_init (dev); +if (err) +dev_err (&pdev->dev,"mlx5_thermal_init failed with error code %d\n" , err); +pci_save_state (pdev);devlink_register (devlink);return 0 ;
@@ -1796,6 +1801,7 @@ static void remove_one(struct pci_dev *pdev)set_bit (MLX5_BREAK_FW_WAIT , &dev->intf_state);devlink_unregister (devlink);mlx5_sriov_disable (pdev); +mlx5_thermal_uninit (dev);mlx5_crdump_disable (dev);mlx5_drain_health_wq (dev);mlx5_uninit_one (dev);
drivers/net/ethernet/mellanox/mlx5/core/thermal.c new file +108 -0
108 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/thermal.h new file +20 -0
@@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB +* Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. +*/ +#ifndef __MLX5_THERMAL_DRIVER_H +#define __MLX5_THERMAL_DRIVER_H + +#if IS_ENABLED (CONFIG_THERMAL ) +int mlx5_thermal_init (struct mlx5_core_dev *mdev); +void mlx5_thermal_uninit (struct mlx5_core_dev *mdev); +#else +static inline int mlx5_thermal_init (struct mlx5_core_dev *mdev) +{ + mdev->thermal =NULL ; +return 0 ; +} + +static inline void mlx5_thermal_uninit (struct mlx5_core_dev *mdev) { } +#endif + +#endif /* __MLX5_THERMAL_DRIVER_H */
include/linux/mlx5/driver.h +3 -0
@@ -134,6 +134,7 @@ enum {MLX5_REG_PCAM =0x507f ,MLX5_REG_NODE_DESC =0x6001 ,MLX5_REG_HOST_ENDIANNESS =0x7004 , +MLX5_REG_MTMP =0x900A ,MLX5_REG_MCIA =0x9014 ,MLX5_REG_MFRL =0x9028 , MLX5_REG_MLCR = 0x902b,
@@ -731,6 +732,7 @@ struct mlx5_fw_tracer;struct mlx5_vxlan ;struct mlx5_geneve ;struct mlx5_hv_vhca ; +struct mlx5_thermal ;#define MLX5_LOG_SW_ICM_BLOCK_SIZE (dev) (MLX5_CAP_DEV_MEM(dev, log_sw_icm_alloc_granularity))#define MLX5_SW_ICM_BLOCK_SIZE (dev) (1 << MLX5_LOG_SW_ICM_BLOCK_SIZE(dev))
@@ -808,6 +810,7 @@ struct mlx5_core_dev {struct mlx5_rsc_dump *rsc_dump;u32 vsc_addr;struct mlx5_hv_vhca *hv_vhca; +struct mlx5_thermal *thermal; };struct mlx5_db {
include/linux/mlx5/mlx5_ifc.h +26 -0
@@ -10869,6 +10869,31 @@ struct mlx5_ifc_mrtc_reg_bits {u8 time_l[0x20 ]; }; +struct mlx5_ifc_mtmp_reg_bits { +u8 reserved_at_0[0x14 ]; +u8 sensor_index[0xc ]; + +u8 reserved_at_20[0x10 ]; +u8 temperature[0x10 ]; + +u8 mte[0x1 ]; +u8 mtr[0x1 ]; +u8 reserved_at_42[0xe ]; +u8 max_temperature[0x10 ]; + +u8 tee[0x2 ]; +u8 reserved_at_62[0xe ]; +u8 temp_threshold_hi[0x10 ]; + +u8 reserved_at_80[0x10 ]; +u8 temp_threshold_lo[0x10 ]; + +u8 reserved_at_a0[0x20 ]; + +u8 sensor_name_hi[0x20 ]; +u8 sensor_name_lo[0x20 ]; +}; +union mlx5_ifc_ports_control_registers_document_bits {struct mlx5_ifc_bufferx_reg_bits bufferx_reg;struct mlx5_ifc_eth_2819_cntrs_grp_data_layout_bits eth_2819_cntrs_grp_data_layout;
@@ -10931,6 +10956,7 @@ union mlx5_ifc_ports_control_registers_document_bits {struct mlx5_ifc_mfrl_reg_bits mfrl_reg;struct mlx5_ifc_mtutc_reg_bits mtutc_reg;struct mlx5_ifc_mrtc_reg_bits mrtc_reg; +struct mlx5_ifc_mtmp_reg_bits mtmp_reg;u8 reserved_at_0[0x60e0 ]; };
Signature · 1 line
2.39.2
PATCH 5/15 net/mlx5e: Correct SKB room check to use all room in the fifo
In reply to Saeed MahameedFrom: Rahul Rameshbabu <[email protected]>
Previous check was comparing against the fifo mask. The mask is size of the fifo (power of two) minus one, so a less than or equal comparator should be used for checking if the fifo has room for the SKB.
--- drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h +1 -1
@@ -86,7 +86,7 @@ void mlx5e_free_txqsq_descs(struct mlx5e_txqsq *sq);static inline bool mlx5e_skb_fifo_has_room (struct mlx5e_skb_fifo *fifo) { -return (u16)(*fifo->pc - *fifo->cc) < fifo->mask; +return (u16)(*fifo->pc - *fifo->cc) <= fifo->mask; } static inline bool
Signature · 1 line
2.39.2
Jakub Kicinski
maintainerRe: [net-next 05/15] net/mlx5e: Correct SKB room check to use all room in the fifo
Quoted 1 line · On Mon, 13 Mar 2023 22:42:24 -0700 Saeed Mahameed wrote:
Subject: [net-next 05/15] net/mlx5e: Correct SKB room check to use all room in the fifo
net/mlx5e: utilize the entire fifo
Quoted 7 lines
From: Rahul Rameshbabu <[email protected]>
Previous check was comparing against the fifo mask. The mask is size of the fifo (power of two) minus one, so a less than or equal comparator should be used for checking if the fifo has room for the SKB.
Fixes 19b43a432e3e ("net/mlx5e: Extend SKB room check to include PTP-SQ")
no fixes tag
I thought we've been over this.
Jakub Kicinski
maintainerRe: [net-next 05/15] net/mlx5e: Correct SKB room check to use all room in the fifo
Quoted 11 lines · On Wed, 15 Mar 2023 21:56:41 -0700 Jakub Kicinski wrote:
Quoted 1 line · On Mon, 13 Mar 2023 22:42:24 -0700 Saeed Mahameed wrote:
Subject: [net-next 05/15] net/mlx5e: Correct SKB room check to use all room in the fifo
net/mlx5e: utilize the entire fifo
Quoted 6 lines
From: Rahul Rameshbabu <[email protected]>
Previous check was comparing against the fifo mask. The mask is size of the fifo (power of two) minus one, so a less than or equal comparator should be used for checking if the fifo has room for the SKB.
Quoted 5 lines
Quoted 1 line
Fixes 19b43a432e3e ("net/mlx5e: Extend SKB room check to include PTP-SQ")no fixes tag
I thought we've been over this.
The rest looks fine, do you want me to apply from the list and fix up?
Re: [net-next 05/15] net/mlx5e: Correct SKB room check to use all room in the fifo
Quoted 12 lines · Jakub Kicinski
Quoted 11 lines · On Wed, 15 Mar 2023 21:56:41 -0700 Jakub Kicinski wrote:
Quoted 1 line · On Mon, 13 Mar 2023 22:42:24 -0700 Saeed Mahameed wrote:
Subject: [net-next 05/15] net/mlx5e: Correct SKB room check to use all room in the fifo
net/mlx5e: utilize the entire fifo
Quoted 6 lines
From: Rahul Rameshbabu <[email protected]>
Previous check was comparing against the fifo mask. The mask is size of the fifo (power of two) minus one, so a less than or equal comparator should be used for checking if the fifo has room for the SKB.
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
Fixes 19b43a432e3e ("net/mlx5e: Extend SKB room check to include PTP-SQ")no fixes tag
I thought we've been over this.
Sorry it wasn't clear to me that it was about the Fixes tag, I thought the issue was with targeting the net branch.
Quoted 2 lines
The rest looks fine, do you want me to apply from the list and fix up?
Yes that works, Thank you.
Jakub Kicinski
maintainerRe: [net-next 05/15] net/mlx5e: Correct SKB room check to use all room in the fifo
Quoted 6 lines · On Wed, 15 Mar 2023 22:05:41 -0700 Saeed Mahameed wrote:
Quoted 3 lines
Quoted 3 lines
no fixes tag
I thought we've been over this.
Sorry it wasn't clear to me that it was about the Fixes tag, I thought the issue was with targeting the net branch.
Mostly about it getting into stable, the process is a bit unpredictable.
Quoted 3 lines
Quoted 1 line
The rest looks fine, do you want me to apply from the list and fix up?
Yes that works, Thank you.
Will do.
PATCH 6/15 net/mlx5e: Rename RQ/SQ adaptive moderation state flag
In reply to Saeed MahameedFrom: Adham Faris <[email protected]>
Dynamic interrupt moderation RQ and SQ feature represented by MLX5E_RQ_STATE_AM and MLX5E_SQ_STATE_AM enums respectively, is not consistent with the feature naming in the driver, and with the formal feature and library names.
Hence, change MLX5E_RQ_STATE_AM and MLX5E_SQ_STATE_AM enum type names in core/en.h to MLX5E_RQ_STATE_DIM and MLX5E_SQ_STATE_DIM respectively.
--- drivers/net/ethernet/mellanox/mlx5/core/en.h | 4 ++-- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 4 ++-- drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en.h +2 -2
@@ -339,7 +339,7 @@ static inline u8 mlx5e_get_dcb_num_tc(struct mlx5e_params *params)enum {MLX5E_RQ_STATE_ENABLED ,MLX5E_RQ_STATE_RECOVERING , -MLX5E_RQ_STATE_AM , +MLX5E_RQ_STATE_DIM ,MLX5E_RQ_STATE_NO_CSUM_COMPLETE ,MLX5E_RQ_STATE_CSUM_FULL ,/* cqe_csum_full hw bit is set */ MLX5E_RQ_STATE_MINI_CQE_HW_STRIDX ,/* set when mini_cqe_resp_stride_index cap is used */
@@ -390,7 +390,7 @@ enum {MLX5E_SQ_STATE_MPWQE ,MLX5E_SQ_STATE_RECOVERING ,MLX5E_SQ_STATE_IPSEC , -MLX5E_SQ_STATE_AM , +MLX5E_SQ_STATE_DIM ,MLX5E_SQ_STATE_VLAN_NEED_L2_INLINE ,MLX5E_SQ_STATE_PENDING_XSK_TX , MLX5E_SQ_STATE_PENDING_TLS_RX_RESYNC,
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +2 -2
@@ -1188,7 +1188,7 @@ int mlx5e_open_rq(struct mlx5e_params *params, struct mlx5e_rq_param *param,__set_bit (MLX5E_RQ_STATE_CSUM_FULL , &rq->state);if (params->rx_dim_enabled) -__set_bit (MLX5E_RQ_STATE_AM , &rq->state); +__set_bit (MLX5E_RQ_STATE_DIM , &rq->state);/* We disable csum_complete when XDP is enabled since * XDP programs might manipulate packets which will render
@@ -1664,7 +1664,7 @@ int mlx5e_open_txqsq(struct mlx5e_channel *c, u32 tisn, int txq_ix,mlx5e_set_sq_maxrate (c->netdev, sq, tx_rate);if (params->tx_dim_enabled) - sq->state |=BIT (MLX5E_SQ_STATE_AM ); + sq->state |=BIT (MLX5E_SQ_STATE_DIM );return 0 ;
drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c +2 -2
@@ -51,7 +51,7 @@ static void mlx5e_handle_tx_dim(struct mlx5e_txqsq *sq)struct mlx5e_sq_stats *stats = sq->stats;struct dim_sample dim_sample = {}; -if (unlikely (!test_bit (MLX5E_SQ_STATE_AM , &sq->state))) +if (unlikely (!test_bit (MLX5E_SQ_STATE_DIM , &sq->state)))return ;dim_update_sample (sq->cq.event_ctr, stats->packets, stats->bytes, &dim_sample);
@@ -63,7 +63,7 @@ static void mlx5e_handle_rx_dim(struct mlx5e_rq *rq)struct mlx5e_rq_stats *stats = rq->stats;struct dim_sample dim_sample = {}; -if (unlikely (!test_bit (MLX5E_RQ_STATE_AM , &rq->state))) +if (unlikely (!test_bit (MLX5E_RQ_STATE_DIM , &rq->state)))return ;dim_update_sample (rq->cq.event_ctr, stats->packets, stats->bytes, &dim_sample);
Signature · 1 line
2.39.2
PATCH 7/15 net/mlx5e: Stringify RQ SW state in RQ devlink health diagnostics
In reply to Saeed MahameedFrom: Adham Faris <[email protected]>
One of the parameters that is retrieved/printed as a response to devlink health diagnostics for rx reporter is the RQ SW state.
It's printed as a bitmap decimal number. Printing it as bitmap is problematic and non informative.
In addition User can't count on SW state without accessing the kernel sources (mlx5e rq state enum in en.h).
This patch prints RQ SW state in a textual representation, as a key:
value pairs, where disabled rq states will appear as '0' and enabled ones will appear as '1'.
See below the generated output for rx health diagnostics devlink command:
$ devlink health diagnose auxiliary/mlx5_core.eth.0/65535 reporter rx
Before:
=======================================================================
Common config:
RQ:
type: 2 stride size: 2048 size: 8 ts_format: FRC
CQ:
stride size: 64 size: 1024
RQs:
channel ix: 0 rqn: 4172 HW state: 1 SW state: 37 WQE counter: 7 posted WQEs: 7 cc: 7
CQ:
cqn: 1033 HW status: 0 ci: 0 size: 1024
EQ:
eqn: 7 irqn: 32 vecidx: 0 ci: 2 size: 2048
ICOSQ:
sqn: 4169 HW state: 1 cc: 74 pc: 74 WQE size: 128
CQ:
cqn: 1030 cc: 1 size: 128
channel ix: 1 ...
.
.After:
=======================================================================
Common config:
RQ:
type: 2 stride size: 2048 size: 8 ts_format: FRC
CQ:
stride size: 64 size: 1024
RQs:
channel ix: 0 rqn: 4172 HW state: 1 WQE counter: 7 posted WQEs: 7 cc: 7
SW State:
enabled: 1 recovering: 0 am: 1 no_csum_complete: 0 csum_full: 0 mini_cqe_hw_stridx: 1 shampo: 0 mini_cqe_enhanced: 0
CQ:
cqn: 1033 HW status: 0 ci: 0 size: 1024
EQ:
eqn: 7 irqn: 32 vecidx: 0 ci: 2 size: 2048
ICOSQ:
sqn: 4169 HW state: 1 cc: 74 pc: 74 WQE size: 128
CQ:
cqn: 1030 cc: 1 size: 128
channel: ix: 1 ...
.
.--- drivers/net/ethernet/mellanox/mlx5/core/en.h | 6 ++- .../mellanox/mlx5/core/en/reporter_rx.c | 49 +++++++++++++++++-- 2 files changed, 50 insertions(+), 5 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en.h +5 -1
@@ -336,8 +336,11 @@ static inline u8 mlx5e_get_dcb_num_tc(struct mlx5e_params *params) params->mqprio.num_tc : 1; } +/* Keep this enum consistent with the corresponding strings array +* declared in en/reporter_rx.c +*/ enum { -MLX5E_RQ_STATE_ENABLED , +MLX5E_RQ_STATE_ENABLED =0 ,MLX5E_RQ_STATE_RECOVERING ,MLX5E_RQ_STATE_DIM ,MLX5E_RQ_STATE_NO_CSUM_COMPLETE ,
@@ -345,6 +348,7 @@ enum {MLX5E_RQ_STATE_MINI_CQE_HW_STRIDX ,/* set when mini_cqe_resp_stride_index cap is used */ MLX5E_RQ_STATE_SHAMPO ,/* set when SHAMPO cap is used */ MLX5E_RQ_STATE_MINI_CQE_ENHANCED ,/* set when enhanced mini_cqe_cap is used */ + MLX5E_NUM_RQ_STATES, /* Must be kept last */ }; struct mlx5e_cq {
drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c +45 -4
73 lines not on this page · raw message
Signature · 1 line
2.39.2
PATCH 8/15 net/mlx5e: Expose SQ SW state as part of SQ health diagnostics
In reply to Saeed MahameedFrom: Adham Faris <[email protected]>
Add SQ SW state textual representation to devlink health diagnostics for tx reporter.
SQ SW state can be retrieved by issuing the devlink command below:
$ devlink health diagnose auxiliary/mlx5_core.eth.0/65535 reporter tx
Output
=======================================================================
Common Config:
SQ:
stride size: 64 size: 1024 ts_format: FRC
CQ:
stride size: 64 size: 1024
SQs:
channel ix: 0 tc: 0 txq ix: 0 sqn: 4170 HW state: 1 stopped: false cc: 0 pc: 0
SW State:
enabled: 1 mpwqe: 1 recovering: 0 ipsec: 0 am: 1 vlan_need_l2_inline: 1 pending_xsk_tx: 0 pending_tls_rx_resync: 0 xdp_multibuf: 0
CQ:
cqn: 1031 HW status: 0 ci: 0 size: 1024
EQ:
eqn: 7 irqn: 32 vecidx: 0 ci: 2 size: 2048--- drivers/net/ethernet/mellanox/mlx5/core/en.h | 6 ++- .../mellanox/mlx5/core/en/reporter_tx.c | 46 +++++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/en.h +5 -1
@@ -389,8 +389,11 @@ struct mlx5e_sq_dma {enum mlx5e_dma_map_type type; }; +/* Keep this enum consistent with with the corresponding strings array +* declared in en/reporter_tx.c +*/ enum { -MLX5E_SQ_STATE_ENABLED , +MLX5E_SQ_STATE_ENABLED =0 ,MLX5E_SQ_STATE_MPWQE ,MLX5E_SQ_STATE_RECOVERING ,MLX5E_SQ_STATE_IPSEC ,
@@ -399,6 +402,7 @@ enum {MLX5E_SQ_STATE_PENDING_XSK_TX ,MLX5E_SQ_STATE_PENDING_TLS_RX_RESYNC ,MLX5E_SQ_STATE_XDP_MULTIBUF , + MLX5E_NUM_SQ_STATES, /* Must be kept last */ }; struct mlx5e_tx_mpwqe {
drivers/net/ethernet/mellanox/mlx5/core/en/reporter_tx.c +46 -0
64 lines not on this page · raw message
Signature · 1 line
2.39.2
PATCH 9/15 net/mlx5e: Add XSK RQ state flag for RQ devlink health diagnostics
In reply to Saeed MahameedFrom: Adham Faris <[email protected]>
Currently RQ health diagnostics doesn't inform the user whether an RQ is an XSK RQ or not.
Address this, by adding XSK state flag to RQ SW state enum in core/en.h. XSK will be '1' if current RQ is an XSK RQ, and it will be '0' if it's not.
In this example below, it can be seen that XSK field value is '1' since xdpsock program have been attached to channel 0 before issuing the devlink query command:
$ devlink health diagnose auxiliary/mlx5_core.eth.0/65535 reporter rx
Output:
=======================================================================
Common config:
RQ:
type: 2 stride size: 4096 size: 16 ts_format: FRC
CQ:
stride size: 64 size: 1024
RQs:
channel ix: 0 rqn: 4236 HW state: 1 WQE counter: 15 posted WQEs: 15 cc: 15
SW State:
enabled: 1 recovering: 0 am: 1 no_csum_complete: 1 csum_full: 0 mini_cqe_hw_stridx: 1 shampo: 0 mini_cqe_enhanced: 0 xsk: 1
CQ:
cqn: 1085 HW status: 0 ci: 0 size: 1024
EQ:
eqn: 7 irqn: 32 vecidx: 0 ci: 5 size: 2048
ICOSQ:
sqn: 4229 HW state: 1 cc: 158 pc: 158 WQE size: 2048
CQ:
cqn: 1080 cc: 1 size: 2048--- drivers/net/ethernet/mellanox/mlx5/core/en.h | 1 + .../net/ethernet/mellanox/mlx5/core/en/reporter_rx.c | 1 + drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c | 10 ++++++++-- 3 files changed, 10 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en.h +1 -0
@@ -348,6 +348,7 @@ enum {MLX5E_RQ_STATE_MINI_CQE_HW_STRIDX ,/* set when mini_cqe_resp_stride_index cap is used */ MLX5E_RQ_STATE_SHAMPO ,/* set when SHAMPO cap is used */ MLX5E_RQ_STATE_MINI_CQE_ENHANCED ,/* set when enhanced mini_cqe_cap is used */ +MLX5E_RQ_STATE_XSK ,/* set to indicate an xsk rq */ MLX5E_NUM_RQ_STATES, /* Must be kept last */ };
drivers/net/ethernet/mellanox/mlx5/core/en/reporter_rx.c +1 -0
@@ -18,6 +18,7 @@ static const char * const rq_sw_state_type_name[] = { [MLX5E_RQ_STATE_MINI_CQE_HW_STRIDX] = "mini_cqe_hw_stridx", [MLX5E_RQ_STATE_SHAMPO] = "shampo", [MLX5E_RQ_STATE_MINI_CQE_ENHANCED] = "mini_cqe_enhanced", + [MLX5E_RQ_STATE_XSK] = "xsk", };static int mlx5e_query_rq_state (struct mlx5_core_dev *dev,u32 rqn,u8 *state)
drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c +8 -2
@@ -93,13 +93,19 @@ static int mlx5e_open_xsk_rq(struct mlx5e_channel *c, struct mlx5e_params *param struct mlx5e_rq_param *rq_params, struct xsk_buff_pool *pool, struct mlx5e_xsk_param *xsk) { + struct mlx5e_rq *xskrq = &c->xskrq;int err; - err =mlx5e_init_xsk_rq (c, params, pool, xsk, &c->xskrq); + err =mlx5e_init_xsk_rq (c, params, pool, xsk, xskrq);if (err)return err; -return mlx5e_open_rq (params, rq_params, xsk,cpu_to_node (c->cpu), &c->xskrq); + err =mlx5e_open_rq (params, rq_params, xsk,cpu_to_node (c->cpu), xskrq); +if (err) +return err; + +__set_bit (MLX5E_RQ_STATE_XSK , &xskrq->state); +return 0 ; } int mlx5e_open_xsk(struct mlx5e_priv *priv, struct mlx5e_params *params,
Signature · 1 line
2.39.2
PATCH 10/15 net/mlx5: Move needed PTYS functions to core layer
In reply to Saeed MahameedFrom: Gal Pressman <[email protected]>
Downstream patches require devlink params to access the PTYS register, move the needed functions from mlx5e to the core layer.
--- .../ethernet/mellanox/mlx5/core/en/params.c | 2 +- .../net/ethernet/mellanox/mlx5/core/en/port.c | 157 +----------------- .../net/ethernet/mellanox/mlx5/core/en/port.h | 14 -- .../ethernet/mellanox/mlx5/core/en_ethtool.c | 12 +- .../net/ethernet/mellanox/mlx5/core/en_tc.c | 2 +- .../net/ethernet/mellanox/mlx5/core/esw/qos.c | 2 +- .../net/ethernet/mellanox/mlx5/core/port.c | 151 +++++++++++++++++ include/linux/mlx5/port.h | 16 ++ 8 files changed, 179 insertions(+), 177 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/params.c +1 -1
@@ -553,7 +553,7 @@ bool slow_pci_heuristic(struct mlx5_core_dev *mdev)u32 link_speed =0 ;u32 pci_bw =0 ; -mlx5e_port_max_linkspeed (mdev, &link_speed); +mlx5_port_max_linkspeed (mdev, &link_speed); pci_bw =pcie_bandwidth_available (mdev->pdev,NULL ,NULL ,NULL );mlx5_core_dbg_once (mdev,"Max link speed = %d, PCI BW = %d\n" , link_speed, pci_bw);
drivers/net/ethernet/mellanox/mlx5/core/en/port.c +3 -154
187 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/en/port.h +0 -14
@@ -36,25 +36,11 @@#include <linux/mlx5/driver.h> #include "en.h" -struct mlx5e_port_eth_proto { -u32 cap; -u32 admin; -u32 oper; -}; - -int mlx5_port_query_eth_proto (struct mlx5_core_dev *dev,u8 port,bool ext, -struct mlx5e_port_eth_proto *eproto);void mlx5_port_query_eth_autoneg (struct mlx5_core_dev *dev,u8 *an_status,u8 *an_disable_cap,u8 *an_disable_admin);int mlx5_port_set_eth_ptys (struct mlx5_core_dev *dev,bool an_disable,u32 proto_admin,bool ext); -u32 mlx5e_port_ptys2speed (struct mlx5_core_dev *mdev,u32 eth_proto_oper, -bool force_legacy);int mlx5e_port_linkspeed (struct mlx5_core_dev *mdev,u32 *speed); -int mlx5e_port_max_linkspeed (struct mlx5_core_dev *mdev,u32 *speed); -u32 mlx5e_port_speed2linkmodes (struct mlx5_core_dev *mdev,u32 speed, -bool force_legacy); -bool mlx5e_ptys_ext_supported (struct mlx5_core_dev *mdev);int mlx5e_port_query_pbmc (struct mlx5_core_dev *mdev,void *out);int mlx5e_port_set_pbmc (struct mlx5_core_dev *mdev,void *in); int mlx5e_port_query_sbpr(struct mlx5_core_dev *mdev, u32 desc, u8 dir,
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +6 -6
@@ -220,7 +220,7 @@ static void mlx5e_ethtool_get_speed_arr(struct mlx5_core_dev *mdev,struct ptys2ethtool_config **arr, u32 *size) { - bool ext = mlx5e_ptys_ext_supported(mdev); + bool ext = mlx5_ptys_ext_supported(mdev); *arr = ext ? ptys2ext_ethtool_table : ptys2legacy_ethtool_table; *size = ext ? ARRAY_SIZE(ptys2ext_ethtool_table) :
@@ -895,7 +895,7 @@ static void get_speed_duplex(struct net_device *netdev,if (!netif_carrier_ok (netdev)) goto out; - speed =mlx5e_port_ptys2speed (priv->mdev, eth_proto_oper, force_legacy); + speed =mlx5_port_ptys2speed (priv->mdev, eth_proto_oper, force_legacy);if (!speed) {if (data_rate_oper) speed =100 * data_rate_oper;
@@ -980,7 +980,7 @@ static void get_lp_advertising(struct mlx5_core_dev *mdev, u32 eth_proto_lp, struct ethtool_link_ksettings *link_ksettings) {unsigned long *lp_advertising = link_ksettings->link_modes.lp_advertising; -bool ext =mlx5e_ptys_ext_supported (mdev); +bool ext =mlx5_ptys_ext_supported (mdev);ptys2ethtool_adver_link (lp_advertising, eth_proto_lp, ext); }
@@ -1160,7 +1160,7 @@ int mlx5e_ethtool_set_link_ksettings(struct mlx5e_priv *priv, const struct ethtool_link_ksettings *link_ksettings) {struct mlx5_core_dev *mdev = priv->mdev; -struct mlx5e_port_eth_proto eproto; +struct mlx5_port_eth_proto eproto;const unsigned long *adver;bool an_changes = false;u8 an_disable_admin;
@@ -1180,7 +1180,7 @@ int mlx5e_ethtool_set_link_ksettings(struct mlx5e_priv *priv, autoneg = link_ksettings->base.autoneg; speed = link_ksettings->base.speed; - ext_supported =mlx5e_ptys_ext_supported (mdev); + ext_supported =mlx5_ptys_ext_supported (mdev); ext =ext_requested (autoneg, adver, ext_supported);if (!ext_supported && ext)return -EOPNOTSUPP ;
@@ -1194,7 +1194,7 @@ int mlx5e_ethtool_set_link_ksettings(struct mlx5e_priv *priv, goto out; } link_modes = autoneg ==AUTONEG_ENABLE ?ethtool2ptys_adver_func (adver) : -mlx5e_port_speed2linkmodes (mdev, speed, !ext); +mlx5_port_speed2linkmodes (mdev, speed, !ext); err =mlx5e_speed_validate (priv->netdev, ext, link_modes, autoneg);if (err)
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +1 -1
@@ -1108,7 +1108,7 @@ mlx5e_hairpin_params_init(struct mlx5e_hairpin_params *hairpin_params, hairpin_params->mdev = mdev;/* set hairpin pair per each 50Gbs share of the link */ -mlx5e_port_max_linkspeed (mdev, &link_speed); +mlx5_port_max_linkspeed (mdev, &link_speed); link_speed =max_t (u32, link_speed,50000 ); link_speed64 = link_speed;do_div (link_speed64,50000 );
drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c +1 -1
@@ -744,7 +744,7 @@ static int esw_qos_devlink_rate_to_mbps(struct mlx5_core_dev *mdev, const char *u64 value;int err; - err =mlx5e_port_max_linkspeed (mdev, &link_speed_max); + err =mlx5_port_max_linkspeed (mdev, &link_speed_max);if (err) {NL_SET_ERR_MSG_MOD (extack,"Failed to get link maximum speed" );return err;
drivers/net/ethernet/mellanox/mlx5/core/port.c +151 -0
154 lines not on this page · raw message
include/linux/mlx5/port.h +16 -0
@@ -141,6 +141,12 @@ enum mlx5_ptys_width { MLX5_PTYS_WIDTH_12X = 1 << 4, }; +struct mlx5_port_eth_proto { +u32 cap; +u32 admin; +u32 oper; +}; +#define MLX5E_PROT_MASK (link_mode) (1U << link_mode)#define MLX5_GET_ETH_PROTO (reg, out, ext, field) \ (ext ? MLX5_GET(reg, out, ext_##field) : \
@@ -218,4 +224,14 @@ int mlx5_set_trust_state(struct mlx5_core_dev *mdev, u8 trust_state);int mlx5_query_trust_state (struct mlx5_core_dev *mdev,u8 *trust_state);int mlx5_set_dscp2prio (struct mlx5_core_dev *mdev,u8 dscp,u8 prio);int mlx5_query_dscp2prio (struct mlx5_core_dev *mdev,u8 *dscp2prio); + +int mlx5_port_query_eth_proto (struct mlx5_core_dev *dev,u8 port,bool ext, +struct mlx5_port_eth_proto *eproto); +bool mlx5_ptys_ext_supported (struct mlx5_core_dev *mdev); +u32 mlx5_port_ptys2speed (struct mlx5_core_dev *mdev,u32 eth_proto_oper, +bool force_legacy); +u32 mlx5_port_speed2linkmodes (struct mlx5_core_dev *mdev,u32 speed, +bool force_legacy); +int mlx5_port_max_linkspeed (struct mlx5_core_dev *mdev,u32 *speed); +#endif /* __MLX5_PORT_H__ */
Signature · 1 line
2.39.2
PATCH 11/15 net/mlx5e: Add devlink hairpin queues parameters
In reply to Saeed MahameedFrom: Gal Pressman <[email protected]>
We refer to a TC NIC rule that involves forwarding as "hairpin". Hairpin queues are mlx5 hardware specific implementation for hardware forwarding of such packets.
Per the discussion in [1], move the hairpin queues control (number and size) from debugfs to devlink.
Expose two devlink params:
- hairpin_num_queues: control the number of hairpin queues
- hairpin_queue_size: control the size (in packets) of the hairpin queues
[1] https://lore.kernel.org/all/[email protected]/
--- .../ethernet/mellanox/mlx5/devlink.rst | 35 ++++++++++ Documentation/networking/devlink/mlx5.rst | 12 ++++ .../net/ethernet/mellanox/mlx5/core/devlink.c | 66 +++++++++++++++++++ .../net/ethernet/mellanox/mlx5/core/devlink.h | 2 + .../net/ethernet/mellanox/mlx5/core/en_tc.c | 50 ++++++-------- 5 files changed, 134 insertions(+), 31 deletions(-)
Documentation/networking/device_drivers/ethernet/mellanox/mlx5/devlink.rst +35 -0
@@ -122,6 +122,41 @@ users try to enable them. $ devlink dev eswitch set pci/0000:06:00.0 mode switchdev +hairpin_num_queues: Number of hairpin queues +-------------------------------------------- +We refer to a TC NIC rule that involves forwarding as "hairpin". + +Hairpin queues are mlx5 hardware specific implementation for hardware +forwarding of such packets. + +- Show the number of hairpin queues:: + + $ devlink dev param show pci/0000:06:00.0 name hairpin_num_queues + pci/0000:06:00.0: + name hairpin_num_queues type driver-specific + values: + cmode driverinit value 2 + +- Change the number of hairpin queues:: + + $ devlink dev param set pci/0000:06:00.0 name hairpin_num_queues value 4 cmode driverinit + +hairpin_queue_size: Size of the hairpin queues +---------------------------------------------- +Control the size of the hairpin queues. + +- Show the size of the hairpin queues:: + + $ devlink dev param show pci/0000:06:00.0 name hairpin_queue_size + pci/0000:06:00.0: + name hairpin_queue_size type driver-specific + values: + cmode driverinit value 1024 + +- Change the size (in packets) of the hairpin queues:: + + $ devlink dev param set pci/0000:06:00.0 name hairpin_queue_size value 512 cmode driverinit + Health reporters ================
Documentation/networking/devlink/mlx5.rst +12 -0
@@ -72,6 +72,18 @@ parameters. Default: disabled + * - ``hairpin_num_queues`` + - u32 + - driverinit + - We refer to a TC NIC rule that involves forwarding as "hairpin". + Hairpin queues are mlx5 hardware specific implementation for hardware + forwarding of such packets. + + Control the number of hairpin queues. + * - ``hairpin_queue_size`` + - u32 + - driverinit + - Control the size (in packets) of the hairpin queues. The ``mlx5`` driver supports reloading via ``DEVLINK_CMD_RELOAD``
drivers/net/ethernet/mellanox/mlx5/core/devlink.c +66 -0
84 lines not on this page · raw message
drivers/net/ethernet/mellanox/mlx5/core/devlink.h +2 -0
@@ -12,6 +12,8 @@ enum mlx5_devlink_param_id {MLX5_DEVLINK_PARAM_ID_ESW_LARGE_GROUP_NUM ,MLX5_DEVLINK_PARAM_ID_ESW_PORT_METADATA ,MLX5_DEVLINK_PARAM_ID_ESW_MULTIPORT , +MLX5_DEVLINK_PARAM_ID_HAIRPIN_NUM_QUEUES , + MLX5_DEVLINK_PARAM_ID_HAIRPIN_QUEUE_SIZE, }; struct mlx5_trap_ctx {
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +19 -31
99 lines not on this page · raw message
Signature · 1 line
2.39.2
PATCH 12/15 net/mlx5e: Add more information to hairpin table dump
In reply to Saeed MahameedFrom: Gal Pressman <[email protected]>
Print the number of hairpin queues and size as part of the hairpin table dump.
--- drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +6 -2
@@ -583,6 +583,7 @@ struct mlx5e_hairpin {struct mlx5e_tir direct_tir;int num_channels; +u8 log_num_packets;struct mlx5e_rqt indir_rqt;struct mlx5e_tir indir_tir[MLX5E_NUM_INDIR_TIRS ];struct mlx5_ttc_table *ttc;
@@ -929,6 +930,7 @@ mlx5e_hairpin_create(struct mlx5e_priv *priv, struct mlx5_hairpin_params *params hp->func_mdev = func_mdev; hp->func_priv = priv; hp->num_channels = params->num_channels; + hp->log_num_packets = params->log_num_packets; err =mlx5e_hairpin_create_transport (hp);if (err)
@@ -1070,9 +1072,11 @@ static int debugfs_hairpin_table_dump_show(struct seq_file *file, void *priv)mutex_lock (&tc->hairpin_tbl_lock);hash_for_each (tc->hairpin_tbl, bkt, hpe, hairpin_hlist) -seq_printf (file,"Hairpin peer_vhca_id %u prio %u refcnt %u\n" , +seq_printf (file, +"Hairpin peer_vhca_id %u prio %u refcnt %u num_channels %u num_packets %lu\n" , hpe->peer_vhca_id, hpe->prio, -refcount_read (&hpe->refcnt)); +refcount_read (&hpe->refcnt), hpe->hp->num_channels, +BIT (hpe->hp->log_num_packets));mutex_unlock (&tc->hairpin_tbl_lock);return 0 ;
Signature · 1 line
2.39.2
PATCH 13/15 net/mlx5e: TC, Extract indr setup block checks to function
In reply to Saeed MahameedFrom: Maor Dickman <[email protected]>
In preparation for next patch which will add new check if device block can be setup, extract all existing checks to function to make it more readable and maintainable.
--- .../ethernet/mellanox/mlx5/core/en/rep/tc.c | 58 ++++++++++++------- 1 file changed, 36 insertions(+), 22 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c +36 -22
@@ -426,39 +426,53 @@ static bool mlx5e_rep_macvlan_mode_supported(const struct net_device *dev)return macvlan->mode ==MACVLAN_MODE_PASSTHRU ; } -static int -mlx5e_rep_indr_setup_block (struct net_device *netdev,struct Qdisc *sch, -struct mlx5e_rep_priv *rpriv, -struct flow_block_offload *f, -flow_setup_cb_t *setup_cb, -void *data, -void (*cleanup)(struct flow_block_cb *block_cb)) +static bool +mlx5e_rep_check_indr_block_supported (struct mlx5e_rep_priv *rpriv, +struct net_device *netdev, +struct flow_block_offload *f) {struct mlx5e_priv *priv =netdev_priv (rpriv->netdev);struct mlx5_eswitch *esw = priv->mdev->priv.eswitch; -bool is_ovs_int_port =netif_is_ovs_master (netdev); -struct mlx5e_rep_indr_block_priv *indr_priv; -struct flow_block_cb *block_cb; -if (!mlx5e_tc_tun_device_to_offload (priv, netdev) && - !(is_vlan_dev (netdev) &&vlan_dev_real_dev (netdev) == rpriv->netdev) && - !is_ovs_int_port) { -if (!(netif_is_macvlan (netdev) &&macvlan_dev_real_dev (netdev) == rpriv->netdev)) -return -EOPNOTSUPP ; +if (f->binder_type !=FLOW_BLOCK_BINDER_TYPE_CLSACT_INGRESS && + f->binder_type !=FLOW_BLOCK_BINDER_TYPE_CLSACT_EGRESS ) +return false; + +if (mlx5e_tc_tun_device_to_offload (priv, netdev)) +return true; + +if (is_vlan_dev (netdev) &&vlan_dev_real_dev (netdev) == rpriv->netdev) +return true; + +if (netif_is_macvlan (netdev)) {if (!mlx5e_rep_macvlan_mode_supported (netdev)) {netdev_warn (netdev,"Offloading ingress filter is supported only with macvlan passthru mode" ); -return -EOPNOTSUPP ; +return false; } + +if (macvlan_dev_real_dev (netdev) == rpriv->netdev) +return true; } -if (f->binder_type !=FLOW_BLOCK_BINDER_TYPE_CLSACT_INGRESS && - f->binder_type !=FLOW_BLOCK_BINDER_TYPE_CLSACT_EGRESS ) -return -EOPNOTSUPP ; +if (netif_is_ovs_master (netdev) && f->binder_type ==FLOW_BLOCK_BINDER_TYPE_CLSACT_EGRESS && +mlx5e_tc_int_port_supported (esw)) +return true; -if (f->binder_type ==FLOW_BLOCK_BINDER_TYPE_CLSACT_EGRESS && !is_ovs_int_port) -return -EOPNOTSUPP ; +return false; +} + +static int +mlx5e_rep_indr_setup_block (struct net_device *netdev,struct Qdisc *sch, +struct mlx5e_rep_priv *rpriv, +struct flow_block_offload *f, +flow_setup_cb_t *setup_cb, +void *data, +void (*cleanup)(struct flow_block_cb *block_cb)) +{ +struct mlx5e_rep_indr_block_priv *indr_priv; +struct flow_block_cb *block_cb; -if (is_ovs_int_port && !mlx5e_tc_int_port_supported (esw)) +if (!mlx5e_rep_check_indr_block_supported (rpriv, netdev, f))return -EOPNOTSUPP ; f->unlocked_driver_cb = true;
Signature · 1 line
2.39.2
PATCH 14/15 net/mlx5e: Enable TC offload for ingress MACVLAN over bond
In reply to Saeed MahameedFrom: Maor Dickman <[email protected]>
Support offloading of TC rules that filter ingress traffic from a MACVLAN device, which is attached to bond device.
--- drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c +6 -1
@@ -433,6 +433,7 @@ mlx5e_rep_check_indr_block_supported(struct mlx5e_rep_priv *rpriv, {struct mlx5e_priv *priv =netdev_priv (rpriv->netdev);struct mlx5_eswitch *esw = priv->mdev->priv.eswitch; +struct net_device *macvlan_real_dev;if (f->binder_type !=FLOW_BLOCK_BINDER_TYPE_CLSACT_INGRESS && f->binder_type !=FLOW_BLOCK_BINDER_TYPE_CLSACT_EGRESS )
@@ -450,7 +451,11 @@ mlx5e_rep_check_indr_block_supported(struct mlx5e_rep_priv *rpriv,return false; } -if (macvlan_dev_real_dev (netdev) == rpriv->netdev) + macvlan_real_dev =macvlan_dev_real_dev (netdev); + +if (macvlan_real_dev == rpriv->netdev) +return true; +if (netif_is_bond_master (macvlan_real_dev))return true; }
Signature · 1 line
2.39.2
PATCH 15/15 net/mlx5e: Enable TC offload for egress MACVLAN over bond
In reply to Saeed MahameedFrom: Maor Dickman <[email protected]>
Support offloading of TC rules that mirror/redirect egress traffic to a MACVLAN device, which is attached to bond device which master mlx5 devices.
--- drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/mirred.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/mirred.c +3 -3
@@ -234,6 +234,9 @@ parse_mirred(struct mlx5e_tc_act_parse_state *parse_state,if (mlx5_lag_mpesw_do_mirred (priv->mdev, out_dev, extack))return -EOPNOTSUPP ; +if (netif_is_macvlan (out_dev)) + out_dev =macvlan_dev_real_dev (out_dev); + out_dev =get_fdb_out_dev (uplink_dev, out_dev);if (!out_dev)return -ENODEV ;
@@ -250,9 +253,6 @@ parse_mirred(struct mlx5e_tc_act_parse_state *parse_state,return err; } -if (netif_is_macvlan (out_dev)) - out_dev =macvlan_dev_real_dev (out_dev); - err =verify_uplink_forwarding (priv, attr, out_dev, extack);if (err)return err;
Signature · 1 line
2.39.2