net/ice: fix missing type casts for flex descriptors
PATCH 1/1 net/ice: fix missing type casts for flex descriptors
When ice driver was ported to use the common Rx descriptor format, some type casts were missed. Add them.
--- drivers/net/intel/ice/ice_rxtx.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/net/intel/ice/ice_rxtx.c +10 -10
@@ -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 ;
Signature · 1 line
2.55.0
PATCH 1/1 net/ice: use macros to get field values
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.
--- drivers/net/intel/ice/ice_rxtx.c | 37 ++++++++++++-------------------- 1 file changed, 14 insertions(+), 23 deletions(-)
drivers/net/intel/ice/ice_rxtx.c +14 -23
@@ -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 ;
Signature · 1 line
2.55.0
Re: [PATCH] net/ice: use macros to get field values
Quoted 16 lines · Omar Munchaev
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 useFIELD_GETmacros instead.Signed-off-by Omar Munchaev <[email protected]>--- drivers/net/intel/ice/ice_rxtx.c | 37 ++++++++++++-------------------- 1 file changed, 14 insertions(+), 23 deletions(-)drivers/net/intel/ice/ice_rxtx.c +0
-0
drivers/net/intel/ice/ice_rxtx.c static inline int · line 4468
Quoted 8 lines
drivers/net/intel/ice/ice_rxtx.c +1
-4@@ -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.
Signature · 2 lines
Thanks, Anatoly
Re: [PATCH] net/ice: use macros to get field values
Quoted 32 lines · Anatoly
Quoted 16 lines · Omar Munchaev
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 useFIELD_GETmacros instead.Signed-off-by Omar Munchaev <[email protected]>--- drivers/net/intel/ice/ice_rxtx.c | 37 ++++++++++++-------------------- 1 file changed, 14 insertions(+), 23 deletions(-)drivers/net/intel/ice/ice_rxtx.c +0
-0drivers/net/intel/ice/ice_rxtx.c static inline int · line 4468
Quoted 8 lines
drivers/net/intel/ice/ice_rxtx.c +1
-4@@ -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, idMissing semicolon, so the build fails. Please run
devtools/test-meson-builds.shscript 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.
Quoted 7 lines
[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 <[email protected]>
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
Re: [PATCH] net/ice: use macros to get field values
In reply to Omar MunchaevQuoted 8 lines · Omar Munchaev
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 useFIELD_GETmacros instead.Signed-off-by Omar Munchaev <[email protected]>---
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
Quoted 8 lines · Omar Munchaev
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")Signed-off-by Omar Munchaev <[email protected]>---
Signature · 2 lines
Thanks, Anatoly
Bruce Richardson
AppliedQuoted 4 lines · Anatoly
Quoted 3 lines · Omar Munchaev
When ice driver was ported to use the common Rx descriptor format, some type casts were missed. Add them.
Quoted 8 lines
Quoted 5 lines
Fixes e70342ba90a83 ("net/ice: use common Rx queue structure")Signed-off-by Omar Munchaev <[email protected]>---
Acked-by Anatoly Burakov <[email protected]>
Applied to dpdk-next-net-intel
Thanks,
/Bruce