Commit 6401f37c authored by David S. Miller's avatar David S. Miller

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: default avatarDavid S. Miller <davem@davemloft.net>
parents 54a6a043 2ed46ce4
...@@ -29,18 +29,18 @@ ...@@ -29,18 +29,18 @@
#include <linux/sched/signal.h> #include <linux/sched/signal.h>
#include <net/ip.h> #include <net/ip.h>
#ifdef CONFIG_NET_RX_BUSY_POLL
struct napi_struct;
extern unsigned int sysctl_net_busy_read __read_mostly;
extern unsigned int sysctl_net_busy_poll __read_mostly;
/* 0 - Reserved to indicate value not set /* 0 - Reserved to indicate value not set
* 1..NR_CPUS - Reserved for sender_cpu * 1..NR_CPUS - Reserved for sender_cpu
* NR_CPUS+1..~0 - Region available for NAPI IDs * NR_CPUS+1..~0 - Region available for NAPI IDs
*/ */
#define MIN_NAPI_ID ((unsigned int)(NR_CPUS + 1)) #define MIN_NAPI_ID ((unsigned int)(NR_CPUS + 1))
#ifdef CONFIG_NET_RX_BUSY_POLL
struct napi_struct;
extern unsigned int sysctl_net_busy_read __read_mostly;
extern unsigned int sysctl_net_busy_poll __read_mostly;
static inline bool net_busy_loop_on(void) static inline bool net_busy_loop_on(void)
{ {
return sysctl_net_busy_poll; return sysctl_net_busy_poll;
......
...@@ -3505,6 +3505,7 @@ static u32 bpf_convert_ctx_access(enum bpf_access_type type, ...@@ -3505,6 +3505,7 @@ static u32 bpf_convert_ctx_access(enum bpf_access_type type,
bpf_target_off(struct sk_buff, tc_index, 2, bpf_target_off(struct sk_buff, tc_index, 2,
target_size)); target_size));
#else #else
*target_size = 2;
if (type == BPF_WRITE) if (type == BPF_WRITE)
*insn++ = BPF_MOV64_REG(si->dst_reg, si->dst_reg); *insn++ = BPF_MOV64_REG(si->dst_reg, si->dst_reg);
else else
...@@ -3520,6 +3521,7 @@ static u32 bpf_convert_ctx_access(enum bpf_access_type type, ...@@ -3520,6 +3521,7 @@ static u32 bpf_convert_ctx_access(enum bpf_access_type type,
*insn++ = BPF_JMP_IMM(BPF_JGE, si->dst_reg, MIN_NAPI_ID, 1); *insn++ = BPF_JMP_IMM(BPF_JGE, si->dst_reg, MIN_NAPI_ID, 1);
*insn++ = BPF_MOV64_IMM(si->dst_reg, 0); *insn++ = BPF_MOV64_IMM(si->dst_reg, 0);
#else #else
*target_size = 4;
*insn++ = BPF_MOV64_IMM(si->dst_reg, 0); *insn++ = BPF_MOV64_IMM(si->dst_reg, 0);
#endif #endif
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment