From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-x44a.google.com (mail-pf1-x44a.google.com [IPv6:2607:f8b0:4864:20::44a]) by mail.toke.dk (Postfix) with ESMTPS id DC60AA06509 for ; Fri, 12 May 2023 20:19:57 +0200 (CEST) Authentication-Results: mail.toke.dk; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20221208 header.b=m7pNH+tJ Received: by mail-pf1-x44a.google.com with SMTP id d2e1a72fcca58-643a9203dc2so5744896b3a.1 for ; Fri, 12 May 2023 11:19:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1683915595; x=1686507595; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=Je0QZ3OEcPYIjlzwUZPK1i4M9j5mxA5BuIpDlUTvQs0=; b=m7pNH+tJv1eJb1PQNpYn7KL+B8x6ruIGuglVNB8oPweOb20MnT+8J0OjNba+0GMzAK i2qJQSsCLilZbh/VpSYzFhr+8TWJLN04ELWSCloAo8uOukOYPyZW2y8WCHI2gWKiGPQV mrdpFmtHsu5KgALTxLapvn6bfo9H/5o0X4lIsxV8DrTfvLPVA+RJ+JLrS8SyutdKHk91 ZZOOJNOsgnh7HNk/c9g6OpoP2ftc70yyq7mybLStwyewVu3ewf9Fk314s4R2f5cbmvbp 1CR/ln9gWb+p/8b1nsfv1vw52Mmb4WkjQI0lXCU+fYFEL2vb9AAks2Y6sdhizLX3G56c UgGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683915595; x=1686507595; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Je0QZ3OEcPYIjlzwUZPK1i4M9j5mxA5BuIpDlUTvQs0=; b=HYArfFx9rsr4xQsDQQQF1SprUaC8ht207trmZ2fjM1oyjdGSxShqgLfOFMhWxlDRSc ZTTRHGLJAY4ZNUbVn61K2ycZQRSd4AxhsbmBKIi5rANhOZuGNzZ4IAfurCGmEsliRw5Y cymH073VwSsw/YFYq1OzfJpFn0c0dfPQ6upUzhRnhJWc6fsyY5JY70IX5gNYw4TEFa6z ZVjGGHQFEVQxfunXqFuiEVNsfk+5eZkXrQkiCU04PqC/CeXbcEy1hx/px/X7QAXtdHqf xzyIXH7Fu/HiCmd9Isx3F/ESYjxQMsKR7P5lM5hb/i6Q+1zmuSqqZ4t0MY0tfS688hwN kAiw== X-Gm-Message-State: AC+VfDyUXTnqkM8rzxgk4DQNrXOsL88XtRsPXbtQ5VI7zaOnaTpiIr3N LjrgqF94hRxvwLDiZ/3jOJcLm44= X-Google-Smtp-Source: ACHHUZ4ijGlK7Lm+EEX2bsGa22HNJnpvzQmaM/g3aYsO0WEKo4uUmlXchpuaAJE65klqvjmYPTAzyvA= X-Received: from sdf.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5935]) (user=sdf job=sendgmr) by 2002:a05:6a00:be7:b0:641:31b1:e781 with SMTP id x39-20020a056a000be700b0064131b1e781mr7072190pfu.5.1683915595291; Fri, 12 May 2023 11:19:55 -0700 (PDT) Date: Fri, 12 May 2023 11:19:53 -0700 In-Reply-To: <20230512152607.992209-7-larysa.zaremba@intel.com> Mime-Version: 1.0 References: <20230512152607.992209-1-larysa.zaremba@intel.com> <20230512152607.992209-7-larysa.zaremba@intel.com> Message-ID: From: Stanislav Fomichev To: Larysa Zaremba Content-Type: text/plain; charset="utf-8" Message-ID-Hash: SHFJSZITHXW5UHWOS2EZWLNK7RKRRPGP X-Message-ID-Hash: SHFJSZITHXW5UHWOS2EZWLNK7RKRRPGP X-MailFrom: 3S4NeZAMKCfQoZbckkcha.YkitZl-dejpotZl-lnkfaYp.jap@flex--sdf.bounces.google.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: bpf@vger.kernel.org, Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Jakub Kicinski , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Jiri Olsa , Jesse Brandeburg , Tony Nguyen , Anatoly Burakov , Jesper Dangaard Brouer , Alexander Lobakin , Magnus Karlsson , Maryam Tahhan , xdp-hints@xdp-project.net, netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org, linux-kernel@vger.kernel.org X-Mailman-Version: 3.3.8 Precedence: list Subject: [xdp-hints] Re: [PATCH RESEND bpf-next 06/15] ice: Support HW timestamp hint List-Id: XDP hardware hints design discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On 05/12, Larysa Zaremba wrote: > Use previously refactored code and create a function > that allows XDP code to read HW timestamp. > > HW timestamp is the first supported hint in the driver, > so also add xdp_metadata_ops. > > Signed-off-by: Larysa Zaremba > --- > drivers/net/ethernet/intel/ice/ice.h | 2 ++ > drivers/net/ethernet/intel/ice/ice_main.c | 1 + > drivers/net/ethernet/intel/ice/ice_txrx_lib.c | 22 +++++++++++++++++++ > 3 files changed, 25 insertions(+) > > diff --git a/drivers/net/ethernet/intel/ice/ice.h b/drivers/net/ethernet/intel/ice/ice.h > index aa32111afd6e..ba1bb8392db1 100644 > --- a/drivers/net/ethernet/intel/ice/ice.h > +++ b/drivers/net/ethernet/intel/ice/ice.h > @@ -962,4 +962,6 @@ static inline void ice_clear_rdma_cap(struct ice_pf *pf) > set_bit(ICE_FLAG_UNPLUG_AUX_DEV, pf->flags); > clear_bit(ICE_FLAG_RDMA_ENA, pf->flags); > } > + > +extern const struct xdp_metadata_ops ice_xdp_md_ops; > #endif /* _ICE_H_ */ > diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c > index a1f7c8edc22f..cda6c4a80737 100644 > --- a/drivers/net/ethernet/intel/ice/ice_main.c > +++ b/drivers/net/ethernet/intel/ice/ice_main.c > @@ -3378,6 +3378,7 @@ static void ice_set_ops(struct ice_vsi *vsi) > > netdev->netdev_ops = &ice_netdev_ops; > netdev->udp_tunnel_nic_info = &pf->hw.udp_tunnel_nic; > + netdev->xdp_metadata_ops = &ice_xdp_md_ops; > ice_set_ethtool_ops(netdev); > > if (vsi->type != ICE_VSI_PF) > diff --git a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c > index 2515f5f7a2b6..e9589cadf811 100644 > --- a/drivers/net/ethernet/intel/ice/ice_txrx_lib.c > +++ b/drivers/net/ethernet/intel/ice/ice_txrx_lib.c > @@ -537,3 +537,25 @@ void ice_finalize_xdp_rx(struct ice_tx_ring *xdp_ring, unsigned int xdp_res, > spin_unlock(&xdp_ring->tx_lock); > } > } > + > +/** > + * ice_xdp_rx_hw_ts - HW timestamp XDP hint handler > + * @ctx: XDP buff pointer > + * @ts_ns: destination address > + * > + * Copy HW timestamp (if available) to the destination address. > + */ > +static int ice_xdp_rx_hw_ts(const struct xdp_md *ctx, u64 *ts_ns) > +{ > + const struct ice_xdp_buff *xdp_ext = (void *)ctx; > + > + if (!ice_ptp_copy_rx_hwts_from_desc(xdp_ext->rx_ring, > + xdp_ext->eop_desc, ts_ns)) > + return -EOPNOTSUPP; Per Jesper's recent update, should this be ENODATA?