@@ -32,6 +32,7 @@
#include <linux/percpu.h>
#include <linux/rculist.h>
#include <linux/workqueue.h>
+#include <linux/netqueue.h>
#include <linux/dynamic_queue_limits.h>
#include <linux/ethtool.h>
new file mode 100644
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Network queue identifier definitions
+ *
+ * Copyright (c) 2020 Tom Herbert <tom@herbertland.com>
+ */
+
+#ifndef _LINUX_NETQUEUE_H
+#define _LINUX_NETQUEUE_H
+
+/* Indicates no network queue is present in 16 bit queue number */
+#define NO_QUEUE USHRT_MAX
+
+struct net_queue_pair {
+ unsigned short txq_id;
+ unsigned short rxq_id;
+};
+
+static inline void init_net_queue_pair(struct net_queue_pair *qpair)
+{
+ qpair->rxq_id = NO_QUEUE;
+ qpair->txq_id = NO_QUEUE;
+}
+
+#endif /* _LINUX_NETQUEUE_H */
@@ -1800,16 +1800,14 @@ static inline void sk_tx_queue_set(struct sock *sk, int tx_queue)
sk->sk_tx_queue_mapping = tx_queue;
}
-#define NO_QUEUE_MAPPING USHRT_MAX
-
static inline void sk_tx_queue_clear(struct sock *sk)
{
- sk->sk_tx_queue_mapping = NO_QUEUE_MAPPING;
+ sk->sk_tx_queue_mapping = NO_QUEUE;
}
static inline int sk_tx_queue_get(const struct sock *sk)
{
- if (sk && sk->sk_tx_queue_mapping != NO_QUEUE_MAPPING)
+ if (sk && sk->sk_tx_queue_mapping != NO_QUEUE)
return sk->sk_tx_queue_mapping;
return -1;
@@ -1821,7 +1819,7 @@ static inline void sk_rx_queue_set(struct sock *sk, const struct sk_buff *skb)
if (skb_rx_queue_recorded(skb)) {
u16 rx_queue = skb_get_rx_queue(skb);
- if (WARN_ON_ONCE(rx_queue == NO_QUEUE_MAPPING))
+ if (WARN_ON_ONCE(rx_queue == NO_QUEUE))
return;
sk->sk_rx_queue_mapping = rx_queue;
@@ -1832,14 +1830,14 @@ static inline void sk_rx_queue_set(struct sock *sk, const struct sk_buff *skb)
static inline void sk_rx_queue_clear(struct sock *sk)
{
#ifdef CONFIG_XPS
- sk->sk_rx_queue_mapping = NO_QUEUE_MAPPING;
+ sk->sk_rx_queue_mapping = NO_QUEUE;
#endif
}
#ifdef CONFIG_XPS
static inline int sk_rx_queue_get(const struct sock *sk)
{
- if (sk && sk->sk_rx_queue_mapping != NO_QUEUE_MAPPING)
+ if (sk && sk->sk_rx_queue_mapping != NO_QUEUE)
return sk->sk_rx_queue_mapping;
return -1;
@@ -7544,7 +7544,7 @@ static u32 bpf_convert_ctx_access(enum bpf_access_type type,
case offsetof(struct __sk_buff, queue_mapping):
if (type == BPF_WRITE) {
- *insn++ = BPF_JMP_IMM(BPF_JGE, si->src_reg, NO_QUEUE_MAPPING, 1);
+ *insn++ = BPF_JMP_IMM(BPF_JGE, si->src_reg, NO_QUEUE, 1);
*insn++ = BPF_STX_MEM(BPF_H, si->dst_reg, si->src_reg,
bpf_target_off(struct sk_buff,
queue_mapping,
@@ -7981,7 +7981,7 @@ u32 bpf_sock_convert_ctx_access(enum bpf_access_type type,
sizeof_field(struct sock,
sk_rx_queue_mapping),
target_size));
- *insn++ = BPF_JMP_IMM(BPF_JNE, si->dst_reg, NO_QUEUE_MAPPING,
+ *insn++ = BPF_JMP_IMM(BPF_JNE, si->dst_reg, NO_QUEUE,
1);
*insn++ = BPF_MOV64_IMM(si->dst_reg, -1);
#else