]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
idpf: fix Rx descriptor ready check barrier in splitq
authorAlexander Lobakin <aleksander.lobakin@intel.com>
Tue, 26 Aug 2025 15:54:56 +0000 (17:54 +0200)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Mon, 8 Sep 2025 17:26:25 +0000 (10:26 -0700)
No idea what the current barrier position was meant for. At that point,
nothing is read from the descriptor, only the pointer to the actual one
is fetched.
The correct barrier usage here is after the generation check, so that
only the first qword is read if the descriptor is not yet ready and we
need to stop polling. Debatable on coherent DMA as the Rx descriptor
size is <= cacheline size, but anyway, the current barrier position
only makes the codegen worse.

Fixes: 3a8845af66ed ("idpf: add RX splitq napi poll support")
Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Tested-by: Ramu R <ramu.r@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/idpf/idpf_txrx.c

index 194f924d2bd6e3d12a08b00cf4c4b265ae5d9845..e75a94d7ac2ac493acbf26573c75fe9853ddd404 100644 (file)
@@ -3102,18 +3102,14 @@ static int idpf_rx_splitq_clean(struct idpf_rx_queue *rxq, int budget)
                /* get the Rx desc from Rx queue based on 'next_to_clean' */
                rx_desc = &rxq->rx[ntc].flex_adv_nic_3_wb;
 
-               /* This memory barrier is needed to keep us from reading
-                * any other fields out of the rx_desc
-                */
-               dma_rmb();
-
                /* if the descriptor isn't done, no work yet to do */
                gen_id = le16_get_bits(rx_desc->pktlen_gen_bufq_id,
                                       VIRTCHNL2_RX_FLEX_DESC_ADV_GEN_M);
-
                if (idpf_queue_has(GEN_CHK, rxq) != gen_id)
                        break;
 
+               dma_rmb();
+
                rxdid = FIELD_GET(VIRTCHNL2_RX_FLEX_DESC_ADV_RXDID_M,
                                  rx_desc->rxdid_ucast);
                if (rxdid != VIRTCHNL2_RXDID_2_FLEX_SPLITQ) {