static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata,
enum ieee80211_self_protected_actioncode action,
- u8 *da, __le16 llid, __le16 plid, __le16 reason);
+ u8 *da, u16 llid, u16 plid, u16 reason);
/* We only need a valid sta if user configured a minimum rssi_threshold. */
spin_lock_bh(&sta->lock);
changed = __mesh_plink_deactivate(sta);
- sta->reason = cpu_to_le16(WLAN_REASON_MESH_PEER_CANCELED);
+ sta->reason = WLAN_REASON_MESH_PEER_CANCELED;
mesh_plink_frame_tx(sdata, WLAN_SP_MESH_PEERING_CLOSE,
sta->sta.addr, sta->llid, sta->plid,
sta->reason);
static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata,
enum ieee80211_self_protected_actioncode action,
- u8 *da, __le16 llid, __le16 plid, __le16 reason)
+ u8 *da, u16 llid, u16 plid, u16 reason)
{
struct ieee80211_local *local = sdata->local;
struct sk_buff *skb;
if (action == WLAN_SP_MESH_PEERING_CONFIRM) {
/* AID */
pos = skb_put(skb, 2);
- memcpy(pos + 2, &plid, 2);
+ put_unaligned_le16(plid, pos + 2);
}
if (ieee80211_add_srates_ie(sdata, skb, true, band) ||
ieee80211_add_ext_srates_ie(sdata, skb, true, band) ||
*pos++ = ie_len;
memcpy(pos, &peering_proto, 2);
pos += 2;
- memcpy(pos, &llid, 2);
+ put_unaligned_le16(llid, pos);
pos += 2;
if (include_plid) {
- memcpy(pos, &plid, 2);
+ put_unaligned_le16(plid, pos);
pos += 2;
}
if (action == WLAN_SP_MESH_PEERING_CLOSE) {
- memcpy(pos, &reason, 2);
+ put_unaligned_le16(reason, pos);
pos += 2;
}
static void mesh_plink_timer(unsigned long data)
{
struct sta_info *sta;
- __le16 llid, plid, reason;
+ u16 reason = 0;
struct ieee80211_sub_if_data *sdata;
struct mesh_config *mshcfg;
enum ieee80211_self_protected_actioncode action = 0;
mpl_dbg(sta->sdata,
"Mesh plink timer for %pM fired on state %s\n",
sta->sta.addr, mplstates[sta->plink_state]);
- reason = 0;
- llid = sta->llid;
- plid = sta->plid;
sdata = sta->sdata;
mshcfg = &sdata->u.mesh.mshcfg;
action = WLAN_SP_MESH_PEERING_OPEN;
break;
}
- reason = cpu_to_le16(WLAN_REASON_MESH_MAX_RETRIES);
+ reason = WLAN_REASON_MESH_MAX_RETRIES;
/* fall through on else */
case NL80211_PLINK_CNF_RCVD:
/* confirm timer */
if (!reason)
- reason = cpu_to_le16(WLAN_REASON_MESH_CONFIRM_TIMEOUT);
+ reason = WLAN_REASON_MESH_CONFIRM_TIMEOUT;
sta->plink_state = NL80211_PLINK_HOLDING;
mod_plink_timer(sta, mshcfg->dot11MeshHoldingTimeout);
action = WLAN_SP_MESH_PEERING_CLOSE;
spin_unlock_bh(&sta->lock);
if (action)
mesh_plink_frame_tx(sdata, action, sta->sta.addr,
- llid, plid, reason);
+ sta->llid, sta->plid, reason);
}
static inline void mesh_plink_timer_set(struct sta_info *sta, int timeout)
}
static bool llid_in_use(struct ieee80211_sub_if_data *sdata,
- __le16 llid)
+ u16 llid)
{
struct ieee80211_local *local = sdata->local;
bool in_use = false;
return in_use;
}
-static __le16 mesh_get_new_llid(struct ieee80211_sub_if_data *sdata)
+static u16 mesh_get_new_llid(struct ieee80211_sub_if_data *sdata)
{
u16 llid;
get_random_bytes(&llid, sizeof(llid));
/* for mesh PS we still only have the AID range for TIM bits */
llid = (llid % IEEE80211_MAX_AID) + 1;
- } while (llid_in_use(sdata, cpu_to_le16(llid)));
+ } while (llid_in_use(sdata, llid));
- return cpu_to_le16(llid);
+ return llid;
}
u32 mesh_plink_open(struct sta_info *sta)
{
struct mesh_config *mshcfg = &sdata->u.mesh.mshcfg;
- __le16 reason = (event == CLS_ACPT) ?
- cpu_to_le16(WLAN_REASON_MESH_CLOSE) :
- cpu_to_le16(WLAN_REASON_MESH_CONFIG);
+ u16 reason = (event == CLS_ACPT) ?
+ WLAN_REASON_MESH_CLOSE : WLAN_REASON_MESH_CONFIG;
sta->reason = reason;
sta->plink_state = NL80211_PLINK_HOLDING;
struct sta_info *sta,
struct ieee802_11_elems *elems,
enum ieee80211_self_protected_actioncode ftype,
- __le16 llid, __le16 plid)
+ u16 llid, u16 plid)
{
enum plink_event event = PLINK_UNDEFINED;
u8 ie_len = elems->peering_len;
enum ieee80211_self_protected_actioncode ftype;
u32 changed = 0;
u8 ie_len = elems->peering_len;
- __le16 plid, llid = 0;
+ __le16 _plid, _llid;
+ u16 plid, llid = 0;
if (!elems->peering) {
mpl_dbg(sdata,
/* Note the lines below are correct, the llid in the frame is the plid
* from the point of view of this host.
*/
- memcpy(&plid, PLINK_GET_LLID(elems->peering), 2);
+ memcpy(&_plid, PLINK_GET_LLID(elems->peering), sizeof(__le16));
+ plid = le16_to_cpu(_plid);
if (ftype == WLAN_SP_MESH_PEERING_CONFIRM ||
- (ftype == WLAN_SP_MESH_PEERING_CLOSE && ie_len == 8))
- memcpy(&llid, PLINK_GET_PLID(elems->peering), 2);
+ (ftype == WLAN_SP_MESH_PEERING_CLOSE && ie_len == 8)) {
+ memcpy(&_llid, PLINK_GET_PLID(elems->peering), sizeof(__le16));
+ llid = le16_to_cpu(_llid);
+ }
/* WARNING: Only for sta pointer, is dropped & re-acquired */
rcu_read_lock();
} else if (!sta && event == OPN_RJCT) {
mesh_plink_frame_tx(sdata, WLAN_SP_MESH_PEERING_CLOSE,
mgmt->sa, 0, plid,
- cpu_to_le16(WLAN_REASON_MESH_CONFIG));
+ WLAN_REASON_MESH_CONFIG);
goto unlock_rcu;
} else if (!sta || event == PLINK_UNDEFINED) {
/* something went wrong */