* [PATCH 0/5] ath9k: Preliminary changes to enabled access point mode
@ 2008-08-11 11:01 Jouni Malinen
2008-08-11 11:01 ` [PATCH 1/5] ath9k: Allow AP mode to be enabled Jouni Malinen
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Jouni Malinen @ 2008-08-11 11:01 UTC (permalink / raw)
To: John W. Linville; +Cc: linux-wireless
This series (to be applied on top of Sujith's 10-patch series from
today) brings in preliminary AP mode support for ath9k. In addition,
couple of bug fixes included in the changes may also apply for
client modes.
--
Jouni Malinen PGP id EFC895FA
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH 1/5] ath9k: Allow AP mode to be enabled 2008-08-11 11:01 [PATCH 0/5] ath9k: Preliminary changes to enabled access point mode Jouni Malinen @ 2008-08-11 11:01 ` Jouni Malinen 2008-08-11 11:01 ` [PATCH 2/5] ath9k: Updated Beacon generation to use mac80211-style Jouni Malinen ` (3 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: Jouni Malinen @ 2008-08-11 11:01 UTC (permalink / raw) To: John W. Linville; +Cc: linux-wireless Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com> Index: wireless-testing/drivers/net/wireless/ath9k/main.c =================================================================== --- wireless-testing.orig/drivers/net/wireless/ath9k/main.c +++ wireless-testing/drivers/net/wireless/ath9k/main.c @@ -426,10 +426,13 @@ static int ath9k_add_interface(struct ie case IEEE80211_IF_TYPE_IBSS: ic_opmode = ATH9K_M_IBSS; break; + case IEEE80211_IF_TYPE_AP: + ic_opmode = ATH9K_M_HOSTAP; + break; default: DPRINTF(sc, ATH_DBG_FATAL, - "%s: Only STA and IBSS are supported currently\n", - __func__); + "%s: Interface type %d not yet supported\n", + __func__, conf->type); return -EOPNOTSUPP; } @@ -530,6 +533,7 @@ static int ath9k_config_interface(struct struct ieee80211_if_conf *conf) { struct ath_softc *sc = hw->priv; + struct ath_hal *ah = sc->sc_ah; struct ath_vap *avp; u32 rfilt = 0; int error, i; @@ -542,6 +546,17 @@ static int ath9k_config_interface(struct return -EINVAL; } + /* TODO: Need to decide which hw opmode to use for multi-interface + * cases */ + if (vif->type == IEEE80211_IF_TYPE_AP && + ah->ah_opmode != ATH9K_M_HOSTAP) { + ah->ah_opmode = ATH9K_M_HOSTAP; + ath9k_hw_setopmode(ah); + ath9k_hw_write_associd(ah, sc->sc_myaddr, 0); + /* Request full reset to get hw opmode changed properly */ + sc->sc_flags |= SC_OP_FULL_RESET; + } + if ((conf->changed & IEEE80211_IFCC_BSSID) && !is_zero_ether_addr(conf->bssid)) { switch (vif->type) { Index: wireless-testing/drivers/net/wireless/ath9k/core.c =================================================================== --- wireless-testing.orig/drivers/net/wireless/ath9k/core.c +++ wireless-testing/drivers/net/wireless/ath9k/core.c @@ -549,9 +549,15 @@ int ath_vap_listen(struct ath_softc *sc, * XXXX * Disable BMISS interrupt when we're not associated */ - ath9k_hw_set_interrupts(ah, - sc->sc_imask & ~(ATH9K_INT_SWBA | ATH9K_INT_BMISS)); - sc->sc_imask &= ~(ATH9K_INT_SWBA | ATH9K_INT_BMISS); + if (sc->sc_ah->ah_opmode == ATH9K_M_HOSTAP) { + ath9k_hw_set_interrupts(ah, sc->sc_imask & ~ATH9K_INT_BMISS); + sc->sc_imask &= ~ATH9K_INT_BMISS; + } else { + ath9k_hw_set_interrupts( + ah, + sc->sc_imask & ~(ATH9K_INT_SWBA | ATH9K_INT_BMISS)); + sc->sc_imask &= ~(ATH9K_INT_SWBA | ATH9K_INT_BMISS); + } /* need to reconfigure the beacons when it moves to RUN */ sc->sc_flags &= ~SC_OP_BEACONS; -- -- Jouni Malinen PGP id EFC895FA ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/5] ath9k: Updated Beacon generation to use mac80211-style 2008-08-11 11:01 [PATCH 0/5] ath9k: Preliminary changes to enabled access point mode Jouni Malinen 2008-08-11 11:01 ` [PATCH 1/5] ath9k: Allow AP mode to be enabled Jouni Malinen @ 2008-08-11 11:01 ` Jouni Malinen 2008-08-11 11:01 ` [PATCH 3/5] ath9k: Fix TX status reporting Jouni Malinen ` (2 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: Jouni Malinen @ 2008-08-11 11:01 UTC (permalink / raw) To: John W. Linville; +Cc: linux-wireless This change moves ath9k to use mac80211-generated Beacon frames instead of trying to allocate a single Beacon frame and then update it. In addition, the remaining ath_skb_{map,unmap}_single() wrapper calls are replaced with direct pci_{map,unmap}_single() calls in beacon.c. Power save buffering for multicast/broadcast frames is not yet converted to use mac80211-style (frames to be buffered inside mac80211, not in driver). Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com> Index: wireless-testing/drivers/net/wireless/ath9k/main.c =================================================================== --- wireless-testing.orig/drivers/net/wireless/ath9k/main.c +++ wireless-testing/drivers/net/wireless/ath9k/main.c @@ -624,6 +624,18 @@ static int ath9k_config_interface(struct ath_beacon_sync(sc, 0); } + if ((conf->changed & IEEE80211_IFCC_BEACON) && + (vif->type == IEEE80211_IF_TYPE_AP)) { + ath9k_hw_stoptxdma(sc->sc_ah, sc->sc_bhalq); + + error = ath_beacon_alloc(sc, 0); + if (error != 0) + return error; + + ath_beacon_config(sc, 0); + sc->sc_flags |= SC_OP_BEACONS; + } + /* Check for WLAN_CAPABILITY_PRIVACY ? */ if ((avp->av_opmode != IEEE80211_IF_TYPE_STA)) { for (i = 0; i < IEEE80211_WEP_NKID; i++) @@ -1052,15 +1064,6 @@ void ath_get_beaconconfig(struct ath_sof conf->bmiss_timeout = ATH_DEFAULT_BMISS_LIMIT * conf->listen_interval; } -int ath_update_beacon(struct ath_softc *sc, - int if_id, - struct ath_beacon_offset *bo, - struct sk_buff *skb, - int mcast) -{ - return 0; -} - void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb, struct ath_xmit_status *tx_status, struct ath_node *an) { Index: wireless-testing/drivers/net/wireless/ath9k/beacon.c =================================================================== --- wireless-testing.orig/drivers/net/wireless/ath9k/beacon.c +++ wireless-testing/drivers/net/wireless/ath9k/beacon.c @@ -172,6 +172,7 @@ static void empty_mcastq_into_cabq(struc mcastq->axq_link = NULL; } +/* TODO: use ieee80211_get_buffered_bc() to fetch power saved mcast frames */ /* This is only run at DTIM. We move everything from the vap's mcast queue * to the hardware cab queue. Caller must hold the mcastq lock. */ static void trigger_mcastq(struct ath_hal *ah, @@ -206,7 +207,6 @@ static struct ath_buf *ath_beacon_genera int cabq_depth; int mcastq_depth; int is_beacon_dtim = 0; - unsigned int curlen; struct ath_txq *cabq; struct ath_txq *mcastq; avp = sc->sc_vaps[if_id]; @@ -223,33 +223,27 @@ static struct ath_buf *ath_beacon_genera } bf = avp->av_bcbuf; skb = (struct sk_buff *) bf->bf_mpdu; + if (skb) { + pci_unmap_single(sc->pdev, bf->bf_dmacontext, + skb_end_pointer(skb) - skb->head, + PCI_DMA_TODEVICE); + } - /* - * Update dynamic beacon contents. If this returns - * non-zero then we need to remap the memory because - * the beacon frame changed size (probably because - * of the TIM bitmap). - */ - curlen = skb->len; + skb = ieee80211_beacon_get(sc->hw, avp->av_if_data); + bf->bf_mpdu = skb; + if (skb == NULL) + return NULL; + bf->bf_buf_addr = bf->bf_dmacontext = + pci_map_single(sc->pdev, skb->data, + skb_end_pointer(skb) - skb->head, + PCI_DMA_TODEVICE); + /* TODO: convert to use ieee80211_get_buffered_bc() */ /* XXX: spin_lock_bh should not be used here, but sparse bitches * otherwise. We should fix sparse :) */ spin_lock_bh(&mcastq->axq_lock); mcastq_depth = avp->av_mcastq.axq_depth; - if (ath_update_beacon(sc, if_id, &avp->av_boff, skb, mcastq_depth) == - 1) { - ath_skb_unmap_single(sc, skb, PCI_DMA_TODEVICE, - get_dma_mem_context(bf, bf_dmacontext)); - bf->bf_buf_addr = ath_skb_map_single(sc, skb, PCI_DMA_TODEVICE, - get_dma_mem_context(bf, bf_dmacontext)); - } else { - pci_dma_sync_single_for_cpu(sc->pdev, - bf->bf_buf_addr, - skb_tailroom(skb), - PCI_DMA_TODEVICE); - } - /* * if the CABQ traffic from previous DTIM is pending and the current * beacon is also a DTIM. @@ -262,7 +256,8 @@ static struct ath_buf *ath_beacon_genera cabq_depth = cabq->axq_depth; spin_unlock_bh(&cabq->axq_lock); - is_beacon_dtim = avp->av_boff.bo_tim[4] & 1; + if (avp->av_boff.bo_tim) + is_beacon_dtim = avp->av_boff.bo_tim[4] & 1; if (mcastq_depth && is_beacon_dtim && cabq_depth) { /* @@ -408,8 +403,9 @@ int ath_beacon_alloc(struct ath_softc *s bf = avp->av_bcbuf; if (bf->bf_mpdu != NULL) { skb = (struct sk_buff *)bf->bf_mpdu; - ath_skb_unmap_single(sc, skb, PCI_DMA_TODEVICE, - get_dma_mem_context(bf, bf_dmacontext)); + pci_unmap_single(sc->pdev, bf->bf_dmacontext, + skb_end_pointer(skb) - skb->head, + PCI_DMA_TODEVICE); dev_kfree_skb_any(skb); bf->bf_mpdu = NULL; } @@ -439,9 +435,8 @@ int ath_beacon_alloc(struct ath_softc *s __le64 val; int intval; - /* FIXME: Use default value for now: Sujith */ - - intval = ATH_DEFAULT_BINTVAL; + intval = sc->hw->conf.beacon_int ? + sc->hw->conf.beacon_int : ATH_DEFAULT_BINTVAL; /* * The beacon interval is in TU's; the TSF in usecs. @@ -466,8 +461,10 @@ int ath_beacon_alloc(struct ath_softc *s memcpy(&wh[1], &val, sizeof(val)); } - bf->bf_buf_addr = ath_skb_map_single(sc, skb, PCI_DMA_TODEVICE, - get_dma_mem_context(bf, bf_dmacontext)); + bf->bf_buf_addr = bf->bf_dmacontext = + pci_map_single(sc->pdev, skb->data, + skb_end_pointer(skb) - skb->head, + PCI_DMA_TODEVICE); bf->bf_mpdu = skb; return 0; @@ -493,8 +490,9 @@ void ath_beacon_return(struct ath_softc bf = avp->av_bcbuf; if (bf->bf_mpdu != NULL) { struct sk_buff *skb = (struct sk_buff *)bf->bf_mpdu; - ath_skb_unmap_single(sc, skb, PCI_DMA_TODEVICE, - get_dma_mem_context(bf, bf_dmacontext)); + pci_unmap_single(sc->pdev, bf->bf_dmacontext, + skb_end_pointer(skb) - skb->head, + PCI_DMA_TODEVICE); dev_kfree_skb_any(skb); bf->bf_mpdu = NULL; } @@ -520,8 +518,9 @@ void ath_beacon_free(struct ath_softc *s list_for_each_entry(bf, &sc->sc_bbuf, list) { if (bf->bf_mpdu != NULL) { struct sk_buff *skb = (struct sk_buff *) bf->bf_mpdu; - ath_skb_unmap_single(sc, skb, PCI_DMA_TODEVICE, - get_dma_mem_context(bf, bf_dmacontext)); + pci_unmap_single(sc->pdev, bf->bf_dmacontext, + skb_end_pointer(skb) - skb->head, + PCI_DMA_TODEVICE); dev_kfree_skb_any(skb); bf->bf_mpdu = NULL; } @@ -643,8 +642,8 @@ void ath9k_beacon_tasklet(unsigned long * on the tsf to safeguard against missing an swba. */ - /* FIXME: Use default value for now - Sujith */ - intval = ATH_DEFAULT_BINTVAL; + intval = sc->hw->conf.beacon_int ? + sc->hw->conf.beacon_int : ATH_DEFAULT_BINTVAL; tsf = ath9k_hw_gettsf64(ah); tsftu = TSF_TO_TU(tsf>>32, tsf); @@ -760,7 +759,8 @@ void ath_beacon_config(struct ath_softc * Protocol stack doesn't support dynamic beacon configuration, * use default configurations. */ - conf.beacon_interval = ATH_DEFAULT_BINTVAL; + conf.beacon_interval = sc->hw->conf.beacon_int ? + sc->hw->conf.beacon_int : ATH_DEFAULT_BINTVAL; conf.listen_interval = 1; conf.dtim_period = conf.beacon_interval; conf.dtim_count = 1; Index: wireless-testing/drivers/net/wireless/ath9k/core.h =================================================================== --- wireless-testing.orig/drivers/net/wireless/ath9k/core.h +++ wireless-testing/drivers/net/wireless/ath9k/core.h @@ -729,11 +729,6 @@ void ath_beacon_sync(struct ath_softc *s void ath_get_beaconconfig(struct ath_softc *sc, int if_id, struct ath_beacon_config *conf); -int ath_update_beacon(struct ath_softc *sc, - int if_id, - struct ath_beacon_offset *bo, - struct sk_buff *skb, - int mcast); /********/ /* VAPs */ /********/ -- -- Jouni Malinen PGP id EFC895FA ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 3/5] ath9k: Fix TX status reporting 2008-08-11 11:01 [PATCH 0/5] ath9k: Preliminary changes to enabled access point mode Jouni Malinen 2008-08-11 11:01 ` [PATCH 1/5] ath9k: Allow AP mode to be enabled Jouni Malinen 2008-08-11 11:01 ` [PATCH 2/5] ath9k: Updated Beacon generation to use mac80211-style Jouni Malinen @ 2008-08-11 11:01 ` Jouni Malinen 2008-08-11 11:01 ` [PATCH 4/5] ath9k: Assign seq# when mac80211 requests this Jouni Malinen 2008-08-11 11:01 ` [PATCH 5/5] ath9k: Fix TX control flag use for no ACK and RTS/CTS Jouni Malinen 4 siblings, 0 replies; 6+ messages in thread From: Jouni Malinen @ 2008-08-11 11:01 UTC (permalink / raw) To: John W. Linville; +Cc: linux-wireless Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com> Index: wireless-testing/drivers/net/wireless/ath9k/main.c =================================================================== --- wireless-testing.orig/drivers/net/wireless/ath9k/main.c +++ wireless-testing/drivers/net/wireless/ath9k/main.c @@ -1085,8 +1085,16 @@ void ath_tx_complete(struct ath_softc *s tx_info->flags |= IEEE80211_TX_STAT_AMPDU_NO_BACK; tx_status->flags &= ~ATH_TX_BAR; } - if (tx_status->flags) - tx_info->status.excessive_retries = 1; + + if (tx_status->flags & (ATH_TX_ERROR | ATH_TX_XRETRY)) { + if (!(tx_info->flags & IEEE80211_TX_CTL_NO_ACK)) { + /* Frame was not ACKed, but an ACK was expected */ + tx_info->status.excessive_retries = 1; + } + } else { + /* Frame was ACKed */ + tx_info->flags |= IEEE80211_TX_STAT_ACK; + } tx_info->status.retry_count = tx_status->retries; -- -- Jouni Malinen PGP id EFC895FA ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 4/5] ath9k: Assign seq# when mac80211 requests this 2008-08-11 11:01 [PATCH 0/5] ath9k: Preliminary changes to enabled access point mode Jouni Malinen ` (2 preceding siblings ...) 2008-08-11 11:01 ` [PATCH 3/5] ath9k: Fix TX status reporting Jouni Malinen @ 2008-08-11 11:01 ` Jouni Malinen 2008-08-11 11:01 ` [PATCH 5/5] ath9k: Fix TX control flag use for no ACK and RTS/CTS Jouni Malinen 4 siblings, 0 replies; 6+ messages in thread From: Jouni Malinen @ 2008-08-11 11:01 UTC (permalink / raw) To: John W. Linville; +Cc: linux-wireless Use TX control flag IEEE80211_TX_CTL_ASSIGN_SEQ as a request to update the seq# for the frames. This will likely require some further cleanup to get seq# correctly for Beacons vs. other frames and also potentially for multiple BSSes. Anyway, this is better than ending up sending out most frames with seq# 0. Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com> Index: wireless-testing/drivers/net/wireless/ath9k/beacon.c =================================================================== --- wireless-testing.orig/drivers/net/wireless/ath9k/beacon.c +++ wireless-testing/drivers/net/wireless/ath9k/beacon.c @@ -209,6 +209,7 @@ static struct ath_buf *ath_beacon_genera int is_beacon_dtim = 0; struct ath_txq *cabq; struct ath_txq *mcastq; + struct ieee80211_tx_info *info; avp = sc->sc_vaps[if_id]; mcastq = &avp->av_mcastq; @@ -233,6 +234,17 @@ static struct ath_buf *ath_beacon_genera bf->bf_mpdu = skb; if (skb == NULL) return NULL; + info = IEEE80211_SKB_CB(skb); + if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) { + /* + * TODO: make sure the seq# gets assigned properly (vs. other + * TX frames) + */ + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; + sc->seq_no += 0x10; + hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG); + hdr->seq_ctrl |= cpu_to_le16(sc->seq_no); + } bf->bf_buf_addr = bf->bf_dmacontext = pci_map_single(sc->pdev, skb->data, skb_end_pointer(skb) - skb->head, Index: wireless-testing/drivers/net/wireless/ath9k/main.c =================================================================== --- wireless-testing.orig/drivers/net/wireless/ath9k/main.c +++ wireless-testing/drivers/net/wireless/ath9k/main.c @@ -368,6 +368,20 @@ static int ath9k_tx(struct ieee80211_hw { struct ath_softc *sc = hw->priv; int hdrlen, padsize; + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); + + /* + * As a temporary workaround, assign seq# here; this will likely need + * to be cleaned up to work better with Beacon transmission and virtual + * BSSes. + */ + if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) { + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; + if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT) + sc->seq_no += 0x10; + hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG); + hdr->seq_ctrl |= cpu_to_le16(sc->seq_no); + } /* Add the padding after the header if this is not already done */ hdrlen = ieee80211_get_hdrlen_from_skb(skb); Index: wireless-testing/drivers/net/wireless/ath9k/core.h =================================================================== --- wireless-testing.orig/drivers/net/wireless/ath9k/core.h +++ wireless-testing/drivers/net/wireless/ath9k/core.h @@ -965,6 +965,7 @@ struct ath_softc { u32 sc_txqsetup; u32 sc_txintrperiod; /* tx interrupt batching */ int sc_haltype2q[ATH9K_WME_AC_VO+1]; /* HAL WME AC -> h/w qnum */ + u16 seq_no; /* TX sequence number */ /* Beacon */ struct ath9k_tx_queue_info sc_beacon_qi; -- -- Jouni Malinen PGP id EFC895FA ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 5/5] ath9k: Fix TX control flag use for no ACK and RTS/CTS 2008-08-11 11:01 [PATCH 0/5] ath9k: Preliminary changes to enabled access point mode Jouni Malinen ` (3 preceding siblings ...) 2008-08-11 11:01 ` [PATCH 4/5] ath9k: Assign seq# when mac80211 requests this Jouni Malinen @ 2008-08-11 11:01 ` Jouni Malinen 4 siblings, 0 replies; 6+ messages in thread From: Jouni Malinen @ 2008-08-11 11:01 UTC (permalink / raw) To: John W. Linville; +Cc: linux-wireless Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com> Index: wireless-testing/drivers/net/wireless/ath9k/xmit.c =================================================================== --- wireless-testing.orig/drivers/net/wireless/ath9k/xmit.c +++ wireless-testing/drivers/net/wireless/ath9k/xmit.c @@ -357,9 +357,9 @@ static int ath_tx_prepare(struct ath_sof txctl->flags = ATH9K_TXDESC_CLRDMASK; /* needed for crypto errors */ if (tx_info->flags & IEEE80211_TX_CTL_NO_ACK) - tx_info->flags |= ATH9K_TXDESC_NOACK; + txctl->flags |= ATH9K_TXDESC_NOACK; if (tx_info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) - tx_info->flags |= ATH9K_TXDESC_RTSENA; + txctl->flags |= ATH9K_TXDESC_RTSENA; /* * Setup for rate calculations. -- -- Jouni Malinen PGP id EFC895FA ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-08-11 11:03 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-08-11 11:01 [PATCH 0/5] ath9k: Preliminary changes to enabled access point mode Jouni Malinen 2008-08-11 11:01 ` [PATCH 1/5] ath9k: Allow AP mode to be enabled Jouni Malinen 2008-08-11 11:01 ` [PATCH 2/5] ath9k: Updated Beacon generation to use mac80211-style Jouni Malinen 2008-08-11 11:01 ` [PATCH 3/5] ath9k: Fix TX status reporting Jouni Malinen 2008-08-11 11:01 ` [PATCH 4/5] ath9k: Assign seq# when mac80211 requests this Jouni Malinen 2008-08-11 11:01 ` [PATCH 5/5] ath9k: Fix TX control flag use for no ACK and RTS/CTS Jouni Malinen
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).