From patchwork Fri Mar 3 08:10:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 124759 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4335341DC3; Fri, 3 Mar 2023 09:11:01 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5EF0F427F2; Fri, 3 Mar 2023 09:10:58 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 005D14161A for ; Fri, 3 Mar 2023 09:10:56 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3234WuWS024918 for ; Fri, 3 Mar 2023 00:10:56 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=7HtxD11lsbJuh2rWos/ibxwkgIeAzQjybI+un747e/g=; b=Kbwiq8xuy8GdfGOdCnAQySrMF78wKLob/3qCcBkVkUQSKrxSjWZWWjORJKccYMpYJQ/P 7oMEBzpkoQtmvUIH3b/qy8b9ztKx6RtEyHz7h6kfXdEqDY628DEQ6kgjrQG4bMv+DUVA ah+qn2A1xYWZVjr+6Nn8V8Y2fT+YauEeCuBrDWmtY6wAF3QSQU0xMfd/ievZTdCrofed gvc6lcvK/UR5h0KjOIGfHmqhl+lzHYUcqfeW7Iguf5S2dMWlU2oPB8l/J5BGmw4Ti/YW j9A++AMzQUard2Nut+14uy1Xbwx9OjbfsHldhebunmNP9HhDHj5WOB43OmjNcJzksodT Tg== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3p1wr9xbh6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Fri, 03 Mar 2023 00:10:55 -0800 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 3 Mar 2023 00:10:53 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.42 via Frontend Transport; Fri, 3 Mar 2023 00:10:53 -0800 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id 42A2E3F70BE; Fri, 3 Mar 2023 00:10:50 -0800 (PST) From: Nithin Dabilpuram To: Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , Subject: [PATCH 02/15] net/cnxk: fix data len for first seg with multi seg pkt Date: Fri, 3 Mar 2023 13:40:00 +0530 Message-ID: <20230303081013.589868-2-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230303081013.589868-1-ndabilpuram@marvell.com> References: <20230303081013.589868-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: UMkI86bVYyTWtW8j_wkR_9IM9O1HruKD X-Proofpoint-GUID: UMkI86bVYyTWtW8j_wkR_9IM9O1HruKD X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-03_01,2023-03-02_02,2023-02-09_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org When coming from vector routine, the first seg length is set to same as pkt len assuming it is a single segment pkt. Read just the same in cn10k_nix_prepare_mseg() that is called in case of mbuf-fast-free offload disabled. In CN9K, clear other data len fields to avoid using stale data. Fixes: 8520bce63379 ("net/cnxk: rework no-fast-free offload") Fixes: ae2c2cb60635 ("net/cnxk: avoid command copy from Tx queue") Signed-off-by: Nithin Dabilpuram --- drivers/net/cnxk/cn10k_tx.h | 24 +++++++++++++++++++----- drivers/net/cnxk/cn9k_tx.h | 1 + 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/drivers/net/cnxk/cn10k_tx.h b/drivers/net/cnxk/cn10k_tx.h index d0f7bc22a4..a72a803e10 100644 --- a/drivers/net/cnxk/cn10k_tx.h +++ b/drivers/net/cnxk/cn10k_tx.h @@ -1012,9 +1012,13 @@ cn10k_nix_prepare_mseg(struct cn10k_eth_txq *txq, ol_flags = m->ol_flags; /* Start from second segment, first segment is already there */ + dlen = m->data_len; is_sg2 = 0; l_sg.u = sg->u; - len -= l_sg.u & 0xFFFF; + /* Clear l_sg.u first seg length that might be stale from vector path */ + l_sg.u &= ~0xFFFFUL; + l_sg.u |= dlen; + len -= dlen; nb_segs = m->nb_segs - 1; m_next = m->next; slist = &cmd[3 + off + 1]; @@ -1940,7 +1944,7 @@ cn10k_nix_xmit_pkts_vector(void *tx_queue, uint64_t *ws, uint64x2_t xtmp128, ytmp128; uint64x2_t xmask01, xmask23; uintptr_t c_laddr = laddr; - uint8_t lnum, shift, loff; + uint8_t lnum, shift, loff = 0; rte_iova_t c_io_addr; uint64_t sa_base; union wdata { @@ -2059,10 +2063,20 @@ cn10k_nix_xmit_pkts_vector(void *tx_queue, uint64_t *ws, !!(flags & NIX_TX_OFFLOAD_TSTAMP_F); } - /* Check if there are enough LMTLINES for this loop */ - if (lnum + 4 > 32) { + /* Check if there are enough LMTLINES for this loop. + * Consider previous line to be partial. + */ + if (lnum + 4 >= 32) { uint8_t ldwords_con = 0, lneeded = 0; - for (j = 0; j < NIX_DESCS_PER_LOOP; j++) { + + if ((loff >> 4) + segdw[0] > 8) { + lneeded += 1; + ldwords_con = segdw[0]; + } else { + ldwords_con = (loff >> 4) + segdw[0]; + } + + for (j = 1; j < NIX_DESCS_PER_LOOP; j++) { ldwords_con += segdw[j]; if (ldwords_con > 8) { lneeded += 1; diff --git a/drivers/net/cnxk/cn9k_tx.h b/drivers/net/cnxk/cn9k_tx.h index 52661a624c..e956c1ad2a 100644 --- a/drivers/net/cnxk/cn9k_tx.h +++ b/drivers/net/cnxk/cn9k_tx.h @@ -461,6 +461,7 @@ cn9k_nix_prepare_mseg(struct cn9k_eth_txq *txq, /* Start from second segment, first segment is already there */ i = 1; sg_u = sg->u; + sg_u &= 0xFC0000000000FFFF; nb_segs = m->nb_segs - 1; m_next = m->next; slist = &cmd[3 + off + 1];