commit c42b2eb9711d74c467f30dc022bd2ffd64b54b1f Author: Jiri Slaby Date: Wed Jun 27 20:41:10 2007 +0200 register_hw, ops are empty routines so far diff --git a/ath/if_ath_pci.c b/ath/if_ath_pci.c index 6faf778..b2fcefe 100644 --- a/ath/if_ath_pci.c +++ b/ath/if_ath_pci.c @@ -109,22 +109,54 @@ static struct pci_device_id ath_pci_id_table[] __devinitdata = { }; MODULE_DEVICE_TABLE(pci, ath_pci_id_table); +static int ath_open(struct ieee80211_hw *hw) +{ + printk("%s\n", __FUNCTION__); + return 0; +} + +static int ath_stop(struct ieee80211_hw *hw) +{ + printk("%s\n", __FUNCTION__); + return 0; +} + +static int ath_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf) +{ + printk("%s\n", __FUNCTION__); + return 0; +} + +static int ath_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len) +{ + printk("%s\n", __FUNCTION__); + return 0; +} + +static int ath_conf_tx(struct ieee80211_hw *hw, int queue, + const struct ieee80211_tx_queue_params *params) +{ + printk("%s\n", __FUNCTION__); + return 0; +} + 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*/ + .tx = NULL, + .reset = NULL, + .open = ath_open, + .stop = ath_stop, + .add_interface = NULL, + .remove_interface = NULL, + .config = ath_config, + .config_interface = NULL, + .set_key = NULL, + .hw_scan = ath_hw_scan, + .get_stats = NULL, + .conf_tx = ath_conf_tx, +/* .get_tx_stats = , + .get_tsf = , + .reset_tsf = , + .beacon_update = ,*/ }; static irqreturn_t ath_intr(int irq, void *dev_id) @@ -656,6 +688,7 @@ static int ath_attach(struct pci_dev *pdev, struct ieee80211_hw *hw) { struct ath_softc *sc = hw->priv; struct ath_hw *ah = sc->ah; + u8 mac[ETH_ALEN]; unsigned int i; int ret; @@ -808,7 +841,7 @@ static int ath_attach(struct pci_dev *pdev, struct ieee80211_hw *hw) sc->blinking = 0; sc->ledstate = 1; sc->ledon = 0; /* low true */ - sc->ledidle = (2700*HZ)/1000; /* 2.7sec */ + sc->ledidle = msecs_to_jiffies(2700); /* 2.7sec */ setup_timer(&sc->sc_ledtimer, ath_led_off, (unsigned long)sc); /* @@ -823,104 +856,8 @@ static int ath_attach(struct pci_dev *pdev, struct ieee80211_hw *hw) ath5k_hw_set_gpio(ah, sc->sc_ledpin, !sc->sc_ledon); } - ether_setup(dev); - dev->open = ath_init; - dev->stop = ath_stop; - dev->hard_start_xmit = ath_start; - dev->tx_timeout = ath_tx_timeout; - dev->watchdog_timeo = 5 * HZ; /* XXX */ - dev->set_multicast_list = ath_mode_init; - dev->do_ioctl = ath_ioctl; - dev->get_stats = ath_getstats; - dev->set_mac_address = ath_set_mac_address; - dev->change_mtu = &ath_change_mtu; - dev->tx_queue_len = ATH_TXBUF; /* TODO? 1 for mgmt frame */ -/*get_wireless_stats moved from net_device to iw_handler_def*/ -# if IW_HANDLER_VERSION < 7 - dev->get_wireless_stats = ath_iw_getstats; -# endif - ieee80211_ioctl_iwsetup(&ath_iw_handler_def); - dev->wireless_handlers = &ath_iw_handler_def; -#if IEEE80211_VLAN_TAG_USED - dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; - dev->vlan_rx_register = ath_vlan_register; - dev->vlan_rx_kill_vid = ath_vlan_kill_vid; -#endif /* IEEE80211_VLAN_TAG_USED */ - ic->ic_dev = dev; - ic->ic_devstats = &sc->sc_devstats; - ic->ic_init = ath_init; - ic->ic_reset = ath_reset; - ic->ic_newassoc = ath_newassoc; - ic->ic_updateslot = ath_updateslot; - ic->ic_wme.wme_update = ath_wme_update; - /* XXX not right but it's not used anywhere important */ - ic->ic_phytype = MODULATION_OFDM; - ic->ic_opmode = IEEE80211_M_STA; - ic->ic_caps = - IEEE80211_C_IBSS /* ibss, nee adhoc, mode */ - | IEEE80211_C_AHDEMO /* adhoc demo (pseudo_ibss) mode */ - | IEEE80211_C_HOSTAP /* hostap mode */ - | IEEE80211_C_MONITOR /* monitor mode */ - | IEEE80211_C_SHPREAMBLE /* short preamble supported */ - | IEEE80211_C_SHSLOT /* short slot time supported */ - | IEEE80211_C_WPA /* capable of WPA1+WPA2 */ - ; - /* - * initialize management queue - */ - skb_queue_head_init(&ic->ic_mgtq); - - /* - * Query the hal to figure out h/w crypto support. - */ - if (ath_hal_ciphersupported(ah, AR5K_CIPHER_WEP)) - ic->ic_caps |= IEEE80211_C_WEP; - if (ath_hal_ciphersupported(ah, AR5K_CIPHER_AES_OCB)) - ic->ic_caps |= IEEE80211_C_AES; - if (ath_hal_ciphersupported(ah, AR5K_CIPHER_AES_CCM)) - ic->ic_caps |= IEEE80211_C_AES_CCM; - if (ath_hal_ciphersupported(ah, AR5K_CIPHER_CKIP)) - ic->ic_caps |= IEEE80211_C_CKIP; - if (ath_hal_ciphersupported(ah, AR5K_CIPHER_TKIP)) { - ic->ic_caps |= IEEE80211_C_TKIP; - /* - * Check if h/w does the MIC and/or whether the - * separate key cache entries are required to - * handle both tx+rx MIC keys. - */ - if (ath_hal_ciphersupported(ah, AR5K_CIPHER_MIC)) - ic->ic_caps |= IEEE80211_C_TKIPMIC; - if (ath_hal_tkipsplit(ah)) - sc->sc_splitmic = 1; - } sc->sc_hasclrkey = ath_hal_ciphersupported(ah, AR5K_CIPHER_CLR); sc->sc_mcastkey = ath_hal_getmcastkeysearch(ah); - /* - * TPC support can be done either with a global cap or - * per-packet support. The latter is not available on - * all parts. We're a bit pedantic here as all parts - * support a global cap. - */ - if (ath_hal_hastpc(ah) || ath_hal_hastxpowlimit(ah)) - ic->ic_caps |= IEEE80211_C_TXPMGT; - - /* - * Mark WME capability only if we have sufficient - * hardware queues to do proper priority scheduling. - */ - if (sc->sc_ac2q[WME_AC_BE] != sc->sc_ac2q[WME_AC_BK]) - ic->ic_caps |= IEEE80211_C_WME; - /* - * Check for misc other capabilities. - */ - if (ath_hal_hasbursting(ah)) - ic->ic_caps |= IEEE80211_C_BURST; - - /* - * Indicate we need the 802.11 header padded to a - * 32-bit boundary for 4-address and QoS frames. - */ - ic->ic_flags |= IEEE80211_F_DATAPAD; /* * Query the hal about antenna support. @@ -934,66 +871,21 @@ static int ath_attach(struct pci_dev *pdev, struct ieee80211_hw *hw) sc->sc_hasveol = ath_hal_hasveol(ah); sc->sc_rxfilter = 0; +#endif - /* get mac address from hardware */ -// ath_hal_getmac(ah, ic->ic_myaddr); BLEE -// IEEE80211_ADDR_COPY(dev->dev_addr, ic->ic_myaddr); - - /* call MI attach routine. */ - ieee80211_ifattach(ic); - /* override default methods */ - ic->ic_node_alloc = ath_node_alloc; - sc->sc_node_free = ic->ic_node_free; - ic->ic_node_free = ath_node_free; - ic->ic_node_getrssi = ath_node_getrssi; - sc->sc_recv_mgmt = ic->ic_recv_mgmt; - ic->ic_recv_mgmt = ath_recv_mgmt; - sc->sc_newstate = ic->ic_newstate; - ic->ic_newstate = ath_newstate; - ic->ic_crypto.cs_key_alloc = ath_key_alloc; - ic->ic_crypto.cs_key_delete = ath_key_delete; - ic->ic_crypto.cs_key_set = ath_key_set; - ic->ic_crypto.cs_key_update_begin = ath_key_update_begin; - ic->ic_crypto.cs_key_update_end = ath_key_update_end; - - radar_init(ic); - - /* complete initialization */ - ieee80211_media_init(ic, ath_media_change, ieee80211_media_status); - - if (register_netdev(dev)) { - printk(KERN_ERR "%s: unable to register device\n", dev->name); - goto bad3; + ath5k_hw_get_lladdr(ah, mac); + SET_IEEE80211_PERM_ADDR(hw, mac); + + ret = ieee80211_register_hw(hw); + if (ret) { + dev_err(&pdev->dev, "can't register ieee80211 hw\n"); + goto err_queues; } - /* - * Attach dynamic MIB vars and announce support - * now that we have a device name with unit number. - */ - ath_dynamic_sysctl_register(sc); - ath_rate_dynamic_sysctl_register(sc); - ath_announce(sc); -#endif +// ath_dynamic_sysctl_register(sc); +// ath_announce(sc); return 0; -#ifdef BLE -//bad3: -// ieee80211_ifdetach(ic); -// ath_rate_detach(sc->sc_rc); -bad2: - if (sc->sc_txq[WME_AC_BK].axq_qnum != (u_int) -1) { - ATH_TXQ_LOCK_DESTROY(&sc->sc_txq[WME_AC_BK]); - } - if (sc->sc_txq[WME_AC_BE].axq_qnum != (u_int) -1) { - ATH_TXQ_LOCK_DESTROY(&sc->sc_txq[WME_AC_BE]); - } - if (sc->sc_txq[WME_AC_VI].axq_qnum != (u_int) -1) { - ATH_TXQ_LOCK_DESTROY(&sc->sc_txq[WME_AC_VI]); - } - if (sc->sc_txq[WME_AC_VO].axq_qnum != (u_int) -1) { - ATH_TXQ_LOCK_DESTROY(&sc->sc_txq[WME_AC_VO]); - } -#endif err_queues: ath_tx_cleanup(sc); err_desc: @@ -1019,8 +911,7 @@ static void ath_detach(struct pci_dev *pdev, struct ieee80211_hw *hw) * it last * Other than that, it's straightforward... */ -// ieee80211_ifdetach(ic); -// ath_rate_detach(sc->sc_rc); + ieee80211_unregister_hw(hw); ath_desc_free(sc, pdev); ath_tx_cleanup(sc); @@ -1030,7 +921,6 @@ static void ath_detach(struct pci_dev *pdev, struct ieee80211_hw *hw) * state and potentially want to use them. */ // ath_dynamic_sysctl_unregister(sc); -// unregister_netdev(dev); } static const char *ath_chip_name(u8 mac_version) @@ -1158,7 +1048,10 @@ static int __devinit ath_pci_probe(struct pci_dev *pdev, if (ret) goto err_ah; - dev_info(&pdev->dev, "%s chip found\n", ath_chip_name(id->driver_data)); + dev_info(&pdev->dev, "%s chip found: mac %d.%d phy %d.%d\n", + ath_chip_name(id->driver_data), sc->ah->ah_mac_version, + sc->ah->ah_mac_version, sc->ah->ah_phy_revision >> 4, + sc->ah->ah_phy_revision & 0xf); /* ready to process interrupts */ sc->invalid = 0; diff --git a/ath/if_athvar.h b/ath/if_athvar.h index fce6a97..c58286c 100644 --- a/ath/if_athvar.h +++ b/ath/if_athvar.h @@ -335,8 +335,6 @@ int ath_ioctl_ethtool(struct ath_softc *, int, void __user *); void ath_sysctl_register(void); void ath_sysctl_unregister(void); -#define ath_hal_ciphersupported(_ah, _cipher) \ - (ath5k_hw_get_capability(_ah, AR5K_CAP_CIPHER, _cipher, NULL) == 0) #define ath_hal_getcountrycode(_ah, _pcc) \ (*(_pcc) = (_ah)->ah_country_code) #define ath_hal_tkipsplit(_ah) \ diff --git a/openhal/ath5k.h b/openhal/ath5k.h index 4364949..8339bfc 100644 --- a/openhal/ath5k.h +++ b/openhal/ath5k.h @@ -825,7 +825,6 @@ enum ath5k_power_mode { */ enum ath5k_capability_type { AR5K_CAP_REG_DMN = 0, /* Used to get current reg. domain id */ - AR5K_CAP_CIPHER = 1, /* Can handle encryption */ AR5K_CAP_TKIP_MIC = 2, /* Can handle TKIP MIC in hardware */ AR5K_CAP_TKIP_SPLIT = 3, /* TKIP uses split keys */ AR5K_CAP_PHYCOUNTERS = 4, /* PHY error counters */ diff --git a/openhal/ath5k_hw.c b/openhal/ath5k_hw.c index 56761ca..34133a1 100644 --- a/openhal/ath5k_hw.c +++ b/openhal/ath5k_hw.c @@ -2353,7 +2353,7 @@ static int ath5k_eeprom_read_mac(struct ath_hw *hal, u8 *mac) int octet, ret; memset(mac, 0, ETH_ALEN); - memset(&mac_d, 0, ETH_ALEN); + memset(mac_d, 0, ETH_ALEN); ret = ath5k_hw_eeprom_read(hal, 0x20, &data); if (ret) @@ -5840,13 +5840,6 @@ int ath5k_hw_get_capability(struct ath_hw *hal, *result = ath5k_get_regdomain(hal); goto yes; } - case AR5K_CAP_CIPHER: - switch (capability) { - case AR5K_CIPHER_WEP: - goto yes; - default: - goto no; - } case AR5K_CAP_NUM_TXQUEUES: if (result) { if (hal->ah_version == AR5K_AR5210)