[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201218201633.2735367-9-jonathan.lemon@gmail.com>
Date: Fri, 18 Dec 2020 12:16:32 -0800
From: Jonathan Lemon <jonathan.lemon@...il.com>
To: <netdev@...r.kernel.org>, <edumazet@...gle.com>,
<willemdebruijn.kernel@...il.com>
CC: <kernel-team@...com>
Subject: [PATCH 8/9 v1 RFC] tap/tun: use skb_zcopy_set() instead of open coded assignment
From: Jonathan Lemon <bsd@...com>
Replace direct assignments with skb_zcopy_set() for clarity.
Signed-off-by: Jonathan Lemon <jonathan.lemon@...il.com>
---
drivers/net/tap.c | 3 +--
drivers/net/tun.c | 3 +--
drivers/vhost/net.c | 1 +
3 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/net/tap.c b/drivers/net/tap.c
index c2bcbf9218dc..7e7a4c7ca891 100644
--- a/drivers/net/tap.c
+++ b/drivers/net/tap.c
@@ -722,8 +722,7 @@ static ssize_t tap_get_user(struct tap_queue *q, void *msg_control,
tap = rcu_dereference(q->tap);
/* copy skb_ubuf_info for callback when skb has no error */
if (zerocopy) {
- skb_shinfo(skb)->destructor_arg = msg_control;
- skb_shinfo(skb)->zc_flags |= SKBZC_FRAGMENTS;
+ skb_zcopy_set(skb, msg_control, NULL);
} else if (msg_control) {
struct ubuf_info *uarg = msg_control;
uarg->callback(NULL, uarg, false);
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index bad4b0229584..0844da91e2ed 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -1814,8 +1814,7 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
/* copy skb_ubuf_info for callback when skb has no error */
if (zerocopy) {
- skb_shinfo(skb)->destructor_arg = msg_control;
- skb_shinfo(skb)->zc_flags |= SKBZC_FRAGMENTS;
+ skb_zcopy_set(skb, msg_control, NULL);
} else if (msg_control) {
struct ubuf_info *uarg = msg_control;
uarg->callback(NULL, uarg, false);
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index bf28d0b75c1b..174c05c90872 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -904,6 +904,7 @@ static void handle_tx_zerocopy(struct vhost_net *net, struct socket *sock)
ubuf->callback = vhost_zerocopy_callback;
ubuf->ctx = nvq->ubufs;
ubuf->desc = nvq->upend_idx;
+ ubuf->zc_flags = SKBZC_FRAGMENTS;
refcount_set(&ubuf->refcnt, 1);
msg.msg_control = &ctl;
ctl.type = TUN_MSG_UBUF;
--
2.24.1
Powered by blists - more mailing lists