On Mon, 2011-10-10 at 21:32 +0200, Eliad Peller wrote: > On Mon, Oct 10, 2011 at 8:51 PM, Luciano Coelho <coelho@xxxxxx> wrote: > > On Mon, 2011-10-10 at 10:12 +0200, Eliad Peller wrote: > >> If there is an active AP role, stay always on. > >> Otherwise, allow chip to enter elp. > >> > >> (Note that this is a global configuration, so if the > >> device is already configured according to our policy, > >> we don't have to configure it again) > >> > >> Signed-off-by: Eliad Peller <eliad@xxxxxxxxxx> > >> --- > > > > [...] > > > >> @@ -573,13 +563,38 @@ static int wl12xx_init_ap_role(struct wl1271 *wl, struct wl12xx_vif *wlvif) > >> > >> int wl1271_init_vif_specific(struct wl1271 *wl, struct ieee80211_vif *vif) > >> { > >> - struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); > >> + struct wl12xx_vif *iter, *wlvif = wl12xx_vif_to_data(vif); > >> struct conf_tx_ac_category *conf_ac; > >> struct conf_tx_tid *conf_tid; > >> bool is_ap = (wlvif->bss_type == BSS_TYPE_AP_BSS); > >> - > >> + u8 sta_roles_cnt = 0, ap_roles_cnt = 0; > >> int ret, i; > >> > >> + wl12xx_for_each_wlvif(wl, iter) { > >> + if (iter->bss_type == BSS_TYPE_AP_BSS) > >> + ap_roles_cnt++; > >> + else > >> + sta_roles_cnt++; > >> + } > >> + > >> + /* > >> + * consider all existing roles before configuring psm. > >> + * TODO: reconfigure on interface removal. > >> + */ > >> + if (!ap_roles_cnt) { > >> + if (is_ap) { > >> + /* Configure for power always on */ > >> + ret = wl1271_acx_sleep_auth(wl, WL1271_PSM_CAM); > >> + if (ret < 0) > >> + return ret; > >> + } else if (!sta_roles_cnt) { > >> + /* Configure for ELP power saving */ > >> + ret = wl1271_acx_sleep_auth(wl, WL1271_PSM_ELP); > >> + if (ret < 0) > >> + return ret; > >> + } > >> + } > >> + > > > > Wouldn't it be much simpler to have a "have_ap" element in the wl > > struct? > > > > > have_ap is not enough, because there might be multiple aps, and we > need to consider it on removal. Right... > we can use ap_count, if you prefer it that way. Yeah, I'd still prefer that. -- Cheers, Luca. -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html