Skip to content

Commit

Permalink
Rename eBPF section names for tc backend (p4lang#4361)
Browse files Browse the repository at this point in the history
Rename parser C file's eBPF section to "p4tc/parse" and control blocks C
file's eBPF section to "p4tc/main".
  • Loading branch information
vbnogueira authored Feb 7, 2024
1 parent 12dafee commit 6cec6b4
Show file tree
Hide file tree
Showing 55 changed files with 56 additions and 55 deletions.
3 changes: 2 additions & 1 deletion backends/tc/ebpfCodeGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ void PNAArchTC::emitParser(EBPF::CodeBuilder *builder) const {
builder->newline();
builder->newline();
pipeline->name = "tc-parse";
pipeline->sectionName = "classifier/" + pipeline->name;
pipeline->sectionName = "p4tc/parse";
pipeline->functionName = pipeline->name.replace("-", "_") + "_func";
pipeline->emit(builder);
builder->target->emitLicense(builder, pipeline->license);
Expand Down Expand Up @@ -1108,6 +1108,7 @@ bool ConvertToEbpfPipelineTC::preorder(const IR::PackageBlock *block) {
(void)block;

pipeline = new TCIngressPipelinePNA(name, options, refmap, typemap);
pipeline->sectionName = "p4tc/main";
auto parser_converter = new ConvertToEBPFParserPNA(pipeline, typemap);
parserBlock->apply(*parser_converter);
pipeline->parser = parser_converter->getEBPFParser();
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4tc_samples_outputs/calculator_control_blocks.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ if (/* hdr->p4calc.isValid() */
}
return -1;
}
SEC("classifier/tc-ingress")
SEC("p4tc/main")
int tc_ingress_func(struct __sk_buff *skb) {
struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb;
if (compiler_meta__->pass_to_kernel == true) return TC_ACT_OK;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4tc_samples_outputs/calculator_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct headers_t *h
return -1;
}

SEC("classifier/tc-parse")
SEC("p4tc/parse")
int tc_parse_func(struct __sk_buff *skb) {
struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb;
struct hdr_md *hdrMd;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4tc_samples_outputs/checksum_control_blocks.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ static __always_inline int process(struct __sk_buff *skb, struct my_ingress_head
}
return -1;
}
SEC("classifier/tc-ingress")
SEC("p4tc/main")
int tc_ingress_func(struct __sk_buff *skb) {
struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb;
if (compiler_meta__->pass_to_kernel == true) return TC_ACT_OK;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4tc_samples_outputs/checksum_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ ck_0_state; goto accept;
return -1;
}

SEC("classifier/tc-parse")
SEC("p4tc/parse")
int tc_parse_func(struct __sk_buff *skb) {
struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb;
struct hdr_md *hdrMd;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ static __always_inline int process(struct __sk_buff *skb, struct Header_t *h, st
}
return -1;
}
SEC("classifier/tc-ingress")
SEC("p4tc/main")
int tc_ingress_func(struct __sk_buff *skb) {
struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb;
if (compiler_meta__->pass_to_kernel == true) return TC_ACT_OK;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct Header_t *h,
return -1;
}

SEC("classifier/tc-parse")
SEC("p4tc/parse")
int tc_parse_func(struct __sk_buff *skb) {
struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb;
struct hdr_md *hdrMd;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ if (/* hdr->ipv4.isValid() */
}
return -1;
}
SEC("classifier/tc-ingress")
SEC("p4tc/main")
int tc_ingress_func(struct __sk_buff *skb) {
struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb;
if (compiler_meta__->pass_to_kernel == true) return TC_ACT_OK;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct headers_t *h
return -1;
}

SEC("classifier/tc-parse")
SEC("p4tc/parse")
int tc_parse_func(struct __sk_buff *skb) {
struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb;
struct hdr_md *hdrMd;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ if (/* hdr->ipv4.isValid() */
}
return -1;
}
SEC("classifier/tc-ingress")
SEC("p4tc/main")
int tc_ingress_func(struct __sk_buff *skb) {
struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb;
if (compiler_meta__->pass_to_kernel == true) return TC_ACT_OK;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct headers_t *h
return -1;
}

SEC("classifier/tc-parse")
SEC("p4tc/parse")
int tc_parse_func(struct __sk_buff *skb) {
struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb;
struct hdr_md *hdrMd;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ if (/* hdr->ipv4.isValid() */
}
return -1;
}
SEC("classifier/tc-ingress")
SEC("p4tc/main")
int tc_ingress_func(struct __sk_buff *skb) {
struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb;
if (compiler_meta__->pass_to_kernel == true) return TC_ACT_OK;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4tc_samples_outputs/drop_packet_example_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct headers_t *h
return -1;
}

SEC("classifier/tc-parse")
SEC("p4tc/parse")
int tc_parse_func(struct __sk_buff *skb) {
struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb;
struct hdr_md *hdrMd;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ static __always_inline int process(struct __sk_buff *skb, struct my_ingress_head
}
return -1;
}
SEC("classifier/tc-ingress")
SEC("p4tc/main")
int tc_ingress_func(struct __sk_buff *skb) {
struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb;
if (compiler_meta__->pass_to_kernel == true) return TC_ACT_OK;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct my_ingress_h
return -1;
}

SEC("classifier/tc-parse")
SEC("p4tc/parse")
int tc_parse_func(struct __sk_buff *skb) {
struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb;
struct hdr_md *hdrMd;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ static __always_inline int process(struct __sk_buff *skb, struct my_ingress_head
}
return -1;
}
SEC("classifier/tc-ingress")
SEC("p4tc/main")
int tc_ingress_func(struct __sk_buff *skb) {
struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb;
if (compiler_meta__->pass_to_kernel == true) return TC_ACT_OK;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct my_ingress_h
return -1;
}

SEC("classifier/tc-parse")
SEC("p4tc/parse")
int tc_parse_func(struct __sk_buff *skb) {
struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb;
struct hdr_md *hdrMd;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4tc_samples_outputs/hash1_control_blocks.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ crc16_finalize(ingress_h_reg);
}
return -1;
}
SEC("classifier/tc-ingress")
SEC("p4tc/main")
int tc_ingress_func(struct __sk_buff *skb) {
struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb;
if (compiler_meta__->pass_to_kernel == true) return TC_ACT_OK;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4tc_samples_outputs/hash1_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct my_ingress_h
return -1;
}

SEC("classifier/tc-parse")
SEC("p4tc/parse")
int tc_parse_func(struct __sk_buff *skb) {
struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb;
struct hdr_md *hdrMd;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4tc_samples_outputs/ipip_control_blocks.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ if (/* hdr->outer.isValid() */
}
return -1;
}
SEC("classifier/tc-ingress")
SEC("p4tc/main")
int tc_ingress_func(struct __sk_buff *skb) {
struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb;
if (compiler_meta__->pass_to_kernel == true) return TC_ACT_OK;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4tc_samples_outputs/ipip_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct headers_t *h
return -1;
}

SEC("classifier/tc-parse")
SEC("p4tc/parse")
int tc_parse_func(struct __sk_buff *skb) {
struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb;
struct hdr_md *hdrMd;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4tc_samples_outputs/matchtype_control_blocks.c
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ if (/* hdr->ipv4.isValid() */
}
return -1;
}
SEC("classifier/tc-ingress")
SEC("p4tc/main")
int tc_ingress_func(struct __sk_buff *skb) {
struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb;
if (compiler_meta__->pass_to_kernel == true) return TC_ACT_OK;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4tc_samples_outputs/matchtype_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct headers_t *h
return -1;
}

SEC("classifier/tc-parse")
SEC("p4tc/parse")
int tc_parse_func(struct __sk_buff *skb) {
struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb;
struct hdr_md *hdrMd;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ if (/* hdr->ipv4.isValid() */
}
return -1;
}
SEC("classifier/tc-ingress")
SEC("p4tc/main")
int tc_ingress_func(struct __sk_buff *skb) {
struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb;
if (compiler_meta__->pass_to_kernel == true) return TC_ACT_OK;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct headers_t *h
return -1;
}

SEC("classifier/tc-parse")
SEC("p4tc/parse")
int tc_parse_func(struct __sk_buff *skb) {
struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb;
struct hdr_md *hdrMd;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ if (hdr->ipv4.protocol != 4 || (hdr->tcp.srcPort <= 3)) {
}
return -1;
}
SEC("classifier/tc-ingress")
SEC("p4tc/main")
int tc_ingress_func(struct __sk_buff *skb) {
struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb;
if (compiler_meta__->pass_to_kernel == true) return TC_ACT_OK;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct headers_t *h
return -1;
}

SEC("classifier/tc-parse")
SEC("p4tc/parse")
int tc_parse_func(struct __sk_buff *skb) {
struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb;
struct hdr_md *hdrMd;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ if (hdr->ipv4.protocol == 6 || ((hdr->ipv4.version > 1) && (hdr->ipv4.ihl <= 2))
}
return -1;
}
SEC("classifier/tc-ingress")
SEC("p4tc/main")
int tc_ingress_func(struct __sk_buff *skb) {
struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb;
if (compiler_meta__->pass_to_kernel == true) return TC_ACT_OK;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct headers_t *h
return -1;
}

SEC("classifier/tc-parse")
SEC("p4tc/parse")
int tc_parse_func(struct __sk_buff *skb) {
struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb;
struct hdr_md *hdrMd;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ if (/* hdr->ipv4.isValid() */
}
return -1;
}
SEC("classifier/tc-ingress")
SEC("p4tc/main")
int tc_ingress_func(struct __sk_buff *skb) {
struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb;
if (compiler_meta__->pass_to_kernel == true) return TC_ACT_OK;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct headers_t *h
return -1;
}

SEC("classifier/tc-parse")
SEC("p4tc/parse")
int tc_parse_func(struct __sk_buff *skb) {
struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb;
struct hdr_md *hdrMd;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ if ((u32)istd.input_port == 4) {
}
return -1;
}
SEC("classifier/tc-ingress")
SEC("p4tc/main")
int tc_ingress_func(struct __sk_buff *skb) {
struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb;
if (compiler_meta__->pass_to_kernel == true) return TC_ACT_OK;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4tc_samples_outputs/no_table_example_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct headers_t *h
return -1;
}

SEC("classifier/tc-parse")
SEC("p4tc/parse")
int tc_parse_func(struct __sk_buff *skb) {
struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb;
struct hdr_md *hdrMd;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ if (/* hdr->ipv4.isValid() */
}
return -1;
}
SEC("classifier/tc-ingress")
SEC("p4tc/main")
int tc_ingress_func(struct __sk_buff *skb) {
struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb;
if (compiler_meta__->pass_to_kernel == true) return TC_ACT_OK;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4tc_samples_outputs/noaction_example_01_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct headers_t *h
return -1;
}

SEC("classifier/tc-parse")
SEC("p4tc/parse")
int tc_parse_func(struct __sk_buff *skb) {
struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb;
struct hdr_md *hdrMd;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ if (/* hdr->ipv4.isValid() */
}
return -1;
}
SEC("classifier/tc-ingress")
SEC("p4tc/main")
int tc_ingress_func(struct __sk_buff *skb) {
struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb;
if (compiler_meta__->pass_to_kernel == true) return TC_ACT_OK;
Expand Down
2 changes: 1 addition & 1 deletion testdata/p4tc_samples_outputs/noaction_example_02_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct headers_t *h
return -1;
}

SEC("classifier/tc-parse")
SEC("p4tc/parse")
int tc_parse_func(struct __sk_buff *skb) {
struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb;
struct hdr_md *hdrMd;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ if (((u32)istd.input_port == 2 && /* hdr->ipv4.isValid() */
}
return -1;
}
SEC("classifier/tc-ingress")
SEC("p4tc/main")
int tc_ingress_func(struct __sk_buff *skb) {
struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb;
if (compiler_meta__->pass_to_kernel == true) return TC_ACT_OK;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct headers_t *h
return -1;
}

SEC("classifier/tc-parse")
SEC("p4tc/parse")
int tc_parse_func(struct __sk_buff *skb) {
struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb;
struct hdr_md *hdrMd;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ if (/* hdr->ipv4.isValid() */
}
return -1;
}
SEC("classifier/tc-ingress")
SEC("p4tc/main")
int tc_ingress_func(struct __sk_buff *skb) {
struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb;
if (compiler_meta__->pass_to_kernel == true) return TC_ACT_OK;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct headers_t *h
return -1;
}

SEC("classifier/tc-parse")
SEC("p4tc/parse")
int tc_parse_func(struct __sk_buff *skb) {
struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb;
struct hdr_md *hdrMd;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ if (/* hdr->ipv4.isValid() */
}
return -1;
}
SEC("classifier/tc-ingress")
SEC("p4tc/main")
int tc_ingress_func(struct __sk_buff *skb) {
struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb;
if (compiler_meta__->pass_to_kernel == true) return TC_ACT_OK;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct headers_t *h
return -1;
}

SEC("classifier/tc-parse")
SEC("p4tc/parse")
int tc_parse_func(struct __sk_buff *skb) {
struct pna_global_metadata *compiler_meta__ = (struct pna_global_metadata *) skb->cb;
struct hdr_md *hdrMd;
Expand Down
Loading

0 comments on commit 6cec6b4

Please sign in to comment.