Re: [RFC 1/2] nl80211: add extended feature for BSS selection support
On 01/05/2016 05:31 PM, Johannes Berg wrote: On Tue, 2016-01-05 at 10:50 +0100, Arend van Spriel wrote: +struct cfg80211_bss_selection { +> > bool present; +> > enum nl80211_band pref_band; +> > u8 rssi_adjust; +> > bool ignore_rssi; +}; Hm. Isn't it possible to specify *some* parameters of these? Or at least, in the future (if we extend this), it would be? Seems that 'present' might want to be a bitmap or so? Or perhaps be done by using invalid values by default (e.g. NUM_BANDS for no band preference, etc.)? Ok. I was not sure how to go about this. Our firmware uses an ordered list of selection "keys" with the first being the primary selection key and so on. So there are three "key" types: band, rssi, and rssi_adjust. The latter is not really a selection key, but will do rssi adjustment for BSSes in the specified band. Ok. One of the questions I have is whether the order of a nested list attribute is retained. It is if you parse it right, but it's not typically something that we rely on and take advantage of, so I wouldn't want to do it that way. Also, I'm not really sure it'd really be what we wanted to do anyway? ok It seems though that we might need to allow for other drivers having other selection criteria, and having a validity flag for each? That could go some of the way. So do we want want a dedicated "bss selection capability" flag iso extended feature in which the driver can indicate the supported selection criteria to user-space? Guess so. To really fully replicate your firmware's capabilities seems difficult, though I also don't really see much point, or are you saying you could put "rssi" first? But the way you described it in nl80211, with "band" being a "tie breaker", it sounds like really "rssi" comes first, usually, followed by rssi_adjust and band? The firmware api is pretty flexible, but I did not want to introduce that in nl80211. So I limited it to the two use-cases I know of 1) "band, rssi", and 2) "rssi_adjust, rssi". In terms of netlink attributes I played a trick in reusing ATTR_BSS_SELECT_BAND_PREF. When ATTR_BSS_SELECT_RSSI_ADJUST is passed the ATTR_BSS_SELECT_BAND_PREF is used to determine in which band the rssi is adjusted. So "band" and "rssi_adjust" are mutual exclusive. The other way - band first - could also be done with a huge rssi_adjust though (as I said before), so I don't really see much value in having all this complexity to start with? Ok. Will elaborate. In follow-up email I raise question whether this could/should be a signed value. Any opinion on this? I didn't see that, but yeah - good question. Would it be supported by firmware? To be honest I had to check, but yes it does. But logically - does it even make sense? If you already prefer that band, why give it a boost still? Just disable RSSI? Hmm. I hope the use-cases mentioned clarify this. Regards, Arend -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] net/rfkill: Create "airplane mode" LED trigger
On Tue, 2016-01-05 at 22:55 -0800, Marcel Holtmann wrote: > > so I am not convinced the kernel should have the concept of airplane > mode at all. [snip long story] This is true, but that doesn't mean the patch is bad, just the naming could be different. I think the patch could name this "rfkill-all" (or so) instead, and replace all the "airplane_mode" identifiers as well. Then the driver can still default to "rfkill-all" trigger, or a suitably interested userspace could remove the trigger and manage the LED state itself. Then again - if I think about that more - perhaps the kernel *should* have a concept of airplane mode, just one that's not necessarily tied to the "rfkill_all" setting, but could be controlled by userspace. That way, userspace wouldn't have to know about the LED, just about the airplane mode indicator (for which rfkill would probably be an appropriate place) Two comments on the patch itself: > +#ifdef CONFIG_RFKILL_LEDS > + led_trigger_register(airplane_mode_led_trigger); > +#endif Everything else uses inlines to avoid ifdefs, you can do the same here. Also, error handling seems necessary. johannes -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Mac80211 : Wpa rekeying issue
On 05/01/16 16:50, Johannes Berg wrote: On Tue, 2016-01-05 at 11:54 +0100, Matthias May wrote: Not safe as in "access to stuff which has to be locked", or not safe as in "a CCMP replay attack is possible"? When changing this we argumented that since we are not really connected yet, a CCMP replay attack doesn't really make sense. It's a bit more complicated than my first look suggested, it seems. However, I'm not sure what effect your patch is supposed to have. You're skipping CCMP replay checking and update when not authorized yet, at which point the station isn't receiving frames anyway (though they'd be checked for all this, they'd later be discarded). Once it becomes authorized, you do the checks. However, it never becomes unauthorized again, even for rekeying, so for the PTK rekeying issue at hand it's pretty much a no-op? afaik it solves the issue that when a STA roames from AP1 to AP2, and key material is installed at different times. We observed encrypted frames which had a wrong CCMP counter. If the STA updates it's counter with these frames then depending on the wrong CCMP value received, up to a few hundred frames were dropped. Not exactly the same as rekeying but the effect are pretty similar. johannes PS: the comment in your patch is also wrong: + /* If we are a station update the ccmp counter only when we are +* authorised. For all other modes always update. */ + if (!rx->sta || + (rx->sta && test_sta_flag(rx->sta, WLAN_STA_AUTHORIZED)) ) { There's no check for "if we are a station" here. Yeah this doesn't make sense. Also the check on !rx-sta seems superfluous since it's already checked a few lines above. Regards Matthias -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 1/2] mac80211: check requested flags in ieee80211_tx_prepare_skb()
On Tue, 2016-01-05 at 11:35 +0100, Janusz Dziedzic wrote: > In case driver already set info->flags (eg. > IEEE80211_TX_CTL_NO_CCK_RATE > in ath9k driver), before this patch we skip this requested flags. I don't see how we "skip" them? > + unsigned int flags = info->flags; > > if (ieee80211_tx_prepare(sdata, , NULL, skb) == TX_DROP) > return false; > > info->band = band; > info->control.vif = vif; > info->hw_queue = vif->hw_queue[skb_get_queue_mapping(skb)]; > + info->flags |= flags; tx_prepare() doesn't [seem to] do anything to the flags but twiddle a few, so ? johannes -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC 1/2] nl80211: add extended feature for BSS selection support
On Wed, 2016-01-06 at 11:16 +0100, Arend van Spriel wrote: > So do we want want a dedicated "bss selection capability" flag iso > extended feature in which the driver can indicate the supported > selection criteria to user-space? Guess so. Frankly, I'm not really quite sure. The alternative is to just treat all of this as advisory and not worry, so that userspace can specify all it wants and the driver will use all it can. That seems mostly reasonable as well. > I played a trick in reusing ATTR_BSS_SELECT_BAND_PREF. When > ATTR_BSS_SELECT_RSSI_ADJUST is passed the ATTR_BSS_SELECT_BAND_PREF > is > used to determine in which band the rssi is adjusted. So "band" and > "rssi_adjust" are mutual exclusive. Yeah, OK, I think that might have confused me a bit :) > > But logically - does it even make sense? If you already prefer that > > band, why give it a boost still? Just disable RSSI? Hmm. > > I hope the use-cases mentioned clarify this. > Right. So realistically, writing this a bit more verbosely, you have 1) rssi_preference, band_preference(band) 2) rssi_adjust(band, delta), rssi_preference and perhaps 3) rssi_preference as the default? As for 1), you said it was "band, rssi" but it seems you really meant the other way around since before you said "band" was a tie-breaker. Perhaps then, the API should just expose the two "primitives" * band_preference(band) * rssi_adjust(band, delta)? johannes -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] staging: wilc1000: Removed unnecessary braces
Removed unnecessary braces for single statement blocks to fix the warning detected by checkpatch.pl WARNING: braces {} are not necessary for single statement blocks Signed-off-by: Anjali Menon--- drivers/staging/wilc1000/wilc_wlan_cfg.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c b/drivers/staging/wilc1000/wilc_wlan_cfg.c index a34a81c..afb5d2c 100644 --- a/drivers/staging/wilc1000/wilc_wlan_cfg.c +++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c @@ -251,9 +251,8 @@ static int wilc_wlan_cfg_set_bin(u8 *frame, u32 offset, u16 id, u8 *b, u32 size) if ((b != NULL) && (size != 0)) { memcpy([4], b, size); - for (i = 0; i < size; i++) { + for (i = 0; i < size; i++) checksum += buf[i + 4]; - } } buf[size + 4] = checksum; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] staging: wilc1000: Removed unnecessary braces
On Wed, 2016-01-06 at 18:59 +0530, Anjali Menon wrote: > Removed unnecessary braces for single statement blocks to > fix the warning detected by checkpatch.pl > > WARNING: braces {} are not necessary for single statement blocks > > Signed-off-by: Anjali Menon> --- > drivers/staging/wilc1000/wilc_wlan_cfg.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c > b/drivers/staging/wilc1000/wilc_wlan_cfg.c > index a34a81c..afb5d2c 100644 > --- a/drivers/staging/wilc1000/wilc_wlan_cfg.c > +++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c > @@ -251,9 +251,8 @@ static int wilc_wlan_cfg_set_bin(u8 *frame, u32 offset, > u16 id, u8 *b, u32 size) > > if ((b != NULL) && (size != 0)) { > memcpy([4], b, size); > - for (i = 0; i < size; i++) { > + for (i = 0; i < size; i++) > checksum += buf[i + 4]; > - } > } > > buf[size + 4] = checksum; Please think of what the code is doing instead of just shutting up checkpatch. Maybe instead of walking the buffer twice, once for the memcpy, another for the checksum, perhaps using a routine to do both at the same time would be better. Maybe something like: if (b && size) { u32 count = size; u8 *to = [4]; while (count--) checksum += (*to++ = *b++); } -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC HACK][PATCH] brcmfmac: provide country found in NVRAM as regulatory hint
NVRAM may contain info about device country. Example from SR40ac (US): wl_country_code=US wl0_country_code=US wl1_country_code=US or Netgear R8000 (Canada): wl0_country_code=CA wl1_country_code=CA wl2_country_code=CA Read it when parsing NVRAM and provide to regulatory. Signed-off-by: Rafał Miłecki--- This is HACKy code, do not apply! Hi, I wanted to post this suggestion for improving brcmfmac. It's bothering OpenWrt users that have to set country manually. This code is ugly. I think done callback is getting too complex and I don't like the way of referencing wiphy in pcie.c. But it gives a basic idea and I'd like to see if there will be any comments. --- .../broadcom/brcm80211/brcmfmac/cfg80211.h | 3 ++ .../broadcom/brcm80211/brcmfmac/firmware.c | 53 ++ .../broadcom/brcm80211/brcmfmac/firmware.h | 6 ++- .../wireless/broadcom/brcm80211/brcmfmac/pcie.c| 16 ++- .../wireless/broadcom/brcm80211/brcmfmac/sdio.c| 3 +- .../net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 3 +- 6 files changed, 59 insertions(+), 25 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h index c17b6d5..cb96f68 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h @@ -20,6 +20,9 @@ /* for brcmu_d11inf */ #include +#include "fwil_types.h" +#include "p2p.h" + #define WL_NUM_SCAN_MAX10 #define WL_TLV_INFO_MAX1024 #define WL_BSS_INFO_MAX2048 diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c index 1e4d5f6..6692ef1 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c @@ -32,6 +32,19 @@ static char brcmf_firmware_path[BRCMF_FW_NAME_LEN]; module_param_string(alternative_fw_path, brcmf_firmware_path, BRCMF_FW_NAME_LEN, 0440); +struct brcmf_fw { + struct device *dev; + u16 flags; + const struct firmware *code; + const char *nvram_name; + u16 domain_nr; + u16 bus_nr; + char alpha2[2]; + void (*done)(struct device *dev, const struct firmware *fw, +void *nvram_image, u32 nvram_len, const char *alpha2); + struct completion *completion; +}; + enum nvram_parser_state { IDLE, KEY, @@ -65,6 +78,7 @@ struct nvram_parser { u32 entry; bool multi_dev_v1; bool multi_dev_v2; + char alpha2[2]; }; /** @@ -127,6 +141,11 @@ static enum nvram_parser_state brcmf_nvram_handle_key(struct nvram_parser *nvp) nvp->multi_dev_v1 = true; if (strncmp(>data[nvp->entry], "pcie/", 5) == 0) nvp->multi_dev_v2 = true; + /* TODO: Use wl%d_country_code */ + if (!strncmp(>data[nvp->entry], "wl0_country_code", 16)) { + nvp->alpha2[0] = nvp->data[nvp->pos + 1]; + nvp->alpha2[1] = nvp->data[nvp->pos + 2]; + } } else if (!is_nvram_char(c) || c == ' ') { brcmf_dbg(INFO, "warning: ln=%d:col=%d: '=' expected, skip invalid key entry\n", nvp->line, nvp->column); @@ -364,7 +383,7 @@ fail: * End of buffer is completed with token identifying length of buffer. */ static void *brcmf_fw_nvram_strip(const u8 *data, size_t data_len, - u32 *new_length, u16 domain_nr, u16 bus_nr) + u32 *new_length, struct brcmf_fw *fwctx) { struct nvram_parser nvp; u32 pad; @@ -380,9 +399,14 @@ static void *brcmf_fw_nvram_strip(const u8 *data, size_t data_len, break; } if (nvp.multi_dev_v1) - brcmf_fw_strip_multi_v1(, domain_nr, bus_nr); + brcmf_fw_strip_multi_v1(, fwctx->domain_nr, fwctx->bus_nr); else if (nvp.multi_dev_v2) - brcmf_fw_strip_multi_v2(, domain_nr, bus_nr); + brcmf_fw_strip_multi_v2(, fwctx->domain_nr, fwctx->bus_nr); + + if (nvp.alpha2[0]) { + fwctx->alpha2[0] = nvp.alpha2[0]; + fwctx->alpha2[1] = nvp.alpha2[1]; + } if (nvp.nvram_len == 0) { kfree(nvp.nvram); @@ -411,17 +435,6 @@ void brcmf_fw_nvram_free(void *nvram) kfree(nvram); } -struct brcmf_fw { - struct device *dev; - u16 flags; - const struct firmware *code; - const char *nvram_name; - u16 domain_nr; - u16 bus_nr; - void (*done)(struct device *dev, const struct firmware *fw, -void *nvram_image, u32 nvram_len); -}; - static void brcmf_fw_request_nvram_done(const
[PATCH] iwlwifi: Document missing module options
This patch documents two missing module options in the internal code comment block. Signed-off-by: Rodrigo Freire--- drivers/net/wireless/iwlwifi/iwl-modparams.h |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/drivers/net/wireless/iwlwifi/iwl-modparams.h b/drivers/net/wireless/iwlwifi/iwl-modparams.h index ac2b90d..1477277 100644 --- a/drivers/net/wireless/iwlwifi/iwl-modparams.h +++ b/drivers/net/wireless/iwlwifi/iwl-modparams.h @@ -102,6 +102,8 @@ enum iwl_disable_11n { * @power_level: power level, default = 1 * @debug_level: levels are IWL_DL_* * @ant_coupling: antenna coupling in dB, default = 0 + * @nvm_file: specifies a external NVM file + * @uapsd_disable: disable U-APSD, default = 1 * @d0i3_disable: disable d0i3, default = 1, * @lar_disable: disable LAR (regulatory), default = 0 * @fw_monitor: allow to use firmware monitor -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 1/3] mwifiex: firmware download enhancements
From: chunfan chenSame chip is being used by WLAN as well as bluetooth drivers. Each driver needs to check during initialisation if firmware is already active or it needs to be freshly downloaded. If one driver has started downloading the firmware, other finds the winner flag as false. mwifiex_check_fw_status() checks firmware status and also check if WLAN is the winner for firmware downloading. Once we detect that other interface is downloading the firmware, we call this routine again with max poll count to wait until firmware is ready. This patch splits the routine to avoid checking winner status unnecessarily multiple times and ensures that correct messages are displayed to user. Firmware status poll count is also increased to 150. Signed-off-by: Chunfan Chen Signed-off-by: Amitkumar Karwar --- v2: Correct the patch title and explain winner, loser and other interface concept --- drivers/net/wireless/marvell/mwifiex/fw.h | 2 +- drivers/net/wireless/marvell/mwifiex/init.c | 16 +--- drivers/net/wireless/marvell/mwifiex/main.h | 1 + drivers/net/wireless/marvell/mwifiex/pcie.c | 40 + drivers/net/wireless/marvell/mwifiex/sdio.c | 33 ++-- 5 files changed, 57 insertions(+), 35 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/fw.h b/drivers/net/wireless/marvell/mwifiex/fw.h index ced7af2..426e76a 100644 --- a/drivers/net/wireless/marvell/mwifiex/fw.h +++ b/drivers/net/wireless/marvell/mwifiex/fw.h @@ -96,7 +96,7 @@ enum KEY_TYPE_ID { #define WAPI_KEY_LEN (WLAN_KEY_LEN_SMS4 + PN_LEN + 2) #define MAX_POLL_TRIES 100 -#define MAX_FIRMWARE_POLL_TRIES100 +#define MAX_FIRMWARE_POLL_TRIES150 #define FIRMWARE_READY_SDIO0xfedc #define FIRMWARE_READY_PCIE0xfedcba00 diff --git a/drivers/net/wireless/marvell/mwifiex/init.c b/drivers/net/wireless/marvell/mwifiex/init.c index 6f7876e..517653b 100644 --- a/drivers/net/wireless/marvell/mwifiex/init.c +++ b/drivers/net/wireless/marvell/mwifiex/init.c @@ -741,8 +741,6 @@ int mwifiex_dnld_fw(struct mwifiex_adapter *adapter, u32 poll_num = 1; if (adapter->if_ops.check_fw_status) { - adapter->winner = 0; - /* check if firmware is already running */ ret = adapter->if_ops.check_fw_status(adapter, poll_num); if (!ret) { @@ -750,13 +748,23 @@ int mwifiex_dnld_fw(struct mwifiex_adapter *adapter, "WLAN FW already running! Skip FW dnld\n"); return 0; } + } + + /* check if we are the winner for downloading FW */ + if (adapter->if_ops.check_winner_status) { + adapter->winner = 0; + ret = adapter->if_ops.check_winner_status(adapter); poll_num = MAX_FIRMWARE_POLL_TRIES; + if (ret) { + mwifiex_dbg(adapter, MSG, + "WLAN read winner status failed!\n"); + return ret; + } - /* check if we are the winner for downloading FW */ if (!adapter->winner) { mwifiex_dbg(adapter, MSG, - "FW already running! Skip FW dnld\n"); + "WLAN is not the winner! Skip FW dnld\n"); goto poll_fw; } } diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h index 2f7f478..c08be79 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.h +++ b/drivers/net/wireless/marvell/mwifiex/main.h @@ -791,6 +791,7 @@ struct mwifiex_if_ops { int (*init_if) (struct mwifiex_adapter *); void (*cleanup_if) (struct mwifiex_adapter *); int (*check_fw_status) (struct mwifiex_adapter *, u32); + int (*check_winner_status)(struct mwifiex_adapter *); int (*prog_fw) (struct mwifiex_adapter *, struct mwifiex_fw_image *); int (*register_dev) (struct mwifiex_adapter *); void (*unregister_dev) (struct mwifiex_adapter *); diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c index 9703848..4000357 100644 --- a/drivers/net/wireless/marvell/mwifiex/pcie.c +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c @@ -2007,14 +2007,12 @@ done: /* * This function checks the firmware status in card. - * - * The winner interface is also determined by this function. */ static int mwifiex_check_fw_status(struct mwifiex_adapter *adapter, u32 poll_num) { int ret = 0; - u32 firmware_stat, winner_status; + u32 firmware_stat; struct pcie_service_card *card = adapter->card; const struct
[PATCH v2 2/3] mwifiex: fix IBSS data path issue.
From: chunfan chenThe port_open flag is not applicable for IBSS mode. IBSS data path was broken when port_open flag was introduced. This patch fixes the problem by correcting the checks. Fixes: 5c8946330abfa4c ("mwifiex: enable traffic only when port is open") Signed-off-by: chunfan chen Signed-off-by: Amitkumar Karwar --- drivers/net/wireless/marvell/mwifiex/sta_event.c | 10 ++ drivers/net/wireless/marvell/mwifiex/wmm.c | 6 -- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/sta_event.c b/drivers/net/wireless/marvell/mwifiex/sta_event.c index ff3ee9d..23bae87 100644 --- a/drivers/net/wireless/marvell/mwifiex/sta_event.c +++ b/drivers/net/wireless/marvell/mwifiex/sta_event.c @@ -607,11 +607,13 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv) case EVENT_PS_AWAKE: mwifiex_dbg(adapter, EVENT, "info: EVENT: AWAKE\n"); - if (!adapter->pps_uapsd_mode && priv->port_open && + if (!adapter->pps_uapsd_mode && + (priv->port_open || +(priv->bss_mode == NL80211_IFTYPE_ADHOC)) && priv->media_connected && adapter->sleep_period.period) { - adapter->pps_uapsd_mode = true; - mwifiex_dbg(adapter, EVENT, - "event: PPS/UAPSD mode activated\n"); + adapter->pps_uapsd_mode = true; + mwifiex_dbg(adapter, EVENT, + "event: PPS/UAPSD mode activated\n"); } adapter->tx_lock_flag = false; if (adapter->pps_uapsd_mode && adapter->gen_null_pkt) { diff --git a/drivers/net/wireless/marvell/mwifiex/wmm.c b/drivers/net/wireless/marvell/mwifiex/wmm.c index acccd67..499e5a7 100644 --- a/drivers/net/wireless/marvell/mwifiex/wmm.c +++ b/drivers/net/wireless/marvell/mwifiex/wmm.c @@ -475,7 +475,8 @@ mwifiex_wmm_lists_empty(struct mwifiex_adapter *adapter) priv = adapter->priv[i]; if (!priv) continue; - if (!priv->port_open) + if (!priv->port_open && + (priv->bss_mode != NL80211_IFTYPE_ADHOC)) continue; if (adapter->if_ops.is_port_ready && !adapter->if_ops.is_port_ready(priv)) @@ -1099,7 +1100,8 @@ mwifiex_wmm_get_highest_priolist_ptr(struct mwifiex_adapter *adapter, priv_tmp = adapter->bss_prio_tbl[j].bss_prio_cur->priv; - if (!priv_tmp->port_open || + if (((priv_tmp->bss_mode != NL80211_IFTYPE_ADHOC) && +!priv_tmp->port_open) || (atomic_read(_tmp->wmm.tx_pkts_queued) == 0)) continue; -- 1.8.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 3/3] mwifiex: add debugfs file to read chip information
From: Xinming HuThis patch add 'verext' debugfs item, which can be used to get detailed chip specific information from our firmware. Examples: echo "1" > /sys/kernel/debug/mwifiex/mlan0/verext cat /sys/kernel/debug/mwifiex/mlan0/verext Signed-off-by: Shengzhen Li Signed-off-by: Amitkumar Karwar --- drivers/net/wireless/marvell/mwifiex/README | 10 + drivers/net/wireless/marvell/mwifiex/debugfs.c | 51 +++- drivers/net/wireless/marvell/mwifiex/main.h | 3 +- drivers/net/wireless/marvell/mwifiex/sta_ioctl.c | 3 +- 4 files changed, 63 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/README b/drivers/net/wireless/marvell/mwifiex/README index 2f0f9b5..24e649b 100644 --- a/drivers/net/wireless/marvell/mwifiex/README +++ b/drivers/net/wireless/marvell/mwifiex/README @@ -237,4 +237,14 @@ device_dump cat fw_dump +verext + This command is used to get extended firmware version string using + different configuration parameters. + + Usage: + echo "[version_str_sel]" > verext + cat verext + + [version_str_sel]: firmware support several extend version + string cases, include 0/1/10/20/21/99 === diff --git a/drivers/net/wireless/marvell/mwifiex/debugfs.c b/drivers/net/wireless/marvell/mwifiex/debugfs.c index 5e55629..13fe384 100644 --- a/drivers/net/wireless/marvell/mwifiex/debugfs.c +++ b/drivers/net/wireless/marvell/mwifiex/debugfs.c @@ -95,8 +95,7 @@ mwifiex_info_read(struct file *file, char __user *ubuf, mwifiex_drv_get_driver_version(priv->adapter, fmt, sizeof(fmt) - 1); - if (!priv->version_str[0]) - mwifiex_get_ver_ext(priv); + mwifiex_get_ver_ext(priv, 0); p += sprintf(p, "driver_name = " "\"mwifiex\"\n"); p += sprintf(p, "driver_version = %s", fmt); @@ -596,6 +595,52 @@ done: return ret; } +/* debugfs verext file write handler. + * This function is called when the 'verext' file is opened for write + */ +static ssize_t +mwifiex_verext_write(struct file *file, const char __user *ubuf, +size_t count, loff_t *ppos) +{ + int ret; + u32 versionstrsel; + struct mwifiex_private *priv = (void *)file->private_data; + char buf[16]; + + memset(buf, 0, sizeof(buf)); + + if (copy_from_user(, ubuf, min_t(size_t, sizeof(buf) - 1, count))) + return -EFAULT; + + ret = kstrtou32(buf, 10, ); + if (ret) + return ret; + + priv->versionstrsel = versionstrsel; + + return count; +} + +/* Proc verext file read handler. + * This function is called when the 'verext' file is opened for reading + * This function can be used read driver exteneed verion string. + */ +static ssize_t +mwifiex_verext_read(struct file *file, char __user *ubuf, + size_t count, loff_t *ppos) +{ + struct mwifiex_private *priv = + (struct mwifiex_private *)file->private_data; + char buf[256]; + int ret; + + mwifiex_get_ver_ext(priv, priv->versionstrsel); + ret = snprintf(buf, sizeof(buf), "version string: %s\n", + priv->version_str); + + return simple_read_from_buffer(ubuf, count, ppos, buf, ret); +} + /* Proc memrw file write handler. * This function is called when the 'memrw' file is opened for writing * This function can be used to write to a memory location. @@ -972,6 +1017,7 @@ MWIFIEX_DFS_FILE_OPS(histogram); MWIFIEX_DFS_FILE_OPS(debug_mask); MWIFIEX_DFS_FILE_OPS(timeshare_coex); MWIFIEX_DFS_FILE_WRITE_OPS(reset); +MWIFIEX_DFS_FILE_OPS(verext); /* * This function creates the debug FS directory structure and the files. @@ -1000,6 +1046,7 @@ mwifiex_dev_debugfs_init(struct mwifiex_private *priv) MWIFIEX_DFS_ADD_FILE(debug_mask); MWIFIEX_DFS_ADD_FILE(timeshare_coex); MWIFIEX_DFS_ADD_FILE(reset); + MWIFIEX_DFS_ADD_FILE(verext); } /* diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h index c08be79..35ab052 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.h +++ b/drivers/net/wireless/marvell/mwifiex/main.h @@ -616,6 +616,7 @@ struct mwifiex_private { spinlock_t curr_bcn_buf_lock; struct wireless_dev wdev; struct mwifiex_chan_freq_power cfp; + u32 versionstrsel; char version_str[128]; #ifdef CONFIG_DEBUG_FS struct dentry *dfs_dev_dir; @@ -1418,7 +1419,7 @@ int mwifiex_set_encode(struct mwifiex_private *priv, struct key_params *kp, int mwifiex_set_gen_ie(struct mwifiex_private *priv, const u8 *ie, int ie_len); -int mwifiex_get_ver_ext(struct mwifiex_private *priv); +int mwifiex_get_ver_ext(struct mwifiex_private *priv, u32 version_str_sel);
[PATCH 6/6] wireless:libertas: fix suspend problems
When the device goes to suspend mode with powersaving enabled, lbs_remove_card tries to exit powersaving state even when already woken up. That command is not processed properly in that situation, so the system hangs at suspend, so disable it. Signed-off-by: Andreas Kemnade--- drivers/net/wireless/libertas/main.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 8079560..b35b8bc 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -1060,7 +1060,12 @@ void lbs_remove_card(struct lbs_private *priv) if (priv->psmode == LBS802_11POWERMODEMAX_PSP) { priv->psmode = LBS802_11POWERMODECAM; - lbs_set_ps_mode(priv, PS_MODE_ACTION_EXIT_PS, true); + /* no need to wakeup if already woken up, +* on suspend, this exit ps command is not processed +* the driver hangs +*/ + if (priv->psstate != PS_STATE_FULL_POWER) + lbs_set_ps_mode(priv, PS_MODE_ACTION_EXIT_PS, true); } if (priv->is_deep_sleep) { -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 0/6] wireless:libertas: ieee80211 powersave mode
This series makes IEEE 80211 powersave mode work again so that power usage is dramatically reduced when the device is connected. It does not include other power saving methods which are working when the device is not connected (like enabling deep sleep modus) Tested on GTA04 which includes a W2CBW003 chip (Marvel 8686) with sdio interface [PATCH 1/6] wireless:libertas: do not strip header for PS_MODE [PATCH 2/6] wireless:libertas: check whether bus can do more than [PATCH 3/6] wireless:libertas: add an cfg80211 interface for [PATCH 4/6] wireless:libertas: do not confirm sleep if commands are [PATCH 5/6] wireless:libertas: go back to ps mode without commands [PATCH 6/6] wireless:libertas: fix suspend problems -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/6] wireless:libertas: add an cfg80211 interface for powersaving
This patch adds an interface for handling commands like iwconfig wlanX power on/off. Such an interface formerly existed when the driver used wext. While performance with sdio in polling mode without using powersave mode is quite bad, powersaving mode is unusable, so do not enable it under such conditions. Signed-off-by: Andreas Kemnade--- drivers/net/wireless/libertas/cfg.c | 38 + 1 file changed, 38 insertions(+) diff --git a/drivers/net/wireless/libertas/cfg.c b/drivers/net/wireless/libertas/cfg.c index 8317afd..fd18d03 100644 --- a/drivers/net/wireless/libertas/cfg.c +++ b/drivers/net/wireless/libertas/cfg.c @@ -2038,6 +2038,43 @@ static int lbs_leave_ibss(struct wiphy *wiphy, struct net_device *dev) +int lbs_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, + bool enabled, int timeout) +{ + struct lbs_private *priv = wiphy_priv(wiphy); + + if (!(priv->fwcapinfo & FW_CAPINFO_PS)) { + if (!enabled) + return 0; + else + return -EINVAL; + } + /* firmware does not work well with too long latency with power saving +* enabled, so do not enable it if there is only polling, no +* interrupts (like in some sdio hosts which can only +* poll for sdio irqs) +*/ + if (priv->is_polling) { + if (!enabled) + return 0; + else + return -EINVAL; + } + if (!enabled) { + priv->psmode = LBS802_11POWERMODECAM; + if (priv->psstate != PS_STATE_FULL_POWER) + lbs_set_ps_mode(priv, + PS_MODE_ACTION_EXIT_PS, + true); + return 0; + } + if (priv->psmode != LBS802_11POWERMODECAM) + return 0; + priv->psmode = LBS802_11POWERMODEMAX_PSP; + if (priv->connect_status == LBS_CONNECTED) + lbs_set_ps_mode(priv, PS_MODE_ACTION_ENTER_PS, true); + return 0; +} /* * Initialization @@ -2056,6 +2093,7 @@ static struct cfg80211_ops lbs_cfg80211_ops = { .change_virtual_intf = lbs_change_intf, .join_ibss = lbs_join_ibss, .leave_ibss = lbs_leave_ibss, + .set_power_mgmt = lbs_set_power_mgmt, }; -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4/6] wireless:libertas: do not confirm sleep if commands are pending
If the main thread gets one PS AWAKE event and one PS SLEEP event in one iteration over event_fifo there will never be checks for commands to be processed, since psstate will always be PS_STATE_SLEEP or PS_STATE_PRE_SLEEP Signed-off-by: Andreas Kemnade--- drivers/net/wireless/libertas/cmdresp.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index 701125f..c95bf6d 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c @@ -257,6 +257,10 @@ int lbs_process_event(struct lbs_private *priv, u32 event) "EVENT: in FULL POWER mode, ignoring PS_SLEEP\n"); break; } + if (!list_empty(>cmdpendingq)) { + lbs_deb_cmd("EVENT: commands in queue, do not sleep\n"); + break; + } priv->psstate = PS_STATE_PRE_SLEEP; lbs_ps_confirm_sleep(priv); -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 5/6] wireless:libertas: go back to ps mode without commands pending
Removes the old todo block and checks only whether ieee powersave mode is requested. We still have to check for being connected as this powersave mode includes logic for regularly waking up and checking for packets which only makes sense when connected. For not being connected, another mode is needed. Signed-off-by: Andreas Kemnade--- drivers/net/wireless/libertas/cmd.c | 36 +--- 1 file changed, 5 insertions(+), 31 deletions(-) diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 40467d6..4ddd0e5 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -1428,40 +1428,14 @@ int lbs_execute_next_command(struct lbs_private *priv) * check if in power save mode, if yes, put the device back * to PS mode */ -#ifdef TODO - /* -* This was the old code for libertas+wext. Someone that -* understands this beast should re-code it in a sane way. -* -* I actually don't understand why this is related to WPA -* and to connection status, shouldn't powering should be -* independ of such things? -*/ if ((priv->psmode != LBS802_11POWERMODECAM) && (priv->psstate == PS_STATE_FULL_POWER) && - ((priv->connect_status == LBS_CONNECTED) || - lbs_mesh_connected(priv))) { - if (priv->secinfo.WPAenabled || - priv->secinfo.WPA2enabled) { - /* check for valid WPA group keys */ - if (priv->wpa_mcast_key.len || - priv->wpa_unicast_key.len) { - lbs_deb_host( - "EXEC_NEXT_CMD: WPA enabled and GTK_SET" - " go back to PS_SLEEP"); - lbs_set_ps_mode(priv, - PS_MODE_ACTION_ENTER_PS, - false); - } - } else { - lbs_deb_host( - "EXEC_NEXT_CMD: cmdpendingq empty, " - "go back to PS_SLEEP"); - lbs_set_ps_mode(priv, PS_MODE_ACTION_ENTER_PS, - false); - } + (priv->connect_status == LBS_CONNECTED)) { + lbs_deb_host( + "EXEC_NEXT_CMD: cmdpendingq empty, go back to PS_SLEEP"); + lbs_set_ps_mode(priv, PS_MODE_ACTION_ENTER_PS, + false); } -#endif } ret = 0; -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/6] wireless:libertas: do not strip header for PS_MODE commands
struct cmd_ds_802_11_ps_mode contains the command header and a pointer to it was initialized with data points to the body which leads to mis-interpretation of the cmd_ds_802_11_ps_mode.action member. Signed-off-by: Andreas Kemnade--- drivers/net/wireless/libertas/cmd.c | 4 ++-- drivers/net/wireless/libertas/cmdresp.c | 5 - 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 0387a5b..40467d6 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c @@ -957,7 +957,7 @@ static void lbs_queue_cmd(struct lbs_private *priv, /* Exit_PS command needs to be queued in the header always. */ if (le16_to_cpu(cmdnode->cmdbuf->command) == CMD_802_11_PS_MODE) { - struct cmd_ds_802_11_ps_mode *psm = (void *) >cmdbuf; + struct cmd_ds_802_11_ps_mode *psm = (void *)cmdnode->cmdbuf; if (psm->action == cpu_to_le16(PS_MODE_ACTION_EXIT_PS)) { if (priv->psstate != PS_STATE_FULL_POWER) @@ -1387,7 +1387,7 @@ int lbs_execute_next_command(struct lbs_private *priv) * PS command. Ignore it if it is not Exit_PS. * otherwise send it down immediately. */ - struct cmd_ds_802_11_ps_mode *psm = (void *)[1]; + struct cmd_ds_802_11_ps_mode *psm = (void *)cmd; lbs_deb_host( "EXEC_NEXT_CMD: PS cmd, action 0x%02x\n", diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index e5442e8..701125f 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c @@ -123,7 +123,10 @@ int lbs_process_command_response(struct lbs_private *priv, u8 *data, u32 len) priv->cmd_timed_out = 0; if (respcmd == CMD_RET(CMD_802_11_PS_MODE)) { - struct cmd_ds_802_11_ps_mode *psmode = (void *) [1]; + /* struct cmd_ds_802_11_ps_mode also contains +* the header +*/ + struct cmd_ds_802_11_ps_mode *psmode = (void *)resp; u16 action = le16_to_cpu(psmode->action); lbs_deb_host( -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html