Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 135102
b: refs/heads/master
c: c52f33d
h: refs/heads/master
v: v3
  • Loading branch information
Jouni Malinen authored and John W. Linville committed Mar 5, 2009
1 parent e5d9803 commit df052ad
Show file tree
Hide file tree
Showing 8 changed files with 213 additions and 42 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bce048d77dff3dcfd75d54dc38580c81baa95853
refs/heads/master: c52f33d05e5f8d59f02722fbc308f5f391575ca5
15 changes: 12 additions & 3 deletions trunk/drivers/net/wireless/ath9k/ath9k.h
Original file line number Diff line number Diff line change
Expand Up @@ -373,10 +373,10 @@ int ath_tx_cleanup(struct ath_softc *sc);
struct ath_txq *ath_test_get_txq(struct ath_softc *sc, struct sk_buff *skb);
int ath_txq_update(struct ath_softc *sc, int qnum,
struct ath9k_tx_queue_info *q);
int ath_tx_start(struct ath_softc *sc, struct sk_buff *skb,
int ath_tx_start(struct ieee80211_hw *hw, struct sk_buff *skb,
struct ath_tx_control *txctl);
void ath_tx_tasklet(struct ath_softc *sc);
void ath_tx_cabq(struct ath_softc *sc, struct sk_buff *skb);
void ath_tx_cabq(struct ieee80211_hw *hw, struct sk_buff *skb);
bool ath_tx_aggr_check(struct ath_softc *sc, struct ath_node *an, u8 tidno);
int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta,
u16 tid, u16 *ssn);
Expand Down Expand Up @@ -429,6 +429,7 @@ struct ath_beacon {
u32 ast_be_xmit;
u64 bc_tstamp;
struct ieee80211_vif *bslot[ATH_BCBUF];
struct ath_wiphy *bslot_aphy[ATH_BCBUF];
int slottime;
int slotupdate;
struct ath9k_tx_queue_info beacon_qi;
Expand All @@ -440,7 +441,7 @@ struct ath_beacon {
void ath_beacon_tasklet(unsigned long data);
void ath_beacon_config(struct ath_softc *sc, struct ieee80211_vif *vif);
int ath_beaconq_setup(struct ath_hw *ah);
int ath_beacon_alloc(struct ath_softc *sc, struct ieee80211_vif *vif);
int ath_beacon_alloc(struct ath_wiphy *aphy, struct ieee80211_vif *vif);
void ath_beacon_return(struct ath_softc *sc, struct ath_vif *avp);

/*******/
Expand Down Expand Up @@ -554,7 +555,12 @@ struct ath_wiphy;
struct ath_softc {
struct ieee80211_hw *hw;
struct device *dev;

spinlock_t wiphy_lock; /* spinlock to protect ath_wiphy data */
struct ath_wiphy *pri_wiphy;
struct ath_wiphy **sec_wiphy; /* secondary wiphys (virtual radios); may
* have NULL entries */
int num_sec_wiphy; /* number of sec_wiphy pointers in the array */
struct tasklet_struct intr_tq;
struct tasklet_struct bcon_tasklet;
struct ath_hw *sc_ah;
Expand Down Expand Up @@ -638,6 +644,7 @@ int ath_attach(u16 devid, struct ath_softc *sc);
void ath_detach(struct ath_softc *sc);
const char *ath_mac_bb_name(u32 mac_bb_version);
const char *ath_rf_name(u16 rf_version);
void ath_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw);

#ifdef CONFIG_PCI
int ath_pci_init(void);
Expand Down Expand Up @@ -675,5 +682,7 @@ static inline void ath9k_ps_restore(struct ath_softc *sc)


void ath9k_set_bssid_mask(struct ieee80211_hw *hw);
int ath9k_wiphy_add(struct ath_softc *sc);
int ath9k_wiphy_del(struct ath_wiphy *aphy);

#endif /* ATH9K_H */
21 changes: 14 additions & 7 deletions trunk/drivers/net/wireless/ath9k/beacon.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,11 @@ static void ath_beacon_setup(struct ath_softc *sc, struct ath_vif *avp,
series, 4, 0);
}

static struct ath_buf *ath_beacon_generate(struct ath_softc *sc,
static struct ath_buf *ath_beacon_generate(struct ieee80211_hw *hw,
struct ieee80211_vif *vif)
{
struct ath_wiphy *aphy = hw->priv;
struct ath_softc *sc = aphy->sc;
struct ath_buf *bf;
struct ath_vif *avp;
struct sk_buff *skb;
Expand Down Expand Up @@ -144,7 +146,7 @@ static struct ath_buf *ath_beacon_generate(struct ath_softc *sc,

/* Get a new beacon from mac80211 */

skb = ieee80211_beacon_get(sc->hw, vif);
skb = ieee80211_beacon_get(hw, vif);
bf->bf_mpdu = skb;
if (skb == NULL)
return NULL;
Expand All @@ -171,7 +173,7 @@ static struct ath_buf *ath_beacon_generate(struct ath_softc *sc,
return NULL;
}

skb = ieee80211_get_buffered_bc(sc->hw, vif);
skb = ieee80211_get_buffered_bc(hw, vif);

/*
* if the CABQ traffic from previous DTIM is pending and the current
Expand All @@ -196,8 +198,8 @@ static struct ath_buf *ath_beacon_generate(struct ath_softc *sc,
ath_beacon_setup(sc, avp, bf);

while (skb) {
ath_tx_cabq(sc, skb);
skb = ieee80211_get_buffered_bc(sc->hw, vif);
ath_tx_cabq(hw, skb);
skb = ieee80211_get_buffered_bc(hw, vif);
}

return bf;
Expand Down Expand Up @@ -244,8 +246,9 @@ int ath_beaconq_setup(struct ath_hw *ah)
return ath9k_hw_setuptxqueue(ah, ATH9K_TX_QUEUE_BEACON, &qi);
}

int ath_beacon_alloc(struct ath_softc *sc, struct ieee80211_vif *vif)
int ath_beacon_alloc(struct ath_wiphy *aphy, struct ieee80211_vif *vif)
{
struct ath_softc *sc = aphy->sc;
struct ath_vif *avp;
struct ieee80211_hdr *hdr;
struct ath_buf *bf;
Expand Down Expand Up @@ -286,6 +289,7 @@ int ath_beacon_alloc(struct ath_softc *sc, struct ieee80211_vif *vif)
}
BUG_ON(sc->beacon.bslot[avp->av_bslot] != NULL);
sc->beacon.bslot[avp->av_bslot] = vif;
sc->beacon.bslot_aphy[avp->av_bslot] = aphy;
sc->nbcnvifs++;
}
}
Expand Down Expand Up @@ -368,6 +372,7 @@ void ath_beacon_return(struct ath_softc *sc, struct ath_vif *avp)

if (avp->av_bslot != -1) {
sc->beacon.bslot[avp->av_bslot] = NULL;
sc->beacon.bslot_aphy[avp->av_bslot] = NULL;
sc->nbcnvifs--;
}

Expand All @@ -391,6 +396,7 @@ void ath_beacon_tasklet(unsigned long data)
struct ath_hw *ah = sc->sc_ah;
struct ath_buf *bf = NULL;
struct ieee80211_vif *vif;
struct ath_wiphy *aphy;
int slot;
u32 bfaddr, bc = 0, tsftu;
u64 tsf;
Expand Down Expand Up @@ -439,14 +445,15 @@ void ath_beacon_tasklet(unsigned long data)
tsftu = TSF_TO_TU(tsf>>32, tsf);
slot = ((tsftu % intval) * ATH_BCBUF) / intval;
vif = sc->beacon.bslot[(slot + 1) % ATH_BCBUF];
aphy = sc->beacon.bslot_aphy[(slot + 1) % ATH_BCBUF];

DPRINTF(sc, ATH_DBG_BEACON,
"slot %d [tsf %llu tsftu %u intval %u] vif %p\n",
slot, tsf, tsftu, intval, vif);

bfaddr = 0;
if (vif) {
bf = ath_beacon_generate(sc, vif);
bf = ath_beacon_generate(aphy->hw, vif);
if (bf != NULL) {
bfaddr = bf->bf_daddr;
bc = 1;
Expand Down
65 changes: 42 additions & 23 deletions trunk/drivers/net/wireless/ath9k/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1307,6 +1307,7 @@ void ath_cleanup(struct ath_softc *sc)
ath_detach(sc);
free_irq(sc->irq, sc);
ath_bus_cleanup(sc);
kfree(sc->sec_wiphy);
ieee80211_free_hw(sc->hw);
}

Expand All @@ -1324,6 +1325,14 @@ void ath_detach(struct ath_softc *sc)
#endif
ath_deinit_leds(sc);

for (i = 0; i < sc->num_sec_wiphy; i++) {
struct ath_wiphy *aphy = sc->sec_wiphy[i];
if (aphy == NULL)
continue;
sc->sec_wiphy[i] = NULL;
ieee80211_unregister_hw(aphy->hw);
ieee80211_free_hw(aphy->hw);
}
ieee80211_unregister_hw(hw);
ath_rx_cleanup(sc);
ath_tx_cleanup(sc);
Expand Down Expand Up @@ -1357,6 +1366,7 @@ static int ath_init(u16 devid, struct ath_softc *sc)
if (ath9k_init_debug(sc) < 0)
printk(KERN_ERR "Unable to create debugfs files\n");

spin_lock_init(&sc->wiphy_lock);
spin_lock_init(&sc->sc_resetlock);
mutex_init(&sc->mutex);
tasklet_init(&sc->intr_tq, ath9k_tasklet, (unsigned long)sc);
Expand Down Expand Up @@ -1520,8 +1530,10 @@ static int ath_init(u16 devid, struct ath_softc *sc)
sc->beacon.slottime = ATH9K_SLOT_TIME_9; /* default to short slot time */

/* initialize beacon slots */
for (i = 0; i < ARRAY_SIZE(sc->beacon.bslot); i++)
for (i = 0; i < ARRAY_SIZE(sc->beacon.bslot); i++) {
sc->beacon.bslot[i] = NULL;
sc->beacon.bslot_aphy[i] = NULL;
}

/* save MISC configurations */
sc->config.swBeaconProcess = 1;
Expand Down Expand Up @@ -1561,22 +1573,8 @@ static int ath_init(u16 devid, struct ath_softc *sc)
return error;
}

int ath_attach(u16 devid, struct ath_softc *sc)
void ath_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
{
struct ieee80211_hw *hw = sc->hw;
const struct ieee80211_regdomain *regd;
int error = 0, i;

DPRINTF(sc, ATH_DBG_CONFIG, "Attach ATH hw\n");

error = ath_init(devid, sc);
if (error != 0)
return error;

/* get mac address from hardware and set in mac80211 */

SET_IEEE80211_PERM_ADDR(hw, sc->sc_ah->macaddr);

hw->flags = IEEE80211_HW_RX_INCLUDES_FCS |
IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
IEEE80211_HW_SIGNAL_DBM |
Expand Down Expand Up @@ -1604,17 +1602,37 @@ int ath_attach(u16 devid, struct ath_softc *sc)

hw->rate_control_algorithm = "ath9k_rate_control";

hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
&sc->sbands[IEEE80211_BAND_2GHZ];
if (test_bit(ATH9K_MODE_11A, sc->sc_ah->caps.wireless_modes))
hw->wiphy->bands[IEEE80211_BAND_5GHZ] =
&sc->sbands[IEEE80211_BAND_5GHZ];
}

int ath_attach(u16 devid, struct ath_softc *sc)
{
struct ieee80211_hw *hw = sc->hw;
const struct ieee80211_regdomain *regd;
int error = 0, i;

DPRINTF(sc, ATH_DBG_CONFIG, "Attach ATH hw\n");

error = ath_init(devid, sc);
if (error != 0)
return error;

/* get mac address from hardware and set in mac80211 */

SET_IEEE80211_PERM_ADDR(hw, sc->sc_ah->macaddr);

ath_set_hw_capab(sc, hw);

if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT) {
setup_ht_cap(sc, &sc->sbands[IEEE80211_BAND_2GHZ].ht_cap);
if (test_bit(ATH9K_MODE_11A, sc->sc_ah->caps.wireless_modes))
setup_ht_cap(sc, &sc->sbands[IEEE80211_BAND_5GHZ].ht_cap);
}

hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &sc->sbands[IEEE80211_BAND_2GHZ];
if (test_bit(ATH9K_MODE_11A, sc->sc_ah->caps.wireless_modes))
hw->wiphy->bands[IEEE80211_BAND_5GHZ] =
&sc->sbands[IEEE80211_BAND_5GHZ];

/* initialize tx/rx engine */
error = ath_tx_init(sc, ATH_TXBUF);
if (error != 0)
Expand Down Expand Up @@ -2067,7 +2085,7 @@ static int ath9k_tx(struct ieee80211_hw *hw,

DPRINTF(sc, ATH_DBG_XMIT, "transmitting packet, skb: %p\n", skb);

if (ath_tx_start(sc, skb, &txctl) != 0) {
if (ath_tx_start(hw, skb, &txctl) != 0) {
DPRINTF(sc, ATH_DBG_XMIT, "TX failed\n");
goto exit;
}
Expand Down Expand Up @@ -2247,6 +2265,7 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw,
printk(KERN_DEBUG "%s: vif had allocated beacon "
"slot\n", __func__);
sc->beacon.bslot[i] = NULL;
sc->beacon.bslot_aphy[i] = NULL;
}
}

Expand Down Expand Up @@ -2388,7 +2407,7 @@ static int ath9k_config_interface(struct ieee80211_hw *hw,
*/
ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq);

error = ath_beacon_alloc(sc, vif);
error = ath_beacon_alloc(aphy, vif);
if (error != 0) {
mutex_unlock(&sc->mutex);
return error;
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/net/wireless/ath9k/rc.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ struct ath_rate_priv {
};

struct ath_tx_info_priv {
struct ath_wiphy *aphy;
struct ath_tx_status tx;
int n_frames;
int n_bad_frames;
Expand Down
41 changes: 39 additions & 2 deletions trunk/drivers/net/wireless/ath9k/recv.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,22 @@
static struct ieee80211_hw * ath_get_virt_hw(struct ath_softc *sc,
struct ieee80211_hdr *hdr)
{
return sc->pri_wiphy->hw;
struct ieee80211_hw *hw = sc->pri_wiphy->hw;
int i;

spin_lock_bh(&sc->wiphy_lock);
for (i = 0; i < sc->num_sec_wiphy; i++) {
struct ath_wiphy *aphy = sc->sec_wiphy[i];
if (aphy == NULL)
continue;
if (compare_ether_addr(hdr->addr1, aphy->hw->wiphy->perm_addr)
== 0) {
hw = aphy->hw;
break;
}
}
spin_unlock_bh(&sc->wiphy_lock);
return hw;
}

/*
Expand Down Expand Up @@ -611,7 +626,29 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush)
}

/* Send the frame to mac80211 */
__ieee80211_rx(ath_get_virt_hw(sc, hdr), skb, &rx_status);
if (hdr->addr1[5] & 0x01) {
int i;
/*
* Deliver broadcast/multicast frames to all suitable
* virtual wiphys.
*/
/* TODO: filter based on channel configuration */
for (i = 0; i < sc->num_sec_wiphy; i++) {
struct ath_wiphy *aphy = sc->sec_wiphy[i];
struct sk_buff *nskb;
if (aphy == NULL)
continue;
nskb = skb_copy(skb, GFP_ATOMIC);
if (nskb)
__ieee80211_rx(aphy->hw, nskb,
&rx_status);
}
__ieee80211_rx(sc->hw, skb, &rx_status);
} else {
/* Deliver unicast frames based on receiver address */
__ieee80211_rx(ath_get_virt_hw(sc, hdr), skb,
&rx_status);
}

/* We will now give hardware our shiny new allocated skb */
bf->bf_mpdu = requeue_skb;
Expand Down
Loading

0 comments on commit df052ad

Please sign in to comment.