Commit aeb63cfd authored by Luis R. Rodriguez's avatar Luis R. Rodriguez Committed by John W. Linville

ath5k: use common ath.ko ath_rxbuf_alloc()

Now that its shared we can remove ath5k's own implementation.
Signed-off-by: default avatarLuis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent d15dd3e5
...@@ -544,7 +544,7 @@ ath5k_pci_probe(struct pci_dev *pdev, ...@@ -544,7 +544,7 @@ ath5k_pci_probe(struct pci_dev *pdev,
__set_bit(ATH_STAT_INVALID, sc->status); __set_bit(ATH_STAT_INVALID, sc->status);
sc->iobase = mem; /* So we can unmap it on detach */ sc->iobase = mem; /* So we can unmap it on detach */
sc->cachelsz = csz * sizeof(u32); /* convert to bytes */ sc->common.cachelsz = csz * sizeof(u32); /* convert to bytes */
sc->opmode = NL80211_IFTYPE_STATION; sc->opmode = NL80211_IFTYPE_STATION;
sc->bintval = 1000; sc->bintval = 1000;
mutex_init(&sc->lock); mutex_init(&sc->lock);
...@@ -1151,27 +1151,20 @@ static ...@@ -1151,27 +1151,20 @@ static
struct sk_buff *ath5k_rx_skb_alloc(struct ath5k_softc *sc, dma_addr_t *skb_addr) struct sk_buff *ath5k_rx_skb_alloc(struct ath5k_softc *sc, dma_addr_t *skb_addr)
{ {
struct sk_buff *skb; struct sk_buff *skb;
unsigned int off;
/* /*
* Allocate buffer with headroom_needed space for the * Allocate buffer with headroom_needed space for the
* fake physical layer header at the start. * fake physical layer header at the start.
*/ */
skb = dev_alloc_skb(sc->rxbufsize + sc->cachelsz - 1); skb = ath_rxbuf_alloc(&sc->common,
sc->rxbufsize + sc->common.cachelsz - 1,
GFP_ATOMIC);
if (!skb) { if (!skb) {
ATH5K_ERR(sc, "can't alloc skbuff of size %u\n", ATH5K_ERR(sc, "can't alloc skbuff of size %u\n",
sc->rxbufsize + sc->cachelsz - 1); sc->rxbufsize + sc->common.cachelsz - 1);
return NULL; return NULL;
} }
/*
* Cache-line-align. This is important (for the
* 5210 at least) as not doing so causes bogus data
* in rx'd frames.
*/
off = ((unsigned long)skb->data) % sc->cachelsz;
if (off != 0)
skb_reserve(skb, sc->cachelsz - off);
*skb_addr = pci_map_single(sc->pdev, *skb_addr = pci_map_single(sc->pdev,
skb->data, sc->rxbufsize, PCI_DMA_FROMDEVICE); skb->data, sc->rxbufsize, PCI_DMA_FROMDEVICE);
...@@ -1613,10 +1606,10 @@ ath5k_rx_start(struct ath5k_softc *sc) ...@@ -1613,10 +1606,10 @@ ath5k_rx_start(struct ath5k_softc *sc)
struct ath5k_buf *bf; struct ath5k_buf *bf;
int ret; int ret;
sc->rxbufsize = roundup(IEEE80211_MAX_LEN, sc->cachelsz); sc->rxbufsize = roundup(IEEE80211_MAX_LEN, sc->common.cachelsz);
ATH5K_DBG(sc, ATH5K_DEBUG_RESET, "cachelsz %u rxbufsize %u\n", ATH5K_DBG(sc, ATH5K_DEBUG_RESET, "cachelsz %u rxbufsize %u\n",
sc->cachelsz, sc->rxbufsize); sc->common.cachelsz, sc->rxbufsize);
spin_lock_bh(&sc->rxbuflock); spin_lock_bh(&sc->rxbuflock);
sc->rxlink = NULL; sc->rxlink = NULL;
......
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
#include "ath5k.h" #include "ath5k.h"
#include "debug.h" #include "debug.h"
#include "../ath.h"
#define ATH_RXBUF 40 /* number of RX buffers */ #define ATH_RXBUF 40 /* number of RX buffers */
#define ATH_TXBUF 200 /* number of TX buffers */ #define ATH_TXBUF 200 /* number of TX buffers */
...@@ -112,6 +113,7 @@ struct ath5k_rfkill { ...@@ -112,6 +113,7 @@ struct ath5k_rfkill {
* associated with an instance of a device */ * associated with an instance of a device */
struct ath5k_softc { struct ath5k_softc {
struct pci_dev *pdev; /* for dma mapping */ struct pci_dev *pdev; /* for dma mapping */
struct ath_common common;
void __iomem *iobase; /* address of the device */ void __iomem *iobase; /* address of the device */
struct mutex lock; /* dev-level lock */ struct mutex lock; /* dev-level lock */
struct ieee80211_tx_queue_stats tx_stats[AR5K_NUM_TX_QUEUES]; struct ieee80211_tx_queue_stats tx_stats[AR5K_NUM_TX_QUEUES];
...@@ -134,7 +136,6 @@ struct ath5k_softc { ...@@ -134,7 +136,6 @@ struct ath5k_softc {
struct ath5k_desc *desc; /* TX/RX descriptors */ struct ath5k_desc *desc; /* TX/RX descriptors */
dma_addr_t desc_daddr; /* DMA (physical) address */ dma_addr_t desc_daddr; /* DMA (physical) address */
size_t desc_len; /* size of TX/RX descriptors */ size_t desc_len; /* size of TX/RX descriptors */
u16 cachelsz; /* cache line size */
DECLARE_BITMAP(status, 5); DECLARE_BITMAP(status, 5);
#define ATH_STAT_INVALID 0 /* disable hardware accesses */ #define ATH_STAT_INVALID 0 /* disable hardware accesses */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment