Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2b406f1e authored by Sujith's avatar Sujith Committed by John W. Linville
Browse files

ath9k: Nuke fixed rate handling in driver

parent 46494e6d
Loading
Loading
Loading
Loading
+0 −4
Original line number Original line Diff line number Diff line
@@ -89,13 +89,9 @@ static void ath_setcurmode(struct ath_softc *sc, enum wireless_mode mode)
	const struct ath9k_rate_table *rt;
	const struct ath9k_rate_table *rt;
	int i;
	int i;


	memset(sc->sc_rixmap, 0xff, sizeof(sc->sc_rixmap));
	rt = ath9k_hw_getratetable(sc->sc_ah, mode);
	rt = ath9k_hw_getratetable(sc->sc_ah, mode);
	BUG_ON(!rt);
	BUG_ON(!rt);


	for (i = 0; i < rt->rateCount; i++)
		sc->sc_rixmap[rt->info[i].rateCode] = (u8) i;

	memset(sc->sc_hwmap, 0, sizeof(sc->sc_hwmap));
	memset(sc->sc_hwmap, 0, sizeof(sc->sc_hwmap));
	for (i = 0; i < 256; i++) {
	for (i = 0; i < 256; i++) {
		u8 ix = rt->rateCodeToIndex[i];
		u8 ix = rt->rateCodeToIndex[i];
+0 −8
Original line number Original line Diff line number Diff line
@@ -641,19 +641,12 @@ void ath_get_beaconconfig(struct ath_softc *sc,
#define ATH_SET_VAP_BSSID_MASK(bssid_mask) \
#define ATH_SET_VAP_BSSID_MASK(bssid_mask) \
	((bssid_mask)[0] &= ~(((ATH_BCBUF-1)<<2)|0x02))
	((bssid_mask)[0] &= ~(((ATH_BCBUF-1)<<2)|0x02))


/* VAP configuration (from protocol layer) */
struct ath_vap_config {
	u32 av_fixed_rateset;
	u32 av_fixed_retryset;
};

/* driver-specific vap state */
/* driver-specific vap state */
struct ath_vap {
struct ath_vap {
	int av_bslot;			/* beacon slot index */
	int av_bslot;			/* beacon slot index */
	enum ath9k_opmode av_opmode;	/* VAP operational mode */
	enum ath9k_opmode av_opmode;	/* VAP operational mode */
	struct ath_buf *av_bcbuf;	/* beacon buffer */
	struct ath_buf *av_bcbuf;	/* beacon buffer */
	struct ath_tx_control av_btxctl;  /* txctl information for beacon */
	struct ath_tx_control av_btxctl;  /* txctl information for beacon */
	struct ath_vap_config av_config;/* vap configuration parameters*/
	struct ath_rate_node *rc_node;
	struct ath_rate_node *rc_node;
};
};


@@ -915,7 +908,6 @@ struct ath_softc {
	/* Rate */
	/* Rate */
	struct ieee80211_rate rates[IEEE80211_NUM_BANDS][ATH_RATE_MAX];
	struct ieee80211_rate rates[IEEE80211_NUM_BANDS][ATH_RATE_MAX];
	const struct ath9k_rate_table *sc_currates;
	const struct ath9k_rate_table *sc_currates;
	u8 sc_rixmap[256];	/* IEEE to h/w rate table ix */
	u8 sc_protrix;		/* protection rate index */
	u8 sc_protrix;		/* protection rate index */
	struct {
	struct {
		u32 rateKbps;	/* transfer rate in kbs */
		u32 rateKbps;	/* transfer rate in kbs */
+0 −8
Original line number Original line Diff line number Diff line
@@ -379,7 +379,6 @@ static void ath9k_bss_assoc_info(struct ath_softc *sc,
				"%s: Unable to set channel\n",
				"%s: Unable to set channel\n",
				__func__);
				__func__);


		ath_rate_newstate(sc, avp);
		/* Update ratectrl about the new state */
		/* Update ratectrl about the new state */
		ath_rc_node_update(hw, avp->rc_node);
		ath_rc_node_update(hw, avp->rc_node);


@@ -1099,10 +1098,6 @@ static int ath9k_add_interface(struct ieee80211_hw *hw,
	/* Set the device opmode */
	/* Set the device opmode */
	sc->sc_ah->ah_opmode = ic_opmode;
	sc->sc_ah->ah_opmode = ic_opmode;


	/* default VAP configuration */
	avp->av_config.av_fixed_rateset = IEEE80211_FIXED_RATE_NONE;
	avp->av_config.av_fixed_retryset = 0x03030303;

	if (conf->type == NL80211_IFTYPE_AP) {
	if (conf->type == NL80211_IFTYPE_AP) {
		/* TODO: is this a suitable place to start ANI for AP mode? */
		/* TODO: is this a suitable place to start ANI for AP mode? */
		/* Start ANI */
		/* Start ANI */
@@ -1205,9 +1200,6 @@ static int ath9k_config_interface(struct ieee80211_hw *hw,
		switch (vif->type) {
		switch (vif->type) {
		case NL80211_IFTYPE_STATION:
		case NL80211_IFTYPE_STATION:
		case NL80211_IFTYPE_ADHOC:
		case NL80211_IFTYPE_ADHOC:
			/* Update ratectrl about the new state */
			ath_rate_newstate(sc, avp);

			/* Set BSSID */
			/* Set BSSID */
			memcpy(sc->sc_curbssid, conf->bssid, ETH_ALEN);
			memcpy(sc->sc_curbssid, conf->bssid, ETH_ALEN);
			sc->sc_curaid = 0;
			sc->sc_curaid = 0;
+3 −89
Original line number Original line Diff line number Diff line
@@ -709,27 +709,6 @@ u8 ath_rate_findrateix(struct ath_softc *sc,
	return 0;
	return 0;
}
}


/*
 * Update rate-control state on a device state change.  When
 * operating as a station this includes associate/reassociate
 * with an AP.  Otherwise this gets called, for example, when
 * the we transition to run state when operating as an AP.
 */
void ath_rate_newstate(struct ath_softc *sc, struct ath_vap *avp)
{
	struct ath_rate_softc *asc = sc->sc_rc;

	if (avp->av_config.av_fixed_rateset != IEEE80211_FIXED_RATE_NONE) {
		asc->fixedrix =
			sc->sc_rixmap[avp->av_config.av_fixed_rateset & 0xff];
		/* NB: check the fixed rate exists */
		if (asc->fixedrix == 0xff)
			asc->fixedrix = IEEE80211_FIXED_RATE_NONE;
	} else {
		asc->fixedrix = IEEE80211_FIXED_RATE_NONE;
	}
}

static u8 ath_rc_ratefind_ht(struct ath_softc *sc,
static u8 ath_rc_ratefind_ht(struct ath_softc *sc,
			     struct ath_rate_node *ath_rc_priv,
			     struct ath_rate_node *ath_rc_priv,
			     const struct ath_rate_table *rate_table,
			     const struct ath_rate_table *rate_table,
@@ -1009,73 +988,11 @@ static void ath_rate_findrate(struct ath_softc *sc,
			      int *is_probe,
			      int *is_probe,
			      int is_retry)
			      int is_retry)
{
{
	struct ath_vap *avp = ath_rc_priv->avp;

	DPRINTF(sc, ATH_DBG_RATE, "%s\n", __func__);

	if (!num_rates || !num_tries)
	if (!num_rates || !num_tries)
		return;
		return;


	if (avp->av_config.av_fixed_rateset == IEEE80211_FIXED_RATE_NONE) {
	ath_rc_ratefind(sc, ath_rc_priv, num_tries, num_rates,
	ath_rc_ratefind(sc, ath_rc_priv, num_tries, num_rates,
			rcflag, series, is_probe, is_retry);
			rcflag, series, is_probe, is_retry);
	} else {
		/* Fixed rate */
		int idx;
		u8 flags;
		u32 rix;
		struct ath_rate_softc *asc = ath_rc_priv->asc;
		struct ath_rate_table *rate_table;

		rate_table = (struct ath_rate_table *)
			asc->hw_rate_table[sc->sc_curmode];

		for (idx = 0; idx < 4; idx++) {
			unsigned int    mcs;
			u8 series_rix = 0;

			series[idx].tries = IEEE80211_RATE_IDX_ENTRY(
				avp->av_config.av_fixed_retryset, idx);

			mcs = IEEE80211_RATE_IDX_ENTRY(
				avp->av_config.av_fixed_rateset, idx);

			if (idx == 3 && (mcs & 0xf0) == 0x70)
				mcs = (mcs & ~0xf0)|0x80;

			if (!(mcs & 0x80))
				flags = 0;
			else
				flags = ((ath_rc_priv->ht_cap &
						WLAN_RC_DS_FLAG) ?
						ATH_RC_DS_FLAG : 0) |
					((ath_rc_priv->ht_cap &
						WLAN_RC_40_FLAG) ?
						ATH_RC_CW40_FLAG : 0) |
					((ath_rc_priv->ht_cap &
						WLAN_RC_SGI_FLAG) ?
					((ath_rc_priv->ht_cap &
						WLAN_RC_40_FLAG) ?
						ATH_RC_SGI_FLAG : 0) : 0);

			series[idx].rix = sc->sc_rixmap[mcs];
			series_rix  = series[idx].rix;

			/* XXX: Give me some cleanup love */
			if ((flags & ATH_RC_CW40_FLAG) &&
				(flags & ATH_RC_SGI_FLAG))
				rix = rate_table->info[series_rix].ht_index;
			else if (flags & ATH_RC_SGI_FLAG)
				rix = rate_table->info[series_rix].sgi_index;
			else if (flags & ATH_RC_CW40_FLAG)
				rix = rate_table->info[series_rix].cw40index;
			else
				rix = rate_table->info[series_rix].base_index;
			series[idx].max_4ms_framelen =
				rate_table->info[rix].max_4ms_framelen;
			series[idx].flags = flags;
		}
	}
}
}


static void ath_rc_update_ht(struct ath_softc *sc,
static void ath_rc_update_ht(struct ath_softc *sc,
@@ -1498,11 +1415,8 @@ static void ath_rate_tx_complete(struct ath_softc *sc,
{
{
	int final_ts_idx = info_priv->tx.ts_rateindex;
	int final_ts_idx = info_priv->tx.ts_rateindex;
	int tx_status = 0, is_underrun = 0;
	int tx_status = 0, is_underrun = 0;
	struct ath_vap *avp;


	avp = rc_priv->avp;
	if (info_priv->tx.ts_status & ATH9K_TXERR_FILT)
	if ((avp->av_config.av_fixed_rateset != IEEE80211_FIXED_RATE_NONE) ||
	    (info_priv->tx.ts_status & ATH9K_TXERR_FILT))
		return;
		return;


	if (info_priv->tx.ts_rssi > 0) {
	if (info_priv->tx.ts_rssi > 0) {
+1 −28
Original line number Original line Diff line number Diff line
@@ -60,16 +60,6 @@ struct ath_softc;


#define ATH_RATE_MAX	30
#define ATH_RATE_MAX	30


enum ieee80211_fixed_rate_mode {
	IEEE80211_FIXED_RATE_NONE  = 0,
	IEEE80211_FIXED_RATE_MCS   = 1  /* HT rates */
};

/*
 * Use the hal os glue code to get ms time
 */
#define IEEE80211_RATE_IDX_ENTRY(val, idx) (((val&(0xff<<(idx*8)))>>(idx*8)))

#define WLAN_PHY_HT_20_SS       WLAN_RC_PHY_HT_20_SS
#define WLAN_PHY_HT_20_SS       WLAN_RC_PHY_HT_20_SS
#define WLAN_PHY_HT_20_DS       WLAN_RC_PHY_HT_20_DS
#define WLAN_PHY_HT_20_DS       WLAN_RC_PHY_HT_20_DS
#define WLAN_PHY_HT_20_DS_HGI   WLAN_RC_PHY_HT_20_DS_HGI
#define WLAN_PHY_HT_20_DS_HGI   WLAN_RC_PHY_HT_20_DS_HGI
@@ -287,27 +277,10 @@ struct ath_tx_info_priv {
	u8 min_rate;
	u8 min_rate;
};
};


/*
 * Attach/detach a rate control module.
 */
struct ath_rate_softc *ath_rate_attach(struct ath_softc *sch);
struct ath_rate_softc *ath_rate_attach(struct ath_softc *sch);
void ath_rate_detach(struct ath_rate_softc *asc);
void ath_rate_detach(struct ath_rate_softc *asc);

/*
 * Update/reset rate control state for 802.11 state transitions.
 * Important mostly as the analog to ath_rate_newassoc when operating
 * in station mode.
 */
void ath_rc_node_update(struct ieee80211_hw *hw, struct ath_rate_node *rc_priv);
void ath_rc_node_update(struct ieee80211_hw *hw, struct ath_rate_node *rc_priv);
void ath_rate_newstate(struct ath_softc *sc, struct ath_vap *avp);
u8 ath_rate_findrateix(struct ath_softc *sc, u8 dot11_rate);

/*
 * Return rate index for given Dot11 Rate.
 */
u8 ath_rate_findrateix(struct ath_softc *sc,
		       u8 dot11_rate);

/* Routines to register/unregister rate control algorithm */
int ath_rate_control_register(void);
int ath_rate_control_register(void);
void ath_rate_control_unregister(void);
void ath_rate_control_unregister(void);