]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Add more debug prints for frequency selection
authorJouni Malinen <jouni@qca.qualcomm.com>
Tue, 5 Nov 2013 09:07:51 +0000 (11:07 +0200)
committerJouni Malinen <j@w1.fi>
Tue, 5 Nov 2013 09:07:51 +0000 (11:07 +0200)
This prints out get_shared_radio_freqs() results and related information
from P2P operations to make debug logs more helpful for figuring out
issues related to multi-channel concurrency.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

wpa_supplicant/p2p_supplicant.c
wpa_supplicant/wpa_supplicant.c
wpa_supplicant/wpa_supplicant_i.h

index 25bf4e7e7ee54301a3255ff5d3648b05f9ac351a..226acd691fdb3c93f858ec7610bbd52686751d2c 100644 (file)
@@ -124,7 +124,7 @@ static int wpas_p2p_stop_find_oper(struct wpa_supplicant *wpa_s);
 static int wpas_p2p_num_unused_channels(struct wpa_supplicant *wpa_s)
 {
        int *freqs;
-       int num;
+       int num, unused;
 
        freqs = os_calloc(wpa_s->num_multichan_concurrent, sizeof(int));
        if (!freqs)
@@ -134,7 +134,9 @@ static int wpas_p2p_num_unused_channels(struct wpa_supplicant *wpa_s)
                                     wpa_s->num_multichan_concurrent);
        os_free(freqs);
 
-       return wpa_s->num_multichan_concurrent - num;
+       unused = wpa_s->num_multichan_concurrent - num;
+       wpa_dbg(wpa_s, MSG_DEBUG, "P2P: num_unused_channels: %d", unused);
+       return unused;
 }
 
 
@@ -164,6 +166,8 @@ static int wpas_p2p_valid_oper_freqs(struct wpa_supplicant *wpa_s,
 
        os_free(freqs);
 
+       dump_freq_array(wpa_s, "valid for P2P", p2p_freqs, j);
+
        return j;
 }
 
index c058a6e736f14359e36c6cd9b071c4c7c756fba5..4388ad6b586761bbdfd48439d4aed80e4e1b6bd9 100644 (file)
@@ -4009,6 +4009,18 @@ int wpas_wpa_is_in_progress(struct wpa_supplicant *wpa_s, int include_current)
 }
 
 
+void dump_freq_array(struct wpa_supplicant *wpa_s, const char *title,
+                    int *freq_array, unsigned int len)
+{
+       unsigned int i;
+
+       wpa_dbg(wpa_s, MSG_DEBUG, "Shared frequencies (len=%u): %s",
+               len, title);
+       for (i = 0; i < len; i++)
+               wpa_dbg(wpa_s, MSG_DEBUG, "freq[%u]: %d", i, freq_array[i]);
+}
+
+
 /*
  * Find the operating frequencies of any of the virtual interfaces that
  * are using the same radio as the current interface.
@@ -4022,6 +4034,8 @@ int get_shared_radio_freqs(struct wpa_supplicant *wpa_s,
        int freq;
        unsigned int idx = 0, i;
 
+       wpa_dbg(wpa_s, MSG_DEBUG,
+               "Determining shared radio frequencies (max len %u)", len);
        os_memset(freq_array, 0, sizeof(int) * len);
 
        /* First add the frequency of the local interface */
@@ -4039,12 +4053,16 @@ int get_shared_radio_freqs(struct wpa_supplicant *wpa_s,
                if (freq > 0 && idx < len &&
                    (idx == 0 || freq_array[0] != freq))
                        freq_array[idx++] = freq;
+               dump_freq_array(wpa_s, "No get_radio_name", freq_array, idx);
                return idx;
        }
 
        rn = wpa_s->driver->get_radio_name(wpa_s->drv_priv);
-       if (rn == NULL || rn[0] == '\0')
+       if (rn == NULL || rn[0] == '\0') {
+               dump_freq_array(wpa_s, "get_radio_name failed",
+                               freq_array, idx);
                return idx;
+       }
 
        for (ifs = wpa_s->global->ifaces; ifs && idx < len;
             ifs = ifs->next) {
@@ -4074,5 +4092,7 @@ int get_shared_radio_freqs(struct wpa_supplicant *wpa_s,
                if (i == idx)
                        freq_array[idx++] = freq;
        }
+
+       dump_freq_array(wpa_s, "completed iteration", freq_array, idx);
        return idx;
 }
index da536cb2020b6bc9074ec222beeb6f9371634e1d..eed1053ad95f477baa9871a4850bcd16be362539 100644 (file)
@@ -863,6 +863,8 @@ int wpas_network_disabled(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid);
 
 int wpas_init_ext_pw(struct wpa_supplicant *wpa_s);
 
+void dump_freq_array(struct wpa_supplicant *wpa_s, const char *title,
+                    int *freq_array, unsigned int len);
 int get_shared_radio_freqs(struct wpa_supplicant *wpa_s,
                           int *freq_array, unsigned int len);