From patchwork Sun Jan 17 22:19:25 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Lamparter X-Patchwork-Id: 73556 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id o0HMPlkw028749 for ; Sun, 17 Jan 2010 22:25:47 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754527Ab0AQWZh (ORCPT ); Sun, 17 Jan 2010 17:25:37 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754536Ab0AQWZh (ORCPT ); Sun, 17 Jan 2010 17:25:37 -0500 Received: from mail-bw0-f219.google.com ([209.85.218.219]:53886 "EHLO mail-bw0-f219.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754428Ab0AQWZg (ORCPT ); Sun, 17 Jan 2010 17:25:36 -0500 X-Greylist: delayed 362 seconds by postgrey-1.27 at vger.kernel.org; Sun, 17 Jan 2010 17:25:36 EST Received: by bwz19 with SMTP id 19so1157599bwz.28 for ; Sun, 17 Jan 2010 14:25:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:received:received:received :from:to:subject:date:user-agent:cc:mime-version:content-type :content-transfer-encoding:message-id; bh=ouRS+1oyZ75rtgqbb0WZ9lrbLk2v87Go54xFyRHhwss=; b=hWurRSnXqfZwU8pM5ZGwedNJOFKn0USb96QesHoIwokh6Cmm5wT06x+QZrsMJevqSl 7Gqz+Heasdv57A3i1JDCCxvso7dkQ5+rz7w1RkjpxpmbdWVMzuosanEKso3ShnuPhpCp eahbefRCTR7/z/0hg0r2JeWlHzShyOSi/lO8I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=from:to:subject:date:user-agent:cc:mime-version:content-type :content-transfer-encoding:message-id; b=XELfGsHO/sJ6y0z9ET5pti2/PqrCsylvhdT9z213HZvkfYRUU/e4Ugb+hhqgmrk1lB /WF37sRHviRgT6m8kZA+nQ3IWZD3+XFMQZhjFIOp34StrsG9hwZ2Y1qUwUQaS7tPEKt+ 86xJd7HlrkD77YoYwYz2tA4CGXyCeDEE+7+AU= Received: by 10.204.30.208 with SMTP id v16mr3000676bkc.18.1263766772447; Sun, 17 Jan 2010 14:19:32 -0800 (PST) Received: from blech.mobile (nat-wh.rz.uni-karlsruhe.de [129.13.72.197]) by mx.google.com with ESMTPS id 13sm623123bwz.6.2010.01.17.14.19.31 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 17 Jan 2010 14:19:31 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by blech.mobile (Postfix) with ESMTP id 9BFE83411FD; Sun, 17 Jan 2010 23:19:30 +0100 (CET) Received: from blech.mobile ([127.0.0.1]) by localhost (localhost [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PYQQgzMw2s5F; Sun, 17 Jan 2010 23:19:26 +0100 (CET) Received: from blech.mobile (localhost [127.0.0.1]) by blech.mobile (Postfix) with ESMTP id 320C634111E; Sun, 17 Jan 2010 23:19:26 +0100 (CET) From: Christian Lamparter To: linux-wireless@vger.kernel.org Subject: [PATCH] p54pci: move tx cleanup into tasklet Date: Sun, 17 Jan 2010 23:19:25 +0100 User-Agent: KMail/1.12.4 (Linux/2.6.33-rc3-x-wl; KDE/4.3.4; x86_64; ; ) Cc: John W Linville MIME-Version: 1.0 Message-Id: <201001172319.25737.chunkeey@googlemail.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org diff --git a/drivers/net/wireless/p54/p54pci.c b/drivers/net/wireless/p54/p54pci.c index 7446373..a227c3d 100644 --- a/drivers/net/wireless/p54/p54pci.c +++ b/drivers/net/wireless/p54/p54pci.c @@ -226,25 +226,26 @@ static void p54p_check_rx_ring(struct ieee80211_hw *dev, u32 *index, p54p_refill_rx_ring(dev, ring_index, ring, ring_limit, rx_buf); } -/* caller must hold priv->lock */ static void p54p_check_tx_ring(struct ieee80211_hw *dev, u32 *index, int ring_index, struct p54p_desc *ring, u32 ring_limit, - void **tx_buf) + struct sk_buff **tx_buf) { + unsigned long flags; struct p54p_priv *priv = dev->priv; struct p54p_ring_control *ring_control = priv->ring_control; struct p54p_desc *desc; + struct sk_buff *skb; u32 idx, i; i = (*index) % ring_limit; (*index) = idx = le32_to_cpu(ring_control->device_idx[1]); idx %= ring_limit; + spin_lock_irqsave(&priv->lock, flags); while (i != idx) { desc = &ring[i]; - if (tx_buf[i]) - if (FREE_AFTER_TX((struct sk_buff *) tx_buf[i])) - p54_free_skb(dev, tx_buf[i]); + + skb = tx_buf[i]; tx_buf[i] = NULL; pci_unmap_single(priv->pdev, le32_to_cpu(desc->host_addr), @@ -255,17 +256,32 @@ static void p54p_check_tx_ring(struct ieee80211_hw *dev, u32 *index, desc->len = 0; desc->flags = 0; + if (skb && FREE_AFTER_TX(skb)) { + spin_unlock_irqrestore(&priv->lock, flags); + p54_free_skb(dev, skb); + spin_lock_irqsave(&priv->lock, flags); + } + i++; i %= ring_limit; } + spin_unlock_irqrestore(&priv->lock, flags); } -static void p54p_rx_tasklet(unsigned long dev_id) +static void p54p_tasklet(unsigned long dev_id) { struct ieee80211_hw *dev = (struct ieee80211_hw *)dev_id; struct p54p_priv *priv = dev->priv; struct p54p_ring_control *ring_control = priv->ring_control; + p54p_check_tx_ring(dev, &priv->tx_idx_mgmt, 3, ring_control->tx_mgmt, + ARRAY_SIZE(ring_control->tx_mgmt), + priv->tx_buf_mgmt); + + p54p_check_tx_ring(dev, &priv->tx_idx_data, 1, ring_control->tx_data, + ARRAY_SIZE(ring_control->tx_data), + priv->tx_buf_data); + p54p_check_rx_ring(dev, &priv->rx_idx_mgmt, 2, ring_control->rx_mgmt, ARRAY_SIZE(ring_control->rx_mgmt), priv->rx_buf_mgmt); @@ -280,38 +296,24 @@ static irqreturn_t p54p_interrupt(int irq, void *dev_id) { struct ieee80211_hw *dev = dev_id; struct p54p_priv *priv = dev->priv; - struct p54p_ring_control *ring_control = priv->ring_control; __le32 reg; spin_lock(&priv->lock); reg = P54P_READ(int_ident); if (unlikely(reg == cpu_to_le32(0xFFFFFFFF))) { - spin_unlock(&priv->lock); - return IRQ_HANDLED; + goto out; } - P54P_WRITE(int_ack, reg); reg &= P54P_READ(int_enable); - if (reg & cpu_to_le32(ISL38XX_INT_IDENT_UPDATE)) { - p54p_check_tx_ring(dev, &priv->tx_idx_mgmt, - 3, ring_control->tx_mgmt, - ARRAY_SIZE(ring_control->tx_mgmt), - priv->tx_buf_mgmt); - - p54p_check_tx_ring(dev, &priv->tx_idx_data, - 1, ring_control->tx_data, - ARRAY_SIZE(ring_control->tx_data), - priv->tx_buf_data); - - tasklet_schedule(&priv->rx_tasklet); - - } else if (reg & cpu_to_le32(ISL38XX_INT_IDENT_INIT)) + if (reg & cpu_to_le32(ISL38XX_INT_IDENT_UPDATE)) + tasklet_schedule(&priv->tasklet); + else if (reg & cpu_to_le32(ISL38XX_INT_IDENT_INIT)) complete(&priv->boot_comp); +out: spin_unlock(&priv->lock); - return reg ? IRQ_HANDLED : IRQ_NONE; } @@ -360,7 +362,7 @@ static void p54p_stop(struct ieee80211_hw *dev) unsigned int i; struct p54p_desc *desc; - tasklet_kill(&priv->rx_tasklet); + tasklet_kill(&priv->tasklet); P54P_WRITE(int_enable, cpu_to_le32(0)); P54P_READ(int_enable); @@ -551,7 +553,7 @@ static int __devinit p54p_probe(struct pci_dev *pdev, priv->common.tx = p54p_tx; spin_lock_init(&priv->lock); - tasklet_init(&priv->rx_tasklet, p54p_rx_tasklet, (unsigned long)dev); + tasklet_init(&priv->tasklet, p54p_tasklet, (unsigned long)dev); err = request_firmware(&priv->firmware, "isl3886pci", &priv->pdev->dev); diff --git a/drivers/net/wireless/p54/p54pci.h b/drivers/net/wireless/p54/p54pci.h index fbb6839..2feead6 100644 --- a/drivers/net/wireless/p54/p54pci.h +++ b/drivers/net/wireless/p54/p54pci.h @@ -92,7 +92,7 @@ struct p54p_priv { struct p54_common common; struct pci_dev *pdev; struct p54p_csr __iomem *map; - struct tasklet_struct rx_tasklet; + struct tasklet_struct tasklet; const struct firmware *firmware; spinlock_t lock; struct p54p_ring_control *ring_control; @@ -101,8 +101,8 @@ struct p54p_priv { u32 rx_idx_mgmt, tx_idx_mgmt; struct sk_buff *rx_buf_data[8]; struct sk_buff *rx_buf_mgmt[4]; - void *tx_buf_data[32]; - void *tx_buf_mgmt[4]; + struct sk_buff *tx_buf_data[32]; + struct sk_buff *tx_buf_mgmt[4]; struct completion boot_comp; };