DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Omar Munchaev <omarmunchaev@gmail.com>
To: dev@dpdk.org
Cc: Omar Munchaev <omar.munchaev@gmail.com>,
	Bruce Richardson <bruce.richardson@intel.com>,
	Anatoly Burakov <anatoly.burakov@intel.com>
Subject: [PATCH] net/ice: use macros to get field values
Date: Tue, 29 Sep 2026 00:27:59 +0700	[thread overview]
Message-ID: <20260928172759.3369704-2-omar.munchaev@gmail.com> (raw)
In-Reply-To: <20260928172759.3369704-1-omar.munchaev@gmail.com>

Currently, in ice_check_fdir_programming_status,
descriptor fields are accessed through direct
bit mask manipulation and shifts.
The ice driver has macros for this, so rewrite the function
to use FIELD_GET macros instead.

Signed-off-by: Omar Munchaev <omar.munchaev@gmail.com>
---
 drivers/net/intel/ice/ice_rxtx.c | 37 ++++++++++++--------------------
 1 file changed, 14 insertions(+), 23 deletions(-)

diff --git a/drivers/net/intel/ice/ice_rxtx.c b/drivers/net/intel/ice/ice_rxtx.c
index 882af80833..f14e5e56b5 100644
--- a/drivers/net/intel/ice/ice_rxtx.c
+++ b/drivers/net/intel/ice/ice_rxtx.c
@@ -4465,36 +4465,27 @@ static inline int
 ice_check_fdir_programming_status(struct ci_rx_queue *rxq)
 {
 	volatile union ci_rx_flex_desc *rxdp;
-	uint16_t qword1;
-	uint16_t rx_status;
-	uint16_t error;
-	uint16_t id;
+	uint32_t stat_err, error, id
 	int ret = -EAGAIN;
 
 	rxdp = &rxq->rx_flex_ring[rxq->rx_tail];
-	qword1 = rte_le_to_cpu_16(rxdp->wb.status_error0);
-	rx_status = (qword1 & ICE_RXD_QW1_STATUS_M)
-			>> ICE_RXD_QW1_STATUS_S;
-
-	if (rx_status & (1 << ICE_RX_DESC_STATUS_DD_S)) {
-		ret = 0;
-		error = (qword1 & ICE_RX_PROG_STATUS_DESC_WB_QW1_FAIL_M) >>
-			ICE_RX_PROG_STATUS_DESC_WB_QW1_FAIL_S;
-		id = (qword1 & ICE_RX_PROG_STATUS_DESC_WB_QW1_PROGID_M) >>
-			ICE_RX_PROG_STATUS_DESC_WB_QW1_PROGID_S;
-		if (error) {
-			if (id == ICE_RX_PROG_STATUS_DESC_WB_QW1_PROG_ADD)
-				PMD_DRV_LOG(ERR, "Failed to add FDIR rule.");
-			else if (id == ICE_RX_PROG_STATUS_DESC_WB_QW1_PROG_DEL)
-				PMD_DRV_LOG(ERR, "Failed to remove FDIR rule.");
+	stat_err = rte_le_to_cpu_16(rxdp->wb.status_error0);
+	if (FIELD_GET(ICE_FXD_FLTR_WB_QW1_DD_M, stat_err) == ICE_FXD_FLTR_WB_QW1_DD_YES) {
+		id = FIELD_GET(ICE_FXD_FLTR_WB_QW1_PROG_ID_M, stat_err);
+		error = FIELD_GET(ICE_FXD_FLTR_WB_QW1_FAIL_M, stat_err);
+		if (error == ICE_FXD_FLTR_WB_QW1_FAIL_YES) {
+			if (id == ICE_FXD_FLTR_WB_QW1_PROG_ADD)
+				PMD_DRV_LOG(ERR, "Failed to add FDIR rule due to no space in the table");
+			else
+				PMD_DRV_LOG(ERR, "Failed to remove FDIR rule, attempt to remove non-existent entry");
 			ret = -EINVAL;
 			goto err;
 		}
-		error = (qword1 & ICE_RX_PROG_STATUS_DESC_WB_QW1_FAIL_PROF_M) >>
-			ICE_RX_PROG_STATUS_DESC_WB_QW1_FAIL_PROF_S;
-		if (error) {
-			PMD_DRV_LOG(ERR, "Failed to create FDIR profile.");
+		error = FIELD_GET(ICE_FXD_FLTR_WB_QW1_FAIL_PROF_M, stat_err);
+		if (error == ICE_FXD_FLTR_WB_QW1_FAIL_PROF_YES) {
+			PMD_DRV_LOG(ERR, "Profile matching error");
 			ret = -EINVAL;
+			goto err;
 		}
 err:
 		rxdp->wb.status_error0 = 0;
-- 
2.55.0


  reply	other threads:[~2026-09-29  5:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-28 17:27 [PATCH] net/ice: fix missing type casts for flex descriptors Omar Munchaev
2026-09-28 17:27 ` Omar Munchaev [this message]
2026-10-06 14:30   ` [PATCH] net/ice: use macros to get field values Burakov, Anatoly
2026-10-06 15:06     ` Bruce Richardson
2026-10-06 15:09   ` Bruce Richardson
2026-10-06 14:21 ` [PATCH] net/ice: fix missing type casts for flex descriptors Burakov, Anatoly
2026-10-06 14:31   ` Bruce Richardson

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=20260928172759.3369704-2-omar.munchaev@gmail.com \
    --to=omarmunchaev@gmail.com \
    --cc=anatoly.burakov@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=omar.munchaev@gmail.com \
    /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