Skip to content

adding p4 namespace in backends/tofino/b4-asm/alloc.h#5506

Open
Diyan-Dev wants to merge 1 commit intop4lang:mainfrom
Diyan-Dev:fix-add-p4-namespace
Open

adding p4 namespace in backends/tofino/b4-asm/alloc.h#5506
Diyan-Dev wants to merge 1 commit intop4lang:mainfrom
Diyan-Dev:fix-add-p4-namespace

Conversation

@Diyan-Dev
Copy link

P4 namespace has been added to BFN in backends/tofino/b4-asm/alloc.h

I have only edited one file for 2 reasons

  • I didn't want to make many changes and edited multiple files in one commit
  • This is the only file in backends/tofino/bf-asm with namespace BFN

Let me know if you want me to edit more files in one commit !

These are the outputs of make test

The result of make test after adding P4 namespace in alloc.h in Tofino backend.

97% tests passed, 70 tests failed out of 2434

The result before editing alloc.h file

97% tests passed, 70 tests failed out of 2434

Label Time Summary:
XFAIL          =  12.37 sec*proc (18 tests)
dpdk           = 187.12 sec*proc (254 tests)
ebpf           =   2.79 sec*proc (28 tests)
ebpf-bcc       =   2.59 sec*proc (26 tests)
ebpf-errors    =   0.10 sec*proc (1 test)
err            = 148.00 sec*proc (601 tests)
graph          =   0.86 sec*proc (2 tests)
gtest          =  36.43 sec*proc (1 test)
p14_to_16      = 424.68 sec*proc (194 tests)
p4             = 1416.61 sec*proc (1304 tests)
ubpf           =   2.32 sec*proc (19 tests)

Total Test time (real) = 2226.55 sec

The following tests FAILED:
        259 - ebpf-bcc/testdata/p4_16_samples/action_call_ebpf.p4 (Failed)
        260 - ebpf-bcc/testdata/p4_16_samples/action_call_table_ebpf.p4 (Failed)
        261 - ebpf-bcc/testdata/p4_16_samples/advance_ebpf.p4 (Failed)
        262 - ebpf-bcc/testdata/p4_16_samples/bool_ebpf.p4 (Failed)
        263 - ebpf-bcc/testdata/p4_16_samples/count_add_ebpf.p4 (Failed)
        264 - ebpf-bcc/testdata/p4_16_samples/count_ebpf.p4 (Failed)
        265 - ebpf-bcc/testdata/p4_16_samples/hit_ebpf.p4 (Failed)
        266 - ebpf-bcc/testdata/p4_16_samples/init_ebpf.p4 (Failed)
        267 - ebpf-bcc/testdata/p4_16_samples/issue2791_ebpf.p4 (Failed)
        268 - ebpf-bcc/testdata/p4_16_samples/issue2793_ebpf.p4 (Failed)
        269 - ebpf-bcc/testdata/p4_16_samples/issue2797_ebpf.p4 (Failed)
        270 - ebpf-bcc/testdata/p4_16_samples/issue2816-1_ebpf.p4 (Failed)
        271 - ebpf-bcc/testdata/p4_16_samples/issue2816_ebpf.p4 (Failed)
        272 - ebpf-bcc/testdata/p4_16_samples/issue870_ebpf.p4 (Failed)
        273 - ebpf-bcc/testdata/p4_16_samples/key-issue-1020_ebpf.p4 (Failed)
        274 - ebpf-bcc/testdata/p4_16_samples/key_ebpf.p4 (Failed)
        275 - ebpf-bcc/testdata/p4_16_samples/length_ebpf.p4 (Failed)
        276 - ebpf-bcc/testdata/p4_16_samples/lpm_ebpf.p4 (Failed)
        277 - ebpf-bcc/testdata/p4_16_samples/stack_ebpf.p4 (Failed)
        278 - ebpf-bcc/testdata/p4_16_samples/switch_ebpf.p4 (Failed)
        280 - ebpf-bcc/testdata/p4_16_samples/test_ebpf.p4 (Failed)
        281 - ebpf-bcc/testdata/p4_16_samples/two_ebpf.p4 (Failed)
        282 - ebpf-bcc/testdata/p4_16_samples/valid_ebpf.p4 (Failed)
        283 - ebpf-bcc/testdata/p4_16_samples/value_set_ebpf.p4 (Failed)
        284 - ebpf-bcc/testdata/p4_16_samples/verify_ebpf.p4 (Failed)
        285 - ebpf/testdata/p4_16_samples/action_call_ebpf.p4 (Failed)
        286 - ebpf/testdata/p4_16_samples/action_call_table_ebpf.p4 (Failed)
        287 - ebpf/testdata/p4_16_samples/advance_ebpf.p4 (Failed)
        288 - ebpf/testdata/p4_16_samples/bool_ebpf.p4 (Failed)
        289 - ebpf/testdata/p4_16_samples/count_add_ebpf.p4 (Failed)
        290 - ebpf/testdata/p4_16_samples/count_ebpf.p4 (Failed)
        291 - ebpf/testdata/p4_16_samples/hit_ebpf.p4 (Failed)
        292 - ebpf/testdata/p4_16_samples/init_ebpf.p4 (Failed)
        293 - ebpf/testdata/p4_16_samples/issue2791_ebpf.p4 (Failed)
        294 - ebpf/testdata/p4_16_samples/issue2793_ebpf.p4 (Failed)
        295 - ebpf/testdata/p4_16_samples/issue2797_ebpf.p4 (Failed)
        296 - ebpf/testdata/p4_16_samples/issue2816-1_ebpf.p4 (Failed)
        297 - ebpf/testdata/p4_16_samples/issue2816_ebpf.p4 (Failed)
        298 - ebpf/testdata/p4_16_samples/issue870_ebpf.p4 (Failed)
        299 - ebpf/testdata/p4_16_samples/key-issue-1020_ebpf.p4 (Failed)
        300 - ebpf/testdata/p4_16_samples/key_ebpf.p4 (Failed)
        301 - ebpf/testdata/p4_16_samples/length_ebpf.p4 (Failed)
        303 - ebpf/testdata/p4_16_samples/stack_ebpf.p4 (Failed)
        304 - ebpf/testdata/p4_16_samples/switch_ebpf.p4 (Failed)
        306 - ebpf/testdata/p4_16_samples/test_ebpf.p4 (Failed)
        307 - ebpf/testdata/p4_16_samples/two_ebpf.p4 (Failed)
        308 - ebpf/testdata/p4_16_samples/valid_ebpf.p4 (Failed)
        309 - ebpf/testdata/p4_16_samples/value_set_ebpf.p4 (Failed)
        310 - ebpf/testdata/p4_16_samples/verify_ebpf.p4 (Failed)
        311 - ebpf-errors/testdata/p4_16_ebpf_errors/header_unaligned.p4 (Failed)
        312 - ebpf/testdata/p4_16_samples/ebpf_checksum_extern.p4 (Failed)
        2415 - ubpf/testdata/p4_16_samples/action_call_ubpf.p4 (Failed)
        2416 - ubpf/testdata/p4_16_samples/action_fwd_ubpf.p4 (Failed)
        2417 - ubpf/testdata/p4_16_samples/advance_ubpf.p4 (Failed)
        2418 - ubpf/testdata/p4_16_samples/csum_ubpf.p4 (Failed)
        2419 - ubpf/testdata/p4_16_samples/default_action_ubpf.p4 (Failed)
        2420 - ubpf/testdata/p4_16_samples/hash_ubpf.p4 (Failed)
        2421 - ubpf/testdata/p4_16_samples/ipv4-actions_ubpf.p4 (Failed)
        2422 - ubpf/testdata/p4_16_samples/ipv6-actions_ubpf.p4 (Failed)
        2423 - ubpf/testdata/p4_16_samples/issue3483_ubpf.p4 (Failed)
        2424 - ubpf/testdata/p4_16_samples/lookahead_ubpf.p4 (Failed)
        2425 - ubpf/testdata/p4_16_samples/lpm_ubpf.p4 (Failed)
        2426 - ubpf/testdata/p4_16_samples/metadata_ubpf.p4 (Failed)
        2427 - ubpf/testdata/p4_16_samples/parenthesis-test_ubpf.p4 (Failed)
        2428 - ubpf/testdata/p4_16_samples/simple-actions_ubpf.p4 (Failed)
        2429 - ubpf/testdata/p4_16_samples/simple-firewall_ubpf.p4 (Failed)
        2430 - ubpf/testdata/p4_16_samples/truncate_ubpf.p4 (Failed)
        2431 - ubpf/testdata/p4_16_samples/tunneling_ubpf.p4 (Failed)
        2432 - ubpf/testdata/p4_16_samples/ubpf_hash_extern.p4 (Failed)
        2433 - ubpf/testdata/p4_16_samples/ubpf_checksum_extern.p4 (Failed)
Errors while running CTest
make: *** [Makefile:74: test] Error 8

This reference the issue #5214

@fruffy fruffy added the tofino Topics related to the Tofino switch and back end. label Feb 28, 2026
@fruffy
Copy link
Collaborator

fruffy commented Feb 28, 2026

Consider the second part of the issue description:

A lot of the files (in particular in bf-asm) do not have any namespace at all. This should be fixed

@Diyan-Dev
Copy link
Author

yeah will surely consider that for other files.
are you satisfied with the alloc.h edit ?

@fruffy
Copy link
Collaborator

fruffy commented Mar 10, 2026

are you satisfied with the alloc.h edit ?

We can merge it, did you confirm that the other files in the folder have the same pattern?

@Diyan-Dev
Copy link
Author

Diyan-Dev commented Mar 11, 2026

Some things that i was not aware of previously but i am now are...

  • i didn't ran make build after this edit (i only ran make test)
  • many files in b4-asm dont actually have namespace at all ( i knew it but didn't add the namespaces in those files)

So i gonna open a new pr verifying by make build and also editing some more files in not in b4-asm rather a small folder first in tofino

if you think the above mentioned things are fine you may proceed (or if you confirm by running make with tofino backend) but i would prefer not to

BTW the pattern of adding namespace is same in all the files !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tofino Topics related to the Tofino switch and back end.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants