From patchwork Tue Oct 6 16:20:43 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Albert Herranz X-Patchwork-Id: 51978 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n96GUlRL025727 for ; Tue, 6 Oct 2009 16:30:48 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932242AbZJFQVb (ORCPT ); Tue, 6 Oct 2009 12:21:31 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755594AbZJFQVb (ORCPT ); Tue, 6 Oct 2009 12:21:31 -0400 Received: from smtp122.mail.ukl.yahoo.com ([77.238.184.53]:40498 "HELO smtp122.mail.ukl.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1755993AbZJFQVa (ORCPT ); Tue, 6 Oct 2009 12:21:30 -0400 Received: (qmail 79213 invoked from network); 6 Oct 2009 16:20:47 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.es; h=Received:X-Yahoo-SMTP:X-YMail-OSG:X-Yahoo-Newman-Property:From:To:Cc:Subject:Date:Message-Id:X-Mailer; b=Lv3GvIylCfk01opMErfbiUOcIT2Eh3s2p7vsqrP2lTDE3h09iEOKhTlIazDrRcm1jGfEegaUlXoWwKh1p+Ex8QlvZZM2leqXaUebzHrWw9QEJag6O7ixKEOoFFkZZbXptQWPFEp4eRn8gua20O/Y0ohLp0EVsqS863IjsJvKnwY= ; Received: from 101.Red-81-32-166.dynamicIP.rima-tde.net (albert_herranz@81.32.166.101 with login) by smtp122.mail.ukl.yahoo.com with SMTP; 06 Oct 2009 16:20:47 +0000 GMT X-Yahoo-SMTP: czee06uswBAtfIYshc.kP27UlfEXaxwWNSjJ X-YMail-OSG: 5nRixWcVM1nFRBtsDi6iCQSXTIEiEE3C75ajl92M8eiZjiai0mg3rnDDtzVSYoNbY0mNDSnLtkYb867QC2uCkCxpegKBQyDSSj1QqINY7vnIy_Lc6sB5S9sIAmStqZii81xoPHQdv65Q04rvczpZA.sMLsIfa9ERtS3iyjsByzeXLdvvP4tGEBCGhbCnWf1Nq3gW2LYFq4unweiW2kCn88wyhlBuzdG0zET.MqFib1xoO8H8kwrYhjIeBfXq60wFdqtyJXZRaAuJs0x6xCcwRIs5aycE3dZ3TkNedS5pnDviI6RqCtM- X-Yahoo-Newman-Property: ymail-3 From: Albert Herranz To: bcm43xx-dev@lists.berlios.de, mb@bu3sch.de Cc: linux-wireless@vger.kernel.org, Albert Herranz Subject: [PATCH] b43: do not stack-allocate pio rx/tx header buffers Date: Tue, 6 Oct 2009 18:20:43 +0200 Message-Id: <1254846043-7121-1-git-send-email-albert_herranz@yahoo.es> X-Mailer: git-send-email 1.6.0.4 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/b43/b43.h b/drivers/net/wireless/b43/b43.h index fa1549a..b09dda1 100644 --- a/drivers/net/wireless/b43/b43.h +++ b/drivers/net/wireless/b43/b43.h @@ -550,6 +550,9 @@ struct b43_dma { struct b43_pio_txqueue; struct b43_pio_rxqueue; +struct b43_rxhdr_fw4; +struct b43_txhdr; + /* Data structures for PIO transmission, per 80211 core. */ struct b43_pio { struct b43_pio_txqueue *tx_queue_AC_BK; /* Background */ @@ -559,6 +562,12 @@ struct b43_pio { struct b43_pio_txqueue *tx_queue_mcast; /* Multicast */ struct b43_pio_rxqueue *rx_queue; + + /* + * RX/TX header buffers used by the frame transmit functions. + */ + struct b43_rxhdr_fw4 *rxhdr; + struct b43_txhdr *txhdr; }; /* Context information for a noise calculation (Link Quality). */ diff --git a/drivers/net/wireless/b43/pio.c b/drivers/net/wireless/b43/pio.c index e96091b..45aa6e2 100644 --- a/drivers/net/wireless/b43/pio.c +++ b/drivers/net/wireless/b43/pio.c @@ -241,6 +241,9 @@ void b43_pio_free(struct b43_wldev *dev) destroy_queue_tx(pio, tx_queue_AC_VI); destroy_queue_tx(pio, tx_queue_AC_BE); destroy_queue_tx(pio, tx_queue_AC_BK); + + kfree(pio->rxhdr); + kfree(pio->txhdr); } int b43_pio_init(struct b43_wldev *dev) @@ -276,11 +279,23 @@ int b43_pio_init(struct b43_wldev *dev) if (!pio->rx_queue) goto err_destroy_mcast; + pio->rxhdr = kzalloc(sizeof(*pio->rxhdr), GFP_KERNEL); + if (!pio->rxhdr) + goto err_destroy_rx; + + pio->txhdr = kzalloc(sizeof(*pio->txhdr), GFP_KERNEL); + if (!pio->txhdr) + goto err_destroy_rxhdr; + b43dbg(dev->wl, "PIO initialized\n"); err = 0; out: return err; +err_destroy_rxhdr: + kfree(pio->rxhdr); +err_destroy_rx: + destroy_queue_rx(pio, rx_queue); err_destroy_mcast: destroy_queue_tx(pio, tx_queue_mcast); err_destroy_vo: @@ -435,8 +450,9 @@ static void pio_tx_frame_4byte_queue(struct b43_pio_txpacket *pack, static int pio_tx_frame(struct b43_pio_txqueue *q, struct sk_buff *skb) { + struct b43_wldev *dev = q->dev; + struct b43_pio *pio = &dev->pio; struct b43_pio_txpacket *pack; - struct b43_txhdr txhdr; u16 cookie; int err; unsigned int hdrlen; @@ -447,8 +463,8 @@ static int pio_tx_frame(struct b43_pio_txqueue *q, struct b43_pio_txpacket, list); cookie = generate_cookie(q, pack); - hdrlen = b43_txhdr_size(q->dev); - err = b43_generate_txhdr(q->dev, (u8 *)&txhdr, skb, + hdrlen = b43_txhdr_size(dev); + err = b43_generate_txhdr(dev, (u8 *)pio->txhdr, skb, info, cookie); if (err) return err; @@ -456,15 +472,15 @@ static int pio_tx_frame(struct b43_pio_txqueue *q, if (info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) { /* Tell the firmware about the cookie of the last * mcast frame, so it can clear the more-data bit in it. */ - b43_shm_write16(q->dev, B43_SHM_SHARED, + b43_shm_write16(dev, B43_SHM_SHARED, B43_SHM_SH_MCASTCOOKIE, cookie); } pack->skb = skb; if (q->rev >= 8) - pio_tx_frame_4byte_queue(pack, (const u8 *)&txhdr, hdrlen); + pio_tx_frame_4byte_queue(pack, (const u8 *)pio->txhdr, hdrlen); else - pio_tx_frame_2byte_queue(pack, (const u8 *)&txhdr, hdrlen); + pio_tx_frame_2byte_queue(pack, (const u8 *)pio->txhdr, hdrlen); /* Remove it from the list of available packet slots. * It will be put back when we receive the status report. */ @@ -604,14 +620,14 @@ void b43_pio_get_tx_stats(struct b43_wldev *dev, static bool pio_rx_frame(struct b43_pio_rxqueue *q) { struct b43_wldev *dev = q->dev; - struct b43_rxhdr_fw4 rxhdr; + struct b43_pio *pio = &dev->pio; u16 len; u32 macstat; unsigned int i, padding; struct sk_buff *skb; const char *err_msg = NULL; - memset(&rxhdr, 0, sizeof(rxhdr)); + memset(pio->rxhdr, 0, sizeof(*pio->rxhdr)); /* Check if we have data and wait for it to get ready. */ if (q->rev >= 8) { @@ -649,16 +665,16 @@ data_ready: /* Get the preamble (RX header) */ if (q->rev >= 8) { - ssb_block_read(dev->dev, &rxhdr, sizeof(rxhdr), + ssb_block_read(dev->dev, pio->rxhdr, sizeof(*pio->rxhdr), q->mmio_base + B43_PIO8_RXDATA, sizeof(u32)); } else { - ssb_block_read(dev->dev, &rxhdr, sizeof(rxhdr), + ssb_block_read(dev->dev, pio->rxhdr, sizeof(*pio->rxhdr), q->mmio_base + B43_PIO_RXDATA, sizeof(u16)); } /* Sanity checks. */ - len = le16_to_cpu(rxhdr.frame_len); + len = le16_to_cpu(pio->rxhdr->frame_len); if (unlikely(len > 0x700)) { err_msg = "len > 0x700"; goto rx_error; @@ -668,7 +684,7 @@ data_ready: goto rx_error; } - macstat = le32_to_cpu(rxhdr.mac_status); + macstat = le32_to_cpu(pio->rxhdr->mac_status); if (macstat & B43_RX_MAC_FCSERR) { if (!(q->dev->wl->filter_flags & FIF_FCSFAIL)) { /* Drop frames with failed FCS. */ @@ -723,7 +739,7 @@ data_ready: } } - b43_rx(q->dev, skb, &rxhdr); + b43_rx(q->dev, skb, pio->rxhdr); return 1;