Skip to content
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

Merged
merged 2 commits into from
Nov 15, 2024

Conversation

tacslon
Copy link
Contributor

@tacslon tacslon commented Oct 10, 2024

Currently, we cannot assign metadata length in param config when calling xsk_umem__create(). This PR adds the support to assign tx_metadata_len when creating umem.
Also, adding xsk_umem__create_opts() to provide a new way to create umem by opts macro.

@tacslon tacslon changed the title Add tx_metadata_len to support AF_XDP Tx Add tx_metadata_len to support AF_XDP Tx metadata Oct 10, 2024
Copy link
Member

@magnus-karlsson magnus-karlsson left a 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.

lib/libxdp/xsk.c Outdated Show resolved Hide resolved
lib/libxdp/xsk.c Outdated Show resolved Hide resolved
@tohojo
Copy link
Member

tohojo commented Oct 15, 2024 via email

@magnus-karlsson
Copy link
Member

magnus-karlsson commented Oct 18, 2024 via email

@tacslon tacslon changed the title Add tx_metadata_len to support AF_XDP Tx metadata xdp-forward: Add tx_metadata_len/xsk_umem__create_opts() to support AF_XDP Tx metadata Oct 22, 2024
@tacslon tacslon changed the title xdp-forward: Add tx_metadata_len/xsk_umem__create_opts() to support AF_XDP Tx metadata libxdp: Add tx_metadata_len/xsk_umem__create_opts() to support AF_XDP Tx metadata Oct 22, 2024
@tacslon tacslon force-pushed the master branch 2 times, most recently from d807dc0 to 7931a29 Compare October 23, 2024 02:40
@tacslon tacslon requested a review from tohojo October 28, 2024 01:05
headers/xdp/xsk.h Outdated Show resolved Hide resolved
headers/linux/if_xdp.h Outdated Show resolved Hide resolved
lib/libxdp/xsk.c Outdated Show resolved Hide resolved
lib/libxdp/xsk.c Outdated Show resolved Hide resolved
headers/xdp/xsk.h Outdated Show resolved Hide resolved
lib/libxdp/libxdp.map Outdated Show resolved Hide resolved
lib/libxdp/xsk.c Outdated Show resolved Hide resolved
@tacslon tacslon force-pushed the master branch 2 times, most recently from c93b5fb to f1345db Compare October 31, 2024 02:26
@tacslon tacslon requested a review from tohojo October 31, 2024 02:28
@tacslon
Copy link
Contributor Author

tacslon commented Nov 6, 2024

@tohojo Requested changes are committed, ptal, thanks!

Copy link
Member

@tohojo tohojo left a 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 :)

lib/libxdp/xsk.c Outdated Show resolved Hide resolved
lib/libxdp/xsk.c Outdated Show resolved Hide resolved
@tacslon
Copy link
Contributor Author

tacslon commented Nov 7, 2024

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]>
@tacslon tacslon force-pushed the master branch 2 times, most recently from d7c82d9 to 124faa9 Compare November 7, 2024 12:38
lib/libxdp/xsk.c Outdated Show resolved Hide resolved
lib/libxdp/xsk.c Show resolved Hide resolved
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]>
@tohojo
Copy link
Member

tohojo commented Nov 14, 2024

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 xsk_umem__create_with_fd() slightly: before, 0 was accepted as a valid socket fd, where now it isn't, even for the old function. I don't think this will be an issue in practice, as the only way this can happen is if socket() itself returns 0 as the fd, but wanted to flag it just the same. What is your feeling, @magnus-karlsson - is this OK?

@tacslon
Copy link
Contributor Author

tacslon commented Nov 15, 2024

The 2 failing selftests are caused by failing to load xdp_handle_tcp_recv prog, maybe can be retested

headers/xdp/xsk.h Show resolved Hide resolved
@tohojo tohojo merged commit 9085a51 into xdp-project:master Nov 15, 2024
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants