From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1ACE5A04E7; Sun, 1 Nov 2020 19:36:19 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2954729C6; Sun, 1 Nov 2020 19:36:17 +0100 (CET) Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com [209.85.215.195]) by dpdk.org (Postfix) with ESMTP id 23AC328EE for ; Sun, 1 Nov 2020 19:36:16 +0100 (CET) Received: by mail-pg1-f195.google.com with SMTP id n16so8833137pgv.13 for ; Sun, 01 Nov 2020 10:36:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=B5tIb11WixHyRKBLPjJd531Qr5cOvts22neQjo3Pkok=; b=E221g47qulnHYM62bxP8ODWXXvjVqyqD7riv0itT1sbJYIySuB197UgdPvfotV9rry VcxIETW1QPgGtO6F+qHroeBI9cgIf4yKUdM6EKPMuKyn3LID8gdXMTRVKIET0178otdl KI1EQKCh7Q7LYSbSsUgRFKv4ZRazljt0xEtkfGYvZOPb8ONEpO8uymY67Al7mqBWbLfT 24RFU/CT3CtHTzjhawJtdJzlQ5qIjQoomhyTLxjCXyuuK2OnMYR7pSndqYAFLvob4dyh Z5u6yVgiLZNZfJvj65S4uaj5jCod+Ngz3bV+ls2VjFDJoqcqyQpU3ybtIR7ivLAOp2e4 gSGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=B5tIb11WixHyRKBLPjJd531Qr5cOvts22neQjo3Pkok=; b=N5i7mFRZdie61ZLUBI1He30xhOIg3F028xRvx5HiR2ocYZYjR++ci5nkpPtKmEJGSM 4FSO+1jL90HSLeG3Fra1i6S9pP+IQBUHwKQSG7rRIkpJsWgOKwkHTK30iKqBbJ1dhkTK RUiIYXP+gnN7UnwFj3tVeZUEpZXngnWZ69TZuCiGji3Ge5dqFP4p5Pf7xzphks50VZTB u8joU6kJ7ETuJU1jYP+cWPZvgNtV/xQATh3XlRWOxIpdyGDm6XOWvAhDazFc3vh3I4xu AZiYGp4HTB7QA2f64b6i1/7+Ov3pGzFQQfBugiTVRjI335aHawJH0fxZ4pVIGqLiAcEG 4Dgg== X-Gm-Message-State: AOAM5326GUHpMCUwuN2RGfQJimz6CiFr1r/XpGsC0IivrEmfyEDGCJ3/ SBnqxuf4pz/QUuoHLBHvSG9OtF4bFvDNwhHe9gJcmsWi99+gB4qN X-Google-Smtp-Source: ABdhPJx+NRWbhMSxR6ZSUWwsQ2ui4wOhyFRU5V6hN/V9qk4J0EmZB8GTakeuizrxO2enuTwHmYRO+yKbViTWuBEUQSM= X-Received: by 2002:a92:c5ac:: with SMTP id r12mr8259904ilt.162.1604255298359; Sun, 01 Nov 2020 10:28:18 -0800 (PST) MIME-Version: 1.0 References: <20201029092751.3837177-1-thomas@monjalon.net> <20201101180626.2198868-1-thomas@monjalon.net> <20201101180626.2198868-11-thomas@monjalon.net> In-Reply-To: <20201101180626.2198868-11-thomas@monjalon.net> From: Jerin Jacob Date: Sun, 1 Nov 2020 23:58:02 +0530 Message-ID: To: Thomas Monjalon Cc: dpdk-dev , Ferruh Yigit , David Marchand , "Richardson, Bruce" , Olivier Matz , Andrew Rybchenko , Jerin Jacob , Viacheslav Ovsiienko , Nithin Dabilpuram , Kiran Kumar K , Ray Kinsella , Neil Horman Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH v2 10/14] net/octeontx2: switch timestamp to dynamic mbuf field 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" On Sun, Nov 1, 2020 at 11:40 PM Thomas Monjalon wrote: > > The mbuf timestamp is moved to a dynamic field > in order to allow removal of the deprecated static field. > The related mbuf flag is also replaced. > > Signed-off-by: Thomas Monjalon > --- > drivers/net/octeontx2/otx2_ethdev.c | 33 +++++++++++++++++++++++++++++ > drivers/net/octeontx2/otx2_rx.h | 19 ++++++++++++++--- > drivers/net/octeontx2/version.map | 7 ++++++ > 3 files changed, 56 insertions(+), 3 deletions(-) > > diff --git a/drivers/net/octeontx2/otx2_ethdev.c b/drivers/net/octeontx2/otx2_ethdev.c > index cfb733a4b5..ad95219438 100644 > --- a/drivers/net/octeontx2/otx2_ethdev.c > +++ b/drivers/net/octeontx2/otx2_ethdev.c > @@ -4,6 +4,7 @@ > > #include > > +#include > #include > #include > #include > @@ -14,6 +15,35 @@ > #include "otx2_ethdev.h" > #include "otx2_ethdev_sec.h" > > +uint64_t rte_pmd_octeontx2_timestamp_rx_dynflag; > +int rte_pmd_octeontx2_timestamp_dynfield_offset = -1; Instead of the global variable, please move the offset to struct otx2_timesync_info(which is used in fastpath) and accessible in slow path. > + > +static int > +otx2_rx_timestamp_setup(uint16_t flags) > +{ > + int timestamp_rx_dynflag_offset; > + > + if ((flags & NIX_RX_OFFLOAD_TSTAMP_F) == 0) > + return 0; > + > + rte_pmd_octeontx2_timestamp_dynfield_offset = rte_mbuf_dynfield_lookup( > + RTE_MBUF_DYNFIELD_TIMESTAMP_NAME, NULL); > + if (rte_pmd_octeontx2_timestamp_dynfield_offset < 0) { > + otx2_err("Failed to lookup timestamp field"); > + return -rte_errno; > + } > + timestamp_rx_dynflag_offset = rte_mbuf_dynflag_lookup( > + RTE_MBUF_DYNFLAG_RX_TIMESTAMP_NAME, NULL); > + if (timestamp_rx_dynflag_offset < 0) { > + otx2_err("Failed to lookup Rx timestamp flag"); > + return -rte_errno; > + } > + rte_pmd_octeontx2_timestamp_rx_dynflag = > + RTE_BIT64(timestamp_rx_dynflag_offset); > + > + return 0; > +} > + > static inline uint64_t > nix_get_rx_offload_capa(struct otx2_eth_dev *dev) > { > @@ -1874,6 +1904,9 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev) > dev->tx_offload_flags |= nix_tx_offload_flags(eth_dev); > dev->rss_info.rss_grps = NIX_RSS_GRPS; > > + if (otx2_rx_timestamp_setup(dev->rx_offload_flags) != 0) > + goto fail_offloads; > + > nb_rxq = RTE_MAX(data->nb_rx_queues, 1); > nb_txq = RTE_MAX(data->nb_tx_queues, 1); > > diff --git a/drivers/net/octeontx2/otx2_rx.h b/drivers/net/octeontx2/otx2_rx.h > index 61a5c436dd..6981edce82 100644 > --- a/drivers/net/octeontx2/otx2_rx.h > +++ b/drivers/net/octeontx2/otx2_rx.h > @@ -63,6 +63,18 @@ union mbuf_initializer { > uint64_t value; > }; > > +/* variables are exported because this file is included in other drivers */ > +extern uint64_t rte_pmd_octeontx2_timestamp_rx_dynflag; > +extern int rte_pmd_octeontx2_timestamp_dynfield_offset; > + > +static inline rte_mbuf_timestamp_t * > +otx2_timestamp_dynfield(struct rte_mbuf *mbuf) Please take the offset from struct otx2_timesync_info *tstamp. it already available in otx2_nix_mbuf_to_tstamp(). See below. > +{ > + return RTE_MBUF_DYNFIELD(mbuf, > + rte_pmd_octeontx2_timestamp_dynfield_offset, > + rte_mbuf_timestamp_t *); > +} > + > static __rte_always_inline void > otx2_nix_mbuf_to_tstamp(struct rte_mbuf *mbuf, > struct otx2_timesync_info *tstamp, const uint16_t flag, > @@ -77,15 +89,16 @@ otx2_nix_mbuf_to_tstamp(struct rte_mbuf *mbuf, > /* Reading the rx timestamp inserted by CGX, viz at > * starting of the packet data. > */ > - mbuf->timestamp = rte_be_to_cpu_64(*tstamp_ptr); > + *otx2_timestamp_dynfield(mbuf) = rte_be_to_cpu_64(*tstamp_ptr); > /* PKT_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 = mbuf->timestamp; > + tstamp->rx_tstamp = *otx2_timestamp_dynfield(mbuf); > tstamp->rx_ready = 1; > mbuf->ol_flags |= PKT_RX_IEEE1588_PTP | > - PKT_RX_IEEE1588_TMST | PKT_RX_TIMESTAMP; > + PKT_RX_IEEE1588_TMST | > + rte_pmd_octeontx2_timestamp_rx_dynflag; > } > } > } > diff --git a/drivers/net/octeontx2/version.map b/drivers/net/octeontx2/version.map > index 4a76d1d52d..d4f4784bcd 100644 > --- a/drivers/net/octeontx2/version.map > +++ b/drivers/net/octeontx2/version.map > @@ -1,3 +1,10 @@ > DPDK_21 { > local: *; > }; > + > +INTERNAL { > + global: > + > + rte_pmd_octeontx2_timestamp_dynfield_offset; > + rte_pmd_octeontx2_timestamp_rx_dynflag; No need to export this function if offset is part of struct otx2_timesync_info > +}; > -- > 2.28.0 >