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

Stop endianess conversion in parser #4193

Merged
merged 3 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Stop endianess conversion in parser
  • Loading branch information
komaljai committed Oct 12, 2023
commit c50508e569327ccf8185cabcfe3d54510e70e1ab
3 changes: 3 additions & 0 deletions backends/ebpf/runtime/ebpf_kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ limitations under the License.

#define load_byte(data, b) (*(((u8*)(data)) + (b)))
#define load_half(data, b) bpf_ntohs(*(u16 *)((u8*)(data) + (b)))
#define load_half_ne(data, b) (*(u16 *)((u8*)(data) + (b)))
#define load_word_ne(data, b) (*(u32 *)((u8*)(data) + (b)))
#define load_dword_ne(data, b) (*(u64 *)((u8*)(data) + (b)))
#define load_word(data, b) bpf_ntohl(*(u32 *)((u8*)(data) + (b)))
#define load_dword(data, b) bpf_be64_to_cpu(*(u64 *)((u8*)(data) + (b)))

Expand Down
8 changes: 4 additions & 4 deletions backends/tc/ebpfCodeGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -542,14 +542,14 @@ void PnaStateTranslationVisitor::compileExtractField(const IR::Expression *expr,
helper = "load_byte";
loadSize = 8;
} else if (wordsToRead <= 2) {
helper = "load_half";
helper = "load_half_ne";
loadSize = 16;
} else if (wordsToRead <= 4) {
helper = "load_word";
helper = "load_word_ne";
loadSize = 32;
} else {
if (wordsToRead > 64) BUG("Unexpected width %d", widthToExtract);
helper = "load_dword";
helper = "load_dword_ne";
loadSize = 64;
}

Expand Down Expand Up @@ -606,7 +606,7 @@ void PnaStateTranslationVisitor::compileExtractField(const IR::Expression *expr,
if (shift == 0)
helper = "load_byte";
else
helper = "load_half";
helper = "load_half_ne";
auto bt = EBPF::EBPFTypeFactory::instance->create(IR::Type_Bits::get(8));
unsigned bytes = ROUNDUP(widthToExtract, 8);
for (unsigned i = 0; i < bytes; i++) {
Expand Down
18 changes: 9 additions & 9 deletions testdata/p4tc_samples_outputs/default_action_example_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,16 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct headers_t *h
hdr->ipv4.diffserv = (u8)((load_byte(pkt, BYTES(ebpf_packetOffsetInBits))));
ebpf_packetOffsetInBits += 8;

hdr->ipv4.totalLen = (u16)((load_half(pkt, BYTES(ebpf_packetOffsetInBits))));
hdr->ipv4.totalLen = (u16)((load_half_ne(pkt, BYTES(ebpf_packetOffsetInBits))));
ebpf_packetOffsetInBits += 16;

hdr->ipv4.identification = (u16)((load_half(pkt, BYTES(ebpf_packetOffsetInBits))));
hdr->ipv4.identification = (u16)((load_half_ne(pkt, BYTES(ebpf_packetOffsetInBits))));
ebpf_packetOffsetInBits += 16;

hdr->ipv4.flags = (u8)((load_byte(pkt, BYTES(ebpf_packetOffsetInBits)) >> 5) & EBPF_MASK(u8, 3));
ebpf_packetOffsetInBits += 3;

hdr->ipv4.fragOffset = (u16)((load_half(pkt, BYTES(ebpf_packetOffsetInBits))) & EBPF_MASK(u16, 13));
hdr->ipv4.fragOffset = (u16)((load_half_ne(pkt, BYTES(ebpf_packetOffsetInBits))) & EBPF_MASK(u16, 13));
ebpf_packetOffsetInBits += 13;

hdr->ipv4.ttl = (u8)((load_byte(pkt, BYTES(ebpf_packetOffsetInBits))));
Expand All @@ -67,13 +67,13 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct headers_t *h
hdr->ipv4.protocol = (u8)((load_byte(pkt, BYTES(ebpf_packetOffsetInBits))));
ebpf_packetOffsetInBits += 8;

hdr->ipv4.hdrChecksum = (u16)((load_half(pkt, BYTES(ebpf_packetOffsetInBits))));
hdr->ipv4.hdrChecksum = (u16)((load_half_ne(pkt, BYTES(ebpf_packetOffsetInBits))));
ebpf_packetOffsetInBits += 16;

hdr->ipv4.srcAddr = (u32)((load_word(pkt, BYTES(ebpf_packetOffsetInBits))));
hdr->ipv4.srcAddr = (u32)((load_word_ne(pkt, BYTES(ebpf_packetOffsetInBits))));
ebpf_packetOffsetInBits += 32;

hdr->ipv4.dstAddr = (u32)((load_word(pkt, BYTES(ebpf_packetOffsetInBits))));
hdr->ipv4.dstAddr = (u32)((load_word_ne(pkt, BYTES(ebpf_packetOffsetInBits))));
ebpf_packetOffsetInBits += 32;

hdr->ipv4.ebpf_valid = 1;
Expand All @@ -88,13 +88,13 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct headers_t *h
goto reject;
}

hdr->ethernet.dstAddr = (u64)((load_dword(pkt, BYTES(ebpf_packetOffsetInBits)) >> 16) & EBPF_MASK(u64, 48));
hdr->ethernet.dstAddr = (u64)((load_dword_ne(pkt, BYTES(ebpf_packetOffsetInBits)) >> 16) & EBPF_MASK(u64, 48));
ebpf_packetOffsetInBits += 48;

hdr->ethernet.srcAddr = (u64)((load_dword(pkt, BYTES(ebpf_packetOffsetInBits)) >> 16) & EBPF_MASK(u64, 48));
hdr->ethernet.srcAddr = (u64)((load_dword_ne(pkt, BYTES(ebpf_packetOffsetInBits)) >> 16) & EBPF_MASK(u64, 48));
ebpf_packetOffsetInBits += 48;

hdr->ethernet.etherType = (u16)((load_half(pkt, BYTES(ebpf_packetOffsetInBits))));
hdr->ethernet.etherType = (u16)((load_half_ne(pkt, BYTES(ebpf_packetOffsetInBits))));
ebpf_packetOffsetInBits += 16;

hdr->ethernet.ebpf_valid = 1;
Expand Down
32 changes: 16 additions & 16 deletions testdata/p4tc_samples_outputs/default_hit_const_example_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,16 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct headers_t *h
hdr->ipv4.diffserv = (u8)((load_byte(pkt, BYTES(ebpf_packetOffsetInBits))));
ebpf_packetOffsetInBits += 8;

hdr->ipv4.totalLen = (u16)((load_half(pkt, BYTES(ebpf_packetOffsetInBits))));
hdr->ipv4.totalLen = (u16)((load_half_ne(pkt, BYTES(ebpf_packetOffsetInBits))));
ebpf_packetOffsetInBits += 16;

hdr->ipv4.identification = (u16)((load_half(pkt, BYTES(ebpf_packetOffsetInBits))));
hdr->ipv4.identification = (u16)((load_half_ne(pkt, BYTES(ebpf_packetOffsetInBits))));
ebpf_packetOffsetInBits += 16;

hdr->ipv4.flags = (u8)((load_byte(pkt, BYTES(ebpf_packetOffsetInBits)) >> 5) & EBPF_MASK(u8, 3));
ebpf_packetOffsetInBits += 3;

hdr->ipv4.fragOffset = (u16)((load_half(pkt, BYTES(ebpf_packetOffsetInBits))) & EBPF_MASK(u16, 13));
hdr->ipv4.fragOffset = (u16)((load_half_ne(pkt, BYTES(ebpf_packetOffsetInBits))) & EBPF_MASK(u16, 13));
ebpf_packetOffsetInBits += 13;

hdr->ipv4.ttl = (u8)((load_byte(pkt, BYTES(ebpf_packetOffsetInBits))));
Expand All @@ -67,13 +67,13 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct headers_t *h
hdr->ipv4.protocol = (u8)((load_byte(pkt, BYTES(ebpf_packetOffsetInBits))));
ebpf_packetOffsetInBits += 8;

hdr->ipv4.hdrChecksum = (u16)((load_half(pkt, BYTES(ebpf_packetOffsetInBits))));
hdr->ipv4.hdrChecksum = (u16)((load_half_ne(pkt, BYTES(ebpf_packetOffsetInBits))));
ebpf_packetOffsetInBits += 16;

hdr->ipv4.srcAddr = (u32)((load_word(pkt, BYTES(ebpf_packetOffsetInBits))));
hdr->ipv4.srcAddr = (u32)((load_word_ne(pkt, BYTES(ebpf_packetOffsetInBits))));
ebpf_packetOffsetInBits += 32;

hdr->ipv4.dstAddr = (u32)((load_word(pkt, BYTES(ebpf_packetOffsetInBits))));
hdr->ipv4.dstAddr = (u32)((load_word_ne(pkt, BYTES(ebpf_packetOffsetInBits))));
ebpf_packetOffsetInBits += 32;

hdr->ipv4.ebpf_valid = 1;
Expand All @@ -92,16 +92,16 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct headers_t *h
goto reject;
}

hdr->tcp.srcPort = (u16)((load_half(pkt, BYTES(ebpf_packetOffsetInBits))));
hdr->tcp.srcPort = (u16)((load_half_ne(pkt, BYTES(ebpf_packetOffsetInBits))));
ebpf_packetOffsetInBits += 16;

hdr->tcp.dstPort = (u16)((load_half(pkt, BYTES(ebpf_packetOffsetInBits))));
hdr->tcp.dstPort = (u16)((load_half_ne(pkt, BYTES(ebpf_packetOffsetInBits))));
ebpf_packetOffsetInBits += 16;

hdr->tcp.seqNo = (u32)((load_word(pkt, BYTES(ebpf_packetOffsetInBits))));
hdr->tcp.seqNo = (u32)((load_word_ne(pkt, BYTES(ebpf_packetOffsetInBits))));
ebpf_packetOffsetInBits += 32;

hdr->tcp.ackNo = (u32)((load_word(pkt, BYTES(ebpf_packetOffsetInBits))));
hdr->tcp.ackNo = (u32)((load_word_ne(pkt, BYTES(ebpf_packetOffsetInBits))));
ebpf_packetOffsetInBits += 32;

hdr->tcp.dataOffset = (u8)((load_byte(pkt, BYTES(ebpf_packetOffsetInBits)) >> 4) & EBPF_MASK(u8, 4));
Expand All @@ -113,13 +113,13 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct headers_t *h
hdr->tcp.flags = (u8)((load_byte(pkt, BYTES(ebpf_packetOffsetInBits))));
ebpf_packetOffsetInBits += 8;

hdr->tcp.window = (u16)((load_half(pkt, BYTES(ebpf_packetOffsetInBits))));
hdr->tcp.window = (u16)((load_half_ne(pkt, BYTES(ebpf_packetOffsetInBits))));
ebpf_packetOffsetInBits += 16;

hdr->tcp.checksum = (u16)((load_half(pkt, BYTES(ebpf_packetOffsetInBits))));
hdr->tcp.checksum = (u16)((load_half_ne(pkt, BYTES(ebpf_packetOffsetInBits))));
ebpf_packetOffsetInBits += 16;

hdr->tcp.urgentPtr = (u16)((load_half(pkt, BYTES(ebpf_packetOffsetInBits))));
hdr->tcp.urgentPtr = (u16)((load_half_ne(pkt, BYTES(ebpf_packetOffsetInBits))));
ebpf_packetOffsetInBits += 16;

hdr->tcp.ebpf_valid = 1;
Expand All @@ -134,13 +134,13 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct headers_t *h
goto reject;
}

hdr->eth.dstAddr = (u64)((load_dword(pkt, BYTES(ebpf_packetOffsetInBits)) >> 16) & EBPF_MASK(u64, 48));
hdr->eth.dstAddr = (u64)((load_dword_ne(pkt, BYTES(ebpf_packetOffsetInBits)) >> 16) & EBPF_MASK(u64, 48));
ebpf_packetOffsetInBits += 48;

hdr->eth.srcAddr = (u64)((load_dword(pkt, BYTES(ebpf_packetOffsetInBits)) >> 16) & EBPF_MASK(u64, 48));
hdr->eth.srcAddr = (u64)((load_dword_ne(pkt, BYTES(ebpf_packetOffsetInBits)) >> 16) & EBPF_MASK(u64, 48));
ebpf_packetOffsetInBits += 48;

hdr->eth.etherType = (u16)((load_half(pkt, BYTES(ebpf_packetOffsetInBits))));
hdr->eth.etherType = (u16)((load_half_ne(pkt, BYTES(ebpf_packetOffsetInBits))));
ebpf_packetOffsetInBits += 16;

hdr->eth.ebpf_valid = 1;
Expand Down
18 changes: 9 additions & 9 deletions testdata/p4tc_samples_outputs/drop_packet_example_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,16 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct headers_t *h
hdr->ipv4.diffserv = (u8)((load_byte(pkt, BYTES(ebpf_packetOffsetInBits))));
ebpf_packetOffsetInBits += 8;

hdr->ipv4.totalLen = (u16)((load_half(pkt, BYTES(ebpf_packetOffsetInBits))));
hdr->ipv4.totalLen = (u16)((load_half_ne(pkt, BYTES(ebpf_packetOffsetInBits))));
ebpf_packetOffsetInBits += 16;

hdr->ipv4.identification = (u16)((load_half(pkt, BYTES(ebpf_packetOffsetInBits))));
hdr->ipv4.identification = (u16)((load_half_ne(pkt, BYTES(ebpf_packetOffsetInBits))));
ebpf_packetOffsetInBits += 16;

hdr->ipv4.flags = (u8)((load_byte(pkt, BYTES(ebpf_packetOffsetInBits)) >> 5) & EBPF_MASK(u8, 3));
ebpf_packetOffsetInBits += 3;

hdr->ipv4.fragOffset = (u16)((load_half(pkt, BYTES(ebpf_packetOffsetInBits))) & EBPF_MASK(u16, 13));
hdr->ipv4.fragOffset = (u16)((load_half_ne(pkt, BYTES(ebpf_packetOffsetInBits))) & EBPF_MASK(u16, 13));
ebpf_packetOffsetInBits += 13;

hdr->ipv4.ttl = (u8)((load_byte(pkt, BYTES(ebpf_packetOffsetInBits))));
Expand All @@ -67,13 +67,13 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct headers_t *h
hdr->ipv4.protocol = (u8)((load_byte(pkt, BYTES(ebpf_packetOffsetInBits))));
ebpf_packetOffsetInBits += 8;

hdr->ipv4.hdrChecksum = (u16)((load_half(pkt, BYTES(ebpf_packetOffsetInBits))));
hdr->ipv4.hdrChecksum = (u16)((load_half_ne(pkt, BYTES(ebpf_packetOffsetInBits))));
ebpf_packetOffsetInBits += 16;

hdr->ipv4.srcAddr = (u32)((load_word(pkt, BYTES(ebpf_packetOffsetInBits))));
hdr->ipv4.srcAddr = (u32)((load_word_ne(pkt, BYTES(ebpf_packetOffsetInBits))));
ebpf_packetOffsetInBits += 32;

hdr->ipv4.dstAddr = (u32)((load_word(pkt, BYTES(ebpf_packetOffsetInBits))));
hdr->ipv4.dstAddr = (u32)((load_word_ne(pkt, BYTES(ebpf_packetOffsetInBits))));
ebpf_packetOffsetInBits += 32;

hdr->ipv4.ebpf_valid = 1;
Expand All @@ -88,13 +88,13 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct headers_t *h
goto reject;
}

hdr->ethernet.dstAddr = (u64)((load_dword(pkt, BYTES(ebpf_packetOffsetInBits)) >> 16) & EBPF_MASK(u64, 48));
hdr->ethernet.dstAddr = (u64)((load_dword_ne(pkt, BYTES(ebpf_packetOffsetInBits)) >> 16) & EBPF_MASK(u64, 48));
ebpf_packetOffsetInBits += 48;

hdr->ethernet.srcAddr = (u64)((load_dword(pkt, BYTES(ebpf_packetOffsetInBits)) >> 16) & EBPF_MASK(u64, 48));
hdr->ethernet.srcAddr = (u64)((load_dword_ne(pkt, BYTES(ebpf_packetOffsetInBits)) >> 16) & EBPF_MASK(u64, 48));
ebpf_packetOffsetInBits += 48;

hdr->ethernet.etherType = (u16)((load_half(pkt, BYTES(ebpf_packetOffsetInBits))));
hdr->ethernet.etherType = (u16)((load_half_ne(pkt, BYTES(ebpf_packetOffsetInBits))));
ebpf_packetOffsetInBits += 16;

hdr->ethernet.ebpf_valid = 1;
Expand Down
14 changes: 7 additions & 7 deletions testdata/p4tc_samples_outputs/global_action_example_01_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,16 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct my_ingress_h
hdr->ipv4.diffserv = (u8)((load_byte(pkt, BYTES(ebpf_packetOffsetInBits))));
ebpf_packetOffsetInBits += 8;

hdr->ipv4.totalLen = (u16)((load_half(pkt, BYTES(ebpf_packetOffsetInBits))));
hdr->ipv4.totalLen = (u16)((load_half_ne(pkt, BYTES(ebpf_packetOffsetInBits))));
ebpf_packetOffsetInBits += 16;

hdr->ipv4.identification = (u16)((load_half(pkt, BYTES(ebpf_packetOffsetInBits))));
hdr->ipv4.identification = (u16)((load_half_ne(pkt, BYTES(ebpf_packetOffsetInBits))));
ebpf_packetOffsetInBits += 16;

hdr->ipv4.flags = (u8)((load_byte(pkt, BYTES(ebpf_packetOffsetInBits)) >> 5) & EBPF_MASK(u8, 3));
ebpf_packetOffsetInBits += 3;

hdr->ipv4.fragOffset = (u16)((load_half(pkt, BYTES(ebpf_packetOffsetInBits))) & EBPF_MASK(u16, 13));
hdr->ipv4.fragOffset = (u16)((load_half_ne(pkt, BYTES(ebpf_packetOffsetInBits))) & EBPF_MASK(u16, 13));
ebpf_packetOffsetInBits += 13;

hdr->ipv4.ttl = (u8)((load_byte(pkt, BYTES(ebpf_packetOffsetInBits))));
Expand All @@ -67,13 +67,13 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct my_ingress_h
hdr->ipv4.protocol = (u8)((load_byte(pkt, BYTES(ebpf_packetOffsetInBits))));
ebpf_packetOffsetInBits += 8;

hdr->ipv4.hdrChecksum = (u16)((load_half(pkt, BYTES(ebpf_packetOffsetInBits))));
hdr->ipv4.hdrChecksum = (u16)((load_half_ne(pkt, BYTES(ebpf_packetOffsetInBits))));
ebpf_packetOffsetInBits += 16;

hdr->ipv4.srcAddr = (u32)((load_word(pkt, BYTES(ebpf_packetOffsetInBits))));
hdr->ipv4.srcAddr = (u32)((load_word_ne(pkt, BYTES(ebpf_packetOffsetInBits))));
ebpf_packetOffsetInBits += 32;

hdr->ipv4.dstAddr = (u32)((load_word(pkt, BYTES(ebpf_packetOffsetInBits))));
hdr->ipv4.dstAddr = (u32)((load_word_ne(pkt, BYTES(ebpf_packetOffsetInBits))));
ebpf_packetOffsetInBits += 32;

hdr->ipv4.ebpf_valid = 1;
Expand All @@ -94,7 +94,7 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct my_ingress_h
__builtin_memcpy(&hdr->ethernet.srcAddr, pkt + BYTES(ebpf_packetOffsetInBits), 6);
ebpf_packetOffsetInBits += 48;

hdr->ethernet.etherType = (u16)((load_half(pkt, BYTES(ebpf_packetOffsetInBits))));
hdr->ethernet.etherType = (u16)((load_half_ne(pkt, BYTES(ebpf_packetOffsetInBits))));
ebpf_packetOffsetInBits += 16;

hdr->ethernet.ebpf_valid = 1;
Expand Down
14 changes: 7 additions & 7 deletions testdata/p4tc_samples_outputs/global_action_example_02_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,16 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct my_ingress_h
hdr->ipv4.diffserv = (u8)((load_byte(pkt, BYTES(ebpf_packetOffsetInBits))));
ebpf_packetOffsetInBits += 8;

hdr->ipv4.totalLen = (u16)((load_half(pkt, BYTES(ebpf_packetOffsetInBits))));
hdr->ipv4.totalLen = (u16)((load_half_ne(pkt, BYTES(ebpf_packetOffsetInBits))));
ebpf_packetOffsetInBits += 16;

hdr->ipv4.identification = (u16)((load_half(pkt, BYTES(ebpf_packetOffsetInBits))));
hdr->ipv4.identification = (u16)((load_half_ne(pkt, BYTES(ebpf_packetOffsetInBits))));
ebpf_packetOffsetInBits += 16;

hdr->ipv4.flags = (u8)((load_byte(pkt, BYTES(ebpf_packetOffsetInBits)) >> 5) & EBPF_MASK(u8, 3));
ebpf_packetOffsetInBits += 3;

hdr->ipv4.fragOffset = (u16)((load_half(pkt, BYTES(ebpf_packetOffsetInBits))) & EBPF_MASK(u16, 13));
hdr->ipv4.fragOffset = (u16)((load_half_ne(pkt, BYTES(ebpf_packetOffsetInBits))) & EBPF_MASK(u16, 13));
ebpf_packetOffsetInBits += 13;

hdr->ipv4.ttl = (u8)((load_byte(pkt, BYTES(ebpf_packetOffsetInBits))));
Expand All @@ -67,13 +67,13 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct my_ingress_h
hdr->ipv4.protocol = (u8)((load_byte(pkt, BYTES(ebpf_packetOffsetInBits))));
ebpf_packetOffsetInBits += 8;

hdr->ipv4.hdrChecksum = (u16)((load_half(pkt, BYTES(ebpf_packetOffsetInBits))));
hdr->ipv4.hdrChecksum = (u16)((load_half_ne(pkt, BYTES(ebpf_packetOffsetInBits))));
ebpf_packetOffsetInBits += 16;

hdr->ipv4.srcAddr = (u32)((load_word(pkt, BYTES(ebpf_packetOffsetInBits))));
hdr->ipv4.srcAddr = (u32)((load_word_ne(pkt, BYTES(ebpf_packetOffsetInBits))));
ebpf_packetOffsetInBits += 32;

hdr->ipv4.dstAddr = (u32)((load_word(pkt, BYTES(ebpf_packetOffsetInBits))));
hdr->ipv4.dstAddr = (u32)((load_word_ne(pkt, BYTES(ebpf_packetOffsetInBits))));
ebpf_packetOffsetInBits += 32;

hdr->ipv4.ebpf_valid = 1;
Expand All @@ -94,7 +94,7 @@ static __always_inline int run_parser(struct __sk_buff *skb, struct my_ingress_h
__builtin_memcpy(&hdr->ethernet.srcAddr, pkt + BYTES(ebpf_packetOffsetInBits), 6);
ebpf_packetOffsetInBits += 48;

hdr->ethernet.etherType = (u16)((load_half(pkt, BYTES(ebpf_packetOffsetInBits))));
hdr->ethernet.etherType = (u16)((load_half_ne(pkt, BYTES(ebpf_packetOffsetInBits))));
ebpf_packetOffsetInBits += 16;

hdr->ethernet.ebpf_valid = 1;
Expand Down
Loading