DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Bulatov Mark <ms.bulatov7@gmail.com>
To: "Niklas Söderlund" <niklas.soderlund@corigine.com>,
	"Chaoyong He" <chaoyong.he@corigine.com>
Cc: dev@dpdk.org, stable@dpdk.org, Mark Bulatov <ms.bulatov7@gmail.com>
Subject: [PATCH] net/nfp: fix wrong argument order in nfp_encode_basic
Date: Fri, 13 Nov 2026 17:28:23 +0300	[thread overview]
Message-ID: <20261113142823.5918-1-ms.bulatov7@gmail.com> (raw)

The function nfp_encode_basic_qdr() takes cpp_tgt as its second argument
and dest_island as its third. However, the implementation of this function
implies the opposite: dest_island should be the second argument, and
cpp_tgt the third.

Furthermore, the implementation compares the second argument against a
negative value, whereas the cpp_tgt parameter — as defined in the
nfp_target.h header file—consists of a set of values ​​that does not
include any negative numbers. The situation is exactly the reverse for
the nfp_decode_basic() function, which receives a value for which these
definitions are not entirely appropriate.

Fix this by swapping the arguments.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: e6858e7e7c ("net/nfp: move shared target logic to own file")
Cc: stable@dpdk.org

Signed-off-by: Mark Bulatov <ms.bulatov7@gmail.com>
---
 drivers/net/nfp/nfpcore/nfp_target.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/nfp/nfpcore/nfp_target.c b/drivers/net/nfp/nfpcore/nfp_target.c
index 0e7a5cbb05..239ffff869 100644
--- a/drivers/net/nfp/nfpcore/nfp_target.c
+++ b/drivers/net/nfp/nfpcore/nfp_target.c
@@ -728,7 +728,7 @@ nfp_encode_basic(uint64_t *addr,
 			 * address but we can verify if the existing contents
 			 * will point to a valid island.
 			 */
-			return nfp_encode_basic_qdr(*addr, cpp_tgt, dest_island,
+			return nfp_encode_basic_qdr(*addr, dest_island, cpp_tgt,
 					mode, addr40, isld1, isld0);
 		}
 
@@ -741,7 +741,7 @@ nfp_encode_basic(uint64_t *addr,
 		return 0;
 	case 1:
 		if (cpp_tgt == NFP_CPP_TARGET_QDR && addr40 == 0) {
-			return nfp_encode_basic_qdr(*addr, cpp_tgt, dest_island,
+			return nfp_encode_basic_qdr(*addr, dest_island, cpp_tgt,
 					mode, addr40, isld1, isld0);
 		}
 
@@ -763,7 +763,7 @@ nfp_encode_basic(uint64_t *addr,
 		if (cpp_tgt == NFP_CPP_TARGET_QDR && addr40 == 0) {
 			/* iid<0> = addr<30> = channel<0> */
 			/* channel<1> = addr<31> = Index */
-			return nfp_encode_basic_qdr(*addr, cpp_tgt, dest_island,
+			return nfp_encode_basic_qdr(*addr, dest_island, cpp_tgt,
 					mode, addr40, isld1, isld0);
 		}
 
@@ -786,7 +786,7 @@ nfp_encode_basic(uint64_t *addr,
 			 * iid<1> = addr<30> = channel<0>
 			 * channel<1> = addr<31> = Index
 			 */
-			return nfp_encode_basic_qdr(*addr, cpp_tgt, dest_island,
+			return nfp_encode_basic_qdr(*addr, dest_island, cpp_tgt,
 					mode, addr40, isld1, isld0);
 		}
 
-- 
2.39.5


             reply	other threads:[~2026-11-13 16:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13 14:28 Bulatov Mark [this message]
2026-11-15 21:48 ` [PATCH] net/nfp: fix wrong argument order in nfp_encode_basic Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261113142823.5918-1-ms.bulatov7@gmail.com \
    --to=ms.bulatov7@gmail.com \
    --cc=chaoyong.he@corigine.com \
    --cc=dev@dpdk.org \
    --cc=niklas.soderlund@corigine.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox