[PATCH 14/15] wpa_supplicant: Re-order measurement report sending
Andrei Otcheretianski
andrei.otcheretianski at intel.com
Wed Dec 28 05:06:46 PST 2016
From: Avraham Stern <avraham.stern at intel.com>
Move wpas_rrm_send_msr_report() and wpas_rrm_send_msr_report_mpdu()
upper in rrm.c file so they can be used to send the measurement report
in case the measurement request is rejected.
This will be used in the next patch.
Signed-off-by: Avrahams Stern <avraham.stern at intel.com>
---
wpa_supplicant/rrm.c | 97 ++++++++++++++++++++++++++--------------------------
1 file changed, 49 insertions(+), 48 deletions(-)
diff --git a/wpa_supplicant/rrm.c b/wpa_supplicant/rrm.c
index 3f35ace..69f7df9 100644
--- a/wpa_supplicant/rrm.c
+++ b/wpa_supplicant/rrm.c
@@ -373,6 +373,55 @@ reject:
}
+static void wpas_rrm_send_msr_report_mpdu(struct wpa_supplicant *wpa_s,
+ const u8 *data, size_t len)
+{
+ struct wpabuf *report = wpabuf_alloc(len + 3);
+
+ if (!report)
+ return;
+
+ wpabuf_put_u8(report, WLAN_ACTION_RADIO_MEASUREMENT);
+ wpabuf_put_u8(report, WLAN_RRM_RADIO_MEASUREMENT_REPORT);
+ wpabuf_put_u8(report, wpa_s->rrm.token);
+
+ wpabuf_put_data(report, data, len);
+
+ if (wpa_drv_send_action(wpa_s, wpa_s->assoc_freq, 0, wpa_s->bssid,
+ wpa_s->own_addr, wpa_s->bssid,
+ wpabuf_head(report), wpabuf_len(report), 0)) {
+ wpa_printf(MSG_ERROR,
+ "RRM: Radio measurement report failed. Send action failed");
+ }
+
+ wpabuf_free(report);
+}
+
+
+static void wpas_rrm_send_msr_report(struct wpa_supplicant *wpa_s,
+ struct wpabuf *buf)
+{
+ int len = wpabuf_len(buf);
+ const u8 *pos = wpabuf_head_u8(buf), *next = pos;
+
+#define MPDU_REPORT_LEN (int)(IEEE80211_MAX_MMPDU_SIZE - IEEE80211_HDRLEN - 3)
+
+ while (len) {
+ int send_len = (len > MPDU_REPORT_LEN) ? next - pos : len;
+
+ if (send_len == len ||
+ (send_len + next[1] + 2) > MPDU_REPORT_LEN) {
+ wpas_rrm_send_msr_report_mpdu(wpa_s, pos, send_len);
+ len -= send_len;
+ pos = next;
+ }
+
+ next += next[1] + 2;
+ }
+#undef MPDU_REPORT_LEN
+}
+
+
static int
wpas_rrm_handle_msr_req_element(struct wpa_supplicant *wpa_s,
struct rrm_measurement_request_element *req,
@@ -473,54 +522,6 @@ out:
}
-static void wpas_rrm_send_msr_report_mpdu(struct wpa_supplicant *wpa_s,
- const u8 *data, size_t len)
-{
- struct wpabuf *report = wpabuf_alloc(len + 3);
-
- if (!report)
- return;
-
- wpabuf_put_u8(report, WLAN_ACTION_RADIO_MEASUREMENT);
- wpabuf_put_u8(report, WLAN_RRM_RADIO_MEASUREMENT_REPORT);
- wpabuf_put_u8(report, wpa_s->rrm.token);
-
- wpabuf_put_data(report, data, len);
-
- if (wpa_drv_send_action(wpa_s, wpa_s->assoc_freq, 0, wpa_s->bssid,
- wpa_s->own_addr, wpa_s->bssid,
- wpabuf_head(report), wpabuf_len(report), 0)) {
- wpa_printf(MSG_ERROR,
- "RRM: Radio measurement report failed. Send action failed");
- }
-
- wpabuf_free(report);
-}
-
-static void wpas_rrm_send_msr_report(struct wpa_supplicant *wpa_s,
- struct wpabuf *buf)
-{
- int len = wpabuf_len(buf);
- const u8 *pos = wpabuf_head_u8(buf), *next = pos;
-
-#define MPDU_REPORT_LEN (int)(IEEE80211_MAX_MMPDU_SIZE - IEEE80211_HDRLEN - 3)
-
- while (len) {
- int send_len = (len > MPDU_REPORT_LEN) ? next - pos : len;
-
- if (send_len == len ||
- (send_len + next[1] + 2) > MPDU_REPORT_LEN) {
- wpas_rrm_send_msr_report_mpdu(wpa_s, pos, send_len);
- len -= send_len;
- pos = next;
- }
-
- next += next[1] + 2;
- }
-#undef MPDU_REPORT_LEN
-}
-
-
void wpas_rrm_handle_radio_measurement_request(struct wpa_supplicant *wpa_s,
const u8 *src,
const u8 *frame, size_t len)
--
1.9.1
More information about the Hostap
mailing list