diff options
author | Jesper Dangaard Brouer <brouer@redhat.com> | 2018-04-17 17:45:37 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-04-17 17:50:28 +0300 |
commit | 106ca27f2922e8de820d1bd3d79b1cbdf2d78eea (patch) | |
tree | a8df6f30bfcd2dafe6d0dd436f2b8088b2006873 /include/net/xdp.h | |
parent | 189ead81a83eba5f5c5ce56c45620e51abcb5cb8 (diff) | |
download | linux-106ca27f2922e8de820d1bd3d79b1cbdf2d78eea.tar.xz |
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: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/xdp.h')
-rw-r--r-- | include/net/xdp.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/include/net/xdp.h b/include/net/xdp.h index e4207699c410..15f8ade008b5 100644 --- a/include/net/xdp.h +++ b/include/net/xdp.h @@ -50,6 +50,13 @@ struct xdp_rxq_info { struct xdp_mem_info mem; } ____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 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); int xdp_rxq_info_reg_mem_model(struct xdp_rxq_info *xdp_rxq, 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__ */ |