WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Restrict netfront to 256 grant references to avoid

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Restrict netfront to 256 grant references to avoid
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 14 Apr 2006 17:00:17 +0000
Delivery-date: Fri, 14 Apr 2006 10:02:29 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 176302fe4dfb47bf5f4c74c26ea00e1a90726770
# Parent  b36a43b9d9b55cd8bae08b4b72dc369c5ab6862d
Restrict netfront to 256 grant references to avoid
exhausting the global pool.

Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>

diff -r b36a43b9d9b5 -r 176302fe4dfb 
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Fri Apr 14 
14:05:04 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Fri Apr 14 
14:05:28 2006
@@ -106,7 +106,7 @@
        /* Receive-ring batched refills. */
 #define RX_MIN_TARGET 8
 #define RX_DFL_MIN_TARGET 64
-#define RX_MAX_TARGET NET_RX_RING_SIZE
+#define RX_MAX_TARGET min_t(int, NET_RX_RING_SIZE, 256)
        int rx_min_target, rx_max_target, rx_target;
        struct sk_buff_head rx_batch;
 
@@ -119,6 +119,7 @@
        struct sk_buff *tx_skbs[NET_TX_RING_SIZE+1];
        struct sk_buff *rx_skbs[NET_RX_RING_SIZE+1];
 
+#define TX_MAX_TARGET min_t(int, NET_RX_RING_SIZE, 256)
        grant_ref_t gref_tx_head;
        grant_ref_t grant_tx_ref[NET_TX_RING_SIZE + 1];
        grant_ref_t gref_rx_head;
@@ -505,8 +506,9 @@
        } while (prod != np->tx.sring->rsp_prod);
 
  out:
-       if (np->tx_full &&
-           ((np->tx.sring->req_prod - prod) < NET_TX_RING_SIZE)) {
+       if ((np->tx_full) &&
+           ((np->tx.sring->req_prod - prod) < NET_TX_RING_SIZE) &&
+           !gnttab_empty_grant_references(&np->gref_tx_head)) {
                np->tx_full = 0;
                if (np->user_state == UST_OPEN)
                        netif_wake_queue(dev);
@@ -705,7 +707,8 @@
 
        network_tx_buf_gc(dev);
 
-       if (RING_FULL(&np->tx)) {
+       if (RING_FULL(&np->tx) ||
+           gnttab_empty_grant_references(&np->gref_tx_head)) {
                np->tx_full = 1;
                netif_stop_queue(dev);
        }
@@ -1140,14 +1143,14 @@
        }
 
        /* A grant for every tx ring slot */
-       if (gnttab_alloc_grant_references(NET_TX_RING_SIZE,
+       if (gnttab_alloc_grant_references(TX_MAX_TARGET,
                                          &np->gref_tx_head) < 0) {
                printk(KERN_ALERT "#### netfront can't alloc tx grant refs\n");
                err = -ENOMEM;
                goto exit;
        }
        /* A grant for every rx ring slot */
-       if (gnttab_alloc_grant_references(NET_RX_RING_SIZE,
+       if (gnttab_alloc_grant_references(RX_MAX_TARGET,
                                          &np->gref_rx_head) < 0) {
                printk(KERN_ALERT "#### netfront can't alloc rx grant refs\n");
                gnttab_free_grant_references(np->gref_tx_head);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Restrict netfront to 256 grant references to avoid, Xen patchbot -unstable <=