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

Small TC fixes #5002

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Small TC fixes #5002

wants to merge 3 commits into from

Conversation

vbnogueira
Copy link
Contributor

Whilst writing the automated test tools for the tc backend, I ended up finding some compilation bugs when compiling some generated C files from the testdata samples directory
This PR fixes those issues, describes them in more detail in the commit messages and updates pna.h

…ride cases

In cases where the tc_may_override annotation is associate with an
action that has a parameter with a tc_type annotation, the compiler
is emitting the parameters declaration in p4tc_filter_fields incorrectly.
For example in tc_may_override_example_04:

struct p4tc_filter_fields {
    __u32 pipeid;
    __u32 handle;
    __u32 classid;
    __u32 chain;
    __u32 blockid;
    __be16 proto;
    __u16 prio;
    ipv4 ipv4_tbl_1_next_hop_ipv4addr;
};

"ipv4" is not a valid C type, so this won't compile

Also, in the case of bit types that are not equivalent to a standard C
type (u8, u16, u32, u64), the compiler is emitting the type incorrectly.
Let's say, in the previous example, that the type for ipv4addr was bit<33>,
the compiler would've emitted the following:

struct p4tc_filter_fields {
    __u32 pipeid;
    __u32 handle;
    __u32 classid;
    __u32 chain;
    __u32 blockid;
    __be16 proto;
    __u16 prio;
    __u33 ipv4_tbl_1_next_hop_ipv4addr;
};

This commit fixes this by converting tc_type annotated action parameters
to their corresponding C type and converts any non C standard bit type
into a u8 array rounded up to the nearest byte

Signed-off-by: Victor Nogueira <[email protected]>
In struct p4tc_table_entry_create_bpf_params__local we've adopted
profile_id instead of aging_ms. This commits updates the field name in
the generated output

Signed-off-by: Victor Nogueira <[email protected]>
@vbnogueira
Copy link
Contributor Author

@komaljai please take a look when you have some time

Add missing kfuncs and remove some deprecated ones

Signed-off-by: Victor Nogueira <[email protected]>
@fruffy fruffy added the p4tc Topics related to the P4-TC back end label Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p4tc Topics related to the P4-TC back end
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants