diff mbox series

[net,7/7] net/mlx5e: Fix condition when retrieving PTP-rqn

Message ID 20210907212420.28529-8-saeed@kernel.org (mailing list archive)
State Accepted
Commit 8db6a54f3cae6a803b2cbf5390662bca641f7da8
Delegated to: Netdev Maintainers
Headers show
Series [net,1/7] net/mlx5: Bridge, fix uninitialized variable usage | expand

Checks

Context Check Description
netdev/cover_letter success Pull request
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net
netdev/subject_prefix success Link
netdev/cc_maintainers success CCed 3 of 3 maintainers
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link

Commit Message

Saeed Mahameed Sept. 7, 2021, 9:24 p.m. UTC
From: Aya Levin <ayal@nvidia.com>

When activating the PTP-RQ, redirect the RQT from drop-RQ to PTP-RQ.
Use mlx5e_channels_get_ptp_rqn to retrieve the rqn. This helper returns
a boolean (not status), hence caller should consider return value 0 as a
fail. Change the caller interpretation of the return value.

Fixes: 43ec0f41fa73 ("net/mlx5e: Hide all implementation details of mlx5e_rx_res")
Signed-off-by: Aya Levin <ayal@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en/rx_res.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jakub Kicinski Sept. 8, 2021, 4:39 p.m. UTC | #1
On Tue,  7 Sep 2021 14:24:20 -0700 Saeed Mahameed wrote:
> From: Aya Levin <ayal@nvidia.com>
> 
> When activating the PTP-RQ, redirect the RQT from drop-RQ to PTP-RQ.
> Use mlx5e_channels_get_ptp_rqn to retrieve the rqn. This helper returns
> a boolean (not status), hence caller should consider return value 0 as a
> fail. Change the caller interpretation of the return value.

It would be really great to turn down the dial on the abbreviations and
add some user-visible impact, as is best practice (some would say a
requirement) for fixes.

I've been following the PTP work in mlx5 a little bit but I have no idea
what a RQT is and what kind of issues to expect without this patch.
Saeed Mahameed Sept. 8, 2021, 5:34 p.m. UTC | #2
On Wed, 2021-09-08 at 09:39 -0700, Jakub Kicinski wrote:
> On Tue,  7 Sep 2021 14:24:20 -0700 Saeed Mahameed wrote:
> > From: Aya Levin <ayal@nvidia.com>
> > 
> > When activating the PTP-RQ, redirect the RQT from drop-RQ to PTP-
> > RQ.
> > Use mlx5e_channels_get_ptp_rqn to retrieve the rqn. This helper
> > returns
> > a boolean (not status), hence caller should consider return value 0
> > as a
> > fail. Change the caller interpretation of the return value.
> 
> It would be really great to turn down the dial on the abbreviations
> and
> add some user-visible impact, as is best practice (some would say a
> requirement) for fixes.
> 

Ack and agreed ! I will enforce this.

> I've been following the PTP work in mlx5 a little bit but I have no
> idea
> what a RQT is and what kind of issues to expect without this patch.

RQT is a simple RQ Table; where we group rq numbers in one table object
so steering and RSS objects can point to a table of RQs.

To simplify driver code: 
 1. we use RQT objects also for single RQ destinations.
 2. HW/FW do not allow destroying RQs when they are directly being
referenced by Steering rules. RQTs help keeping steering objects
pointing to a valid RQT object  while driver is destroying RQs, while
re-configuring, we just swap the rq number in the RQT with the new
configuration RQs, or when device is deactivated (ifconfig down) we
just swap all RQ numbers in all RQTs with the "Drop RQ"
diff mbox series

Patch

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/rx_res.c b/drivers/net/ethernet/mellanox/mlx5/core/en/rx_res.c
index bf0313e2682b..13056cb9757d 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/rx_res.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/rx_res.c
@@ -572,7 +572,7 @@  void mlx5e_rx_res_channels_activate(struct mlx5e_rx_res *res, struct mlx5e_chann
 	if (res->features & MLX5E_RX_RES_FEATURE_PTP) {
 		u32 rqn;
 
-		if (mlx5e_channels_get_ptp_rqn(chs, &rqn))
+		if (!mlx5e_channels_get_ptp_rqn(chs, &rqn))
 			rqn = res->drop_rqn;
 
 		err = mlx5e_rqt_redirect_direct(&res->ptp.rqt, rqn);