From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by mail.toke.dk (Postfix) with ESMTPS id A5DC0A21382 for ; Mon, 14 Aug 2023 20:05:16 +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=NLwR0hZl Received: by mail-pg1-x536.google.com with SMTP id 41be03b00d2f7-5650ef42f6dso2741828a12.0 for ; Mon, 14 Aug 2023 11:05:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1692036314; x=1692641114; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=m7g1R/21wNzU5e8eJcC+fpUif2cqg4RQzc6j7+Cbixw=; b=NLwR0hZljonn0iprYdGZXFuRHxpcnqiLK6RdF9URm4R08zhVSUDOU6W16EGdjcb9Mt 9UXnZw2t+dTJGr/SRdhWwvx1y5rPIA69ELhZioh6ZvapvK0ndw8iGp6dc3UAmeru0d6j 49VyCdJMo3hdJ8jfraJA5LdUJ++oRCMub8/8U+5NwR/h6aevFAGUmGqPOI4tQE8WgCoV LGD5nRla5EEgJ43wjIgLB96iF0z1IS1YPwV0It3CCtoDZG0SPhm0Myx3YVfEGSF29KOD dQje/8cBvp839QYpX1ldmktWvVB1YNoZxegQvVITKAg7+YjVBftYSAS4ZJMTjquHDoy3 a7Ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692036314; x=1692641114; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=m7g1R/21wNzU5e8eJcC+fpUif2cqg4RQzc6j7+Cbixw=; b=iIYpQMK0dYrGOcRFFnfDs/lJDnoJuABfKS+ttHmPf3uEYjyannVlKuBPvD9ww/dSha tIXD7XNN/6Mk/OCtxO3vTTjJ+vPf5npSsRskaY2VgulJBQ4B2iVG33Ha4r1mNXKf5j8z R5GRUoUEhEc6KfNOj35P0nqSZNB4XjWcigAn4OyWsrjtJIbastUiMKuPLMkZEPfX2Y73 OjdnBJx3Hwtn7A1bcUVbh9zZTjnlaX/oAxCGs7cSB6ovFXMwP+cWueqCIHmAYIxR/K9m Z82p5BcOySiLQmb16F40TcL3AVm28/RfOvRUgN+pXteZpc9loOQhIas6kjvANk4O4rB0 Zlkg== X-Gm-Message-State: AOJu0YzmD0o8nk6fx+wUcVfAenv5asONgrjOV2OwvJBYhp+cnSft1sw2 YR/rj1ey8zWN8zfRYYQSgilRc2rDA54noPI4mYw9iQ== X-Google-Smtp-Source: AGHT+IFmklskcpj993E1zbKMUrIDed1HAft3WDszMju3MwSdz1XnQqYUQhQEXysogzFrKlxLKlXEwy2bfBXlhMeSr8U= X-Received: by 2002:a17:90a:6046:b0:268:b682:23da with SMTP id h6-20020a17090a604600b00268b68223damr7465920pjm.34.1692036314332; Mon, 14 Aug 2023 11:05:14 -0700 (PDT) MIME-Version: 1.0 References: <20230809165418.2831456-1-sdf@google.com> <20230809165418.2831456-5-sdf@google.com> In-Reply-To: From: Stanislav Fomichev Date: Mon, 14 Aug 2023 11:05:02 -0700 Message-ID: To: Maciej Fijalkowski Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 2JCVBKVN3CEABDEHFY32DZ2HRUHT74T3 X-Message-ID-Hash: 2JCVBKVN3CEABDEHFY32DZ2HRUHT74T3 X-MailFrom: sdf@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, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, martin.lau@linux.dev, song@kernel.org, yhs@fb.com, john.fastabend@gmail.com, kpsingh@kernel.org, haoluo@google.com, jolsa@kernel.org, kuba@kernel.org, toke@kernel.org, willemb@google.com, dsahern@kernel.org, magnus.karlsson@intel.com, bjorn@kernel.org, hawk@kernel.org, netdev@vger.kernel.org, xdp-hints@xdp-project.net, Saeed Mahameed X-Mailman-Version: 3.3.8 Precedence: list Subject: [xdp-hints] Re: [PATCH bpf-next 4/9] net/mlx5e: Implement AF_XDP TX timestamp and checksum offload List-Id: XDP hardware hints design discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Mon, Aug 14, 2023 at 4:02=E2=80=AFAM Maciej Fijalkowski wrote: > > On Wed, Aug 09, 2023 at 09:54:13AM -0700, Stanislav Fomichev wrote: > > TX timestamp: > > - requires passing clock, not sure I'm passing the correct one (from > > cq->mdev), but the timestamp value looks convincing > > > > TX checksum: > > - looks like device does packet parsing (and doesn't accept custom > > start/offset), so I'm ignoring user offsets > > > > Cc: Saeed Mahameed > > Signed-off-by: Stanislav Fomichev > > --- > > drivers/net/ethernet/mellanox/mlx5/core/en.h | 4 +- > > .../net/ethernet/mellanox/mlx5/core/en/xdp.c | 72 ++++++++++++++++--- > > .../net/ethernet/mellanox/mlx5/core/en/xdp.h | 10 ++- > > .../ethernet/mellanox/mlx5/core/en/xsk/tx.c | 11 ++- > > .../net/ethernet/mellanox/mlx5/core/en_main.c | 1 + > > 5 files changed, 82 insertions(+), 16 deletions(-) > > > > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net= /ethernet/mellanox/mlx5/core/en.h > > index 0f8f70b91485..6f38627ae7f8 100644 > > --- a/drivers/net/ethernet/mellanox/mlx5/core/en.h > > +++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h > > @@ -476,10 +476,12 @@ struct mlx5e_xdp_info_fifo { > > > > struct mlx5e_xdpsq; > > struct mlx5e_xmit_data; > > +struct xsk_tx_metadata; > > typedef int (*mlx5e_fp_xmit_xdp_frame_check)(struct mlx5e_xdpsq *); > > typedef bool (*mlx5e_fp_xmit_xdp_frame)(struct mlx5e_xdpsq *, > > struct mlx5e_xmit_data *, > > - int); > > + int, > > + struct xsk_tx_metadata *); > > > > struct mlx5e_xdpsq { > > /* data path */ > > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c b/drivers= /net/ethernet/mellanox/mlx5/core/en/xdp.c > > index 40589cebb773..197d372048ec 100644 > > --- a/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c > > +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c > > @@ -102,7 +102,7 @@ mlx5e_xmit_xdp_buff(struct mlx5e_xdpsq *sq, struct = mlx5e_rq *rq, > > xdptxd->dma_addr =3D dma_addr; > > > > if (unlikely(!INDIRECT_CALL_2(sq->xmit_xdp_frame, mlx5e_x= mit_xdp_frame_mpwqe, > > - mlx5e_xmit_xdp_frame, sq, x= dptxd, 0))) > > + mlx5e_xmit_xdp_frame, sq, x= dptxd, 0, NULL))) > > return false; > > > > /* xmit_mode =3D=3D MLX5E_XDP_XMIT_MODE_FRAME */ > > @@ -144,7 +144,7 @@ mlx5e_xmit_xdp_buff(struct mlx5e_xdpsq *sq, struct = mlx5e_rq *rq, > > xdptxd->dma_addr =3D dma_addr; > > > > if (unlikely(!INDIRECT_CALL_2(sq->xmit_xdp_frame, mlx5e_xmit_xdp_= frame_mpwqe, > > - mlx5e_xmit_xdp_frame, sq, xdptxd, 0= ))) > > + mlx5e_xmit_xdp_frame, sq, xdptxd, 0= , NULL))) > > return false; > > > > /* xmit_mode =3D=3D MLX5E_XDP_XMIT_MODE_PAGE */ > > @@ -260,6 +260,37 @@ const struct xdp_metadata_ops mlx5e_xdp_metadata_o= ps =3D { > > .xmo_rx_hash =3D mlx5e_xdp_rx_hash, > > }; > > > > +struct mlx5e_xsk_tx_complete { > > + struct mlx5_cqe64 *cqe; > > + struct mlx5e_cq *cq; > > +}; > > + > > +static u64 mlx5e_xsk_fill_timestamp(void *_priv) > > +{ > > + struct mlx5e_xsk_tx_complete *priv =3D _priv; > > + u64 ts; > > + > > + ts =3D get_cqe_ts(priv->cqe); > > + > > + if (mlx5_is_real_time_rq(priv->cq->mdev) || mlx5_is_real_time_sq(= priv->cq->mdev)) > > + return mlx5_real_time_cyc2time(&priv->cq->mdev->clock, ts= ); > > + > > + return mlx5_timecounter_cyc2time(&priv->cq->mdev->clock, ts); > > +} > > + > > +static void mlx5e_xsk_request_checksum(u16 csum_start, u16 csum_offset= , void *priv) > > +{ > > + struct mlx5_wqe_eth_seg *eseg =3D priv; > > + > > + /* HW/FW is doing parsing, so offsets are largely ignored. */ > > + eseg->cs_flags |=3D MLX5_ETH_WQE_L3_CSUM | MLX5_ETH_WQE_L4_CSUM; > > +} > > + > > +const struct xsk_tx_metadata_ops mlx5e_xsk_tx_metadata_ops =3D { > > + .tmo_fill_timestamp =3D mlx5e_xsk_fill_timestamp, > > + .tmo_request_checksum =3D mlx5e_xsk_request_checksum, > > Can you explain to us why mlx5 doesn't need to implement the request > timestamp op? There is always a timestamp in the tx completion descriptor, so no need to explicitly request it.