-
Notifications
You must be signed in to change notification settings - Fork 151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
libxdp: Add tx_metadata_len/xsk_umem__create_opts() to support AF_XDP Tx metadata #443
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for implementing this. Some comments that need addressing in the review.
talon ***@***.***> writes:
> We reuse the opts macros from libbpf - see `struct xdp_program_opts`
```
#define xdp_program_opts__last_field fd
#define DECLARE_LIBXDP_OPTS DECLARE_LIBBPF_OPTS
```
@tohojo Thanks, I can see macros listed above, how to use these macros to version the interface?
See example usage in xdp_program__create().
Unfortunately, the existing struct xsk_umem_config doesn't support the
opts macro usage since it doesn't contain a 'sz' field as its first
member. So to support this way of extending opts, a new version of that
struct would need to be defined, and a new set of functions taking the
opts instead of the old struct. So replacements for xsk_umem__create()
and xsk_umem__create_with_fd().
This could be a single function, I suppose (xdp_umem__create_opts() or
something similar?) with some/most of the function parameters being
moved to be opts struct members. This is a matter of taste, so I'll let
Magnus chime in here with his preference...
|
On Tue, 15 Oct 2024 at 23:07, Toke Høiland-Jørgensen < ***@***.***> wrote:
talon ***@***.***> writes:
>> We reuse the opts macros from libbpf - see `struct xdp_program_opts`
> ```
> #define xdp_program_opts__last_field fd
>
> #define DECLARE_LIBXDP_OPTS DECLARE_LIBBPF_OPTS
> ```
> @tohojo Thanks, I can see macros listed above, how to use these macros
to version the interface?
See example usage in xdp_program__create().
Unfortunately, the existing struct xsk_umem_config doesn't support the
opts macro usage since it doesn't contain a 'sz' field as its first
member. So to support this way of extending opts, a new version of that
struct would need to be defined, and a new set of functions taking the
opts instead of the old struct. So replacements for xsk_umem__create()
and xsk_umem__create_with_fd().
This could be a single function, I suppose (xdp_umem__create_opts() or
something similar?) with some/most of the function parameters being
moved to be opts struct members. This is a matter of taste, so I'll let
Magnus chime in here with his preference...
The least evil here seems to be a new function. The name Toke proposes is
fine. And add a comment that users should use the new version.
… —
Reply to this email directly, view it on GitHub
<#443 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AASGUEM554MSG2UM7LSLHALZ3V7ZJAVCNFSM6AAAAABPWUWX3GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMJVGE3DEMRRHE>
.
You are receiving this because your review was requested.Message ID:
***@***.***>
|
d807dc0
to
7931a29
Compare
c93b5fb
to
f1345db
Compare
@tohojo Requested changes are committed, ptal, thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only a few nits, otherwise the opts usage LGTM :)
@tohojo @magnus-karlsson New changes are committed, ptal, thanks! |
… Tx metadata Add tx_metadata_len to support AF_XDP Tx metadata. Also, add xsk_umem__create_opts() to provide a new way to create umem, like xdp_program__create(). Another 2 functions to create umem(xsk_umem__create() and xsk_umem__create_with_fd()) calls xsk_umem__create_opts() internally, while outside callers do not know this change. Signed-off-by: Muyang Tian <[email protected]>
d7c82d9
to
124faa9
Compare
Use 0 as default(or unset) value for fd when creating umem, also, set fields to their default values if passed in by 0. Signed-off-by: Muyang Tian <[email protected]>
Alright, so from an opts API point of view, it basically looks good now. @magnus-karlsson could you please take a look as well and approve from an XSK PoV? One issue to flag here is that we are technically changing the semantics of |
The 2 failing selftests are caused by failing to load |
Currently, we cannot assign metadata length in param
config
when callingxsk_umem__create()
. This PR adds the support to assigntx_metadata_len
when creating umem.Also, adding
xsk_umem__create_opts()
to provide a new way to create umem by opts macro.