diff options
author | Senthil Balasubramanian <senthilkumar@atheros.com> | 2009-03-06 00:54:08 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-03-16 18:09:30 -0400 |
commit | f0e6ce13c17afd74a49e0ef043d72581562f73ae (patch) | |
tree | 51882c6e4718a898b7592d4cc7e4c13679ae2f3b /drivers | |
parent | ec329acef99ded8dad59e1ef8a5a02b823083353 (diff) |
ath9k: Get rid of unnecessary ATOMIC memory alloc during init time
We can sleep for memory during init time and so allocating rx buffers,
descriptro buffers with GFP_KERNEL should help us to get rid of transient
alloc fails.
Signed-off-by: Senthil Balasubramanian <senthilkumar@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/ath9k/main.c | 5 | ||||
-rw-r--r-- | drivers/net/wireless/ath9k/recv.c | 8 |
2 files changed, 6 insertions, 7 deletions
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c index bb30ccca1843..4bc43db9ab22 100644 --- a/drivers/net/wireless/ath9k/main.c +++ b/drivers/net/wireless/ath9k/main.c | |||
@@ -1804,7 +1804,7 @@ int ath_descdma_setup(struct ath_softc *sc, struct ath_descdma *dd, | |||
1804 | 1804 | ||
1805 | /* allocate descriptors */ | 1805 | /* allocate descriptors */ |
1806 | dd->dd_desc = dma_alloc_coherent(sc->dev, dd->dd_desc_len, | 1806 | dd->dd_desc = dma_alloc_coherent(sc->dev, dd->dd_desc_len, |
1807 | &dd->dd_desc_paddr, GFP_ATOMIC); | 1807 | &dd->dd_desc_paddr, GFP_KERNEL); |
1808 | if (dd->dd_desc == NULL) { | 1808 | if (dd->dd_desc == NULL) { |
1809 | error = -ENOMEM; | 1809 | error = -ENOMEM; |
1810 | goto fail; | 1810 | goto fail; |
@@ -1816,12 +1816,11 @@ int ath_descdma_setup(struct ath_softc *sc, struct ath_descdma *dd, | |||
1816 | 1816 | ||
1817 | /* allocate buffers */ | 1817 | /* allocate buffers */ |
1818 | bsize = sizeof(struct ath_buf) * nbuf; | 1818 | bsize = sizeof(struct ath_buf) * nbuf; |
1819 | bf = kmalloc(bsize, GFP_KERNEL); | 1819 | bf = kzalloc(bsize, GFP_KERNEL); |
1820 | if (bf == NULL) { | 1820 | if (bf == NULL) { |
1821 | error = -ENOMEM; | 1821 | error = -ENOMEM; |
1822 | goto fail2; | 1822 | goto fail2; |
1823 | } | 1823 | } |
1824 | memset(bf, 0, bsize); | ||
1825 | dd->dd_bufptr = bf; | 1824 | dd->dd_bufptr = bf; |
1826 | 1825 | ||
1827 | INIT_LIST_HEAD(head); | 1826 | INIT_LIST_HEAD(head); |
diff --git a/drivers/net/wireless/ath9k/recv.c b/drivers/net/wireless/ath9k/recv.c index 3df5c7824360..9439cb351118 100644 --- a/drivers/net/wireless/ath9k/recv.c +++ b/drivers/net/wireless/ath9k/recv.c | |||
@@ -100,7 +100,7 @@ static u64 ath_extend_tsf(struct ath_softc *sc, u32 rstamp) | |||
100 | return (tsf & ~0x7fff) | rstamp; | 100 | return (tsf & ~0x7fff) | rstamp; |
101 | } | 101 | } |
102 | 102 | ||
103 | static struct sk_buff *ath_rxbuf_alloc(struct ath_softc *sc, u32 len) | 103 | static struct sk_buff *ath_rxbuf_alloc(struct ath_softc *sc, u32 len, gfp_t gfp_mask) |
104 | { | 104 | { |
105 | struct sk_buff *skb; | 105 | struct sk_buff *skb; |
106 | u32 off; | 106 | u32 off; |
@@ -118,7 +118,7 @@ static struct sk_buff *ath_rxbuf_alloc(struct ath_softc *sc, u32 len) | |||
118 | * Unfortunately this means we may get 8 KB here from the | 118 | * Unfortunately this means we may get 8 KB here from the |
119 | * kernel... and that is actually what is observed on some | 119 | * kernel... and that is actually what is observed on some |
120 | * systems :( */ | 120 | * systems :( */ |
121 | skb = dev_alloc_skb(len + sc->cachelsz - 1); | 121 | skb = __dev_alloc_skb(len + sc->cachelsz - 1, gfp_mask); |
122 | if (skb != NULL) { | 122 | if (skb != NULL) { |
123 | off = ((unsigned long) skb->data) % sc->cachelsz; | 123 | off = ((unsigned long) skb->data) % sc->cachelsz; |
124 | if (off != 0) | 124 | if (off != 0) |
@@ -306,7 +306,7 @@ int ath_rx_init(struct ath_softc *sc, int nbufs) | |||
306 | } | 306 | } |
307 | 307 | ||
308 | list_for_each_entry(bf, &sc->rx.rxbuf, list) { | 308 | list_for_each_entry(bf, &sc->rx.rxbuf, list) { |
309 | skb = ath_rxbuf_alloc(sc, sc->rx.bufsize); | 309 | skb = ath_rxbuf_alloc(sc, sc->rx.bufsize, GFP_KERNEL); |
310 | if (skb == NULL) { | 310 | if (skb == NULL) { |
311 | error = -ENOMEM; | 311 | error = -ENOMEM; |
312 | break; | 312 | break; |
@@ -580,7 +580,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush) | |||
580 | 580 | ||
581 | /* Ensure we always have an skb to requeue once we are done | 581 | /* Ensure we always have an skb to requeue once we are done |
582 | * processing the current buffer's skb */ | 582 | * processing the current buffer's skb */ |
583 | requeue_skb = ath_rxbuf_alloc(sc, sc->rx.bufsize); | 583 | requeue_skb = ath_rxbuf_alloc(sc, sc->rx.bufsize, GFP_ATOMIC); |
584 | 584 | ||
585 | /* If there is no memory we ignore the current RX'd frame, | 585 | /* If there is no memory we ignore the current RX'd frame, |
586 | * tell hardware it can give us a new frame using the old | 586 | * tell hardware it can give us a new frame using the old |