Skip to contentSkip to conversation

ath9k: Preliminary changes to enabled access point mode

PATCH New Jouni Malinen 1 participant 6 messages Aug 11, 2008 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

cover ath9k: Preliminary changes to enabled access point mode

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.

Signature · 1 line
Jouni Malinen                                            PGP id EFC895FA
#1 lore raw

PATCH 1/5 ath9k: Allow AP mode to be enabled

drivers/net/wireless/ath9k/main.c +17 -2
Index: 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) {
drivers/net/wireless/ath9k/core.c +9 -3
Index: 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;
 

--

Signature · 1 line
Jouni Malinen                                            PGP id EFC895FA
#2 lore raw

PATCH 2/5 ath9k: Updated Beacon generation to use mac80211-style

In reply to Jouni Malinen

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).

drivers/net/wireless/ath9k/main.c +12 -9
Index: 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)
 {
drivers/net/wireless/ath9k/beacon.c +36 -36

145 lines not on this page · raw message

drivers/net/wireless/ath9k/core.h +0 -5
Index: 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 */
 /********/

--

Signature · 1 line
Jouni Malinen                                            PGP id EFC895FA
#3 lore raw

PATCH 3/5 ath9k: Fix TX status reporting

In reply to Jouni Malinen
drivers/net/wireless/ath9k/main.c +10 -2
Index: 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;
 

--

Signature · 1 line
Jouni Malinen                                            PGP id EFC895FA
#4 lore raw

PATCH 4/5 ath9k: Assign seq# when mac80211 requests this

In reply to Jouni Malinen

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.

drivers/net/wireless/ath9k/beacon.c +12 -0
Index: 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,
drivers/net/wireless/ath9k/main.c +14 -0
Index: 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);
drivers/net/wireless/ath9k/core.h +1 -0
Index: 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;

--

Signature · 1 line
Jouni Malinen                                            PGP id EFC895FA
#5 lore raw

PATCH 5/5 ath9k: Fix TX control flag use for no ACK and RTS/CTS

In reply to Jouni Malinen
drivers/net/wireless/ath9k/xmit.c +2 -2
Index: 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.

--

Signature · 1 line
Jouni Malinen                                            PGP id EFC895FA