From: Jesper Dangaard Brouer <brouer@redhat.com>
To: bpf@vger.kernel.org
Cc: Jesper Dangaard Brouer <brouer@redhat.com>,
netdev@vger.kernel.org, Stanislav Fomichev <sdf@google.com>,
martin.lau@kernel.org, ast@kernel.org, daniel@iogearbox.net,
alexandr.lobakin@intel.com, xdp-hints@xdp-project.net
Subject: [xdp-hints] [PATCH bpf-next V1] xdp: bpf_xdp_metadata use NODEV for no device support
Date: Wed, 15 Feb 2023 11:09:36 +0100 [thread overview]
Message-ID: <167645577609.1860229.12489295285473044895.stgit@firesoul> (raw)
With our XDP-hints kfunc approach, where individual drivers overload the
default implementation, it can be hard for API users to determine
whether or not the current device driver have this kfunc available.
Change the default implementations to use an errno (ENODEV), that
drivers shouldn't return, to make it possible for BPF runtime to
determine if bpf kfunc for xdp metadata isn't implemented by driver.
This is intended to ease supporting and troubleshooting setups. E.g.
when users on mailing list report -19 (ENODEV) as an error, then we can
immediately tell them their kernel is too old.
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
---
net/core/xdp.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/net/core/xdp.c b/net/core/xdp.c
index 26483935b7a4..7bb5984ae4f7 100644
--- a/net/core/xdp.c
+++ b/net/core/xdp.c
@@ -722,10 +722,12 @@ __diag_ignore_all("-Wmissing-prototypes",
* @timestamp: Return value pointer.
*
* Returns 0 on success or ``-errno`` on error.
+ *
+ * -ENODEV (19): means device driver doesn't implement kfunc
*/
__bpf_kfunc int bpf_xdp_metadata_rx_timestamp(const struct xdp_md *ctx, u64 *timestamp)
{
- return -EOPNOTSUPP;
+ return -ENODEV;
}
/**
@@ -734,10 +736,12 @@ __bpf_kfunc int bpf_xdp_metadata_rx_timestamp(const struct xdp_md *ctx, u64 *tim
* @hash: Return value pointer.
*
* Returns 0 on success or ``-errno`` on error.
+ *
+ * -ENODEV (19): means device driver doesn't implement kfunc
*/
__bpf_kfunc int bpf_xdp_metadata_rx_hash(const struct xdp_md *ctx, u32 *hash)
{
- return -EOPNOTSUPP;
+ return -ENODEV;
}
__diag_pop();
next reply other threads:[~2023-02-15 10:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-15 10:09 Jesper Dangaard Brouer [this message]
2023-02-15 15:45 ` [xdp-hints] " Larysa Zaremba
2023-02-15 17:11 ` Alexander Lobakin
2023-02-15 17:50 ` Jesper Dangaard Brouer
2023-02-16 11:33 ` Alexander Lobakin
2023-02-16 12:16 ` Larysa Zaremba
2023-02-16 14:13 ` Toke Høiland-Jørgensen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://lists.xdp-project.net/postorius/lists/xdp-hints.xdp-project.net/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=167645577609.1860229.12489295285473044895.stgit@firesoul \
--to=brouer@redhat.com \
--cc=alexandr.lobakin@intel.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=martin.lau@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=sdf@google.com \
--cc=xdp-hints@xdp-project.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox