Commit b443d8d8 authored by Johannes Berg's avatar Johannes Berg Committed by John W. Linville

iwlwifi: make iwl_fill_probe_req static

This function is only used in iwl-scan.c, so
if we move it up a little in the file it can
be made static.
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarWey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent e7a0d0c4
...@@ -202,8 +202,6 @@ void iwl_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms); ...@@ -202,8 +202,6 @@ void iwl_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms);
void iwl_force_scan_end(struct iwl_priv *priv); void iwl_force_scan_end(struct iwl_priv *priv);
void iwl_internal_short_hw_scan(struct iwl_priv *priv); void iwl_internal_short_hw_scan(struct iwl_priv *priv);
int iwl_force_reset(struct iwl_priv *priv, int mode, bool external); int iwl_force_reset(struct iwl_priv *priv, int mode, bool external);
u16 iwl_fill_probe_req(struct iwl_priv *priv, struct ieee80211_mgmt *frame,
const u8 *ta, const u8 *ie, int ie_len, int left);
void iwl_setup_rx_scan_handlers(struct iwl_priv *priv); void iwl_setup_rx_scan_handlers(struct iwl_priv *priv);
void iwl_setup_scan_deferred_work(struct iwl_priv *priv); void iwl_setup_scan_deferred_work(struct iwl_priv *priv);
void iwl_cancel_scan_deferred_work(struct iwl_priv *priv); void iwl_cancel_scan_deferred_work(struct iwl_priv *priv);
......
...@@ -572,6 +572,53 @@ static int iwl_get_channels_for_scan(struct iwl_priv *priv, ...@@ -572,6 +572,53 @@ static int iwl_get_channels_for_scan(struct iwl_priv *priv,
return added; return added;
} }
/**
* iwl_fill_probe_req - fill in all required fields and IE for probe request
*/
static u16 iwl_fill_probe_req(struct ieee80211_mgmt *frame, const u8 *ta,
const u8 *ies, int ie_len, int left)
{
int len = 0;
u8 *pos = NULL;
/* Make sure there is enough space for the probe request,
* two mandatory IEs and the data */
left -= 24;
if (left < 0)
return 0;
frame->frame_control = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ);
memcpy(frame->da, iwl_bcast_addr, ETH_ALEN);
memcpy(frame->sa, ta, ETH_ALEN);
memcpy(frame->bssid, iwl_bcast_addr, ETH_ALEN);
frame->seq_ctrl = 0;
len += 24;
/* ...next IE... */
pos = &frame->u.probe_req.variable[0];
/* fill in our indirect SSID IE */
left -= 2;
if (left < 0)
return 0;
*pos++ = WLAN_EID_SSID;
*pos++ = 0;
len += 2;
if (WARN_ON(left < ie_len))
return len;
if (ies && ie_len) {
memcpy(pos, ies, ie_len);
len += ie_len;
}
return (u16)len;
}
static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
{ {
struct iwl_host_cmd cmd = { struct iwl_host_cmd cmd = {
...@@ -791,7 +838,7 @@ static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) ...@@ -791,7 +838,7 @@ static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
scan->rx_chain = cpu_to_le16(rx_chain); scan->rx_chain = cpu_to_le16(rx_chain);
switch (priv->scan_type) { switch (priv->scan_type) {
case IWL_SCAN_NORMAL: case IWL_SCAN_NORMAL:
cmd_len = iwl_fill_probe_req(priv, cmd_len = iwl_fill_probe_req(
(struct ieee80211_mgmt *)scan->data, (struct ieee80211_mgmt *)scan->data,
vif->addr, vif->addr,
priv->scan_request->ie, priv->scan_request->ie,
...@@ -801,7 +848,7 @@ static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) ...@@ -801,7 +848,7 @@ static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
case IWL_SCAN_RADIO_RESET: case IWL_SCAN_RADIO_RESET:
case IWL_SCAN_ROC: case IWL_SCAN_ROC:
/* use bcast addr, will not be transmitted but must be valid */ /* use bcast addr, will not be transmitted but must be valid */
cmd_len = iwl_fill_probe_req(priv, cmd_len = iwl_fill_probe_req(
(struct ieee80211_mgmt *)scan->data, (struct ieee80211_mgmt *)scan->data,
iwl_bcast_addr, NULL, 0, iwl_bcast_addr, NULL, 0,
IWL_MAX_SCAN_SIZE - sizeof(*scan)); IWL_MAX_SCAN_SIZE - sizeof(*scan));
...@@ -1004,53 +1051,6 @@ static void iwl_bg_scan_check(struct work_struct *data) ...@@ -1004,53 +1051,6 @@ static void iwl_bg_scan_check(struct work_struct *data)
mutex_unlock(&priv->mutex); mutex_unlock(&priv->mutex);
} }
/**
* iwl_fill_probe_req - fill in all required fields and IE for probe request
*/
u16 iwl_fill_probe_req(struct iwl_priv *priv, struct ieee80211_mgmt *frame,
const u8 *ta, const u8 *ies, int ie_len, int left)
{
int len = 0;
u8 *pos = NULL;
/* Make sure there is enough space for the probe request,
* two mandatory IEs and the data */
left -= 24;
if (left < 0)
return 0;
frame->frame_control = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ);
memcpy(frame->da, iwl_bcast_addr, ETH_ALEN);
memcpy(frame->sa, ta, ETH_ALEN);
memcpy(frame->bssid, iwl_bcast_addr, ETH_ALEN);
frame->seq_ctrl = 0;
len += 24;
/* ...next IE... */
pos = &frame->u.probe_req.variable[0];
/* fill in our indirect SSID IE */
left -= 2;
if (left < 0)
return 0;
*pos++ = WLAN_EID_SSID;
*pos++ = 0;
len += 2;
if (WARN_ON(left < ie_len))
return len;
if (ies && ie_len) {
memcpy(pos, ies, ie_len);
len += ie_len;
}
return (u16)len;
}
static void iwl_bg_abort_scan(struct work_struct *work) static void iwl_bg_abort_scan(struct work_struct *work)
{ {
struct iwl_priv *priv = container_of(work, struct iwl_priv, abort_scan); struct iwl_priv *priv = container_of(work, struct iwl_priv, abort_scan);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment