mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-17 01:04:19 +08:00
c2865b1122
-----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQTFp0I1jqZrAX+hPRXbK58LschIgwUCZDhSiwAKCRDbK58LschI g8cbAQCH4xrquOeDmYyGXFQGchHZAIj++tKg8ABU4+hYeJtrlwEA6D4W6wjoSZRk mLSptZ9qro8yZA86BvyPvlBT1h9ELQA= =StAc -----END PGP SIGNATURE----- Daniel Borkmann says: ==================== pull-request: bpf-next 2023-04-13 We've added 260 non-merge commits during the last 36 day(s) which contain a total of 356 files changed, 21786 insertions(+), 11275 deletions(-). The main changes are: 1) Rework BPF verifier log behavior and implement it as a rotating log by default with the option to retain old-style fixed log behavior, from Andrii Nakryiko. 2) Adds support for using {FOU,GUE} encap with an ipip device operating in collect_md mode and add a set of BPF kfuncs for controlling encap params, from Christian Ehrig. 3) Allow BPF programs to detect at load time whether a particular kfunc exists or not, and also add support for this in light skeleton, from Alexei Starovoitov. 4) Optimize hashmap lookups when key size is multiple of 4, from Anton Protopopov. 5) Enable RCU semantics for task BPF kptrs and allow referenced kptr tasks to be stored in BPF maps, from David Vernet. 6) Add support for stashing local BPF kptr into a map value via bpf_kptr_xchg(). This is useful e.g. for rbtree node creation for new cgroups, from Dave Marchevsky. 7) Fix BTF handling of is_int_ptr to skip modifiers to work around tracing issues where a program cannot be attached, from Feng Zhou. 8) Migrate a big portion of test_verifier unit tests over to test_progs -a verifier_* via inline asm to ease {read,debug}ability, from Eduard Zingerman. 9) Several updates to the instruction-set.rst documentation which is subject to future IETF standardization (https://lwn.net/Articles/926882/), from Dave Thaler. 10) Fix BPF verifier in the __reg_bound_offset's 64->32 tnum sub-register known bits information propagation, from Daniel Borkmann. 11) Add skb bitfield compaction work related to BPF with the overall goal to make more of the sk_buff bits optional, from Jakub Kicinski. 12) BPF selftest cleanups for build id extraction which stand on its own from the upcoming integration work of build id into struct file object, from Jiri Olsa. 13) Add fixes and optimizations for xsk descriptor validation and several selftest improvements for xsk sockets, from Kal Conley. 14) Add BPF links for struct_ops and enable switching implementations of BPF TCP cong-ctls under a given name by replacing backing struct_ops map, from Kui-Feng Lee. 15) Remove a misleading BPF verifier env->bypass_spec_v1 check on variable offset stack read as earlier Spectre checks cover this, from Luis Gerhorst. 16) Fix issues in copy_from_user_nofault() for BPF and other tracers to resemble copy_from_user_nmi() from safety PoV, from Florian Lehner and Alexei Starovoitov. 17) Add --json-summary option to test_progs in order for CI tooling to ease parsing of test results, from Manu Bretelle. 18) Batch of improvements and refactoring to prep for upcoming bpf_local_storage conversion to bpf_mem_cache_{alloc,free} allocator, from Martin KaFai Lau. 19) Improve bpftool's visual program dump which produces the control flow graph in a DOT format by adding C source inline annotations, from Quentin Monnet. 20) Fix attaching fentry/fexit/fmod_ret/lsm to modules by extracting the module name from BTF of the target and searching kallsyms of the correct module, from Viktor Malik. 21) Improve BPF verifier handling of '<const> <cond> <non_const>' to better detect whether in particular jmp32 branches are taken, from Yonghong Song. 22) Allow BPF TCP cong-ctls to write app_limited of struct tcp_sock. A built-in cc or one from a kernel module is already able to write to app_limited, from Yixin Shen. Conflicts: Documentation/bpf/bpf_devel_QA.rstb7abcd9c65
("bpf, doc: Link to submitting-patches.rst for general patch submission info")0f10f647f4
("bpf, docs: Use internal linking for link to netdev subsystem doc") https://lore.kernel.org/all/20230307095812.236eb1be@canb.auug.org.au/ include/net/ip_tunnels.hbc9d003dc4
("ip_tunnel: Preserve pointer const in ip_tunnel_info_opts")ac931d4cde
("ipip,ip_tunnel,sit: Add FOU support for externally controlled ipip devices") https://lore.kernel.org/all/20230413161235.4093777-1-broonie@kernel.org/ net/bpf/test_run.ce5995bc7e2
("bpf, test_run: fix crashes due to XDP frame overwriting/corruption")294635a816
("bpf, test_run: fix &xdp_frame misplacement for LIVE_FRAMES") https://lore.kernel.org/all/20230320102619.05b80a98@canb.auug.org.au/ ==================== Link: https://lore.kernel.org/r/20230413191525.7295-1-daniel@iogearbox.net Signed-off-by: Jakub Kicinski <kuba@kernel.org>
478 lines
14 KiB
C
478 lines
14 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/* include/net/xdp.h
|
|
*
|
|
* Copyright (c) 2017 Jesper Dangaard Brouer, Red Hat Inc.
|
|
*/
|
|
#ifndef __LINUX_NET_XDP_H__
|
|
#define __LINUX_NET_XDP_H__
|
|
|
|
#include <linux/skbuff.h> /* skb_shared_info */
|
|
#include <uapi/linux/netdev.h>
|
|
#include <linux/bitfield.h>
|
|
|
|
/**
|
|
* DOC: XDP RX-queue information
|
|
*
|
|
* The XDP RX-queue info (xdp_rxq_info) is associated with the driver
|
|
* level RX-ring queues. It is information that is specific to how
|
|
* the driver have configured a given RX-ring queue.
|
|
*
|
|
* Each xdp_buff frame received in the driver carries a (pointer)
|
|
* reference to this xdp_rxq_info structure. This provides the XDP
|
|
* data-path read-access to RX-info for both kernel and bpf-side
|
|
* (limited subset).
|
|
*
|
|
* For now, direct access is only safe while running in NAPI/softirq
|
|
* context. Contents are read-mostly and must not be updated during
|
|
* driver NAPI/softirq poll.
|
|
*
|
|
* The driver usage API is a register and unregister API.
|
|
*
|
|
* The struct is not directly tied to the XDP prog. A new XDP prog
|
|
* can be attached as long as it doesn't change the underlying
|
|
* RX-ring. If the RX-ring does change significantly, the NIC driver
|
|
* naturally need to stop the RX-ring before purging and reallocating
|
|
* memory. In that process the driver MUST call unregister (which
|
|
* also applies for driver shutdown and unload). The register API is
|
|
* also mandatory during RX-ring setup.
|
|
*/
|
|
|
|
enum xdp_mem_type {
|
|
MEM_TYPE_PAGE_SHARED = 0, /* Split-page refcnt based model */
|
|
MEM_TYPE_PAGE_ORDER0, /* Orig XDP full page model */
|
|
MEM_TYPE_PAGE_POOL,
|
|
MEM_TYPE_XSK_BUFF_POOL,
|
|
MEM_TYPE_MAX,
|
|
};
|
|
|
|
typedef u32 xdp_features_t;
|
|
|
|
/* XDP flags for ndo_xdp_xmit */
|
|
#define XDP_XMIT_FLUSH (1U << 0) /* doorbell signal consumer */
|
|
#define XDP_XMIT_FLAGS_MASK XDP_XMIT_FLUSH
|
|
|
|
struct xdp_mem_info {
|
|
u32 type; /* enum xdp_mem_type, but known size type */
|
|
u32 id;
|
|
};
|
|
|
|
struct page_pool;
|
|
|
|
struct xdp_rxq_info {
|
|
struct net_device *dev;
|
|
u32 queue_index;
|
|
u32 reg_state;
|
|
struct xdp_mem_info mem;
|
|
unsigned int napi_id;
|
|
u32 frag_size;
|
|
} ____cacheline_aligned; /* perf critical, avoid false-sharing */
|
|
|
|
struct xdp_txq_info {
|
|
struct net_device *dev;
|
|
};
|
|
|
|
enum xdp_buff_flags {
|
|
XDP_FLAGS_HAS_FRAGS = BIT(0), /* non-linear xdp buff */
|
|
XDP_FLAGS_FRAGS_PF_MEMALLOC = BIT(1), /* xdp paged memory is under
|
|
* pressure
|
|
*/
|
|
};
|
|
|
|
struct xdp_buff {
|
|
void *data;
|
|
void *data_end;
|
|
void *data_meta;
|
|
void *data_hard_start;
|
|
struct xdp_rxq_info *rxq;
|
|
struct xdp_txq_info *txq;
|
|
u32 frame_sz; /* frame size to deduce data_hard_end/reserved tailroom*/
|
|
u32 flags; /* supported values defined in xdp_buff_flags */
|
|
};
|
|
|
|
static __always_inline bool xdp_buff_has_frags(struct xdp_buff *xdp)
|
|
{
|
|
return !!(xdp->flags & XDP_FLAGS_HAS_FRAGS);
|
|
}
|
|
|
|
static __always_inline void xdp_buff_set_frags_flag(struct xdp_buff *xdp)
|
|
{
|
|
xdp->flags |= XDP_FLAGS_HAS_FRAGS;
|
|
}
|
|
|
|
static __always_inline void xdp_buff_clear_frags_flag(struct xdp_buff *xdp)
|
|
{
|
|
xdp->flags &= ~XDP_FLAGS_HAS_FRAGS;
|
|
}
|
|
|
|
static __always_inline bool xdp_buff_is_frag_pfmemalloc(struct xdp_buff *xdp)
|
|
{
|
|
return !!(xdp->flags & XDP_FLAGS_FRAGS_PF_MEMALLOC);
|
|
}
|
|
|
|
static __always_inline void xdp_buff_set_frag_pfmemalloc(struct xdp_buff *xdp)
|
|
{
|
|
xdp->flags |= XDP_FLAGS_FRAGS_PF_MEMALLOC;
|
|
}
|
|
|
|
static __always_inline void
|
|
xdp_init_buff(struct xdp_buff *xdp, u32 frame_sz, struct xdp_rxq_info *rxq)
|
|
{
|
|
xdp->frame_sz = frame_sz;
|
|
xdp->rxq = rxq;
|
|
xdp->flags = 0;
|
|
}
|
|
|
|
static __always_inline void
|
|
xdp_prepare_buff(struct xdp_buff *xdp, unsigned char *hard_start,
|
|
int headroom, int data_len, const bool meta_valid)
|
|
{
|
|
unsigned char *data = hard_start + headroom;
|
|
|
|
xdp->data_hard_start = hard_start;
|
|
xdp->data = data;
|
|
xdp->data_end = data + data_len;
|
|
xdp->data_meta = meta_valid ? data : data + 1;
|
|
}
|
|
|
|
/* Reserve memory area at end-of data area.
|
|
*
|
|
* This macro reserves tailroom in the XDP buffer by limiting the
|
|
* XDP/BPF data access to data_hard_end. Notice same area (and size)
|
|
* is used for XDP_PASS, when constructing the SKB via build_skb().
|
|
*/
|
|
#define xdp_data_hard_end(xdp) \
|
|
((xdp)->data_hard_start + (xdp)->frame_sz - \
|
|
SKB_DATA_ALIGN(sizeof(struct skb_shared_info)))
|
|
|
|
static inline struct skb_shared_info *
|
|
xdp_get_shared_info_from_buff(struct xdp_buff *xdp)
|
|
{
|
|
return (struct skb_shared_info *)xdp_data_hard_end(xdp);
|
|
}
|
|
|
|
static __always_inline unsigned int xdp_get_buff_len(struct xdp_buff *xdp)
|
|
{
|
|
unsigned int len = xdp->data_end - xdp->data;
|
|
struct skb_shared_info *sinfo;
|
|
|
|
if (likely(!xdp_buff_has_frags(xdp)))
|
|
goto out;
|
|
|
|
sinfo = xdp_get_shared_info_from_buff(xdp);
|
|
len += sinfo->xdp_frags_size;
|
|
out:
|
|
return len;
|
|
}
|
|
|
|
struct xdp_frame {
|
|
void *data;
|
|
u16 len;
|
|
u16 headroom;
|
|
u32 metasize; /* uses lower 8-bits */
|
|
/* Lifetime of xdp_rxq_info is limited to NAPI/enqueue time,
|
|
* while mem info is valid on remote CPU.
|
|
*/
|
|
struct xdp_mem_info mem;
|
|
struct net_device *dev_rx; /* used by cpumap */
|
|
u32 frame_sz;
|
|
u32 flags; /* supported values defined in xdp_buff_flags */
|
|
};
|
|
|
|
static __always_inline bool xdp_frame_has_frags(struct xdp_frame *frame)
|
|
{
|
|
return !!(frame->flags & XDP_FLAGS_HAS_FRAGS);
|
|
}
|
|
|
|
static __always_inline bool xdp_frame_is_frag_pfmemalloc(struct xdp_frame *frame)
|
|
{
|
|
return !!(frame->flags & XDP_FLAGS_FRAGS_PF_MEMALLOC);
|
|
}
|
|
|
|
#define XDP_BULK_QUEUE_SIZE 16
|
|
struct xdp_frame_bulk {
|
|
int count;
|
|
void *xa;
|
|
void *q[XDP_BULK_QUEUE_SIZE];
|
|
};
|
|
|
|
static __always_inline void xdp_frame_bulk_init(struct xdp_frame_bulk *bq)
|
|
{
|
|
/* bq->count will be zero'ed when bq->xa gets updated */
|
|
bq->xa = NULL;
|
|
}
|
|
|
|
static inline struct skb_shared_info *
|
|
xdp_get_shared_info_from_frame(struct xdp_frame *frame)
|
|
{
|
|
void *data_hard_start = frame->data - frame->headroom - sizeof(*frame);
|
|
|
|
return (struct skb_shared_info *)(data_hard_start + frame->frame_sz -
|
|
SKB_DATA_ALIGN(sizeof(struct skb_shared_info)));
|
|
}
|
|
|
|
struct xdp_cpumap_stats {
|
|
unsigned int redirect;
|
|
unsigned int pass;
|
|
unsigned int drop;
|
|
};
|
|
|
|
/* Clear kernel pointers in xdp_frame */
|
|
static inline void xdp_scrub_frame(struct xdp_frame *frame)
|
|
{
|
|
frame->data = NULL;
|
|
frame->dev_rx = NULL;
|
|
}
|
|
|
|
static inline void
|
|
xdp_update_skb_shared_info(struct sk_buff *skb, u8 nr_frags,
|
|
unsigned int size, unsigned int truesize,
|
|
bool pfmemalloc)
|
|
{
|
|
skb_shinfo(skb)->nr_frags = nr_frags;
|
|
|
|
skb->len += size;
|
|
skb->data_len += size;
|
|
skb->truesize += truesize;
|
|
skb->pfmemalloc |= pfmemalloc;
|
|
}
|
|
|
|
/* Avoids inlining WARN macro in fast-path */
|
|
void xdp_warn(const char *msg, const char *func, const int line);
|
|
#define XDP_WARN(msg) xdp_warn(msg, __func__, __LINE__)
|
|
|
|
struct xdp_frame *xdp_convert_zc_to_xdp_frame(struct xdp_buff *xdp);
|
|
struct sk_buff *__xdp_build_skb_from_frame(struct xdp_frame *xdpf,
|
|
struct sk_buff *skb,
|
|
struct net_device *dev);
|
|
struct sk_buff *xdp_build_skb_from_frame(struct xdp_frame *xdpf,
|
|
struct net_device *dev);
|
|
int xdp_alloc_skb_bulk(void **skbs, int n_skb, gfp_t gfp);
|
|
struct xdp_frame *xdpf_clone(struct xdp_frame *xdpf);
|
|
|
|
static inline
|
|
void xdp_convert_frame_to_buff(struct xdp_frame *frame, struct xdp_buff *xdp)
|
|
{
|
|
xdp->data_hard_start = frame->data - frame->headroom - sizeof(*frame);
|
|
xdp->data = frame->data;
|
|
xdp->data_end = frame->data + frame->len;
|
|
xdp->data_meta = frame->data - frame->metasize;
|
|
xdp->frame_sz = frame->frame_sz;
|
|
xdp->flags = frame->flags;
|
|
}
|
|
|
|
static inline
|
|
int xdp_update_frame_from_buff(struct xdp_buff *xdp,
|
|
struct xdp_frame *xdp_frame)
|
|
{
|
|
int metasize, headroom;
|
|
|
|
/* Assure headroom is available for storing info */
|
|
headroom = xdp->data - xdp->data_hard_start;
|
|
metasize = xdp->data - xdp->data_meta;
|
|
metasize = metasize > 0 ? metasize : 0;
|
|
if (unlikely((headroom - metasize) < sizeof(*xdp_frame)))
|
|
return -ENOSPC;
|
|
|
|
/* Catch if driver didn't reserve tailroom for skb_shared_info */
|
|
if (unlikely(xdp->data_end > xdp_data_hard_end(xdp))) {
|
|
XDP_WARN("Driver BUG: missing reserved tailroom");
|
|
return -ENOSPC;
|
|
}
|
|
|
|
xdp_frame->data = xdp->data;
|
|
xdp_frame->len = xdp->data_end - xdp->data;
|
|
xdp_frame->headroom = headroom - sizeof(*xdp_frame);
|
|
xdp_frame->metasize = metasize;
|
|
xdp_frame->frame_sz = xdp->frame_sz;
|
|
xdp_frame->flags = xdp->flags;
|
|
|
|
return 0;
|
|
}
|
|
|
|
/* Convert xdp_buff to xdp_frame */
|
|
static inline
|
|
struct xdp_frame *xdp_convert_buff_to_frame(struct xdp_buff *xdp)
|
|
{
|
|
struct xdp_frame *xdp_frame;
|
|
|
|
if (xdp->rxq->mem.type == MEM_TYPE_XSK_BUFF_POOL)
|
|
return xdp_convert_zc_to_xdp_frame(xdp);
|
|
|
|
/* Store info in top of packet */
|
|
xdp_frame = xdp->data_hard_start;
|
|
if (unlikely(xdp_update_frame_from_buff(xdp, xdp_frame) < 0))
|
|
return NULL;
|
|
|
|
/* rxq only valid until napi_schedule ends, convert to xdp_mem_info */
|
|
xdp_frame->mem = xdp->rxq->mem;
|
|
|
|
return xdp_frame;
|
|
}
|
|
|
|
void __xdp_return(void *data, struct xdp_mem_info *mem, bool napi_direct,
|
|
struct xdp_buff *xdp);
|
|
void xdp_return_frame(struct xdp_frame *xdpf);
|
|
void xdp_return_frame_rx_napi(struct xdp_frame *xdpf);
|
|
void xdp_return_buff(struct xdp_buff *xdp);
|
|
void xdp_flush_frame_bulk(struct xdp_frame_bulk *bq);
|
|
void xdp_return_frame_bulk(struct xdp_frame *xdpf,
|
|
struct xdp_frame_bulk *bq);
|
|
|
|
static __always_inline unsigned int xdp_get_frame_len(struct xdp_frame *xdpf)
|
|
{
|
|
struct skb_shared_info *sinfo;
|
|
unsigned int len = xdpf->len;
|
|
|
|
if (likely(!xdp_frame_has_frags(xdpf)))
|
|
goto out;
|
|
|
|
sinfo = xdp_get_shared_info_from_frame(xdpf);
|
|
len += sinfo->xdp_frags_size;
|
|
out:
|
|
return len;
|
|
}
|
|
|
|
int __xdp_rxq_info_reg(struct xdp_rxq_info *xdp_rxq,
|
|
struct net_device *dev, u32 queue_index,
|
|
unsigned int napi_id, u32 frag_size);
|
|
static inline int
|
|
xdp_rxq_info_reg(struct xdp_rxq_info *xdp_rxq,
|
|
struct net_device *dev, u32 queue_index,
|
|
unsigned int napi_id)
|
|
{
|
|
return __xdp_rxq_info_reg(xdp_rxq, dev, queue_index, napi_id, 0);
|
|
}
|
|
|
|
void xdp_rxq_info_unreg(struct xdp_rxq_info *xdp_rxq);
|
|
void xdp_rxq_info_unused(struct xdp_rxq_info *xdp_rxq);
|
|
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);
|
|
void xdp_rxq_info_unreg_mem_model(struct xdp_rxq_info *xdp_rxq);
|
|
int xdp_reg_mem_model(struct xdp_mem_info *mem,
|
|
enum xdp_mem_type type, void *allocator);
|
|
void xdp_unreg_mem_model(struct xdp_mem_info *mem);
|
|
|
|
/* 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);
|
|
}
|
|
|
|
static inline bool xdp_metalen_invalid(unsigned long metalen)
|
|
{
|
|
return (metalen & (sizeof(__u32) - 1)) || (metalen > 32);
|
|
}
|
|
|
|
struct xdp_attachment_info {
|
|
struct bpf_prog *prog;
|
|
u32 flags;
|
|
};
|
|
|
|
struct netdev_bpf;
|
|
void xdp_attachment_setup(struct xdp_attachment_info *info,
|
|
struct netdev_bpf *bpf);
|
|
|
|
#define DEV_MAP_BULK_SIZE XDP_BULK_QUEUE_SIZE
|
|
|
|
#define XDP_METADATA_KFUNC_xxx \
|
|
XDP_METADATA_KFUNC(XDP_METADATA_KFUNC_RX_TIMESTAMP, \
|
|
bpf_xdp_metadata_rx_timestamp) \
|
|
XDP_METADATA_KFUNC(XDP_METADATA_KFUNC_RX_HASH, \
|
|
bpf_xdp_metadata_rx_hash) \
|
|
|
|
enum {
|
|
#define XDP_METADATA_KFUNC(name, _) name,
|
|
XDP_METADATA_KFUNC_xxx
|
|
#undef XDP_METADATA_KFUNC
|
|
MAX_XDP_METADATA_KFUNC,
|
|
};
|
|
|
|
enum xdp_rss_hash_type {
|
|
/* First part: Individual bits for L3/L4 types */
|
|
XDP_RSS_L3_IPV4 = BIT(0),
|
|
XDP_RSS_L3_IPV6 = BIT(1),
|
|
|
|
/* The fixed (L3) IPv4 and IPv6 headers can both be followed by
|
|
* variable/dynamic headers, IPv4 called Options and IPv6 called
|
|
* Extension Headers. HW RSS type can contain this info.
|
|
*/
|
|
XDP_RSS_L3_DYNHDR = BIT(2),
|
|
|
|
/* When RSS hash covers L4 then drivers MUST set XDP_RSS_L4 bit in
|
|
* addition to the protocol specific bit. This ease interaction with
|
|
* SKBs and avoids reserving a fixed mask for future L4 protocol bits.
|
|
*/
|
|
XDP_RSS_L4 = BIT(3), /* L4 based hash, proto can be unknown */
|
|
XDP_RSS_L4_TCP = BIT(4),
|
|
XDP_RSS_L4_UDP = BIT(5),
|
|
XDP_RSS_L4_SCTP = BIT(6),
|
|
XDP_RSS_L4_IPSEC = BIT(7), /* L4 based hash include IPSEC SPI */
|
|
|
|
/* Second part: RSS hash type combinations used for driver HW mapping */
|
|
XDP_RSS_TYPE_NONE = 0,
|
|
XDP_RSS_TYPE_L2 = XDP_RSS_TYPE_NONE,
|
|
|
|
XDP_RSS_TYPE_L3_IPV4 = XDP_RSS_L3_IPV4,
|
|
XDP_RSS_TYPE_L3_IPV6 = XDP_RSS_L3_IPV6,
|
|
XDP_RSS_TYPE_L3_IPV4_OPT = XDP_RSS_L3_IPV4 | XDP_RSS_L3_DYNHDR,
|
|
XDP_RSS_TYPE_L3_IPV6_EX = XDP_RSS_L3_IPV6 | XDP_RSS_L3_DYNHDR,
|
|
|
|
XDP_RSS_TYPE_L4_ANY = XDP_RSS_L4,
|
|
XDP_RSS_TYPE_L4_IPV4_TCP = XDP_RSS_L3_IPV4 | XDP_RSS_L4 | XDP_RSS_L4_TCP,
|
|
XDP_RSS_TYPE_L4_IPV4_UDP = XDP_RSS_L3_IPV4 | XDP_RSS_L4 | XDP_RSS_L4_UDP,
|
|
XDP_RSS_TYPE_L4_IPV4_SCTP = XDP_RSS_L3_IPV4 | XDP_RSS_L4 | XDP_RSS_L4_SCTP,
|
|
XDP_RSS_TYPE_L4_IPV4_IPSEC = XDP_RSS_L3_IPV4 | XDP_RSS_L4 | XDP_RSS_L4_IPSEC,
|
|
|
|
XDP_RSS_TYPE_L4_IPV6_TCP = XDP_RSS_L3_IPV6 | XDP_RSS_L4 | XDP_RSS_L4_TCP,
|
|
XDP_RSS_TYPE_L4_IPV6_UDP = XDP_RSS_L3_IPV6 | XDP_RSS_L4 | XDP_RSS_L4_UDP,
|
|
XDP_RSS_TYPE_L4_IPV6_SCTP = XDP_RSS_L3_IPV6 | XDP_RSS_L4 | XDP_RSS_L4_SCTP,
|
|
XDP_RSS_TYPE_L4_IPV6_IPSEC = XDP_RSS_L3_IPV6 | XDP_RSS_L4 | XDP_RSS_L4_IPSEC,
|
|
|
|
XDP_RSS_TYPE_L4_IPV6_TCP_EX = XDP_RSS_TYPE_L4_IPV6_TCP | XDP_RSS_L3_DYNHDR,
|
|
XDP_RSS_TYPE_L4_IPV6_UDP_EX = XDP_RSS_TYPE_L4_IPV6_UDP | XDP_RSS_L3_DYNHDR,
|
|
XDP_RSS_TYPE_L4_IPV6_SCTP_EX = XDP_RSS_TYPE_L4_IPV6_SCTP | XDP_RSS_L3_DYNHDR,
|
|
};
|
|
|
|
#ifdef CONFIG_NET
|
|
u32 bpf_xdp_metadata_kfunc_id(int id);
|
|
bool bpf_dev_bound_kfunc_id(u32 btf_id);
|
|
void xdp_set_features_flag(struct net_device *dev, xdp_features_t val);
|
|
void xdp_features_set_redirect_target(struct net_device *dev, bool support_sg);
|
|
void xdp_features_clear_redirect_target(struct net_device *dev);
|
|
#else
|
|
static inline u32 bpf_xdp_metadata_kfunc_id(int id) { return 0; }
|
|
static inline bool bpf_dev_bound_kfunc_id(u32 btf_id) { return false; }
|
|
|
|
static inline void
|
|
xdp_set_features_flag(struct net_device *dev, xdp_features_t val)
|
|
{
|
|
}
|
|
|
|
static inline void
|
|
xdp_features_set_redirect_target(struct net_device *dev, bool support_sg)
|
|
{
|
|
}
|
|
|
|
static inline void
|
|
xdp_features_clear_redirect_target(struct net_device *dev)
|
|
{
|
|
}
|
|
#endif
|
|
|
|
static inline void xdp_clear_features_flag(struct net_device *dev)
|
|
{
|
|
xdp_set_features_flag(dev, 0);
|
|
}
|
|
|
|
#endif /* __LINUX_NET_XDP_H__ */
|