commit e3da8ea8c04c123504a0b4fe8cf2cc18447d6799 Author: Jiri Slaby Date: Wed Jun 20 18:22:24 2007 +0200 alloc ieee80211_hw instead of netdev diff --git a/ath/if_ath.c b/ath/if_ath.c index e2dc8ee..f342270 100644 --- a/ath/if_ath.c +++ b/ath/if_ath.c @@ -86,15 +86,15 @@ enum { ATH_LED_POLL, }; -static int ath_init(struct net_device *); -static int ath_reset(struct net_device *); +static int ath_init(struct ieee80211_hw *); +static int ath_reset(struct ieee80211_hw *); static void ath_fatal_tasklet(unsigned long); static void ath_bstuck_tasklet(unsigned long); static void ath_rxorn_tasklet(unsigned long); static void ath_bmiss_tasklet(unsigned long); static void ath_radar_tasklet(unsigned long); -static int ath_stop_locked(struct net_device *); -static int ath_stop(struct net_device *); +static int ath_stop_locked(struct ieee80211_hw *); +static int ath_stop(struct ieee80211_hw *); #ifdef BLE static int ath_media_change(struct net_device *); static int ath_key_alloc(struct ieee80211com *, @@ -115,7 +115,7 @@ static int ath_beaconq_setup(struct ath_hal *); static void ath_beacon_setup(struct ath_softc *, struct ath_buf *, struct ieee80211_tx_control *); static void ath_beacon_send(struct net_device *); -static void ath_beacon_free(struct ath_softc *); +//static void ath_beacon_free(struct ath_softc *); //static void ath_beacon_config(struct ath_softc *); static void ath_descdma_cleanup(struct ath_softc *sc, struct list_head *); static int ath_desc_alloc(struct ath_softc *); @@ -148,8 +148,8 @@ static void ath_tx_tasklet(unsigned long data); static void ath_tx_timeout(struct net_device *); static int ath_chan_set(struct ath_softc *, struct ieee80211_channel *); #endif -static void ath_draintxq(struct ath_softc *); -static void ath_stoprecv(struct ath_softc *); +//static void ath_draintxq(struct ath_softc *); +//static void ath_stoprecv(struct ath_softc *); static int ath_startrecv(struct ath_softc *); //static void ath_chan_change(struct ath_softc *, struct ieee80211_channel *); static void ath_next_scan(unsigned long); @@ -166,7 +166,7 @@ static struct iw_handler_def ath_iw_handler_def; static void ath_setup_stationkey(struct ieee80211_node *); static void ath_newassoc(struct ieee80211_node *, int); #endif -static int ath_getchannels(struct net_device *, u_int cc, +static int ath_getchannels(struct ieee80211_hw *, u_int cc, bool outdoor, bool xchanmode); #ifdef BLE static void ath_led_event(struct ath_softc *, int); @@ -178,7 +178,7 @@ static int ath_set_mac_address(struct net_device *, void *); static int ath_change_mtu(struct net_device *, int); static int ath_ioctl(struct net_device *, struct ifreq *, int); #endif -static int ath_rate_setup(struct net_device *, u_int mode); +static int ath_rate_setup(struct ieee80211_hw *, u_int mode); static void ath_setcurmode(struct ath_softc *, unsigned int); //static int ath_rawdev_attach(struct ath_softc *); @@ -233,16 +233,16 @@ enum { ATH_DEBUG_FATAL = 0x80000000, /* fatal errors */ ATH_DEBUG_ANY = 0xffffffff }; -#define DPRINTF(sc, _m, _fmt, ...) do { \ - if (sc->sc_debug & (_m)) \ - printk(_fmt, __VA_ARGS__); \ +#define DPRINTF(sc, _m, _fmt...) do { \ + if (sc->sc_debug & (_m)) \ + printk(_fmt); \ } while (0) #define KEYPRINTF(sc, ix, hk, mac) do { \ if (sc->sc_debug & ATH_DEBUG_KEYCACHE) \ ath_keyprint(__func__, ix, hk, mac); \ } while (0) static void ath_printrxbuf(struct ath_buf *bf, int); -static void ath_printtxbuf(struct ath_buf *bf, int); +//static void ath_printtxbuf(struct ath_buf *bf, int); #else #define IFF_DUMPPKTS(sc, _m) 0 #define DPRINTF(sc, _m, _fmt, ...) @@ -316,9 +316,9 @@ struct wlan_ng_prism2_header { }; int -ath_attach(u_int16_t devid, struct net_device *dev) +ath_attach(u_int16_t devid, struct ieee80211_hw *hw) { - struct ath_softc *sc = dev->priv; + struct ath_softc *sc = hw->priv; // struct ieee80211com *ic = &sc->sc_ic; struct ath_hal *ah; enum ath5k_status status; @@ -338,12 +338,12 @@ ath_attach(u_int16_t devid, struct net_device *dev) ATH_LOCK_INIT(sc); ATH_TXBUF_LOCK_INIT(sc); - tasklet_init(&sc->sc_rxtq, ath_rx_tasklet, (unsigned long)dev); - tasklet_init(&sc->sc_rxorntq, ath_rxorn_tasklet, (unsigned long)dev); - tasklet_init(&sc->sc_fataltq, ath_fatal_tasklet, (unsigned long)dev); - tasklet_init(&sc->sc_bmisstq, ath_bmiss_tasklet, (unsigned long)dev); - tasklet_init(&sc->sc_bstuckq, ath_bstuck_tasklet, (unsigned long)dev); - tasklet_init(&sc->sc_radartq, ath_radar_tasklet, (unsigned long)dev); + tasklet_init(&sc->sc_rxtq, ath_rx_tasklet, (unsigned long)hw); + tasklet_init(&sc->sc_rxorntq, ath_rxorn_tasklet, (unsigned long)hw); + tasklet_init(&sc->sc_fataltq, ath_fatal_tasklet, (unsigned long)hw); + tasklet_init(&sc->sc_bmisstq, ath_bmiss_tasklet, (unsigned long)hw); + tasklet_init(&sc->sc_bstuckq, ath_bstuck_tasklet, (unsigned long)hw); + tasklet_init(&sc->sc_radartq, ath_radar_tasklet, (unsigned long)hw); /* * Attach the hal @@ -417,8 +417,7 @@ ath_attach(u_int16_t devid, struct net_device *dev) ath_outdoor = outdoor; if (xchanmode != -1) ath_xchanmode = xchanmode; - error = ath_getchannels(dev, ath_countrycode, - ath_outdoor, ath_xchanmode); + error = ath_getchannels(hw, ath_countrycode, ath_outdoor,ath_xchanmode); if (error != 0) { printk("error! but continuing anyways...\n"); //goto bad; @@ -427,11 +426,11 @@ ath_attach(u_int16_t devid, struct net_device *dev) /* * Setup rate tables for all potential media types. */ - ath_rate_setup(dev, MODE_IEEE80211A); - ath_rate_setup(dev, MODE_IEEE80211B); - ath_rate_setup(dev, MODE_IEEE80211G); - ath_rate_setup(dev, MODE_ATHEROS_TURBO); - ath_rate_setup(dev, MODE_ATHEROS_TURBOG); + ath_rate_setup(hw, MODE_IEEE80211A); + ath_rate_setup(hw, MODE_IEEE80211B); + ath_rate_setup(hw, MODE_IEEE80211G); + ath_rate_setup(hw, MODE_ATHEROS_TURBO); + ath_rate_setup(hw, MODE_ATHEROS_TURBOG); /* NB: setup here so ath_rate_update is happy */ ath_setcurmode(sc, MODE_IEEE80211A); @@ -522,11 +521,11 @@ ath_attach(u_int16_t devid, struct net_device *dev) #endif init_timer(&sc->sc_scan_ch); sc->sc_scan_ch.function = ath_next_scan; - sc->sc_scan_ch.data = (unsigned long) dev; + sc->sc_scan_ch.data = (unsigned long)hw; init_timer(&sc->sc_cal_ch); sc->sc_cal_ch.function = ath_calibrate; - sc->sc_cal_ch.data = (unsigned long) dev; + sc->sc_cal_ch.data = (unsigned long)hw; sc->sc_blinking = 0; sc->sc_ledstate = 1; @@ -661,8 +660,6 @@ ath_attach(u_int16_t devid, struct net_device *dev) sc->sc_hasveol = ath_hal_hasveol(ah); sc->sc_rxfilter = 0; - sc->sc_rawdev_enabled = 0; - sc->sc_rawdev.type = ARPHRD_IEEE80211; /* get mac address from hardware */ // ath_hal_getmac(ah, ic->ic_myaddr); BLEE @@ -735,13 +732,12 @@ bad: } int -ath_detach(struct net_device *dev) +ath_detach(struct ieee80211_hw *hw) { - struct ath_softc *sc = dev->priv; + struct ath_softc *sc = hw->priv; // struct ieee80211com *ic = &sc->sc_ic; - DPRINTF(sc, ATH_DEBUG_ANY, "%s: flags %x\n", __func__, dev->flags); - ath_stop(dev); + ath_stop(hw); sc->sc_invalid = 1; /* * NB: the order of these is important: @@ -774,26 +770,24 @@ ath_detach(struct net_device *dev) } void -ath_suspend(struct net_device *dev) +ath_suspend(struct ieee80211_hw *hw) { - struct ath_softc *sc = dev->priv; + struct ath_softc *sc = hw->priv; struct ath_hal *ah = sc->sc_ah; - DPRINTF(sc, ATH_DEBUG_ANY, "%s: flags %x\n", __func__, dev->flags); if (sc->sc_softled) ath5k_hw_set_gpio(ah, sc->sc_ledpin, 1); - ath_stop(dev); + ath_stop(hw); } void -ath_resume(struct net_device *dev) +ath_resume(struct ieee80211_hw *hw) { - struct ath_softc *sc = dev->priv; + struct ath_softc *sc = hw->priv; struct ath_hal *ah = sc->sc_ah; - DPRINTF(sc, ATH_DEBUG_ANY, "%s: flags %x\n", __func__, dev->flags); - ath_init(dev); + ath_init(hw); if (sc->sc_softled) { ath5k_hw_set_gpio_output(ah, sc->sc_ledpin); ath5k_hw_set_gpio(ah, sc->sc_ledpin, 0); @@ -917,16 +911,16 @@ irqreturn_t ath_intr(int irq, void *dev_id) static void ath_fatal_tasklet(unsigned long data) { - struct net_device *dev = (struct net_device *)data; + struct ieee80211_hw *hw = (void *)data; printk(KERN_ERR "hardware error; resetting\n"); - ath_reset(dev); + ath_reset(hw); } static void -ath_radar_tasklet (unsigned long data) +ath_radar_tasklet(unsigned long data) { - struct net_device *dev = (struct net_device *)data; + struct ieee80211_hw *hw = (void *)data; #ifdef BLE struct ath_softc *sc = dev->priv; struct ieee80211com *ic = &sc->sc_ic; @@ -945,23 +939,23 @@ ath_radar_tasklet (unsigned long data) ic->ic_ibss_chan = c; ieee80211_new_state (ic, IEEE80211_S_INIT, -1); #endif - ath_init (dev); + ath_init(hw); } static void ath_rxorn_tasklet(unsigned long data) { - struct net_device *dev = (struct net_device *)data; + struct ieee80211_hw *hw = (void *)data; printk(KERN_WARNING "rx FIFO overrun; resetting\n"); - ath_reset(dev); + ath_reset(hw); } static void ath_bmiss_tasklet(unsigned long data) { #ifdef BLE - struct net_device *dev = (struct net_device *)data; + struct ieee80211_hw *dev = (void *)data; struct ath_softc *sc = dev->priv; struct ieee80211com *ic = &sc->sc_ic; @@ -1019,9 +1013,9 @@ ath_chan2flags(struct ieee80211com *ic, struct ieee80211_channel *chan) } #endif static int -ath_init(struct net_device *dev) +ath_init(struct ieee80211_hw *hw) { - struct ath_softc *sc = dev->priv; + struct ath_softc *sc = hw->priv; struct ath_hal *ah = sc->sc_ah; enum ath5k_status status; int error = 0; @@ -1034,7 +1028,7 @@ ath_init(struct net_device *dev) * Stop anything previously setup. This is safe * whether this is the first time through or not. */ - ath_stop_locked(dev); + ath_stop_locked(hw); #ifdef BLE /* * Change our interface type if we are in monitor mode. @@ -1122,14 +1116,14 @@ done: } static int -ath_stop_locked(struct net_device *dev) +ath_stop_locked(struct ieee80211_hw *hw) { - struct ath_softc *sc = dev->priv; -// struct ieee80211com *ic = &sc->sc_ic; +#ifdef BLE + struct ath_softc *sc = hw->priv; struct ath_hal *ah = sc->sc_ah; - DPRINTF(sc, ATH_DEBUG_RESET, "%s: invalid %u flags 0x%x\n", - __func__, sc->sc_invalid, dev->flags); + DPRINTF(sc, ATH_DEBUG_RESET, "%s: invalid %u\n", + __func__, sc->sc_invalid); ATH_LOCK_ASSERT(sc); if (dev->flags & IFF_RUNNING) { @@ -1150,9 +1144,9 @@ ath_stop_locked(struct net_device *dev) * hardware is gone (invalid). */ // ieee80211_new_state(ic, IEEE80211_S_INIT, -1); - netif_stop_queue(dev); - if (sc->sc_rawdev_enabled) - netif_stop_queue(&sc->sc_rawdev); +// netif_stop_queue(dev); +// if (sc->sc_rawdev_enabled) +// netif_stop_queue(&sc->sc_rawdev); dev->flags &= ~IFF_RUNNING; if (!sc->sc_invalid) { @@ -1172,6 +1166,7 @@ ath_stop_locked(struct net_device *dev) sc->sc_rxlink = NULL; ath_beacon_free(sc); } +#endif return 0; } @@ -1182,13 +1177,13 @@ ath_stop_locked(struct net_device *dev) * stop is preempted). */ static int -ath_stop(struct net_device *dev) +ath_stop(struct ieee80211_hw *hw) { - struct ath_softc *sc = dev->priv; + struct ath_softc *sc = hw->priv; int error; ATH_LOCK(sc); - error = ath_stop_locked(dev); + error = ath_stop_locked(hw); if (error == 0 && !sc->sc_invalid) { /* * Set the chip in full sleep mode. Note that we are @@ -1228,16 +1223,16 @@ ath_stop(struct net_device *dev) * to reset or reload hardware state. */ static int -ath_reset(struct net_device *dev) +ath_reset(struct ieee80211_hw *hw) { - struct ath_softc *sc = dev->priv; -// struct ath_hal *ah = sc->sc_ah; -// struct ieee80211_channel *c; -// enum ath5k_status status; -// int opmode; +#ifdef BLE + struct ath_softc *sc = hw->priv; + struct ath_hal *ah = sc->sc_ah; + struct ieee80211_channel *c; + enum ath5k_status status; + int opmode; DPRINTF(sc, ATH_DEBUG_RESET, "%s: resetting\n", dev->name); -#ifdef BLE /* * Convert to a HAL channel description with the flags * constrained to reflect the current operating mode. @@ -1271,9 +1266,10 @@ ath_reset(struct net_device *dev) if (ic->ic_state == IEEE80211_S_RUN) netif_wake_queue(dev); /* restart xmit */ -#endif + if (sc->sc_rawdev_enabled) netif_wake_queue(&sc->sc_rawdev); +#endif return 0; } @@ -2744,14 +2740,14 @@ ath_beacon_send(struct net_device *dev) static void ath_bstuck_tasklet(unsigned long data) { - struct net_device *dev = (struct net_device *)data; - struct ath_softc *sc = dev->priv; + struct ieee80211_hw *hw = (void *)data; + struct ath_softc *sc = hw->priv; printk(KERN_WARNING "stuck beacon; resetting (bmiss count %u)\n", sc->sc_bmisscount); - ath_reset(dev); + ath_reset(hw); } - +#ifdef BLE /* * Reclaim beacon resources. */ @@ -2777,7 +2773,6 @@ ath_beacon_free(struct ath_softc *sc) // } } -#ifdef BLE /* * Configure the beacon and sleep timers. * @@ -3154,11 +3149,14 @@ ath_rxbuf_init(struct ath_softc *sc, struct ath_buf *bf) if (sc->sc_opmode == IEEE80211_IF_TYPE_MNTR) { headroom_needed = sizeof(struct wlan_ng_prism2_header); - } else if (sc->sc_rawdev.type == ARPHRD_IEEE80211_PRISM) { + } +#ifdef BLE + else if (sc->sc_rawdev.type == ARPHRD_IEEE80211_PRISM) { headroom_needed = sizeof(struct wlan_ng_prism2_header); } else if (sc->sc_rawdev.type == ARPHRD_IEEE80211_RADIOTAP) { headroom_needed = sizeof(struct ath_rx_radiotap_header); } +#endif /* * Check if we have enough headroom. If not, just free the skb @@ -3207,7 +3205,7 @@ ath_rxbuf_init(struct ath_softc *sc, struct ath_buf *bf) if (off != 0) skb_reserve(skb, sc->sc_cachelsz - off); - skb->dev = &sc->sc_dev; +// skb->dev = sc->sc_dev; bf->bf_skb = skb; bf->bf_skbaddr = bus_map_single(sc->sc_bdev, skb->data, sc->sc_rxbufsize, BUS_DMA_FROMDEVICE); @@ -3832,7 +3830,7 @@ rx_accept: skb_put(skb, len); skb->protocol = __constant_htons(ETH_P_CONTROL); - +#ifdef BLE if (sc->sc_rawdev_enabled && (sc->sc_rawdev.flags & IFF_UP)) { struct sk_buff *skb2; @@ -3841,7 +3839,7 @@ rx_accept: ath_rx_capture(&sc->sc_rawdev, ds, skb2); } } - +#endif if (sc->sc_opmode == IEEE80211_IF_TYPE_MNTR) { /* * Monitor mode: discard anything shorter than @@ -4019,7 +4017,7 @@ ath_txq_setup(struct ath_softc *sc, int qtype, int subtype) } if (qnum >= N(sc->sc_txq)) { printk("%s: hal qnum %u out of range, max %u!\n", - sc->sc_dev.name, qnum, (unsigned int) N(sc->sc_txq)); + "BLE"/*sc->sc_dev->name*/, qnum, (unsigned int) N(sc->sc_txq)); ath5k_hw_release_tx_queue(ah, qnum); return NULL; } @@ -4842,7 +4840,6 @@ ath_tx_timeout(struct net_device *dev) sc->sc_stats.ast_watchdog++; ath_init(dev); } -#endif static void ath_tx_draintxq(struct ath_softc *sc, struct ath_txq *txq) @@ -4923,13 +4920,9 @@ ath_draintxq(struct ath_softc *sc) ath_tx_stopdma(sc, &sc->sc_txq[i]); } } - sc->sc_dev.trans_start = jiffies; - sc->sc_rawdev.trans_start = jiffies; - - netif_start_queue(&sc->sc_dev); // TODO: needed here? - if (sc->sc_rawdev_enabled) - netif_start_queue(&sc->sc_rawdev); +// sc->sc_dev->trans_start = jiffies; +// netif_start_queue(sc->sc_dev); // TODO: needed here? for (i = 0; i < AR5K_NUM_TX_QUEUES; i++) { if (ATH_TXQ_SETUP(sc, i)) ath_tx_draintxq(sc, &sc->sc_txq[i]); @@ -4972,7 +4965,7 @@ ath_stoprecv(struct ath_softc *sc) sc->sc_rxlink = NULL; /* just in case */ #undef PA2DESC } - +#endif /* * Enable the receive h/w following a reset. */ @@ -5159,8 +5152,8 @@ ath_next_scan(unsigned long arg) static void ath_calibrate(unsigned long arg) { - struct net_device *dev = (struct net_device *) arg; - struct ath_softc *sc = dev->priv; + struct ieee80211_hw *hw = (void *)arg; + struct ath_softc *sc = hw->priv; struct ath_hal *ah = sc->sc_ah; sc->sc_stats.ast_per_cal++; @@ -5174,9 +5167,8 @@ ath_calibrate(unsigned long arg) * to load new gain values. */ sc->sc_stats.ast_per_rfgain++; - DPRINTF(sc, ATH_DEBUG_RESET, "%s: calibration, resetting\n", - dev->name); - ath_reset(dev); + DPRINTF(sc, ATH_DEBUG_RESET, "calibration, resetting\n"); + ath_reset(hw); } if (!ath5k_hw_phy_calibrate(ah, &sc->sc_curchan)) { DPRINTF(sc, ATH_DEBUG_ANY, @@ -5390,10 +5382,10 @@ ath_newassoc(struct ieee80211_node *ni, int isnew) } #endif static int -ath_getchannels(struct net_device *dev, u_int cc, +ath_getchannels(struct ieee80211_hw *hw, u_int cc, bool outdoor, bool xchanmode) { - struct ath_softc *sc = dev->priv; + struct ath_softc *sc = hw->priv; struct ath_hal *ah = sc->sc_ah; struct ath5k_channel *chans; int i, ix; @@ -5521,7 +5513,7 @@ ath_update_txpow(struct ath_softc *sc) } static int -ath_rate_setup(struct net_device *dev, u_int mode) +ath_rate_setup(struct ieee80211_hw *dev, u_int mode) { struct ath_softc *sc = dev->priv; struct ath_hal *ah = sc->sc_ah; @@ -5726,7 +5718,7 @@ ath_printrxbuf(struct ath_buf *bf, int done) ds->ds_hw[0], ds->ds_hw[1], !done ? ' ' : (ds->ds_rxstat.rs_status == 0) ? '*' : '!'); } - +#ifdef BLE static void ath_printtxbuf(struct ath_buf *bf, int done) { @@ -5739,6 +5731,7 @@ ath_printtxbuf(struct ath_buf *bf, int done) ds->ds_hw[0], ds->ds_hw[1], ds->ds_hw[2], ds->ds_hw[3], !done ? ' ' : (ds->ds_txstat.ts_status == 0) ? '*' : '!'); } +#endif #endif /* AR_DEBUG */ #ifdef BLE /* @@ -6352,7 +6345,7 @@ ath_sysctl_halparam(ctl_table *ctl, int write, struct file *filp, #endif case ATH_RXFILTER: sc->sc_rxfilter = val; - ath_reset(&sc->sc_dev); +// ath_reset(sc->sc_dev); break; case ATH_RADARSIM: tasklet_schedule(&sc->sc_radartq); @@ -6417,6 +6410,7 @@ ath_sysctl_halparam(ctl_table *ctl, int write, struct file *filp, case ATH_BINTVAL: // val = (sc->sc_ic).ic_lintval; break; +#ifdef BLE case ATH_RAWDEV: val = sc->sc_rawdev_enabled; break; @@ -6429,6 +6423,7 @@ ath_sysctl_halparam(ctl_table *ctl, int write, struct file *filp, val = 0; } break; +#endif case ATH_RXFILTER: val = sc->sc_rxfilter; break; @@ -6585,7 +6580,7 @@ ath_dynamic_sysctl_register(struct ath_softc *sc) sc->sc_sysctls[0].child = &sc->sc_sysctls[2]; /* [1] is NULL terminator */ sc->sc_sysctls[2].ctl_name = CTL_AUTO; - sc->sc_sysctls[2].procname = sc->sc_dev.name; + sc->sc_sysctls[2].procname = "BLE";//sc->sc_dev->name; sc->sc_sysctls[2].mode = 0555; sc->sc_sysctls[2].child = &sc->sc_sysctls[4]; /* [3] is NULL terminator */ diff --git a/ath/if_ath_pci.c b/ath/if_ath_pci.c index ad78e30..c9c4a4f 100644 --- a/ath/if_ath_pci.c +++ b/ath/if_ath_pci.c @@ -37,11 +37,6 @@ #include "if_athvar.h" #include "if_ath_pci.h" -/* support for module parameters */ -static char *ifname = "ath"; -module_param(ifname, charp, 0); -MODULE_PARM_DESC(ifname, "Interface name prefix (default: ath)"); - /* * User a static table of PCI id's for now. While this is the * "new way" to do things, we may want to switch back to having @@ -75,12 +70,30 @@ void bus_read_cachesize(struct ath_softc *sc, u8 *csz) pci_read_config_byte(sc->sc_bdev, PCI_CACHE_LINE_SIZE, csz); } +static struct ieee80211_ops ath_hw_ops = { +/* .tx = d_tx, + .open = d_open, + .stop = d_stop, + .add_interface = d_add_interface, + .remove_interface = d_remove_interface, + .config = d_config, + .config_interface = d_config_interface, + .set_key = d_set_key, + .get_stats = d_get_stats, + .get_tx_stats = d_get_tx_stats, + .conf_tx = d_conf_tx, + .get_tsf = d_get_tsf, + .reset_tsf = d_reset_tsf, + .beacon_update = d_beacon_update, + .hw_scan = d_hw_scan*/ +}; + static int __devinit ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) { void __iomem *mem; struct ath_softc *sc; - struct net_device *dev; + struct ieee80211_hw *hw; const char *athname; int retval; u32 val; @@ -146,55 +159,46 @@ static int __devinit ath_pci_probe(struct pci_dev *pdev, goto err_reg; } - sc = kzalloc(sizeof(struct ath_softc), GFP_KERNEL); - if (sc == NULL) { - dev_err(&pdev->dev, "no memory for device state\n"); + hw = ieee80211_alloc_hw(sizeof(*sc), &ath_hw_ops); + if (hw == NULL) { + dev_err(&pdev->dev, "cannot allocate ieee80211_hw\n"); goto err_map; } + SET_IEEE80211_DEV(hw, &pdev->dev); + sc = hw->priv; + sc->hw = hw; + /* * Mark the device as detached to avoid processing * interrupts until setup is complete. */ sc->sc_invalid = 1; - - dev = &sc->sc_dev; - - /* use variable interface name prefix */ - strncpy(dev->name, ifname, IFNAMSIZ - sizeof("%d") - 1); - strncat(dev->name, "%d", sizeof("%d")); - - dev->irq = pdev->irq; - dev->priv = sc; sc->sc_iobase = mem; - - SET_MODULE_OWNER(dev); - SET_NETDEV_DEV(dev, &pdev->dev); - sc->sc_bdev = pdev; - pci_set_drvdata(pdev, dev); + pci_set_drvdata(pdev, hw); - if (request_irq(dev->irq, ath_intr, IRQF_SHARED, dev->name, dev)) { + if (request_irq(pdev->irq, ath_intr, IRQF_SHARED, "ath", sc)) { dev_err(&pdev->dev, "request_irq failed\n"); goto err_free; } - if (ath_attach(id->device, dev) != 0) + if (ath_attach(id->device, hw) != 0) goto err_irq; athname = ath_hal_probe(id->vendor, id->device); dev_info(&pdev->dev, "%s: irq=%d\n", - athname ? athname : "Atheros ???", dev->irq); + athname ? athname : "Atheros ???", pdev->irq); /* ready to process interrupts */ sc->sc_invalid = 0; return 0; err_irq: - free_irq(dev->irq, dev); + free_irq(pdev->irq, sc); err_free: - kfree(sc); + ieee80211_free_hw(hw); err_map: pci_iounmap(pdev, mem); err_reg: @@ -207,15 +211,15 @@ err: static void __devexit ath_pci_remove(struct pci_dev *pdev) { - struct net_device *dev = pci_get_drvdata(pdev); - struct ath_softc *sc = dev->priv; + struct ieee80211_hw *hw = pci_get_drvdata(pdev); + struct ath_softc *sc = hw->priv; - ath_detach(dev); - free_irq(dev->irq, dev); + ath_detach(hw); + free_irq(pdev->irq, sc); pci_iounmap(pdev, sc->sc_iobase); pci_release_region(pdev, 0); pci_disable_device(pdev); - free_netdev(dev); + ieee80211_free_hw(hw); } #ifdef CONFIG_PM diff --git a/ath/if_athvar.h b/ath/if_athvar.h index 0d3f1d2..c9685eb 100644 --- a/ath/if_athvar.h +++ b/ath/if_athvar.h @@ -177,16 +177,12 @@ struct ath_txq { } while (0) struct ath_softc { - struct net_device sc_dev; /* NB: must be first */ void __iomem *sc_iobase; /* address of the device */ - struct net_device sc_rawdev; /* live monitor device */ struct semaphore sc_lock; /* dev-level lock */ struct net_device_stats sc_devstats; /* device statistics */ struct ath_stats sc_stats; /* private statistics */ - struct ieee80211_hw sc_hw; /* IEEE 802.11 common */ -#ifdef BLE - struct ieee80211com sc_ic; /* IEEE 802.11 common */ -#endif + struct ieee80211_hw *hw; /* IEEE 802.11 common */ + enum ieee80211_if_types sc_opmode; int sc_regdomain; int sc_countrycode; @@ -220,8 +216,7 @@ struct ath_softc { sc_blinking: 1, /* LED blink operation active */ sc_endblink: 1, /* finish LED blink operation */ sc_mcastkey: 1, /* mcast key cache search */ - sc_hasclrkey:1, /* CLR key supported */ - sc_rawdev_enabled : 1; /* enable sc_rawdev */ + sc_hasclrkey:1; /* CLR key supported */ /* rate tables */ const struct ath5k_rate_table *sc_rates[NUM_IEEE80211_MODES]; const struct ath5k_rate_table *sc_currates; /* current rate table */ @@ -329,10 +324,10 @@ struct ath_softc { #define ATH_TXBUF_LOCK_ASSERT(_sc) \ KASSERT(spin_is_locked(&(_sc)->sc_txbuflock), ("txbuf not locked!")) -int ath_attach(u16, struct net_device *); -int ath_detach(struct net_device *); -void ath_resume(struct net_device *); -void ath_suspend(struct net_device *); +int ath_attach(u16, struct ieee80211_hw *); +int ath_detach(struct ieee80211_hw *); +void ath_resume(struct ieee80211_hw *); +void ath_suspend(struct ieee80211_hw *); /* *Port r1752 - Starting linux kernel v2.6.19 and later *interrupt handlers are not passed.