Unverified Commit 469c8e40 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files
parents 563a37de 9d894db9
Loading
Loading
Loading
Loading
+0 −17
Original line number Diff line number Diff line
@@ -1495,23 +1495,6 @@ enum gnet_bpf_attach_type {
	MAX_GNET_BPF_ATTACH_TYPE
};

static inline enum gnet_bpf_attach_type
to_gnet_bpf_attach_type(enum bpf_attach_type attach_type)
{
	switch (attach_type) {
	case BPF_GNET_TCP_RECVMSG:
		return GNET_TCP_RECVMSG;
	case BPF_GNET_SK_DST_SET:
		return GNET_SK_DST_SET;
	case BPF_GNET_RCV_NIC_NODE:
		return GNET_RCV_NIC_NODE;
	case BPF_GNET_SEND_NIC_NODE:
		return GNET_SEND_NIC_NODE;
	default:
	return GNET_BPF_ATTACH_TYPE_INVALID;
	}
}

struct gnet_bpf {
	struct bpf_prog __rcu *progs[MAX_GNET_BPF_ATTACH_TYPE];
	u32 flags[MAX_GNET_BPF_ATTACH_TYPE];
+17 −0
Original line number Diff line number Diff line
@@ -10699,6 +10699,23 @@ EXPORT_SYMBOL(gnet_bpf_progs);
struct static_key_false gnet_bpf_enabled_key[MAX_GNET_BPF_ATTACH_TYPE];
EXPORT_SYMBOL(gnet_bpf_enabled_key);

static inline enum gnet_bpf_attach_type
to_gnet_bpf_attach_type(enum bpf_attach_type attach_type)
{
	switch (attach_type) {
	case BPF_GNET_TCP_RECVMSG:
		return GNET_TCP_RECVMSG;
	case BPF_GNET_SK_DST_SET:
		return GNET_SK_DST_SET;
	case BPF_GNET_RCV_NIC_NODE:
		return GNET_RCV_NIC_NODE;
	case BPF_GNET_SEND_NIC_NODE:
		return GNET_SEND_NIC_NODE;
	default:
	return GNET_BPF_ATTACH_TYPE_INVALID;
	}
}

int gnet_bpf_prog_attach(const union bpf_attr *attr,
			 enum bpf_prog_type ptype, struct bpf_prog *prog)
{