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

Commit fd1af15d authored by Johannes Berg's avatar Johannes Berg Committed by Reinette Chatre
Browse files

iwlwifi: track station IDs



mac80211 allows us to store private data per
station, so put the station ID there. This
allows us to avoid the station ID lookup when
removing regular stations. To also be able to
avoid the lookup to remove the special IBSS
BSSID station, track its ID in the per-vif
private data.

Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarReinette Chatre <reinette.chatre@intel.com>
parent 4ff73974
Loading
Loading
Loading
Loading
+7 −9
Original line number Diff line number Diff line
@@ -2461,28 +2461,26 @@ static u16 iwl3945_build_addsta_hcmd(const struct iwl_addsta_cmd *cmd, u8 *data)
static int iwl3945_manage_ibss_station(struct iwl_priv *priv,
				       struct ieee80211_vif *vif, bool add)
{
	struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv;
	int ret;

	/*
	 * NB: this assumes that the station it gets will be
	 *     IWL_STA_ID, which will happen but isn't obvious.
	 */

	if (add) {
		ret = iwl_add_local_station(priv, vif->bss_conf.bssid, false);
		ret = iwl_add_local_station(priv, vif->bss_conf.bssid, false,
					    &vif_priv->ibss_bssid_sta_id);
		if (ret)
			return ret;

		iwl3945_sync_sta(priv, IWL_STA_ID,
		iwl3945_sync_sta(priv, vif_priv->ibss_bssid_sta_id,
				 (priv->band == IEEE80211_BAND_5GHZ) ?
				 IWL_RATE_6M_PLCP : IWL_RATE_1M_PLCP,
				 CMD_ASYNC);
		iwl3945_rate_scale_init(priv->hw, IWL_STA_ID);
		iwl3945_rate_scale_init(priv->hw, vif_priv->ibss_bssid_sta_id);

		return 0;
	}

	return iwl_remove_station(priv, vif->bss_conf.bssid);
	return iwl_remove_station(priv, vif_priv->ibss_bssid_sta_id,
				  vif->bss_conf.bssid);
}

/**
+5 −0
Original line number Diff line number Diff line
@@ -106,7 +106,12 @@ struct iwl3945_rs_sta {
};


/*
 * The common struct MUST be first because it is shared between
 * 3945 and agn!
 */
struct iwl3945_sta_priv {
	struct iwl_station_priv_common common;
	struct iwl3945_rs_sta rs_sta;
};

+6 −2
Original line number Diff line number Diff line
@@ -1520,7 +1520,11 @@ void iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
int iwlagn_manage_ibss_station(struct iwl_priv *priv,
			       struct ieee80211_vif *vif, bool add)
{
	struct iwl_vif_priv *vif_priv = (void *)vif->drv_priv;

	if (add)
		return iwl_add_local_station(priv, vif->bss_conf.bssid, true);
	return iwl_remove_station(priv, vif->bss_conf.bssid);
		return iwl_add_local_station(priv, vif->bss_conf.bssid, true,
					     &vif_priv->ibss_bssid_sta_id);
	return iwl_remove_station(priv, vif_priv->ibss_bssid_sta_id,
				  vif->bss_conf.bssid);
}
+7 −1
Original line number Diff line number Diff line
@@ -2854,6 +2854,8 @@ static int iwl_mac_setup_register(struct iwl_priv *priv,
			     IEEE80211_HW_SUPPORTS_STATIC_SMPS;

	hw->sta_data_size = sizeof(struct iwl_station_priv);
	hw->vif_data_size = sizeof(struct iwl_vif_priv);

	hw->wiphy->interface_modes =
		BIT(NL80211_IFTYPE_STATION) |
		BIT(NL80211_IFTYPE_ADHOC);
@@ -3229,6 +3231,8 @@ static int iwlagn_mac_sta_add(struct ieee80211_hw *hw,
	int ret;
	u8 sta_id;

	sta_priv->common.sta_id = IWL_INVALID_STATION;

	IWL_DEBUG_INFO(priv, "received request to add station %pM\n",
			sta->addr);

@@ -3245,12 +3249,14 @@ static int iwlagn_mac_sta_add(struct ieee80211_hw *hw,
		return ret;
	}

	sta_priv->common.sta_id = sta_id;

	/* Initialize rate scaling */
	IWL_DEBUG_INFO(priv, "Initializing rate scaling for station %pM\n",
		       sta->addr);
	iwl_rs_rate_init(priv, sta, sta_id);

	return ret;
	return 0;
}

/*****************************************************************************
+18 −0
Original line number Diff line number Diff line
@@ -497,20 +497,38 @@ struct iwl_station_entry {
	struct iwl_link_quality_cmd *lq;
};

struct iwl_station_priv_common {
	u8 sta_id;
};

/*
 * iwl_station_priv: Driver's private station information
 *
 * When mac80211 creates a station it reserves some space (hw->sta_data_size)
 * in the structure for use by driver. This structure is places in that
 * space.
 *
 * The common struct MUST be first because it is shared between
 * 3945 and agn!
 */
struct iwl_station_priv {
	struct iwl_station_priv_common common;
	struct iwl_lq_sta lq_sta;
	atomic_t pending_frames;
	bool client;
	bool asleep;
};

/**
 * struct iwl_vif_priv - driver's private per-interface information
 *
 * When mac80211 allocates a virtual interface, it can allocate
 * space for us to put data into.
 */
struct iwl_vif_priv {
	u8 ibss_bssid_sta_id;
};

/* one for each uCode image (inst/data, boot/init/runtime) */
struct fw_desc {
	void *v_addr;		/* access by driver */
Loading