From: Herbert Xu Subject: Re: [PATCH][RFC] correction trouble of short message in UDP Date: Fri, 26 Jan 2007 01:17:19 +1100 Message-ID: <20070125141719.GA13992@gondor.apana.org.au> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Keir Fraser Cc: t.horikoshi@jp.fujitsu.com, xen-devel@lists.xensource.com, xen-ia64-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org On Thu, Jan 25, 2007 at 02:03:19PM +0000, Keir Fraser wrote: > > So we should replace current netfront_tx_slot_available implementation with: > (tx->req_prod_pvt - tx->rsp_cons) < (TX_MAX_TARGET - MAX_SKB_FRAGS - 2) Yeah that's the idea. I was thinking of something like this: diff -r bea505a69722 linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c --- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c Tue Jan 23 15:58:05 2007 +0000 +++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c Fri Jan 26 01:14:19 2007 +1100 @@ -138,8 +138,10 @@ static inline int netif_needs_gso(struct #define GRANT_INVALID_REF 0 -#define NET_TX_RING_SIZE __RING_SIZE((struct netif_tx_sring *)0, PAGE_SIZE) -#define NET_RX_RING_SIZE __RING_SIZE((struct netif_rx_sring *)0, PAGE_SIZE) +#define NET_TX_RING_SIZE \ + (__RING_SIZE((struct netif_tx_sring *)0, PAGE_SIZE) & 255) +#define NET_RX_RING_SIZE \ + (__RING_SIZE((struct netif_rx_sring *)0, PAGE_SIZE) & 255) struct netfront_info { struct list_head list; @@ -159,7 +161,7 @@ struct netfront_info { /* Receive-ring batched refills. */ #define RX_MIN_TARGET 8 #define RX_DFL_MIN_TARGET 64 -#define RX_MAX_TARGET min_t(int, NET_RX_RING_SIZE, 256) +#define RX_MAX_TARGET NET_RX_RING_SIZE unsigned rx_min_target, rx_max_target, rx_target; struct sk_buff_head rx_batch; @@ -172,7 +174,7 @@ struct netfront_info { struct sk_buff *tx_skbs[NET_TX_RING_SIZE+1]; struct sk_buff *rx_skbs[NET_RX_RING_SIZE]; -#define TX_MAX_TARGET min_t(int, NET_RX_RING_SIZE, 256) +#define TX_MAX_TARGET NET_TX_RING_SIZE grant_ref_t gref_tx_head; grant_ref_t grant_tx_ref[NET_TX_RING_SIZE + 1]; grant_ref_t gref_rx_head; Cheers, -- Visit Openswan at http://www.openswan.org/ Email: Herbert Xu ~{PmV>HI~} Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt