From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 08C7AA034E; Wed, 19 Jan 2022 11:52:16 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E5A254111B; Wed, 19 Jan 2022 11:52:15 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id CD5764013F for ; Wed, 19 Jan 2022 11:52:13 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 20J1uHg6028050 for ; Wed, 19 Jan 2022 02:52:11 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=Qmo9l2qQmLRzP/rT/OTXVu53bRwyrdQ0SlYjs7wOzzc=; b=TWVqKssk5RtbHN64pWTXoQmTI0cTT9ZlTnwsoxs/EpmrQdCLTVegatnG5+NxQ8hr2khm 3mPjXyuRYYm3cj+1Udz0Sd6ZJS9IF177uxeW48z/IWWkPPkgiO91ou8GmGJXTlCxyX/X Cn3G36Ki5K5X3HeYMvpZ1hZC2xRJqZKW9kCF2YTMEikDmO7RAwlyVpsbVNek0As9tJgp UzKghrtOzb8tZZNg2SEZwJ5Lg5bSCy7zCZdCqHvdNDiE58TPsDUdWgOdwojpSWB2H8yG v08uFBTnoOm4NfN64YV7TtC85uyou+ex+124QpOoN70Xgjgkz6fv70Va/SyQnLPKu2x9 lQ== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3dp9dyhku6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Wed, 19 Jan 2022 02:52:11 -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.18; Wed, 19 Jan 2022 02:52:09 -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.2 via Frontend Transport; Wed, 19 Jan 2022 02:52:09 -0800 Received: from localhost.localdomain (unknown [10.28.48.107]) by maili.marvell.com (Postfix) with ESMTP id 753893F7077; Wed, 19 Jan 2022 02:52:06 -0800 (PST) From: Rahul Bhansali To: , Pavan Nikhilesh , "Shijith Thotton" , Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , Rahul Bhansali Subject: [PATCH] net/cnxk: resolve mbuf data length update issue Date: Wed, 19 Jan 2022 16:22:03 +0530 Message-ID: <20220119105203.1553714-1-rbhansali@marvell.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: M4lxTPGjz6qh1u1f_k09FzDx8lmmpwwM X-Proofpoint-ORIG-GUID: M4lxTPGjz6qh1u1f_k09FzDx8lmmpwwM X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-19_07,2022-01-19_01,2021-12-02_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 If multi-segment is enabled and single segment/packet is received, then mbuf data_len is not updated in cn9k_nix_cqe_to_mbuf function. Also, in case of timestamp is enabled, mbuf data_len and pkt_len will be updated for all packets including multi segmented packets. Signed-off-by: Rahul Bhansali --- Depends-on: Series-21246 ("[v2,1/4] net/cnxk: avoid command copy from Tx queue") drivers/event/cnxk/cn10k_worker.h | 2 -- drivers/event/cnxk/cn9k_worker.h | 2 -- drivers/net/cnxk/cn10k_rx.h | 9 +++++++-- drivers/net/cnxk/cn9k_rx.h | 18 +++++++++++------- drivers/net/cnxk/cnxk_ethdev.h | 9 +++------ 5 files changed, 21 insertions(+), 19 deletions(-) diff --git a/drivers/event/cnxk/cn10k_worker.h b/drivers/event/cnxk/cn10k_worker.h index 1e61a6ddf0..5c36540a43 100644 --- a/drivers/event/cnxk/cn10k_worker.h +++ b/drivers/event/cnxk/cn10k_worker.h @@ -174,7 +174,6 @@ cn10k_process_vwqe(uintptr_t vwqe, uint16_t port_id, const uint32_t flags, CNXK_SSO_WQE_SG_PTR); cnxk_nix_mbuf_to_tstamp((struct rte_mbuf *)mbuf, tstamp, flags & NIX_RX_OFFLOAD_TSTAMP_F, - flags & NIX_RX_MULTI_SEG_F, (uint64_t *)tstamp_ptr); wqe[0] = (uint64_t *)mbuf; non_vec--; @@ -266,7 +265,6 @@ cn10k_sso_hws_get_work(struct cn10k_sso_hws *ws, struct rte_event *ev, cnxk_nix_mbuf_to_tstamp((struct rte_mbuf *)mbuf, ws->tstamp, flags & NIX_RX_OFFLOAD_TSTAMP_F, - flags & NIX_RX_MULTI_SEG_F, (uint64_t *)tstamp_ptr); gw.u64[1] = mbuf; } else if (CNXK_EVENT_TYPE_FROM_TAG(gw.u64[0]) == diff --git a/drivers/event/cnxk/cn9k_worker.h b/drivers/event/cnxk/cn9k_worker.h index e44422ec25..368baae048 100644 --- a/drivers/event/cnxk/cn9k_worker.h +++ b/drivers/event/cnxk/cn9k_worker.h @@ -208,7 +208,6 @@ cn9k_sso_hws_dual_get_work(uint64_t base, uint64_t pair_base, cnxk_nix_mbuf_to_tstamp((struct rte_mbuf *)mbuf, dws->tstamp, flags & NIX_RX_OFFLOAD_TSTAMP_F, - flags & NIX_RX_MULTI_SEG_F, (uint64_t *)tstamp_ptr); gw.u64[1] = mbuf; } @@ -285,7 +284,6 @@ cn9k_sso_hws_get_work(struct cn9k_sso_hws *ws, struct rte_event *ev, cnxk_nix_mbuf_to_tstamp((struct rte_mbuf *)mbuf, ws->tstamp, flags & NIX_RX_OFFLOAD_TSTAMP_F, - flags & NIX_RX_MULTI_SEG_F, (uint64_t *)tstamp_ptr); gw.u64[1] = mbuf; } diff --git a/drivers/net/cnxk/cn10k_rx.h b/drivers/net/cnxk/cn10k_rx.h index 9694a3080f..45b626b089 100644 --- a/drivers/net/cnxk/cn10k_rx.h +++ b/drivers/net/cnxk/cn10k_rx.h @@ -364,7 +364,13 @@ cn10k_nix_cqe_to_mbuf(const struct nix_cqe_hdr_s *cq, const uint32_t tag, *(uint64_t *)(&mbuf->rearm_data) = val; if (flag & NIX_RX_MULTI_SEG_F) - nix_cqe_xtract_mseg(rx, mbuf, val, flag); + /* + * For multi segment packets, mbuf length correction according + * to Rx timestamp length will be handled later during + * timestamp data process. + * Hence, flag argument is not required. + */ + nix_cqe_xtract_mseg(rx, mbuf, val, 0); else mbuf->next = NULL; } @@ -452,7 +458,6 @@ cn10k_nix_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts, flags); cnxk_nix_mbuf_to_tstamp(mbuf, rxq->tstamp, (flags & NIX_RX_OFFLOAD_TSTAMP_F), - (flags & NIX_RX_MULTI_SEG_F), (uint64_t *)((uint8_t *)mbuf + data_off)); rx_pkts[packets++] = mbuf; diff --git a/drivers/net/cnxk/cn9k_rx.h b/drivers/net/cnxk/cn9k_rx.h index fa4efbf80a..c883eaeb07 100644 --- a/drivers/net/cnxk/cn9k_rx.h +++ b/drivers/net/cnxk/cn9k_rx.h @@ -345,13 +345,18 @@ cn9k_nix_cqe_to_mbuf(const struct nix_cqe_hdr_s *cq, const uint32_t tag, mbuf->ol_flags = ol_flags; *(uint64_t *)(&mbuf->rearm_data) = val; mbuf->pkt_len = len; - - if (flag & NIX_RX_MULTI_SEG_F) { - nix_cqe_xtract_mseg(rx, mbuf, val, flag); - } else { - mbuf->data_len = len; + mbuf->data_len = len; + + if (flag & NIX_RX_MULTI_SEG_F) + /* + * For multi segment packets, mbuf length correction according + * to Rx timestamp length will be handled later during + * timestamp data process. + * Hence, flag argument is not required. + */ + nix_cqe_xtract_mseg(rx, mbuf, val, 0); + else mbuf->next = NULL; - } } static inline uint16_t @@ -414,7 +419,6 @@ cn9k_nix_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t pkts, flags); cnxk_nix_mbuf_to_tstamp(mbuf, rxq->tstamp, (flags & NIX_RX_OFFLOAD_TSTAMP_F), - (flags & NIX_RX_MULTI_SEG_F), (uint64_t *)((uint8_t *)mbuf + data_off)); rx_pkts[packets++] = mbuf; diff --git a/drivers/net/cnxk/cnxk_ethdev.h b/drivers/net/cnxk/cnxk_ethdev.h index 5bfda3d815..480cc6dfa4 100644 --- a/drivers/net/cnxk/cnxk_ethdev.h +++ b/drivers/net/cnxk/cnxk_ethdev.h @@ -685,14 +685,11 @@ cnxk_nix_timestamp_dynfield(struct rte_mbuf *mbuf, static __rte_always_inline void cnxk_nix_mbuf_to_tstamp(struct rte_mbuf *mbuf, struct cnxk_timesync_info *tstamp, - const uint8_t ts_enable, const uint8_t mseg_enable, - uint64_t *tstamp_ptr) + const uint8_t ts_enable, uint64_t *tstamp_ptr) { if (ts_enable) { - if (!mseg_enable) { - mbuf->pkt_len -= CNXK_NIX_TIMESYNC_RX_OFFSET; - mbuf->data_len -= CNXK_NIX_TIMESYNC_RX_OFFSET; - } + mbuf->pkt_len -= CNXK_NIX_TIMESYNC_RX_OFFSET; + mbuf->data_len -= CNXK_NIX_TIMESYNC_RX_OFFSET; /* Reading the rx timestamp inserted by CGX, viz at * starting of the packet data. -- 2.25.1