Willem de Bruijn
2020-Dec-28  16:22 UTC
[PATCH rfc 0/3] virtio-net: add tx-hash, rx-tstamp and tx-tstamp
From: Willem de Bruijn <willemb at google.com> RFC for three new features to the virtio network device: 1. pass tx flow hash and state to host, for routing + telemetry 2. pass rx tstamp to guest, for better RTT estimation 3. pass tx tstamp to host, for accurate pacing All three would introduce an extension to the virtio spec. I assume this would require opening three ballots against v1.2 at https://www.oasis-open.org/committees/ballots.php?wg_abbrev=virtio This RFC is to informally discuss the proposals first. The patchset is against v5.10. Evaluation additionally requires changes to qemu and at least one back-end. I implemented preliminary support in Linux vhost-net. Both patches available through github at https://github.com/wdebruij/linux/tree/virtio-net-txhash-1 https://github.com/wdebruij/qemu/tree/virtio-net-txhash-1 Willem de Bruijn (3): virtio-net: support transmit hash report virtio-net: support receive timestamp virtio-net: support transmit timestamp drivers/net/virtio_net.c | 52 +++++++++++++++++++++++++++++++-- include/uapi/linux/virtio_net.h | 23 ++++++++++++++- 2 files changed, 71 insertions(+), 4 deletions(-) -- 2.29.2.729.g45daf8777d-goog
Willem de Bruijn
2020-Dec-28  16:22 UTC
[PATCH rfc 1/3] virtio-net: support transmit hash report
From: Willem de Bruijn <willemb at google.com>
Virtio-net supports sharing the flow hash from host to guest on rx.
Do the same on transmit, to allow the host to infer connection state
for more robust routing and telemetry.
Linux derives ipv6 flowlabel and ECMP multipath from sk->sk_txhash,
and updates these fields on error with sk_rethink_txhash. This feature
allows the host to make similar decisions.
Besides the raw hash, optionally also convey connection state for
this hash. Specifically, the hash rotates on transmit timeout. To
avoid having to keep a stateful table in the host to detect flow
changes, explicitly notify when a hash changed due to timeout.
Signed-off-by: Willem de Bruijn <willemb at google.com>
---
 drivers/net/virtio_net.c        | 24 +++++++++++++++++++++---
 include/uapi/linux/virtio_net.h | 10 +++++++++-
 2 files changed, 30 insertions(+), 4 deletions(-)
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 21b71148c532..b917b7333928 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -201,6 +201,9 @@ struct virtnet_info {
 	/* Host will merge rx buffers for big packets (shake it! shake it!) */
 	bool mergeable_rx_bufs;
 
+	/* Guest will pass tx path info to the host */
+	bool has_tx_hash;
+
 	/* Has control virtqueue */
 	bool has_cvq;
 
@@ -394,9 +397,9 @@ static struct sk_buff *page_to_skb(struct virtnet_info *vi,
 
 	hdr_len = vi->hdr_len;
 	if (vi->mergeable_rx_bufs)
-		hdr_padded_len = sizeof(*hdr);
+		hdr_padded_len = max_t(unsigned int, hdr_len, sizeof(*hdr));
 	else
-		hdr_padded_len = sizeof(struct padded_vnet_hdr);
+		hdr_padded_len = ALIGN(hdr_len, 16);
 
 	/* hdr_valid means no XDP, so we can copy the vnet header */
 	if (hdr_valid)
@@ -1534,6 +1537,7 @@ static int xmit_skb(struct send_queue *sq, struct sk_buff
*skb)
 	struct virtio_net_hdr_mrg_rxbuf *hdr;
 	const unsigned char *dest = ((struct ethhdr *)skb->data)->h_dest;
 	struct virtnet_info *vi = sq->vq->vdev->priv;
+	struct virtio_net_hdr_v1_hash *ht;
 	int num_sg;
 	unsigned hdr_len = vi->hdr_len;
 	bool can_push;
@@ -1558,6 +1562,14 @@ static int xmit_skb(struct send_queue *sq, struct sk_buff
*skb)
 	if (vi->mergeable_rx_bufs)
 		hdr->num_buffers = 0;
 
+	ht = (void *)hdr;
+	if (vi->has_tx_hash) {
+		ht->hash_value = cpu_to_virtio32(vi->vdev, skb->hash);
+		ht->hash_report = skb->l4_hash ? VIRTIO_NET_HASH_REPORT_L4 :
+						 VIRTIO_NET_HASH_REPORT_OTHER;
+		ht->hash_state = VIRTIO_NET_HASH_STATE_DEFAULT;
+	}
+
 	sg_init_table(sq->sg, skb_shinfo(skb)->nr_frags + (can_push ? 1 : 2));
 	if (can_push) {
 		__skb_push(skb, hdr_len);
@@ -3054,6 +3066,11 @@ static int virtnet_probe(struct virtio_device *vdev)
 	else
 		vi->hdr_len = sizeof(struct virtio_net_hdr);
 
+	if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_TX_HASH)) {
+		vi->has_tx_hash = true;
+		vi->hdr_len = sizeof(struct virtio_net_hdr_v1_hash);
+	}
+
 	if (virtio_has_feature(vdev, VIRTIO_F_ANY_LAYOUT) ||
 	    virtio_has_feature(vdev, VIRTIO_F_VERSION_1))
 		vi->any_header_sg = true;
@@ -3243,7 +3260,8 @@ static struct virtio_device_id id_table[] = {
 	VIRTIO_NET_F_GUEST_ANNOUNCE, VIRTIO_NET_F_MQ, \
 	VIRTIO_NET_F_CTRL_MAC_ADDR, \
 	VIRTIO_NET_F_MTU, VIRTIO_NET_F_CTRL_GUEST_OFFLOADS, \
-	VIRTIO_NET_F_SPEED_DUPLEX, VIRTIO_NET_F_STANDBY
+	VIRTIO_NET_F_SPEED_DUPLEX, VIRTIO_NET_F_STANDBY, \
+	VIRTIO_NET_F_TX_HASH
 
 static unsigned int features[] = {
 	VIRTNET_FEATURES,
diff --git a/include/uapi/linux/virtio_net.h b/include/uapi/linux/virtio_net.h
index 3f55a4215f11..f6881b5b77ee 100644
--- a/include/uapi/linux/virtio_net.h
+++ b/include/uapi/linux/virtio_net.h
@@ -57,6 +57,7 @@
 					 * Steering */
 #define VIRTIO_NET_F_CTRL_MAC_ADDR 23	/* Set MAC address */
 
+#define VIRTIO_NET_F_TX_HASH	  56	/* Guest sends hash report */
 #define VIRTIO_NET_F_HASH_REPORT  57	/* Supports hash report */
 #define VIRTIO_NET_F_RSS	  60	/* Supports RSS RX steering */
 #define VIRTIO_NET_F_RSC_EXT	  61	/* extended coalescing info */
@@ -170,8 +171,15 @@ struct virtio_net_hdr_v1_hash {
 #define VIRTIO_NET_HASH_REPORT_IPv6_EX         7
 #define VIRTIO_NET_HASH_REPORT_TCPv6_EX        8
 #define VIRTIO_NET_HASH_REPORT_UDPv6_EX        9
+#define VIRTIO_NET_HASH_REPORT_L4              10
+#define VIRTIO_NET_HASH_REPORT_OTHER           11
 	__le16 hash_report;
-	__le16 padding;
+	union {
+		__le16 padding;
+#define VIRTIO_NET_HASH_STATE_DEFAULT          0
+#define VIRTIO_NET_HASH_STATE_TIMEOUT_BIT      0x1
+		__le16 hash_state;
+	};
 };
 
 #ifndef VIRTIO_NET_NO_LEGACY
-- 
2.29.2.729.g45daf8777d-goog
Willem de Bruijn
2020-Dec-28  16:22 UTC
[PATCH rfc 2/3] virtio-net: support receive timestamp
From: Willem de Bruijn <willemb at google.com>
Add optional PTP hardware timestamp offload for virtio-net.
Accurate RTT measurement requires timestamps close to the wire.
Introduce virtio feature VIRTIO_NET_F_RX_TSTAMP. If negotiated, the
virtio-net header is expanded with room for a timestamp. A host may
pass receive timestamps for all or some packets. A timestamp is valid
if non-zero.
The timestamp straddles (virtual) hardware domains. Like PTP, use
international atomic time (CLOCK_TAI) as global clock base. It is
guest responsibility to sync with host, e.g., through kvm-clock.
Signed-off-by: Willem de Bruijn <willemb at google.com>
---
 drivers/net/virtio_net.c        | 20 +++++++++++++++++++-
 include/uapi/linux/virtio_net.h | 12 ++++++++++++
 2 files changed, 31 insertions(+), 1 deletion(-)
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index b917b7333928..57744bb6a141 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -204,6 +204,9 @@ struct virtnet_info {
 	/* Guest will pass tx path info to the host */
 	bool has_tx_hash;
 
+	/* Host will pass CLOCK_TAI receive time to the guest */
+	bool has_rx_tstamp;
+
 	/* Has control virtqueue */
 	bool has_cvq;
 
@@ -292,6 +295,13 @@ static inline struct virtio_net_hdr_mrg_rxbuf
*skb_vnet_hdr(struct sk_buff *skb)
 	return (struct virtio_net_hdr_mrg_rxbuf *)skb->cb;
 }
 
+static inline struct virtio_net_hdr_v12 *skb_vnet_hdr_12(struct sk_buff *skb)
+{
+	BUILD_BUG_ON(sizeof(struct virtio_net_hdr_v12) > sizeof(skb->cb));
+
+	return (void *)skb->cb;
+}
+
 /*
  * private is used to chain pages for big packets, put the whole
  * most recent used list in the beginning for reuse
@@ -1082,6 +1092,9 @@ static void receive_buf(struct virtnet_info *vi, struct
receive_queue *rq,
 		goto frame_err;
 	}
 
+	if (vi->has_rx_tstamp)
+		skb_hwtstamps(skb)->hwtstamp =
ns_to_ktime(skb_vnet_hdr_12(skb)->tstamp);
+
 	skb_record_rx_queue(skb, vq2rxq(rq->vq));
 	skb->protocol = eth_type_trans(skb, dev);
 	pr_debug("Receiving skb proto 0x%04x len %i type %i\n",
@@ -3071,6 +3084,11 @@ static int virtnet_probe(struct virtio_device *vdev)
 		vi->hdr_len = sizeof(struct virtio_net_hdr_v1_hash);
 	}
 
+	if (virtio_has_feature(vdev, VIRTIO_NET_F_RX_TSTAMP)) {
+		vi->has_rx_tstamp = true;
+		vi->hdr_len = sizeof(struct virtio_net_hdr_v12);
+	}
+
 	if (virtio_has_feature(vdev, VIRTIO_F_ANY_LAYOUT) ||
 	    virtio_has_feature(vdev, VIRTIO_F_VERSION_1))
 		vi->any_header_sg = true;
@@ -3261,7 +3279,7 @@ static struct virtio_device_id id_table[] = {
 	VIRTIO_NET_F_CTRL_MAC_ADDR, \
 	VIRTIO_NET_F_MTU, VIRTIO_NET_F_CTRL_GUEST_OFFLOADS, \
 	VIRTIO_NET_F_SPEED_DUPLEX, VIRTIO_NET_F_STANDBY, \
-	VIRTIO_NET_F_TX_HASH
+	VIRTIO_NET_F_TX_HASH, VIRTIO_NET_F_RX_TSTAMP
 
 static unsigned int features[] = {
 	VIRTNET_FEATURES,
diff --git a/include/uapi/linux/virtio_net.h b/include/uapi/linux/virtio_net.h
index f6881b5b77ee..0ffe2eeebd4a 100644
--- a/include/uapi/linux/virtio_net.h
+++ b/include/uapi/linux/virtio_net.h
@@ -57,6 +57,7 @@
 					 * Steering */
 #define VIRTIO_NET_F_CTRL_MAC_ADDR 23	/* Set MAC address */
 
+#define VIRTIO_NET_F_RX_TSTAMP	  55	/* Host sends TAI receive time */
 #define VIRTIO_NET_F_TX_HASH	  56	/* Guest sends hash report */
 #define VIRTIO_NET_F_HASH_REPORT  57	/* Supports hash report */
 #define VIRTIO_NET_F_RSS	  60	/* Supports RSS RX steering */
@@ -182,6 +183,17 @@ struct virtio_net_hdr_v1_hash {
 	};
 };
 
+struct virtio_net_hdr_v12 {
+	struct virtio_net_hdr_v1 hdr;
+	struct {
+		__le32 value;
+		__le16 report;
+		__le16 flow_state;
+	} hash;
+	__virtio32 reserved;
+	__virtio64 tstamp;
+};
+
 #ifndef VIRTIO_NET_NO_LEGACY
 /* This header comes first in the scatter-gather list.
  * For legacy virtio, if VIRTIO_F_ANY_LAYOUT is not negotiated, it must
-- 
2.29.2.729.g45daf8777d-goog
Willem de Bruijn
2020-Dec-28  16:22 UTC
[PATCH rfc 3/3] virtio-net: support transmit timestamp
From: Willem de Bruijn <willemb at google.com>
Add optional delivery time (SO_TXTIME) offload for virtio-net.
The Linux TCP/IP stack tries to avoid bursty transmission and network
congestion through pacing: computing an skb delivery time based on
congestion information. Userspace protocol implementations can achieve
the same with SO_TXTIME. This may also reduce scheduling jitter and
improve RTT estimation.
Pacing can be implemented in ETF or FQ qdiscs or offloaded to NIC
hardware. Allow guests to offload for the same reasons.
The timestamp straddles (virtual) hardware domains. Like PTP, use
international atomic time (CLOCK_TAI) as global clock base. It is
guest responsibility to sync with host, e.g., through kvm-clock.
Signed-off-by: Willem de Bruijn <willemb at google.com>
---
 drivers/net/virtio_net.c        | 24 +++++++++++++++++-------
 include/uapi/linux/virtio_net.h |  1 +
 2 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 57744bb6a141..d40be688aed0 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -207,6 +207,9 @@ struct virtnet_info {
 	/* Host will pass CLOCK_TAI receive time to the guest */
 	bool has_rx_tstamp;
 
+	/* Guest will pass CLOCK_TAI delivery time to the host */
+	bool has_tx_tstamp;
+
 	/* Has control virtqueue */
 	bool has_cvq;
 
@@ -1550,7 +1553,7 @@ static int xmit_skb(struct send_queue *sq, struct sk_buff
*skb)
 	struct virtio_net_hdr_mrg_rxbuf *hdr;
 	const unsigned char *dest = ((struct ethhdr *)skb->data)->h_dest;
 	struct virtnet_info *vi = sq->vq->vdev->priv;
-	struct virtio_net_hdr_v1_hash *ht;
+	struct virtio_net_hdr_v12 *h12;
 	int num_sg;
 	unsigned hdr_len = vi->hdr_len;
 	bool can_push;
@@ -1575,13 +1578,15 @@ static int xmit_skb(struct send_queue *sq, struct
sk_buff *skb)
 	if (vi->mergeable_rx_bufs)
 		hdr->num_buffers = 0;
 
-	ht = (void *)hdr;
+	h12 = (void *)hdr;
 	if (vi->has_tx_hash) {
-		ht->hash_value = cpu_to_virtio32(vi->vdev, skb->hash);
-		ht->hash_report = skb->l4_hash ? VIRTIO_NET_HASH_REPORT_L4 :
-						 VIRTIO_NET_HASH_REPORT_OTHER;
-		ht->hash_state = VIRTIO_NET_HASH_STATE_DEFAULT;
+		h12->hash.value = cpu_to_virtio32(vi->vdev, skb->hash);
+		h12->hash.report = skb->l4_hash ? VIRTIO_NET_HASH_REPORT_L4 :
+						  VIRTIO_NET_HASH_REPORT_OTHER;
+		h12->hash.flow_state = VIRTIO_NET_HASH_STATE_DEFAULT;
 	}
+	if (vi->has_tx_tstamp)
+		h12->tstamp = cpu_to_virtio64(vi->vdev, skb->tstamp);
 
 	sg_init_table(sq->sg, skb_shinfo(skb)->nr_frags + (can_push ? 1 : 2));
 	if (can_push) {
@@ -3089,6 +3094,11 @@ static int virtnet_probe(struct virtio_device *vdev)
 		vi->hdr_len = sizeof(struct virtio_net_hdr_v12);
 	}
 
+	if (virtio_has_feature(vdev, VIRTIO_NET_F_TX_TSTAMP)) {
+		vi->has_tx_tstamp = true;
+		vi->hdr_len = sizeof(struct virtio_net_hdr_v12);
+	}
+
 	if (virtio_has_feature(vdev, VIRTIO_F_ANY_LAYOUT) ||
 	    virtio_has_feature(vdev, VIRTIO_F_VERSION_1))
 		vi->any_header_sg = true;
@@ -3279,7 +3289,7 @@ static struct virtio_device_id id_table[] = {
 	VIRTIO_NET_F_CTRL_MAC_ADDR, \
 	VIRTIO_NET_F_MTU, VIRTIO_NET_F_CTRL_GUEST_OFFLOADS, \
 	VIRTIO_NET_F_SPEED_DUPLEX, VIRTIO_NET_F_STANDBY, \
-	VIRTIO_NET_F_TX_HASH, VIRTIO_NET_F_RX_TSTAMP
+	VIRTIO_NET_F_TX_HASH, VIRTIO_NET_F_RX_TSTAMP, VIRTIO_NET_F_TX_TSTAMP
 
 static unsigned int features[] = {
 	VIRTNET_FEATURES,
diff --git a/include/uapi/linux/virtio_net.h b/include/uapi/linux/virtio_net.h
index 0ffe2eeebd4a..da017a47791d 100644
--- a/include/uapi/linux/virtio_net.h
+++ b/include/uapi/linux/virtio_net.h
@@ -57,6 +57,7 @@
 					 * Steering */
 #define VIRTIO_NET_F_CTRL_MAC_ADDR 23	/* Set MAC address */
 
+#define VIRTIO_NET_F_TX_TSTAMP	  54	/* Guest sets TAI delivery time */
 #define VIRTIO_NET_F_RX_TSTAMP	  55	/* Host sends TAI receive time */
 #define VIRTIO_NET_F_TX_HASH	  56	/* Guest sends hash report */
 #define VIRTIO_NET_F_HASH_REPORT  57	/* Supports hash report */
-- 
2.29.2.729.g45daf8777d-goog
Michael S. Tsirkin
2020-Dec-28  17:29 UTC
[PATCH rfc 0/3] virtio-net: add tx-hash, rx-tstamp and tx-tstamp
On Mon, Dec 28, 2020 at 11:22:30AM -0500, Willem de Bruijn wrote:> From: Willem de Bruijn <willemb at google.com> > > RFC for three new features to the virtio network device: > > 1. pass tx flow hash and state to host, for routing + telemetry > 2. pass rx tstamp to guest, for better RTT estimation > 3. pass tx tstamp to host, for accurate pacing > > All three would introduce an extension to the virtio spec. > I assume this would require opening three ballots against v1.2 at > https://www.oasis-open.org/committees/ballots.php?wg_abbrev=virtio > > This RFC is to informally discuss the proposals first. > > The patchset is against v5.10. Evaluation additionally requires > changes to qemu and at least one back-end. I implemented preliminary > support in Linux vhost-net. Both patches available through github at > > https://github.com/wdebruij/linux/tree/virtio-net-txhash-1 > https://github.com/wdebruij/qemu/tree/virtio-net-txhash-1Any data on what the benefits are?> Willem de Bruijn (3): > virtio-net: support transmit hash report > virtio-net: support receive timestamp > virtio-net: support transmit timestamp > > drivers/net/virtio_net.c | 52 +++++++++++++++++++++++++++++++-- > include/uapi/linux/virtio_net.h | 23 ++++++++++++++- > 2 files changed, 71 insertions(+), 4 deletions(-) > > -- > 2.29.2.729.g45daf8777d-goog
kernel test robot
2021-Feb-02  13:47 UTC
[PATCH rfc 3/3] virtio-net: support transmit timestamp
Hi Willem,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on ipvs/master]
[also build test WARNING on linus/master v5.11-rc6 next-20210125]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url:   
https://github.com/0day-ci/linux/commits/Willem-de-Bruijn/virtio-net-add-tx-hash-rx-tstamp-and-tx-tstamp/20201229-002604
base:   https://git.kernel.org/pub/scm/linux/kernel/git/horms/ipvs.git master
config: x86_64-randconfig-s021-20201228 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-215-g0fb77bb6-dirty
        #
https://github.com/0day-ci/linux/commit/be9cab7692382c7886333b498d1d8adbba1881f7
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review
Willem-de-Bruijn/virtio-net-add-tx-hash-rx-tstamp-and-tx-tstamp/20201229-002604
        git checkout be9cab7692382c7886333b498d1d8adbba1881f7
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp at intel.com>
"sparse warnings: (new ones prefixed by >>)"
   drivers/net/virtio_net.c:1099:80: sparse: sparse: incorrect type in argument
1 (different base types) @@     expected unsigned long long [usertype] ns @@    
got restricted __virtio64 [usertype] tstamp @@
   drivers/net/virtio_net.c:1099:80: sparse:     expected unsigned long long
[usertype] ns
   drivers/net/virtio_net.c:1099:80: sparse:     got restricted __virtio64
[usertype] tstamp>> drivers/net/virtio_net.c:1583:33: sparse: sparse: incorrect type in
assignment (different base types) @@     expected restricted __le32 [usertype]
value @@     got restricted __virtio32 @@
   drivers/net/virtio_net.c:1583:33: sparse:     expected restricted __le32
[usertype] value
   drivers/net/virtio_net.c:1583:33: sparse:     got restricted
__virtio32>> drivers/net/virtio_net.c:1584:34: sparse: sparse: incorrect type in
assignment (different base types) @@     expected restricted __le16 [usertype]
report @@     got int @@
   drivers/net/virtio_net.c:1584:34: sparse:     expected restricted __le16
[usertype] report
   drivers/net/virtio_net.c:1584:34: sparse:     got int
vim +1583 drivers/net/virtio_net.c
  1550	
  1551	static int xmit_skb(struct send_queue *sq, struct sk_buff *skb)
  1552	{
  1553		struct virtio_net_hdr_mrg_rxbuf *hdr;
  1554		const unsigned char *dest = ((struct ethhdr *)skb->data)->h_dest;
  1555		struct virtnet_info *vi = sq->vq->vdev->priv;
  1556		struct virtio_net_hdr_v12 *h12;
  1557		int num_sg;
  1558		unsigned hdr_len = vi->hdr_len;
  1559		bool can_push;
  1560	
  1561		pr_debug("%s: xmit %p %pM\n", vi->dev->name, skb, dest);
  1562	
  1563		can_push = vi->any_header_sg &&
  1564			!((unsigned long)skb->data & (__alignof__(*hdr) - 1)) &&
  1565			!skb_header_cloned(skb) && skb_headroom(skb) >= hdr_len;
  1566		/* Even if we can, don't push here yet as this would skew
  1567		 * csum_start offset below. */
  1568		if (can_push)
  1569			hdr = (struct virtio_net_hdr_mrg_rxbuf *)(skb->data - hdr_len);
  1570		else
  1571			hdr = skb_vnet_hdr(skb);
  1572	
  1573		if (virtio_net_hdr_from_skb(skb, &hdr->hdr,
  1574					    virtio_is_little_endian(vi->vdev), false,
  1575					    0))
  1576			BUG();
  1577	
  1578		if (vi->mergeable_rx_bufs)
  1579			hdr->num_buffers = 0;
  1580	
  1581		h12 = (void *)hdr;
  1582		if (vi->has_tx_hash) {> 1583			h12->hash.value = cpu_to_virtio32(vi->vdev, skb->hash);
> 1584			h12->hash.report = skb->l4_hash ? VIRTIO_NET_HASH_REPORT_L4 :
  1585							  VIRTIO_NET_HASH_REPORT_OTHER;
  1586			h12->hash.flow_state = VIRTIO_NET_HASH_STATE_DEFAULT;
  1587		}
  1588		if (vi->has_tx_tstamp)
  1589			h12->tstamp = cpu_to_virtio64(vi->vdev, skb->tstamp);
  1590	
  1591		sg_init_table(sq->sg, skb_shinfo(skb)->nr_frags + (can_push ? 1 :
2));
  1592		if (can_push) {
  1593			__skb_push(skb, hdr_len);
  1594			num_sg = skb_to_sgvec(skb, sq->sg, 0, skb->len);
  1595			if (unlikely(num_sg < 0))
  1596				return num_sg;
  1597			/* Pull header back to avoid skew in tx bytes calculations. */
  1598			__skb_pull(skb, hdr_len);
  1599		} else {
  1600			sg_set_buf(sq->sg, hdr, hdr_len);
  1601			num_sg = skb_to_sgvec(skb, sq->sg + 1, 0, skb->len);
  1602			if (unlikely(num_sg < 0))
  1603				return num_sg;
  1604			num_sg++;
  1605		}
  1606		return virtqueue_add_outbuf(sq->vq, sq->sg, num_sg, skb,
GFP_ATOMIC);
  1607	}
  1608	
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all at lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 34123 bytes
Desc: not available
URL:
<http://lists.linuxfoundation.org/pipermail/virtualization/attachments/20210202/5d1a8a21/attachment-0001.gz>