diff options
author | Jahnavi Meher <jahnavi.meher@gmail.com> | 2014-06-16 10:15:03 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2014-06-19 15:49:22 -0400 |
commit | 360accb0dba1777a4ea85a637c816b7987fa947b (patch) | |
tree | 6667aed5b7f9970686e44738f07b79f79f01addf | |
parent | f75d3419ec2579929a29c4b3b0a7b790c6f6ae24 (diff) |
rsi: Changed the logic of dequeuing packets from hal queues.
The number of packets being dequeued from s/w queues was fixed -
changed it to a dynamic calculation based on txop. There are also
some fixes to the dequeuing algorithm.
Signed-off-by: Jahnavi Meher <jahnavi.meher@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/rsi/rsi_91x_core.c | 80 | ||||
-rw-r--r-- | drivers/net/wireless/rsi/rsi_main.h | 3 |
2 files changed, 59 insertions, 24 deletions
diff --git a/drivers/net/wireless/rsi/rsi_91x_core.c b/drivers/net/wireless/rsi/rsi_91x_core.c index cf61d6e3eaa7..264e8fac83ff 100644 --- a/drivers/net/wireless/rsi/rsi_91x_core.c +++ b/drivers/net/wireless/rsi/rsi_91x_core.c | |||
@@ -77,6 +77,50 @@ static bool rsi_recalculate_weights(struct rsi_common *common) | |||
77 | } | 77 | } |
78 | 78 | ||
79 | /** | 79 | /** |
80 | * rsi_get_num_pkts_dequeue() - This function determines the number of | ||
81 | * packets to be dequeued based on the number | ||
82 | * of bytes calculated using txop. | ||
83 | * | ||
84 | * @common: Pointer to the driver private structure. | ||
85 | * @q_num: the queue from which pkts have to be dequeued | ||
86 | * | ||
87 | * Return: pkt_num: Number of pkts to be dequeued. | ||
88 | */ | ||
89 | static u32 rsi_get_num_pkts_dequeue(struct rsi_common *common, u8 q_num) | ||
90 | { | ||
91 | struct rsi_hw *adapter = common->priv; | ||
92 | struct sk_buff *skb; | ||
93 | u32 pkt_cnt = 0; | ||
94 | s16 txop = common->tx_qinfo[q_num].txop * 32; | ||
95 | struct ieee80211_rate rate; | ||
96 | |||
97 | rate.bitrate = RSI_RATE_MCS0 * 5 * 10; /* Convert to Kbps */ | ||
98 | if (q_num == VI_Q) | ||
99 | txop = ((txop << 5) / 80); | ||
100 | |||
101 | if (skb_queue_len(&common->tx_queue[q_num])) | ||
102 | skb = skb_peek(&common->tx_queue[q_num]); | ||
103 | else | ||
104 | return 0; | ||
105 | |||
106 | do { | ||
107 | txop -= ieee80211_generic_frame_duration(adapter->hw, | ||
108 | adapter->vifs[0], | ||
109 | common->band, | ||
110 | skb->len, &rate); | ||
111 | pkt_cnt += 1; | ||
112 | /*checking if pkts are still there*/ | ||
113 | if (skb_queue_len(&common->tx_queue[q_num]) - pkt_cnt) | ||
114 | skb = skb->next; | ||
115 | else | ||
116 | break; | ||
117 | |||
118 | } while (txop > 0); | ||
119 | |||
120 | return pkt_cnt; | ||
121 | } | ||
122 | |||
123 | /** | ||
80 | * rsi_core_determine_hal_queue() - This function determines the queue from | 124 | * rsi_core_determine_hal_queue() - This function determines the queue from |
81 | * which packet has to be dequeued. | 125 | * which packet has to be dequeued. |
82 | * @common: Pointer to the driver private structure. | 126 | * @common: Pointer to the driver private structure. |
@@ -88,7 +132,7 @@ static u8 rsi_core_determine_hal_queue(struct rsi_common *common) | |||
88 | bool recontend_queue = false; | 132 | bool recontend_queue = false; |
89 | u32 q_len = 0; | 133 | u32 q_len = 0; |
90 | u8 q_num = INVALID_QUEUE; | 134 | u8 q_num = INVALID_QUEUE; |
91 | u8 ii = 0, min = 0; | 135 | u8 ii = 0; |
92 | 136 | ||
93 | if (skb_queue_len(&common->tx_queue[MGMT_SOFT_Q])) { | 137 | if (skb_queue_len(&common->tx_queue[MGMT_SOFT_Q])) { |
94 | if (!common->mgmt_q_block) | 138 | if (!common->mgmt_q_block) |
@@ -96,6 +140,9 @@ static u8 rsi_core_determine_hal_queue(struct rsi_common *common) | |||
96 | return q_num; | 140 | return q_num; |
97 | } | 141 | } |
98 | 142 | ||
143 | if (common->hw_data_qs_blocked) | ||
144 | return q_num; | ||
145 | |||
99 | if (common->pkt_cnt != 0) { | 146 | if (common->pkt_cnt != 0) { |
100 | --common->pkt_cnt; | 147 | --common->pkt_cnt; |
101 | return common->selected_qnum; | 148 | return common->selected_qnum; |
@@ -106,14 +153,15 @@ get_queue_num: | |||
106 | 153 | ||
107 | q_num = rsi_determine_min_weight_queue(common); | 154 | q_num = rsi_determine_min_weight_queue(common); |
108 | 155 | ||
109 | q_len = skb_queue_len(&common->tx_queue[ii]); | ||
110 | ii = q_num; | 156 | ii = q_num; |
111 | 157 | ||
112 | /* Selecting the queue with least back off */ | 158 | /* Selecting the queue with least back off */ |
113 | for (; ii < NUM_EDCA_QUEUES; ii++) { | 159 | for (; ii < NUM_EDCA_QUEUES; ii++) { |
160 | q_len = skb_queue_len(&common->tx_queue[ii]); | ||
114 | if (((common->tx_qinfo[ii].pkt_contended) && | 161 | if (((common->tx_qinfo[ii].pkt_contended) && |
115 | (common->tx_qinfo[ii].weight < min)) && q_len) { | 162 | (common->tx_qinfo[ii].weight < common->min_weight)) && |
116 | min = common->tx_qinfo[ii].weight; | 163 | q_len) { |
164 | common->min_weight = common->tx_qinfo[ii].weight; | ||
117 | q_num = ii; | 165 | q_num = ii; |
118 | } | 166 | } |
119 | } | 167 | } |
@@ -140,26 +188,10 @@ get_queue_num: | |||
140 | common->selected_qnum = q_num; | 188 | common->selected_qnum = q_num; |
141 | q_len = skb_queue_len(&common->tx_queue[q_num]); | 189 | q_len = skb_queue_len(&common->tx_queue[q_num]); |
142 | 190 | ||
143 | switch (common->selected_qnum) { | 191 | if (q_num == VO_Q || q_num == VI_Q) { |
144 | case VO_Q: | 192 | common->pkt_cnt = rsi_get_num_pkts_dequeue(common, q_num); |
145 | if (q_len > MAX_CONTINUOUS_VO_PKTS) | 193 | common->pkt_cnt -= 1; |
146 | common->pkt_cnt = (MAX_CONTINUOUS_VO_PKTS - 1); | 194 | }; |
147 | else | ||
148 | common->pkt_cnt = --q_len; | ||
149 | break; | ||
150 | |||
151 | case VI_Q: | ||
152 | if (q_len > MAX_CONTINUOUS_VI_PKTS) | ||
153 | common->pkt_cnt = (MAX_CONTINUOUS_VI_PKTS - 1); | ||
154 | else | ||
155 | common->pkt_cnt = --q_len; | ||
156 | |||
157 | break; | ||
158 | |||
159 | default: | ||
160 | common->pkt_cnt = 0; | ||
161 | break; | ||
162 | } | ||
163 | 195 | ||
164 | return q_num; | 196 | return q_num; |
165 | } | 197 | } |
diff --git a/drivers/net/wireless/rsi/rsi_main.h b/drivers/net/wireless/rsi/rsi_main.h index 2cb73e7edb98..86291310e293 100644 --- a/drivers/net/wireless/rsi/rsi_main.h +++ b/drivers/net/wireless/rsi/rsi_main.h | |||
@@ -115,6 +115,7 @@ struct wmm_qinfo { | |||
115 | s32 weight; | 115 | s32 weight; |
116 | s32 wme_params; | 116 | s32 wme_params; |
117 | s32 pkt_contended; | 117 | s32 pkt_contended; |
118 | s32 txop; | ||
118 | }; | 119 | }; |
119 | 120 | ||
120 | struct transmit_q_stats { | 121 | struct transmit_q_stats { |
@@ -192,6 +193,8 @@ struct rsi_common { | |||
192 | u8 selected_qnum; | 193 | u8 selected_qnum; |
193 | u32 pkt_cnt; | 194 | u32 pkt_cnt; |
194 | u8 min_weight; | 195 | u8 min_weight; |
196 | |||
197 | bool hw_data_qs_blocked; | ||
195 | }; | 198 | }; |
196 | 199 | ||
197 | struct rsi_hw { | 200 | struct rsi_hw { |