Commit a09343fc authored by Jérôme Pouiller's avatar Jérôme Pouiller Committed by Greg Kroah-Hartman
Browse files

staging: wfx: simplify hif_update_ie()



hif_update_ie() is only called to change the beacon template. So,
specialize this function and simplify the way to call it.

Signed-off-by: default avatarJérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20200115135338.14374-29-Jerome.Pouiller@silabs.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d1072b04
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -461,15 +461,14 @@ int hif_map_link(struct wfx_vif *wvif, u8 *mac_addr, int flags, int sta_id)
	return ret;
}

int hif_update_ie(struct wfx_vif *wvif, const struct hif_ie_flags *target_frame,
		  const u8 *ies, size_t ies_len)
int hif_update_ie_beacon(struct wfx_vif *wvif, const u8 *ies, size_t ies_len)
{
	int ret;
	struct hif_msg *hif;
	int buf_len = sizeof(struct hif_req_update_ie) + ies_len;
	struct hif_req_update_ie *body = wfx_alloc_hif(buf_len, &hif);

	memcpy(&body->ie_flags, target_frame, sizeof(struct hif_ie_flags));
	body->ie_flags.beacon = 1;
	body->num_ies = cpu_to_le16(1);
	memcpy(body->ie, ies, ies_len);
	wfx_fill_header(hif, wvif->id, HIF_REQ_ID_UPDATE_IE, buf_len);
+1 −2
Original line number Diff line number Diff line
@@ -57,8 +57,7 @@ int hif_start(struct wfx_vif *wvif, const struct ieee80211_bss_conf *conf,
	      const struct ieee80211_channel *channel);
int hif_beacon_transmit(struct wfx_vif *wvif, bool enable);
int hif_map_link(struct wfx_vif *wvif, u8 *mac_addr, int flags, int sta_id);
int hif_update_ie(struct wfx_vif *wvif, const struct hif_ie_flags *target_frame,
		  const u8 *ies, size_t ies_len);
int hif_update_ie_beacon(struct wfx_vif *wvif, const u8 *ies, size_t ies_len);
int hif_sl_set_mac_key(struct wfx_dev *wdev, const u8 *slk_key,
		       int destination);
int hif_sl_config(struct wfx_dev *wdev, const unsigned long *bitmap);
+2 −8
Original line number Diff line number Diff line
@@ -881,9 +881,6 @@ void wfx_bss_info_changed(struct ieee80211_hw *hw,
	if (changed & BSS_CHANGED_ASSOC ||
	    changed & BSS_CHANGED_ERP_CTS_PROT ||
	    changed & BSS_CHANGED_ERP_PREAMBLE) {
		struct hif_ie_flags target_frame = {
			.beacon = 1,
		};
		u8 erp_ie[3] = { WLAN_EID_ERP_INFO, 1, 0 };

		hif_erp_use_protection(wvif, info->use_cts_prot);
@@ -892,7 +889,7 @@ void wfx_bss_info_changed(struct ieee80211_hw *hw,
		if (info->use_short_preamble)
			erp_ie[2] |= WLAN_ERP_BARKER_PREAMBLE;
		if (wvif->vif->type != NL80211_IFTYPE_STATION)
			hif_update_ie(wvif, &target_frame, erp_ie, sizeof(erp_ie));
			hif_update_ie_beacon(wvif, erp_ie, sizeof(erp_ie));
	}

	if (changed & BSS_CHANGED_ASSOC || changed & BSS_CHANGED_ERP_SLOT)
@@ -960,9 +957,6 @@ void wfx_sta_notify(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
static int wfx_set_tim_impl(struct wfx_vif *wvif, bool aid0_bit_set)
{
	struct sk_buff *skb;
	struct hif_ie_flags target_frame = {
		.beacon = 1,
	};
	u16 tim_offset, tim_length;
	u8 *tim_ptr;

@@ -987,7 +981,7 @@ static int wfx_set_tim_impl(struct wfx_vif *wvif, bool aid0_bit_set)
			tim_ptr[4] &= ~1;
	}

	hif_update_ie(wvif, &target_frame, tim_ptr, tim_length);
	hif_update_ie_beacon(wvif, tim_ptr, tim_length);
	dev_kfree_skb(skb);

	return 0;