mwifiex: change memset to simple assignment for ht_cap.mcs.rx_mask
PATCH 1/7 mwifiex: change memset to simple assignment for ht_cap.mcs.rx_mask
From: Maithili Hinge <[email protected]>
WARNING: single byte memset is suspicious.
Swapped 2nd/3rd argument?
This code happens to work because rx_mcs is the first variable in mcs structure. We should use 'mcs.rx_mcs' here anyway.
--- drivers/net/wireless/mwifiex/uap_cmd.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/net/wireless/mwifiex/uap_cmd.c +5 -3
@@ -175,17 +175,19 @@ mwifiex_set_ht_params(struct mwifiex_private *priv,switch (GET_RXSTBC (cap_info)) {case MWIFIEX_RX_STBC1 :/* HT_CAP 1X1 mode */ -memset (&bss_cfg->ht_cap.mcs,0xff ,1 ); + bss_cfg->ht_cap.mcs.rx_mask[0 ] =0xff ;break ;case MWIFIEX_RX_STBC12 :/* fall through */ case MWIFIEX_RX_STBC123 :/* HT_CAP 2X2 mode */ -memset (&bss_cfg->ht_cap.mcs,0xff ,2 ); + bss_cfg->ht_cap.mcs.rx_mask[0 ] =0xff ; + bss_cfg->ht_cap.mcs.rx_mask[1 ] =0xff ;break ;default :dev_warn (priv->adapter->dev,"Unsupported RX-STBC, default to 2x2\n" ); -memset (&bss_cfg->ht_cap.mcs,0xff ,2 ); + bss_cfg->ht_cap.mcs.rx_mask[0 ] =0xff ; + bss_cfg->ht_cap.mcs.rx_mask[1 ] =0xff ;break ; } priv->ap_11n_enabled =1 ;
Signature · 1 line
1.8.2.3
PATCH 2/7 mwifiex: increase SDIO multiport aggregation buffer sizes
From: Amitkumar Karwar <[email protected]>
Currently Tx and Rx buffer sizes are 8K and 16K respectively for all chipsets. We will change them to 32K for SD8897 and 16K for older chipsets. SD8897 chipset has more SDIO data ports than older chipsets.
This patch will help to improve throughput numbers.
--- drivers/net/wireless/mwifiex/sdio.c | 6 ++++-- drivers/net/wireless/mwifiex/sdio.h | 18 ++++++++++++++---- 2 files changed, 18 insertions(+), 6 deletions(-)
drivers/net/wireless/mwifiex/sdio.c +4 -2
@@ -85,6 +85,8 @@ mwifiex_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id) card->supports_sdio_new_mode = data->supports_sdio_new_mode; card->has_control_mask = data->has_control_mask; card->tx_buf_size = data->tx_buf_size; + card->mp_tx_agg_buf_size = data->mp_tx_agg_buf_size; + card->mp_rx_agg_buf_size = data->mp_rx_agg_buf_size; }sdio_claim_host (func);
@@ -1842,8 +1844,8 @@ static int mwifiex_init_sdio(struct mwifiex_adapter *adapter) card->mpa_rx.len_arr =kzalloc (sizeof (*card->mpa_rx.len_arr) * card->mp_agg_pkt_limit,GFP_KERNEL ); ret =mwifiex_alloc_sdio_mpa_buffers (adapter, -SDIO_MP_TX_AGGR_DEF_BUF_SIZE , -SDIO_MP_RX_AGGR_DEF_BUF_SIZE ); + card->mp_tx_agg_buf_size, + card->mp_rx_agg_buf_size);if (ret) {dev_err (adapter->dev,"failed to alloc sdio mp-a buffers\n" );kfree (card->mp_regs);
drivers/net/wireless/mwifiex/sdio.h +14 -4
@@ -64,10 +64,8 @@#define UP_LD_CMD_PORT_HOST_INT_STATUS (0x40U)#define DN_LD_CMD_PORT_HOST_INT_STATUS (0x80U) -#define SDIO_MP_TX_AGGR_DEF_BUF_SIZE (8192)/* 8K */ - -/* Multi port RX aggregation buffer size */ -#define SDIO_MP_RX_AGGR_DEF_BUF_SIZE (16384)/* 16K */ +#define MWIFIEX_MP_AGGR_BUF_SIZE_16K (16384) +#define MWIFIEX_MP_AGGR_BUF_SIZE_32K (32768)/* Misc. Config Register : Auto Re-enable interrupts */ #define AUTO_RE_ENABLE_INT BIT(4)
@@ -234,6 +232,8 @@ struct sdio_mmc_card {bool supports_sdio_new_mode;bool has_control_mask;u16 tx_buf_size; +u32 mp_tx_agg_buf_size; +u32 mp_rx_agg_buf_size;u32 mp_rd_bitmap;u32 mp_wr_bitmap;
@@ -258,6 +258,8 @@ struct mwifiex_sdio_device {bool supports_sdio_new_mode;bool has_control_mask;u16 tx_buf_size; +u32 mp_tx_agg_buf_size; +u32 mp_rx_agg_buf_size; };static const struct mwifiex_sdio_card_reg mwifiex_reg_sd87xx = {
@@ -315,6 +317,8 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8786 = { .supports_sdio_new_mode = false, .has_control_mask = true, .tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_2K, + .mp_tx_agg_buf_size = MWIFIEX_MP_AGGR_BUF_SIZE_16K, + .mp_rx_agg_buf_size = MWIFIEX_MP_AGGR_BUF_SIZE_16K, };static const struct mwifiex_sdio_device mwifiex_sdio_sd8787 = {
@@ -325,6 +329,8 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8787 = { .supports_sdio_new_mode = false, .has_control_mask = true, .tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_2K, + .mp_tx_agg_buf_size = MWIFIEX_MP_AGGR_BUF_SIZE_16K, + .mp_rx_agg_buf_size = MWIFIEX_MP_AGGR_BUF_SIZE_16K, };static const struct mwifiex_sdio_device mwifiex_sdio_sd8797 = {
@@ -335,6 +341,8 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8797 = { .supports_sdio_new_mode = false, .has_control_mask = true, .tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_2K, + .mp_tx_agg_buf_size = MWIFIEX_MP_AGGR_BUF_SIZE_16K, + .mp_rx_agg_buf_size = MWIFIEX_MP_AGGR_BUF_SIZE_16K, };static const struct mwifiex_sdio_device mwifiex_sdio_sd8897 = {
@@ -345,6 +353,8 @@ static const struct mwifiex_sdio_device mwifiex_sdio_sd8897 = { .supports_sdio_new_mode = true, .has_control_mask = false, .tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_4K, + .mp_tx_agg_buf_size = MWIFIEX_MP_AGGR_BUF_SIZE_32K, + .mp_rx_agg_buf_size = MWIFIEX_MP_AGGR_BUF_SIZE_32K, };/*
Signature · 1 line
1.8.2.3
PATCH 3/7 mwifiex: improve AMSDU packet aggregation for PCIe and SDIO
In reply to Bing ZhaoFrom: Amitkumar Karwar <[email protected]>
For PCIe, aggregate more AMSDU packets till PCIe TXBD is full.
For SDIO, aggregation was disabled for AMSDU packets because AMSDU aggregated packet size is already 4K or 8K, SDIO Multiport Aggregation feature didn't use to gain much previously. Now with increased multiport aggregation buffer, we can enable it for AMSDU packets.
--- drivers/net/wireless/mwifiex/11n_aggr.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-)
drivers/net/wireless/mwifiex/11n_aggr.c +5 -12
@@ -236,18 +236,11 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv, ret = adapter->if_ops.host_to_card (adapter,MWIFIEX_USB_EP_DATA , skb_aggr,NULL ); }else { -/* -* Padding per MSDU will affect the length of next -* packet and hence the exact length of next packet -* is uncertain here. -* -* Also, aggregation of transmission buffer, while -* downloading the data to the card, wont gain much -* on the AMSDU packets as the AMSDU packets utilizes -* the transmission buffer space to the maximum -* (adapter->tx_buf_size). -*/ - tx_param.next_pkt_len =0 ; +if (skb_src) + tx_param.next_pkt_len = + skb_src->len +sizeof (struct txpd ); +else + tx_param.next_pkt_len =0 ; ret = adapter->if_ops.host_to_card (adapter,MWIFIEX_TYPE_DATA , skb_aggr, &tx_param);
Signature · 1 line
1.8.2.3
PATCH 4/7 mwifiex: increase the number of nodes in command pool
In reply to Bing ZhaoFrom: Amitkumar Karwar <[email protected]>
Command nodes are increased from 20 to 50. Now we can always scan 1 channel per scan command to avoid traffic delay/loss in connected state. We will get rid of *CHANNEL_PER_SCAN_CMD macros used due to command node constraints.
--- drivers/net/wireless/mwifiex/ioctl.h | 2 +- drivers/net/wireless/mwifiex/scan.c | 17 ++--------------- 2 files changed, 3 insertions(+), 16 deletions(-)
drivers/net/wireless/mwifiex/ioctl.h +1 -1
@@ -303,7 +303,7 @@ struct mwifiex_ds_ant_cfg {u32 rx_ant; }; -#define MWIFIEX_NUM_OF_CMD_BUFFER 20 +#define MWIFIEX_NUM_OF_CMD_BUFFER 50#define MWIFIEX_SIZE_OF_CMD_BUFFER 2048enum {
drivers/net/wireless/mwifiex/scan.c +2 -15
@@ -29,9 +29,6 @@#define MWIFIEX_MAX_CHANNELS_PER_SPECIFIC_SCAN 14#define MWIFIEX_DEF_CHANNELS_PER_SCAN_CMD 4 -#define MWIFIEX_LIMIT_1_CHANNEL_PER_SCAN_CMD 15 -#define MWIFIEX_LIMIT_2_CHANNELS_PER_SCAN_CMD 27 -#define MWIFIEX_LIMIT_3_CHANNELS_PER_SCAN_CMD 35/* Memory needed to store a max sized Channel List TLV for a firmware scan */ #define CHAN_TLV_MAX_SIZE (sizeof(struct mwifiex_ie_types_header) \
@@ -1055,20 +1052,10 @@ mwifiex_config_scan(struct mwifiex_private *priv,/* * In associated state we will reduce the number of channels scanned per -* scan command to avoid any traffic delay/loss. This number is decided -* based on total number of channels to be scanned due to constraints -* of command buffers. +* scan command to 1 to avoid any traffic delay/loss. */ -if (priv->media_connected) { -if (chan_num <MWIFIEX_LIMIT_1_CHANNEL_PER_SCAN_CMD ) +if (priv->media_connected) *max_chan_per_scan =1 ; -else if (chan_num <MWIFIEX_LIMIT_2_CHANNELS_PER_SCAN_CMD ) - *max_chan_per_scan =2 ; -else if (chan_num <MWIFIEX_LIMIT_3_CHANNELS_PER_SCAN_CMD ) - *max_chan_per_scan =3 ; -else - *max_chan_per_scan =4 ; - } }/*
Signature · 1 line
1.8.2.3
PATCH 5/7 mwifiex: update timestamp information for aggregation packets
In reply to Bing ZhaoFrom: Avinash Patil <[email protected]>
New skbs are allocated at the time of AMSDU aggregation. Setting up in timestamps for such skbs was missing which would result into wrong queue delays passed to FW. Fix this by setting timestamp of skbs created for AMSDU aggregation.
--- drivers/net/wireless/mwifiex/11n_aggr.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/wireless/mwifiex/11n_aggr.c +4 -0
@@ -160,6 +160,7 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv,int pad =0 , ret;struct mwifiex_tx_param tx_param;struct txpd *ptx_pd =NULL ; +struct timeval tv;int headroom = adapter->iface_type ==MWIFIEX_USB ?0 :INTF_HEADER_LEN ; skb_src =skb_peek (&pra_list->skb_head);
@@ -184,6 +185,9 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv, tx_info_aggr->bss_num = tx_info_src->bss_num; skb_aggr->priority = skb_src->priority; +do_gettimeofday (&tv); + skb_aggr->tstamp =timeval_to_ktime (tv); + do { /* Check if AMSDU can accommodate this MSDU */ if (skb_tailroom(skb_aggr) < (skb_src->len + LLC_SNAP_LEN))
Signature · 1 line
1.8.2.3
PATCH 6/7 mwifiex: use USB core's soft_unbind option
In reply to Bing ZhaoFrom: Amitkumar Karwar <[email protected]>
This option allows driver to finish pending operations in disconnect handler by not killing URBs after usb_deregister call.
We will get rid of global pointer 'usb_card' by moving code from cleanup_module() to disconnect(). This will help to match with our handling for SDIO and PCIe interfaces.
--- drivers/net/wireless/mwifiex/usb.c | 60 ++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 31 deletions(-)
drivers/net/wireless/mwifiex/usb.c +29 -31
@@ -22,9 +22,9 @@#define USB_VERSION "1.0" +static u8 user_rmmod;static struct mwifiex_if_ops usb_ops;static struct semaphore add_remove_card_sem; -static struct usb_card_rec *usb_card;static struct usb_device_id mwifiex_usb_table[] = {/* 8797 */
@@ -532,28 +532,43 @@ static int mwifiex_usb_resume(struct usb_interface *intf)static void mwifiex_usb_disconnect (struct usb_interface *intf) {struct usb_card_rec *card =usb_get_intfdata (intf); +struct mwifiex_adapter *adapter; -if (!card) { -pr_err ("%s: card is NULL\n" , __func__); +if (!card || !card->adapter) { +pr_err ("%s: card or card->adapter is NULL\n" , __func__);return ; } -mwifiex_usb_free (card); + adapter = card->adapter; +if (!adapter->priv_num) +return ; -if (card->adapter) { -struct mwifiex_adapter *adapter = card->adapter; +/* In case driver is removed when asynchronous FW downloading is +* in progress +*/ +wait_for_completion (&adapter->fw_load); -if (!adapter->priv_num) -return ; +if (user_rmmod) { +#ifdef CONFIG_PM +if (adapter->is_suspended) +mwifiex_usb_resume (intf); +#endif + +mwifiex_deauthenticate_all (adapter); -dev_dbg (adapter->dev,"%s: removing card\n" , __func__); -mwifiex_remove_card (adapter, &add_remove_card_sem); +mwifiex_init_shutdown_fw (mwifiex_get_priv (adapter, +MWIFIEX_BSS_ROLE_ANY ), +MWIFIEX_FUNC_SHUTDOWN ); } +mwifiex_usb_free (card); + +dev_dbg (adapter->dev,"%s: removing card\n" , __func__); +mwifiex_remove_card (adapter, &add_remove_card_sem); +usb_set_intfdata (intf,NULL );usb_put_dev (interface_to_usbdev (intf));kfree (card); - usb_card =NULL ;return ; }
@@ -565,6 +580,7 @@ static struct usb_driver mwifiex_usb_driver = { .id_table = mwifiex_usb_table, .suspend = mwifiex_usb_suspend, .resume = mwifiex_usb_resume, + .soft_unbind = 1, };static int mwifiex_usb_tx_init (struct mwifiex_adapter *adapter)
@@ -762,7 +778,6 @@ static int mwifiex_register_dev(struct mwifiex_adapter *adapter) card->adapter = adapter; adapter->dev = &card->udev->dev; - usb_card = card;switch (le16_to_cpu (card->udev->descriptor.idProduct)) {case USB8897_PID_1 :
@@ -1025,25 +1040,8 @@ static void mwifiex_usb_cleanup_module(void)if (!down_interruptible (&add_remove_card_sem))up (&add_remove_card_sem); -if (usb_card && usb_card->adapter) { -struct mwifiex_adapter *adapter = usb_card->adapter; - -/* In case driver is removed when asynchronous FW downloading is -* in progress -*/ -wait_for_completion (&adapter->fw_load); - -#ifdef CONFIG_PM -if (adapter->is_suspended) -mwifiex_usb_resume (usb_card->intf); -#endif - -mwifiex_deauthenticate_all (adapter); - -mwifiex_init_shutdown_fw (mwifiex_get_priv (adapter, -MWIFIEX_BSS_ROLE_ANY ), -MWIFIEX_FUNC_SHUTDOWN ); - } +/* set the flag as user is removing this module */ + user_rmmod =1 ;usb_deregister (&mwifiex_usb_driver); }
Signature · 1 line
1.8.2.3
PATCH 7/7 mwifiex: remove redundant 'fw_load' completion structure
In reply to Bing ZhaoFrom: Amitkumar Karwar <[email protected]>
'add_remove_card_sem' semaphore already takes care of synchronization for driver load and unload threads. Hence there won't be a case when unload thread is waiting on 'wait_for_completion(fw_load)'.
--- drivers/net/wireless/mwifiex/main.c | 2 -- drivers/net/wireless/mwifiex/main.h | 1 - drivers/net/wireless/mwifiex/pcie.c | 3 --- drivers/net/wireless/mwifiex/sdio.c | 3 --- drivers/net/wireless/mwifiex/usb.c | 5 ----- 5 files changed, 14 deletions(-)
drivers/net/wireless/mwifiex/main.c +0 -2
@@ -521,7 +521,6 @@ done:release_firmware (adapter->firmware); adapter->firmware =NULL ; } -complete (&adapter->fw_load);if (init_failed)mwifiex_free_adapter (adapter);up (sem);
@@ -535,7 +534,6 @@ static int mwifiex_init_hw_fw(struct mwifiex_adapter *adapter) {int ret; -init_completion (&adapter->fw_load); ret =request_firmware_nowait (THIS_MODULE ,1 , adapter->fw_name, adapter->dev,GFP_KERNEL , adapter, mwifiex_fw_dpc);
drivers/net/wireless/mwifiex/main.h +0 -1
@@ -787,7 +787,6 @@ struct mwifiex_adapter {struct mwifiex_wait_queue cmd_wait_q;u8 scan_wait_q_woken;spinlock_t queue_lock;/* lock for tx queues */ -struct completion fw_load;u8 country_code[IEEE80211_COUNTRY_STRING_LEN ];u16 max_mgmt_ie_index;u8 scan_delay_cnt;
drivers/net/wireless/mwifiex/pcie.c +0 -3
@@ -221,9 +221,6 @@ static void mwifiex_pcie_remove(struct pci_dev *pdev)if (!adapter || !adapter->priv_num)return ; -/* In case driver is removed when asynchronous FW load is in progress */ -wait_for_completion (&adapter->fw_load); -if (user_rmmod) {#ifdef CONFIG_PM_SLEEP if (adapter->is_suspended)
drivers/net/wireless/mwifiex/sdio.c +0 -3
@@ -179,9 +179,6 @@ mwifiex_sdio_remove(struct sdio_func *func)if (!adapter || !adapter->priv_num)return ; -/* In case driver is removed when asynchronous FW load is in progress */ -wait_for_completion (&adapter->fw_load); -if (user_rmmod) {if (adapter->is_suspended)mwifiex_sdio_resume (adapter->dev);
drivers/net/wireless/mwifiex/usb.c +0 -5
@@ -543,11 +543,6 @@ static void mwifiex_usb_disconnect(struct usb_interface *intf)if (!adapter->priv_num)return ; -/* In case driver is removed when asynchronous FW downloading is -* in progress -*/ -wait_for_completion (&adapter->fw_load); -if (user_rmmod) {#ifdef CONFIG_PM if (adapter->is_suspended)
Signature · 1 line
1.8.2.3