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 71B9CA2A305 for ; Thu, 14 Sep 2023 23:05:01 +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=sf729dNt Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-c647150c254so2704835276.1 for ; Thu, 14 Sep 2023 14:05:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1694725500; x=1695330300; 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=s8lJ/wwRdtQO1FPJ3x7uMnAOgiGCvLMvp8mW8wlA0oo=; b=sf729dNtKlwMz9e7NwxmbRdrCEWvkJrnuYSLd3ONLduH0DWlgQLa3/9wcCIa/EKFrR cejqknCH9dYKzmALP9mff73zWvTZrcUvnNSECacQStGuAPEcMmA7/5fdElDwkhFJMvAE WO6O4sWkLu3MeiVxPd4bLXdA7VRQMOdeYVxykqYKa9rn9LEo/qQ74SmLXWD0TOSKXsDq wjucKFDpa2szzgrPwitTBSizpwLnYs9iXqmn1H8oJEC2nDpiiFFyZ7SAo8i93YkdKy7f R3Ro/3m/5AlUr39Ovv6n/cHtQfln4aJZdvhmlMPvbdG7MqBq9S8wvXfE+zsCZBOww1lM aOqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694725500; x=1695330300; 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=s8lJ/wwRdtQO1FPJ3x7uMnAOgiGCvLMvp8mW8wlA0oo=; b=DKlKgg//Uox/UyC8cQFsQc7c+szd6XVAoAkglhmNKMBIWCblEB2mCdd8EPmdR+RMLS BdzTw4CHxq1FngvIM0kDnMIQYyXvyEVBvQeXi7mXMEW5lBAd7EyCozJ19ahojECIi+Mo SK051RY+MBZLWXjc9nslEmDl1+oXEX99Hoq1A28sp656TS9D2IjlHQ+essTupJe+nIL9 ierD+HG/va0JmrBYjxInTfbMI+4GhI2EyxFtdp6aqMsBKJSiKwhr70cJkBqb2063rERs l79Z6VbcQCePaV3azGz4TZ4paHfrh342lPiKHQP7UZ33IaOv2oyLfSewAv8paAlKNVvq i9cQ== X-Gm-Message-State: AOJu0YyRQMY5czUsvb+it1pWiOnESLx6uuQMqqRDlAEE6k/0bEYx/soa 1a4ie6ZTt1e6BBqSKW2x8klz2oQ= X-Google-Smtp-Source: AGHT+IGBVfjbSsKj7d7DebQnG2T8uSrtj2rRYcb2IwJR9AmePoOHHNUoBNQun7eAKz/+4xI5vDVwGVs= X-Received: from sdf.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5935]) (user=sdf job=sendgmr) by 2002:a25:d141:0:b0:d77:fb00:b246 with SMTP id i62-20020a25d141000000b00d77fb00b246mr87035ybg.1.1694725500261; Thu, 14 Sep 2023 14:05:00 -0700 (PDT) Date: Thu, 14 Sep 2023 14:04:46 -0700 In-Reply-To: <20230914210452.2588884-1-sdf@google.com> Mime-Version: 1.0 References: <20230914210452.2588884-1-sdf@google.com> X-Mailer: git-send-email 2.42.0.459.ge4e396fd5e-goog Message-ID: <20230914210452.2588884-4-sdf@google.com> From: Stanislav Fomichev To: bpf@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Message-ID-Hash: YIIYKZO4GLQ6OIFAJRF67E62HR33GTQ7 X-Message-ID-Hash: YIIYKZO4GLQ6OIFAJRF67E62HR33GTQ7 X-MailFrom: 3fHUDZQMKCaMVGIJRRJOH.FRPaGS-KLQWVaGS-SURMHFW.QHW@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: 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, sdf@google.com, 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 X-Mailman-Version: 3.3.8 Precedence: list Subject: [xdp-hints] [PATCH bpf-next v2 3/9] tools: ynl: print xsk-features from the sample List-Id: XDP hardware hints design discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Regenerate the userspace specs and print xsk-features bitmask. Signed-off-by: Stanislav Fomichev --- tools/net/ynl/generated/netdev-user.c | 19 +++++++++++++++++++ tools/net/ynl/generated/netdev-user.h | 3 +++ tools/net/ynl/samples/netdev.c | 6 ++++++ 3 files changed, 28 insertions(+) diff --git a/tools/net/ynl/generated/netdev-user.c b/tools/net/ynl/generated/netdev-user.c index 68b408ca0f7f..f8dd6aa0ad97 100644 --- a/tools/net/ynl/generated/netdev-user.c +++ b/tools/net/ynl/generated/netdev-user.c @@ -45,12 +45,26 @@ const char *netdev_xdp_act_str(enum netdev_xdp_act value) return netdev_xdp_act_strmap[value]; } +static const char * const netdev_xsk_flags_strmap[] = { + [0] = "tx-timestamp", + [1] = "tx-checksum", +}; + +const char *netdev_xsk_flags_str(enum netdev_xsk_flags value) +{ + value = ffs(value) - 1; + if (value < 0 || value >= (int)MNL_ARRAY_SIZE(netdev_xsk_flags_strmap)) + return NULL; + return netdev_xsk_flags_strmap[value]; +} + /* Policies */ struct ynl_policy_attr netdev_dev_policy[NETDEV_A_DEV_MAX + 1] = { [NETDEV_A_DEV_IFINDEX] = { .name = "ifindex", .type = YNL_PT_U32, }, [NETDEV_A_DEV_PAD] = { .name = "pad", .type = YNL_PT_IGNORE, }, [NETDEV_A_DEV_XDP_FEATURES] = { .name = "xdp-features", .type = YNL_PT_U64, }, [NETDEV_A_DEV_XDP_ZC_MAX_SEGS] = { .name = "xdp-zc-max-segs", .type = YNL_PT_U32, }, + [NETDEV_A_DEV_XSK_FEATURES] = { .name = "xsk-features", .type = YNL_PT_U64, }, }; struct ynl_policy_nest netdev_dev_nest = { @@ -97,6 +111,11 @@ int netdev_dev_get_rsp_parse(const struct nlmsghdr *nlh, void *data) return MNL_CB_ERROR; dst->_present.xdp_zc_max_segs = 1; dst->xdp_zc_max_segs = mnl_attr_get_u32(attr); + } else if (type == NETDEV_A_DEV_XSK_FEATURES) { + if (ynl_attr_validate(yarg, attr)) + return MNL_CB_ERROR; + dst->_present.xsk_features = 1; + dst->xsk_features = mnl_attr_get_u64(attr); } } diff --git a/tools/net/ynl/generated/netdev-user.h b/tools/net/ynl/generated/netdev-user.h index 0952d3261f4d..b8c5cdb331b4 100644 --- a/tools/net/ynl/generated/netdev-user.h +++ b/tools/net/ynl/generated/netdev-user.h @@ -18,6 +18,7 @@ extern const struct ynl_family ynl_netdev_family; /* Enums */ const char *netdev_op_str(int op); const char *netdev_xdp_act_str(enum netdev_xdp_act value); +const char *netdev_xsk_flags_str(enum netdev_xsk_flags value); /* Common nested types */ /* ============== NETDEV_CMD_DEV_GET ============== */ @@ -48,11 +49,13 @@ struct netdev_dev_get_rsp { __u32 ifindex:1; __u32 xdp_features:1; __u32 xdp_zc_max_segs:1; + __u32 xsk_features:1; } _present; __u32 ifindex; __u64 xdp_features; __u32 xdp_zc_max_segs; + __u64 xsk_features; }; void netdev_dev_get_rsp_free(struct netdev_dev_get_rsp *rsp); diff --git a/tools/net/ynl/samples/netdev.c b/tools/net/ynl/samples/netdev.c index 06433400dddd..06377e3f1df5 100644 --- a/tools/net/ynl/samples/netdev.c +++ b/tools/net/ynl/samples/netdev.c @@ -38,6 +38,12 @@ static void netdev_print_device(struct netdev_dev_get_rsp *d, unsigned int op) printf(" %s", netdev_xdp_act_str(1 << i)); } + printf(" %llx:", d->xsk_features); + for (int i = 0; d->xsk_features > 1U << i; i++) { + if (d->xsk_features & (1U << i)) + printf(" %s", netdev_xsk_flags_str(1 << i)); + } + printf(" xdp-zc-max-segs=%u", d->xdp_zc_max_segs); name = netdev_op_str(op); -- 2.42.0.459.ge4e396fd5e-goog