DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ajit Khaparde <ajit.khaparde@broadcom.com>
To: dev@dpdk.org
Cc: ferruh.yigit@intel.com,
	Somnath Kotur <somnath.kotur@broadcom.com>,
	Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
Subject: [dpdk-dev] [PATCH 1/6] net/bnxt: fix an issue seen with TSO
Date: Wed, 15 May 2019 11:08:12 -0700	[thread overview]
Message-ID: <20190515180817.71523-2-ajit.khaparde@broadcom.com> (raw)
Message-ID: <20190515180812.SaU1aG5ecNZoc9Kdb107gTBO3VtqQDSjI8uAngJSBLg@z> (raw)
In-Reply-To: <20190515180817.71523-1-ajit.khaparde@broadcom.com>

We wrongly update lflags in the Tx descriptor; avoid it. Also, instead of
calculating the last producer index to see if mbuf segments are chained,
check if the pointer is NULL to iterate through the segment list.

Fixes: 6eb3cc2294fd ("net/bnxt: add initial Tx code")
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
---
 drivers/net/bnxt/bnxt_txr.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_txr.c b/drivers/net/bnxt/bnxt_txr.c
index 39be7bdfa..6f55f3c53 100644
--- a/drivers/net/bnxt/bnxt_txr.c
+++ b/drivers/net/bnxt/bnxt_txr.c
@@ -123,7 +123,6 @@ static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt,
 	struct tx_bd_long_hi *txbd1 = NULL;
 	uint32_t vlan_tag_flags, cfa_action;
 	bool long_bd = false;
-	uint16_t last_prod = 0;
 	struct rte_mbuf *m_seg;
 	struct bnxt_sw_tx_bd *tx_buf;
 	static const uint32_t lhint_arr[4] = {
@@ -143,8 +142,6 @@ static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt,
 	tx_buf = &txr->tx_buf_ring[txr->tx_prod];
 	tx_buf->mbuf = tx_pkt;
 	tx_buf->nr_bds = long_bd + tx_pkt->nb_segs;
-	last_prod = (txr->tx_prod + tx_buf->nr_bds - 1) &
-				txr->tx_ring_struct->ring_mask;
 
 	if (unlikely(bnxt_tx_avail(txr) < tx_buf->nr_bds))
 		return -ENOMEM;
@@ -193,11 +190,17 @@ static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt,
 		txbd1->cfa_action = cfa_action;
 
 		if (tx_pkt->ol_flags & PKT_TX_TCP_SEG) {
+			uint16_t hdr_size;
+
 			/* TSO */
 			txbd1->lflags |= TX_BD_LONG_LFLAGS_LSO;
-			txbd1->hdr_size = tx_pkt->l2_len + tx_pkt->l3_len +
+			hdr_size = tx_pkt->l2_len + tx_pkt->l3_len +
 					tx_pkt->l4_len + tx_pkt->outer_l2_len +
 					tx_pkt->outer_l3_len;
+			/* The hdr_size is multiple of 16bit units not 8bit.
+			 * Hence divide by 2.
+			 */
+			txbd1->hdr_size = hdr_size >> 1;
 			txbd1->mss = tx_pkt->tso_segsz;
 
 		} else if ((tx_pkt->ol_flags & PKT_TX_OIP_IIP_TCP_UDP_CKSUM) ==
@@ -282,7 +285,7 @@ static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt,
 
 	m_seg = tx_pkt->next;
 	/* i is set at the end of the if(long_bd) block */
-	while (txr->tx_prod != last_prod) {
+	while (m_seg) {
 		txr->tx_prod = RING_NEXT(txr->tx_ring_struct, txr->tx_prod);
 		tx_buf = &txr->tx_buf_ring[txr->tx_prod];
 
@@ -295,8 +298,6 @@ static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt,
 	}
 
 	txbd->flags_type |= TX_BD_LONG_FLAGS_PACKET_END;
-	if (txbd1)
-		txbd1->lflags = rte_cpu_to_le_32(txbd1->lflags);
 
 	txr->tx_prod = RING_NEXT(txr->tx_ring_struct, txr->tx_prod);
 
-- 
2.20.1 (Apple Git-117)


  parent reply	other threads:[~2019-05-15 18:08 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-15 18:08 [dpdk-dev] [PATCH 0/6] bnxt patchset for Tx performance optimization Ajit Khaparde
2019-05-15 18:08 ` Ajit Khaparde
2019-05-15 18:08 ` Ajit Khaparde [this message]
2019-05-15 18:08   ` [dpdk-dev] [PATCH 1/6] net/bnxt: fix an issue seen with TSO Ajit Khaparde
2019-05-15 18:08 ` [dpdk-dev] [PATCH 2/6] net/bnxt: add support to update ipid Ajit Khaparde
2019-05-15 18:08   ` Ajit Khaparde
2019-05-15 18:08 ` [dpdk-dev] [PATCH 3/6] net/bnxt: check for some error conditions in Tx path Ajit Khaparde
2019-05-15 18:08   ` Ajit Khaparde
2019-05-15 18:08 ` [dpdk-dev] [PATCH 4/6] net/bnxt: fix a couple of issues with Tx batching Ajit Khaparde
2019-05-15 18:08   ` Ajit Khaparde
2019-05-15 18:08 ` [dpdk-dev] [PATCH 5/6] net/bnxt: optimize Tx batching code Ajit Khaparde
2019-05-15 18:08   ` Ajit Khaparde
2019-05-15 18:08 ` [dpdk-dev] [PATCH 6/6] net/bnxt: support bulk free of Tx mbufs Ajit Khaparde
2019-05-15 18:08   ` Ajit Khaparde
2019-05-27 16:16 ` [dpdk-dev] [PATCH 0/6] bnxt patchset for Tx performance optimization Ferruh Yigit

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=20190515180817.71523-2-ajit.khaparde@broadcom.com \
    --to=ajit.khaparde@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=somnath.kotur@broadcom.com \
    --cc=sriharsha.basavapatna@broadcom.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;
as well as URLs for NNTP newsgroup(s).