DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net/ice: fix missing type casts for flex descriptors
@ 2026-09-28 17:27 Omar Munchaev
  2026-09-28 17:27 ` [PATCH] net/ice: use macros to get field values Omar Munchaev
  2026-10-06 14:21 ` [PATCH] net/ice: fix missing type casts for flex descriptors Burakov, Anatoly
  0 siblings, 2 replies; 7+ messages in thread
From: Omar Munchaev @ 2026-09-28 17:27 UTC (permalink / raw)
  To: dev; +Cc: Omar Munchaev, stable, Bruce Richardson, Anatoly Burakov

When ice driver was ported to use the common Rx descriptor format,
some type casts were missed. Add them.

Fixes: e70342ba90a83 ("net/ice: use common Rx queue structure")
Cc: stable@dpdk.org

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

diff --git a/drivers/net/intel/ice/ice_rxtx.c b/drivers/net/intel/ice/ice_rxtx.c
index b333444cbf..882af80833 100644
--- a/drivers/net/intel/ice/ice_rxtx.c
+++ b/drivers/net/intel/ice/ice_rxtx.c
@@ -2698,7 +2698,7 @@ ice_fdir_setup_rx_resources(struct ice_pf *pf)
 	}
 
 	/* Allocate RX hardware ring descriptors. */
-	ring_size = sizeof(union ice_32byte_rx_desc) * ICE_FDIR_NUM_RX_DESC;
+	ring_size = sizeof(union ci_rx_flex_desc) * ICE_FDIR_NUM_RX_DESC;
 	ring_size = RTE_ALIGN(ring_size, ICE_DMA_MEM_ALIGN);
 
 	rz = rte_eth_dma_zone_reserve(dev, "fdir_rx_ring",
@@ -2718,7 +2718,7 @@ ice_fdir_setup_rx_resources(struct ice_pf *pf)
 
 	rxq->rx_ring_phys_addr = rz->iova;
 	memset(rz->addr, 0, ICE_FDIR_NUM_RX_DESC *
-	       sizeof(union ice_32byte_rx_desc));
+	       sizeof(union ci_rx_flex_desc));
 	rxq->rx_flex_ring = (union ci_rx_flex_desc *)rz->addr;
 
 	/*
@@ -4464,15 +4464,15 @@ ice_set_default_ptype_table(struct rte_eth_dev *dev)
 static inline int
 ice_check_fdir_programming_status(struct ci_rx_queue *rxq)
 {
-	volatile union ice_32byte_rx_desc *rxdp;
-	uint64_t qword1;
-	uint32_t rx_status;
-	uint32_t error;
-	uint32_t id;
+	volatile union ci_rx_flex_desc *rxdp;
+	uint16_t qword1;
+	uint16_t rx_status;
+	uint16_t error;
+	uint16_t id;
 	int ret = -EAGAIN;
 
-	rxdp = (volatile union ice_32byte_rx_desc *)&rxq->rx_flex_ring[rxq->rx_tail];
-	qword1 = rte_le_to_cpu_64(rxdp->wb.qword1.status_error_len);
+	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;
 
@@ -4497,7 +4497,7 @@ ice_check_fdir_programming_status(struct ci_rx_queue *rxq)
 			ret = -EINVAL;
 		}
 err:
-		rxdp->wb.qword1.status_error_len = 0;
+		rxdp->wb.status_error0 = 0;
 		rxq->rx_tail++;
 		if (unlikely(rxq->rx_tail == rxq->nb_rx_desc))
 			rxq->rx_tail = 0;
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH] net/ice: use macros to get field values
  2026-09-28 17:27 [PATCH] net/ice: fix missing type casts for flex descriptors Omar Munchaev
@ 2026-09-28 17:27 ` Omar Munchaev
  2026-10-06 14:30   ` Burakov, Anatoly
  2026-10-06 15:09   ` Bruce Richardson
  2026-10-06 14:21 ` [PATCH] net/ice: fix missing type casts for flex descriptors Burakov, Anatoly
  1 sibling, 2 replies; 7+ messages in thread
From: Omar Munchaev @ 2026-09-28 17:27 UTC (permalink / raw)
  To: dev; +Cc: Omar Munchaev, Bruce Richardson, Anatoly Burakov

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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] net/ice: fix missing type casts for flex descriptors
  2026-09-28 17:27 [PATCH] net/ice: fix missing type casts for flex descriptors Omar Munchaev
  2026-09-28 17:27 ` [PATCH] net/ice: use macros to get field values Omar Munchaev
@ 2026-10-06 14:21 ` Burakov, Anatoly
  2026-10-06 14:31   ` Bruce Richardson
  1 sibling, 1 reply; 7+ messages in thread
From: Burakov, Anatoly @ 2026-10-06 14:21 UTC (permalink / raw)
  To: Omar Munchaev, dev; +Cc: Omar Munchaev, stable, Bruce Richardson

On 9/28/2026 7:27 PM, Omar Munchaev wrote:
> When ice driver was ported to use the common Rx descriptor format,
> some type casts were missed. Add them.
> 
> Fixes: e70342ba90a83 ("net/ice: use common Rx queue structure")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Omar Munchaev <omar.munchaev@gmail.com>
> ---

Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>

-- 
Thanks,
Anatoly

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] net/ice: use macros to get field values
  2026-09-28 17:27 ` [PATCH] net/ice: use macros to get field values Omar Munchaev
@ 2026-10-06 14:30   ` Burakov, Anatoly
  2026-10-06 15:06     ` Bruce Richardson
  2026-10-06 15:09   ` Bruce Richardson
  1 sibling, 1 reply; 7+ messages in thread
From: Burakov, Anatoly @ 2026-10-06 14:30 UTC (permalink / raw)
  To: Omar Munchaev, dev; +Cc: Omar Munchaev, Bruce Richardson

On 9/28/2026 7:27 PM, Omar Munchaev wrote:
> 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

Missing semicolon, so the build fails. Please run 
`devtools/test-meson-builds.sh` script before submission. When 
submitting new versions of the patch, you should increment the version, 
and the patchset also does not have proper threading. Please refer to 
contribution guidelines[1] for how to do this correctly.

[1] https://core.dpdk.org/contribute/

That said, the rest of it looks fine to me, so the semicolon issue can 
be fixed on apply.

Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>

-- 
Thanks,
Anatoly

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] net/ice: fix missing type casts for flex descriptors
  2026-10-06 14:21 ` [PATCH] net/ice: fix missing type casts for flex descriptors Burakov, Anatoly
@ 2026-10-06 14:31   ` Bruce Richardson
  0 siblings, 0 replies; 7+ messages in thread
From: Bruce Richardson @ 2026-10-06 14:31 UTC (permalink / raw)
  To: Burakov, Anatoly; +Cc: Omar Munchaev, dev, Omar Munchaev, stable

On Tue, Oct 06, 2026 at 04:21:43PM +0200, Burakov, Anatoly wrote:
> On 9/28/2026 7:27 PM, Omar Munchaev wrote:
> > When ice driver was ported to use the common Rx descriptor format,
> > some type casts were missed. Add them.
> > 
> > Fixes: e70342ba90a83 ("net/ice: use common Rx queue structure")
> > Cc: stable@dpdk.org
> > 
> > Signed-off-by: Omar Munchaev <omar.munchaev@gmail.com>
> > ---
> 
> Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
> 
Applied to dpdk-next-net-intel

Thanks,
/Bruce

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] net/ice: use macros to get field values
  2026-10-06 14:30   ` Burakov, Anatoly
@ 2026-10-06 15:06     ` Bruce Richardson
  0 siblings, 0 replies; 7+ messages in thread
From: Bruce Richardson @ 2026-10-06 15:06 UTC (permalink / raw)
  To: Burakov, Anatoly; +Cc: Omar Munchaev, dev, Omar Munchaev

On Tue, Oct 06, 2026 at 04:30:00PM +0200, Burakov, Anatoly wrote:
> On 9/28/2026 7:27 PM, Omar Munchaev wrote:
> > 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
> 
> Missing semicolon, so the build fails. Please run
> `devtools/test-meson-builds.sh` script before submission. When submitting
> new versions of the patch, you should increment the version, and the
> patchset also does not have proper threading. Please refer to contribution
> guidelines[1] for how to do this correctly.
> 
> [1] https://core.dpdk.org/contribute/
> 
> That said, the rest of it looks fine to me, so the semicolon issue can be
> fixed on apply.
> 
> Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
> 
Given the missing semicolon, I decided to ask AI to review this patch
before I committed the patch with the small fix. It flags one logic issue
with it:

  Finding: FDIR successes are reported as timeouts. In ice_rxtx.c:4469, ret
  starts as -EAGAIN and is never set to 0 when a completed descriptor has no
  error. The caller treats -EAGAIN as “keep waiting” (ice_rxtx.c:4550), so it
  consumes the successful completion, continues polling, and eventually
  returns -ETIMEDOUT. Set ret = 0 when DD is present and both failure checks
  pass.

This finding looks right to me. ret is set to -EAGAIN at line 4469 and set
to a zero value nowhere else in the function.

/Bruce

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] net/ice: use macros to get field values
  2026-09-28 17:27 ` [PATCH] net/ice: use macros to get field values Omar Munchaev
  2026-10-06 14:30   ` Burakov, Anatoly
@ 2026-10-06 15:09   ` Bruce Richardson
  1 sibling, 0 replies; 7+ messages in thread
From: Bruce Richardson @ 2026-10-06 15:09 UTC (permalink / raw)
  To: Omar Munchaev; +Cc: dev, Omar Munchaev, Anatoly Burakov

On Tue, Sep 29, 2026 at 12:27:59AM +0700, Omar Munchaev wrote:
> 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>
> ---

When submitting a new version, it's recommended to also run the
checkpatches.sh and check-git-log.sh scripts. These are giving an error for
this patch because of a mismatch between your email address in the signoff
and in the "from" line of the email (and in .mailmap). The signoff has a
"." in it, that is missing in your email address in the other two
locations.

Regards,

/Bruce


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-10-06 15:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-28 17:27 [PATCH] net/ice: fix missing type casts for flex descriptors Omar Munchaev
2026-09-28 17:27 ` [PATCH] net/ice: use macros to get field values Omar Munchaev
2026-10-06 14:30   ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox