xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC V2] xen/netback: Count ring slots properly when larger MTU sizes are used
@ 2012-08-29 12:21 Palagummi, Siva
  2012-08-30  8:07 ` Ian Campbell
  0 siblings, 1 reply; 16+ messages in thread
From: Palagummi, Siva @ 2012-08-29 12:21 UTC (permalink / raw)
  To: Ian Campbell; +Cc: xen-devel@lists.xen.org


[-- Attachment #1.1: Type: text/plain, Size: 492 bytes --]

This patch contains the modifications that are discussed in thread http://lists.xen.org/archives/html/xen-devel/2012-08/msg01730.html

Ian,
Instead of using max_required_rx_slots, I used the count that we already have in hand to verify if we have enough room in the batch queue for next skb. Please let me know if that is not appropriate. Things worked fine in my environment. Under heavy load now we seems to be consuming most of the slots in the queue and no BUG_ON :-)

Thanks
Siva

[-- Attachment #1.2: Type: text/html, Size: 5808 bytes --]

[-- Attachment #2: netback_slots_counting_v2.patch --]
[-- Type: application/octet-stream, Size: 2462 bytes --]

From: Siva Palagummi <Siva.Palagummi@ca.com>

count variable in xen_netbk_rx_action need to be incremented
correctly to take into account of extra slots required when skb_headlen is 
greater than PAGE_SIZE when larger MTU values are used. Without this change
BUG_ON(npo.meta_prod > ARRAY_SIZE(netbk->meta)) is causing netback thread 
to exit.

The fix is to stash the counting already done in xen_netbk_count_skb_slots
in skb_cb_overlay and use it directly in xen_netbk_rx_action.

Also improved the checking for filling the batch queue. 

Also merged a change from a patch created for xen_netbk_count_skb_slots 
function as per thread 
http://lists.xen.org/archives/html/xen-devel/2012-05/msg01864.html

The problem is seen with linux 3.2.2 kernel on Intel 10Gbps network


Signed-off-by: Siva Palagummi <Siva.Palagummi@ca.com>
---
diff -uprN a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
--- a/drivers/net/xen-netback/netback.c	2012-01-25 19:39:32.000000000 -0500
+++ b/drivers/net/xen-netback/netback.c	2012-08-28 17:31:22.000000000 -0400
@@ -80,6 +80,11 @@ union page_ext {
 	void *mapping;
 };
 
+struct skb_cb_overlay {
+	int meta_slots_used;
+	int count;
+};
+
 struct xen_netbk {
 	wait_queue_head_t wq;
 	struct task_struct *task;
@@ -324,9 +329,9 @@ unsigned int xen_netbk_count_skb_slots(s
 {
 	unsigned int count;
 	int i, copy_off;
+	struct skb_cb_overlay *sco;
 
-	count = DIV_ROUND_UP(
-			offset_in_page(skb->data)+skb_headlen(skb), PAGE_SIZE);
+	count = DIV_ROUND_UP(skb_headlen(skb), PAGE_SIZE);
 
 	copy_off = skb_headlen(skb) % PAGE_SIZE;
 
@@ -352,6 +357,8 @@ unsigned int xen_netbk_count_skb_slots(s
 			size -= bytes;
 		}
 	}
+	sco = (struct skb_cb_overlay *)skb->cb;
+	sco->count = count;
 	return count;
 }
 
@@ -586,9 +593,6 @@ static void netbk_add_frag_responses(str
 	}
 }
 
-struct skb_cb_overlay {
-	int meta_slots_used;
-};
 
 static void xen_netbk_rx_action(struct xen_netbk *netbk)
 {
@@ -621,12 +625,16 @@ static void xen_netbk_rx_action(struct x
 		sco = (struct skb_cb_overlay *)skb->cb;
 		sco->meta_slots_used = netbk_gop_skb(skb, &npo);
 
-		count += nr_frags + 1;
+		count += sco->count;
 
 		__skb_queue_tail(&rxq, skb);
 
+		skb = skb_peek(&netbk->rx_queue);
+		if (skb == NULL)
+			break;
+		sco = (struct skb_cb_overlay *)skb->cb;
 		/* Filled the batch queue? */
-		if (count + MAX_SKB_FRAGS >= XEN_NETIF_RX_RING_SIZE)
+		if (count + sco->count >= XEN_NETIF_RX_RING_SIZE)
 			break;
 	}
 

[-- Attachment #3: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2012-12-20 21:42 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-29 12:21 [PATCH RFC V2] xen/netback: Count ring slots properly when larger MTU sizes are used Palagummi, Siva
2012-08-30  8:07 ` Ian Campbell
2012-08-30 10:26   ` Palagummi, Siva
2012-12-04 23:23   ` Matt Wilson
2012-12-05 11:56     ` Palagummi, Siva
2012-12-06  5:35       ` Matt Wilson
2012-12-11 10:25         ` Palagummi, Siva
2012-12-11 21:34           ` Matt Wilson
2012-12-13 23:12             ` Palagummi, Siva
2012-12-14 18:53               ` Matt Wilson
2012-12-17 11:26                 ` Ian Campbell
2012-12-17 20:09                   ` Matt Wilson
2012-12-18 10:02                     ` Ian Campbell
2012-12-18 19:43                       ` Matt Wilson
2012-12-20 10:05                         ` Ian Campbell
2012-12-20 21:42                           ` Matt Wilson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).