Skip to content

Commit

Permalink
Rename eBPF section names for tc backend
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
mouse-mt authored and vbnogueira committed Jan 25, 2024
1 parent 5082fe3 commit 071f11b
Show file tree
Hide file tree
Showing 47 changed files with 48 additions and 47 deletions.
3 changes: 2 additions & 1 deletion backends/tc/ebpfCodeGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ void PNAArchTC::emitParser(EBPF::CodeBuilder *builder) const {
builder->newline();
emitInstances(builder);
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 @@ -1096,6 +1096,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
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,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 @@ -208,7 +208,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 @@ -164,7 +164,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 @@ -286,7 +286,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 @@ -353,7 +353,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 @@ -355,7 +355,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/ipip_control_blocks.c
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,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 @@ -170,7 +170,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 @@ -497,7 +497,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 @@ -504,7 +504,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 @@ -757,7 +757,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 @@ -164,7 +164,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 @@ -757,7 +757,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 @@ -164,7 +164,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 @@ -356,7 +356,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 @@ -258,7 +258,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 @@ -139,7 +139,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 @@ -359,7 +359,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 @@ -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
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 @@ -203,7 +203,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 @@ -164,7 +164,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 @@ -290,7 +290,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 @@ -368,7 +368,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 @@ -285,7 +285,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 @@ -285,7 +285,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/simple_lpm_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 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 @@ -292,7 +292,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 @@ -356,7 +356,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/size_param_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
Loading

0 comments on commit 071f11b

Please sign in to comment.