From patchwork Thu Nov 10 10:08:17 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Retreive shared frequency when a singly "phy" is shared between multiple interfaces Date: Thu, 10 Nov 2011 00:08:17 -0000 From: Jithu Jance X-Patchwork-Id: 124837 Message-Id: <6C370B347C3FE8438C9692873287D2E119560C6B04@SJEXCHCCR01.corp.ad.broadcom.com> To: "Johannes Berg" Cc: "hostap@lists.shmoo.com" Hi Johannes, Thanks for your reply. Please correct me, if my understanding is wrong. I am talking about a concurrent scenario where we have a legacy STA on wlan0 interface(primary MAC address) already in connected state. Then we are starting an Autonomous GO by issuing p2p_group_add on wlan1(p2p_device_address) interface. In wpas_p2p_init_go_params, I could see that the wpa_supplicant invokes wpa_drv_shared_freq to get the shared freq. Since this handler wasn't present, I implemented it to retrieve the freq. Without the below patch, the p2p_group_add was always resulting in a GO on freq 2412. Freq 2412 would be set when there is no known preference as per "wpas_p2p_init_go_params" function. Did I miss something?? Sorry for the whitespace issue. I am attaching the corrected patch below. Signed-hostap: Jithu Jance --- src/drivers/driver_nl80211.c | 37 +++++++++++++++++++++++++++++++++++++ 1 files changed, 37 insertions(+), 0 deletions(-) diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 2ab10ae..e5077e0 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -269,6 +269,7 @@ static int nl80211_send_frame_cmd(struct wpa_driver_nl80211_data *drv, const u8 *buf, size_t buf_len, u64 *cookie, int no_cck); static int wpa_driver_nl80211_probe_req_report(void *priv, int report); +static int wpa_driver_nl80211_shared_freq(void *priv); #ifdef HOSTAPD static void add_ifidx(struct wpa_driver_nl80211_data *drv, int ifidx); @@ -7231,6 +7232,41 @@ static int nl80211_signal_poll(void *priv, struct wpa_signal_info *si) return nl80211_get_link_noise(drv, si); } +static int wpa_driver_nl80211_shared_freq(void *priv) +{ + struct i802_bss *bss = priv; + struct wpa_driver_nl80211_data *drv = bss->drv; + struct nl80211_global *global = drv->global; + struct wpa_driver_nl80211_data *driver = NULL; + int freq = 0; + + /* If the same phy is in connected state with some other interface, + * then retrieve the assoc freq */ + wpa_printf(MSG_DEBUG, "nl80211: get shared freq for PHY(%s)", drv->phyname); + + dl_list_for_each(driver, &global->interfaces, + struct wpa_driver_nl80211_data, list) { + + /* skip, if its the same instance */ + if(drv == driver) + continue; + + if(os_strcmp(drv->phyname, driver->phyname) == 0) { + if(driver->associated) { + wpa_printf(MSG_DEBUG, "nl80211: Found a match for (%s) " + "with macaddr("MACSTR") associated to %s ", + driver->phyname, MAC2STR(driver->addr), driver->ssid); + freq = nl80211_get_assoc_freq(driver); + wpa_printf(MSG_DEBUG, "nl80211: shared freq for PHY(%s):%d ", drv->phyname, freq); + } + } + } + + if(!freq) + wpa_printf(MSG_DEBUG, "nl80211: No shared Interface for PHY(%s)", drv->phyname); + + return freq; +} static int nl80211_send_frame(void *priv, const u8 *data, size_t data_len, int encrypt) @@ -7612,6 +7648,7 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = { .signal_monitor = nl80211_signal_monitor, .signal_poll = nl80211_signal_poll, .send_frame = nl80211_send_frame, + .shared_freq = wpa_driver_nl80211_shared_freq, .set_param = nl80211_set_param, .get_radio_name = nl80211_get_radio_name, .add_pmkid = nl80211_add_pmkid,