Commit 106ca27f authored by Jesper Dangaard Brouer's avatar Jesper Dangaard Brouer Committed by David S. Miller

xdp: move struct xdp_buff from filter.h to xdp.h

This is done to prepare for the next patch, and it is also
nice to move this XDP related struct out of filter.h.
Signed-off-by: default avatarJesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 189ead81
...@@ -30,6 +30,7 @@ struct sock; ...@@ -30,6 +30,7 @@ struct sock;
struct seccomp_data; struct seccomp_data;
struct bpf_prog_aux; struct bpf_prog_aux;
struct xdp_rxq_info; struct xdp_rxq_info;
struct xdp_buff;
/* ArgX, context and stack frame pointer register positions. Note, /* ArgX, context and stack frame pointer register positions. Note,
* Arg1, Arg2, Arg3, etc are used as argument mappings of function * Arg1, Arg2, Arg3, etc are used as argument mappings of function
...@@ -500,14 +501,6 @@ struct bpf_skb_data_end { ...@@ -500,14 +501,6 @@ struct bpf_skb_data_end {
void *data_end; void *data_end;
}; };
struct xdp_buff {
void *data;
void *data_end;
void *data_meta;
void *data_hard_start;
struct xdp_rxq_info *rxq;
};
struct sk_msg_buff { struct sk_msg_buff {
void *data; void *data;
void *data_end; void *data_end;
...@@ -772,21 +765,6 @@ int xdp_do_redirect(struct net_device *dev, ...@@ -772,21 +765,6 @@ int xdp_do_redirect(struct net_device *dev,
struct bpf_prog *prog); struct bpf_prog *prog);
void xdp_do_flush_map(void); void xdp_do_flush_map(void);
/* Drivers not supporting XDP metadata can use this helper, which
* rejects any room expansion for metadata as a result.
*/
static __always_inline void
xdp_set_data_meta_invalid(struct xdp_buff *xdp)
{
xdp->data_meta = xdp->data + 1;
}
static __always_inline bool
xdp_data_meta_unsupported(const struct xdp_buff *xdp)
{
return unlikely(xdp->data_meta > xdp->data);
}
void bpf_warn_invalid_xdp_action(u32 act); void bpf_warn_invalid_xdp_action(u32 act);
struct sock *do_sk_redirect_map(struct sk_buff *skb); struct sock *do_sk_redirect_map(struct sk_buff *skb);
......
...@@ -50,6 +50,13 @@ struct xdp_rxq_info { ...@@ -50,6 +50,13 @@ struct xdp_rxq_info {
struct xdp_mem_info mem; struct xdp_mem_info mem;
} ____cacheline_aligned; /* perf critical, avoid false-sharing */ } ____cacheline_aligned; /* perf critical, avoid false-sharing */
struct xdp_buff {
void *data;
void *data_end;
void *data_meta;
void *data_hard_start;
struct xdp_rxq_info *rxq;
};
static inline static inline
void xdp_return_frame(void *data, struct xdp_mem_info *mem) void xdp_return_frame(void *data, struct xdp_mem_info *mem)
...@@ -72,4 +79,19 @@ bool xdp_rxq_info_is_reg(struct xdp_rxq_info *xdp_rxq); ...@@ -72,4 +79,19 @@ bool xdp_rxq_info_is_reg(struct xdp_rxq_info *xdp_rxq);
int xdp_rxq_info_reg_mem_model(struct xdp_rxq_info *xdp_rxq, int xdp_rxq_info_reg_mem_model(struct xdp_rxq_info *xdp_rxq,
enum xdp_mem_type type, void *allocator); enum xdp_mem_type type, void *allocator);
/* Drivers not supporting XDP metadata can use this helper, which
* rejects any room expansion for metadata as a result.
*/
static __always_inline void
xdp_set_data_meta_invalid(struct xdp_buff *xdp)
{
xdp->data_meta = xdp->data + 1;
}
static __always_inline bool
xdp_data_meta_unsupported(const struct xdp_buff *xdp)
{
return unlikely(xdp->data_meta > xdp->data);
}
#endif /* __LINUX_NET_XDP_H__ */ #endif /* __LINUX_NET_XDP_H__ */
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