rsi: Adding support for bgscan, 5GHz support and clean up of code
PATCH 1/1 rsi: Adding support for bgscan, 5GHz support and clean up of code
From: Jahnavi Meher <[email protected]>
This patch adds code for support of bgscan and 5GHz. It also contains changes to the piece of code that determines the number of packets to be de-queued from soft queues - it is changed from a fixed number to a count based on txop. There are also a number of small clean ups.
--- rsi_91x_core.c | 81 ++++++++++++++++++++--------- rsi_91x_debugfs.c | 10 +-- rsi_91x_mac80211.c | 110 +++++++++++++++++++++++++++++++++------ rsi_91x_main.c | 2 rsi_91x_mgmt.c | 148 +++++++++++++++++++++++++++++++++++++++++++---------- rsi_91x_sdio_ops.c | 4 - rsi_main.h | 14 +++++ rsi_mgmt.h | 2 rsi_sdio.h | 4 - 9 files changed, 299 insertions(+), 76 deletions(-)
drivers/net/wireless/rsi/rsi_91x_core.c +58 -23
@@ -77,6 +77,50 @@ static bool rsi_recalculate_weights(stru }/** +* rsi_get_num_pkts_dequeue() - This function determines the number of +* packets to be dequeued based on the number +* of bytes calculated using txop. +* +* @common: Pointer to the driver private structure. +* @q_num: the queue from which pkts have to be dequeued +* +* Return: pkt_num: Number of pkts to be dequeued. +*/ +static u32 rsi_get_num_pkts_dequeue (struct rsi_common *common,u8 q_num) +{ +struct rsi_hw *adapter = common->priv; +struct sk_buff *skb; +u32 pkt_cnt =0 ; +s16 txop = common->tx_qinfo[q_num].txop *32 ; +struct ieee80211_rate rate; + rate.bitrate =RSI_RATE_MCS0 *5 *10 ; + +if (q_num ==VI_Q ) + txop = ((txop <<5 ) /80 ); + +if (skb_queue_len (&common->tx_queue[q_num])) + skb =skb_peek (&common->tx_queue[q_num]); +else +return 0 ; + +do { + txop -=ieee80211_generic_frame_duration (adapter->hw, + adapter->vifs[0 ], + common->band, + skb->len, &rate); + pkt_cnt +=1 ; +/*checking if pkts are still there*/ +if (skb_queue_len (&common->tx_queue[q_num]) - pkt_cnt) + skb = skb->next; +else +break ; + + }while (txop >0 ); + +return pkt_cnt; +} + +/** * rsi_core_determine_hal_queue() - This function determines the queue from * which packet has to be dequeued. * @common: Pointer to the driver private structure.
@@ -88,7 +132,7 @@ static u8 rsi_core_determine_hal_queue(sbool recontend_queue = false;u32 q_len =0 ;u8 q_num =INVALID_QUEUE ; -u8 ii =0 , min =0 ; +u8 ii =0 ;if (skb_queue_len (&common->tx_queue[MGMT_SOFT_Q ])) {if (!common->mgmt_q_block)
@@ -106,14 +150,15 @@ get_queue_num: q_num =rsi_determine_min_weight_queue (common); - q_len =skb_queue_len (&common->tx_queue[ii]); ii = q_num;/* Selecting the queue with least back off */ for (; ii <NUM_EDCA_QUEUES ; ii++) { + q_len =skb_queue_len (&common->tx_queue[ii]);if (((common->tx_qinfo[ii].pkt_contended) && - (common->tx_qinfo[ii].weight < min)) && q_len) { - min = common->tx_qinfo[ii].weight; + (common->tx_qinfo[ii].weight < common->min_weight)) && + q_len) { + common->min_weight = common->tx_qinfo[ii].weight; q_num = ii; } }
@@ -140,25 +185,11 @@ get_queue_num: common->selected_qnum = q_num; q_len =skb_queue_len (&common->tx_queue[q_num]); -switch (common->selected_qnum) { -case VO_Q : -if (q_len >MAX_CONTINUOUS_VO_PKTS ) - common->pkt_cnt = (MAX_CONTINUOUS_VO_PKTS -1 ); -else - common->pkt_cnt = --q_len; -break ; - -case VI_Q : -if (q_len >MAX_CONTINUOUS_VI_PKTS ) - common->pkt_cnt = (MAX_CONTINUOUS_VI_PKTS -1 ); -else - common->pkt_cnt = --q_len; - -break ; - -default : +if (q_num ==VO_Q || q_num ==VI_Q ) { + common->pkt_cnt =rsi_get_num_pkts_dequeue (common, q_num); + common->pkt_cnt -=1 ; + }else { common->pkt_cnt =0 ; -break ; }return q_num;
@@ -245,13 +276,16 @@ void rsi_core_qos_processor(struct rsi_cif ((q_num <MGMT_SOFT_Q ) && ((skb_queue_len (&common->tx_queue[q_num])) <=MIN_DATA_QUEUE_WATER_MARK )) { -if (ieee80211_queue_stopped (adapter->hw,WME_AC (q_num))) +if (ieee80211_queue_stopped (adapter->hw, +WME_AC (q_num))) {ieee80211_wake_queue (adapter->hw,WME_AC (q_num)); + } } skb =rsi_core_dequeue_pkt (common, q_num);if (skb ==NULL ) { +rsi_dbg (ERR_ZONE ,"skb null\n" );mutex_unlock (&common->tx_rxlock);break ; }
@@ -325,6 +359,7 @@ void rsi_core_xmit(struct rsi_common *coif ((q_num !=MGMT_SOFT_Q ) && ((skb_queue_len (&common->tx_queue[q_num]) +1 ) >=DATA_QUEUE_WATER_MARK )) { +rsi_dbg (ERR_ZONE ,"%s: sw queue full\n" , __func__);if (!ieee80211_queue_stopped (adapter->hw,WME_AC (q_num)))ieee80211_stop_queue (adapter->hw,WME_AC (q_num));rsi_set_event (&common->tx_thread.event);
drivers/net/wireless/rsi/rsi_91x_debugfs.c +5 -5
@@ -145,7 +145,7 @@ static int rsi_stats_read(struct seq_filseq_printf (seq,"total_mgmt_pkt_send : %d\n" , common->tx_stats.total_tx_pkt_send[MGMT_SOFT_Q ]);seq_printf (seq,"total_mgmt_pkt_queued : %d\n" , -skb_queue_len (&common->tx_queue[4 ])); +skb_queue_len (&common->tx_queue[MGMT_SOFT_Q ]));seq_printf (seq,"total_mgmt_pkt_freed : %d\n" , common->tx_stats.total_tx_pkt_freed[MGMT_SOFT_Q ]);
@@ -153,25 +153,25 @@ static int rsi_stats_read(struct seq_filseq_printf (seq,"total_data_vo_pkt_send: %8d\t" , common->tx_stats.total_tx_pkt_send[VO_Q ]);seq_printf (seq,"total_data_vo_pkt_queued: %8d\t" , -skb_queue_len (&common->tx_queue[0 ])); +skb_queue_len (&common->tx_queue[VO_Q ]));seq_printf (seq,"total_vo_pkt_freed: %8d\n" , common->tx_stats.total_tx_pkt_freed[VO_Q ]);seq_printf (seq,"total_data_vi_pkt_send: %8d\t" , common->tx_stats.total_tx_pkt_send[VI_Q ]);seq_printf (seq,"total_data_vi_pkt_queued: %8d\t" , -skb_queue_len (&common->tx_queue[1 ])); +skb_queue_len (&common->tx_queue[VI_Q ]));seq_printf (seq,"total_vi_pkt_freed: %8d\n" , common->tx_stats.total_tx_pkt_freed[VI_Q ]);seq_printf (seq,"total_data_be_pkt_send: %8d\t" , common->tx_stats.total_tx_pkt_send[BE_Q ]);seq_printf (seq,"total_data_be_pkt_queued: %8d\t" , -skb_queue_len (&common->tx_queue[2 ])); +skb_queue_len (&common->tx_queue[BE_Q ]));seq_printf (seq,"total_be_pkt_freed: %8d\n" , common->tx_stats.total_tx_pkt_freed[BE_Q ]);seq_printf (seq,"total_data_bk_pkt_send: %8d\t" , common->tx_stats.total_tx_pkt_send[BK_Q ]);seq_printf (seq,"total_data_bk_pkt_queued: %8d\t" , -skb_queue_len (&common->tx_queue[3 ])); +skb_queue_len (&common->tx_queue[BK_Q ]));seq_printf (seq,"total_bk_pkt_freed: %8d\n" , common->tx_stats.total_tx_pkt_freed[BK_Q ]);
drivers/net/wireless/rsi/rsi_91x_mac80211.c +93 -17
188 lines not on this page · raw message
drivers/net/wireless/rsi/rsi_91x_main.c +1 -1
@@ -21,7 +21,7 @@#include "rsi_mgmt.h" #include "rsi_common.h" -u32 rsi_zone_enabled =/* INFO_ZONE | +u32 rsi_zone_enabled =/*INFO_ZONE | INIT_ZONE | MGMT_TX_ZONE | MGMT_RX_ZONE |
drivers/net/wireless/rsi/rsi_91x_mgmt.c +122 -26
229 lines not on this page · raw message
drivers/net/wireless/rsi/rsi_91x_sdio_ops.c +2 -2
@@ -404,9 +404,9 @@ void rsi_interrupt_handler(struct rsi_hw dev->rx_info.mgmt_buffer_full = false;rsi_sdio_ack_intr (common->priv, (1 <<PKT_BUFF_AVAILABLE )); -rsi_set_event ((&common->tx_thread.event)); +rsi_set_event (&common->tx_thread.event);rsi_dbg (ISR_ZONE , -"%s: ==> BUFFER_AVILABLE <==\n" , +"%s: ==> BUFFER_AVAILABLE <==\n" , __func__); dev->rx_info.buf_avilable_counter++;break ;
drivers/net/wireless/rsi/rsi_main.h +14 -0
@@ -19,6 +19,9 @@#include <linux/string.h> #include <linux/skbuff.h> +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/init.h> #include <net/mac80211.h> #define ERR_ZONE BIT(0)/* For Error Msgs */
@@ -115,6 +118,7 @@ struct wmm_qinfo {s32 weight;s32 wme_params;s32 pkt_contended; +s32 txop; };struct transmit_q_stats {
@@ -141,6 +145,12 @@ struct rsi_thread {atomic_t thread_done; }; +struct cqm_info { +char last_cqm_event; +int rssi_thold; +unsigned int rssi_hyst; +}; +struct rsi_hw ;struct rsi_common {
@@ -192,6 +202,10 @@ struct rsi_common {u8 selected_qnum;u32 pkt_cnt;u8 min_weight; + +/* bgscan related */ +struct cqm_info cqm_info; +bool block_state; };struct rsi_hw {
drivers/net/wireless/rsi/rsi_mgmt.h +2 -0
@@ -271,6 +271,7 @@ int rsi_send_aggregation_params_frame(stint rsi_hal_load_key (struct rsi_common *common,u8 *data,u16 key_len,u8 key_type,u8 key_id,u32 cipher);int rsi_set_channel (struct rsi_common *common,u16 chno); +int rsi_send_block_unblock_frame (struct rsi_common *common,bool event);void rsi_inform_bss_status (struct rsi_common *common,u8 status,const u8 *bssid,u8 qos_enable,u16 aid);void rsi_indicate_pkt_to_os (struct rsi_common *common,struct sk_buff *skb);
@@ -282,4 +283,5 @@ void rsi_core_qos_processor(struct rsi_cvoid rsi_core_xmit (struct rsi_common *common,struct sk_buff *skb);int rsi_send_mgmt_pkt (struct rsi_common *common,struct sk_buff *skb);int rsi_send_data_pkt (struct rsi_common *common,struct sk_buff *skb); +int rsi_band_check (struct rsi_common *common);#endif
drivers/net/wireless/rsi/rsi_sdio.h +2 -2
@@ -30,7 +30,7 @@enum sdio_interrupt_type {BUFFER_FULL =0x0 , -BUFFER_AVAILABLE =0x1 , +BUFFER_AVAILABLE =0x2 ,FIRMWARE_ASSERT_IND =0x3 ,MSDU_PACKET_PENDING =0x4 ,UNKNOWN_INT =0XE
@@ -42,7 +42,7 @@ enum sdio_interrupt_type {#define PKT_MGMT_BUFF_FULL 2#define MSDU_PKT_PENDING 3/* Interrupt Bit Related Macros */ -#define PKT_BUFF_AVAILABLE 0 +#define PKT_BUFF_AVAILABLE 1#define FW_ASSERT_IND 2#define RSI_DEVICE_BUFFER_STATUS_REGISTER 0xf3
Quoted 1 line · Jahnavi Meher
This patch adds code for support of bgscan and 5GHz.
[]
Quoted 1 line
There are also a number of small clean ups.
[]
Quoted 1 line
diff -uprN
b/drivers/net/wireless/rsi/rsi_91x_mac80211.ca/drivers/net/wireless/rsi/rsi_91x_mac80211.c
[]
drivers/net/wireless/rsi/rsi_91x_mac80211.c static void rsi_mac80211_tx(struct ieee8 · line 248
Quoted 8 lines
drivers/net/wireless/rsi/rsi_91x_mac80211.c +1
-1@@ -243,8 +243,8 @@ static void rsi_mac80211_tx(struct ieee8 {struct rsi_hw *adapter = hw->priv;struct rsi_common *common = adapter->priv; -rsi_core_xmit (common, skb); +return ; }
Adding unnecessary returns at the end of a void function is not an improvement.
Quoted 8 lines · Jahnavi Meher
From: Jahnavi Meher <[email protected]>
This patch adds code for support of bgscan and 5GHz. It also contains changes to the piece of code that determines the number of packets to be de-queued from soft queues - it is changed from a fixed number to a count based on txop. There are also a number of small clean ups.
Signed-off-by Jahnavi Meher <[email protected]>
Patches should always contain one logical change per patch. This patch adds three new features plus small clean ups, that's too much. For example, you could split the patches like this:
1. add 5 GHz
2. add bgscan
3. queue change
4. small cleanups (one or more patches depending on the changes)
Signature · 1 line
Kalle Valo