]> Pileus Git - ~andy/linux/commitdiff
staging: brcm80211: remove DHD_USE_STATIC_BUF
authormike.rapoport@gmail.com <mike.rapoport@gmail.com>
Tue, 12 Oct 2010 22:09:08 +0000 (00:09 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 14 Oct 2010 19:27:50 +0000 (12:27 -0700)
The DHD_USE_STATIC_BUF cannot be enabled in the build configuration,
remove it.

Signed-off-by: Mike Rapoport <mike.rapoport@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
drivers/staging/brcm80211/brcmfmac/dhd.h
drivers/staging/brcm80211/brcmfmac/dhd_cdc.c
drivers/staging/brcm80211/brcmfmac/dhd_linux.c
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
drivers/staging/brcm80211/include/linux_osl.h
drivers/staging/brcm80211/util/linux_osl.c

index 15a3f5e15e3e2454346bd4a3199ac86ab9f1fc84..caabf7b563acc44b7beb28392bc58dd9deac387f 100644 (file)
@@ -1040,11 +1040,7 @@ sdioh_request_buffer(sdioh_info_t *sd, uint pio_dma, uint fix_inc, uint write,
        if (pkt == NULL) {
                sd_data(("%s: Creating new %s Packet, len=%d\n",
                         __func__, write ? "TX" : "RX", buflen_u));
-#ifdef DHD_USE_STATIC_BUF
-               mypkt = PKTGET_STATIC(sd->osh, buflen_u, write ? true : false);
-#else
                mypkt = PKTGET(sd->osh, buflen_u, write ? true : false);
-#endif                         /* DHD_USE_STATIC_BUF */
                if (!mypkt) {
                        sd_err(("%s: PKTGET failed: len %d\n",
                                __func__, buflen_u));
@@ -1062,11 +1058,7 @@ sdioh_request_buffer(sdioh_info_t *sd, uint pio_dma, uint fix_inc, uint write,
                if (!write)
                        bcopy(PKTDATA(mypkt), buffer, buflen_u);
 
-#ifdef DHD_USE_STATIC_BUF
-               PKTFREE_STATIC(sd->osh, mypkt, write ? true : false);
-#else
                PKTFREE(sd->osh, mypkt, write ? true : false);
-#endif                         /* DHD_USE_STATIC_BUF */
        } else if (((u32) (PKTDATA(pkt)) & DMA_ALIGN_MASK) != 0) {
                /* Case 2: We have a packet, but it is unaligned. */
 
@@ -1075,12 +1067,7 @@ sdioh_request_buffer(sdioh_info_t *sd, uint pio_dma, uint fix_inc, uint write,
 
                sd_data(("%s: Creating aligned %s Packet, len=%d\n",
                         __func__, write ? "TX" : "RX", PKTLEN(pkt)));
-#ifdef DHD_USE_STATIC_BUF
-               mypkt = PKTGET_STATIC(sd->osh, PKTLEN(pkt),
-                                       write ? true : false);
-#else
                mypkt = PKTGET(sd->osh, PKTLEN(pkt), write ? true : false);
-#endif                         /* DHD_USE_STATIC_BUF */
                if (!mypkt) {
                        sd_err(("%s: PKTGET failed: len %d\n",
                                __func__, PKTLEN(pkt)));
@@ -1098,11 +1085,7 @@ sdioh_request_buffer(sdioh_info_t *sd, uint pio_dma, uint fix_inc, uint write,
                if (!write)
                        bcopy(PKTDATA(mypkt), PKTDATA(pkt), PKTLEN(mypkt));
 
-#ifdef DHD_USE_STATIC_BUF
-               PKTFREE_STATIC(sd->osh, mypkt, write ? true : false);
-#else
                PKTFREE(sd->osh, mypkt, write ? true : false);
-#endif                         /* DHD_USE_STATIC_BUF */
        } else {                /* case 3: We have a packet and
                                 it is aligned. */
                sd_data(("%s: Aligned %s Packet, direct DMA\n",
index 517ac36e206130b21e6a441076fca83ec499d126..57d06b2da46f85fbbf85755300b45cdcd598a063 100644 (file)
@@ -73,9 +73,7 @@ enum dhd_prealloc_index {
        DHD_PREALLOC_DATABUF,
        DHD_PREALLOC_OSL_BUF
 };
-#ifdef DHD_USE_STATIC_BUF
-extern void *dhd_os_prealloc(int section, unsigned long size);
-#endif
+
 /* Common structure for module and instance linkage */
 typedef struct dhd_pub {
        /* Linkage ponters */
index cb2d0d90b1d70fe52b4ef6fede53a4443fda2957..00b725ff484a6b5eb38bbd2a9ad5d4425e8c2e95 100644 (file)
@@ -406,20 +406,11 @@ int dhd_prot_attach(dhd_pub_t *dhd)
 {
        dhd_prot_t *cdc;
 
-#ifndef DHD_USE_STATIC_BUF
        cdc = (dhd_prot_t *) MALLOC(dhd->osh, sizeof(dhd_prot_t));
        if (!cdc) {
                DHD_ERROR(("%s: kmalloc failed\n", __func__));
                goto fail;
        }
-#else
-       cdc = (dhd_prot_t *) dhd_os_prealloc(DHD_PREALLOC_PROT,
-                                               sizeof(dhd_prot_t));
-       if (!cdc) {
-               DHD_ERROR(("%s: kmalloc failed\n", __func__));
-               goto fail;
-       }
-#endif                         /* DHD_USE_STATIC_BUF */
        memset(cdc, 0, sizeof(dhd_prot_t));
 
        /* ensure that the msg buf directly follows the cdc msg struct */
@@ -436,19 +427,15 @@ int dhd_prot_attach(dhd_pub_t *dhd)
        return 0;
 
 fail:
-#ifndef DHD_USE_STATIC_BUF
        if (cdc != NULL)
                MFREE(dhd->osh, cdc, sizeof(dhd_prot_t));
-#endif
        return BCME_NOMEM;
 }
 
 /* ~NOTE~ What if another thread is waiting on the semaphore?  Holding it? */
 void dhd_prot_detach(dhd_pub_t *dhd)
 {
-#ifndef DHD_USE_STATIC_BUF
        MFREE(dhd->osh, dhd->prot, sizeof(dhd_prot_t));
-#endif
        dhd->prot = NULL;
 }
 
index 62915c67120792e36f0ea8fd0e75609d5b51b715..9110fbe4f7f100c3bc80fdf53e08daf6543153a1 100644 (file)
@@ -2678,27 +2678,6 @@ void dhd_os_sdtxunlock(dhd_pub_t *pub)
        dhd_os_sdunlock(pub);
 }
 
-#ifdef DHD_USE_STATIC_BUF
-void *dhd_os_prealloc(int section, unsigned long size)
-{
-#if defined(CUSTOMER_HW2) && defined(CONFIG_WIFI_CONTROL_FUNC)
-       void *alloc_ptr = NULL;
-       if (wifi_control_data && wifi_control_data->mem_prealloc) {
-               alloc_ptr = wifi_control_data->mem_prealloc(section, size);
-               if (alloc_ptr) {
-                       DHD_INFO(("success alloc section %d\n", section));
-                       bzero(alloc_ptr, size);
-                       return alloc_ptr;
-               }
-       }
-
-       DHD_ERROR(("can't alloc section %d\n", section));
-       return 0;
-#else
-       return MALLOC(0, size);
-#endif /* #if defined(CUSTOMER_HW2) && defined(CONFIG_WIFI_CONTROL_FUNC) */
-}
-#endif /* DHD_USE_STATIC_BUF */
 #if defined(CONFIG_WIRELESS_EXT)
 struct iw_statistics *dhd_get_wireless_stats(struct net_device *dev)
 {
index 6b91211ae3140a3c74bb47af72578c2e48a1892a..e0e1d2b0a813111f71b0f76b504ae64569b6c5fb 100644 (file)
@@ -5382,7 +5382,6 @@ static bool dhdsdio_probe_malloc(dhd_bus_t *bus, osl_t *osh, void *sdh)
 {
        DHD_TRACE(("%s: Enter\n", __func__));
 
-#ifndef DHD_USE_STATIC_BUF
        if (bus->dhd->maxctl) {
                bus->rxblen =
                    roundup((bus->dhd->maxctl + SDPCM_HDRLEN),
@@ -5405,26 +5404,6 @@ static bool dhdsdio_probe_malloc(dhd_bus_t *bus, osl_t *osh, void *sdh)
                        MFREE(osh, bus->rxbuf, bus->rxblen);
                goto fail;
        }
-#else
-       if (bus->dhd->maxctl) {
-               bus->rxblen =
-                   roundup((bus->dhd->maxctl + SDPCM_HDRLEN),
-                           ALIGNMENT) + DHD_SDALIGN;
-               bus->rxbuf = dhd_os_prealloc(DHD_PREALLOC_RXBUF, bus->rxblen);
-               if (!(bus->rxbuf)) {
-                       DHD_ERROR(("%s: MALLOC of %d-byte rxbuf failed\n",
-                                  __func__, bus->rxblen));
-                       goto fail;
-               }
-       }
-       /* Allocate buffer to receive glomed packet */
-       bus->databuf = dhd_os_prealloc(DHD_PREALLOC_DATABUF, MAX_DATA_BUF);
-       if (!(bus->databuf)) {
-               DHD_ERROR(("%s: MALLOC of %d-byte databuf failed\n",
-                          __func__, MAX_DATA_BUF));
-               goto fail;
-       }
-#endif                         /* DHD_USE_STATIC_BUF */
 
        /* Align the buffer */
        if ((uintptr) bus->databuf % DHD_SDALIGN)
@@ -5583,17 +5562,13 @@ static void dhdsdio_release_malloc(dhd_bus_t *bus, osl_t *osh)
                return;
 
        if (bus->rxbuf) {
-#ifndef DHD_USE_STATIC_BUF
                MFREE(osh, bus->rxbuf, bus->rxblen);
-#endif
                bus->rxctl = bus->rxbuf = NULL;
                bus->rxlen = 0;
        }
 
        if (bus->databuf) {
-#ifndef DHD_USE_STATIC_BUF
                MFREE(osh, bus->databuf, MAX_DATA_BUF);
-#endif
                bus->databuf = NULL;
        }
 }
index 8dfead41a67997f1b467bd24e96c6897c21ab50f..1e1369ed53772fd3deebfadeabfb510389bf3eea 100644 (file)
@@ -337,11 +337,6 @@ extern void *osl_pktget(osl_t *osh, uint len);
 extern void osl_pktfree(osl_t *osh, void *skb, bool send);
 
 #ifdef BRCM_FULLMAC
-#ifdef DHD_USE_STATIC_BUF
-#define        PKTGET_STATIC(osh, len, send)           osl_pktget_static((osh), (len))
-#define        PKTFREE_STATIC(osh, skb, send)  \
-       osl_pktfree_static((osh), (skb), (send))
-#endif
 extern void *osl_pktget_static(osl_t *osh, uint len);
 extern void osl_pktfree_static(osl_t *osh, void *skb, bool send);
 
index 6616174a30920bc0d76ed4f629a2c30c3ecedbd6..7c7d14bc1c2830523e98a9da8b531ee8fa255ce9 100644 (file)
 #define OS_HANDLE_MAGIC                0x1234abcd      /* Magic # to recognise osh */
 #define BCM_MEM_FILENAME_LEN   24      /* Mem. filename length */
 
-#if defined(BRCM_FULLMAC) && defined(DHD_USE_STATIC_BUF)
-#define MAX_STATIC_BUF_NUM 16
-#define STATIC_BUF_SIZE        (PAGE_SIZE*2)
-#define STATIC_BUF_TOTAL_LEN (MAX_STATIC_BUF_NUM*STATIC_BUF_SIZE)
-typedef struct bcm_static_buf {
-       struct semaphore static_sem;
-       unsigned char *buf_ptr;
-       unsigned char buf_use[MAX_STATIC_BUF_NUM];
-} bcm_static_buf_t;
-
-static bcm_static_buf_t *bcm_static_buf;
-
-#define MAX_STATIC_PKT_NUM 8
-typedef struct bcm_static_pkt {
-       struct sk_buff *skb_4k[MAX_STATIC_PKT_NUM];
-       struct sk_buff *skb_8k[MAX_STATIC_PKT_NUM];
-       struct semaphore osl_pkt_sem;
-       unsigned char pkt_use[MAX_STATIC_PKT_NUM * 2];
-} bcm_static_pkt_t;
-static bcm_static_pkt_t *bcm_static_skb;
-#endif                         /* DHD_USE_STATIC_BUF */
-
 struct osl_info {
        osl_pubinfo_t pub;
        uint magic;
@@ -174,39 +152,6 @@ osl_t *osl_attach(void *pdev, uint bustype, bool pkttag)
                break;
        }
 
-#if defined(BRCM_FULLMAC) && defined(DHD_USE_STATIC_BUF)
-       if (!bcm_static_buf) {
-               bcm_static_buf = (bcm_static_buf_t *) dhd_os_prealloc(3,
-                                       STATIC_BUF_SIZE + STATIC_BUF_TOTAL_LEN);
-               if (!bcm_static_buf) {
-                       printk(KERN_ERR "can not alloc static buf!\n");
-               } else
-                       printk(KERN_ERR "alloc static buf at %x!\n",
-                              (unsigned int)bcm_static_buf);
-
-               init_MUTEX(&bcm_static_buf->static_sem);
-
-               bcm_static_buf->buf_ptr =
-                   (unsigned char *)bcm_static_buf + STATIC_BUF_SIZE;
-
-       }
-
-       if (!bcm_static_skb) {
-               int i;
-               void *skb_buff_ptr = 0;
-               bcm_static_skb =
-                   (bcm_static_pkt_t *) ((char *)bcm_static_buf + 2048);
-               skb_buff_ptr = dhd_os_prealloc(4, 0);
-
-               bcopy(skb_buff_ptr, bcm_static_skb,
-                     sizeof(struct sk_buff *) * 16);
-               for (i = 0; i < MAX_STATIC_PKT_NUM * 2; i++)
-                       bcm_static_skb->pkt_use[i] = 0;
-
-               init_MUTEX(&bcm_static_skb->osl_pkt_sem);
-       }
-#endif /* defined(BRCM_FULLMAC) && defined(DHD_USE_STATIC_BUF) */
-
 #if defined(BCMDBG) && !defined(BRCM_FULLMAC)
        if (pkttag) {
                struct sk_buff *skb;
@@ -221,13 +166,6 @@ void osl_detach(osl_t *osh)
        if (osh == NULL)
                return;
 
-#if defined(BRCM_FULLMAC) && defined(DHD_USE_STATIC_BUF)
-       if (bcm_static_buf)
-               bcm_static_buf = 0;
-
-       if (bcm_static_skb)
-               bcm_static_skb = 0;
-#endif
        ASSERT(osh->magic == OS_HANDLE_MAGIC);
        kfree(osh);
 }
@@ -282,73 +220,6 @@ void BCMFASTPATH osl_pktfree(osl_t *osh, void *p, bool send)
        }
 }
 
-#if defined(BRCM_FULLMAC) && defined(DHD_USE_STATIC_BUF)
-void *osl_pktget_static(osl_t *osh, uint len)
-{
-       int i = 0;
-       struct sk_buff *skb;
-
-       if (len > (PAGE_SIZE * 2)) {
-               printk(KERN_ERR "Do we really need this big skb??\n");
-               return osl_pktget(osh, len);
-       }
-
-       down(&bcm_static_skb->osl_pkt_sem);
-       if (len <= PAGE_SIZE) {
-               for (i = 0; i < MAX_STATIC_PKT_NUM; i++) {
-                       if (bcm_static_skb->pkt_use[i] == 0)
-                               break;
-               }
-
-               if (i != MAX_STATIC_PKT_NUM) {
-                       bcm_static_skb->pkt_use[i] = 1;
-                       up(&bcm_static_skb->osl_pkt_sem);
-
-                       skb = bcm_static_skb->skb_4k[i];
-                       skb->tail = skb->data + len;
-                       skb->len = len;
-
-                       return skb;
-               }
-       }
-
-       for (i = 0; i < MAX_STATIC_PKT_NUM; i++) {
-               if (bcm_static_skb->pkt_use[i + MAX_STATIC_PKT_NUM] == 0)
-                       break;
-       }
-
-       if (i != MAX_STATIC_PKT_NUM) {
-               bcm_static_skb->pkt_use[i + MAX_STATIC_PKT_NUM] = 1;
-               up(&bcm_static_skb->osl_pkt_sem);
-               skb = bcm_static_skb->skb_8k[i];
-               skb->tail = skb->data + len;
-               skb->len = len;
-
-               return skb;
-       }
-
-       up(&bcm_static_skb->osl_pkt_sem);
-       printk(KERN_ERR "all static pkt in use!\n");
-       return osl_pktget(osh, len);
-}
-
-void osl_pktfree_static(osl_t *osh, void *p, bool send)
-{
-       int i;
-
-       for (i = 0; i < MAX_STATIC_PKT_NUM * 2; i++) {
-               if (p == bcm_static_skb->skb_4k[i]) {
-                       down(&bcm_static_skb->osl_pkt_sem);
-                       bcm_static_skb->pkt_use[i] = 0;
-                       up(&bcm_static_skb->osl_pkt_sem);
-
-                       return;
-               }
-       }
-       return osl_pktfree(osh, p, send);
-}
-#endif /* defined(BRCM_FULLMAC) && defined(DHD_USE_STATIC_BUF) */
-
 u32 osl_pci_read_config(osl_t *osh, uint offset, uint size)
 {
        uint val = 0;
@@ -422,35 +293,6 @@ void *osl_malloc(osl_t *osh, uint size)
        if (osh)
                ASSERT(osh->magic == OS_HANDLE_MAGIC);
 
-#if defined(BRCM_FULLMAC) && defined(DHD_USE_STATIC_BUF)
-               if (bcm_static_buf) {
-                       int i = 0;
-                       if ((size >= PAGE_SIZE) && (size <= STATIC_BUF_SIZE)) {
-                               down(&bcm_static_buf->static_sem);
-                               for (i = 0; i < MAX_STATIC_BUF_NUM; i++) {
-                                       if (bcm_static_buf->buf_use[i] == 0)
-                                               break;
-                               }
-                               if (i == MAX_STATIC_BUF_NUM) {
-                                       up(&bcm_static_buf->static_sem);
-                                       printk(KERN_ERR "all static buff in use!\n");
-                                       goto original;
-                               }
-                               bcm_static_buf->buf_use[i] = 1;
-                               up(&bcm_static_buf->static_sem);
-
-                               bzero(bcm_static_buf->buf_ptr + STATIC_BUF_SIZE * i,
-                                         size);
-                               if (osh)
-                                       osh->malloced += size;
-
-                               return (void *)(bcm_static_buf->buf_ptr +
-                                                STATIC_BUF_SIZE * i);
-                       }
-               }
-       original:
-#endif /* defined(BRCM_FULLMAC) && defined(DHD_USE_STATIC_BUF) */
-
        addr = kmalloc(size, GFP_ATOMIC);
        if (addr == NULL) {
                if (osh)
@@ -465,28 +307,6 @@ void *osl_malloc(osl_t *osh, uint size)
 
 void osl_mfree(osl_t *osh, void *addr, uint size)
 {
-#if defined(BRCM_FULLMAC) && defined(DHD_USE_STATIC_BUF)
-       if (bcm_static_buf) {
-               if ((addr > (void *)bcm_static_buf) && ((unsigned char *)addr
-                               <= ((unsigned char *)
-                                   bcm_static_buf +
-                                   STATIC_BUF_TOTAL_LEN))) {
-                       int buf_idx = 0;
-                       buf_idx =
-                           ((unsigned char *)addr -
-                            bcm_static_buf->buf_ptr) / STATIC_BUF_SIZE;
-                       down(&bcm_static_buf->static_sem);
-                       bcm_static_buf->buf_use[buf_idx] = 0;
-                       up(&bcm_static_buf->static_sem);
-
-                       if (osh) {
-                               ASSERT(osh->magic == OS_HANDLE_MAGIC);
-                               osh->malloced -= size;
-                       }
-                       return;
-               }
-       }
-#endif /* defined(BRCM_FULLMAC) && defined(DHD_USE_STATIC_BUF) */
        if (osh) {
                ASSERT(osh->magic == OS_HANDLE_MAGIC);
                osh->malloced -= size;