Skip to contentSkip to conversation

xen-netback: making the bandwidth limiter runtime settable

PATCH Applied Imre Palik 3 participants 5 messages Mar 19, 2015 – Mar 20, 2015

Subsystems (3)
lore
Share & tools
lore

Imre Palik

author
#0 lore raw

PATCH v2 1/1 xen-netback: making the bandwidth limiter runtime settable

From: "Palik, Imre" <[email protected]>

With the current netback, the bandwidth limiter's parameters are only settable during vif setup time. This patch register a watch on them, and thus makes them runtime changeable.

When the watch fires, the timer is reset. The timer's mutex is used for fencing the change.

Cc Anthony Liguori <[email protected]>
---
 drivers/net/xen-netback/common.h    |    4 +++
 drivers/net/xen-netback/interface.c |    1 +
 drivers/net/xen-netback/netback.c   |    4 +--
 drivers/net/xen-netback/xenbus.c    |   57 +++++++++++++++++++++++++++++++++++
 4 files changed, 63 insertions(+), 3 deletions(-)
drivers/net/xen-netback/common.h +4 -0
index 589fa25..8a495b3 100644
@@ -238,6 +238,8 @@ struct xenvif {
 	unsigned int num_queues; /* active queues, resource allocated */
 	unsigned int stalled_queues;
 
+	struct xenbus_watch credit_watch;
+
 	spinlock_t lock;
 
 #ifdef CONFIG_DEBUG_FS
@@ -260,6 +262,8 @@ static inline struct xenbus_device *xenvif_to_xenbus_device(struct xenvif *vif)
 	return to_xenbus_device(vif->dev->dev.parent);
 }
 
+void xenvif_tx_credit_callback(unsigned long data);
+
 struct xenvif *xenvif_alloc(struct device *parent,
 			    domid_t domid,
 			    unsigned int handle);
drivers/net/xen-netback/interface.c +1 -0
index 3aa8648..34d8038 100644
@@ -463,6 +463,7 @@ int xenvif_init_queue(struct xenvif_queue *queue)
 	queue->credit_bytes = queue->remaining_credit = ~0UL;
 	queue->credit_usec  = 0UL;
 	init_timer(&queue->credit_timeout);
+	queue->credit_timeout.function = xenvif_tx_credit_callback;
 	queue->credit_window_start = get_jiffies_64();
 
 	queue->rx_queue_max = XENVIF_RX_QUEUE_BYTES;
drivers/net/xen-netback/netback.c +1 -3
index cab9f52..2c25e8e 100644
@@ -641,7 +641,7 @@ static void tx_add_credit(struct xenvif_queue *queue)
 	queue->remaining_credit = min(max_credit, max_burst);
 }
 
-static void tx_credit_callback(unsigned long data)
+void xenvif_tx_credit_callback(unsigned long data)
 {
 	struct xenvif_queue *queue = (struct xenvif_queue *)data;
 	tx_add_credit(queue);
@@ -1169,8 +1169,6 @@ static bool tx_credit_exceeded(struct xenvif_queue *queue, unsigned size)
 	if (size > queue->remaining_credit) {
 		queue->credit_timeout.data     =
 			(unsigned long)queue;
-		queue->credit_timeout.function =
-			tx_credit_callback;
 		mod_timer(&queue->credit_timeout,
 			  next_credit);
 		queue->credit_window_start = next_credit;
drivers/net/xen-netback/xenbus.c +57 -0

87 lines not on this page · raw message

Signature · 1 line
1.7.9.5
Acked-by on v2 1/1
#1 lore raw
Quoted 11 lines · Imre Palik

From: "Palik, Imre" <[email protected]>

With the current netback, the bandwidth limiter's parameters are only settable during vif setup time. This patch register a watch on them, and thus makes them runtime changeable.

When the watch fires, the timer is reset. The timer's mutex is used for fencing the change.

Cc Anthony Liguori <[email protected]>
Acked-by on v2 1/1
#2 lore raw
In reply to Imre Palik
Quoted 11 lines · Imre Palik

From: "Palik, Imre" <[email protected]>

With the current netback, the bandwidth limiter's parameters are only settable during vif setup time. This patch register a watch on them, and thus makes them runtime changeable.

When the watch fires, the timer is reset. The timer's mutex is used for fencing the change.

Cc Anthony Liguori <[email protected]>
maintainer Applied
#3 lore raw
In reply to Imre Palik

From: Imre Palik <[email protected]>
Date: Thu, 19 Mar 2015 11:05:42 +0100

Quoted 11 lines

From: "Palik, Imre" <[email protected]>

With the current netback, the bandwidth limiter's parameters are only settable during vif setup time. This patch register a watch on them, and thus makes them runtime changeable.

When the watch fires, the timer is reset. The timer's mutex is used for fencing the change.

Cc Anthony Liguori <[email protected]>

Applied to net-next, thanks.

maintainer Applied
#4 lore raw
In reply to Imre Palik

From: Imre Palik <[email protected]>
Date: Thu, 19 Mar 2015 11:05:42 +0100

Quoted 11 lines

From: "Palik, Imre" <[email protected]>

With the current netback, the bandwidth limiter's parameters are only settable during vif setup time. This patch register a watch on them, and thus makes them runtime changeable.

When the watch fires, the timer is reset. The timer's mutex is used for fencing the change.

Cc Anthony Liguori <[email protected]>

Applied to net-next, thanks.