|
楼主 |
发表于 2018-10-9 22:48
|
显示全部楼层
本帖最后由 hello_limin 于 2018-10-11 14:14 编辑
第1个,就是我在编译的过程中卡在了 704-rt2x00-use-different-txstatus-timeouts-when-flushing.patch 这个补丁,仔细看了看,是 rt2x00mac.c 打不上,后来想到 999-rt2x00-queue-update.patch 这个里面也有对 rt2x00mac.c 进行打补丁,ok 那我就将704里这卡住的部分剪切粘贴到999补丁里,
嘿 移花接木居然编译通过了,歪打正着
举此贴中案例如下,kernel version : 4.9.58 + mac80211 wireless version : backports-2017-11-01.tar.xz
A. 贴上卡壳的 704-rt2x00-use-different-txstatus-timeouts-when-flushing.patch 补丁修改后的**码,
- From feb87977b6d251fb01a329905719e45908f6c939 Mon Sep 17 00:00:00 2001
- From: Stanislaw Gruszka <sgruszka@redhat.com>
- Date: Fri, 10 Aug 2018 12:31:55 +0200
- Subject: [PATCH 4/5] rt2x00: use different txstatus timeouts when flushing
- Use different tx status timeouts for normal operation and when flushing.
- This increase timeout to 2s for normal operation as when there are bad
- radio conditions and frames are reposted many times device can not provide
- the status for quite long. With new timeout we can still get valid status
- on such bad conditions.
- Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
- ---
- .../net/wireless/ralink/rt2x00/rt2800lib.c | 31 +++++++++++++------
- drivers/net/wireless/ralink/rt2x00/rt2x00.h | 1 +
- .../net/wireless/ralink/rt2x00/rt2x00mac.c | 4 +++
- 3 files changed, 26 insertions(+), 10 deletions(-)
- diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
- index 0c56c7dca55f..595cb9c90b81 100644
- --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
- +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
- @@ -1137,36 +1137,47 @@ void rt2800_txdone(struct rt2x00_dev *rt2x00dev)
- }
- EXPORT_SYMBOL_GPL(rt2800_txdone);
-
- -static inline bool rt2800_entry_txstatus_timeout(struct queue_entry *entry)
- +static inline bool rt2800_entry_txstatus_timeout(struct rt2x00_dev *rt2x00dev,
- + struct queue_entry *entry)
- {
- - bool tout;
- + bool ret;
- + unsigned long tout;
-
- if (!test_bit(ENTRY_DATA_STATUS_PENDING, &entry->flags))
- return false;
-
- - tout = time_after(jiffies, entry->last_action + msecs_to_jiffies(500));
- - if (unlikely(tout))
- + if (test_bit(DEVICE_STATE_FLUSHING, &rt2x00dev->flags))
- + tout = msecs_to_jiffies(100);
- + else
- + tout = msecs_to_jiffies(2000);
- +
- + ret = time_after(jiffies, entry->last_action + tout);
- + if (unlikely(ret))
- rt2x00_dbg(entry->queue->rt2x00dev,
- "TX status timeout for entry %d in queue %d\n",
- entry->entry_idx, entry->queue->qid);
- - return tout;
- -
- + return ret;
- }
-
- bool rt2800_txstatus_timeout(struct rt2x00_dev *rt2x00dev)
- {
- struct data_queue *queue;
- struct queue_entry *entry;
- + unsigned long tout;
- +
- + if (test_bit(DEVICE_STATE_FLUSHING, &rt2x00dev->flags))
- + tout = msecs_to_jiffies(50);
- + else
- + tout = msecs_to_jiffies(1000);
-
- - if (time_before(jiffies,
- - rt2x00dev->last_nostatus_check + msecs_to_jiffies(500)))
- + if (time_before(jiffies, rt2x00dev->last_nostatus_check + tout))
- return false;
-
- rt2x00dev->last_nostatus_check = jiffies;
-
- tx_queue_for_each(rt2x00dev, queue) {
- entry = rt2x00queue_get_entry(queue, Q_INDEX_DONE);
- - if (rt2800_entry_txstatus_timeout(entry))
- + if (rt2800_entry_txstatus_timeout(rt2x00dev, entry))
- return true;
- }
-
- @@ -1195,7 +1206,7 @@ void rt2800_txdone_nostatus(struct rt2x00_dev *rt2x00dev)
- break;
-
- if (test_bit(ENTRY_DATA_IO_FAILED, &entry->flags) ||
- - rt2800_entry_txstatus_timeout(entry))
- + rt2800_entry_txstatus_timeout(rt2x00dev, entry))
- rt2x00lib_txdone_noinfo(entry, TXDONE_FAILURE);
- else
- break;
- diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00.h b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
- index af062cda4a23..4b1744e9fb78 100644
- --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
- +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
- @@ -665,6 +665,7 @@ enum rt2x00_state_flags {
- DEVICE_STATE_STARTED,
- DEVICE_STATE_ENABLED_RADIO,
- DEVICE_STATE_SCANNING,
- + DEVICE_STATE_FLUSHING,
-
- /*
- * Driver configuration
复制代码
B, 贴上突发奇想的 999-rt2x00-queue-update.patch 补丁修改后的**码,- --- a/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c
- +++ b/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c
- @@ -700,7 +700,7 @@ void rt2800mmio_queue_init(struct data_queue *queue)
-
- switch (queue->qid) {
- case QID_RX:
- - queue->limit = 128;
- + queue->limit = 256;
- queue->data_size = AGGREGATION_SIZE;
- queue->desc_size = RXD_DESC_SIZE;
- queue->winfo_size = rxwi_size;
- @@ -711,7 +711,7 @@ void rt2800mmio_queue_init(struct data_queue *queue)
- case QID_AC_VI:
- case QID_AC_BE:
- case QID_AC_BK:
- - queue->limit = 64;
- + queue->limit = 128;
- queue->data_size = AGGREGATION_SIZE;
- queue->desc_size = TXD_DESC_SIZE;
- queue->winfo_size = txwi_size;
- --- a/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c
- +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c
- @@ -26,6 +26,7 @@
-
- #include "rt2x00.h"
- #include "rt2x00lib.h"
- +#include "rt2x00queue.h"
-
- static int rt2x00mac_tx_rts_cts(struct rt2x00_dev *rt2x00dev,
- struct data_queue *queue,
- @@ -115,6 +116,26 @@ void rt2x00mac_tx(struct ieee80211_hw *hw,
- if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags))
- goto exit_free_skb;
-
- + /* Dirty hack for Queue overrun protection,
- + * if AC_VO/AC_VI/AC_BE is full, use next queue.
- + * if AC_BK is full use previous queue.
- + */
- + if (qid < 4) {
- + queue = rt2x00queue_get_tx_queue(rt2x00dev, qid);
- + if (unlikely(rt2x00queue_full(queue))) {
- + switch (qid) {
- + case 0: /* QID_AC_VO */
- + case 1: /* QID_AC_VI */
- + case 2: /* QID_AC_BE */
- + qid ++;
- + break;
- + case 3: /* QID_AC_BK */
- + qid --;
- + break;
- + }
- + }
- + }
- +
- /*
- * Use the ATIM queue if appropriate and present.
- */
- + /* 以下此处是我突发奇想的, *^_^*
- + * 解决704-rt2x00-use-different-txstatus-timeouts-when-flushing.patch,
- + * 卡壳 rt2x00mac.c 打不上补丁的点子.
- + */
- @@ -742,10 +742,14 @@ void rt2x00mac_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
- if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags))
- return;
- + set_bit(DEVICE_STATE_FLUSHING, &rt2x00dev->flags);
- +
- tx_queue_for_each(rt2x00dev, queue)
- if (!rt2x00queue_empty(queue))
- rt2x00queue_flush_queue(queue, drop);
- +
- + clear_bit(DEVICE_STATE_FLUSHING, &rt2x00dev->flags);
- }
- EXPORT_SYMBOL_GPL(rt2x00mac_flush);
- int rt2x00mac_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant)
- + /* 以上此处是我突发奇想的, *^_^*
- + * 解决704-rt2x00-use-different-txstatus-timeouts-when-flushing.patch,
- + * 卡壳 rt2x00mac.c 打不上补丁的点子.
- + */
- --- a/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c
- +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c
- @@ -1211,16 +1211,40 @@ void rt2x00queue_uninitialize(struct rt2x00_dev *rt2x00dev)
- static void rt2x00queue_init(struct rt2x00_dev *rt2x00dev,
- struct data_queue *queue, enum data_queue_qid qid)
- {
- + /* Use default values for each queue type */
- + unsigned short cwmin = 5, cwmax = 10, aifs = 2, txop = 0;
- +
- + switch (qid) {
- + case QID_AC_VO:
- + cwmin = 2;
- + cwmax = 3;
- + txop = 47;
- + break;
- + case QID_AC_VI:
- + cwmin = 3;
- + cwmax = 4;
- + txop = 94;
- + break;
- + case QID_AC_BE:
- + cwmin = 4;
- + aifs = 3;
- + break;
- + case QID_AC_BK:
- + cwmin = 4;
- + aifs = 7;
- + break;
- + }
- +
- mutex_init(&queue->status_lock);
- spin_lock_init(&queue->tx_lock);
- spin_lock_init(&queue->index_lock);
-
- queue->rt2x00dev = rt2x00dev;
- queue->qid = qid;
- - queue->txop = 0;
- - queue->aifs = 2;
- - queue->cw_min = 5;
- - queue->cw_max = 10;
- + queue->txop = txop;
- + queue->aifs = aifs;
- + queue->cw_min = cwmin;
- + queue->cw_max = cwmax;
-
- rt2x00dev->ops->queue_init(queue);
-
复制代码
|
|