Skip to content

Commit f366138

Browse files
avasylevfacebook-github-bot
authored andcommitted
Remove TCP_HDR_OPT_SKIP_UNROLL_LOOP
Summary: It's been a while since 5.3, time to remove gating logic for loop unroll. It's 10x difference in instructions and we it accidentally surfaced that test variant didn't have this define. Reviewed By: frankfeir Differential Revision: D71472295 fbshipit-source-id: 35854cfc14fdcaf22ae49be52a72981056a5074f
1 parent e5a5d53 commit f366138

File tree

1 file changed

+4
-17
lines changed

1 file changed

+4
-17
lines changed

katran/lib/bpf/pckt_parsing.h

+4-17
Original file line numberDiff line numberDiff line change
@@ -206,13 +206,10 @@ __attribute__((__always_inline__)) int parse_hdr_opt_raw(
206206
state->byte_offset += hdr_len;
207207
return 0;
208208
}
209-
#ifdef TCP_HDR_OPT_SKIP_UNROLL_LOOP
210-
__attribute__ ((noinline))
211-
#else
212-
__attribute__ ((__always_inline__))
213-
#endif
214-
int parse_hdr_opt(const struct xdp_md *xdp, struct hdr_opt_state *state)
215-
{
209+
210+
__attribute__((noinline)) int parse_hdr_opt(
211+
const struct xdp_md* xdp,
212+
struct hdr_opt_state* state) {
216213
__u8 *tcp_opt, kind, hdr_len;
217214

218215
const void* data = (void*)(long)xdp->data;
@@ -255,12 +252,7 @@ tcp_hdr_opt_lookup_server_id(
255252

256253
opt_state.hdr_bytes_remaining = tcp_hdr_opt_len;
257254
opt_state.byte_offset = sizeof(struct tcphdr) + tcp_offset;
258-
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 3, 0) || \
259-
!defined TCP_HDR_OPT_SKIP_UNROLL_LOOP
260-
// For linux kernel version < 5.3, there isn't support in the bpf verifier
261-
// for validating bounded loops, so we need to unroll the loop
262255
#pragma clang loop unroll(full)
263-
#endif
264256
for (int i = 0; i < TCP_HDR_OPT_MAX_OPT_CHECKS; i++) {
265257
err = parse_hdr_opt(xdp, &opt_state);
266258
if (err || !opt_state.hdr_bytes_remaining) {
@@ -298,12 +290,7 @@ tcp_hdr_opt_lookup_server_id_skb(
298290

299291
opt_state.hdr_bytes_remaining = tcp_hdr_opt_len;
300292
opt_state.byte_offset = sizeof(struct tcphdr) + tcp_offset;
301-
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 3, 0) || \
302-
!defined TCP_HDR_OPT_SKIP_UNROLL_LOOP
303-
// For linux kernel version < 5.3, there isn't support in the bpf verifier
304-
// for validating bounded loops, so we need to unroll the loop
305293
#pragma clang loop unroll(full)
306-
#endif
307294
for (int i = 0; i < TCP_HDR_OPT_MAX_OPT_CHECKS; i++) {
308295
err = parse_hdr_opt_skb(skb, &opt_state);
309296
if (err || !opt_state.hdr_bytes_remaining) {

0 commit comments

Comments
 (0)