aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/xen-netback/common.h
diff options
context:
space:
mode:
authorZoltan Kiss <zoltan.kiss@citrix.com>2014-08-04 11:20:58 -0400
committerDavid S. Miller <davem@davemloft.net>2014-08-05 19:04:46 -0400
commitf34a4cf9c9b4fd35ba7f9a596cedb011879a1a4d (patch)
tree00be3a0233299ae75e9ab75ca4940cdea15fb6d9 /drivers/net/xen-netback/common.h
parent3d1af1df9762e56e563e8fd088a1b4ce2bcfaf8b (diff)
xen-netback: Turn off the carrier if the guest is not able to receive
Currently when the guest is not able to receive more packets, qdisc layer starts a timer, and when it goes off, qdisc is started again to deliver a packet again. This is a very slow way to drain the queues, consumes unnecessary resources and slows down other guests shutdown. This patch change the behaviour by turning the carrier off when that timer fires, so all the packets are freed up which were stucked waiting for that vif. Instead of the rx_queue_purge bool it uses the VIF_STATUS_RX_PURGE_EVENT bit to signal the thread that either the timeout happened or an RX interrupt arrived, so the thread can check what it should do. It also disables NAPI, so the guest can't transmit, but leaves the interrupts on, so it can resurrect. Only the queues which brought down the interface can enable it again, the bit QUEUE_STATUS_RX_STALLED makes sure of that. Signed-off-by: Zoltan Kiss <zoltan.kiss@citrix.com> Signed-off-by: David Vrabel <david.vrabel@citrix.com> Cc: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: xen-devel@lists.xenproject.org Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/xen-netback/common.h')
-rw-r--r--drivers/net/xen-netback/common.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/net/xen-netback/common.h b/drivers/net/xen-netback/common.h
index 4a92fc19f410..ef3026f46a37 100644
--- a/drivers/net/xen-netback/common.h
+++ b/drivers/net/xen-netback/common.h
@@ -176,9 +176,9 @@ struct xenvif_queue { /* Per-queue data for xenvif */
176 struct xen_netif_rx_back_ring rx; 176 struct xen_netif_rx_back_ring rx;
177 struct sk_buff_head rx_queue; 177 struct sk_buff_head rx_queue;
178 RING_IDX rx_last_skb_slots; 178 RING_IDX rx_last_skb_slots;
179 bool rx_queue_purge; 179 unsigned long status;
180 180
181 struct timer_list wake_queue; 181 struct timer_list rx_stalled;
182 182
183 struct gnttab_copy grant_copy_op[MAX_GRANT_COPY_OPS]; 183 struct gnttab_copy grant_copy_op[MAX_GRANT_COPY_OPS];
184 184
@@ -200,7 +200,16 @@ struct xenvif_queue { /* Per-queue data for xenvif */
200 200
201enum state_bit_shift { 201enum state_bit_shift {
202 /* This bit marks that the vif is connected */ 202 /* This bit marks that the vif is connected */
203 VIF_STATUS_CONNECTED 203 VIF_STATUS_CONNECTED,
204 /* This bit signals the RX thread that queuing was stopped (in
205 * start_xmit), and either the timer fired or an RX interrupt came
206 */
207 QUEUE_STATUS_RX_PURGE_EVENT,
208 /* This bit tells the interrupt handler that this queue was the reason
209 * for the carrier off, so it should kick the thread. Only queues which
210 * brought it down can turn on the carrier.
211 */
212 QUEUE_STATUS_RX_STALLED
204}; 213};
205 214
206struct xenvif { 215struct xenvif {