mwifiex updates for 3.14
cover mwifiex updates for 3.14
These patches improve statistics update as well as endian conversion. Some of them appear to be suitable for earlier kernel versions but I want to have them well cooked in 3.14.
Amitkumar Karwar (5):
mwifiex: declare snap_type as __be16 variable
mwifiex: remove rfc1042_eth_hdr variable
mwifiex: fix an issue with Appletalk devices
mwifiex: remove redundant goto exit_remove statement
mwifiex: improvements in mwifiex_ret_tx_power_cfg()
Bing Zhao (1):
mwifiex: avoid using variable name eth_hdr
Ujjal Roy (6):
mwifiex: use little-endian variables in firmware structures
mwifiex: fix rx_pending count imbalance
mwifiex: correct RX byte count statistics
mwifiex: correct TX byte count statistics
mwifiex: update statistics for bridged packets on AP interface
mwifiex: do not flood kmsg/dmesg with USB debug messages
drivers/net/wireless/mwifiex/11n_aggr.c | 6 ++-- drivers/net/wireless/mwifiex/cfg80211.c | 1 + drivers/net/wireless/mwifiex/cmdevt.c | 4 +-- drivers/net/wireless/mwifiex/decl.h | 1 + drivers/net/wireless/mwifiex/fw.h | 30 ++++++++++---------- drivers/net/wireless/mwifiex/init.c | 3 +- drivers/net/wireless/mwifiex/main.c | 9 ++---- drivers/net/wireless/mwifiex/main.h | 2 +- drivers/net/wireless/mwifiex/sta_cmd.c | 2 +- drivers/net/wireless/mwifiex/sta_cmdresp.c | 35 +++++++++++------------- drivers/net/wireless/mwifiex/sta_rx.c | 44 +++++++++++++----------------- drivers/net/wireless/mwifiex/sta_tx.c | 1 + drivers/net/wireless/mwifiex/txrx.c | 15 +++++++--- drivers/net/wireless/mwifiex/uap_txrx.c | 39 +++++++++++++++----------- drivers/net/wireless/mwifiex/usb.c | 4 +-- drivers/net/wireless/mwifiex/util.c | 5 ++-- 16 files changed, 103 insertions(+), 98 deletions(-)
Signature · 1 line
1.8.2.3
PATCH 1/12 mwifiex: use little-endian variables in firmware structures
From: Ujjal Roy <[email protected]>
The firmware expects the command structure members in little endianness.
--- drivers/net/wireless/mwifiex/cmdevt.c | 4 ++-- drivers/net/wireless/mwifiex/fw.h | 28 ++++++++++++++-------------- drivers/net/wireless/mwifiex/sta_cmd.c | 2 +- 3 files changed, 17 insertions(+), 17 deletions(-)
drivers/net/wireless/mwifiex/cmdevt.c +2 -2
@@ -312,14 +312,14 @@ static int mwifiex_dnld_sleep_confirm_cmd(struct mwifiex_adapter *adapter) }if (GET_BSS_ROLE (mwifiex_get_priv (adapter,MWIFIEX_BSS_ROLE_ANY )) ==MWIFIEX_BSS_ROLE_STA ) { -if (!sleep_cfm_buf->resp_ctrl) +if (!le16_to_cpu (sleep_cfm_buf->resp_ctrl))/* Response is not needed for sleep confirm command */ adapter->ps_state =PS_STATE_SLEEP ;else adapter->ps_state =PS_STATE_SLEEP_CFM ; -if (!sleep_cfm_buf->resp_ctrl && +if (!le16_to_cpu (sleep_cfm_buf->resp_ctrl) && (adapter->is_hs_configured && !adapter->sleep_period.period)) { adapter->pm_wakeup_card_req = true;
drivers/net/wireless/mwifiex/fw.h +14 -14
@@ -610,12 +610,12 @@ struct mwifiex_ie_types_tsf_timestamp {struct mwifiex_cf_param_set {u8 cfp_cnt;u8 cfp_period; -u16 cfp_max_duration; -u16 cfp_duration_remaining; +__le16 cfp_max_duration; +__le16 cfp_duration_remaining; } __packed;struct mwifiex_ibss_param_set { -u16 atim_window; +__le16 atim_window; } __packed;struct mwifiex_ie_types_ss_param_set {
@@ -627,7 +627,7 @@ struct mwifiex_ie_types_ss_param_set { } __packed;struct mwifiex_fh_param_set { -u16 dwell_time; +__le16 dwell_time;u8 hop_set;u8 hop_pattern;u8 hop_index;
@@ -684,10 +684,10 @@ struct host_cmd_ds_802_11_key_material { } __packed;struct host_cmd_ds_gen { -u16 command; -u16 size; -u16 seq_num; -u16 result; +__le16 command; +__le16 size; +__le16 seq_num; +__le16 result; };#define S_DS_GEN sizeof(struct host_cmd_ds_gen)
@@ -820,8 +820,8 @@ struct ieee_types_cf_param_set {u8 len;u8 cfp_cnt;u8 cfp_period; -u16 cfp_max_duration; -u16 cfp_duration_remaining; +__le16 cfp_max_duration; +__le16 cfp_duration_remaining; } __packed;struct ieee_types_ibss_param_set {
@@ -957,7 +957,7 @@ struct mwifiex_hs_config_param { } __packed;struct hs_activate_param { -u16 resp_ctrl; +__le16 resp_ctrl; } __packed;struct host_cmd_ds_802_11_hs_cfg_enh {
@@ -1131,7 +1131,7 @@ struct host_cmd_ds_802_11_bg_scan_query { } __packed;struct host_cmd_ds_802_11_bg_scan_query_rsp { -u32 report_condition; +__le32 report_condition;struct host_cmd_ds_802_11_scan_rsp scan_resp; } __packed;
@@ -1230,7 +1230,7 @@ struct mwifiex_ie_types_wmm_queue_status {struct mwifiex_ie_types_header header;u8 queue_index;u8 disabled; -u16 medium_time; +__le16 medium_time;u8 flow_required;u8 flow_created;u32 reserved;
@@ -1310,7 +1310,7 @@ struct mwifiex_ie_types_vht_oper {u8 chan_center_freq_1;u8 chan_center_freq_2;/* Basic MCS set map, each 2 bits stands for a NSS */ -u16 basic_mcs_map; +__le16 basic_mcs_map; } __packed;struct mwifiex_ie_types_wmmcap {
drivers/net/wireless/mwifiex/sta_cmd.c +1 -1
@@ -354,7 +354,7 @@ mwifiex_cmd_802_11_hs_cfg(struct mwifiex_private *priv, }if (hs_activate) { hs_cfg->action =cpu_to_le16 (HS_ACTIVATE ); - hs_cfg->params.hs_activate.resp_ctrl =RESP_NEEDED ; + hs_cfg->params.hs_activate.resp_ctrl =cpu_to_le16 (RESP_NEEDED ); }else { hs_cfg->action =cpu_to_le16 (HS_CONFIGURE ); hs_cfg->params.hs_config.conditions = hscfg_param->conditions;
Signature · 1 line
1.8.2.3
PATCH 2/12 mwifiex: declare snap_type as __be16 variable
In reply to Bing ZhaoFrom: Amitkumar Karwar <[email protected]>
Actually we are updating snap_type with h_proto (__be16 variable) in ethernet frame header. Hence endianness conversion is not required.
--- drivers/net/wireless/mwifiex/11n_aggr.c | 6 +++--- drivers/net/wireless/mwifiex/fw.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/wireless/mwifiex/11n_aggr.c +3 -3
@@ -69,9 +69,9 @@ mwifiex_11n_form_amsdu_pkt(struct sk_buff *skb_aggr,memcpy (&tx_header->eth803_hdr, skb_src->data, dt_offset);/* Copy SNAP header */ - snap.snap_type = -le16_to_cpu (*(__le16 *) ((u8 *)skb_src->data + dt_offset)); - dt_offset +=sizeof (u16); + snap.snap_type = ((struct ethhdr *)skb_src->data)->h_proto; + + dt_offset +=sizeof (__be16);memcpy (&tx_header->rfc1042_hdr, &snap,sizeof (struct rfc_1042_hdr ));
drivers/net/wireless/mwifiex/fw.h +1 -1
@@ -30,7 +30,7 @@ struct rfc_1042_hdr {u8 llc_ssap;u8 llc_ctrl;u8 snap_oui[3 ]; -u16 snap_type; +__be16 snap_type; };struct rx_packet_hdr {
Signature · 1 line
1.8.2.3
PATCH 3/12 mwifiex: remove rfc1042_eth_hdr variable
In reply to Bing ZhaoFrom: Amitkumar Karwar <[email protected]>
Use 'rfc1042_header' available in net/wireless/util.c
--- drivers/net/wireless/mwifiex/sta_rx.c | 5 ++--- drivers/net/wireless/mwifiex/uap_txrx.c | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-)
drivers/net/wireless/mwifiex/sta_rx.c +2 -3
@@ -88,15 +88,14 @@ int mwifiex_process_rx_packet(struct mwifiex_private *priv,struct rxpd *local_rx_pd;int hdr_chop;struct ethhdr *eth_hdr; -u8 rfc1042_eth_hdr[ETH_ALEN ] = {0xaa ,0xaa ,0x03 ,0x00 ,0x00 ,0x00 }; local_rx_pd = (struct rxpd *) (skb->data); rx_pkt_hdr = (void *)local_rx_pd +le16_to_cpu (local_rx_pd->rx_pkt_offset); -if (!memcmp (&rx_pkt_hdr->rfc1042_hdr, - rfc1042_eth_hdr,sizeof (rfc1042_eth_hdr))) { +if (!memcmp (&rx_pkt_hdr->rfc1042_hdr, rfc1042_header, +sizeof (rfc1042_header))) {/* * Replace the 803 header and rfc1042 header (llc/snap) with an * EthernetII header, keep the src/dst and snap_type
drivers/net/wireless/mwifiex/uap_txrx.c +2 -3
@@ -98,7 +98,6 @@ static void mwifiex_uap_queue_bridged_pkt(struct mwifiex_private *priv,int hdr_chop;struct timeval tv;struct ethhdr *p_ethhdr; -u8 rfc1042_eth_hdr[ETH_ALEN ] = {0xaa ,0xaa ,0x03 ,0x00 ,0x00 ,0x00 }; uap_rx_pd = (struct uap_rxpd *)(skb->data); rx_pkt_hdr = (void *)uap_rx_pd +le16_to_cpu (uap_rx_pd->rx_pkt_offset);
@@ -112,8 +111,8 @@ static void mwifiex_uap_queue_bridged_pkt(struct mwifiex_private *priv,return ; } -if (!memcmp (&rx_pkt_hdr->rfc1042_hdr, - rfc1042_eth_hdr,sizeof (rfc1042_eth_hdr))) { +if (!memcmp (&rx_pkt_hdr->rfc1042_hdr, rfc1042_header, +sizeof (rfc1042_header))) {/* Replace the 803 header and rfc1042 header (llc/snap) with * an Ethernet II header, keep the src/dst and snap_type * (ethertype).
Signature · 1 line
1.8.2.3
PATCH 4/12 mwifiex: fix an issue with Appletalk devices
In reply to Bing ZhaoFrom: Amitkumar Karwar <[email protected]>
SNAP/LLC header in the AARP packet is being stripped off while preparing an EthernetII header.
Annex M, Table M.3 in 802.11 spec says that some header (ex. AppleTalk AARP(2)) should pass through untouched. This patch modifies the check to exclude/include EthernetII header translation for special cases.
--- drivers/net/wireless/mwifiex/sta_rx.c | 8 ++++++-- drivers/net/wireless/mwifiex/uap_txrx.c | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-)
drivers/net/wireless/mwifiex/sta_rx.c +6 -2
@@ -94,8 +94,12 @@ int mwifiex_process_rx_packet(struct mwifiex_private *priv, rx_pkt_hdr = (void *)local_rx_pd +le16_to_cpu (local_rx_pd->rx_pkt_offset); -if (!memcmp (&rx_pkt_hdr->rfc1042_hdr, rfc1042_header, -sizeof (rfc1042_header))) { +if ((!memcmp (&rx_pkt_hdr->rfc1042_hdr, bridge_tunnel_header, +sizeof (bridge_tunnel_header))) || + (!memcmp (&rx_pkt_hdr->rfc1042_hdr, rfc1042_header, +sizeof (rfc1042_header)) && +ntohs (rx_pkt_hdr->rfc1042_hdr.snap_type) !=ETH_P_AARP && +ntohs (rx_pkt_hdr->rfc1042_hdr.snap_type) !=ETH_P_IPX )) {/* * Replace the 803 header and rfc1042 header (llc/snap) with an * EthernetII header, keep the src/dst and snap_type
drivers/net/wireless/mwifiex/uap_txrx.c +6 -2
@@ -111,8 +111,12 @@ static void mwifiex_uap_queue_bridged_pkt(struct mwifiex_private *priv,return ; } -if (!memcmp (&rx_pkt_hdr->rfc1042_hdr, rfc1042_header, -sizeof (rfc1042_header))) { +if ((!memcmp (&rx_pkt_hdr->rfc1042_hdr, bridge_tunnel_header, +sizeof (bridge_tunnel_header))) || + (!memcmp (&rx_pkt_hdr->rfc1042_hdr, rfc1042_header, +sizeof (rfc1042_header)) && +ntohs (rx_pkt_hdr->rfc1042_hdr.snap_type) !=ETH_P_AARP && +ntohs (rx_pkt_hdr->rfc1042_hdr.snap_type) !=ETH_P_IPX )) {/* Replace the 803 header and rfc1042 header (llc/snap) with * an Ethernet II header, keep the src/dst and snap_type * (ethertype).
Signature · 1 line
1.8.2.3
PATCH 5/12 mwifiex: avoid using variable name eth_hdr
In reply to Bing Zhaoeth_hdr is defined in kernel. Use a different variable name in our functions.
--- drivers/net/wireless/mwifiex/sta_rx.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/net/wireless/mwifiex/sta_rx.c +10 -10
@@ -36,12 +36,12 @@ mwifiex_discard_gratuitous_arp(struct mwifiex_private *priv, struct sk_buff *skb) {const struct mwifiex_arp_eth_header *arp; -struct ethhdr *eth_hdr; +struct ethhdr *eth;struct ipv6hdr *ipv6;struct icmp6hdr *icmpv6; - eth_hdr = (struct ethhdr *)skb->data; -switch (ntohs (eth_hdr->h_proto)) { + eth = (struct ethhdr *)skb->data; +switch (ntohs (eth->h_proto)) {case ETH_P_ARP : arp = (void *)(skb->data +sizeof (struct ethhdr )); if (arp->hdr.ar_op == htons(ARPOP_REPLY) ||
@@ -87,7 +87,7 @@ int mwifiex_process_rx_packet(struct mwifiex_private *priv,struct rx_packet_hdr *rx_pkt_hdr;struct rxpd *local_rx_pd;int hdr_chop; -struct ethhdr *eth_hdr; +struct ethhdr *eth; local_rx_pd = (struct rxpd *) (skb->data);
@@ -109,7 +109,7 @@ int mwifiex_process_rx_packet(struct mwifiex_private *priv,* To create the Ethernet II, just move the src, dst address * right before the snap_type. */ - eth_hdr = (struct ethhdr *) + eth = (struct ethhdr *) ((u8 *) &rx_pkt_hdr->eth803_hdr +sizeof (rx_pkt_hdr->eth803_hdr) + sizeof(rx_pkt_hdr->rfc1042_hdr)
@@ -117,14 +117,14 @@ int mwifiex_process_rx_packet(struct mwifiex_private *priv, -sizeof (rx_pkt_hdr->eth803_hdr.h_source) - sizeof(rx_pkt_hdr->rfc1042_hdr.snap_type)); -memcpy (eth_hdr->h_source, rx_pkt_hdr->eth803_hdr.h_source, -sizeof (eth_hdr->h_source)); -memcpy (eth_hdr->h_dest, rx_pkt_hdr->eth803_hdr.h_dest, -sizeof (eth_hdr->h_dest)); +memcpy (eth->h_source, rx_pkt_hdr->eth803_hdr.h_source, +sizeof (eth->h_source)); +memcpy (eth->h_dest, rx_pkt_hdr->eth803_hdr.h_dest, +sizeof (eth->h_dest));/* Chop off the rxpd + the excess memory from the 802.2/llc/snap header that was removed. */ - hdr_chop = (u8 *) eth_hdr - (u8 *) local_rx_pd; + hdr_chop = (u8 *) eth - (u8 *) local_rx_pd; }else {/* Chop off the rxpd */ hdr_chop = (u8 *) &rx_pkt_hdr->eth803_hdr -
Signature · 1 line
1.8.2.3
PATCH 6/12 mwifiex: fix rx_pending count imbalance
In reply to Bing ZhaoFrom: Ujjal Roy <[email protected]>
RX packets are handled in different paths. Not all paths have decrement of rx_pending counter. This patch fixes the counter imbalance.
--- drivers/net/wireless/mwifiex/init.c | 3 ++- drivers/net/wireless/mwifiex/main.h | 2 +- drivers/net/wireless/mwifiex/sta_rx.c | 15 +++------------ drivers/net/wireless/mwifiex/txrx.c | 11 +++++++++-- drivers/net/wireless/mwifiex/uap_txrx.c | 15 +++------------ drivers/net/wireless/mwifiex/usb.c | 4 +--- 6 files changed, 19 insertions(+), 31 deletions(-)
drivers/net/wireless/mwifiex/init.c +2 -1
@@ -643,7 +643,8 @@ mwifiex_shutdown_drv(struct mwifiex_adapter *adapter)if (priv) priv->stats.rx_dropped++; - adapter->if_ops.data_complete (adapter, skb); +dev_kfree_skb_any (skb); + adapter->if_ops.data_complete (adapter); } }
drivers/net/wireless/mwifiex/main.h +1 -1
@@ -615,7 +615,7 @@ struct mwifiex_if_ops {void (*cleanup_mpa_buf) (struct mwifiex_adapter *);int (*cmdrsp_complete) (struct mwifiex_adapter *,struct sk_buff *);int (*event_complete) (struct mwifiex_adapter *,struct sk_buff *); -int (*data_complete) (struct mwifiex_adapter *,struct sk_buff *); +int (*data_complete) (struct mwifiex_adapter *);int (*init_fw_port) (struct mwifiex_adapter *);int (*dnld_fw) (struct mwifiex_adapter *,struct mwifiex_fw_image *);void (*card_reset) (struct mwifiex_adapter *);
drivers/net/wireless/mwifiex/sta_rx.c +3 -12
@@ -188,12 +188,7 @@ int mwifiex_process_sta_rx_packet(struct mwifiex_private *priv,"wrong rx packet: len=%d, rx_pkt_offset=%d, rx_pkt_length=%d\n" , skb->len, rx_pkt_offset, rx_pkt_length); priv->stats.rx_dropped++; - -if (adapter->if_ops.data_complete) - adapter->if_ops.data_complete (adapter, skb); -else -dev_kfree_skb_any (skb); - +dev_kfree_skb_any (skb);return ret; }
@@ -247,12 +242,8 @@ int mwifiex_process_sta_rx_packet(struct mwifiex_private *priv, ret =mwifiex_11n_rx_reorder_pkt (priv, seq_num, local_rx_pd->priority, ta, (u8 ) rx_pkt_type, skb); -if (ret || (rx_pkt_type ==PKT_TYPE_BAR )) { -if (adapter->if_ops.data_complete) - adapter->if_ops.data_complete (adapter, skb); -else -dev_kfree_skb_any (skb); - } +if (ret || (rx_pkt_type ==PKT_TYPE_BAR )) +dev_kfree_skb_any (skb);if (ret) priv->stats.rx_dropped++;
drivers/net/wireless/mwifiex/txrx.c +9 -2
@@ -40,6 +40,7 @@ int mwifiex_handle_rx_packet(struct mwifiex_adapter *adapter,mwifiex_get_priv (adapter,MWIFIEX_BSS_ROLE_ANY );struct rxpd *local_rx_pd;struct mwifiex_rxinfo *rx_info =MWIFIEX_SKB_RXCB (skb); +int ret; local_rx_pd = (struct rxpd *) (skb->data);/* Get the BSS number from rxpd, get corresponding priv */
@@ -58,9 +59,15 @@ int mwifiex_handle_rx_packet(struct mwifiex_adapter *adapter, rx_info->bss_type = priv->bss_type;if (priv->bss_role ==MWIFIEX_BSS_ROLE_UAP ) -return mwifiex_process_uap_rx_packet (priv, skb); + ret =mwifiex_process_uap_rx_packet (priv, skb); +else + ret =mwifiex_process_sta_rx_packet (priv, skb); + +/* Decrement RX pending counter for each packet */ +if (adapter->if_ops.data_complete) + adapter->if_ops.data_complete (adapter); -return mwifiex_process_sta_rx_packet (priv, skb); +return ret; }EXPORT_SYMBOL_GPL (mwifiex_handle_rx_packet);
drivers/net/wireless/mwifiex/uap_txrx.c +3 -12
@@ -267,12 +267,7 @@ int mwifiex_process_uap_rx_packet(struct mwifiex_private *priv, skb->len,le16_to_cpu (uap_rx_pd->rx_pkt_offset), le16_to_cpu(uap_rx_pd->rx_pkt_length)); priv->stats.rx_dropped++; - -if (adapter->if_ops.data_complete) - adapter->if_ops.data_complete (adapter, skb); -else -dev_kfree_skb_any (skb); - +dev_kfree_skb_any (skb);return 0 ; }
@@ -326,12 +321,8 @@ int mwifiex_process_uap_rx_packet(struct mwifiex_private *priv, uap_rx_pd->priority, ta, pkt_type, skb); -if (ret || (rx_pkt_type ==PKT_TYPE_BAR )) { -if (adapter->if_ops.data_complete) - adapter->if_ops.data_complete (adapter, skb); -else -dev_kfree_skb_any (skb); - } +if (ret || (rx_pkt_type ==PKT_TYPE_BAR )) +dev_kfree_skb_any (skb);if (ret) priv->stats.rx_dropped++;
drivers/net/wireless/mwifiex/usb.c +1 -3
@@ -938,11 +938,9 @@ static int mwifiex_usb_cmd_event_complete(struct mwifiex_adapter *adapter,return 0 ; } -static int mwifiex_usb_data_complete (struct mwifiex_adapter *adapter, -struct sk_buff *skb) +static int mwifiex_usb_data_complete (struct mwifiex_adapter *adapter) {atomic_dec (&adapter->rx_pending); -dev_kfree_skb_any (skb);return 0 ; }
Signature · 1 line
1.8.2.3
PATCH 7/12 mwifiex: correct RX byte count statistics
In reply to Bing ZhaoFrom: Ujjal Roy <[email protected]>
The skb is modified in processing the RX packet. Save the original packet length to a variable so that we can get the correct statistics update.
--- drivers/net/wireless/mwifiex/util.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/wireless/mwifiex/util.c +3 -2
@@ -191,6 +191,9 @@ int mwifiex_recv_packet(struct mwifiex_private *priv, struct sk_buff *skb)if (!skb)return -1 ; + priv->stats.rx_bytes += skb->len; + priv->stats.rx_packets++; + skb->dev = priv->netdev; skb->protocol =eth_type_trans (skb, priv->netdev); skb->ip_summed =CHECKSUM_NONE ;
@@ -217,8 +220,6 @@ int mwifiex_recv_packet(struct mwifiex_private *priv, struct sk_buff *skb) (skb->truesize > MWIFIEX_RX_DATA_BUF_SIZE)) skb->truesize += (skb->len - MWIFIEX_RX_DATA_BUF_SIZE); - priv->stats.rx_bytes += skb->len; - priv->stats.rx_packets++;if (in_interrupt ())netif_rx (skb);else
Signature · 1 line
1.8.2.3
PATCH 8/12 mwifiex: correct TX byte count statistics
In reply to Bing ZhaoFrom: Ujjal Roy <[email protected]>
The skb is modified in sending the TX packet. Save the original packet length to a variable so that we can get the correct statistics update.
--- drivers/net/wireless/mwifiex/cfg80211.c | 1 + drivers/net/wireless/mwifiex/decl.h | 1 + drivers/net/wireless/mwifiex/main.c | 1 + drivers/net/wireless/mwifiex/sta_tx.c | 1 + drivers/net/wireless/mwifiex/txrx.c | 2 +- 5 files changed, 5 insertions(+), 1 deletion(-)
drivers/net/wireless/mwifiex/cfg80211.c +1 -0
@@ -222,6 +222,7 @@ mwifiex_cfg80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, tx_info =MWIFIEX_SKB_TXCB (skb); tx_info->bss_num = priv->bss_num; tx_info->bss_type = priv->bss_type; + tx_info->pkt_len = pkt_len;mwifiex_form_mgmt_frame (skb, buf, len);mwifiex_queue_tx_pkt (priv, skb);
drivers/net/wireless/mwifiex/decl.h +1 -0
@@ -130,6 +130,7 @@ struct mwifiex_txinfo {u8 flags;u8 bss_num;u8 bss_type; +u32 pkt_len; };enum mwifiex_wmm_ac_e {
drivers/net/wireless/mwifiex/main.c +1 -0
@@ -648,6 +648,7 @@ mwifiex_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) tx_info =MWIFIEX_SKB_TXCB (skb); tx_info->bss_num = priv->bss_num; tx_info->bss_type = priv->bss_type; + tx_info->pkt_len = skb->len;/* Record the current time the packet was queued; used to * determine the amount of time the packet was queued in
drivers/net/wireless/mwifiex/sta_tx.c +1 -0
@@ -148,6 +148,7 @@ int mwifiex_send_null_packet(struct mwifiex_private *priv, u8 flags) tx_info =MWIFIEX_SKB_TXCB (skb); tx_info->bss_num = priv->bss_num; tx_info->bss_type = priv->bss_type; + tx_info->pkt_len = data_len - (sizeof (struct txpd ) +INTF_HEADER_LEN );skb_reserve (skb,sizeof (struct txpd ) +INTF_HEADER_LEN );skb_push (skb,sizeof (struct txpd ));
drivers/net/wireless/mwifiex/txrx.c +1 -1
@@ -175,7 +175,7 @@ int mwifiex_write_data_complete(struct mwifiex_adapter *adapter,mwifiex_set_trans_start (priv->netdev);if (!status) { priv->stats.tx_packets++; - priv->stats.tx_bytes += skb->len; + priv->stats.tx_bytes += tx_info->pkt_len;if (priv->tx_timeout_cnt) priv->tx_timeout_cnt =0 ; }else {
Signature · 1 line
1.8.2.3
PATCH 9/12 mwifiex: update statistics for bridged packets on AP interface
In reply to Bing ZhaoFrom: Ujjal Roy <[email protected]>
The bridged packets are updated to statistics on both TX and RX paths. Also fix a typo in the comment.
--- drivers/net/wireless/mwifiex/uap_txrx.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
drivers/net/wireless/mwifiex/uap_txrx.c +14 -1
@@ -147,7 +147,7 @@ static void mwifiex_uap_queue_bridged_pkt(struct mwifiex_private *priv, hdr_chop = (u8 *)&rx_pkt_hdr->eth803_hdr - (u8 *)uap_rx_pd; } -/* Chop off the leading header bytes so the it points +/* Chop off the leading header bytes so that it points * to the start of either the reconstructed EthII frame * or the 802.2/llc/snap frame. */
@@ -179,6 +179,19 @@ static void mwifiex_uap_queue_bridged_pkt(struct mwifiex_private *priv, tx_info->bss_type = priv->bss_type; tx_info->flags |=MWIFIEX_BUF_FLAG_BRIDGED_PKT ; +if (is_unicast_ether_addr (rx_pkt_hdr->eth803_hdr.h_dest)) { +/* Update bridge packet statistics as the +* packet is not going to kernel/upper layer. +*/ + priv->stats.rx_bytes += skb->len; + priv->stats.rx_packets++; + +/* Sending bridge packet to TX queue, so save the packet +* length in TXCB to update statistics in TX complete. +*/ + tx_info->pkt_len = skb->len; + } +do_gettimeofday (&tv); skb->tstamp =timeval_to_ktime (tv);mwifiex_wmm_add_buf_txqueue (priv, skb);
Signature · 1 line
1.8.2.3
PATCH 10/12 mwifiex: remove redundant goto exit_remove statement
In reply to Bing ZhaoFrom: Amitkumar Karwar <[email protected]>
The check for 'priv' pointer is redundant. 'priv' won't be used later in this routine.
--- drivers/net/wireless/mwifiex/main.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/net/wireless/mwifiex/main.c +2 -6
@@ -992,12 +992,8 @@ int mwifiex_remove_card(struct mwifiex_adapter *adapter, struct semaphore *sem)rtnl_unlock (); } - priv = adapter->priv[0 ]; -if (!priv || !priv->wdev) - goto exit_remove; - -wiphy_unregister (priv->wdev->wiphy); -wiphy_free (priv->wdev->wiphy); +wiphy_unregister (adapter->wiphy); +wiphy_free (adapter->wiphy);mwifiex_terminate_workqueue (adapter);
Signature · 1 line
1.8.2.3
PATCH 11/12 mwifiex: improvements in mwifiex_ret_tx_power_cfg()
In reply to Bing ZhaoFrom: Amitkumar Karwar <[email protected]>
1) Move common code out of switch case handling
2) Return from the function if number of bytes left in response buffer are less than tlv size
3) Pass pg_tlv_hdr directly instead of txp_cfg to mwifiex_get_power_level()
--- drivers/net/wireless/mwifiex/sta_cmdresp.c | 35 ++++++++++++++---------------- 1 file changed, 16 insertions(+), 19 deletions(-)
drivers/net/wireless/mwifiex/sta_cmdresp.c +16 -19
@@ -338,8 +338,7 @@ static int mwifiex_get_power_level(struct mwifiex_private *priv, void *data_buf)if (!data_buf)return -1 ; - pg_tlv_hdr = (struct mwifiex_types_power_group *) - ((u8 *) data_buf +sizeof (struct host_cmd_ds_txpwr_cfg )); + pg_tlv_hdr = (struct mwifiex_types_power_group *)((u8 *)data_buf); pg = (struct mwifiex_power_group *) ((u8 *) pg_tlv_hdr +sizeof (struct mwifiex_types_power_group )); length =le16_to_cpu (pg_tlv_hdr->length);
@@ -383,19 +382,25 @@ static int mwifiex_ret_tx_power_cfg(struct mwifiex_private *priv,struct mwifiex_types_power_group *pg_tlv_hdr;struct mwifiex_power_group *pg;u16 action =le16_to_cpu (txp_cfg->action); +u16 tlv_buf_left; -switch (action) { -case HostCmd_ACT_GEN_GET: - pg_tlv_hdr = (struct mwifiex_types_power_group *) - ((u8 *) txp_cfg + -sizeof (struct host_cmd_ds_txpwr_cfg )); + pg_tlv_hdr = (struct mwifiex_types_power_group *) + ((u8 *)txp_cfg + +sizeof (struct host_cmd_ds_txpwr_cfg )); - pg = (struct mwifiex_power_group *) - ((u8 *) pg_tlv_hdr + -sizeof (struct mwifiex_types_power_group )); + pg = (struct mwifiex_power_group *) + ((u8 *)pg_tlv_hdr + +sizeof (struct mwifiex_types_power_group )); + tlv_buf_left =le16_to_cpu (resp->size) -S_DS_GEN -sizeof (*txp_cfg); +if (tlv_buf_left < +le16_to_cpu (pg_tlv_hdr->length) +sizeof (*pg_tlv_hdr)) +return 0 ; + +switch (action) { +case HostCmd_ACT_GEN_GET:if (adapter->hw_status ==MWIFIEX_HW_STATUS_INITIALIZING ) -mwifiex_get_power_level (priv, txp_cfg); +mwifiex_get_power_level (priv, pg_tlv_hdr); priv->tx_power_level = (u16 ) pg->power_min;break ;
@@ -404,14 +409,6 @@ static int mwifiex_ret_tx_power_cfg(struct mwifiex_private *priv,if (!le32_to_cpu (txp_cfg->mode))break ; - pg_tlv_hdr = (struct mwifiex_types_power_group *) - ((u8 *) txp_cfg + -sizeof (struct host_cmd_ds_txpwr_cfg )); - - pg = (struct mwifiex_power_group *) - ((u8 *) pg_tlv_hdr + -sizeof (struct mwifiex_types_power_group )); -if (pg->power_max == pg->power_min) priv->tx_power_level = (u16 ) pg->power_min;break ;
Signature · 1 line
1.8.2.3
PATCH 12/12 mwifiex: do not flood kmsg/dmesg with USB debug messages
In reply to Bing ZhaoFrom: Ujjal Roy <[email protected]>
When TX data URB reaches high water mark the message "data: -ENOSR is returned" is printed.
This is not an error case, so change it to debug print.
--- drivers/net/wireless/mwifiex/txrx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mwifiex/txrx.c +1 -1
@@ -112,7 +112,7 @@ int mwifiex_process_tx(struct mwifiex_private *priv, struct sk_buff *skb,switch (ret) {case -ENOSR : -dev_err (adapter->dev,"data: -ENOSR is returned\n" ); +dev_dbg (adapter->dev,"data: -ENOSR is returned\n" );break ;case -EBUSY : if ((GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA) &&
Signature · 1 line
1.8.2.3