From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from rnd-relay.smtp.broadcom.com (rnd-relay.smtp.broadcom.com [192.19.229.170]) by dpdk.org (Postfix) with ESMTP id 75E935B20 for ; Wed, 15 May 2019 20:08:24 +0200 (CEST) Received: from nis-sj1-27.broadcom.com (nis-sj1-27.lvn.broadcom.net [10.75.144.136]) by rnd-relay.smtp.broadcom.com (Postfix) with ESMTP id 187F730C033; Wed, 15 May 2019 11:08:22 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com 187F730C033 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1557943702; bh=C9YrNrk8nidWJfIi0sHUUsYcEVk5ocmx0QXztDPq2bI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AnXX7ls/r3C7qSY5h5X46QEgRC7vpAmrA1QH3FQOv+mJ1c3pAN1jXV/e5FaigAqyO Ou40yM14kk7Jhs0BSodlz+FMo5rWkYL8Hd/cKcENIIk6RzHNpmuutpJ7/p+3aU3TEF pyXWkE5C4bo7ubFNuDbwi13YHrpNgH7ilSSfzjuI= Received: from C02VPB22HTD6.wifi.broadcom.net (c02vpb22htd6.wifi.broadcom.net [10.69.74.102]) by nis-sj1-27.broadcom.com (Postfix) with ESMTP id E268DAC0709; Wed, 15 May 2019 11:08:22 -0700 (PDT) From: Ajit Khaparde To: dev@dpdk.org Cc: ferruh.yigit@intel.com, Somnath Kotur , Sriharsha Basavapatna Date: Wed, 15 May 2019 11:08:12 -0700 Message-Id: <20190515180817.71523-2-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.20.1 (Apple Git-117) In-Reply-To: <20190515180817.71523-1-ajit.khaparde@broadcom.com> References: <20190515180817.71523-1-ajit.khaparde@broadcom.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 1/6] net/bnxt: fix an issue seen with TSO X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 May 2019 18:08:25 -0000 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 Reviewed-by: Somnath Kotur Signed-off-by: Sriharsha Basavapatna --- 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) From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 2A81FA00E6 for ; Wed, 15 May 2019 20:08:42 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 18C5B5F1C; Wed, 15 May 2019 20:08:28 +0200 (CEST) Received: from rnd-relay.smtp.broadcom.com (rnd-relay.smtp.broadcom.com [192.19.229.170]) by dpdk.org (Postfix) with ESMTP id 75E935B20 for ; Wed, 15 May 2019 20:08:24 +0200 (CEST) Received: from nis-sj1-27.broadcom.com (nis-sj1-27.lvn.broadcom.net [10.75.144.136]) by rnd-relay.smtp.broadcom.com (Postfix) with ESMTP id 187F730C033; Wed, 15 May 2019 11:08:22 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com 187F730C033 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1557943702; bh=C9YrNrk8nidWJfIi0sHUUsYcEVk5ocmx0QXztDPq2bI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AnXX7ls/r3C7qSY5h5X46QEgRC7vpAmrA1QH3FQOv+mJ1c3pAN1jXV/e5FaigAqyO Ou40yM14kk7Jhs0BSodlz+FMo5rWkYL8Hd/cKcENIIk6RzHNpmuutpJ7/p+3aU3TEF pyXWkE5C4bo7ubFNuDbwi13YHrpNgH7ilSSfzjuI= Received: from C02VPB22HTD6.wifi.broadcom.net (c02vpb22htd6.wifi.broadcom.net [10.69.74.102]) by nis-sj1-27.broadcom.com (Postfix) with ESMTP id E268DAC0709; Wed, 15 May 2019 11:08:22 -0700 (PDT) From: Ajit Khaparde To: dev@dpdk.org Cc: ferruh.yigit@intel.com, Somnath Kotur , Sriharsha Basavapatna Date: Wed, 15 May 2019 11:08:12 -0700 Message-Id: <20190515180817.71523-2-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.20.1 (Apple Git-117) In-Reply-To: <20190515180817.71523-1-ajit.khaparde@broadcom.com> References: <20190515180817.71523-1-ajit.khaparde@broadcom.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 1/6] net/bnxt: fix an issue seen with TSO X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190515180812.SaU1aG5ecNZoc9Kdb107gTBO3VtqQDSjI8uAngJSBLg@z> 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 Reviewed-by: Somnath Kotur Signed-off-by: Sriharsha Basavapatna --- 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)