Skip to content

Commit 6401f37

Browse files
committed
Merge branch 'bpf-Minor-fix-in-bpf_convert_ctx_access'
Daniel Borkmann says: ==================== bpf: Minor fix in bpf_convert_ctx_access First one was found while trying to compile the kernel with !CONFIG_NET_RX_BUSY_POLL. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents 54a6a04 + 2ed46ce commit 6401f37

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

include/net/busy_poll.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,18 @@
2929
#include <linux/sched/signal.h>
3030
#include <net/ip.h>
3131

32-
#ifdef CONFIG_NET_RX_BUSY_POLL
33-
34-
struct napi_struct;
35-
extern unsigned int sysctl_net_busy_read __read_mostly;
36-
extern unsigned int sysctl_net_busy_poll __read_mostly;
37-
3832
/* 0 - Reserved to indicate value not set
3933
* 1..NR_CPUS - Reserved for sender_cpu
4034
* NR_CPUS+1..~0 - Region available for NAPI IDs
4135
*/
4236
#define MIN_NAPI_ID ((unsigned int)(NR_CPUS + 1))
4337

38+
#ifdef CONFIG_NET_RX_BUSY_POLL
39+
40+
struct napi_struct;
41+
extern unsigned int sysctl_net_busy_read __read_mostly;
42+
extern unsigned int sysctl_net_busy_poll __read_mostly;
43+
4444
static inline bool net_busy_loop_on(void)
4545
{
4646
return sysctl_net_busy_poll;

net/core/filter.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3505,6 +3505,7 @@ static u32 bpf_convert_ctx_access(enum bpf_access_type type,
35053505
bpf_target_off(struct sk_buff, tc_index, 2,
35063506
target_size));
35073507
#else
3508+
*target_size = 2;
35083509
if (type == BPF_WRITE)
35093510
*insn++ = BPF_MOV64_REG(si->dst_reg, si->dst_reg);
35103511
else
@@ -3520,6 +3521,7 @@ static u32 bpf_convert_ctx_access(enum bpf_access_type type,
35203521
*insn++ = BPF_JMP_IMM(BPF_JGE, si->dst_reg, MIN_NAPI_ID, 1);
35213522
*insn++ = BPF_MOV64_IMM(si->dst_reg, 0);
35223523
#else
3524+
*target_size = 4;
35233525
*insn++ = BPF_MOV64_IMM(si->dst_reg, 0);
35243526
#endif
35253527
break;

0 commit comments

Comments
 (0)