Skip to contentSkip to conversation

xen-netback: support for control ring

PATCH In review Paul Durrant 3 participants 24 messages May 5, 2016 – May 10, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover xen-netback: support for control ring

My recent patch to import an up-to-date include/xen/interface/io/netif.h from the Xen Project brought in the necessary definitions to support the new control shared ring and protocol. This patch series updates xen-netback to support the new ring.

Patch #1 adds the necessary boilerplate to map the control ring and handle messages. No implementation of the new protocol is included in this patch so that it can be kept to a reasonable size.

Patch #2 adds the protocol implementation.

Patch #3 adds support for passing has values calculated by xen-netback to capable frontends.

Patch #4 adds support for accepting hash values calculated by capable frontends and using them the set the socket buffer hash.

#20 lore raw

PATCH 4/4 xen-netback: use hash value from the frontend

My recent patch to include/xen/interface/io/netif.h defines a new extra info type that can be used to pass hash values between backend and guest frontend.

This patch adds code to xen-netback to use the value in a hash extra info fragment passed from the guest frontend in a transmit-side (i.e. netback receive side) packet to set the skb hash accordingly.

---
 drivers/net/xen-netback/netback.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
drivers/net/xen-netback/netback.c +27 -0
index 7c72510..a5b5aad 100644
@@ -1509,6 +1509,33 @@ static void xenvif_tx_build_gops(struct xenvif_queue *queue,
 			}
 		}
 
+		if (extras[XEN_NETIF_EXTRA_TYPE_HASH - 1].type) {
+			struct xen_netif_extra_info *extra;
+			enum pkt_hash_types type = PKT_HASH_TYPE_NONE;
+
+			extra = &extras[XEN_NETIF_EXTRA_TYPE_HASH - 1];
+
+			switch (extra->u.hash.type) {
+			case _XEN_NETIF_CTRL_HASH_TYPE_IPV4:
+			case _XEN_NETIF_CTRL_HASH_TYPE_IPV6:
+				type = PKT_HASH_TYPE_L3;
+				break;
+
+			case _XEN_NETIF_CTRL_HASH_TYPE_IPV4_TCP:
+			case _XEN_NETIF_CTRL_HASH_TYPE_IPV6_TCP:
+				type = PKT_HASH_TYPE_L4;
+				break;
+
+			default:
+				break;
+			}
+
+			if (type != PKT_HASH_TYPE_NONE)
+				skb_set_hash(skb,
+					     *(u32 *)extra->u.hash.value,
+					     type);
+		}
+
 		XENVIF_TX_CB(skb)->pending_idx = pending_idx;
 
 		__skb_put(skb, data_len);
Signature · 1 line
2.1.4
#23 lore raw

PATCH 4/4 xen-netback: use hash value from the frontend

In reply to Paul Durrant

My recent patch to include/xen/interface/io/netif.h defines a new extra info type that can be used to pass hash values between backend and guest frontend.

This patch adds code to xen-netback to use the value in a hash extra info fragment passed from the guest frontend in a transmit-side (i.e. netback receive side) packet to set the skb hash accordingly.

---
 drivers/net/xen-netback/netback.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
drivers/net/xen-netback/netback.c +27 -0
index 7c72510..a5b5aad 100644
@@ -1509,6 +1509,33 @@ static void xenvif_tx_build_gops(struct xenvif_queue *queue,
 			}
 		}
 
+		if (extras[XEN_NETIF_EXTRA_TYPE_HASH - 1].type) {
+			struct xen_netif_extra_info *extra;
+			enum pkt_hash_types type = PKT_HASH_TYPE_NONE;
+
+			extra = &extras[XEN_NETIF_EXTRA_TYPE_HASH - 1];
+
+			switch (extra->u.hash.type) {
+			case _XEN_NETIF_CTRL_HASH_TYPE_IPV4:
+			case _XEN_NETIF_CTRL_HASH_TYPE_IPV6:
+				type = PKT_HASH_TYPE_L3;
+				break;
+
+			case _XEN_NETIF_CTRL_HASH_TYPE_IPV4_TCP:
+			case _XEN_NETIF_CTRL_HASH_TYPE_IPV6_TCP:
+				type = PKT_HASH_TYPE_L4;
+				break;
+
+			default:
+				break;
+			}
+
+			if (type != PKT_HASH_TYPE_NONE)
+				skb_set_hash(skb,
+					     *(u32 *)extra->u.hash.value,
+					     type);
+		}
+
 		XENVIF_TX_CB(skb)->pending_idx = pending_idx;
 
 		__skb_put(skb, data_len);
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#7 lore raw

PATCH 2/4 xen-netback: add control protocol implementation

In reply to Paul Durrant

My recent patch to include/xen/interface/io/netif.h defines a new shared ring (in addition to the rx and tx rings) for passing control messages from a VM frontend driver to a backend driver.

A previous patch added the necessary boilerplate for mapping the control ring from the frontend, should it be created. This patch adds implementations for each of the defined protocol messages.

---
 drivers/net/xen-netback/Makefile    |   2 +-
 drivers/net/xen-netback/common.h    |  43 +++++
 drivers/net/xen-netback/hash.c      | 361 ++++++++++++++++++++++++++++++++++++
 drivers/net/xen-netback/interface.c |  28 +++
 drivers/net/xen-netback/netback.c   |  49 ++++-
 5 files changed, 480 insertions(+), 3 deletions(-)
 create mode 100644 drivers/net/xen-netback/hash.c
drivers/net/xen-netback/Makefile +1 -1
index e346e81..11e02be 100644
@@ -1,3 +1,3 @@
 obj-$(CONFIG_XEN_NETDEV_BACKEND) := xen-netback.o
 
-xen-netback-y := netback.o xenbus.o interface.o
+xen-netback-y := netback.o xenbus.o interface.o hash.o
drivers/net/xen-netback/common.h +43 -0

65 lines not on this page · raw message

drivers/net/xen-netback/hash.c new file +361 -0

361 lines not on this page · raw message

drivers/net/xen-netback/interface.c +28 -0
index 78a10d2..e54b475 100644
@@ -151,6 +151,24 @@ void xenvif_wake_queue(struct xenvif_queue *queue)
 	netif_tx_wake_queue(netdev_get_tx_queue(dev, id));
 }
 
+static u16 xenvif_select_queue(struct net_device *dev, struct sk_buff *skb,
+			       void *accel_priv,
+			       select_queue_fallback_t fallback)
+{
+	struct xenvif *vif = netdev_priv(dev);
+	unsigned int size = vif->hash.size;
+
+	if (vif->hash.alg == XEN_NETIF_CTRL_HASH_ALGORITHM_NONE)
+		return fallback(dev, skb) % dev->real_num_tx_queues;
+
+	xenvif_set_skb_hash(vif, skb);
+
+	if (size == 0)
+		return skb_get_hash_raw(skb) % dev->real_num_tx_queues;
+
+	return vif->hash.mapping[skb_get_hash_raw(skb) % size];
+}
+
 static int xenvif_start_xmit(struct sk_buff *skb, struct net_device *dev)
 {
 	struct xenvif *vif = netdev_priv(dev);
@@ -395,6 +413,7 @@ static const struct ethtool_ops xenvif_ethtool_ops = {
 };
 
 static const struct net_device_ops xenvif_netdev_ops = {
+	.ndo_select_queue = xenvif_select_queue,
 	.ndo_start_xmit	= xenvif_start_xmit,
 	.ndo_get_stats	= xenvif_get_stats,
 	.ndo_open	= xenvif_open,
@@ -563,6 +582,10 @@ int xenvif_connect_ctrl(struct xenvif *vif, grant_ref_t ring_ref,
 
 	vif->ctrl_irq = err;
 
+	err = xenvif_init_hash(vif);
+	if (err < 0)
+		goto err_unbind;
+
 	task = kthread_create(xenvif_ctrl_kthread, (void *)vif,
 			      "%s-control", dev->name);
 	if (IS_ERR(task)) {
@@ -579,6 +602,9 @@ int xenvif_connect_ctrl(struct xenvif *vif, grant_ref_t ring_ref,
 	return 0;
 
 err_deinit:
+	xenvif_deinit_hash(vif);
+
+err_unbind:
 	unbind_from_irqhandler(vif->ctrl_irq, vif);
 	vif->ctrl_irq = 0;
 
@@ -749,6 +775,8 @@ void xenvif_disconnect_ctrl(struct xenvif *vif)
 		vif->ctrl_task = NULL;
 	}
 
+	xenvif_deinit_hash(vif);
+
 	if (vif->ctrl_irq) {
 		unbind_from_irqhandler(vif->ctrl_irq, vif);
 		vif->ctrl_irq = 0;
drivers/net/xen-netback/netback.c +47 -2

61 lines not on this page · raw message

Signature · 1 line
2.1.4
#16 lore raw

PATCH 3/4 xen-netback: pass hash value to the frontend

In reply to Paul Durrant

My recent patch to include/xen/interface/io/netif.h defines a new extra info type that can be used to pass hash values between backend and guest frontend.

This patch adds code to xen-netback to pass hash values calculated for guest receive-side packets (i.e. netback transmit side) to the frontend.

---
 drivers/net/xen-netback/interface.c | 13 ++++++-
 drivers/net/xen-netback/netback.c   | 78 +++++++++++++++++++++++++++++++------
 2 files changed, 77 insertions(+), 14 deletions(-)
drivers/net/xen-netback/interface.c +11 -2
index e54b475..b2d945f 100644
@@ -158,8 +158,17 @@ static u16 xenvif_select_queue(struct net_device *dev, struct sk_buff *skb,
 	struct xenvif *vif = netdev_priv(dev);
 	unsigned int size = vif->hash.size;
 
-	if (vif->hash.alg == XEN_NETIF_CTRL_HASH_ALGORITHM_NONE)
-		return fallback(dev, skb) % dev->real_num_tx_queues;
+	if (vif->hash.alg == XEN_NETIF_CTRL_HASH_ALGORITHM_NONE) {
+		u16 index = fallback(dev, skb) % dev->real_num_tx_queues;
+
+		/* Make sure there is no hash information in the socket
+		 * buffer otherwise it would be incorrectly forwarded
+		 * to the frontend.
+		 */
+		skb_clear_hash(skb);
+
+		return index;
+	}
 
 	xenvif_set_skb_hash(vif, skb);
 
drivers/net/xen-netback/netback.c +66 -12

135 lines not on this page · raw message

Signature · 1 line
2.1.4
#19 lore raw

PATCH 3/4 xen-netback: pass hash value to the frontend

In reply to Paul Durrant

My recent patch to include/xen/interface/io/netif.h defines a new extra info type that can be used to pass hash values between backend and guest frontend.

This patch adds code to xen-netback to pass hash values calculated for guest receive-side packets (i.e. netback transmit side) to the frontend.

---
 drivers/net/xen-netback/interface.c | 13 ++++++-
 drivers/net/xen-netback/netback.c   | 78 +++++++++++++++++++++++++++++++------
 2 files changed, 77 insertions(+), 14 deletions(-)
drivers/net/xen-netback/interface.c +11 -2
index e54b475..b2d945f 100644
@@ -158,8 +158,17 @@ static u16 xenvif_select_queue(struct net_device *dev, struct sk_buff *skb,
 	struct xenvif *vif = netdev_priv(dev);
 	unsigned int size = vif->hash.size;
 
-	if (vif->hash.alg == XEN_NETIF_CTRL_HASH_ALGORITHM_NONE)
-		return fallback(dev, skb) % dev->real_num_tx_queues;
+	if (vif->hash.alg == XEN_NETIF_CTRL_HASH_ALGORITHM_NONE) {
+		u16 index = fallback(dev, skb) % dev->real_num_tx_queues;
+
+		/* Make sure there is no hash information in the socket
+		 * buffer otherwise it would be incorrectly forwarded
+		 * to the frontend.
+		 */
+		skb_clear_hash(skb);
+
+		return index;
+	}
 
 	xenvif_set_skb_hash(vif, skb);
 
drivers/net/xen-netback/netback.c +66 -12

135 lines not on this page · raw message

Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#15 lore raw

PATCH 2/4 xen-netback: add control protocol implementation

In reply to Paul Durrant

My recent patch to include/xen/interface/io/netif.h defines a new shared ring (in addition to the rx and tx rings) for passing control messages from a VM frontend driver to a backend driver.

A previous patch added the necessary boilerplate for mapping the control ring from the frontend, should it be created. This patch adds implementations for each of the defined protocol messages.

---
 drivers/net/xen-netback/Makefile    |   2 +-
 drivers/net/xen-netback/common.h    |  43 +++++
 drivers/net/xen-netback/hash.c      | 361 ++++++++++++++++++++++++++++++++++++
 drivers/net/xen-netback/interface.c |  28 +++
 drivers/net/xen-netback/netback.c   |  49 ++++-
 5 files changed, 480 insertions(+), 3 deletions(-)
 create mode 100644 drivers/net/xen-netback/hash.c
drivers/net/xen-netback/Makefile +1 -1
index e346e81..11e02be 100644
@@ -1,3 +1,3 @@
 obj-$(CONFIG_XEN_NETDEV_BACKEND) := xen-netback.o
 
-xen-netback-y := netback.o xenbus.o interface.o
+xen-netback-y := netback.o xenbus.o interface.o hash.o
drivers/net/xen-netback/common.h +43 -0

65 lines not on this page · raw message

drivers/net/xen-netback/hash.c new file +361 -0

361 lines not on this page · raw message

drivers/net/xen-netback/interface.c +28 -0
index 78a10d2..e54b475 100644
@@ -151,6 +151,24 @@ void xenvif_wake_queue(struct xenvif_queue *queue)
 	netif_tx_wake_queue(netdev_get_tx_queue(dev, id));
 }
 
+static u16 xenvif_select_queue(struct net_device *dev, struct sk_buff *skb,
+			       void *accel_priv,
+			       select_queue_fallback_t fallback)
+{
+	struct xenvif *vif = netdev_priv(dev);
+	unsigned int size = vif->hash.size;
+
+	if (vif->hash.alg == XEN_NETIF_CTRL_HASH_ALGORITHM_NONE)
+		return fallback(dev, skb) % dev->real_num_tx_queues;
+
+	xenvif_set_skb_hash(vif, skb);
+
+	if (size == 0)
+		return skb_get_hash_raw(skb) % dev->real_num_tx_queues;
+
+	return vif->hash.mapping[skb_get_hash_raw(skb) % size];
+}
+
 static int xenvif_start_xmit(struct sk_buff *skb, struct net_device *dev)
 {
 	struct xenvif *vif = netdev_priv(dev);
@@ -395,6 +413,7 @@ static const struct ethtool_ops xenvif_ethtool_ops = {
 };
 
 static const struct net_device_ops xenvif_netdev_ops = {
+	.ndo_select_queue = xenvif_select_queue,
 	.ndo_start_xmit	= xenvif_start_xmit,
 	.ndo_get_stats	= xenvif_get_stats,
 	.ndo_open	= xenvif_open,
@@ -563,6 +582,10 @@ int xenvif_connect_ctrl(struct xenvif *vif, grant_ref_t ring_ref,
 
 	vif->ctrl_irq = err;
 
+	err = xenvif_init_hash(vif);
+	if (err < 0)
+		goto err_unbind;
+
 	task = kthread_create(xenvif_ctrl_kthread, (void *)vif,
 			      "%s-control", dev->name);
 	if (IS_ERR(task)) {
@@ -579,6 +602,9 @@ int xenvif_connect_ctrl(struct xenvif *vif, grant_ref_t ring_ref,
 	return 0;
 
 err_deinit:
+	xenvif_deinit_hash(vif);
+
+err_unbind:
 	unbind_from_irqhandler(vif->ctrl_irq, vif);
 	vif->ctrl_irq = 0;
 
@@ -749,6 +775,8 @@ void xenvif_disconnect_ctrl(struct xenvif *vif)
 		vif->ctrl_task = NULL;
 	}
 
+	xenvif_deinit_hash(vif);
+
 	if (vif->ctrl_irq) {
 		unbind_from_irqhandler(vif->ctrl_irq, vif);
 		vif->ctrl_irq = 0;
drivers/net/xen-netback/netback.c +47 -2

61 lines not on this page · raw message

Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#1 lore raw

PATCH 1/4 xen-netback: add control ring boilerplate

In reply to Paul Durrant

My recent patch to include/xen/interface/io/netif.h defines a new shared ring (in addition to the rx and tx rings) for passing control messages from a VM frontend driver to a backend driver.

This patch adds the necessary code to xen-netback to map this new shared ring, should it be created by a frontend, but does not add implementations for any of the defined protocol messages. These are added in a subsequent patch for clarity.

---
 drivers/net/xen-netback/common.h    |  28 +++++++---
 drivers/net/xen-netback/interface.c | 101 +++++++++++++++++++++++++++++++++---
 drivers/net/xen-netback/netback.c   |  99 +++++++++++++++++++++++++++++++++--
 drivers/net/xen-netback/xenbus.c    |  75 ++++++++++++++++++++++----
 4 files changed, 273 insertions(+), 30 deletions(-)
drivers/net/xen-netback/common.h +20 -8
index f44b388..093a12a 100644
@@ -260,6 +260,11 @@ struct xenvif {
 	struct dentry *xenvif_dbg_root;
 #endif
 
+	struct xen_netif_ctrl_back_ring ctrl;
+	struct task_struct *ctrl_task;
+	wait_queue_head_t ctrl_wq;
+	unsigned int ctrl_irq;
+
 	/* Miscellaneous private stuff. */
 	struct net_device *dev;
 };
@@ -285,10 +290,15 @@ struct xenvif *xenvif_alloc(struct device *parent,
 int xenvif_init_queue(struct xenvif_queue *queue);
 void xenvif_deinit_queue(struct xenvif_queue *queue);
 
-int xenvif_connect(struct xenvif_queue *queue, unsigned long tx_ring_ref,
-		   unsigned long rx_ring_ref, unsigned int tx_evtchn,
-		   unsigned int rx_evtchn);
-void xenvif_disconnect(struct xenvif *vif);
+int xenvif_connect_data(struct xenvif_queue *queue,
+			unsigned long tx_ring_ref,
+			unsigned long rx_ring_ref,
+			unsigned int tx_evtchn,
+			unsigned int rx_evtchn);
+void xenvif_disconnect_data(struct xenvif *vif);
+int xenvif_connect_ctrl(struct xenvif *vif, grant_ref_t ring_ref,
+			unsigned int evtchn);
+void xenvif_disconnect_ctrl(struct xenvif *vif);
 void xenvif_free(struct xenvif *vif);
 
 int xenvif_xenbus_init(void);
@@ -300,10 +310,10 @@ int xenvif_queue_stopped(struct xenvif_queue *queue);
 void xenvif_wake_queue(struct xenvif_queue *queue);
 
 /* (Un)Map communication rings. */
-void xenvif_unmap_frontend_rings(struct xenvif_queue *queue);
-int xenvif_map_frontend_rings(struct xenvif_queue *queue,
-			      grant_ref_t tx_ring_ref,
-			      grant_ref_t rx_ring_ref);
+void xenvif_unmap_frontend_data_rings(struct xenvif_queue *queue);
+int xenvif_map_frontend_data_rings(struct xenvif_queue *queue,
+				   grant_ref_t tx_ring_ref,
+				   grant_ref_t rx_ring_ref);
 
 /* Check for SKBs from frontend and schedule backend processing */
 void xenvif_napi_schedule_or_enable_events(struct xenvif_queue *queue);
@@ -318,6 +328,8 @@ void xenvif_kick_thread(struct xenvif_queue *queue);
 
 int xenvif_dealloc_kthread(void *data);
 
+int xenvif_ctrl_kthread(void *data);
+
 void xenvif_rx_queue_tail(struct xenvif_queue *queue, struct sk_buff *skb);
 
 void xenvif_carrier_on(struct xenvif *vif);
drivers/net/xen-netback/interface.c +94 -7

142 lines not on this page · raw message

drivers/net/xen-netback/netback.c +94 -5

123 lines not on this page · raw message

drivers/net/xen-netback/xenbus.c +65 -10

131 lines not on this page · raw message

Signature · 1 line
2.1.4
#6 lore raw

PATCH 1/4 xen-netback: add control ring boilerplate

In reply to Paul Durrant

My recent patch to include/xen/interface/io/netif.h defines a new shared ring (in addition to the rx and tx rings) for passing control messages from a VM frontend driver to a backend driver.

This patch adds the necessary code to xen-netback to map this new shared ring, should it be created by a frontend, but does not add implementations for any of the defined protocol messages. These are added in a subsequent patch for clarity.

---
 drivers/net/xen-netback/common.h    |  28 +++++++---
 drivers/net/xen-netback/interface.c | 101 +++++++++++++++++++++++++++++++++---
 drivers/net/xen-netback/netback.c   |  99 +++++++++++++++++++++++++++++++++--
 drivers/net/xen-netback/xenbus.c    |  75 ++++++++++++++++++++++----
 4 files changed, 273 insertions(+), 30 deletions(-)
drivers/net/xen-netback/common.h +20 -8
index f44b388..093a12a 100644
@@ -260,6 +260,11 @@ struct xenvif {
 	struct dentry *xenvif_dbg_root;
 #endif
 
+	struct xen_netif_ctrl_back_ring ctrl;
+	struct task_struct *ctrl_task;
+	wait_queue_head_t ctrl_wq;
+	unsigned int ctrl_irq;
+
 	/* Miscellaneous private stuff. */
 	struct net_device *dev;
 };
@@ -285,10 +290,15 @@ struct xenvif *xenvif_alloc(struct device *parent,
 int xenvif_init_queue(struct xenvif_queue *queue);
 void xenvif_deinit_queue(struct xenvif_queue *queue);
 
-int xenvif_connect(struct xenvif_queue *queue, unsigned long tx_ring_ref,
-		   unsigned long rx_ring_ref, unsigned int tx_evtchn,
-		   unsigned int rx_evtchn);
-void xenvif_disconnect(struct xenvif *vif);
+int xenvif_connect_data(struct xenvif_queue *queue,
+			unsigned long tx_ring_ref,
+			unsigned long rx_ring_ref,
+			unsigned int tx_evtchn,
+			unsigned int rx_evtchn);
+void xenvif_disconnect_data(struct xenvif *vif);
+int xenvif_connect_ctrl(struct xenvif *vif, grant_ref_t ring_ref,
+			unsigned int evtchn);
+void xenvif_disconnect_ctrl(struct xenvif *vif);
 void xenvif_free(struct xenvif *vif);
 
 int xenvif_xenbus_init(void);
@@ -300,10 +310,10 @@ int xenvif_queue_stopped(struct xenvif_queue *queue);
 void xenvif_wake_queue(struct xenvif_queue *queue);
 
 /* (Un)Map communication rings. */
-void xenvif_unmap_frontend_rings(struct xenvif_queue *queue);
-int xenvif_map_frontend_rings(struct xenvif_queue *queue,
-			      grant_ref_t tx_ring_ref,
-			      grant_ref_t rx_ring_ref);
+void xenvif_unmap_frontend_data_rings(struct xenvif_queue *queue);
+int xenvif_map_frontend_data_rings(struct xenvif_queue *queue,
+				   grant_ref_t tx_ring_ref,
+				   grant_ref_t rx_ring_ref);
 
 /* Check for SKBs from frontend and schedule backend processing */
 void xenvif_napi_schedule_or_enable_events(struct xenvif_queue *queue);
@@ -318,6 +328,8 @@ void xenvif_kick_thread(struct xenvif_queue *queue);
 
 int xenvif_dealloc_kthread(void *data);
 
+int xenvif_ctrl_kthread(void *data);
+
 void xenvif_rx_queue_tail(struct xenvif_queue *queue, struct sk_buff *skb);
 
 void xenvif_carrier_on(struct xenvif *vif);
drivers/net/xen-netback/interface.c +94 -7

142 lines not on this page · raw message

drivers/net/xen-netback/netback.c +94 -5

123 lines not on this page · raw message

drivers/net/xen-netback/xenbus.c +65 -10

131 lines not on this page · raw message

Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
maintainer
#8 lore raw

Re: [PATCH net-next 2/4] xen-netback: add control protocol implementation

In reply to Paul Durrant

From: Paul Durrant <[email protected]>
Date: Thu, 5 May 2016 12:19:28 +0100

drivers/net/xen-netback/common.h struct xenvif_mcast_addr { · line 235

Quoted 2 lines
drivers/net/xen-netback/common.h +2 -0
+struct xenvif_hash_cache {
+	rwlock_t lock;

You really don't want to lock on every SKB hash computation like this, turn this into a spin lock for locking the write side and use RCU locking for lookup and usage.

THanks.

maintainer
#10 lore raw

Re: [PATCH net-next 2/4] xen-netback: add control protocol implementation

In reply to Paul Durrant

From: Paul Durrant <[email protected]>
Date: Thu, 5 May 2016 12:19:28 +0100

drivers/net/xen-netback/common.h struct xenvif_mcast_addr { · line 235

Quoted 2 lines
drivers/net/xen-netback/common.h +2 -0
+struct xenvif_hash_cache {
+	rwlock_t lock;

You really don't want to lock on every SKB hash computation like this, turn this into a spin lock for locking the write side and use RCU locking for lookup and usage.

THanks.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#9 lore raw

Re: [PATCH net-next 2/4] xen-netback: add control protocol implementation

In reply to David Miller
Quoted 11 lines

-----Original Message-----
From: David Miller [mailto:[email protected]]
Sent: 07 May 2016 20:09
To: Paul Durrant
Cc: [email protected]; [email protected]; Wei Liu
Subject: Re: [PATCH net-next 2/4] xen-netback: add control protocol implementation

From: Paul Durrant <[email protected]>
Date: Thu, 5 May 2016 12:19:28 +0100

Quoted 7 lines

drivers/net/xen-netback/common.h struct xenvif_mcast_addr { · line 235

Quoted 2 lines
drivers/net/xen-netback/common.h +2 -0
+struct xenvif_hash_cache {
+	rwlock_t lock;

You really don't want to lock on every SKB hash computation like this, turn this into a spin lock for locking the write side and use RCU locking for lookup and usage.

Yes, that would be better. Will do.

Cheers,

Paul

Quoted 1 line

THanks.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#2 lore raw

Re: [PATCH net-next 1/4] xen-netback: add control ring boilerplate

In reply to Paul Durrant

On Thu, May 05, 2016 at 12:19:27PM +0100, Paul Durrant wrote:
[...]

drivers/net/xen-netback/xenbus.c static void hotplug_status_changed(struct xenbus_watch *watch, · line 837

Quoted 3 lines
drivers/net/xen-netback/xenbus.c +2 -0
+static int connect_ctrl_ring(struct backend_info *be)
+{

Please use goto style error handling in this function.

Other than this the code looks good.

Wei.

#11 lore raw

Re: [PATCH net-next 2/4] xen-netback: add control protocol implementation

In reply to Paul Durrant
Quoted 10 lines · Paul Durrant

My recent patch to include/xen/interface/io/netif.h defines a new shared ring (in addition to the rx and tx rings) for passing control messages from a VM frontend driver to a backend driver.

A previous patch added the necessary boilerplate for mapping the control ring from the frontend, should it be created. This patch adds implementations for each of the defined protocol messages.

Quoted 9 lines
---
 drivers/net/xen-netback/Makefile    |   2 +-
 drivers/net/xen-netback/common.h    |  43 +++++
 drivers/net/xen-netback/hash.c      | 361 ++++++++++++++++++++++++++++++++++++
 drivers/net/xen-netback/interface.c |  28 +++
 drivers/net/xen-netback/netback.c   |  49 ++++-
 5 files changed, 480 insertions(+), 3 deletions(-)
 create mode 100644 drivers/net/xen-netback/hash.c

Other than the issue mentioned by David, the code looks OK to me.

Wei.

Acked-by on v1 4/4
#21 lore raw

Re: [PATCH net-next 4/4] xen-netback: use hash value from the frontend

In reply to Paul Durrant
Quoted 10 lines · Paul Durrant

My recent patch to include/xen/interface/io/netif.h defines a new extra info type that can be used to pass hash values between backend and guest frontend.

This patch adds code to xen-netback to use the value in a hash extra info fragment passed from the guest frontend in a transmit-side (i.e. netback receive side) packet to set the skb hash accordingly.

#5 lore raw

Re: [PATCH net-next 1/4] xen-netback: add control ring boilerplate

In reply to Paul Durrant

On Thu, May 05, 2016 at 12:19:27PM +0100, Paul Durrant wrote:
[...]

drivers/net/xen-netback/xenbus.c static void hotplug_status_changed(struct xenbus_watch *watch, · line 837

Quoted 3 lines
drivers/net/xen-netback/xenbus.c +2 -0
+static int connect_ctrl_ring(struct backend_info *be)
+{

Please use goto style error handling in this function.

Other than this the code looks good.

Wei.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#14 lore raw

Re: [PATCH net-next 2/4] xen-netback: add control protocol implementation

In reply to Paul Durrant
Quoted 10 lines · Paul Durrant

My recent patch to include/xen/interface/io/netif.h defines a new shared ring (in addition to the rx and tx rings) for passing control messages from a VM frontend driver to a backend driver.

A previous patch added the necessary boilerplate for mapping the control ring from the frontend, should it be created. This patch adds implementations for each of the defined protocol messages.

Quoted 9 lines
---
 drivers/net/xen-netback/Makefile    |   2 +-
 drivers/net/xen-netback/common.h    |  43 +++++
 drivers/net/xen-netback/hash.c      | 361 ++++++++++++++++++++++++++++++++++++
 drivers/net/xen-netback/interface.c |  28 +++
 drivers/net/xen-netback/netback.c   |  49 ++++-
 5 files changed, 480 insertions(+), 3 deletions(-)
 create mode 100644 drivers/net/xen-netback/hash.c

Other than the issue mentioned by David, the code looks OK to me.

Wei.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

Acked-by on v1 3/4
#17 lore raw

Re: [PATCH net-next 3/4] xen-netback: pass hash value to the frontend

In reply to Paul Durrant
Quoted 9 lines · Paul Durrant

My recent patch to include/xen/interface/io/netif.h defines a new extra info type that can be used to pass hash values between backend and guest frontend.

This patch adds code to xen-netback to pass hash values calculated for guest receive-side packets (i.e. netback transmit side) to the frontend.

Acked-by on v1 3/4
#18 lore raw

Re: [PATCH net-next 3/4] xen-netback: pass hash value to the frontend

In reply to Paul Durrant
Quoted 9 lines · Paul Durrant

My recent patch to include/xen/interface/io/netif.h defines a new extra info type that can be used to pass hash values between backend and guest frontend.

This patch adds code to xen-netback to pass hash values calculated for guest receive-side packets (i.e. netback transmit side) to the frontend.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

Acked-by on v1 4/4
#22 lore raw

Re: [PATCH net-next 4/4] xen-netback: use hash value from the frontend

In reply to Paul Durrant
Quoted 10 lines · Paul Durrant

My recent patch to include/xen/interface/io/netif.h defines a new extra info type that can be used to pass hash values between backend and guest frontend.

This patch adds code to xen-netback to use the value in a hash extra info fragment passed from the guest frontend in a transmit-side (i.e. netback receive side) packet to set the skb hash accordingly.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#12 lore raw

Re: [PATCH net-next 2/4] xen-netback: add control protocol implementation

In reply to Wei Liu
Quoted 23 lines

-----Original Message-----
From: Wei Liu [mailto:[email protected]]
Sent: 10 May 2016 14:29
To: Paul Durrant
Cc: [email protected]; [email protected]; Wei Liu
Subject: Re: [PATCH net-next 2/4] xen-netback: add control protocol implementation

Quoted 8 lines · Paul Durrant

My recent patch to include/xen/interface/io/netif.h defines a new shared ring (in addition to the rx and tx rings) for passing control messages from a VM frontend driver to a backend driver.

A previous patch added the necessary boilerplate for mapping the control ring from the frontend, should it be created. This patch adds implementations for each of the defined protocol messages.

Quoted 6 lines
---
 drivers/net/xen-netback/Makefile    |   2 +-
 drivers/net/xen-netback/common.h    |  43 +++++
 drivers/net/xen-netback/hash.c      | 361
Quoted 9 lines

++++++++++++++++++++++++++++++++++++

Quoted 5 lines
 drivers/net/xen-netback/interface.c |  28 +++
 drivers/net/xen-netback/netback.c   |  49 ++++-
 5 files changed, 480 insertions(+), 3 deletions(-)
 create mode 100644 drivers/net/xen-netback/hash.c

Other than the issue mentioned by David, the code looks OK to me.

Cool, thanks. I should have the RCU-based hash code done in the next day or so.

Paul

Quoted 1 line

Wei.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#13 lore raw

RE: [PATCH net-next 2/4] xen-netback: add control protocol implementation

In reply to Wei Liu
Quoted 23 lines

-----Original Message-----
From: Wei Liu [mailto:[email protected]]
Sent: 10 May 2016 14:29
To: Paul Durrant
Cc: [email protected]; [email protected]; Wei Liu
Subject: Re: [PATCH net-next 2/4] xen-netback: add control protocol implementation

Quoted 8 lines · Paul Durrant

My recent patch to include/xen/interface/io/netif.h defines a new shared ring (in addition to the rx and tx rings) for passing control messages from a VM frontend driver to a backend driver.

A previous patch added the necessary boilerplate for mapping the control ring from the frontend, should it be created. This patch adds implementations for each of the defined protocol messages.

Quoted 6 lines
---
 drivers/net/xen-netback/Makefile    |   2 +-
 drivers/net/xen-netback/common.h    |  43 +++++
 drivers/net/xen-netback/hash.c      | 361
Quoted 9 lines

++++++++++++++++++++++++++++++++++++

Quoted 5 lines
 drivers/net/xen-netback/interface.c |  28 +++
 drivers/net/xen-netback/netback.c   |  49 ++++-
 5 files changed, 480 insertions(+), 3 deletions(-)
 create mode 100644 drivers/net/xen-netback/hash.c

Other than the issue mentioned by David, the code looks OK to me.

Cool, thanks. I should have the RCU-based hash code done in the next day or so.

Paul

Quoted 1 line

Wei.

#3 lore raw

RE: [PATCH net-next 1/4] xen-netback: add control ring boilerplate

In reply to Wei Liu
Quoted 7 lines

-----Original Message-----
From: Wei Liu [mailto:[email protected]]
Sent: 10 May 2016 14:29
To: Paul Durrant
Cc: [email protected]; [email protected]; Wei Liu
Subject: Re: [PATCH net-next 1/4] xen-netback: add control ring boilerplate

Quoted 8 lines

On Thu, May 05, 2016 at 12:19:27PM +0100, Paul Durrant wrote:
[...]

drivers/net/xen-netback/xenbus.c static void hotplug_status_changed(struct xenbus_watch *watch, · line 837

Quoted 3 lines
drivers/net/xen-netback/xenbus.c +2 -0
+static int connect_ctrl_ring(struct backend_info *be)
+{

Please use goto style error handling in this function.

Will do.

Quoted 2 lines

Other than this the code looks good.

Thanks,

Paul

Quoted 1 line

Wei.

#4 lore raw

Re: [PATCH net-next 1/4] xen-netback: add control ring boilerplate

In reply to Wei Liu
Quoted 7 lines

-----Original Message-----
From: Wei Liu [mailto:[email protected]]
Sent: 10 May 2016 14:29
To: Paul Durrant
Cc: [email protected]; [email protected]; Wei Liu
Subject: Re: [PATCH net-next 1/4] xen-netback: add control ring boilerplate

Quoted 8 lines

On Thu, May 05, 2016 at 12:19:27PM +0100, Paul Durrant wrote:
[...]

drivers/net/xen-netback/xenbus.c static void hotplug_status_changed(struct xenbus_watch *watch, · line 837

Quoted 3 lines
drivers/net/xen-netback/xenbus.c +2 -0
+static int connect_ctrl_ring(struct backend_info *be)
+{

Please use goto style error handling in this function.

Will do.

Quoted 2 lines

Other than this the code looks good.

Thanks,

Paul

Quoted 1 line

Wei.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel