From 97bcd562eb2687fe000ca9c71ed00e7fdbdd5bd2 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sat, 29 Oct 2011 22:25:28 +0300 Subject: [PATCH] Remove disable_11b_rates() driver_ops This function was used unconditionally if wpa_supplicant build includes CONFIG_P2P=y. Adding a separate driver_ops for such use is not really useful since the driver wrappers can do the same internally. Remove this driver_ops and move matching functionality into driver_nl80211.c which was the only driver wrapper using this driver_ops callback. Signed-hostap: Jouni Malinen --- src/drivers/driver.h | 13 ------------- src/drivers/driver_ndis.c | 1 - src/drivers/driver_nl80211.c | 21 +++++++++++---------- wpa_supplicant/driver_i.h | 9 --------- wpa_supplicant/p2p_supplicant.c | 5 ----- 5 files changed, 11 insertions(+), 38 deletions(-) diff --git a/src/drivers/driver.h b/src/drivers/driver.h index 4a9be3567..06f2db32f 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -1946,19 +1946,6 @@ struct wpa_driver_ops { */ int (*probe_req_report)(void *priv, int report); - /** - * disable_11b_rates - Set whether IEEE 802.11b rates are used for TX - * @priv: Private driver interface data - * @disabled: Whether IEEE 802.11b rates are disabled - * Returns: 0 on success, -1 on failure (or if not supported) - * - * This command is used to disable IEEE 802.11b rates (1, 2, 5.5, and - * 11 Mbps) as TX rates for data and management frames. This can be - * used to optimize channel use when there is no need to support IEEE - * 802.11b-only devices. - */ - int (*disable_11b_rates)(void *priv, int disabled); - /** * deinit_ap - Deinitialize AP mode * @priv: Private driver interface data diff --git a/src/drivers/driver_ndis.c b/src/drivers/driver_ndis.c index 7e845b93c..482567412 100644 --- a/src/drivers/driver_ndis.c +++ b/src/drivers/driver_ndis.c @@ -3288,7 +3288,6 @@ const struct wpa_driver_ops wpa_driver_ndis_ops = { NULL /* remain_on_channel */, NULL /* cancel_remain_on_channel */, NULL /* probe_req_report */, - NULL /* disable_11b_rates */, NULL /* deinit_ap */, NULL /* suspend */, NULL /* resume */, diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index be12c13df..aa437aa6b 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -2419,6 +2419,17 @@ wpa_driver_nl80211_finish_drv_init(struct wpa_driver_nl80211_data *drv) drv, drv->ctx); } +#ifdef CONFIG_P2P + if (drv->capa.flags & WPA_DRIVER_FLAGS_P2P_CAPABLE) { + /* + * FIX: Do this conditionally on the interface type to avoid + * changing non-P2P use cases. + */ + drv->disable_11b_rates = 1; + nl80211_disable_11b_rates(drv, drv->ifindex, 1); + } +#endif /* CONFIG_P2P */ + return 0; } @@ -7022,15 +7033,6 @@ nla_put_failure: } -static int wpa_driver_nl80211_disable_11b_rates(void *priv, int disabled) -{ - struct i802_bss *bss = priv; - struct wpa_driver_nl80211_data *drv = bss->drv; - drv->disable_11b_rates = disabled; - return nl80211_disable_11b_rates(drv, drv->ifindex, disabled); -} - - static int wpa_driver_nl80211_deinit_ap(void *priv) { struct i802_bss *bss = priv; @@ -7530,7 +7532,6 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = { .cancel_remain_on_channel = wpa_driver_nl80211_cancel_remain_on_channel, .probe_req_report = wpa_driver_nl80211_probe_req_report, - .disable_11b_rates = wpa_driver_nl80211_disable_11b_rates, .deinit_ap = wpa_driver_nl80211_deinit_ap, .resume = wpa_driver_nl80211_resume, .send_ft_action = nl80211_send_ft_action, diff --git a/wpa_supplicant/driver_i.h b/wpa_supplicant/driver_i.h index 0363f4dbf..b18f3fc40 100644 --- a/wpa_supplicant/driver_i.h +++ b/wpa_supplicant/driver_i.h @@ -426,15 +426,6 @@ static inline int wpa_drv_probe_req_report(struct wpa_supplicant *wpa_s, return -1; } -static inline int wpa_drv_disable_11b_rates(struct wpa_supplicant *wpa_s, - int disabled) -{ - if (wpa_s->driver->disable_11b_rates) - return wpa_s->driver->disable_11b_rates(wpa_s->drv_priv, - disabled); - return -1; -} - static inline int wpa_drv_deinit_ap(struct wpa_supplicant *wpa_s) { if (wpa_s->driver->deinit_ap) diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index 3eeb61ed6..3723c50f7 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -2134,11 +2134,6 @@ int wpas_p2p_init(struct wpa_global *global, struct wpa_supplicant *wpa_s) if (!(wpa_s->drv_flags & WPA_DRIVER_FLAGS_P2P_CAPABLE)) return 0; - if (wpa_drv_disable_11b_rates(wpa_s, 1) < 0) { - wpa_printf(MSG_DEBUG, "P2P: Failed to disable 11b rates"); - /* Continue anyway; this is not really a fatal error */ - } - if (global->p2p) return 0;