From: Martin KaFai Lau <martin.lau@linux.dev>
To: Stanislav Fomichev <sdf@google.com>,
Jesper Dangaard Brouer <brouer@redhat.com>
Cc: bpf@vger.kernel.org, netdev@vger.kernel.org,
martin.lau@kernel.org, ast@kernel.org, daniel@iogearbox.net,
alexandr.lobakin@intel.com, larysa.zaremba@intel.com,
xdp-hints@xdp-project.net
Subject: [xdp-hints] Re: [PATCH bpf-next V3] xdp: bpf_xdp_metadata use EOPNOTSUPP for no driver support
Date: Tue, 21 Feb 2023 11:03:52 -0800 [thread overview]
Message-ID: <d8c514c6-15bf-c2fd-11f9-23519cdc9177@linux.dev> (raw)
In-Reply-To: <CAKH8qBt-wgiFTjbNfuWXC+CNbnDbVPWuoJFO_H_=tc4e3BZGPA@mail.gmail.com>
On 2/21/23 9:13 AM, Stanislav Fomichev wrote:
> On Sat, Feb 18, 2023 at 7:34 AM Jesper Dangaard Brouer
> <brouer@redhat.com> wrote:
>>
>> When driver doesn't implement a bpf_xdp_metadata kfunc the default
>> implementation returns EOPNOTSUPP, which indicate device driver doesn't
>> implement this kfunc.
>>
>> Currently many drivers also return EOPNOTSUPP when the hint isn't
>> available. Instead change drivers to return ENODATA in these cases.
>> There can be natural cases why a driver doesn't provide any hardware
>> info for a specific hint, even on a frame to frame basis (e.g. PTP).
>> Lets keep these cases as separate return codes.
> Long term probably still makes sense to export this info via xdp-features?
> Not sure how long we can 100% ensure EOPNOTSUPP vs ENODATA convention :-)
I am also not sure if it makes the xdp-hints adoption easier for other drivers
by enforcing ENODATA or what other return values a driver should or should not
return while EOPNOTSUPP is a more common errno to use. May be the driver experts
can prove me wrong here.
iiuc, it is for debugging if the bpf prog has been patched with the driver's xdp
kfunc. Others have suggested method like dumping the bpf prog insn. It could
also trace the driver xdp kfunc and see if it is actually called. Why these
won't work?
Beside, it is more like a load time decision which should not need a runtime
return error value to decide. eg. With xdp-features, the bpf prog can check a
global const which can be set based on the query result from xdp-features. It
will then be dead code removed by verifier. This could also handle the older
kernel that does not have xdp-metadata support (ie. missing
bpf_xdp_metadata_rx_{timestamp,hash}).
next prev parent reply other threads:[~2023-02-21 19:04 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-18 15:34 [xdp-hints] " Jesper Dangaard Brouer
2023-02-21 17:13 ` [xdp-hints] " Stanislav Fomichev
2023-02-21 19:03 ` Martin KaFai Lau [this message]
2023-02-21 20:39 ` Jesper Dangaard Brouer
2023-02-21 21:58 ` Martin KaFai Lau
2023-02-22 21:49 ` Jesper Dangaard Brouer
2023-02-24 7:44 ` Martin KaFai Lau
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=d8c514c6-15bf-c2fd-11f9-23519cdc9177@linux.dev \
--to=martin.lau@linux.dev \
--cc=alexandr.lobakin@intel.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=brouer@redhat.com \
--cc=daniel@iogearbox.net \
--cc=larysa.zaremba@intel.com \
--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