From patchwork Thu Feb 24 08:02:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rakesh Kudurumalla X-Patchwork-Id: 108244 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 8FF20A0353; Thu, 24 Feb 2022 09:02:32 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 80B9E41155; Thu, 24 Feb 2022 09:02:32 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 561824114D for ; Thu, 24 Feb 2022 09:02:31 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 21O69Onc024517 for ; Thu, 24 Feb 2022 00:02:30 -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=V0ldjVEQws6Rlz+/X0dTU9N7+Dv3baNaXAqeyVbq9+A=; b=E90j0231RqUSgs/YWfcQQfuUWGHNCiuwnVyPiEtJj1teVz2gV6PiGBK3cK9s18cm1G8B QvKhkmPHLve+jkDg62lsjAegqZgM12ohYOq3Br2ntpCQ0AXX4+KHh47hmMik174ZlMjN 7fq5DKIJIkwnfqt74LVrhl/MRBpWI0TaThq0mhkvkxT2DZGRWVDCSayZflJJ03oxnCgA UDSG9T8chHN6EHEOnUTalZDhqVNnTJitAPVYfgwrcvzAPYjSovbTi+pKhCxhmgzIujd/ ZLsBZ8aO0asHQQqjhKWuCC8dCUFBITWQ+T64oHcKLnmm9k7+TBzdXU8yyWEcscdIgc46 nQ== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3edjernekb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 24 Feb 2022 00:02:30 -0800 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 24 Feb 2022 00:02:28 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Thu, 24 Feb 2022 00:02:28 -0800 Received: from localhost.localdomain (unknown [10.28.48.103]) by maili.marvell.com (Postfix) with ESMTP id CBC2B3F70A2; Thu, 24 Feb 2022 00:02:25 -0800 (PST) From: Rakesh Kudurumalla To: Pavan Nikhilesh , Shijith Thotton , Nithin Dabilpuram , "Kiran Kumar K" , Sunil Kumar Kori , Satha Rao CC: , , Rakesh Kudurumalla Subject: [PATCH 2/2] event/cnxk: add callback handler to read ptp timestamp Date: Thu, 24 Feb 2022 13:32:17 +0530 Message-ID: <20220224080217.2895297-2-rkudurumalla@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220224080217.2895297-1-rkudurumalla@marvell.com> References: <20220224080217.2895297-1-rkudurumalla@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: z_nJpcCaQ03xfE33C-77xyq7Fc6sYv-A X-Proofpoint-GUID: z_nJpcCaQ03xfE33C-77xyq7Fc6sYv-A X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.64.514 definitions=2022-02-23_09,2022-02-23_01,2022-02-23_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 timestamp resolution for an incoming and outgoing packets is different for CN10k and CN9K.Added platform specific callback to retrieve timestamp in correct format when read by application Signed-off-by: Rakesh Kudurumalla --- drivers/event/cnxk/cn10k_worker.h | 4 ++-- drivers/event/cnxk/cn9k_worker.h | 4 ++-- drivers/net/cnxk/cnxk_ethdev.h | 28 ---------------------------- 3 files changed, 4 insertions(+), 32 deletions(-) diff --git a/drivers/event/cnxk/cn10k_worker.h b/drivers/event/cnxk/cn10k_worker.h index e8255eaca2..d288c66cac 100644 --- a/drivers/event/cnxk/cn10k_worker.h +++ b/drivers/event/cnxk/cn10k_worker.h @@ -179,7 +179,7 @@ cn10k_process_vwqe(uintptr_t vwqe, uint16_t port_id, const uint32_t flags, /* Extracting tstamp, if PTP enabled*/ tstamp_ptr = *(uint64_t *)(((struct nix_wqe_hdr_s *)cqe) + CNXK_SSO_WQE_SG_PTR); - cnxk_nix_mbuf_to_tstamp((struct rte_mbuf *)mbuf, tstamp, + cn10k_nix_mbuf_to_tstamp((struct rte_mbuf *)mbuf, tstamp, flags & NIX_RX_OFFLOAD_TSTAMP_F, (uint64_t *)tstamp_ptr); wqe[0] = (uint64_t *)mbuf; @@ -269,7 +269,7 @@ cn10k_sso_hws_get_work(struct cn10k_sso_hws *ws, struct rte_event *ev, tstamp_ptr = *(uint64_t *)(((struct nix_wqe_hdr_s *) gw.u64[1]) + CNXK_SSO_WQE_SG_PTR); - cnxk_nix_mbuf_to_tstamp((struct rte_mbuf *)mbuf, + cn10k_nix_mbuf_to_tstamp((struct rte_mbuf *)mbuf, ws->tstamp, flags & NIX_RX_OFFLOAD_TSTAMP_F, (uint64_t *)tstamp_ptr); diff --git a/drivers/event/cnxk/cn9k_worker.h b/drivers/event/cnxk/cn9k_worker.h index 2107ff7b16..c03b49323d 100644 --- a/drivers/event/cnxk/cn9k_worker.h +++ b/drivers/event/cnxk/cn9k_worker.h @@ -205,7 +205,7 @@ cn9k_sso_hws_dual_get_work(uint64_t base, uint64_t pair_base, tstamp_ptr = *(uint64_t *)(((struct nix_wqe_hdr_s *) gw.u64[1]) + CNXK_SSO_WQE_SG_PTR); - cnxk_nix_mbuf_to_tstamp((struct rte_mbuf *)mbuf, + cn9k_nix_mbuf_to_tstamp((struct rte_mbuf *)mbuf, dws->tstamp, flags & NIX_RX_OFFLOAD_TSTAMP_F, (uint64_t *)tstamp_ptr); @@ -281,7 +281,7 @@ cn9k_sso_hws_get_work(struct cn9k_sso_hws *ws, struct rte_event *ev, tstamp_ptr = *(uint64_t *)(((struct nix_wqe_hdr_s *) gw.u64[1]) + CNXK_SSO_WQE_SG_PTR); - cnxk_nix_mbuf_to_tstamp((struct rte_mbuf *)mbuf, + cn9k_nix_mbuf_to_tstamp((struct rte_mbuf *)mbuf, ws->tstamp, flags & NIX_RX_OFFLOAD_TSTAMP_F, (uint64_t *)tstamp_ptr); diff --git a/drivers/net/cnxk/cnxk_ethdev.h b/drivers/net/cnxk/cnxk_ethdev.h index ce42b8625a..351b9f8fcf 100644 --- a/drivers/net/cnxk/cnxk_ethdev.h +++ b/drivers/net/cnxk/cnxk_ethdev.h @@ -714,34 +714,6 @@ cnxk_nix_timestamp_dynfield(struct rte_mbuf *mbuf, rte_mbuf_timestamp_t *); } -static __rte_always_inline void -cnxk_nix_mbuf_to_tstamp(struct rte_mbuf *mbuf, - struct cnxk_timesync_info *tstamp, - const uint8_t ts_enable, uint64_t *tstamp_ptr) -{ - if (ts_enable) { - 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. - */ - *cnxk_nix_timestamp_dynfield(mbuf, tstamp) = - rte_be_to_cpu_64(*tstamp_ptr); - /* RTE_MBUF_F_RX_IEEE1588_TMST flag needs to be set only in case - * PTP packets are received. - */ - if (mbuf->packet_type == RTE_PTYPE_L2_ETHER_TIMESYNC) { - tstamp->rx_tstamp = - *cnxk_nix_timestamp_dynfield(mbuf, tstamp); - tstamp->rx_ready = 1; - mbuf->ol_flags |= RTE_MBUF_F_RX_IEEE1588_PTP | - RTE_MBUF_F_RX_IEEE1588_TMST | - tstamp->rx_tstamp_dynflag; - } - } -} - static __rte_always_inline uintptr_t cnxk_nix_sa_base_get(uint16_t port, const void *lookup_mem) {