From patchwork Thu Apr 23 07:21:27 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wright X-Patchwork-Id: 26354 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id D3949B7063 for ; Thu, 23 Apr 2009 17:33:38 +1000 (EST) Received: by ozlabs.org (Postfix) id C21FEDDFC3; Thu, 23 Apr 2009 17:33:38 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 68102DDF39 for ; Thu, 23 Apr 2009 17:33:38 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757204AbZDWHdL (ORCPT ); Thu, 23 Apr 2009 03:33:11 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757185AbZDWHdK (ORCPT ); Thu, 23 Apr 2009 03:33:10 -0400 Received: from sous-sol.org ([216.99.217.87]:50839 "EHLO x200.localdomain" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1757167AbZDWHdH (ORCPT ); Thu, 23 Apr 2009 03:33:07 -0400 Received: from x200.localdomain (x200.localdomain [127.0.0.1]) by x200.localdomain (8.14.3/8.14.3) with ESMTP id n3N7S979026883; Thu, 23 Apr 2009 00:28:09 -0700 Received: (from chrisw@localhost) by x200.localdomain (8.14.3/8.14.3/Submit) id n3N7S4ga026878; Thu, 23 Apr 2009 00:28:04 -0700 X-Authentication-Warning: x200.localdomain: chrisw set sender to Chris Wright using -f Message-Id: <20090423072804.211647624@sous-sol.org> User-Agent: quilt/0.47-1 Date: Thu, 23 Apr 2009 00:21:27 -0700 From: Chris Wright To: linux-kernel@vger.kernel.org, stable@kernel.org Cc: Justin Forbes , Zwane Mwaikambo , "Theodore Ts'o" , Randy Dunlap , Dave Jones , Chuck Wolber , Chris Wedgwood , Michael Krufky , Chuck Ebbert , Domenico Andreoli , Willy Tarreau , Rodrigo Rubira Branco , Jake Edge , Eugene Teo , torvalds@linux-foundation.org, akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk, Ben Hutchings , netdev@vger.kernel.org, linux-net-drivers@solarflare.com Subject: [patch 067/100] sfc: Match calls to netif_napi_add() and netif_napi_del() References: <20090423072020.428683652@sous-sol.org> Content-Disposition: inline; filename=sfc-match-calls-to-netif_napi_add-and-netif_napi_del.patch Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org -stable review patch. If anyone has any objections, please let us know. --------------------- From: Ben Hutchings upstream commit: 718cff1eec595ce6ab0635b8160a51ee37d9268d sfc could call netif_napi_add() multiple times for the same napi_struct, corrupting the list of napi_structs for the associated device and leading to a busy-loop on device removal. Move the call to netif_napi_add() and add a call to netif_napi_del() in the obvious places. [bhutchings: backport to 2.6.29] Signed-off-by: Ben Hutchings Signed-off-by: Chris Wright --- We didn't spot this earlier because only netpoll would look at the list, but this changed with the addition of GRO in 2.6.29. I have no excuse for not catching it during the .29 release cycle though. Ben. drivers/net/sfc/efx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/drivers/net/sfc/efx.c +++ b/drivers/net/sfc/efx.c @@ -424,10 +424,6 @@ static void efx_start_channel(struct efx EFX_LOG(channel->efx, "starting chan %d\n", channel->channel); - if (!(channel->efx->net_dev->flags & IFF_UP)) - netif_napi_add(channel->napi_dev, &channel->napi_str, - efx_poll, napi_weight); - /* The interrupt handler for this channel may set work_pending * as soon as we enable it. Make sure it's cleared before * then. Similarly, make sure it sees the enabled flag set. */ @@ -1273,6 +1269,8 @@ static int efx_init_napi(struct efx_nic efx_for_each_channel(channel, efx) { channel->napi_dev = efx->net_dev; + netif_napi_add(channel->napi_dev, &channel->napi_str, + efx_poll, napi_weight); rc = efx_lro_init(&channel->lro_mgr, efx); if (rc) goto err; @@ -1289,6 +1287,8 @@ static void efx_fini_napi(struct efx_nic efx_for_each_channel(channel, efx) { efx_lro_fini(&channel->lro_mgr); + if (channel->napi_dev) + netif_napi_del(&channel->napi_str); channel->napi_dev = NULL; } }