[v3] net/gve : Update EOP & csum bit in txd rte_mbuf chain

Message ID 1722533273-2405457-1-git-send-email-tathagat.dpdk@gmail.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers
Series [v3] net/gve : Update EOP & csum bit in txd rte_mbuf chain |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation fail ninja build failure
ci/Intel-compilation fail Compilation issues

Commit Message

Tathagat Priyadarshi Aug. 1, 2024, 5:27 p.m. UTC
The EOP and csum bit was not set for all the packets in mbuf chain
causing packet transmission stalls for packets split across
mbuf in chain.

Fixes: 4022f99 ("net/gve: support basic Tx data path for DQO")
Cc: stable@dpdk.org

Signed-off-by: Tathagat Priyadarshi <tathagat.dpdk@gmail.com>
Signed-off-by: Varun Lakkur Ambaji Rao <varun.la@gmail.com>
---
 drivers/net/gve/gve_tx_dqo.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
  

Comments

Stephen Hemminger Aug. 1, 2024, 6:54 p.m. UTC | #1
On Thu,  1 Aug 2024 17:27:53 +0000
Tathagat Priyadarshi <tathagat.dpdk@gmail.com> wrote:

> +		if (ol_flags & GVE_TX_CKSUM_OFFLOAD_MASK_DQO)
> +			csum = 1;
> +		else
> +			cusm = 0;
> +

Obvious typo, did you do a final test build?

Could also use logical inverse operator instead of if() which will
generate better code sometimes.
		
		csum = !!(ol_flags & GVE_TX_CKSUM_OFFLOAD_MASK_DQO);
  
Tathagat Priyadarshi Aug. 1, 2024, 6:58 p.m. UTC | #2
Thanks for your suggestion Stephen, I have already updated the patch with
v4 & fixed the typo. Will consider your suggestion in the next version of
the patch.


On Fri, 2 Aug 2024 at 00:24, Stephen Hemminger <stephen@networkplumber.org>
wrote:

> On Thu,  1 Aug 2024 17:27:53 +0000
> Tathagat Priyadarshi <tathagat.dpdk@gmail.com> wrote:
>
> > +             if (ol_flags & GVE_TX_CKSUM_OFFLOAD_MASK_DQO)
> > +                     csum = 1;
> > +             else
> > +                     cusm = 0;
> > +
>
> Obvious typo, did you do a final test build?
>
> Could also use logical inverse operator instead of if() which will
> generate better code sometimes.
>
>                 csum = !!(ol_flags & GVE_TX_CKSUM_OFFLOAD_MASK_DQO);
>
>
  

Patch

diff --git a/drivers/net/gve/gve_tx_dqo.c b/drivers/net/gve/gve_tx_dqo.c
index a65e6aa..91db037 100644
--- a/drivers/net/gve/gve_tx_dqo.c
+++ b/drivers/net/gve/gve_tx_dqo.c
@@ -89,6 +89,7 @@ 
 	uint16_t sw_id;
 	uint64_t bytes;
 	uint16_t first_sw_id;
+	uint8_t csum;
 
 	sw_ring = txq->sw_ring;
 	txr = txq->tx_ring;
@@ -114,6 +115,12 @@ 
 		ol_flags = tx_pkt->ol_flags;
 		nb_used = tx_pkt->nb_segs;
 		first_sw_id = sw_id;
+
+		if (ol_flags & GVE_TX_CKSUM_OFFLOAD_MASK_DQO)
+			csum = 1;
+		else
+			cusm = 0;
+
 		do {
 			if (sw_ring[sw_id] != NULL)
 				PMD_DRV_LOG(DEBUG, "Overwriting an entry in sw_ring");
@@ -126,6 +133,8 @@ 
 			txd->pkt.dtype = GVE_TX_PKT_DESC_DTYPE_DQO;
 			txd->pkt.compl_tag = rte_cpu_to_le_16(first_sw_id);
 			txd->pkt.buf_size = RTE_MIN(tx_pkt->data_len, GVE_TX_MAX_BUF_SIZE_DQO);
+			txd->pkt.end_of_packet = 0;
+			txd->pkt.checksum_offload_enable = csum;
 
 			/* size of desc_ring and sw_ring could be different */
 			tx_id = (tx_id + 1) & mask;
@@ -138,9 +147,6 @@ 
 		/* fill the last descriptor with End of Packet (EOP) bit */
 		txd->pkt.end_of_packet = 1;
 
-		if (ol_flags & GVE_TX_CKSUM_OFFLOAD_MASK_DQO)
-			txd->pkt.checksum_offload_enable = 1;
-
 		txq->nb_free -= nb_used;
 		txq->nb_used += nb_used;
 	}