virtio-net: restore VIRTIO_HDR_F_DATA_VALID on receiving
Subsystems (6)
PATCH 1/1 virtio-net: restore VIRTIO_HDR_F_DATA_VALID on receiving
Commit 501db511397f ("virtio: don't set VIRTIO_NET_HDR_F_DATA_VALID on xmit") in fact disables VIRTIO_HDR_F_DATA_VALID on receiving path too, fixing this by adding a hint (has_data_valid) and set it only on the receiving path.
--- drivers/net/macvtap.c | 2 +- drivers/net/tun.c | 2 +- drivers/net/virtio_net.c | 2 +- include/linux/virtio_net.h | 6 +++++- net/packet/af_packet.c | 4 ++-- 5 files changed, 10 insertions(+), 6 deletions(-)
drivers/net/macvtap.c +1 -1
@@ -825,7 +825,7 @@ static ssize_t macvtap_put_user(struct macvtap_queue *q,return -EINVAL ;if (virtio_net_hdr_from_skb (skb, &vnet_hdr, -macvtap_is_little_endian (q))) +macvtap_is_little_endian (q), true))BUG (); if (copy_to_iter(&vnet_hdr, sizeof(vnet_hdr), iter) !=
drivers/net/tun.c +1 -1
@@ -1360,7 +1360,7 @@ static ssize_t tun_put_user(struct tun_struct *tun,return -EINVAL ;if (virtio_net_hdr_from_skb (skb, &gso, -tun_is_little_endian (tun))) { +tun_is_little_endian (tun), true)) {struct skb_shared_info *sinfo =skb_shinfo (skb); pr_err("unexpected GSO type: " "0x%x, gso_size %d, hdr_len %d\n",
drivers/net/virtio_net.c +1 -1
@@ -1104,7 +1104,7 @@ static int xmit_skb(struct send_queue *sq, struct sk_buff *skb) hdr =skb_vnet_hdr (skb);if (virtio_net_hdr_from_skb (skb, &hdr->hdr, -virtio_is_little_endian (vi->vdev))) +virtio_is_little_endian (vi->vdev), false))BUG ();if (vi->mergeable_rx_bufs)
include/linux/virtio_net.h +5 -1
@@ -56,7 +56,8 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb,static inline int virtio_net_hdr_from_skb (const struct sk_buff *skb,struct virtio_net_hdr *hdr, -bool little_endian) +bool little_endian, +bool has_data_valid) {memset (hdr,0 ,sizeof (*hdr));/* no info leak */
@@ -91,6 +92,9 @@ static inline int virtio_net_hdr_from_skb(const struct sk_buff *skb, skb_checksum_start_offset(skb)); hdr->csum_offset =__cpu_to_virtio16 (little_endian, skb->csum_offset); + }else if (has_data_valid && + skb->ip_summed ==CHECKSUM_UNNECESSARY ) { + hdr->flags =VIRTIO_NET_HDR_F_DATA_VALID ; }/* else everything is zero */ return 0 ;
net/packet/af_packet.c +2 -2
@@ -1976,7 +1976,7 @@ static int packet_rcv_vnet(struct msghdr *msg, const struct sk_buff *skb,return -EINVAL ; *len -=sizeof (vnet_hdr); -if (virtio_net_hdr_from_skb (skb, &vnet_hdr,vio_le ())) +if (virtio_net_hdr_from_skb (skb, &vnet_hdr,vio_le (), true))return -EINVAL ;return memcpy_to_msg (msg, (void *)&vnet_hdr,sizeof (vnet_hdr));
@@ -2237,7 +2237,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev,if (po->has_vnet_hdr) {if (virtio_net_hdr_from_skb (skb, h.raw + macoff -sizeof (struct virtio_net_hdr ), -vio_le ())) { +vio_le (), true)) {spin_lock (&sk->sk_receive_queue.lock); goto drop_n_account; }
Signature · 1 line
2.7.4
Quoted 7 lines · Jason Wang
Commit
501db511397f("virtio: don't setVIRTIO_NET_HDR_F_DATA_VALIDon xmit") in fact disablesVIRTIO_HDR_F_DATA_VALIDon receiving path too, fixing this by adding a hint (has_data_valid) and set it only on the receiving path.Cc Rolf Neugebauer <[email protected]>Signed-off-by Jason Wang <[email protected]>
Ah, I missed this use of the function. Looks like this patch does not regress the issue I was seeing with virtio_net.
Rolf
Quoted 96 lines
--- drivers/net/macvtap.c | 2 +- drivers/net/tun.c | 2 +- drivers/net/virtio_net.c | 2 +- include/linux/virtio_net.h | 6 +++++- net/packet/af_packet.c | 4 ++-- 5 files changed, 10 insertions(+), 6 deletions(-)drivers/net/macvtap.c +1
-1@@ -825,7 +825,7 @@ static ssize_t macvtap_put_user(struct macvtap_queue *q,return -EINVAL ;if (virtio_net_hdr_from_skb (skb, &vnet_hdr, -macvtap_is_little_endian (q))) +macvtap_is_little_endian (q), true))BUG (); if (copy_to_iter(&vnet_hdr, sizeof(vnet_hdr), iter) !=drivers/net/tun.c +1
-1@@ -1360,7 +1360,7 @@ static ssize_t tun_put_user(struct tun_struct *tun,return -EINVAL ;if (virtio_net_hdr_from_skb (skb, &gso, -tun_is_little_endian (tun))) { +tun_is_little_endian (tun), true)) {struct skb_shared_info *sinfo =skb_shinfo (skb); pr_err("unexpected GSO type: " "0x%x, gso_size %d, hdr_len %d\n",drivers/net/virtio_net.c +1
-1@@ -1104,7 +1104,7 @@ static int xmit_skb(struct send_queue *sq, struct sk_buff *skb) hdr =skb_vnet_hdr (skb);if (virtio_net_hdr_from_skb (skb, &hdr->hdr, -virtio_is_little_endian (vi->vdev))) +virtio_is_little_endian (vi->vdev), false))BUG ();if (vi->mergeable_rx_bufs)include/linux/virtio_net.h +5
-1@@ -56,7 +56,8 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb,static inline int virtio_net_hdr_from_skb (const struct sk_buff *skb,struct virtio_net_hdr *hdr, -bool little_endian) +bool little_endian, +bool has_data_valid) {memset (hdr,0 ,sizeof (*hdr));/* no info leak */ @@ -91,6 +92,9 @@ static inline int virtio_net_hdr_from_skb(const struct sk_buff *skb, skb_checksum_start_offset(skb)); hdr->csum_offset =__cpu_to_virtio16 (little_endian, skb->csum_offset); + }else if (has_data_valid && + skb->ip_summed ==CHECKSUM_UNNECESSARY ) { + hdr->flags =VIRTIO_NET_HDR_F_DATA_VALID ; }/* else everything is zero */ return 0 ;net/packet/af_packet.c +2
-3@@ -1976,7 +1976,7 @@ static int packet_rcv_vnet(struct msghdr *msg, const struct sk_buff *skb,return -EINVAL ; *len -=sizeof (vnet_hdr); -if (virtio_net_hdr_from_skb (skb, &vnet_hdr,vio_le ())) +if (virtio_net_hdr_from_skb (skb, &vnet_hdr,vio_le (), true))return -EINVAL ;return memcpy_to_msg (msg, (void *)&vnet_hdr,sizeof (vnet_hdr));@@ -2237,7 +2237,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev,if (po->has_vnet_hdr) {if (virtio_net_hdr_from_skb (skb, h.raw + macoff -sizeof (struct virtio_net_hdr ), -vio_le ())) { +vio_le (), true)) {spin_lock (&sk->sk_receive_queue.lock); goto drop_n_account; } --2.7.4
From: Jason Wang <[email protected]>
Date: Fri, 20 Jan 2017 14:32:42 +0800
Quoted 7 lines
Commit
501db511397f("virtio: don't setVIRTIO_NET_HDR_F_DATA_VALIDon xmit") in fact disablesVIRTIO_HDR_F_DATA_VALIDon receiving path too, fixing this by adding a hint (has_data_valid) and set it only on the receiving path.Cc Rolf Neugebauer <[email protected]>Signed-off-by Jason Wang <[email protected]>
Applied, thanks Jason.
Michael S. Tsirkin
maintainerQuoted 59 lines · Jason Wang
Commit
501db511397f("virtio: don't setVIRTIO_NET_HDR_F_DATA_VALIDon xmit") in fact disablesVIRTIO_HDR_F_DATA_VALIDon receiving path too, fixing this by adding a hint (has_data_valid) and set it only on the receiving path.Cc Rolf Neugebauer <[email protected]>Signed-off-by Jason Wang <[email protected]>--- drivers/net/macvtap.c | 2 +- drivers/net/tun.c | 2 +- drivers/net/virtio_net.c | 2 +- include/linux/virtio_net.h | 6 +++++- net/packet/af_packet.c | 4 ++-- 5 files changed, 10 insertions(+), 6 deletions(-)drivers/net/macvtap.c +1
-1@@ -825,7 +825,7 @@ static ssize_t macvtap_put_user(struct macvtap_queue *q,return -EINVAL ;if (virtio_net_hdr_from_skb (skb, &vnet_hdr, -macvtap_is_little_endian (q))) +macvtap_is_little_endian (q), true))BUG (); if (copy_to_iter(&vnet_hdr, sizeof(vnet_hdr), iter) !=drivers/net/tun.c +1
-1@@ -1360,7 +1360,7 @@ static ssize_t tun_put_user(struct tun_struct *tun,return -EINVAL ;if (virtio_net_hdr_from_skb (skb, &gso, -tun_is_little_endian (tun))) { +tun_is_little_endian (tun), true)) {struct skb_shared_info *sinfo =skb_shinfo (skb); pr_err("unexpected GSO type: " "0x%x, gso_size %d, hdr_len %d\n",drivers/net/virtio_net.c +1
-1@@ -1104,7 +1104,7 @@ static int xmit_skb(struct send_queue *sq, struct sk_buff *skb) hdr =skb_vnet_hdr (skb);if (virtio_net_hdr_from_skb (skb, &hdr->hdr, -virtio_is_little_endian (vi->vdev))) +virtio_is_little_endian (vi->vdev), false))BUG ();if (vi->mergeable_rx_bufs)include/linux/virtio_net.h +0
-0
include/linux/virtio_net.h static inline int virtio_net_hdr_to_skb(struct sk_buff *skb, · line 63
Quoted 9 lines
include/linux/virtio_net.h +2
-1@@ -56,7 +56,8 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb,static inline int virtio_net_hdr_from_skb (const struct sk_buff *skb,struct virtio_net_hdr *hdr, -bool little_endian) +bool little_endian, +bool has_data_valid) {memset (hdr,0 ,sizeof (*hdr));/* no info leak */
I would prefer naming it is_rx. Callers should not know about internal details like data valid, the issue we are trying to fix here is that tx and tx headers are slightly different.
Quoted 34 lines
include/linux/virtio_net.h +3
-0@@ -91,6 +92,9 @@ static inline int virtio_net_hdr_from_skb(const struct sk_buff *skb, skb_checksum_start_offset(skb)); hdr->csum_offset =__cpu_to_virtio16 (little_endian, skb->csum_offset); + }else if (has_data_valid && + skb->ip_summed ==CHECKSUM_UNNECESSARY ) { + hdr->flags =VIRTIO_NET_HDR_F_DATA_VALID ; }/* else everything is zero */ return 0 ;net/packet/af_packet.c +2
-2@@ -1976,7 +1976,7 @@ static int packet_rcv_vnet(struct msghdr *msg, const struct sk_buff *skb,return -EINVAL ; *len -=sizeof (vnet_hdr); -if (virtio_net_hdr_from_skb (skb, &vnet_hdr,vio_le ())) +if (virtio_net_hdr_from_skb (skb, &vnet_hdr,vio_le (), true))return -EINVAL ;return memcpy_to_msg (msg, (void *)&vnet_hdr,sizeof (vnet_hdr));@@ -2237,7 +2237,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev,if (po->has_vnet_hdr) {if (virtio_net_hdr_from_skb (skb, h.raw + macoff -sizeof (struct virtio_net_hdr ), -vio_le ())) { +vio_le (), true)) {spin_lock (&sk->sk_receive_queue.lock); goto drop_n_account; }Signature · 1 line
2.7.4
Quoted 61 lines · Michael S. Tsirkin
Quoted 60 lines · Jason Wang
Commit
501db511397f("virtio: don't setVIRTIO_NET_HDR_F_DATA_VALIDon xmit") in fact disablesVIRTIO_HDR_F_DATA_VALIDon receiving path too, fixing this by adding a hint (has_data_valid) and set it only on the receiving path.Cc Rolf Neugebauer<[email protected]>Signed-off-by Jason Wang<[email protected]>--- drivers/net/macvtap.c | 2 +- drivers/net/tun.c | 2 +- drivers/net/virtio_net.c | 2 +- include/linux/virtio_net.h | 6 +++++- net/packet/af_packet.c | 4 ++-- 5 files changed, 10 insertions(+), 6 deletions(-)drivers/net/macvtap.c +1
-1@@ -825,7 +825,7 @@ static ssize_t macvtap_put_user(struct macvtap_queue *q,return -EINVAL ;if (virtio_net_hdr_from_skb (skb, &vnet_hdr, -macvtap_is_little_endian (q))) +macvtap_is_little_endian (q), true))BUG (); if (copy_to_iter(&vnet_hdr, sizeof(vnet_hdr), iter) !=drivers/net/tun.c +1
-1@@ -1360,7 +1360,7 @@ static ssize_t tun_put_user(struct tun_struct *tun,return -EINVAL ;if (virtio_net_hdr_from_skb (skb, &gso, -tun_is_little_endian (tun))) { +tun_is_little_endian (tun), true)) {struct skb_shared_info *sinfo =skb_shinfo (skb); pr_err("unexpected GSO type: " "0x%x, gso_size %d, hdr_len %d\n",drivers/net/virtio_net.c +1
-1@@ -1104,7 +1104,7 @@ static int xmit_skb(struct send_queue *sq, struct sk_buff *skb) hdr =skb_vnet_hdr (skb);if (virtio_net_hdr_from_skb (skb, &hdr->hdr, -virtio_is_little_endian (vi->vdev))) +virtio_is_little_endian (vi->vdev), false))BUG ();if (vi->mergeable_rx_bufs)include/linux/virtio_net.h +0
-0@@ -56,7 +56,8 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb,
Quoted 12 lines
include/linux/virtio_net.h static inline int virtio_net_hdr_to_skb(struct sk_buff *skb, · line 63
Quoted 8 lines
include/linux/virtio_net.h +2
-1static inline int virtio_net_hdr_from_skb (const struct sk_buff *skb,struct virtio_net_hdr *hdr, -bool little_endian) +bool little_endian, +bool has_data_valid) {memset (hdr,0 ,sizeof (*hdr));/* no info leak */ I would prefer naming it
is_rx. Callers should not know about internal details like data valid, the issue we are trying to fix here is that tx and tx headers are slightly different.
Actually, I've considered something like this, but the problem is:
- tun use this on xmit, so is_rx = true may cause some confusion here
- I believe we may want to support DATA_VALID (like xen-netback) on tx (probably with a feature) in the future.
Thanks
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Michael S. Tsirkin
maintainerQuoted 70 lines · Jason Wang
Quoted 57 lines · Michael S. Tsirkin
Quoted 56 lines · Jason Wang
Commit
501db511397f("virtio: don't setVIRTIO_NET_HDR_F_DATA_VALIDon xmit") in fact disablesVIRTIO_HDR_F_DATA_VALIDon receiving path too, fixing this by adding a hint (has_data_valid) and set it only on the receiving path.Cc Rolf Neugebauer<[email protected]>Signed-off-by Jason Wang<[email protected]>--- drivers/net/macvtap.c | 2 +- drivers/net/tun.c | 2 +- drivers/net/virtio_net.c | 2 +- include/linux/virtio_net.h | 6 +++++- net/packet/af_packet.c | 4 ++-- 5 files changed, 10 insertions(+), 6 deletions(-)drivers/net/macvtap.c +1
-1@@ -825,7 +825,7 @@ static ssize_t macvtap_put_user(struct macvtap_queue *q,return -EINVAL ;if (virtio_net_hdr_from_skb (skb, &vnet_hdr, -macvtap_is_little_endian (q))) +macvtap_is_little_endian (q), true))BUG (); if (copy_to_iter(&vnet_hdr, sizeof(vnet_hdr), iter) !=drivers/net/tun.c +1
-1@@ -1360,7 +1360,7 @@ static ssize_t tun_put_user(struct tun_struct *tun,return -EINVAL ;if (virtio_net_hdr_from_skb (skb, &gso, -tun_is_little_endian (tun))) { +tun_is_little_endian (tun), true)) {struct skb_shared_info *sinfo =skb_shinfo (skb); pr_err("unexpected GSO type: " "0x%x, gso_size %d, hdr_len %d\n",drivers/net/virtio_net.c +1
-1@@ -1104,7 +1104,7 @@ static int xmit_skb(struct send_queue *sq, struct sk_buff *skb) hdr =skb_vnet_hdr (skb);if (virtio_net_hdr_from_skb (skb, &hdr->hdr, -virtio_is_little_endian (vi->vdev))) +virtio_is_little_endian (vi->vdev), false))BUG ();if (vi->mergeable_rx_bufs)include/linux/virtio_net.h +0
-0@@ -56,7 +56,8 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb, static inline int virtio_net_hdr_from_skb(const struct sk_buff *skb, struct virtio_net_hdr *hdr,Quoted 9 lines
include/linux/virtio_net.h static inline int virtio_net_hdr_to_skb(struct sk_buff *skb, · line 62
Quoted 5 lines
include/linux/virtio_net.h +2
-1- bool little_endian) +bool little_endian, + bool has_data_valid) { memset(hdr, 0, sizeof(*hdr)); /* no info leak */I would prefer naming it
is_rx. Callers should not know about internal details like data valid, the issue we are trying to fix here is that tx and tx headers are slightly different.
Quoted 3 lines
Actually, I've considered something like this, but the problem is:
- tun use this on xmit, so
is_rx= true may cause some confusion here
tun is generally weird, yes. how about rx_format?
Quoted 4 lines
- I believe we may want to support
DATA_VALID(like xen-netback) on tx (probably with a feature) in the future.Thanks
We'll put that knowledge within virtio_net_hdr_from_skb not in the callers I think.
Signature · 1 line
MST
Michael S. Tsirkin
maintainerQuoted 70 lines · Jason Wang
Quoted 57 lines · Michael S. Tsirkin
Quoted 56 lines · Jason Wang
Commit
501db511397f("virtio: don't setVIRTIO_NET_HDR_F_DATA_VALIDon xmit") in fact disablesVIRTIO_HDR_F_DATA_VALIDon receiving path too, fixing this by adding a hint (has_data_valid) and set it only on the receiving path.Cc Rolf Neugebauer<[email protected]>Signed-off-by Jason Wang<[email protected]>--- drivers/net/macvtap.c | 2 +- drivers/net/tun.c | 2 +- drivers/net/virtio_net.c | 2 +- include/linux/virtio_net.h | 6 +++++- net/packet/af_packet.c | 4 ++-- 5 files changed, 10 insertions(+), 6 deletions(-)drivers/net/macvtap.c +1
-1@@ -825,7 +825,7 @@ static ssize_t macvtap_put_user(struct macvtap_queue *q,return -EINVAL ;if (virtio_net_hdr_from_skb (skb, &vnet_hdr, -macvtap_is_little_endian (q))) +macvtap_is_little_endian (q), true))BUG (); if (copy_to_iter(&vnet_hdr, sizeof(vnet_hdr), iter) !=drivers/net/tun.c +1
-1@@ -1360,7 +1360,7 @@ static ssize_t tun_put_user(struct tun_struct *tun,return -EINVAL ;if (virtio_net_hdr_from_skb (skb, &gso, -tun_is_little_endian (tun))) { +tun_is_little_endian (tun), true)) {struct skb_shared_info *sinfo =skb_shinfo (skb); pr_err("unexpected GSO type: " "0x%x, gso_size %d, hdr_len %d\n",drivers/net/virtio_net.c +1
-1@@ -1104,7 +1104,7 @@ static int xmit_skb(struct send_queue *sq, struct sk_buff *skb) hdr =skb_vnet_hdr (skb);if (virtio_net_hdr_from_skb (skb, &hdr->hdr, -virtio_is_little_endian (vi->vdev))) +virtio_is_little_endian (vi->vdev), false))BUG ();if (vi->mergeable_rx_bufs)include/linux/virtio_net.h +0
-0@@ -56,7 +56,8 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb, static inline int virtio_net_hdr_from_skb(const struct sk_buff *skb, struct virtio_net_hdr *hdr,Quoted 9 lines
include/linux/virtio_net.h static inline int virtio_net_hdr_to_skb(struct sk_buff *skb, · line 62
Quoted 5 lines
include/linux/virtio_net.h +2
-1- bool little_endian) +bool little_endian, + bool has_data_valid) { memset(hdr, 0, sizeof(*hdr)); /* no info leak */I would prefer naming it
is_rx. Callers should not know about internal details like data valid, the issue we are trying to fix here is that tx and tx headers are slightly different.
Quoted 3 lines
Actually, I've considered something like this, but the problem is:
- tun use this on xmit, so
is_rx= true may cause some confusion here
tun is generally weird, yes. how about rx_format?
Quoted 4 lines
- I believe we may want to support
DATA_VALID(like xen-netback) on tx (probably with a feature) in the future.Thanks
We'll put that knowledge within virtio_net_hdr_from_skb not in the callers I think.
Signature · 5 lines
MST _______________________________________________ Virtualization mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Quoted 69 lines · Michael S. Tsirkin
Quoted 68 lines · Jason Wang
Quoted 66 lines · Michael S. Tsirkin
Quoted 54 lines · Jason Wang
Commit
501db511397f("virtio: don't setVIRTIO_NET_HDR_F_DATA_VALIDon xmit") in fact disablesVIRTIO_HDR_F_DATA_VALIDon receiving path too, fixing this by adding a hint (has_data_valid) and set it only on the receiving path.Cc Rolf Neugebauer<[email protected]>Signed-off-by Jason Wang<[email protected]>--- drivers/net/macvtap.c | 2 +- drivers/net/tun.c | 2 +- drivers/net/virtio_net.c | 2 +- include/linux/virtio_net.h | 6 +++++- net/packet/af_packet.c | 4 ++-- 5 files changed, 10 insertions(+), 6 deletions(-)drivers/net/macvtap.c +1
-1@@ -825,7 +825,7 @@ static ssize_t macvtap_put_user(struct macvtap_queue *q,return -EINVAL ;if (virtio_net_hdr_from_skb (skb, &vnet_hdr, -macvtap_is_little_endian (q))) +macvtap_is_little_endian (q), true))BUG (); if (copy_to_iter(&vnet_hdr, sizeof(vnet_hdr), iter) !=drivers/net/tun.c +1
-1@@ -1360,7 +1360,7 @@ static ssize_t tun_put_user(struct tun_struct *tun,return -EINVAL ;if (virtio_net_hdr_from_skb (skb, &gso, -tun_is_little_endian (tun))) { +tun_is_little_endian (tun), true)) {struct skb_shared_info *sinfo =skb_shinfo (skb); pr_err("unexpected GSO type: " "0x%x, gso_size %d, hdr_len %d\n",drivers/net/virtio_net.c +1
-1@@ -1104,7 +1104,7 @@ static int xmit_skb(struct send_queue *sq, struct sk_buff *skb) hdr =skb_vnet_hdr (skb);if (virtio_net_hdr_from_skb (skb, &hdr->hdr, -virtio_is_little_endian (vi->vdev))) +virtio_is_little_endian (vi->vdev), false))BUG ();if (vi->mergeable_rx_bufs)include/linux/virtio_net.h +0
-0include/linux/virtio_net.h static inline int virtio_net_hdr_to_skb(struct sk_buff *skb, · line 61
Quoted 7 lines
include/linux/virtio_net.h +2
-1@@ -56,7 +56,8 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb,static inline int virtio_net_hdr_from_skb (const struct sk_buff *skb,struct virtio_net_hdr *hdr, -bool little_endian) +bool little_endian, +bool has_data_valid) {memset (hdr,0 ,sizeof (*hdr));/* no info leak */ I would prefer naming it
is_rx. Callers should not know about internal details like data valid, the issue we are trying to fix here is that tx and tx headers are slightly different.
Quoted 4 lines
Quoted 3 lines
Actually, I've considered something like this, but the problem is:
- tun use this on xmit, so
is_rx= true may cause some confusion heretun is generally weird, yes. how about
rx_format?
Ok.
Quoted 8 lines
Quoted 5 lines
- I believe we may want to support
DATA_VALID(like xen-netback) on tx (probably with a feature) in the future.Thanks
We'll put that knowledge within
virtio_net_hdr_from_skbnot in the callers I think.
Maybe, will prepare a patch for net-next.
Thanks
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization