* [RFC PATCH 1/7] skbuff: define field for hash report type
[not found] <20210105122416.16492-1-yuri.benditovich@daynix.com>
@ 2021-01-05 12:24 ` Yuri Benditovich
2021-01-05 12:24 ` [RFC PATCH 2/7] vhost: support for hash report virtio-net feature Yuri Benditovich
` (5 subsequent siblings)
6 siblings, 0 replies; 16+ messages in thread
From: Yuri Benditovich @ 2021-01-05 12:24 UTC (permalink / raw)
Cc: yan, linux-kernel
Used by virtio-net receive side scaling
Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
---
include/linux/skbuff.h | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 416bf95cd5f2..36cf40ec0259 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -510,7 +510,7 @@ int skb_zerocopy_iter_stream(struct sock *sk, struct sk_buff *skb,
* the end of the header data, ie. at skb->end.
*/
struct skb_shared_info {
- __u8 __unused;
+ __u8 hash_report_type; /* virtio-net rss */
__u8 meta_len;
__u8 nr_frags;
__u8 tx_flags;
@@ -1430,6 +1430,11 @@ static inline struct skb_shared_hwtstamps *skb_hwtstamps(struct sk_buff *skb)
return &skb_shinfo(skb)->hwtstamps;
}
+static inline __u8 *skb_hash_report_type(struct sk_buff *skb)
+{
+ return &skb_shinfo(skb)->hash_report_type;
+}
+
static inline struct ubuf_info *skb_zcopy(struct sk_buff *skb)
{
bool is_zcopy = skb && skb_shinfo(skb)->tx_flags & SKBTX_DEV_ZEROCOPY;
--
2.17.1
^ permalink raw reply [flat|nested] 16+ messages in thread
* [RFC PATCH 2/7] vhost: support for hash report virtio-net feature
[not found] <20210105122416.16492-1-yuri.benditovich@daynix.com>
2021-01-05 12:24 ` [RFC PATCH 1/7] skbuff: define field for hash report type Yuri Benditovich
@ 2021-01-05 12:24 ` Yuri Benditovich
2021-01-05 12:24 ` [RFC PATCH 3/7] tun: allow use of BPF_PROG_TYPE_SCHED_CLS program type Yuri Benditovich
` (4 subsequent siblings)
6 siblings, 0 replies; 16+ messages in thread
From: Yuri Benditovich @ 2021-01-05 12:24 UTC (permalink / raw)
To: Michael S. Tsirkin, Jason Wang
Cc: yan, kvm, virtualization, netdev, linux-kernel
According to the virtio specification if VIRTIO_NET_F_HASH_REPORT
feature acked the virtio-net header is extended to hold the hash
value and hash report type.
Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
---
drivers/vhost/net.c | 37 +++++++++++++++++++++++++++++--------
1 file changed, 29 insertions(+), 8 deletions(-)
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 531a00d703cd..31a894b9a992 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -73,7 +73,8 @@ enum {
VHOST_NET_FEATURES = VHOST_FEATURES |
(1ULL << VHOST_NET_F_VIRTIO_NET_HDR) |
(1ULL << VIRTIO_NET_F_MRG_RXBUF) |
- (1ULL << VIRTIO_F_ACCESS_PLATFORM)
+ (1ULL << VIRTIO_F_ACCESS_PLATFORM) |
+ (1ULL << VIRTIO_NET_F_HASH_REPORT)
};
enum {
@@ -1108,14 +1109,16 @@ static void handle_rx(struct vhost_net *net)
.msg_controllen = 0,
.msg_flags = MSG_DONTWAIT,
};
- struct virtio_net_hdr hdr = {
- .flags = 0,
- .gso_type = VIRTIO_NET_HDR_GSO_NONE
+ struct virtio_net_hdr_v1_hash hdrv1 = {
+ {
+ .flags = 0,
+ .gso_type = VIRTIO_NET_HDR_GSO_NONE
+ }
};
size_t total_len = 0;
int err, mergeable;
s16 headcount;
- size_t vhost_hlen, sock_hlen;
+ size_t vhost_hlen, sock_hlen, extra_hlen;
size_t vhost_len, sock_len;
bool busyloop_intr = false;
struct socket *sock;
@@ -1137,9 +1140,12 @@ static void handle_rx(struct vhost_net *net)
vhost_hlen = nvq->vhost_hlen;
sock_hlen = nvq->sock_hlen;
+
vq_log = unlikely(vhost_has_feature(vq, VHOST_F_LOG_ALL)) ?
vq->log : NULL;
mergeable = vhost_has_feature(vq, VIRTIO_NET_F_MRG_RXBUF);
+ extra_hlen = vhost_has_feature(vq, VIRTIO_NET_F_HASH_REPORT) ?
+ sizeof(hdrv1) - sizeof(hdrv1.hdr) : 0;
do {
sock_len = vhost_net_rx_peek_head_len(net, sock->sk,
@@ -1201,8 +1207,8 @@ static void handle_rx(struct vhost_net *net)
}
/* Supply virtio_net_hdr if VHOST_NET_F_VIRTIO_NET_HDR */
if (unlikely(vhost_hlen)) {
- if (copy_to_iter(&hdr, sizeof(hdr),
- &fixup) != sizeof(hdr)) {
+ if (copy_to_iter(&hdrv1, sizeof(struct virtio_net_hdr),
+ &fixup) != sizeof(struct virtio_net_hdr)) {
vq_err(vq, "Unable to write vnet_hdr "
"at addr %p\n", vq->iov->iov_base);
goto out;
@@ -1211,7 +1217,7 @@ static void handle_rx(struct vhost_net *net)
/* Header came from socket; we'll need to patch
* ->num_buffers over if VIRTIO_NET_F_MRG_RXBUF
*/
- iov_iter_advance(&fixup, sizeof(hdr));
+ iov_iter_advance(&fixup, sizeof(struct virtio_net_hdr));
}
/* TODO: Should check and handle checksum. */
@@ -1223,6 +1229,18 @@ static void handle_rx(struct vhost_net *net)
vhost_discard_vq_desc(vq, headcount);
goto out;
}
+ if (unlikely(extra_hlen)) {
+ if (unlikely(vhost_hlen)) {
+ if (copy_to_iter(&hdrv1.hash_value, extra_hlen,
+ &fixup) != extra_hlen) {
+ vq_err(vq, "Unable to write extra_hdr "
+ "at addr %p\n", vq->iov->iov_base);
+ goto out;
+ }
+ } else {
+ iov_iter_advance(&fixup, extra_hlen);
+ }
+ }
nvq->done_idx += headcount;
if (nvq->done_idx > VHOST_NET_BATCH)
vhost_net_signal_used(nvq);
@@ -1624,6 +1642,9 @@ static int vhost_net_set_features(struct vhost_net *n, u64 features)
(1ULL << VIRTIO_F_VERSION_1))) ?
sizeof(struct virtio_net_hdr_mrg_rxbuf) :
sizeof(struct virtio_net_hdr);
+ if (features & (1ULL << VIRTIO_NET_F_HASH_REPORT)) {
+ hdr_len = sizeof(struct virtio_net_hdr_v1_hash);
+ }
if (features & (1 << VHOST_NET_F_VIRTIO_NET_HDR)) {
/* vhost provides vnet_hdr */
vhost_hlen = hdr_len;
--
2.17.1
^ permalink raw reply [flat|nested] 16+ messages in thread
* [RFC PATCH 3/7] tun: allow use of BPF_PROG_TYPE_SCHED_CLS program type
[not found] <20210105122416.16492-1-yuri.benditovich@daynix.com>
2021-01-05 12:24 ` [RFC PATCH 1/7] skbuff: define field for hash report type Yuri Benditovich
2021-01-05 12:24 ` [RFC PATCH 2/7] vhost: support for hash report virtio-net feature Yuri Benditovich
@ 2021-01-05 12:24 ` Yuri Benditovich
2021-01-05 19:30 ` Alexei Starovoitov
2021-01-05 12:24 ` [RFC PATCH 4/7] tun: free bpf_program by bpf_prog_put instead of bpf_prog_destroy Yuri Benditovich
` (3 subsequent siblings)
6 siblings, 1 reply; 16+ messages in thread
From: Yuri Benditovich @ 2021-01-05 12:24 UTC (permalink / raw)
To: David S. Miller, Jakub Kicinski, Alexei Starovoitov,
Daniel Borkmann, Andrii Nakryiko, Martin KaFai Lau, Song Liu,
Yonghong Song, John Fastabend, KP Singh
Cc: yan, netdev, linux-kernel, bpf
This program type can set skb hash value. It will be useful
when the tun will support hash reporting feature if virtio-net.
Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
---
drivers/net/tun.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 7959b5c2d11f..455f7afc1f36 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -2981,6 +2981,8 @@ static int tun_set_ebpf(struct tun_struct *tun, struct tun_prog __rcu **prog_p,
prog = NULL;
} else {
prog = bpf_prog_get_type(fd, BPF_PROG_TYPE_SOCKET_FILTER);
+ if (IS_ERR(prog))
+ prog = bpf_prog_get_type(fd, BPF_PROG_TYPE_SCHED_CLS);
if (IS_ERR(prog))
return PTR_ERR(prog);
}
--
2.17.1
^ permalink raw reply [flat|nested] 16+ messages in thread
* [RFC PATCH 4/7] tun: free bpf_program by bpf_prog_put instead of bpf_prog_destroy
[not found] <20210105122416.16492-1-yuri.benditovich@daynix.com>
` (2 preceding siblings ...)
2021-01-05 12:24 ` [RFC PATCH 3/7] tun: allow use of BPF_PROG_TYPE_SCHED_CLS program type Yuri Benditovich
@ 2021-01-05 12:24 ` Yuri Benditovich
2021-01-05 12:24 ` [RFC PATCH 5/7] tun: add ioctl code TUNSETHASHPOPULATION Yuri Benditovich
` (2 subsequent siblings)
6 siblings, 0 replies; 16+ messages in thread
From: Yuri Benditovich @ 2021-01-05 12:24 UTC (permalink / raw)
To: David S. Miller, Jakub Kicinski, Alexei Starovoitov,
Daniel Borkmann, Andrii Nakryiko, Martin KaFai Lau, Song Liu,
Yonghong Song, John Fastabend, KP Singh
Cc: yan, netdev, linux-kernel, bpf
The module never creates the bpf program with bpf_prog_create
so it shouldn't free it with bpf_prog_destroy.
The program is obtained by bpf_prog_get and should be freed
by bpf_prog_put. For BPF_PROG_TYPE_SOCKET_FILTER both
methods do the same but for other program types they don't.
Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
---
drivers/net/tun.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 455f7afc1f36..18c1baf1a6c1 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -2218,7 +2218,7 @@ static void tun_prog_free(struct rcu_head *rcu)
{
struct tun_prog *prog = container_of(rcu, struct tun_prog, rcu);
- bpf_prog_destroy(prog->prog);
+ bpf_prog_put(prog->prog);
kfree(prog);
}
--
2.17.1
^ permalink raw reply [flat|nested] 16+ messages in thread
* [RFC PATCH 5/7] tun: add ioctl code TUNSETHASHPOPULATION
[not found] <20210105122416.16492-1-yuri.benditovich@daynix.com>
` (3 preceding siblings ...)
2021-01-05 12:24 ` [RFC PATCH 4/7] tun: free bpf_program by bpf_prog_put instead of bpf_prog_destroy Yuri Benditovich
@ 2021-01-05 12:24 ` Yuri Benditovich
2021-01-05 12:24 ` [RFC PATCH 6/7] tun: populate hash in virtio-net header when needed Yuri Benditovich
2021-01-05 12:24 ` [RFC PATCH 7/7] tun: report new tun feature IFF_HASH Yuri Benditovich
6 siblings, 0 replies; 16+ messages in thread
From: Yuri Benditovich @ 2021-01-05 12:24 UTC (permalink / raw)
To: David S. Miller, Jakub Kicinski, Alexei Starovoitov,
Daniel Borkmann, Andrii Nakryiko, Martin KaFai Lau, Song Liu,
Yonghong Song, John Fastabend, KP Singh
Cc: yan, netdev, linux-kernel, bpf
User mode program calls this ioctl before loading of
BPF program to inform the tun that the BPF program has
extended functionality, i.e. sets hash value and returns
the virtqueue number in the lower 16 bits and the type
of the hash report in the upper 16 bits.
Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
---
drivers/net/tun.c | 12 +++++++++++-
include/uapi/linux/if_tun.h | 1 +
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 18c1baf1a6c1..45f4f04a4a3e 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -197,6 +197,7 @@ struct tun_struct {
struct sock_fprog fprog;
/* protected by rtnl lock */
bool filter_attached;
+ bool bpf_populates_hash;
u32 msg_enable;
spinlock_t lock;
struct hlist_head flows[TUN_NUM_FLOW_ENTRIES];
@@ -2765,6 +2766,7 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
tun->align = NET_SKB_PAD;
tun->filter_attached = false;
+ tun->bpf_populates_hash = false;
tun->sndbuf = tfile->socket.sk->sk_sndbuf;
tun->rx_batched = 0;
RCU_INIT_POINTER(tun->steering_prog, NULL);
@@ -2997,7 +2999,7 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd,
struct net *net = sock_net(&tfile->sk);
struct tun_struct *tun;
void __user* argp = (void __user*)arg;
- unsigned int ifindex, carrier;
+ unsigned int ifindex, carrier, populate_hash;
struct ifreq ifr;
kuid_t owner;
kgid_t group;
@@ -3298,6 +3300,14 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd,
ret = open_related_ns(&net->ns, get_net_ns);
break;
+ case TUNSETHASHPOPULATION:
+ ret = -EFAULT;
+ if (copy_from_user(&populate_hash, argp, sizeof(populate_hash)))
+ goto unlock;
+ tun->bpf_populates_hash = !!populate_hash;
+ ret = 0;
+ break;
+
default:
ret = -EINVAL;
break;
diff --git a/include/uapi/linux/if_tun.h b/include/uapi/linux/if_tun.h
index 454ae31b93c7..0fd43533da26 100644
--- a/include/uapi/linux/if_tun.h
+++ b/include/uapi/linux/if_tun.h
@@ -61,6 +61,7 @@
#define TUNSETFILTEREBPF _IOR('T', 225, int)
#define TUNSETCARRIER _IOW('T', 226, int)
#define TUNGETDEVNETNS _IO('T', 227)
+#define TUNSETHASHPOPULATION _IOR('T', 228, int)
/* TUNSETIFF ifr flags */
#define IFF_TUN 0x0001
--
2.17.1
^ permalink raw reply [flat|nested] 16+ messages in thread
* [RFC PATCH 6/7] tun: populate hash in virtio-net header when needed
[not found] <20210105122416.16492-1-yuri.benditovich@daynix.com>
` (4 preceding siblings ...)
2021-01-05 12:24 ` [RFC PATCH 5/7] tun: add ioctl code TUNSETHASHPOPULATION Yuri Benditovich
@ 2021-01-05 12:24 ` Yuri Benditovich
2021-01-05 12:24 ` [RFC PATCH 7/7] tun: report new tun feature IFF_HASH Yuri Benditovich
6 siblings, 0 replies; 16+ messages in thread
From: Yuri Benditovich @ 2021-01-05 12:24 UTC (permalink / raw)
To: David S. Miller, Jakub Kicinski, Alexei Starovoitov,
Daniel Borkmann, Andrii Nakryiko, Martin KaFai Lau, Song Liu,
Yonghong Song, John Fastabend, KP Singh
Cc: yan, netdev, linux-kernel, bpf
If the BPF program populated the hash in the skb the tun
propagates the hash value and hash report type to the
respective fields of virtio-net header.
Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
---
drivers/net/tun.c | 25 ++++++++++++++++++++++---
1 file changed, 22 insertions(+), 3 deletions(-)
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 45f4f04a4a3e..214feb0b16fb 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -556,15 +556,20 @@ static u16 tun_ebpf_select_queue(struct tun_struct *tun, struct sk_buff *skb)
{
struct tun_prog *prog;
u32 numqueues;
- u16 ret = 0;
+ u32 ret = 0;
numqueues = READ_ONCE(tun->numqueues);
if (!numqueues)
return 0;
prog = rcu_dereference(tun->steering_prog);
- if (prog)
+ if (prog) {
ret = bpf_prog_run_clear_cb(prog->prog, skb);
+ if (tun->bpf_populates_hash) {
+ *skb_hash_report_type(skb) = (__u8)(ret >> 16);
+ ret &= 0xffff;
+ }
+ }
return ret % numqueues;
}
@@ -2062,6 +2067,7 @@ static ssize_t tun_put_user(struct tun_struct *tun,
if (vnet_hdr_sz) {
struct virtio_net_hdr gso;
+ __u16 extra_copy = 0;
if (iov_iter_count(iter) < vnet_hdr_sz)
return -EINVAL;
@@ -2085,7 +2091,20 @@ static ssize_t tun_put_user(struct tun_struct *tun,
if (copy_to_iter(&gso, sizeof(gso), iter) != sizeof(gso))
return -EFAULT;
- iov_iter_advance(iter, vnet_hdr_sz - sizeof(gso));
+ if (tun->bpf_populates_hash &&
+ vnet_hdr_sz >= sizeof(struct virtio_net_hdr_v1_hash)) {
+ struct virtio_net_hdr_v1_hash hdr;
+
+ hdr.hdr.num_buffers = 0;
+ hdr.hash_value = cpu_to_le32(skb_get_hash(skb));
+ hdr.hash_report = cpu_to_le16(*skb_hash_report_type(skb));
+ hdr.padding = 0;
+ extra_copy = sizeof(hdr) - sizeof(gso);
+ if (copy_to_iter(&hdr.hdr.num_buffers, extra_copy, iter) != extra_copy)
+ return -EFAULT;
+ }
+
+ iov_iter_advance(iter, vnet_hdr_sz - sizeof(gso) - extra_copy);
}
if (vlan_hlen) {
--
2.17.1
^ permalink raw reply [flat|nested] 16+ messages in thread
* [RFC PATCH 7/7] tun: report new tun feature IFF_HASH
[not found] <20210105122416.16492-1-yuri.benditovich@daynix.com>
` (5 preceding siblings ...)
2021-01-05 12:24 ` [RFC PATCH 6/7] tun: populate hash in virtio-net header when needed Yuri Benditovich
@ 2021-01-05 12:24 ` Yuri Benditovich
6 siblings, 0 replies; 16+ messages in thread
From: Yuri Benditovich @ 2021-01-05 12:24 UTC (permalink / raw)
To: David S. Miller, Jakub Kicinski; +Cc: yan, netdev, linux-kernel
IFF_HASH feature indicates that the tun supports
TUNSETHASHPOPULATION ioctl and can propagate the hash
data to the virtio-net packet.
Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
---
drivers/net/tun.c | 2 +-
include/uapi/linux/if_tun.h | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 214feb0b16fb..b46aa8941a9d 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -88,7 +88,7 @@ static void tun_default_link_ksettings(struct net_device *dev,
#define TUN_VNET_LE 0x80000000
#define TUN_VNET_BE 0x40000000
-#define TUN_FEATURES (IFF_NO_PI | IFF_ONE_QUEUE | IFF_VNET_HDR | \
+#define TUN_FEATURES (IFF_NO_PI | IFF_ONE_QUEUE | IFF_VNET_HDR | IFF_HASH |\
IFF_MULTI_QUEUE | IFF_NAPI | IFF_NAPI_FRAGS)
#define GOODCOPY_LEN 128
diff --git a/include/uapi/linux/if_tun.h b/include/uapi/linux/if_tun.h
index 0fd43533da26..116b84ede3a0 100644
--- a/include/uapi/linux/if_tun.h
+++ b/include/uapi/linux/if_tun.h
@@ -73,6 +73,7 @@
#define IFF_ONE_QUEUE 0x2000
#define IFF_VNET_HDR 0x4000
#define IFF_TUN_EXCL 0x8000
+#define IFF_HASH 0x0080
#define IFF_MULTI_QUEUE 0x0100
#define IFF_ATTACH_QUEUE 0x0200
#define IFF_DETACH_QUEUE 0x0400
--
2.17.1
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [RFC PATCH 3/7] tun: allow use of BPF_PROG_TYPE_SCHED_CLS program type
2021-01-05 12:24 ` [RFC PATCH 3/7] tun: allow use of BPF_PROG_TYPE_SCHED_CLS program type Yuri Benditovich
@ 2021-01-05 19:30 ` Alexei Starovoitov
0 siblings, 0 replies; 16+ messages in thread
From: Alexei Starovoitov @ 2021-01-05 19:30 UTC (permalink / raw)
To: Yuri Benditovich
Cc: David S. Miller, Jakub Kicinski, Alexei Starovoitov,
Daniel Borkmann, Andrii Nakryiko, Martin KaFai Lau, Song Liu,
Yonghong Song, John Fastabend, KP Singh, yan, netdev,
linux-kernel, bpf
On Tue, Jan 05, 2021 at 02:24:12PM +0200, Yuri Benditovich wrote:
> This program type can set skb hash value. It will be useful
> when the tun will support hash reporting feature if virtio-net.
>
> Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
> ---
> drivers/net/tun.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/net/tun.c b/drivers/net/tun.c
> index 7959b5c2d11f..455f7afc1f36 100644
> --- a/drivers/net/tun.c
> +++ b/drivers/net/tun.c
> @@ -2981,6 +2981,8 @@ static int tun_set_ebpf(struct tun_struct *tun, struct tun_prog __rcu **prog_p,
> prog = NULL;
> } else {
> prog = bpf_prog_get_type(fd, BPF_PROG_TYPE_SOCKET_FILTER);
> + if (IS_ERR(prog))
> + prog = bpf_prog_get_type(fd, BPF_PROG_TYPE_SCHED_CLS);
Patches 1 and 2 are missing for me, so I couldn't review properly,
but this diff looks odd.
It allows sched_cls prog type to attach to tun.
That means everything that sched_cls progs can do will be done from tun hook?
sched_cls assumes l2 and can modify the packet.
I think crashes are inevitable.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [RFC PATCH 3/7] tun: allow use of BPF_PROG_TYPE_SCHED_CLS program type
2021-01-20 18:44 ` Alexei Starovoitov
@ 2021-01-24 11:52 ` Yuri Benditovich
0 siblings, 0 replies; 16+ messages in thread
From: Yuri Benditovich @ 2021-01-24 11:52 UTC (permalink / raw)
To: Alexei Starovoitov
Cc: David S. Miller, Jakub Kicinski, Michael S . Tsirkin, Jason Wang,
Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
KP Singh, Randy Dunlap, Willem de Bruijn, Gustavo A . R . Silva,
Herbert Xu, Steffen Klassert, Pablo Neira Ayuso, decui, cai,
Jakub Sitnicki, Marco Elver, Paolo Abeni, Network Development,
LKML, kvm, virtualization, bpf, Yan Vugenfirer
On Wed, Jan 20, 2021 at 8:45 PM Alexei Starovoitov
<alexei.starovoitov@gmail.com> wrote:
>
> On Tue, Jan 12, 2021 at 12:55 PM Yuri Benditovich
> <yuri.benditovich@daynix.com> wrote:
> >
> > On Tue, Jan 12, 2021 at 10:40 PM Yuri Benditovich
> > <yuri.benditovich@daynix.com> wrote:
> > >
> > > On Tue, Jan 12, 2021 at 9:42 PM Yuri Benditovich
> > > <yuri.benditovich@daynix.com> wrote:
> > > >
> > > > This program type can set skb hash value. It will be useful
> > > > when the tun will support hash reporting feature if virtio-net.
> > > >
> > > > Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
> > > > ---
> > > > drivers/net/tun.c | 2 ++
> > > > 1 file changed, 2 insertions(+)
> > > >
> > > > diff --git a/drivers/net/tun.c b/drivers/net/tun.c
> > > > index 7959b5c2d11f..455f7afc1f36 100644
> > > > --- a/drivers/net/tun.c
> > > > +++ b/drivers/net/tun.c
> > > > @@ -2981,6 +2981,8 @@ static int tun_set_ebpf(struct tun_struct *tun, struct tun_prog __rcu **prog_p,
> > > > prog = NULL;
> > > > } else {
> > > > prog = bpf_prog_get_type(fd, BPF_PROG_TYPE_SOCKET_FILTER);
> > > > + if (IS_ERR(prog))
> > > > + prog = bpf_prog_get_type(fd, BPF_PROG_TYPE_SCHED_CLS);
> > > > if (IS_ERR(prog))
> > > > return PTR_ERR(prog);
> > > > }
> > >
> > > Comment from Alexei Starovoitov:
> > > Patches 1 and 2 are missing for me, so I couldn't review properly,
> > > but this diff looks odd.
> > > It allows sched_cls prog type to attach to tun.
> > > That means everything that sched_cls progs can do will be done from tun hook?
> >
> > We do not have an intention to modify the packet in this steering eBPF.
>
> The intent is irrelevant. Using SCHED_CLS here will let users modify the packet
> and some users will do so. Hence the tun code has to support it.
>
> > There is just one function that unavailable for BPF_PROG_TYPE_SOCKET_FILTER
> > that the eBPF needs to make possible to deliver the hash to the guest
> > VM - it is 'bpf_set_hash'
> >
> > Does it mean that we need to define a new eBPF type for socket filter
> > operations + set_hash?
> >
> > Our problem is that the eBPF calculates 32-bit hash, 16-bit queue
> > index and 8-bit of hash type.
> > But it is able to return only 32-bit integer, so in this set of
> > patches the eBPF returns
> > queue index and hash type and saves the hash in skb->hash using bpf_set_hash().
>
> bpf prog can only return a 32-bit integer. That's true.
> But the prog can use helpers to set any number of bits and variables.
> bpf_set_hash_v2() with hash, queue and index arguments could fit this purpose,
> but if you allow it for SCHED_CLS type,
Do I understand correctly that this means:
1. Creation of new helper like
https://lists.linuxfoundation.org/pipermail/bridge/2020-July/013036.html
2. Validation on tun side that the BPF uses only limited subset of
helpers available for SCHED_CLS
> tc side of the code should be ready to deal with that too and this extended
> helper should be meaningful for both tc and tun.
>
> In general if the purpose of the prog is to compute three values they better be
> grouped together. Returned two of them via ORed 32-bit integer and
> returning 32-bit via bpf_set_hash is an awkward api.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [RFC PATCH 3/7] tun: allow use of BPF_PROG_TYPE_SCHED_CLS program type
2021-01-12 20:55 ` Yuri Benditovich
2021-01-18 9:16 ` Yuri Benditovich
@ 2021-01-20 18:44 ` Alexei Starovoitov
2021-01-24 11:52 ` Yuri Benditovich
1 sibling, 1 reply; 16+ messages in thread
From: Alexei Starovoitov @ 2021-01-20 18:44 UTC (permalink / raw)
To: Yuri Benditovich
Cc: David S. Miller, Jakub Kicinski, Michael S . Tsirkin, Jason Wang,
Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
KP Singh, Randy Dunlap, Willem de Bruijn, gustavoars, Herbert Xu,
Steffen Klassert, Pablo Neira Ayuso, decui, cai, Jakub Sitnicki,
Marco Elver, Paolo Abeni, Network Development, LKML, kvm,
virtualization, bpf, Yan Vugenfirer
On Tue, Jan 12, 2021 at 12:55 PM Yuri Benditovich
<yuri.benditovich@daynix.com> wrote:
>
> On Tue, Jan 12, 2021 at 10:40 PM Yuri Benditovich
> <yuri.benditovich@daynix.com> wrote:
> >
> > On Tue, Jan 12, 2021 at 9:42 PM Yuri Benditovich
> > <yuri.benditovich@daynix.com> wrote:
> > >
> > > This program type can set skb hash value. It will be useful
> > > when the tun will support hash reporting feature if virtio-net.
> > >
> > > Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
> > > ---
> > > drivers/net/tun.c | 2 ++
> > > 1 file changed, 2 insertions(+)
> > >
> > > diff --git a/drivers/net/tun.c b/drivers/net/tun.c
> > > index 7959b5c2d11f..455f7afc1f36 100644
> > > --- a/drivers/net/tun.c
> > > +++ b/drivers/net/tun.c
> > > @@ -2981,6 +2981,8 @@ static int tun_set_ebpf(struct tun_struct *tun, struct tun_prog __rcu **prog_p,
> > > prog = NULL;
> > > } else {
> > > prog = bpf_prog_get_type(fd, BPF_PROG_TYPE_SOCKET_FILTER);
> > > + if (IS_ERR(prog))
> > > + prog = bpf_prog_get_type(fd, BPF_PROG_TYPE_SCHED_CLS);
> > > if (IS_ERR(prog))
> > > return PTR_ERR(prog);
> > > }
> >
> > Comment from Alexei Starovoitov:
> > Patches 1 and 2 are missing for me, so I couldn't review properly,
> > but this diff looks odd.
> > It allows sched_cls prog type to attach to tun.
> > That means everything that sched_cls progs can do will be done from tun hook?
>
> We do not have an intention to modify the packet in this steering eBPF.
The intent is irrelevant. Using SCHED_CLS here will let users modify the packet
and some users will do so. Hence the tun code has to support it.
> There is just one function that unavailable for BPF_PROG_TYPE_SOCKET_FILTER
> that the eBPF needs to make possible to deliver the hash to the guest
> VM - it is 'bpf_set_hash'
>
> Does it mean that we need to define a new eBPF type for socket filter
> operations + set_hash?
>
> Our problem is that the eBPF calculates 32-bit hash, 16-bit queue
> index and 8-bit of hash type.
> But it is able to return only 32-bit integer, so in this set of
> patches the eBPF returns
> queue index and hash type and saves the hash in skb->hash using bpf_set_hash().
bpf prog can only return a 32-bit integer. That's true.
But the prog can use helpers to set any number of bits and variables.
bpf_set_hash_v2() with hash, queue and index arguments could fit this purpose,
but if you allow it for SCHED_CLS type,
tc side of the code should be ready to deal with that too and this extended
helper should be meaningful for both tc and tun.
In general if the purpose of the prog is to compute three values they better be
grouped together. Returned two of them via ORed 32-bit integer and
returning 32-bit via bpf_set_hash is an awkward api.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [RFC PATCH 3/7] tun: allow use of BPF_PROG_TYPE_SCHED_CLS program type
2021-01-12 20:55 ` Yuri Benditovich
@ 2021-01-18 9:16 ` Yuri Benditovich
2021-01-20 18:44 ` Alexei Starovoitov
1 sibling, 0 replies; 16+ messages in thread
From: Yuri Benditovich @ 2021-01-18 9:16 UTC (permalink / raw)
To: Alexei Starovoitov, Network Development, LKML, kvm, virtualization, bpf
Cc: Yan Vugenfirer, Jakub Kicinski, David S. Miller, Jason Wang,
Michael S . Tsirkin, Andrii Nakryiko, Daniel Borkmann, Song Liu,
Martin KaFai Lau, John Fastabend, Yonghong Song,
Willem de Bruijn, KP Singh, Gustavo A . R . Silva, Randy Dunlap,
Marco Elver, decui, cai, Pablo Neira Ayuso, Steffen Klassert,
Herbert Xu, Jakub Sitnicki, Paolo Abeni
Hello Alexei,
Can you please answer the questions in the last email of this thread?
Your comment will be extremely helpful.
Thanks
On Tue, Jan 12, 2021 at 10:55 PM Yuri Benditovich
<yuri.benditovich@daynix.com> wrote:
>
> On Tue, Jan 12, 2021 at 10:40 PM Yuri Benditovich
> <yuri.benditovich@daynix.com> wrote:
> >
> > On Tue, Jan 12, 2021 at 9:42 PM Yuri Benditovich
> > <yuri.benditovich@daynix.com> wrote:
> > >
> > > This program type can set skb hash value. It will be useful
> > > when the tun will support hash reporting feature if virtio-net.
> > >
> > > Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
> > > ---
> > > drivers/net/tun.c | 2 ++
> > > 1 file changed, 2 insertions(+)
> > >
> > > diff --git a/drivers/net/tun.c b/drivers/net/tun.c
> > > index 7959b5c2d11f..455f7afc1f36 100644
> > > --- a/drivers/net/tun.c
> > > +++ b/drivers/net/tun.c
> > > @@ -2981,6 +2981,8 @@ static int tun_set_ebpf(struct tun_struct *tun, struct tun_prog __rcu **prog_p,
> > > prog = NULL;
> > > } else {
> > > prog = bpf_prog_get_type(fd, BPF_PROG_TYPE_SOCKET_FILTER);
> > > + if (IS_ERR(prog))
> > > + prog = bpf_prog_get_type(fd, BPF_PROG_TYPE_SCHED_CLS);
> > > if (IS_ERR(prog))
> > > return PTR_ERR(prog);
> > > }
> >
> > Comment from Alexei Starovoitov:
> > Patches 1 and 2 are missing for me, so I couldn't review properly,
> > but this diff looks odd.
> > It allows sched_cls prog type to attach to tun.
> > That means everything that sched_cls progs can do will be done from tun hook?
>
> We do not have an intention to modify the packet in this steering eBPF.
> There is just one function that unavailable for BPF_PROG_TYPE_SOCKET_FILTER
> that the eBPF needs to make possible to deliver the hash to the guest
> VM - it is 'bpf_set_hash'
>
> Does it mean that we need to define a new eBPF type for socket filter
> operations + set_hash?
>
> Our problem is that the eBPF calculates 32-bit hash, 16-bit queue
> index and 8-bit of hash type.
> But it is able to return only 32-bit integer, so in this set of
> patches the eBPF returns
> queue index and hash type and saves the hash in skb->hash using bpf_set_hash().
>
> If this is unacceptable, can you please recommend a better solution?
>
> > sched_cls assumes l2 and can modify the packet.
>
> The steering eBPF in TUN module also assumes l2.
>
> > I think crashes are inevitable.
> >
> > > --
> > > 2.17.1
> > >
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [RFC PATCH 3/7] tun: allow use of BPF_PROG_TYPE_SCHED_CLS program type
2021-01-12 20:40 ` Yuri Benditovich
@ 2021-01-12 20:55 ` Yuri Benditovich
2021-01-18 9:16 ` Yuri Benditovich
2021-01-20 18:44 ` Alexei Starovoitov
0 siblings, 2 replies; 16+ messages in thread
From: Yuri Benditovich @ 2021-01-12 20:55 UTC (permalink / raw)
To: David S. Miller, Jakub Kicinski, Michael S . Tsirkin, Jason Wang,
Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
KP Singh, rdunlap, willemb, gustavoars, herbert,
steffen.klassert, pablo, decui, cai, jakub, elver, pabeni,
netdev, linux-kernel, kvm, virtualization, bpf
Cc: Yan Vugenfirer
On Tue, Jan 12, 2021 at 10:40 PM Yuri Benditovich
<yuri.benditovich@daynix.com> wrote:
>
> On Tue, Jan 12, 2021 at 9:42 PM Yuri Benditovich
> <yuri.benditovich@daynix.com> wrote:
> >
> > This program type can set skb hash value. It will be useful
> > when the tun will support hash reporting feature if virtio-net.
> >
> > Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
> > ---
> > drivers/net/tun.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/net/tun.c b/drivers/net/tun.c
> > index 7959b5c2d11f..455f7afc1f36 100644
> > --- a/drivers/net/tun.c
> > +++ b/drivers/net/tun.c
> > @@ -2981,6 +2981,8 @@ static int tun_set_ebpf(struct tun_struct *tun, struct tun_prog __rcu **prog_p,
> > prog = NULL;
> > } else {
> > prog = bpf_prog_get_type(fd, BPF_PROG_TYPE_SOCKET_FILTER);
> > + if (IS_ERR(prog))
> > + prog = bpf_prog_get_type(fd, BPF_PROG_TYPE_SCHED_CLS);
> > if (IS_ERR(prog))
> > return PTR_ERR(prog);
> > }
>
> Comment from Alexei Starovoitov:
> Patches 1 and 2 are missing for me, so I couldn't review properly,
> but this diff looks odd.
> It allows sched_cls prog type to attach to tun.
> That means everything that sched_cls progs can do will be done from tun hook?
We do not have an intention to modify the packet in this steering eBPF.
There is just one function that unavailable for BPF_PROG_TYPE_SOCKET_FILTER
that the eBPF needs to make possible to deliver the hash to the guest
VM - it is 'bpf_set_hash'
Does it mean that we need to define a new eBPF type for socket filter
operations + set_hash?
Our problem is that the eBPF calculates 32-bit hash, 16-bit queue
index and 8-bit of hash type.
But it is able to return only 32-bit integer, so in this set of
patches the eBPF returns
queue index and hash type and saves the hash in skb->hash using bpf_set_hash().
If this is unacceptable, can you please recommend a better solution?
> sched_cls assumes l2 and can modify the packet.
The steering eBPF in TUN module also assumes l2.
> I think crashes are inevitable.
>
> > --
> > 2.17.1
> >
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [RFC PATCH 3/7] tun: allow use of BPF_PROG_TYPE_SCHED_CLS program type
2021-01-12 19:41 ` [RFC PATCH 3/7] tun: allow use of BPF_PROG_TYPE_SCHED_CLS program type Yuri Benditovich
2021-01-12 19:46 ` Alexei Starovoitov
@ 2021-01-12 20:40 ` Yuri Benditovich
2021-01-12 20:55 ` Yuri Benditovich
1 sibling, 1 reply; 16+ messages in thread
From: Yuri Benditovich @ 2021-01-12 20:40 UTC (permalink / raw)
To: David S. Miller, Jakub Kicinski, Michael S . Tsirkin, Jason Wang,
Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
KP Singh, rdunlap, willemb, gustavoars, herbert,
steffen.klassert, pablo, decui, cai, jakub, elver, pabeni,
netdev, linux-kernel, kvm, virtualization, bpf
Cc: Yan Vugenfirer
On Tue, Jan 12, 2021 at 9:42 PM Yuri Benditovich
<yuri.benditovich@daynix.com> wrote:
>
> This program type can set skb hash value. It will be useful
> when the tun will support hash reporting feature if virtio-net.
>
> Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
> ---
> drivers/net/tun.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/net/tun.c b/drivers/net/tun.c
> index 7959b5c2d11f..455f7afc1f36 100644
> --- a/drivers/net/tun.c
> +++ b/drivers/net/tun.c
> @@ -2981,6 +2981,8 @@ static int tun_set_ebpf(struct tun_struct *tun, struct tun_prog __rcu **prog_p,
> prog = NULL;
> } else {
> prog = bpf_prog_get_type(fd, BPF_PROG_TYPE_SOCKET_FILTER);
> + if (IS_ERR(prog))
> + prog = bpf_prog_get_type(fd, BPF_PROG_TYPE_SCHED_CLS);
> if (IS_ERR(prog))
> return PTR_ERR(prog);
> }
Comment from Alexei Starovoitov:
Patches 1 and 2 are missing for me, so I couldn't review properly,
but this diff looks odd.
It allows sched_cls prog type to attach to tun.
That means everything that sched_cls progs can do will be done from tun hook?
sched_cls assumes l2 and can modify the packet.
I think crashes are inevitable.
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [RFC PATCH 3/7] tun: allow use of BPF_PROG_TYPE_SCHED_CLS program type
2021-01-12 19:46 ` Alexei Starovoitov
@ 2021-01-12 20:33 ` Yuri Benditovich
0 siblings, 0 replies; 16+ messages in thread
From: Yuri Benditovich @ 2021-01-12 20:33 UTC (permalink / raw)
To: Alexei Starovoitov
Cc: David S. Miller, Jakub Kicinski, Michael S. Tsirkin, Jason Wang,
Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
KP Singh, Randy Dunlap, Willem de Bruijn, gustavoars, Herbert Xu,
Steffen Klassert, Pablo Neira Ayuso, decui, cai, Jakub Sitnicki,
Marco Elver, Paolo Abeni, Network Development, LKML, kvm,
virtualization, bpf, Yan Vugenfirer
On Tue, Jan 12, 2021 at 9:46 PM Alexei Starovoitov
<alexei.starovoitov@gmail.com> wrote:
>
> On Tue, Jan 12, 2021 at 11:42 AM Yuri Benditovich
> <yuri.benditovich@daynix.com> wrote:
> >
> > This program type can set skb hash value. It will be useful
> > when the tun will support hash reporting feature if virtio-net.
> >
> > Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
> > ---
> > drivers/net/tun.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/net/tun.c b/drivers/net/tun.c
> > index 7959b5c2d11f..455f7afc1f36 100644
> > --- a/drivers/net/tun.c
> > +++ b/drivers/net/tun.c
> > @@ -2981,6 +2981,8 @@ static int tun_set_ebpf(struct tun_struct *tun, struct tun_prog __rcu **prog_p,
> > prog = NULL;
> > } else {
> > prog = bpf_prog_get_type(fd, BPF_PROG_TYPE_SOCKET_FILTER);
> > + if (IS_ERR(prog))
> > + prog = bpf_prog_get_type(fd, BPF_PROG_TYPE_SCHED_CLS);
>
> You've ignored the feedback and just resend? what for?
No, I do not. Some patches did not reach relevant people at all, so I
just resent _all_ the patches to all the people.
I will copy your earlier comment to this patch and will address it in
the discussion.
Sorry for misunderstanding and some redundant noise.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [RFC PATCH 3/7] tun: allow use of BPF_PROG_TYPE_SCHED_CLS program type
2021-01-12 19:41 ` [RFC PATCH 3/7] tun: allow use of BPF_PROG_TYPE_SCHED_CLS program type Yuri Benditovich
@ 2021-01-12 19:46 ` Alexei Starovoitov
2021-01-12 20:33 ` Yuri Benditovich
2021-01-12 20:40 ` Yuri Benditovich
1 sibling, 1 reply; 16+ messages in thread
From: Alexei Starovoitov @ 2021-01-12 19:46 UTC (permalink / raw)
To: Yuri Benditovich
Cc: David S. Miller, Jakub Kicinski, Michael S. Tsirkin, Jason Wang,
Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
KP Singh, Randy Dunlap, Willem de Bruijn, gustavoars, Herbert Xu,
Steffen Klassert, nogikh, Pablo Neira Ayuso, decui, cai,
Jakub Sitnicki, Marco Elver, Paolo Abeni, Network Development,
LKML, kvm, virtualization, bpf, Yan Vugenfirer
On Tue, Jan 12, 2021 at 11:42 AM Yuri Benditovich
<yuri.benditovich@daynix.com> wrote:
>
> This program type can set skb hash value. It will be useful
> when the tun will support hash reporting feature if virtio-net.
>
> Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
> ---
> drivers/net/tun.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/net/tun.c b/drivers/net/tun.c
> index 7959b5c2d11f..455f7afc1f36 100644
> --- a/drivers/net/tun.c
> +++ b/drivers/net/tun.c
> @@ -2981,6 +2981,8 @@ static int tun_set_ebpf(struct tun_struct *tun, struct tun_prog __rcu **prog_p,
> prog = NULL;
> } else {
> prog = bpf_prog_get_type(fd, BPF_PROG_TYPE_SOCKET_FILTER);
> + if (IS_ERR(prog))
> + prog = bpf_prog_get_type(fd, BPF_PROG_TYPE_SCHED_CLS);
You've ignored the feedback and just resend? what for?
^ permalink raw reply [flat|nested] 16+ messages in thread
* [RFC PATCH 3/7] tun: allow use of BPF_PROG_TYPE_SCHED_CLS program type
2021-01-12 19:41 [RFC PATCH 0/7] Support for virtio-net hash reporting Yuri Benditovich
@ 2021-01-12 19:41 ` Yuri Benditovich
2021-01-12 19:46 ` Alexei Starovoitov
2021-01-12 20:40 ` Yuri Benditovich
0 siblings, 2 replies; 16+ messages in thread
From: Yuri Benditovich @ 2021-01-12 19:41 UTC (permalink / raw)
To: davem, kuba, mst, jasowang, ast, daniel, andrii, kafai,
songliubraving, yhs, john.fastabend, kpsingh, rdunlap, willemb,
gustavoars, herbert, steffen.klassert, nogikh, pablo, decui, cai,
jakub, elver, pabeni, netdev, linux-kernel, kvm, virtualization,
bpf
Cc: yan
This program type can set skb hash value. It will be useful
when the tun will support hash reporting feature if virtio-net.
Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
---
drivers/net/tun.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 7959b5c2d11f..455f7afc1f36 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -2981,6 +2981,8 @@ static int tun_set_ebpf(struct tun_struct *tun, struct tun_prog __rcu **prog_p,
prog = NULL;
} else {
prog = bpf_prog_get_type(fd, BPF_PROG_TYPE_SOCKET_FILTER);
+ if (IS_ERR(prog))
+ prog = bpf_prog_get_type(fd, BPF_PROG_TYPE_SCHED_CLS);
if (IS_ERR(prog))
return PTR_ERR(prog);
}
--
2.17.1
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2021-01-24 11:54 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20210105122416.16492-1-yuri.benditovich@daynix.com>
2021-01-05 12:24 ` [RFC PATCH 1/7] skbuff: define field for hash report type Yuri Benditovich
2021-01-05 12:24 ` [RFC PATCH 2/7] vhost: support for hash report virtio-net feature Yuri Benditovich
2021-01-05 12:24 ` [RFC PATCH 3/7] tun: allow use of BPF_PROG_TYPE_SCHED_CLS program type Yuri Benditovich
2021-01-05 19:30 ` Alexei Starovoitov
2021-01-05 12:24 ` [RFC PATCH 4/7] tun: free bpf_program by bpf_prog_put instead of bpf_prog_destroy Yuri Benditovich
2021-01-05 12:24 ` [RFC PATCH 5/7] tun: add ioctl code TUNSETHASHPOPULATION Yuri Benditovich
2021-01-05 12:24 ` [RFC PATCH 6/7] tun: populate hash in virtio-net header when needed Yuri Benditovich
2021-01-05 12:24 ` [RFC PATCH 7/7] tun: report new tun feature IFF_HASH Yuri Benditovich
2021-01-12 19:41 [RFC PATCH 0/7] Support for virtio-net hash reporting Yuri Benditovich
2021-01-12 19:41 ` [RFC PATCH 3/7] tun: allow use of BPF_PROG_TYPE_SCHED_CLS program type Yuri Benditovich
2021-01-12 19:46 ` Alexei Starovoitov
2021-01-12 20:33 ` Yuri Benditovich
2021-01-12 20:40 ` Yuri Benditovich
2021-01-12 20:55 ` Yuri Benditovich
2021-01-18 9:16 ` Yuri Benditovich
2021-01-20 18:44 ` Alexei Starovoitov
2021-01-24 11:52 ` Yuri Benditovich
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®