Skip to content
This repository has been archived by the owner on Jan 19, 2023. It is now read-only.

Compiler support for htons, htonl, htonll #118

Open
maharishib opened this issue Aug 7, 2019 · 2 comments
Open

Compiler support for htons, htonl, htonll #118

maharishib opened this issue Aug 7, 2019 · 2 comments

Comments

@maharishib
Copy link

These functions(htons,htonl,htonll) are defined in "ebf_common.h".
Can we include compiler support for them, so that we can use this functionality from p4 program?

@mihaibudiu
Copy link
Contributor

In general it is not sustainable to add special support to the compiler for whatever functions may be needed. One thing we can do, though, is to define a calling convention in C and to allow the users to implement any functions that are declared as "extern" and not known by the model. The bmv2 back-end already does this.

Also, please note that there is a long-standing bug related to the (internal) use of htonll in p4c-ebpf and p4c-xdp: p4lang/p4c#1122, which no one had time to fix so far.

@mihaibudiu
Copy link
Contributor

BTW: if we do this we will probably do it in the ebpf back-end rather than in the xdp back-end, because the xdp back-end automatically inherits all the features of the ebpf back-end.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants