libertas: finish conversion to direct command architecture
cover libertas: finish conversion to direct command architecture
This series finishes conversion of all firmware commands to direct commands instead of using the indirect (and I'd argue less clear) model that the original vendor driver used. This was the last barrier to scale before we can begin cleaning up the command submission structure to be less convoluted and more reliable. It's a net code loss too which makes many kittens and puppies happy.
Please apply to wireless-testing. Note that wireless-testing is somewhat broken as a result of the cfg80211 patches, but this series should make that easier to fix up.
Dan Williams (16):
libertas: clean up MONITOR_MODE command
libertas: clean up RSSI command
libertas: convert 11D_DOMAIN_INFO to a direct command
libertas: remove unused indirect TPC_CFG command leftovers
libertas: remove unused Automatic Frequency Control command
libertas: remove Beacon Control
libertas: convert LED_GPIO_CTRL to a direct command
libertas: convert register access to direct commands
libertas: convert Mesh Blinding Table access to a direct command
libertas: convert CMD_FWT_ACCESS to a direct command
libertas: remove unused indirect command response handler
libertas: convert PS_MODE to a direct command
libertas: convert DEEP_SLEEP timer to a direct command
libertas: kill unused lbs_prepare_and_send_command()
libertas: rename lbs_get_cmd_ctrl_node() to lbs_get_free_cmd_node()
libertas: remove unused cmd_pending waitq
drivers/net/wireless/libertas/cfg.c | 197 +-------- drivers/net/wireless/libertas/cfg.h | 6 - drivers/net/wireless/libertas/cmd.c | 718 +++++++++++++------------------ drivers/net/wireless/libertas/cmd.h | 25 +- drivers/net/wireless/libertas/cmdresp.c | 179 +-------- drivers/net/wireless/libertas/debugfs.c | 67 +--- drivers/net/wireless/libertas/decl.h | 5 - drivers/net/wireless/libertas/defs.h | 18 - drivers/net/wireless/libertas/dev.h | 6 - drivers/net/wireless/libertas/host.h | 142 +++---- drivers/net/wireless/libertas/if_usb.c | 4 +- drivers/net/wireless/libertas/main.c | 33 +- drivers/net/wireless/libertas/mesh.c | 216 ++++++++-- drivers/net/wireless/libertas/mesh.h | 14 +- 14 files changed, 613 insertions(+), 1017 deletions(-)
PATCH 1/16 libertas: clean up MONITOR_MODE command
Convert to a full direct command; previous code rolled a direct command by handle but left the original indirect command code lying around.
--- drivers/net/wireless/libertas/cfg.c | 57 ++-------------------------------- drivers/net/wireless/libertas/cmd.c | 42 +++++++++++++++---------- drivers/net/wireless/libertas/cmd.h | 2 + drivers/net/wireless/libertas/host.h | 4 ++- 4 files changed, 33 insertions(+), 72 deletions(-)
drivers/net/wireless/libertas/cfg.c +3 -54
@@ -7,7 +7,6 @@*/ #include <linux/slab.h> -#include <linux/if_arp.h> #include <linux/ieee80211.h> #include <net/cfg80211.h> #include <asm/unaligned.h>
@@ -1383,56 +1382,6 @@ static int lbs_cfg_del_key(struct wiphy *wiphy, struct net_device *netdev, } - -/*************************************************************************** -* Monitor mode -*/ - -/* like "struct cmd_ds_802_11_monitor_mode", but with cmd_header. Once we -* get rid of WEXT, this should go into host.h */ -struct cmd_monitor_mode { -struct cmd_header hdr; - -__le16 action; -__le16 mode; -} __packed; - -static int lbs_enable_monitor_mode (struct lbs_private *priv,int mode) -{ -struct cmd_monitor_mode cmd; -int ret; - -lbs_deb_enter (LBS_DEB_CFG80211 ); - -/* -* cmd 98 00 -* size 0c 00 -* sequence xx xx -* result 00 00 -* action 01 00 ACT_SET -* enable 01 00 -*/ -memset (&cmd,0 ,sizeof (cmd)); - cmd.hdr.size =cpu_to_le16 (sizeof (cmd)); - cmd.action =cpu_to_le16 (CMD_ACT_SET ); - cmd.mode =cpu_to_le16 (mode); - - ret =lbs_cmd_with_response (priv,CMD_802_11_MONITOR_MODE , &cmd); - -if (ret ==0 ) - priv->dev->type =ARPHRD_IEEE80211_RADIOTAP ; -else - priv->dev->type =ARPHRD_ETHER ; - -lbs_deb_leave (LBS_DEB_CFG80211 ); -return ret; -} - - - - - -/*************************************************************************** * Get station */
@@ -1558,17 +1507,17 @@ static int lbs_change_intf(struct wiphy *wiphy, struct net_device *dev,switch (type) {case NL80211_IFTYPE_MONITOR : - ret =lbs_enable_monitor_mode (priv,1 ); + ret =lbs_set_monitor_mode (priv,1 );break ;case NL80211_IFTYPE_STATION :if (priv->wdev->iftype ==NL80211_IFTYPE_MONITOR ) - ret =lbs_enable_monitor_mode (priv,0 ); + ret =lbs_set_monitor_mode (priv,0 );if (!ret) ret =lbs_set_snmp_mib (priv,SNMP_MIB_OID_BSS_TYPE ,1 );break ;case NL80211_IFTYPE_ADHOC :if (priv->wdev->iftype ==NL80211_IFTYPE_MONITOR ) - ret =lbs_enable_monitor_mode (priv,0 ); + ret =lbs_set_monitor_mode (priv,0 );if (!ret) ret =lbs_set_snmp_mib (priv,SNMP_MIB_OID_BSS_TYPE ,2 );break ;
drivers/net/wireless/libertas/cmd.c +25 -17
65 lines not on this page · raw message
drivers/net/wireless/libertas/cmd.h +2 -0
@@ -129,4 +129,6 @@ int lbs_set_deep_sleep(struct lbs_private *priv, int deep_sleep);int lbs_set_host_sleep (struct lbs_private *priv,int host_sleep); +int lbs_set_monitor_mode (struct lbs_private *priv,int enable); +#endif /* _LBS_CMD_H */
drivers/net/wireless/libertas/host.h +3 -1
@@ -675,7 +675,10 @@ struct cmd_ds_802_11_rf_tx_power {s8 minlevel; } __attribute__ ((packed)); +/* MONITOR_MODE only exists in OLPC v5 firmware */ struct cmd_ds_802_11_monitor_mode { +struct cmd_header hdr; +__le16 action;__le16 mode; } __attribute__ ((packed));
@@ -966,7 +969,6 @@ struct cmd_ds_command {/* command Body */ union {struct cmd_ds_802_11_ps_mode psmode; -struct cmd_ds_802_11_monitor_mode monitor;struct cmd_ds_802_11_rssi rssi;struct cmd_ds_802_11_rssi_rsp rssirsp;struct cmd_ds_mac_reg_access macreg;
Signature · 1 line
1.7.1.1
PATCH 2/16 libertas: clean up RSSI command
In reply to Dan WilliamsConvert to a full direct command; previous code rolled a direct command by hand but left the original indirect command code intact but disabled.
--- drivers/net/wireless/libertas/cfg.c | 37 +--------------------------- drivers/net/wireless/libertas/cfg.h | 2 - drivers/net/wireless/libertas/cmd.c | 39 +++++++++++++++++++++++++++--- drivers/net/wireless/libertas/cmd.h | 2 + drivers/net/wireless/libertas/cmdresp.c | 4 --- drivers/net/wireless/libertas/defs.h | 13 ---------- drivers/net/wireless/libertas/host.h | 24 ++++++++---------- drivers/net/wireless/libertas/main.c | 7 +---- 8 files changed, 51 insertions(+), 77 deletions(-)
drivers/net/wireless/libertas/cfg.c +2 -35
@@ -1386,39 +1386,6 @@ static int lbs_cfg_del_key(struct wiphy *wiphy, struct net_device *netdev,* Get station */ -/* -* Returns the signal or 0 in case of an error. -*/ - -/* like "struct cmd_ds_802_11_rssi", but with cmd_header. Once we get rid -* of WEXT, this should go into host.h */ -struct cmd_rssi { -struct cmd_header hdr; - -__le16 n_or_snr; -__le16 nf; -__le16 avg_snr; -__le16 avg_nf; -} __packed; - -static int lbs_get_signal (struct lbs_private *priv,s8 *signal,s8 *noise) -{ -struct cmd_rssi cmd; -int ret; - - cmd.hdr.size =cpu_to_le16 (sizeof (cmd)); - cmd.n_or_snr =cpu_to_le16 (DEFAULT_BCN_AVG_FACTOR ); - ret =lbs_cmd_with_response (priv,CMD_802_11_RSSI , &cmd); - -if (ret ==0 ) { - *signal =CAL_RSSI (le16_to_cpu (cmd.n_or_snr), -le16_to_cpu (cmd.nf)); - *noise =CAL_NF (le16_to_cpu (cmd.nf)); - } -return ret; -} - -static int lbs_cfg_get_station (struct wiphy *wiphy,struct net_device *dev,u8 *mac,struct station_info *sinfo) {
@@ -1439,7 +1406,7 @@ static int lbs_cfg_get_station(struct wiphy *wiphy, struct net_device *dev, sinfo->rx_packets = priv->dev->stats.rx_packets;/* Get current RSSI */ - ret =lbs_get_signal (priv, &signal, &noise); + ret =lbs_get_rssi (priv, &signal, &noise);if (ret ==0 ) { sinfo->signal = signal; sinfo->filled |=STATION_INFO_SIGNAL ;
@@ -1479,7 +1446,7 @@ static int lbs_get_survey(struct wiphy *wiphy, struct net_device *dev, survey->channel =ieee80211_get_channel (wiphy,ieee80211_channel_to_frequency (priv->channel)); - ret =lbs_get_signal (priv, &signal, &noise); + ret =lbs_get_rssi (priv, &signal, &noise);if (ret ==0 ) { survey->filled =SURVEY_INFO_NOISE_DBM ; survey->noise = noise;
drivers/net/wireless/libertas/cfg.h +0 -2
@@ -14,8 +14,6 @@ int lbs_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request);/* All of those are TODOs: */ -#define lbs_cmd_802_11_rssi (priv, cmdptr) (0) -#define lbs_ret_802_11_rssi (priv, resp) (0)#define lbs_cmd_bcn_ctrl (priv, cmdptr, cmd_action) (0)#define lbs_ret_802_11_bcn_ctrl (priv, resp) (0)
drivers/net/wireless/libertas/cmd.c +35 -4
@@ -12,6 +12,8 @@#include "cfg.h" #include "cmd.h" +#define CAL_NF (nf) ((s32)(-(s32)(nf))) +#define CAL_RSSI (snr, nf) ((s32)((s32)(snr) + CAL_NF(nf)))static struct cmd_ctrl_node *lbs_get_cmd_ctrl_node (struct lbs_private *priv);
@@ -690,6 +692,39 @@ out:return ret; } +/** +* @brief Get current RSSI and noise floor +* +* @param priv A pointer to struct lbs_private structure +* @param rssi On successful return, signal level in mBm +* +* @return The channel on success, error on failure +*/ +int lbs_get_rssi (struct lbs_private *priv,s8 *rssi,s8 *nf) +{ +struct cmd_ds_802_11_rssi cmd; +int ret =0 ; + +lbs_deb_enter (LBS_DEB_CMD ); + +BUG_ON (rssi ==NULL ); +BUG_ON (nf ==NULL ); + +memset (&cmd,0 ,sizeof (cmd)); + cmd.hdr.size =cpu_to_le16 (sizeof (cmd)); +/* Average SNR over last 8 beacons */ + cmd.n_or_snr =cpu_to_le16 (8 ); + + ret =lbs_cmd_with_response (priv,CMD_802_11_RSSI , &cmd); +if (ret ==0 ) { + *nf =CAL_NF (le16_to_cpu (cmd.nf)); + *rssi =CAL_RSSI (le16_to_cpu (cmd.n_or_snr),le16_to_cpu (cmd.nf)); + } + +lbs_deb_leave_args (LBS_DEB_CMD ,"ret %d" , ret); +return ret; +} +static int lbs_cmd_reg_access (struct cmd_ds_command *cmdptr,u8 cmd_action,void *pdata_buf) {
@@ -1106,10 +1141,6 @@ int lbs_prepare_and_send_command(struct lbs_private *priv, ret =lbs_cmd_reg_access (cmdptr, cmd_action, pdata_buf);break ; -case CMD_802_11_RSSI : - ret =lbs_cmd_802_11_rssi (priv, cmdptr); -break ; -case CMD_802_11_SET_AFC :case CMD_802_11_GET_AFC :
drivers/net/wireless/libertas/cmd.h +2 -0
@@ -131,4 +131,6 @@ int lbs_set_host_sleep(struct lbs_private *priv, int host_sleep);int lbs_set_monitor_mode (struct lbs_private *priv,int enable); +int lbs_get_rssi (struct lbs_private *priv,s8 *snr,s8 *nf); +#endif /* _LBS_CMD_H */
drivers/net/wireless/libertas/cmdresp.c +0 -4
@@ -172,10 +172,6 @@ static inline int handle_cmd_response(struct lbs_private *priv,case CMD_RET (CMD_802_11_BEACON_STOP ):break ; -case CMD_RET (CMD_802_11_RSSI ): - ret =lbs_ret_802_11_rssi (priv, resp); -break ; -case CMD_RET (CMD_802_11D_DOMAIN_INFO ): ret =lbs_ret_802_11d_domain_info (resp);break ;
drivers/net/wireless/libertas/defs.h +0 -13
@@ -301,19 +301,6 @@ static inline void lbs_deb_hex(unsigned int grp, const char *prompt, u8 *buf, in#define BAND_G (0x02)#define ALL_802_11_BANDS (BAND_B | BAND_G) -/** MACRO DEFINITIONS */ -#define CAL_NF (NF ) ((s32)(-(s32)(NF))) -#define CAL_RSSI (SNR ,NF ) ((s32)((s32)(SNR) + CAL_NF(NF))) -#define SCAN_RSSI (RSSI ) (0x100 - ((u8)(RSSI))) - -#define DEFAULT_BCN_AVG_FACTOR 8 -#define DEFAULT_DATA_AVG_FACTOR 8 -#define AVG_SCALE 100 -#define CAL_AVG_SNR_NF (AVG ,SNRNF ,N ) \ - (((AVG) == 0) ? ((u16)(SNRNF) * AVG_SCALE) : \ - ((((int)(AVG) * (N -1)) + ((u16)(SNRNF) * \ - AVG_SCALE)) / N)) -#define MAX_RATES 14#define MAX_LEDS 8
drivers/net/wireless/libertas/host.h +11 -13
@@ -644,19 +644,19 @@ struct cmd_ds_802_11_rf_channel { } __attribute__ ((packed));struct cmd_ds_802_11_rssi { -/* weighting factor */ -__le16 N; +struct cmd_header hdr; -__le16 reserved_0; -__le16 reserved_1; -__le16 reserved_2; -} __attribute__ ((packed)); +/* request: number of beacons (N) to average the SNR and NF over +* response: SNR of most recent beacon +*/ +__le16 n_or_snr; -struct cmd_ds_802_11_rssi_rsp { -__le16 SNR; -__le16 noisefloor; -__le16 avgSNR; -__le16 avgnoisefloor; +/* The following fields are only set in the response. +* In the request these are reserved and should be set to 0. +*/ +__le16 nf;/* most recent beacon noise floor */ +__le16 avg_snr;/* average SNR weighted by N from request */ +__le16 avg_nf;/* average noise floor weighted by N from request */ } __attribute__ ((packed));struct cmd_ds_802_11_mac_address {
@@ -969,8 +969,6 @@ struct cmd_ds_command {/* command Body */ union {struct cmd_ds_802_11_ps_mode psmode; -struct cmd_ds_802_11_rssi rssi; -struct cmd_ds_802_11_rssi_rsp rssirsp;struct cmd_ds_mac_reg_access macreg;struct cmd_ds_bbp_reg_access bbpreg;struct cmd_ds_rf_reg_access rfreg;
drivers/net/wireless/libertas/main.c +1 -6
@@ -157,12 +157,7 @@ static void lbs_tx_timeout(struct net_device *dev)to kick it somehow? */ lbs_host_to_card_done (priv); -/* More often than not, this actually happens because the -firmware has crapped itself -- rather than just a very -busy medium. So send a harmless command, and if/when -_that_ times out, we'll kick it in the head. */ -lbs_prepare_and_send_command (priv,CMD_802_11_RSSI ,0 , -0 ,0 ,NULL ); +/* FIXME: reset the card */ lbs_deb_leave (LBS_DEB_TX ); }
Signature · 1 line
1.7.1.1
PATCH 3/16 libertas: convert 11D_DOMAIN_INFO to a direct command
In reply to Dan Williams--- drivers/net/wireless/libertas/cfg.c | 103 +---------------- drivers/net/wireless/libertas/cmd.c | 188 ++++++++++++++++++++----------- drivers/net/wireless/libertas/cmd.h | 6 + drivers/net/wireless/libertas/cmdresp.c | 51 --------- drivers/net/wireless/libertas/decl.h | 5 - drivers/net/wireless/libertas/dev.h | 3 - drivers/net/wireless/libertas/host.h | 21 +--- 7 files changed, 139 insertions(+), 238 deletions(-)
drivers/net/wireless/libertas/cfg.c +5 -98
@@ -1979,113 +1979,20 @@ int lbs_cfg_register(struct lbs_private *priv)return ret; } -/** -* @brief This function sets DOMAIN INFO to FW -* @param priv pointer to struct lbs_private -* @return 0; -1 -*/ -static int lbs_11d_set_domain_info (struct lbs_private *priv) -{ -int ret; - - ret =lbs_prepare_and_send_command (priv,CMD_802_11D_DOMAIN_INFO , -CMD_ACT_SET , -CMD_OPTION_WAITFORRSP ,0 ,NULL ); -if (ret) -lbs_deb_11d ("fail to dnld domain info\n" ); - -return ret; -} - -static void lbs_send_domain_info_cmd_fw (struct wiphy *wiphy, -struct regulatory_request *request) -{ -u8 no_of_triplet =0 ; -u8 no_of_parsed_chan =0 ; -u8 first_channel =0 , next_chan =0 , max_pwr =0 ; -u8 i, flag =0 ; -enum ieee80211_band band; -struct ieee80211_supported_band *sband; -struct ieee80211_channel *ch; -struct lbs_private *priv =wiphy_priv (wiphy); -struct lbs_802_11d_domain_reg *domain_info = &priv->domain_reg; -int ret =0 ; - -lbs_deb_enter (LBS_DEB_CFG80211 ); - -/* Set country code */ - domain_info->country_code[0 ] = request->alpha2[0 ]; - domain_info->country_code[1 ] = request->alpha2[1 ]; - domain_info->country_code[2 ] =' ' ; - -for (band =0 ; band <IEEE80211_NUM_BANDS ; band++) { - -if (!wiphy->bands[band]) -continue ; - - sband = wiphy->bands[band]; - -for (i =0 ; i < sband->n_channels ; i++) { - ch = &sband->channels[i]; -if (ch->flags &IEEE80211_CHAN_DISABLED ) -continue ; - -if (!flag) { - flag =1 ; - next_chan = first_channel = (u32 ) ch->hw_value; - max_pwr = ch->max_power; - no_of_parsed_chan =1 ; -continue ; - } - -if (ch->hw_value == next_chan +1 && - ch->max_power == max_pwr) { - next_chan++; - no_of_parsed_chan++; - }else { - domain_info->triplet[no_of_triplet] - .chans.first_channel = first_channel; - domain_info->triplet[no_of_triplet] - .chans.num_channels = no_of_parsed_chan; - domain_info->triplet[no_of_triplet] - .chans.max_power = max_pwr; - no_of_triplet++; - flag =0 ; - } - } -if (flag) { - domain_info->triplet[no_of_triplet] - .chans.first_channel = first_channel; - domain_info->triplet[no_of_triplet] - .chans.num_channels = no_of_parsed_chan; - domain_info->triplet[no_of_triplet] - .chans.max_power = max_pwr; - no_of_triplet++; - } - } - - domain_info->no_triplet = no_of_triplet; - -/* Set domain info */ - ret =lbs_11d_set_domain_info (priv); -if (ret) -lbs_pr_err ("11D: error setting domain info in FW\n" ); - -lbs_deb_leave (LBS_DEB_CFG80211 ); -} -int lbs_reg_notifier (struct wiphy *wiphy,struct regulatory_request *request) { +struct lbs_private *priv =wiphy_priv (wiphy); +int ret; +lbs_deb_enter_args (LBS_DEB_CFG80211 ,"cfg80211 regulatory domain " "callback for domain %c%c\n" , request->alpha2[0 ], request->alpha2[1 ]); -lbs_send_domain_info_cmd_fw (wiphy, request); + ret =lbs_set_11d_domain_info (priv, request, wiphy->bands);lbs_deb_leave (LBS_DEB_CFG80211 ); - -return 0 ; +return ret; }void lbs_scan_deinit (struct lbs_private *priv)
drivers/net/wireless/libertas/cmd.c +123 -65
206 lines not on this page · raw message
drivers/net/wireless/libertas/cmd.h +6 -0
@@ -3,6 +3,8 @@#ifndef _LBS_CMD_H_#define _LBS_CMD_H_ +#include <net/cfg80211.h> +#include "host.h" #include "dev.h"
@@ -133,4 +135,8 @@ int lbs_set_monitor_mode(struct lbs_private *priv, int enable);int lbs_get_rssi (struct lbs_private *priv,s8 *snr,s8 *nf); +int lbs_set_11d_domain_info (struct lbs_private *priv, +struct regulatory_request *request, +struct ieee80211_supported_band **bands); +#endif /* _LBS_CMD_H */
drivers/net/wireless/libertas/cmdresp.c +0 -51
63 lines not on this page · raw message
drivers/net/wireless/libertas/decl.h +0 -5
@@ -53,9 +53,4 @@ int lbs_exit_auto_deep_sleep(struct lbs_private *priv);u32 lbs_fw_index_to_data_rate (u8 index);u8 lbs_data_rate_to_fw_index (u32 rate); -int lbs_cmd_802_11d_domain_info (struct lbs_private *priv, -struct cmd_ds_command *cmd,u16 cmdoption); - -int lbs_ret_802_11d_domain_info (struct cmd_ds_command *resp); -#endif
drivers/net/wireless/libertas/dev.h +0 -3
@@ -60,9 +60,6 @@ struct lbs_private {struct dentry *regs_dir;struct dentry *debugfs_regs_files[6 ]; -/** 11D and domain regulatory data */ -struct lbs_802_11d_domain_reg domain_reg; -/* Hardware debugging */ u32 mac_offset;u32 bbp_offset;
drivers/net/wireless/libertas/host.h +5 -16
@@ -389,30 +389,22 @@ struct lbs_offset_value {u32 value; } __attribute__ ((packed)); -#define MRVDRV_MAX_TRIPLET_802_11D 83 - -#define COUNTRY_CODE_LEN 3 +#define MAX_11D_TRIPLETS 83struct mrvl_ie_domain_param_set {struct mrvl_ie_header header; -u8 countrycode[COUNTRY_CODE_LEN ]; -struct ieee80211_country_ie_triplet triplet[1 ]; +u8 country_code[3 ]; +struct ieee80211_country_ie_triplet triplet[MAX_11D_TRIPLETS ]; } __packed;struct cmd_ds_802_11d_domain_info { +struct cmd_header hdr; +__le16 action;struct mrvl_ie_domain_param_set domain; } __packed; -struct lbs_802_11d_domain_reg { -/** Country code*/ -u8 country_code[COUNTRY_CODE_LEN ]; -/** No. of triplet*/ -u8 no_triplet; -struct ieee80211_country_ie_triplet triplet[MRVDRV_MAX_TRIPLET_802_11D ]; -} __packed; -/* * Define data structure for CMD_GET_HW_SPEC * This structure defines the response for the GET_HW_SPEC command
@@ -973,9 +965,6 @@ struct cmd_ds_command {struct cmd_ds_bbp_reg_access bbpreg;struct cmd_ds_rf_reg_access rfreg; -struct cmd_ds_802_11d_domain_info domaininfo; -struct cmd_ds_802_11d_domain_info domaininforesp; -struct cmd_ds_802_11_tpc_cfg tpccfg;struct cmd_ds_802_11_afc afc;struct cmd_ds_802_11_led_ctrl ledgpio;
Signature · 1 line
1.7.1.1
PATCH 4/16 libertas: remove unused indirect TPC_CFG command leftovers
In reply to Dan WilliamsThese were no longer used but were left around; Transmit Power Control is done through the lbs_set_tpc_cfg() function.
--- drivers/net/wireless/libertas/cmd.c | 12 ------------ drivers/net/wireless/libertas/cmdresp.c | 7 ------- drivers/net/wireless/libertas/host.h | 1 - 3 files changed, 0 insertions(+), 20 deletions(-)
drivers/net/wireless/libertas/cmd.c +0 -12
@@ -1217,18 +1217,6 @@ int lbs_prepare_and_send_command(struct lbs_private *priv, ret =0 ; goto done; -case CMD_802_11_TPC_CFG : - cmdptr->command =cpu_to_le16 (CMD_802_11_TPC_CFG ); - cmdptr->size = -cpu_to_le16 (sizeof (struct cmd_ds_802_11_tpc_cfg ) + -sizeof (struct cmd_header )); - -memmove (&cmdptr->params.tpccfg, - pdata_buf,sizeof (struct cmd_ds_802_11_tpc_cfg )); - - ret =0 ; -break ; -#ifdef CONFIG_LIBERTAS_MESH case CMD_BT_ACCESS :
drivers/net/wireless/libertas/cmdresp.c +0 -7
@@ -125,13 +125,6 @@ static inline int handle_cmd_response(struct lbs_private *priv,case CMD_RET (CMD_802_11_BEACON_STOP ):break ; -case CMD_RET (CMD_802_11_TPC_CFG ): -spin_lock_irqsave (&priv->driver_lock, flags); -memmove ((void *)priv->cur_cmd->callback_arg, &resp->params.tpccfg, -sizeof (struct cmd_ds_802_11_tpc_cfg )); -spin_unlock_irqrestore (&priv->driver_lock, flags); -break ; -case CMD_RET (CMD_BT_ACCESS ):spin_lock_irqsave (&priv->driver_lock, flags);if (priv->cur_cmd->callback_arg)
drivers/net/wireless/libertas/host.h +0 -1
@@ -965,7 +965,6 @@ struct cmd_ds_command {struct cmd_ds_bbp_reg_access bbpreg;struct cmd_ds_rf_reg_access rfreg; -struct cmd_ds_802_11_tpc_cfg tpccfg;struct cmd_ds_802_11_afc afc;struct cmd_ds_802_11_led_ctrl ledgpio;
Signature · 1 line
1.7.1.1
PATCH 5/16 libertas: remove unused Automatic Frequency Control command
In reply to Dan WilliamsIt hasn't been hooked up to anything in a long time and it's not even listed in any of the firmware documentation I have (and I have v5.1, v8, v9, and v10).
--- drivers/net/wireless/libertas/cmd.c | 13 ------------- drivers/net/wireless/libertas/cmdresp.c | 9 --------- drivers/net/wireless/libertas/host.h | 4 +++- 3 files changed, 3 insertions(+), 23 deletions(-)
drivers/net/wireless/libertas/cmd.c +0 -13
@@ -1204,19 +1204,6 @@ int lbs_prepare_and_send_command(struct lbs_private *priv, ret =lbs_cmd_reg_access (cmdptr, cmd_action, pdata_buf);break ; -case CMD_802_11_SET_AFC : -case CMD_802_11_GET_AFC : - - cmdptr->command =cpu_to_le16 (cmd_no); - cmdptr->size =cpu_to_le16 (sizeof (struct cmd_ds_802_11_afc ) + -sizeof (struct cmd_header )); - -memmove (&cmdptr->params.afc, - pdata_buf,sizeof (struct cmd_ds_802_11_afc )); - - ret =0 ; - goto done; -#ifdef CONFIG_LIBERTAS_MESH case CMD_BT_ACCESS :
drivers/net/wireless/libertas/cmdresp.c +0 -9
@@ -113,15 +113,6 @@ static inline int handle_cmd_response(struct lbs_private *priv, ret =lbs_ret_reg_access (priv, respcmd, resp);break ; -case CMD_RET (CMD_802_11_SET_AFC ): -case CMD_RET (CMD_802_11_GET_AFC ): -spin_lock_irqsave (&priv->driver_lock, flags); -memmove ((void *)priv->cur_cmd->callback_arg, &resp->params.afc, -sizeof (struct cmd_ds_802_11_afc )); -spin_unlock_irqrestore (&priv->driver_lock, flags); - -break ; -case CMD_RET (CMD_802_11_BEACON_STOP ):break ;
drivers/net/wireless/libertas/host.h +3 -1
@@ -882,7 +882,10 @@ struct cmd_ds_802_11_led_ctrl {u8 data[256 ]; } __attribute__ ((packed)); +/* Automatic Frequency Control */ struct cmd_ds_802_11_afc { + struct cmd_header hdr; + __le16 afc_auto; union { struct {
@@ -965,7 +968,6 @@ struct cmd_ds_command {struct cmd_ds_bbp_reg_access bbpreg;struct cmd_ds_rf_reg_access rfreg; -struct cmd_ds_802_11_afc afc;struct cmd_ds_802_11_led_ctrl ledgpio;struct cmd_ds_bt_access bt;
Signature · 1 line
1.7.1.1
PATCH 6/16 libertas: remove Beacon Control
In reply to Dan WilliamsFor now; it's a pretty easy command to hook up and whenever OLPC figures out how they want the userspace interface to look (ie, not iwpriv commands) we can easily add it back in. Since the cfg80211 conversion it wasn't working anyway.
--- drivers/net/wireless/libertas/cfg.h | 4 ---- drivers/net/wireless/libertas/cmd.c | 3 --- drivers/net/wireless/libertas/cmdresp.c | 3 --- drivers/net/wireless/libertas/host.h | 3 ++- 4 files changed, 2 insertions(+), 11 deletions(-)
drivers/net/wireless/libertas/cfg.h +0 -4
@@ -13,10 +13,6 @@ void lbs_cfg_free(struct lbs_private *priv);int lbs_reg_notifier (struct wiphy *wiphy,struct regulatory_request *request); -/* All of those are TODOs: */ -#define lbs_cmd_bcn_ctrl (priv, cmdptr, cmd_action) (0) -#define lbs_ret_802_11_bcn_ctrl (priv, resp) (0) -void lbs_send_disconnect_notification (struct lbs_private *priv);void lbs_send_mic_failureevent (struct lbs_private *priv,u32 event);
drivers/net/wireless/libertas/cmd.c +0 -3
@@ -1216,9 +1216,6 @@ int lbs_prepare_and_send_command(struct lbs_private *priv,#endif -case CMD_802_11_BEACON_CTRL : - ret =lbs_cmd_bcn_ctrl (priv, cmdptr, cmd_action); -break ;case CMD_802_11_DEEP_SLEEP : cmdptr->command =cpu_to_le16 (CMD_802_11_DEEP_SLEEP ); cmdptr->size =cpu_to_le16 (sizeof (struct cmd_header ));
drivers/net/wireless/libertas/cmdresp.c +0 -3
@@ -130,9 +130,6 @@ static inline int handle_cmd_response(struct lbs_private *priv, sizeof(resp->params.fwt));spin_unlock_irqrestore (&priv->driver_lock, flags);break ; -case CMD_RET (CMD_802_11_BEACON_CTRL ): - ret =lbs_ret_802_11_bcn_ctrl (priv, resp); -break ;default : lbs_pr_err("CMD_RESP: unknown cmd response 0x%04x\n",
drivers/net/wireless/libertas/host.h +2 -1
@@ -595,6 +595,8 @@ struct cmd_ds_802_11_radio_control { } __attribute__ ((packed));struct cmd_ds_802_11_beacon_control { +struct cmd_header hdr; +__le16 action;__le16 beacon_enable;__le16 beacon_period;
@@ -972,7 +974,6 @@ struct cmd_ds_command {struct cmd_ds_bt_access bt; struct cmd_ds_fwt_access fwt; - struct cmd_ds_802_11_beacon_control bcn_ctrl; } params; } __attribute__ ((packed));#endif
Signature · 1 line
1.7.1.1
PATCH 7/16 libertas: convert LED_GPIO_CTRL to a direct command
In reply to Dan Williams--- drivers/net/wireless/libertas/host.h | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-)
drivers/net/wireless/libertas/host.h +2 -3
@@ -879,6 +879,8 @@ struct cmd_ds_802_11_pa_cfg {struct cmd_ds_802_11_led_ctrl { +struct cmd_header hdr; +__le16 action;__le16 numled;u8 data[256 ];
@@ -969,9 +971,6 @@ struct cmd_ds_command {struct cmd_ds_mac_reg_access macreg;struct cmd_ds_bbp_reg_access bbpreg;struct cmd_ds_rf_reg_access rfreg; - -struct cmd_ds_802_11_led_ctrl ledgpio; -struct cmd_ds_bt_access bt;struct cmd_ds_fwt_access fwt; } params;
Signature · 1 line
1.7.1.1
PATCH 8/16 libertas: convert register access to direct commands
In reply to Dan Williams--- drivers/net/wireless/libertas/cmd.c | 130 ++++++++++++++++--------------- drivers/net/wireless/libertas/cmd.h | 4 + drivers/net/wireless/libertas/cmdresp.c | 48 ----------- drivers/net/wireless/libertas/debugfs.c | 67 ++++------------ drivers/net/wireless/libertas/dev.h | 1 - drivers/net/wireless/libertas/host.h | 24 ++---- 6 files changed, 94 insertions(+), 180 deletions(-)
drivers/net/wireless/libertas/cmd.c +66 -64
@@ -848,78 +848,86 @@ int lbs_set_11d_domain_info(struct lbs_private *priv,return ret; } -static int lbs_cmd_reg_access (struct cmd_ds_command *cmdptr, -u8 cmd_action,void *pdata_buf) +/** +* @brief Read a MAC, Baseband, or RF register +* +* @param priv pointer to struct lbs_private +* @param cmd register command, one of CMD_MAC_REG_ACCESS, +* CMD_BBP_REG_ACCESS, or CMD_RF_REG_ACCESS +* @param offset byte offset of the register to get +* @param value on success, the value of the register at 'offset' +* +* @return 0 on success, error code on failure +*/ +int lbs_get_reg (struct lbs_private *priv,u16 reg,u16 offset,u32 *value) { -struct lbs_offset_value *offval; +struct cmd_ds_reg_access cmd; +int ret =0 ;lbs_deb_enter (LBS_DEB_CMD ); - offval = (struct lbs_offset_value *)pdata_buf; - -switch (le16_to_cpu (cmdptr->command)) { -case CMD_MAC_REG_ACCESS : - { -struct cmd_ds_mac_reg_access *macreg; - - cmdptr->size = -cpu_to_le16 (sizeof (struct cmd_ds_mac_reg_access ) - +sizeof (struct cmd_header )); - macreg = - (struct cmd_ds_mac_reg_access *)&cmdptr->params. - macreg; - - macreg->action =cpu_to_le16 (cmd_action); - macreg->offset =cpu_to_le16 ((u16 ) offval->offset); - macreg->value =cpu_to_le32 (offval->value); - -break ; - } - -case CMD_BBP_REG_ACCESS : - { -struct cmd_ds_bbp_reg_access *bbpreg; +BUG_ON (value ==NULL ); - cmdptr->size = -cpu_to_le16 (sizeof - (struct cmd_ds_bbp_reg_access ) - +sizeof (struct cmd_header )); - bbpreg = - (struct cmd_ds_bbp_reg_access *)&cmdptr->params. - bbpreg; +memset (&cmd,0 ,sizeof (cmd)); + cmd.hdr.size =cpu_to_le16 (sizeof (cmd)); + cmd.action =cpu_to_le16 (CMD_ACT_GET ); - bbpreg->action =cpu_to_le16 (cmd_action); - bbpreg->offset =cpu_to_le16 ((u16 ) offval->offset); - bbpreg->value = (u8 ) offval->value; +if (reg !=CMD_MAC_REG_ACCESS && + reg !=CMD_BBP_REG_ACCESS && + reg !=CMD_RF_REG_ACCESS ) { + ret = -EINVAL ; + goto out; + } -break ; - } + ret =lbs_cmd_with_response (priv, reg, &cmd); +if (ret) { +if (reg ==CMD_BBP_REG_ACCESS || reg ==CMD_RF_REG_ACCESS ) + *value = cmd.value.bbp_rf; +else if (reg ==CMD_MAC_REG_ACCESS ) + *value =le32_to_cpu (cmd.value.mac); + } -case CMD_RF_REG_ACCESS : - { -struct cmd_ds_rf_reg_access *rfreg; +out: +lbs_deb_leave_args (LBS_DEB_CMD ,"ret %d" , ret); +return ret; +} - cmdptr->size = -cpu_to_le16 (sizeof - (struct cmd_ds_rf_reg_access ) + -sizeof (struct cmd_header )); - rfreg = - (struct cmd_ds_rf_reg_access *)&cmdptr->params. - rfreg; +/** +* @brief Write a MAC, Baseband, or RF register +* +* @param priv pointer to struct lbs_private +* @param cmd register command, one of CMD_MAC_REG_ACCESS, +* CMD_BBP_REG_ACCESS, or CMD_RF_REG_ACCESS +* @param offset byte offset of the register to set +* @param value the value to write to the register at 'offset' +* +* @return 0 on success, error code on failure +*/ +int lbs_set_reg (struct lbs_private *priv,u16 reg,u16 offset,u32 value) +{ +struct cmd_ds_reg_access cmd; +int ret =0 ; - rfreg->action =cpu_to_le16 (cmd_action); - rfreg->offset =cpu_to_le16 ((u16 ) offval->offset); - rfreg->value = (u8 ) offval->value; +lbs_deb_enter (LBS_DEB_CMD ); -break ; - } +memset (&cmd,0 ,sizeof (cmd)); + cmd.hdr.size =cpu_to_le16 (sizeof (cmd)); + cmd.action =cpu_to_le16 (CMD_ACT_SET ); -default : -break ; +if (reg ==CMD_BBP_REG_ACCESS || reg ==CMD_RF_REG_ACCESS ) + cmd.value.bbp_rf = (u8) (value &0xFF ); +else if (reg ==CMD_MAC_REG_ACCESS ) + cmd.value.mac =cpu_to_le32 (value); +else { + ret = -EINVAL ; + goto out; } -lbs_deb_leave (LBS_DEB_CMD ); -return 0 ; + ret =lbs_cmd_with_response (priv, reg, &cmd); + +out: +lbs_deb_leave_args (LBS_DEB_CMD ,"ret %d" , ret); +return ret; } static void lbs_queue_cmd(struct lbs_private *priv,
@@ -1198,12 +1206,6 @@ int lbs_prepare_and_send_command(struct lbs_private *priv, ret =lbs_cmd_802_11_ps_mode (cmdptr, cmd_action);break ; -case CMD_MAC_REG_ACCESS : -case CMD_BBP_REG_ACCESS : -case CMD_RF_REG_ACCESS : - ret =lbs_cmd_reg_access (cmdptr, cmd_action, pdata_buf); -break ; -#ifdef CONFIG_LIBERTAS_MESH case CMD_BT_ACCESS :
drivers/net/wireless/libertas/cmd.h +4 -0
@@ -139,4 +139,8 @@ int lbs_set_11d_domain_info(struct lbs_private *priv,struct regulatory_request *request, struct ieee80211_supported_band **bands); +int lbs_get_reg (struct lbs_private *priv,u16 reg,u16 offset,u32 *value); + +int lbs_set_reg (struct lbs_private *priv,u16 reg,u16 offset,u32 value); +#endif /* _LBS_CMD_H */
drivers/net/wireless/libertas/cmdresp.c +0 -48
60 lines not on this page · raw message
drivers/net/wireless/libertas/debugfs.c +18 -49
152 lines not on this page · raw message
drivers/net/wireless/libertas/dev.h +0 -1
@@ -64,7 +64,6 @@ struct lbs_private {u32 mac_offset;u32 bbp_offset;u32 rf_offset; -struct lbs_offset_value offsetvalue;/* Power management */ u16 psmode;
drivers/net/wireless/libertas/host.h +6 -18
@@ -567,24 +567,15 @@ struct cmd_ds_802_11_snmp_mib {u8 value[128 ]; } __attribute__ ((packed)); -struct cmd_ds_mac_reg_access { -__le16 action; -__le16 offset; -__le32 value; -} __attribute__ ((packed)); - -struct cmd_ds_bbp_reg_access { -__le16 action; -__le16 offset; -u8 value; -u8 reserved[3 ]; -} __attribute__ ((packed)); +struct cmd_ds_reg_access { +struct cmd_header hdr; -struct cmd_ds_rf_reg_access {__le16 action;__le16 offset; -u8 value; -u8 reserved[3 ]; +union { +u8 bbp_rf;/* for BBP and RF registers */ +__le32 mac;/* for MAC registers */ + } value; } __attribute__ ((packed));struct cmd_ds_802_11_radio_control {
@@ -968,9 +959,6 @@ struct cmd_ds_command {/* command Body */ union {struct cmd_ds_802_11_ps_mode psmode; -struct cmd_ds_mac_reg_access macreg; -struct cmd_ds_bbp_reg_access bbpreg; -struct cmd_ds_rf_reg_access rfreg;struct cmd_ds_bt_access bt;struct cmd_ds_fwt_access fwt; } params;
Signature · 1 line
1.7.1.1
PATCH 9/16 libertas: convert Mesh Blinding Table access to a direct command
In reply to Dan Williams--- drivers/net/wireless/libertas/cmd.c | 4 - drivers/net/wireless/libertas/cmdresp.c | 7 - drivers/net/wireless/libertas/host.h | 3 +- drivers/net/wireless/libertas/mesh.c | 182 +++++++++++++++++++++++++------ drivers/net/wireless/libertas/mesh.h | 8 +- 5 files changed, 158 insertions(+), 46 deletions(-)
drivers/net/wireless/libertas/cmd.c +0 -4
@@ -1208,10 +1208,6 @@ int lbs_prepare_and_send_command(struct lbs_private *priv,#ifdef CONFIG_LIBERTAS_MESH -case CMD_BT_ACCESS : - ret =lbs_cmd_bt_access (cmdptr, cmd_action, pdata_buf); -break ; -case CMD_FWT_ACCESS : ret =lbs_cmd_fwt_access (cmdptr, cmd_action, pdata_buf);break ;
drivers/net/wireless/libertas/cmdresp.c +0 -7
@@ -68,13 +68,6 @@ static inline int handle_cmd_response(struct lbs_private *priv,case CMD_RET (CMD_802_11_BEACON_STOP ):break ; -case CMD_RET (CMD_BT_ACCESS ): -spin_lock_irqsave (&priv->driver_lock, flags); -if (priv->cur_cmd->callback_arg) -memcpy ((void *)priv->cur_cmd->callback_arg, - &resp->params.bt.addr1,2 *ETH_ALEN ); -spin_unlock_irqrestore (&priv->driver_lock, flags); -break ;case CMD_RET (CMD_FWT_ACCESS ):spin_lock_irqsave (&priv->driver_lock, flags);if (priv->cur_cmd->callback_arg)
drivers/net/wireless/libertas/host.h +2 -1
@@ -903,6 +903,8 @@ struct cmd_ds_get_tsf { } __attribute__ ((packed));struct cmd_ds_bt_access { +struct cmd_header hdr; +__le16 action;__le32 id;u8 addr1[ETH_ALEN ];
@@ -959,7 +961,6 @@ struct cmd_ds_command {/* command Body */ union {struct cmd_ds_802_11_ps_mode psmode; -struct cmd_ds_bt_access bt;struct cmd_ds_fwt_access fwt; } params; } __attribute__ ((packed));
drivers/net/wireless/libertas/mesh.c +150 -32
194 lines not on this page · raw message
drivers/net/wireless/libertas/mesh.h +6 -2
@@ -51,8 +51,12 @@ struct cmd_ds_command;struct cmd_ds_mesh_access ;struct cmd_ds_mesh_config ; -int lbs_cmd_bt_access (struct cmd_ds_command *cmd, -u16 cmd_action,void *pdata_buf); +int lbs_mesh_bt_add_del (struct lbs_private *priv,bool add,u8 *addr1); +int lbs_mesh_bt_reset (struct lbs_private *priv); +int lbs_mesh_bt_get_inverted (struct lbs_private *priv,bool *inverted); +int lbs_mesh_bt_set_inverted (struct lbs_private *priv,bool inverted); +int lbs_mesh_bt_get_entry (struct lbs_private *priv,u32 id,u8 *addr1); +int lbs_cmd_fwt_access (struct cmd_ds_command *cmd,u16 cmd_action,void *pdata_buf); int lbs_mesh_access(struct lbs_private *priv, uint16_t cmd_action,
Signature · 1 line
1.7.1.1
PATCH 10/16 libertas: convert CMD_FWT_ACCESS to a direct command
In reply to Dan WilliamsSlightly different approach here since there are so many arguments to the firmware command. Just let the caller fill them in before pushing the command to the firmware.
--- drivers/net/wireless/libertas/cmd.c | 8 ------- drivers/net/wireless/libertas/cmdresp.c | 9 -------- drivers/net/wireless/libertas/host.h | 3 +- drivers/net/wireless/libertas/mesh.c | 34 ++++++++++++++++++------------ drivers/net/wireless/libertas/mesh.h | 6 +++- 5 files changed, 26 insertions(+), 34 deletions(-)
drivers/net/wireless/libertas/cmd.c +0 -8
@@ -1206,14 +1206,6 @@ int lbs_prepare_and_send_command(struct lbs_private *priv, ret =lbs_cmd_802_11_ps_mode (cmdptr, cmd_action);break ; -#ifdef CONFIG_LIBERTAS_MESH - -case CMD_FWT_ACCESS : - ret =lbs_cmd_fwt_access (cmdptr, cmd_action, pdata_buf); -break ; - -#endif -case CMD_802_11_DEEP_SLEEP : cmdptr->command =cpu_to_le16 (CMD_802_11_DEEP_SLEEP ); cmdptr->size =cpu_to_le16 (sizeof (struct cmd_header ));
drivers/net/wireless/libertas/cmdresp.c +0 -9
@@ -59,7 +59,6 @@ static inline int handle_cmd_response(struct lbs_private *priv, {struct cmd_ds_command *resp = (struct cmd_ds_command *) cmd_response;int ret =0 ; -unsigned long flags;uint16_t respcmd =le16_to_cpu (resp->command);lbs_deb_enter (LBS_DEB_HOST );
@@ -68,14 +67,6 @@ static inline int handle_cmd_response(struct lbs_private *priv,case CMD_RET (CMD_802_11_BEACON_STOP ):break ; -case CMD_RET (CMD_FWT_ACCESS ): -spin_lock_irqsave (&priv->driver_lock, flags); -if (priv->cur_cmd->callback_arg) -memcpy ((void *)priv->cur_cmd->callback_arg, &resp->params.fwt, -sizeof (resp->params.fwt)); -spin_unlock_irqrestore (&priv->driver_lock, flags); -break ; -default :lbs_pr_err ("CMD_RESP: unknown cmd response 0x%04x\n" ,le16_to_cpu (resp->command));
drivers/net/wireless/libertas/host.h +2 -1
@@ -912,6 +912,8 @@ struct cmd_ds_bt_access { } __attribute__ ((packed));struct cmd_ds_fwt_access { +struct cmd_header hdr; +__le16 action;__le32 id;u8 valid;
@@ -961,7 +963,6 @@ struct cmd_ds_command {/* command Body */ union {struct cmd_ds_802_11_ps_mode psmode; -struct cmd_ds_fwt_access fwt; } params; } __attribute__ ((packed));#endif
drivers/net/wireless/libertas/mesh.c +20 -14
@@ -613,25 +613,31 @@ int lbs_mesh_bt_get_entry(struct lbs_private *priv, u32 id, u8 *addr1)return ret; } -int lbs_cmd_fwt_access (struct cmd_ds_command *cmd, -u16 cmd_action,void *pdata_buf) +/** +* @brief Access the mesh forwarding table +* +* @param priv A pointer to struct lbs_private structure +* @param cmd_action The forwarding table action to perform +* @param cmd The pre-filled FWT_ACCESS command +* +* @return 0 on success and 'cmd' will be filled with the +* firmware's response +*/ +int lbs_cmd_fwt_access (struct lbs_private *priv,u16 cmd_action, +struct cmd_ds_fwt_access *cmd) { -struct cmd_ds_fwt_access *fwt_access = &cmd->params.fwt; -lbs_deb_enter_args (LBS_DEB_CMD ,"action %d" , cmd_action); +int ret; - cmd->command =cpu_to_le16 (CMD_FWT_ACCESS ); - cmd->size =cpu_to_le16 (sizeof (struct cmd_ds_fwt_access ) + -sizeof (struct cmd_header )); - cmd->result =0 ; +lbs_deb_enter_args (LBS_DEB_CMD ,"action %d" , cmd_action); -if (pdata_buf) -memcpy (fwt_access, pdata_buf,sizeof (*fwt_access)); -else -memset (fwt_access,0 ,sizeof (*fwt_access)); + cmd->hdr.command =cpu_to_le16 (CMD_FWT_ACCESS ); + cmd->hdr.size =cpu_to_le16 (sizeof (struct cmd_ds_fwt_access )); + cmd->hdr.result =0 ; + cmd->action =cpu_to_le16 (cmd_action); - fwt_access->action =cpu_to_le16 (cmd_action); + ret =lbs_cmd_with_response (priv,CMD_FWT_ACCESS , cmd); -lbs_deb_leave (LBS_DEB_CMD ); +lbs_deb_leave_args (LBS_DEB_CMD ,"ret %d" , ret);return 0 ; }
drivers/net/wireless/libertas/mesh.h +4 -2
@@ -8,6 +8,7 @@#include <net/iw_handler.h> #include <net/lib80211.h> +#include "host.h" #ifdef CONFIG_LIBERTAS_MESH
@@ -57,8 +58,9 @@ int lbs_mesh_bt_get_inverted(struct lbs_private *priv, bool *inverted);int lbs_mesh_bt_set_inverted (struct lbs_private *priv,bool inverted);int lbs_mesh_bt_get_entry (struct lbs_private *priv,u32 id,u8 *addr1); -int lbs_cmd_fwt_access (struct cmd_ds_command *cmd, -u16 cmd_action,void *pdata_buf); +int lbs_cmd_fwt_access (struct lbs_private *priv,u16 cmd_action, +struct cmd_ds_fwt_access *cmd); +int lbs_mesh_access (struct lbs_private *priv,uint16_t cmd_action,struct cmd_ds_mesh_access *cmd); int lbs_mesh_config_send(struct lbs_private *priv,
Signature · 1 line
1.7.1.1
PATCH 11/16 libertas: remove unused indirect command response handler
In reply to Dan Williams--- drivers/net/wireless/libertas/cmdresp.c | 25 +------------------------ 1 files changed, 1 insertions(+), 24 deletions(-)
drivers/net/wireless/libertas/cmdresp.c +1 -24
@@ -54,28 +54,6 @@ void lbs_mac_event_disconnected(struct lbs_private *priv)lbs_deb_leave (LBS_DEB_ASSOC ); } -static inline int handle_cmd_response (struct lbs_private *priv, -struct cmd_header *cmd_response) -{ -struct cmd_ds_command *resp = (struct cmd_ds_command *) cmd_response; -int ret =0 ; -uint16_t respcmd =le16_to_cpu (resp->command); - -lbs_deb_enter (LBS_DEB_HOST ); - -switch (respcmd) { -case CMD_RET (CMD_802_11_BEACON_STOP ): -break ; - -default : -lbs_pr_err ("CMD_RESP: unknown cmd response 0x%04x\n" , -le16_to_cpu (resp->command)); -break ; - } -lbs_deb_leave (LBS_DEB_HOST ); -return ret; -} -int lbs_process_command_response (struct lbs_private *priv,u8 *data,u32 len) {uint16_t respcmd, curcmd;
@@ -216,8 +194,7 @@ int lbs_process_command_response(struct lbs_private *priv, u8 *data, u32 len)if (priv->cur_cmd && priv->cur_cmd->callback) { ret = priv->cur_cmd->callback (priv, priv->cur_cmd->callback_arg, resp); - }else - ret =handle_cmd_response (priv, resp); + }spin_lock_irqsave (&priv->driver_lock, flags);
Signature · 1 line
1.7.1.1
PATCH 12/16 libertas: convert PS_MODE to a direct command
In reply to Dan WilliamsPowersave looks like it got broken at some point but we'll fix that up when the command submission stuff is more understandable, which this series helps to do. That said, this patch should not further break powersave.
--- drivers/net/wireless/libertas/cmd.c | 139 ++++++++++++------------------- drivers/net/wireless/libertas/cmd.h | 6 +- drivers/net/wireless/libertas/cmdresp.c | 13 ++-- drivers/net/wireless/libertas/defs.h | 5 - drivers/net/wireless/libertas/host.h | 50 ++++++----- drivers/net/wireless/libertas/if_usb.c | 4 +- drivers/net/wireless/libertas/main.c | 4 +- 7 files changed, 95 insertions(+), 126 deletions(-)
drivers/net/wireless/libertas/cmd.c +55 -84
@@ -230,42 +230,49 @@ int lbs_host_sleep_cfg(struct lbs_private *priv, uint32_t criteria, }EXPORT_SYMBOL_GPL (lbs_host_sleep_cfg); -static int lbs_cmd_802_11_ps_mode (struct cmd_ds_command *cmd, -u16 cmd_action) +/** +* @brief Sets the Power Save mode +* +* @param priv A pointer to struct lbs_private structure +* @param cmd_action The Power Save operation (PS_MODE_ACTION_ENTER_PS or +* PS_MODE_ACTION_EXIT_PS) +* @param block Whether to block on a response or not +* +* @return 0 on success, error on failure +*/ +int lbs_set_ps_mode (struct lbs_private *priv,u16 cmd_action,bool block) { -struct cmd_ds_802_11_ps_mode *psm = &cmd->params.psmode; +struct cmd_ds_802_11_ps_mode cmd; +int ret =0 ;lbs_deb_enter (LBS_DEB_CMD ); - cmd->command =cpu_to_le16 (CMD_802_11_PS_MODE ); - cmd->size =cpu_to_le16 (sizeof (struct cmd_ds_802_11_ps_mode ) + -sizeof (struct cmd_header )); - psm->action =cpu_to_le16 (cmd_action); - psm->multipledtim =0 ; -switch (cmd_action) { -case CMD_SUBCMD_ENTER_PS : -lbs_deb_cmd ("PS command:" "SubCode- Enter PS\n" ); - - psm->locallisteninterval =0 ; - psm->nullpktinterval =0 ; - psm->multipledtim = -cpu_to_le16 (MRVDRV_DEFAULT_MULTIPLE_DTIM ); -break ; - -case CMD_SUBCMD_EXIT_PS : -lbs_deb_cmd ("PS command:" "SubCode- Exit PS\n" ); -break ; - -case CMD_SUBCMD_SLEEP_CONFIRMED : -lbs_deb_cmd ("PS command: SubCode- sleep confirm\n" ); -break ; +memset (&cmd,0 ,sizeof (cmd)); + cmd.hdr.size =cpu_to_le16 (sizeof (cmd)); + cmd.action =cpu_to_le16 (cmd_action); -default : -break ; +if (cmd_action ==PS_MODE_ACTION_ENTER_PS ) { +lbs_deb_cmd ("PS_MODE: action ENTER_PS\n" ); + cmd.multipledtim =cpu_to_le16 (1 );/* Default DTIM multiple */ + }else if (cmd_action ==PS_MODE_ACTION_EXIT_PS ) { +lbs_deb_cmd ("PS_MODE: action EXIT_PS\n" ); + }else { +/* We don't handle CONFIRM_SLEEP here because it needs to +* be fastpathed to the firmware. +*/ +lbs_deb_cmd ("PS_MODE: unknown action 0x%X\n" , cmd_action); + ret = -EOPNOTSUPP ; + goto out; } -lbs_deb_leave (LBS_DEB_CMD ); -return 0 ; +if (block) + ret =lbs_cmd_with_response (priv,CMD_802_11_PS_MODE , &cmd); +else +lbs_cmd_async (priv,CMD_802_11_PS_MODE , &cmd.hdr,sizeof (cmd)); + +out: +lbs_deb_leave_args (LBS_DEB_CMD ,"ret %d" , ret); +return ret; } int lbs_cmd_802_11_sleep_params(struct lbs_private *priv, uint16_t cmd_action,
@@ -950,16 +957,15 @@ 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 *) &cmdnode->cmdbuf[1 ]; +struct cmd_ds_802_11_ps_mode *psm = (void *) &cmdnode->cmdbuf; -if (psm->action ==cpu_to_le16 (CMD_SUBCMD_EXIT_PS )) { +if (psm->action ==cpu_to_le16 (PS_MODE_ACTION_EXIT_PS )) {if (priv->psstate !=PS_STATE_FULL_POWER ) addtail =0 ; } } -if (le16_to_cpu (cmdnode->cmdbuf->command) == -CMD_802_11_WAKEUP_CONFIRM ) +if (le16_to_cpu (cmdnode->cmdbuf->command) ==CMD_802_11_WAKEUP_CONFIRM ) addtail =0 ;spin_lock_irqsave (&priv->driver_lock, flags);
@@ -1154,7 +1160,7 @@ int lbs_prepare_and_send_command(struct lbs_private *priv, {int ret =0 ;struct cmd_ctrl_node *cmdnode; -struct cmd_ds_command *cmdptr; +struct cmd_header *cmdptr;unsigned long flags;lbs_deb_enter (LBS_DEB_HOST );
@@ -1190,7 +1196,7 @@ int lbs_prepare_and_send_command(struct lbs_private *priv, cmdnode->callback =NULL ; cmdnode->callback_arg = (unsigned long )pdata_buf; - cmdptr = (struct cmd_ds_command *)cmdnode->cmdbuf; + cmdptr = (struct cmd_header *)cmdnode->cmdbuf;lbs_deb_host ("PREP_CMD: command 0x%04x\n" , cmd_no);
@@ -1202,10 +1208,6 @@ int lbs_prepare_and_send_command(struct lbs_private *priv, cmdptr->result =0 ;switch (cmd_no) { -case CMD_802_11_PS_MODE : - ret =lbs_cmd_802_11_ps_mode (cmdptr, cmd_action); -break ; -case CMD_802_11_DEEP_SLEEP : cmdptr->command =cpu_to_le16 (CMD_802_11_DEEP_SLEEP ); cmdptr->size =cpu_to_le16 (sizeof (struct cmd_header ));
@@ -1426,10 +1428,10 @@ int lbs_execute_next_command(struct lbs_private *priv)/* * 1. Non-PS command: * Queue it. set needtowakeup to TRUE if current state -* is SLEEP, otherwise call lbs_ps_wakeup to send Exit_PS. -* 2. PS command but not Exit_PS: +* is SLEEP, otherwise call send EXIT_PS. +* 2. PS command but not EXIT_PS: * Ignore it. -* 3. PS command Exit_PS: +* 3. PS command EXIT_PS: * Set needtowakeup to TRUE if current state is SLEEP, * otherwise send this command down to firmware * immediately.
@@ -1443,8 +1445,11 @@ int lbs_execute_next_command(struct lbs_private *priv)/* w/ new scheme, it will not reach here. since it is blocked in main_thread. */ priv->needtowakeup =1 ; - }else -lbs_ps_wakeup (priv,0 ); + }else { +lbs_set_ps_mode (priv, +PS_MODE_ACTION_EXIT_PS , + false); + } ret =0 ; goto done;
@@ -1459,7 +1464,7 @@ int lbs_execute_next_command(struct lbs_private *priv)"EXEC_NEXT_CMD: PS cmd, action 0x%02x\n" , psm->action);if (psm->action != -cpu_to_le16 (CMD_SUBCMD_EXIT_PS )) { +cpu_to_le16 (PS_MODE_ACTION_EXIT_PS )) {lbs_deb_host ("EXEC_NEXT_CMD: ignore ENTER_PS cmd\n" );list_del (&cmdnode->list);
@@ -1519,13 +1524,16 @@ int lbs_execute_next_command(struct lbs_private *priv)lbs_deb_host ("EXEC_NEXT_CMD: WPA enabled and GTK_SET" " go back to PS_SLEEP" ); - lbs_ps_sleep(priv, 0); +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_ps_sleep (priv,0 ); +lbs_set_ps_mode (priv,PS_MODE_ACTION_ENTER_PS , + false); } }#endif
@@ -1573,43 +1581,6 @@ out:lbs_deb_leave (LBS_DEB_HOST ); } -void lbs_ps_sleep (struct lbs_private *priv,int wait_option) -{ -lbs_deb_enter (LBS_DEB_HOST ); - -/* -* PS is currently supported only in Infrastructure mode -* Remove this check if it is to be supported in IBSS mode also -*/ - -lbs_prepare_and_send_command (priv,CMD_802_11_PS_MODE , -CMD_SUBCMD_ENTER_PS , wait_option,0 ,NULL ); - -lbs_deb_leave (LBS_DEB_HOST ); -} - -/** -* @brief This function sends Exit_PS command to firmware. -* -* @param priv A pointer to struct lbs_private structure -* @param wait_option wait response or not -* @return n/a -*/ -void lbs_ps_wakeup (struct lbs_private *priv,int wait_option) -{ -__le32 Localpsmode; - -lbs_deb_enter (LBS_DEB_HOST ); - - Localpsmode =cpu_to_le32 (LBS802_11POWERMODECAM ); - -lbs_prepare_and_send_command (priv,CMD_802_11_PS_MODE , -CMD_SUBCMD_EXIT_PS , - wait_option,0 , &Localpsmode); - -lbs_deb_leave (LBS_DEB_HOST ); -} -/** * @brief This function checks condition and prepares to * send sleep confirm command to firmware if ok.
drivers/net/wireless/libertas/cmd.h +2 -4
@@ -94,10 +94,6 @@ int lbs_host_sleep_cfg(struct lbs_private *priv, uint32_t criteria,int lbs_cmd_802_11_sleep_params (struct lbs_private *priv,uint16_t cmd_action,struct sleep_params *sp); -void lbs_ps_sleep (struct lbs_private *priv,int wait_option); - -void lbs_ps_wakeup (struct lbs_private *priv,int wait_option); -void lbs_ps_confirm_sleep (struct lbs_private *priv);int lbs_set_radio (struct lbs_private *priv,u8 preamble,u8 radio_on);
@@ -143,4 +139,6 @@ int lbs_get_reg(struct lbs_private *priv, u16 reg, u16 offset, u32 *value);int lbs_set_reg (struct lbs_private *priv,u16 reg,u16 offset,u32 value); +int lbs_set_ps_mode (struct lbs_private *priv,u16 cmd_action,bool block); +#endif /* _LBS_CMD_H */
drivers/net/wireless/libertas/cmdresp.c +7 -6
@@ -49,7 +49,7 @@ void lbs_mac_event_disconnected(struct lbs_private *priv)if (priv->psstate !=PS_STATE_FULL_POWER ) {/* make firmware to exit PS mode */ lbs_deb_cmd ("disconnected, so exit PS mode\n" ); -lbs_ps_wakeup (priv,0 ); +lbs_set_ps_mode (priv,PS_MODE_ACTION_EXIT_PS , false); }lbs_deb_leave (LBS_DEB_ASSOC ); }
@@ -132,9 +132,9 @@ int lbs_process_command_response(struct lbs_private *priv, u8 *data, u32 len)* lbs_execute_next_command(). */ if (priv->wdev->iftype ==NL80211_IFTYPE_MONITOR && - action ==CMD_SUBCMD_ENTER_PS ) + action ==PS_MODE_ACTION_ENTER_PS ) priv->psmode =LBS802_11POWERMODECAM ; - }else if (action ==CMD_SUBCMD_ENTER_PS ) { + }else if (action ==PS_MODE_ACTION_ENTER_PS ) { priv->needtowakeup =0 ; priv->psstate =PS_STATE_AWAKE ;
@@ -149,11 +149,12 @@ int lbs_process_command_response(struct lbs_private *priv, u8 *data, u32 len)spin_unlock_irqrestore (&priv->driver_lock, flags);mutex_unlock (&priv->lock); -lbs_ps_wakeup (priv,0 ); +lbs_set_ps_mode (priv,PS_MODE_ACTION_EXIT_PS , + false);mutex_lock (&priv->lock);spin_lock_irqsave (&priv->driver_lock, flags); } - }else if (action ==CMD_SUBCMD_EXIT_PS ) { + }else if (action ==PS_MODE_ACTION_EXIT_PS ) { priv->needtowakeup =0 ; priv->psstate =PS_STATE_FULL_POWER ;lbs_deb_host ("CMD_RESP: EXIT_PS command response\n" );
@@ -291,7 +292,7 @@ int lbs_process_event(struct lbs_private *priv, u32 event)* in lbs_ps_wakeup() */ lbs_deb_cmd ("waking up ...\n" ); -lbs_ps_wakeup (priv,0 ); +lbs_set_ps_mode (priv,PS_MODE_ACTION_EXIT_PS , false); }break ;
drivers/net/wireless/libertas/defs.h +0 -5
@@ -172,11 +172,6 @@ static inline void lbs_deb_hex(unsigned int grp, const char *prompt, u8 *buf, in#define MRVDRV_MAX_BSS_DESCRIPTS 16#define MRVDRV_MAX_REGION_CODE 6 -#define MRVDRV_IGNORE_MULTIPLE_DTIM 0xfffe -#define MRVDRV_MIN_MULTIPLE_DTIM 1 -#define MRVDRV_MAX_MULTIPLE_DTIM 5 -#define MRVDRV_DEFAULT_MULTIPLE_DTIM 1 -#define MRVDRV_DEFAULT_LISTEN_INTERVAL 10#define MRVDRV_CHANNELS_PER_SCAN 4
drivers/net/wireless/libertas/host.h +27 -23
77 lines not on this page · raw message
drivers/net/wireless/libertas/if_usb.c +2 -2
@@ -433,7 +433,7 @@ static int if_usb_send_fw_pkt(struct if_usb_card *cardp)static int if_usb_reset_device (struct if_usb_card *cardp) { -struct cmd_ds_command *cmd = cardp->ep_out_buf +4 ; +struct cmd_header *cmd = cardp->ep_out_buf +4 ;int ret;lbs_deb_enter (LBS_DEB_USB );
@@ -441,7 +441,7 @@ static int if_usb_reset_device(struct if_usb_card *cardp) *(__le32 *)cardp->ep_out_buf =cpu_to_le32 (CMD_TYPE_REQUEST ); cmd->command =cpu_to_le16 (CMD_802_11_RESET ); - cmd->size =cpu_to_le16 (sizeof (struct cmd_header )); + cmd->size =cpu_to_le16 (sizeof (cmd)); cmd->result =cpu_to_le16 (0 ); cmd->seqnum =cpu_to_le16 (0x5a5a );usb_tx_block (cardp, cardp->ep_out_buf,4 +sizeof (struct cmd_header ));
drivers/net/wireless/libertas/main.c +2 -2
@@ -897,7 +897,7 @@ void lbs_remove_card(struct lbs_private *priv)if (priv->psmode ==LBS802_11POWERMODEMAX_PSP ) { priv->psmode =LBS802_11POWERMODECAM ; -lbs_ps_wakeup (priv,CMD_OPTION_WAITFORRSP ); +lbs_set_ps_mode (priv,PS_MODE_ACTION_EXIT_PS , true); }if (priv->is_deep_sleep) {
@@ -1060,7 +1060,7 @@ static int __init lbs_init_module(void)memset (&confirm_sleep,0 ,sizeof (confirm_sleep)); confirm_sleep.hdr.command =cpu_to_le16 (CMD_802_11_PS_MODE ); confirm_sleep.hdr.size =cpu_to_le16 (sizeof (confirm_sleep)); - confirm_sleep.action =cpu_to_le16 (CMD_SUBCMD_SLEEP_CONFIRMED ); + confirm_sleep.action =cpu_to_le16 (PS_MODE_ACTION_SLEEP_CONFIRMED );lbs_debugfs_init ();lbs_deb_leave (LBS_DEB_MAIN );return 0 ;
Signature · 1 line
1.7.1.1
PATCH 13/16 libertas: convert DEEP_SLEEP timer to a direct command
In reply to Dan WilliamsOther uses were already used direct command paths.
--- drivers/net/wireless/libertas/cmd.c | 4 ---- drivers/net/wireless/libertas/main.c | 14 ++++++-------- 2 files changed, 6 insertions(+), 12 deletions(-)
drivers/net/wireless/libertas/cmd.c +0 -4
@@ -1208,10 +1208,6 @@ int lbs_prepare_and_send_command(struct lbs_private *priv, cmdptr->result =0 ;switch (cmd_no) { -case CMD_802_11_DEEP_SLEEP : - cmdptr->command =cpu_to_le16 (CMD_802_11_DEEP_SLEEP ); - cmdptr->size =cpu_to_le16 (sizeof (struct cmd_header )); -break ;default :lbs_pr_err ("PREP_CMD: unknown command 0x%04x\n" , cmd_no); ret =-1 ;
drivers/net/wireless/libertas/main.c +8 -8
@@ -658,7 +658,6 @@ out:static void auto_deepsleep_timer_fn (unsigned long data) {struct lbs_private *priv = (struct lbs_private *)data; -int ret;lbs_deb_enter (LBS_DEB_CMD );
@@ -666,14 +665,15 @@ static void auto_deepsleep_timer_fn(unsigned long data) priv->is_activity_detected =0 ; }else {if (priv->is_auto_deep_sleep_enabled && - (!priv->wakeup_dev_required) && - (priv->connect_status !=LBS_CONNECTED )) { + (!priv->wakeup_dev_required) && + (priv->connect_status !=LBS_CONNECTED )) { +struct cmd_header cmd; +lbs_deb_main ("Entering auto deep sleep mode...\n" ); - ret =lbs_prepare_and_send_command (priv, -CMD_802_11_DEEP_SLEEP ,0 , -0 ,0 ,NULL ); -if (ret) -lbs_pr_err ("Enter Deep Sleep command failed\n" ); +memset (&cmd,0 ,sizeof (cmd)); + cmd.size =cpu_to_le16 (sizeof (cmd)); +lbs_cmd_async (priv,CMD_802_11_DEEP_SLEEP , &cmd, +sizeof (cmd)); } } mod_timer(&priv->auto_deepsleep_timer , jiffies +
Signature · 1 line
1.7.1.1
PATCH 14/16 libertas: kill unused lbs_prepare_and_send_command()
In reply to Dan WilliamsRemove last bits of indirect command code.
--- drivers/net/wireless/libertas/cmd.c | 146 ++----------------------------- drivers/net/wireless/libertas/cmd.h | 5 - drivers/net/wireless/libertas/cmdresp.c | 3 - drivers/net/wireless/libertas/dev.h | 1 - 4 files changed, 9 insertions(+), 146 deletions(-)
drivers/net/wireless/libertas/cmd.c +9 -137
@@ -77,30 +77,6 @@ static u8 is_command_allowed_in_ps(u16 cmd) }/** -* @brief This function checks if the command is allowed. -* -* @param priv A pointer to lbs_private structure -* @return allowed or not allowed. -*/ - -static int lbs_is_cmd_allowed (struct lbs_private *priv) -{ -int ret =1 ; - -lbs_deb_enter (LBS_DEB_CMD ); - -if (!priv->is_auto_deep_sleep_enabled) { -if (priv->is_deep_sleep) { -lbs_deb_cmd ("command not allowed in deep sleep\n" ); - ret =0 ; - } - } - -lbs_deb_leave (LBS_DEB_CMD ); -return ret; -} - -/** * @brief Updates the hardware details like MAC address and regulatory region * * @param priv A pointer to struct lbs_private structure
@@ -1000,7 +976,6 @@ static void lbs_submit_command(struct lbs_private *priv,spin_lock_irqsave (&priv->driver_lock, flags); priv->cur_cmd = cmdnode; - priv->cur_cmd_retcode =0 ;spin_unlock_irqrestore (&priv->driver_lock, flags); cmdsize =le16_to_cpu (cmd->size);
@@ -1073,9 +1048,6 @@ static void lbs_cleanup_and_insert_cmd(struct lbs_private *priv,void lbs_complete_command (struct lbs_private *priv,struct cmd_ctrl_node *cmd,int result) { -if (cmd == priv->cur_cmd) - priv->cur_cmd_retcode = result; - cmd->result = result; cmd->cmdwaitqwoken =1 ;wake_up_interruptible (&cmd->cmdwait_q);
@@ -1143,112 +1115,6 @@ void lbs_set_mac_control(struct lbs_private *priv) }/** -* @brief This function prepare the command before send to firmware. -* -* @param priv A pointer to struct lbs_private structure -* @param cmd_no command number -* @param cmd_action command action: GET or SET -* @param wait_option wait option: wait response or not -* @param cmd_oid cmd oid: treated as sub command -* @param pdata_buf A pointer to informaion buffer -* @return 0 or -1 -*/ -int lbs_prepare_and_send_command (struct lbs_private *priv, -u16 cmd_no, -u16 cmd_action, -u16 wait_option,u32 cmd_oid,void *pdata_buf) -{ -int ret =0 ; -struct cmd_ctrl_node *cmdnode; -struct cmd_header *cmdptr; -unsigned long flags; - -lbs_deb_enter (LBS_DEB_HOST ); - -if (!priv) { -lbs_deb_host ("PREP_CMD: priv is NULL\n" ); - ret =-1 ; - goto done; - } - -if (priv->surpriseremoved) { -lbs_deb_host ("PREP_CMD: card removed\n" ); - ret =-1 ; - goto done; - } - -if (!lbs_is_cmd_allowed (priv)) { - ret = -EBUSY ; - goto done; - } - - cmdnode =lbs_get_cmd_ctrl_node (priv); - -if (cmdnode ==NULL ) { -lbs_deb_host ("PREP_CMD: cmdnode is NULL\n" ); - -/* Wake up main thread to execute next command */ -wake_up_interruptible (&priv->waitq); - ret =-1 ; - goto done; - } - - cmdnode->callback =NULL ; - cmdnode->callback_arg = (unsigned long )pdata_buf; - - cmdptr = (struct cmd_header *)cmdnode->cmdbuf; - -lbs_deb_host ("PREP_CMD: command 0x%04x\n" , cmd_no); - -/* Set sequence number, command and INT option */ - priv->seqnum++; - cmdptr->seqnum =cpu_to_le16 (priv->seqnum); - - cmdptr->command =cpu_to_le16 (cmd_no); - cmdptr->result =0 ; - -switch (cmd_no) { -default : -lbs_pr_err ("PREP_CMD: unknown command 0x%04x\n" , cmd_no); - ret =-1 ; -break ; - } - -/* return error, since the command preparation failed */ -if (ret !=0 ) { -lbs_deb_host ("PREP_CMD: command preparation failed\n" ); -lbs_cleanup_and_insert_cmd (priv, cmdnode); - ret =-1 ; - goto done; - } - - cmdnode->cmdwaitqwoken =0 ; - -lbs_queue_cmd (priv, cmdnode); -wake_up_interruptible (&priv->waitq); - -if (wait_option &CMD_OPTION_WAITFORRSP ) { -lbs_deb_host ("PREP_CMD: wait for response\n" ); -might_sleep (); -wait_event_interruptible (cmdnode->cmdwait_q, - cmdnode->cmdwaitqwoken); - } - -spin_lock_irqsave (&priv->driver_lock, flags); -if (priv->cur_cmd_retcode) { -lbs_deb_host ("PREP_CMD: command failed with return code %d\n" , - priv->cur_cmd_retcode); - priv->cur_cmd_retcode =0 ; - ret =-1 ; - } -spin_unlock_irqrestore (&priv->driver_lock, flags); - -done: -lbs_deb_leave_args (LBS_DEB_HOST ,"ret %d" , ret); -return ret; -} - -/** * @brief This function allocates the command buffer and link * it to command free queue. *
@@ -1701,9 +1567,15 @@ struct cmd_ctrl_node *__lbs_cmd_async(struct lbs_private *priv, goto done; } -if (!lbs_is_cmd_allowed (priv)) { - cmdnode =ERR_PTR (-EBUSY ); - goto done; +/* No commands are allowed in Deep Sleep until we toggle the GPIO +* to wake up the card and it has signaled that it's ready. +*/ +if (!priv->is_auto_deep_sleep_enabled) { +if (priv->is_deep_sleep) { +lbs_deb_cmd ("command not allowed in deep sleep\n" ); + cmdnode =ERR_PTR (-EBUSY ); + goto done; + } } cmdnode =lbs_get_cmd_ctrl_node (priv);
drivers/net/wireless/libertas/cmd.h +0 -5
@@ -39,11 +39,6 @@ struct cmd_ctrl_node {#define lbs_cmd_with_response (priv, cmdnr, cmd) \ lbs_cmd(priv, cmdnr, cmd, lbs_cmd_copyback, (unsigned long) (cmd)) -int lbs_prepare_and_send_command (struct lbs_private *priv, -u16 cmd_no, -u16 cmd_action, -u16 wait_option,u32 cmd_oid,void *pdata_buf); -void lbs_cmd_async (struct lbs_private *priv,uint16_t command,struct cmd_header *in_cmd,int in_cmd_size);
drivers/net/wireless/libertas/cmdresp.c +0 -3
@@ -112,9 +112,6 @@ int lbs_process_command_response(struct lbs_private *priv, u8 *data, u32 len)del_timer (&priv->command_timer); priv->cmd_timed_out =0 ; -/* Store the response code to cur_cmd_retcode. */ - priv->cur_cmd_retcode = result; -if (respcmd ==CMD_RET (CMD_802_11_PS_MODE )) {struct cmd_ds_802_11_ps_mode *psmode = (void *) &resp[1 ];u16 action =le16_to_cpu (psmode->action);
drivers/net/wireless/libertas/dev.h +0 -1
@@ -116,7 +116,6 @@ struct lbs_private {int cmd_timed_out;/* Command responses sent from the hardware to the driver */ -int cur_cmd_retcode;u8 resp_idx;u8 resp_buf[2 ][LBS_UPLD_SIZE ];u32 resp_len[2 ];
Signature · 1 line
1.7.1.1
PATCH 15/16 libertas: rename lbs_get_cmd_ctrl_node() to lbs_get_free_cmd_node()
In reply to Dan Williams--- drivers/net/wireless/libertas/cmd.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
drivers/net/wireless/libertas/cmd.c +2 -4
@@ -15,8 +15,6 @@#define CAL_NF (nf) ((s32)(-(s32)(nf)))#define CAL_RSSI (snr, nf) ((s32)((s32)(snr) + CAL_NF(nf))) -static struct cmd_ctrl_node *lbs_get_cmd_ctrl_node (struct lbs_private *priv); -/** * @brief Simple callback that copies response back into command *
@@ -1207,7 +1205,7 @@ done:* @param priv A pointer to struct lbs_private structure * @return cmd_ctrl_node A pointer to cmd_ctrl_node structure or NULL */ -static struct cmd_ctrl_node *lbs_get_cmd_ctrl_node (struct lbs_private *priv) +static struct cmd_ctrl_node *lbs_get_free_cmd_node (struct lbs_private *priv) {struct cmd_ctrl_node *tempnode;unsigned long flags;
@@ -1578,7 +1576,7 @@ struct cmd_ctrl_node *__lbs_cmd_async(struct lbs_private *priv, } } - cmdnode =lbs_get_cmd_ctrl_node (priv); + cmdnode =lbs_get_free_cmd_node (priv);if (cmdnode ==NULL ) {lbs_deb_host ("PREP_CMD: cmdnode is NULL\n" );
Signature · 1 line
1.7.1.1
PATCH 16/16 libertas: remove unused cmd_pending waitq
In reply to Dan Williams--- drivers/net/wireless/libertas/dev.h | 1 - drivers/net/wireless/libertas/main.c | 8 -------- 2 files changed, 0 insertions(+), 9 deletions(-)
drivers/net/wireless/libertas/dev.h +0 -1
@@ -111,7 +111,6 @@ struct lbs_private {struct cmd_ctrl_node *cur_cmd;struct list_head cmdfreeq;/* free command buffers */ struct list_head cmdpendingq;/* pending command buffers */ -wait_queue_head_t cmd_pending;struct timer_list command_timer;int cmd_timed_out;
drivers/net/wireless/libertas/main.c +0 -8
@@ -502,12 +502,6 @@ static int lbs_thread(void *data)if (!priv->dnld_sent && !priv->cur_cmd)lbs_execute_next_command (priv); -/* Wake-up command waiters which can't sleep in -* lbs_prepare_and_send_command -*/ -if (!list_empty (&priv->cmdpendingq)) -wake_up_all (&priv->cmd_pending); -spin_lock_irq (&priv->driver_lock);if (!priv->dnld_sent && priv->tx_pending_len >0 ) { int ret = priv->hw_host_to_card(priv, MVMS_DAT,
@@ -533,7 +527,6 @@ static int lbs_thread(void *data)del_timer (&priv->command_timer);del_timer (&priv->auto_deepsleep_timer); -wake_up_all (&priv->cmd_pending);lbs_deb_leave (LBS_DEB_THREAD );return 0 ;
@@ -739,7 +732,6 @@ static int lbs_init_adapter(struct lbs_private *priv)INIT_LIST_HEAD (&priv->cmdpendingq);spin_lock_init (&priv->driver_lock); -init_waitqueue_head (&priv->cmd_pending);/* Allocate the command buffers */ if (lbs_allocate_cmd_buffer (priv)) {
Signature · 1 line
1.7.1.1