From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by mail.toke.dk (Postfix) with ESMTPS id E4676A33ACC for ; Fri, 20 Oct 2023 20:06:10 +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=20230601 header.b=uIywxa8p Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-d9caf486775so1371495276.2 for ; Fri, 20 Oct 2023 11:06:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1697825169; x=1698429969; darn=xdp-project.net; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=KjKRhB2ZGmjdY+V3m2wDwglDBkT5iWSc3BrmrIM618A=; b=uIywxa8p4EIM8qoEq5SzSdSSY7tQqfdexwiOg72so84feO7Y0X6S0r7ewk/FPOiw1r +HTBUtq92zMzCXqqsdjp2kdw9WIc12eGqEReZcKru0qSsT5ONDJjriLF0kDED6M8bl8Q v+Ag17LFJxYIxBtoOd/x71nRtb7OFlztYhy1XUK744dapUpT/DfJ6Hx6ctICfzjpww2X +gtoQjCvwyiHcekhXxb5Bv/rq5wY4e1rBK9+D43Dyaykqrw3ZKQEd6u4dIFUCga5RRgJ c/njQURJiG8MiWYC08lkXs0pur42hni5LSdcVNpj2JIyjUJO379AiGKrI9Y7ybQh4k0O PM/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697825169; x=1698429969; 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=KjKRhB2ZGmjdY+V3m2wDwglDBkT5iWSc3BrmrIM618A=; b=LaaSmu8QjGUKMxkJxANU2vuxXfeqHnaiKdlEBMsrW+WWEytCnSCm2h4TCq3mg2rD4o oS4CmylPTYtgjkWFNppxGrkKaWC2O3Hed+oU7FM0zf8YO+Nh9ljx+DeFSUxvmEg2rUlX GHw+LkX4kafYopkqm5S1yoQGiaMR2TVBxclusoWhlt4VqYT3f4WFYZ99e4eLlxPW6PHl hD0k2GyEjEoSYwKBqd3zzrqaRWiCx8aNMKh/iHqWOO9/+CyS5UkBriuAyQl84e37c63s l44NpsEXBAuVjcSMRUFD++hE7/rEILbxo7RG2gzJqzB9FtpHX6cPj4HJj7nBfw1W5y2G znFg== X-Gm-Message-State: AOJu0YxHavnMo3YQKqVRtsQ53tdS0C72B1TtFkl80QxZhvKT4tWUSsc5 9UaiPSMDpqxf8fAGLhd6509aX2k= X-Google-Smtp-Source: AGHT+IFZSNaTZQdlBfpXvahW6QtUTkP5/JLdYWQRsMYTIf7kO/MHQaXtfOceBtkfAcpN9Lzos6/xzT8= X-Received: from sdf.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5935]) (user=sdf job=sendgmr) by 2002:a25:8e05:0:b0:d74:93a1:70a2 with SMTP id p5-20020a258e05000000b00d7493a170a2mr58369ybl.5.1697825169671; Fri, 20 Oct 2023 11:06:09 -0700 (PDT) Date: Fri, 20 Oct 2023 11:06:07 -0700 In-Reply-To: <20231020174940.gjubehkouns2hmgz@MacBook-Pro-49.local> Mime-Version: 1.0 References: <20231019174944.3376335-1-sdf@google.com> <20231019174944.3376335-3-sdf@google.com> <20231020174940.gjubehkouns2hmgz@MacBook-Pro-49.local> Message-ID: From: Stanislav Fomichev To: Alexei Starovoitov Content-Type: text/plain; charset="utf-8" Message-ID-Hash: LVSDBO6QUTDYSNJWUUZHGL4MGL35IPRA X-Message-ID-Hash: LVSDBO6QUTDYSNJWUUZHGL4MGL35IPRA X-MailFrom: 3kcEyZQMKCRA8tvw44w1u.s42Dt5-xy398Dt5-574zus9.3u9@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, 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, maciej.fijalkowski@intel.com, hawk@kernel.org, yoong.siang.song@intel.com, netdev@vger.kernel.org, xdp-hints@xdp-project.net, saeedm@nvidia.com X-Mailman-Version: 3.3.8 Precedence: list Subject: [xdp-hints] Re: [PATCH bpf-next v4 02/11] xsk: Add TX timestamp and TX checksum offload support List-Id: XDP hardware hints design discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On 10/20, Alexei Starovoitov wrote: > On Thu, Oct 19, 2023 at 10:49:35AM -0700, Stanislav Fomichev wrote: > > diff --git a/include/uapi/linux/if_xdp.h b/include/uapi/linux/if_xdp.h > > index 2ecf79282c26..ecfd67988283 100644 > > --- a/include/uapi/linux/if_xdp.h > > +++ b/include/uapi/linux/if_xdp.h > > @@ -106,6 +106,43 @@ struct xdp_options { > > #define XSK_UNALIGNED_BUF_ADDR_MASK \ > > ((1ULL << XSK_UNALIGNED_BUF_OFFSET_SHIFT) - 1) > > > > +/* Request transmit timestamp. Upon completion, put it into tx_timestamp > > + * field of struct xsk_tx_metadata. > > + */ > > +#define XDP_TX_METADATA_TIMESTAMP (1 << 0) > > + > > +/* Request transmit checksum offload. Checksum start position and offset > > + * are communicated via csum_start and csum_offset fields of struct > > + * xsk_tx_metadata. > > + */ > > +#define XDP_TX_METADATA_CHECKSUM (1 << 1) > > + > > +/* Force checksum calculation in software. Can be used for testing or > > + * working around potential HW issues. This option causes performance > > + * degradation and only works in XDP_COPY mode. > > + */ > > +#define XDP_TX_METADATA_CHECKSUM_SW (1 << 2) > > + > > +struct xsk_tx_metadata { > > + union { > > + struct { > > + __u32 flags; > > + > > + /* XDP_TX_METADATA_CHECKSUM */ > > + > > + /* Offset from desc->addr where checksumming should start. */ > > + __u16 csum_start; > > + /* Offset from csum_start where checksum should be stored. */ > > + __u16 csum_offset; > > + }; > > + > > + struct { > > + /* XDP_TX_METADATA_TIMESTAMP */ > > + __u64 tx_timestamp; > > + } completion; > > + }; > > +}; > > Could you add a comment to above union that csum fields are consumed by the driver > before it xmits the packet while timestamp is filled during xmit, so union > doesn't prevent using both features simultaneously. > It's clear from the example, but not obvious from uapi and the doc in patch 11 > doesn't clarify it either. > > Also please add a name to csum part of the union like you did for completion. > We've learned it the hard way with bpf_attr. All anon structs better have field name > within a union. Helps extensibility (avoid conflicts) in the long term. Sure, will do, thanks! > Other than this the patch set looks great to me. > With Saeed and Magnus acks we can take it in. Magnus is on CC, so I hope see sees the request. Added Saeed here as well. Saeed, can you please take a look at the mlx part? You've been on CC for a particular patch, but just in case: https://lore.kernel.org/bpf/20231019174944.3376335-5-sdf@google.com/T/#u