From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: [PATCH 1/4] xen: netback: Fixes for delayed copy of tx network packets. Date: Fri, 11 Jun 2010 15:19:08 +0100 Message-ID: <1276265951-24490-1-git-send-email-ian.campbell@citrix.com> References: <1276265928.19091.3469.camel@zakaz.uk.xensource.com> Return-path: In-Reply-To: <1276265928.19091.3469.camel@zakaz.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: jeremy@goop.org Cc: Steven.Smith@eu.citrix.com, Keir Fraser , xen-devel@lists.xensource.com, Ian Campbell , JBeulich@novell.com List-Id: xen-devel@lists.xenproject.org From: Keir Fraser - Should call net_tx_action_dealloc() even when dealloc ring is empty, as there may in any case be work to do on the pending_inuse list. - Should not exit directly from the middle of the tx_action tasklet, as the tx_pending_timer should always be checked and updated at the end of the tasklet. Signed-off-by: Keir Fraser Signed-off-by: Ian Campbell [picked from linux-2.6.18-xen.hg 959:1a97bd686258, ported across a43e2175 "xen/netback: move code around"] --- drivers/xen/netback/netback.c | 25 ++++++++++++------------- 1 files changed, 12 insertions(+), 13 deletions(-) diff --git a/drivers/xen/netback/netback.c b/drivers/xen/netback/netback.c index b23fab0..9e4793f 100644 --- a/drivers/xen/netback/netback.c +++ b/drivers/xen/netback/netback.c @@ -1384,16 +1384,6 @@ static void net_tx_submit(struct xen_netbk *netbk) netif_rx_ni(skb); netif->dev->last_rx = jiffies; } - - if (netbk_copy_skb_mode == NETBK_DELAYED_COPY_SKB && - !list_empty(&netbk->pending_inuse_head)) { - struct netbk_tx_pending_inuse *oldest; - - oldest = list_entry(netbk->pending_inuse_head.next, - struct netbk_tx_pending_inuse, list); - mod_timer(&netbk->netbk_tx_pending_timer, - oldest->alloc_time + HZ); - } } /* Called after netfront has transmitted */ @@ -1403,19 +1393,28 @@ static void net_tx_action(unsigned long data) unsigned nr_mops; int ret; - if (netbk->dealloc_cons != netbk->dealloc_prod) - net_tx_action_dealloc(netbk); + net_tx_action_dealloc(netbk); nr_mops = net_tx_build_mops(netbk); if (nr_mops == 0) - return; + goto out; ret = HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref, netbk->tx_map_ops, nr_mops); BUG_ON(ret); net_tx_submit(netbk); +out: + if (netbk_copy_skb_mode == NETBK_DELAYED_COPY_SKB && + !list_empty(&netbk->pending_inuse_head)) { + struct netbk_tx_pending_inuse *oldest; + + oldest = list_entry(netbk->pending_inuse_head.next, + struct netbk_tx_pending_inuse, list); + mod_timer(&netbk->netbk_tx_pending_timer, + oldest->alloc_time + HZ); + } } static void netif_idx_release(struct xen_netbk *netbk, u16 pending_idx) -- 1.5.6.5