From patchwork Tue Oct 1 06:00:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 144769 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 3AAE845A74; Tue, 1 Oct 2024 08:01:12 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6CB6C402E3; Tue, 1 Oct 2024 08:01:09 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 05FE940654 for ; Tue, 1 Oct 2024 08:01:07 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 48UNtA7D000399 for ; Mon, 30 Sep 2024 23:01:07 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfpt0220; bh=i AWFJ1qGJrm/E7OiHJlj0JvWn37eFoxdw2ZyZAzCQ5c=; b=Dv2RyauKCw9VvEDrp HmCvqg4CqnqLckMMT2AvAMEH+sMm3eZOkl5yq1Y2VMAXqP3832E0eNAXAy9foHJB Qiteiefk52JFmbUE45aOGbEz+EMxlFf16e7g4PHH943SFZOvN4p8Wsj9IJhUMXwo liY+OEEu/7qImjpclINFdb0ujgQmpLymn0HlVAloNyEMMrDRjTgsNtR2Sjb85rzU 1gLzb3pwx6deikQMYkpT58KhUpVEVI4wGb/nkQ+ov7yDuZyij6QP9gy6oM3CSUEy GCBJDYDjDSJElLLaqftb2QAE2gZaNQ9MtXyRqB7ih7oar3IcNwIOJwkXD4JS7q1e pzjFg== Received: from dc5-exch05.marvell.com ([199.233.59.128]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 41xf5m2eh5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 30 Sep 2024 23:01:06 -0700 (PDT) Received: from DC5-EXCH05.marvell.com (10.69.176.209) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 30 Sep 2024 23:01:05 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 30 Sep 2024 23:01:05 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id 5BE035C68E6; Mon, 30 Sep 2024 23:01:02 -0700 (PDT) From: Nithin Dabilpuram To: , Nithin Dabilpuram , "Kiran Kumar K" , Sunil Kumar Kori , Satha Rao , Harman Kalra CC: , Rakesh Kudurumalla Subject: [PATCH v2 02/17] net/cnxk: handle timestamp correctly for VF Date: Tue, 1 Oct 2024 11:30:40 +0530 Message-ID: <20241001060055.3747591-2-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241001060055.3747591-1-ndabilpuram@marvell.com> References: <20241001060055.3747591-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: RWbcOmjQDnfHDyUFQDhhIOew9eJ_dZbP X-Proofpoint-GUID: RWbcOmjQDnfHDyUFQDhhIOew9eJ_dZbP X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-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 From: Rakesh Kudurumalla When timestamp is enabled on PF in kernel and respective VF is attached to application in DPDK mbuf_addr is getting corrupted in cnxk_nix_timestamp_dynfield() as "tstamp_dynfield_offset" is zero for PTP enabled PF This patch fixes the same Signed-off-by: Rakesh Kudurumalla --- drivers/net/cnxk/cn10k_ethdev.c | 12 +++++++++++- drivers/net/cnxk/cn9k_ethdev.c | 12 +++++++++++- drivers/net/cnxk/cnxk_ethdev.c | 2 +- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/drivers/net/cnxk/cn10k_ethdev.c b/drivers/net/cnxk/cn10k_ethdev.c index 55ed54bb0f..099890e959 100644 --- a/drivers/net/cnxk/cn10k_ethdev.c +++ b/drivers/net/cnxk/cn10k_ethdev.c @@ -473,7 +473,7 @@ cn10k_nix_ptp_info_update_cb(struct roc_nix *nix, bool ptp_en) struct cnxk_eth_dev *dev = (struct cnxk_eth_dev *)nix; struct rte_eth_dev *eth_dev; struct cn10k_eth_rxq *rxq; - int i; + int i, rc; if (!dev) return -EINVAL; @@ -496,7 +496,17 @@ cn10k_nix_ptp_info_update_cb(struct roc_nix *nix, bool ptp_en) * and MTU setting also requires MBOX message to be * sent(VF->PF) */ + if (dev->ptp_en) { + rc = rte_mbuf_dyn_rx_timestamp_register + (&dev->tstamp.tstamp_dynfield_offset, + &dev->tstamp.rx_tstamp_dynflag); + if (rc != 0) { + plt_err("Failed to register Rx timestamp field/flag"); + return -EINVAL; + } + } eth_dev->rx_pkt_burst = nix_ptp_vf_burst; + rte_eth_fp_ops[eth_dev->data->port_id].rx_pkt_burst = eth_dev->rx_pkt_burst; rte_mb(); } diff --git a/drivers/net/cnxk/cn9k_ethdev.c b/drivers/net/cnxk/cn9k_ethdev.c index ea92b1dcb6..4851e60f16 100644 --- a/drivers/net/cnxk/cn9k_ethdev.c +++ b/drivers/net/cnxk/cn9k_ethdev.c @@ -432,7 +432,7 @@ cn9k_nix_ptp_info_update_cb(struct roc_nix *nix, bool ptp_en) struct cnxk_eth_dev *dev = (struct cnxk_eth_dev *)nix; struct rte_eth_dev *eth_dev; struct cn9k_eth_rxq *rxq; - int i; + int i, rc; if (!dev) return -EINVAL; @@ -455,7 +455,17 @@ cn9k_nix_ptp_info_update_cb(struct roc_nix *nix, bool ptp_en) * and MTU setting also requires MBOX message to be * sent(VF->PF) */ + if (dev->ptp_en) { + rc = rte_mbuf_dyn_rx_timestamp_register + (&dev->tstamp.tstamp_dynfield_offset, + &dev->tstamp.rx_tstamp_dynflag); + if (rc != 0) { + plt_err("Failed to register Rx timestamp field/flag"); + return -EINVAL; + } + } eth_dev->rx_pkt_burst = nix_ptp_vf_burst; + rte_eth_fp_ops[eth_dev->data->port_id].rx_pkt_burst = eth_dev->rx_pkt_burst; rte_mb(); } diff --git a/drivers/net/cnxk/cnxk_ethdev.c b/drivers/net/cnxk/cnxk_ethdev.c index 38746c81c5..dd065c8269 100644 --- a/drivers/net/cnxk/cnxk_ethdev.c +++ b/drivers/net/cnxk/cnxk_ethdev.c @@ -1751,7 +1751,7 @@ cnxk_nix_dev_start(struct rte_eth_dev *eth_dev) else cnxk_eth_dev_ops.timesync_disable(eth_dev); - if (dev->rx_offloads & RTE_ETH_RX_OFFLOAD_TIMESTAMP) { + if (dev->rx_offloads & RTE_ETH_RX_OFFLOAD_TIMESTAMP || dev->ptp_en) { rc = rte_mbuf_dyn_rx_timestamp_register (&dev->tstamp.tstamp_dynfield_offset, &dev->tstamp.rx_tstamp_dynflag);