Merge tag 'mt76-for-kvalo-2020-06-07' of https://github.com/nbd168/wireless
mt76 patches for 5.8 * tx queueing fixes for mt7615/22/63 * locking fix # gpg: Signature made Sun 07 Jun 2020 06:17:47 PM EEST using DSA key ID 02A76EF5 # gpg: Good signature from "Felix Fietkau <nbd@nbd.name>" # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: 75D1 1A7D 91A7 710F 4900 42EF D77D 141D 02A7 6EF5
This commit is contained in:
@@ -301,6 +301,7 @@ struct mt76_hw_cap {
|
|||||||
#define MT_DRV_TX_ALIGNED4_SKBS BIT(1)
|
#define MT_DRV_TX_ALIGNED4_SKBS BIT(1)
|
||||||
#define MT_DRV_SW_RX_AIRTIME BIT(2)
|
#define MT_DRV_SW_RX_AIRTIME BIT(2)
|
||||||
#define MT_DRV_RX_DMA_HDR BIT(3)
|
#define MT_DRV_RX_DMA_HDR BIT(3)
|
||||||
|
#define MT_DRV_HW_MGMT_TXQ BIT(4)
|
||||||
|
|
||||||
struct mt76_driver_ops {
|
struct mt76_driver_ops {
|
||||||
u32 drv_flags;
|
u32 drv_flags;
|
||||||
|
|||||||
@@ -642,8 +642,10 @@ mt7603_set_coverage_class(struct ieee80211_hw *hw, s16 coverage_class)
|
|||||||
{
|
{
|
||||||
struct mt7603_dev *dev = hw->priv;
|
struct mt7603_dev *dev = hw->priv;
|
||||||
|
|
||||||
|
mutex_lock(&dev->mt76.mutex);
|
||||||
dev->coverage_class = max_t(s16, coverage_class, 0);
|
dev->coverage_class = max_t(s16, coverage_class, 0);
|
||||||
mt7603_mac_set_timing(dev);
|
mt7603_mac_set_timing(dev);
|
||||||
|
mutex_unlock(&dev->mt76.mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mt7603_tx(struct ieee80211_hw *hw,
|
static void mt7603_tx(struct ieee80211_hw *hw,
|
||||||
|
|||||||
@@ -234,10 +234,11 @@ mt7615_queues_acq(struct seq_file *s, void *data)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < 16; i++) {
|
for (i = 0; i < 16; i++) {
|
||||||
int j, acs = i / 4, index = i % 4;
|
int j, wmm_idx = i % MT7615_MAX_WMM_SETS;
|
||||||
|
int acs = i / MT7615_MAX_WMM_SETS;
|
||||||
u32 ctrl, val, qlen = 0;
|
u32 ctrl, val, qlen = 0;
|
||||||
|
|
||||||
val = mt76_rr(dev, MT_PLE_AC_QEMPTY(acs, index));
|
val = mt76_rr(dev, MT_PLE_AC_QEMPTY(acs, wmm_idx));
|
||||||
ctrl = BIT(31) | BIT(15) | (acs << 8);
|
ctrl = BIT(31) | BIT(15) | (acs << 8);
|
||||||
|
|
||||||
for (j = 0; j < 32; j++) {
|
for (j = 0; j < 32; j++) {
|
||||||
@@ -245,11 +246,11 @@ mt7615_queues_acq(struct seq_file *s, void *data)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
mt76_wr(dev, MT_PLE_FL_Q0_CTRL,
|
mt76_wr(dev, MT_PLE_FL_Q0_CTRL,
|
||||||
ctrl | (j + (index << 5)));
|
ctrl | (j + (wmm_idx << 5)));
|
||||||
qlen += mt76_get_field(dev, MT_PLE_FL_Q3_CTRL,
|
qlen += mt76_get_field(dev, MT_PLE_FL_Q3_CTRL,
|
||||||
GENMASK(11, 0));
|
GENMASK(11, 0));
|
||||||
}
|
}
|
||||||
seq_printf(s, "AC%d%d: queued=%d\n", acs, index, qlen);
|
seq_printf(s, "AC%d%d: queued=%d\n", wmm_idx, acs, qlen);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -36,10 +36,10 @@ static int
|
|||||||
mt7622_init_tx_queues_multi(struct mt7615_dev *dev)
|
mt7622_init_tx_queues_multi(struct mt7615_dev *dev)
|
||||||
{
|
{
|
||||||
static const u8 wmm_queue_map[] = {
|
static const u8 wmm_queue_map[] = {
|
||||||
MT7622_TXQ_AC0,
|
[IEEE80211_AC_BK] = MT7622_TXQ_AC0,
|
||||||
MT7622_TXQ_AC1,
|
[IEEE80211_AC_BE] = MT7622_TXQ_AC1,
|
||||||
MT7622_TXQ_AC2,
|
[IEEE80211_AC_VI] = MT7622_TXQ_AC2,
|
||||||
MT7622_TXQ_AC3,
|
[IEEE80211_AC_VO] = MT7622_TXQ_AC3,
|
||||||
};
|
};
|
||||||
int ret;
|
int ret;
|
||||||
int i;
|
int i;
|
||||||
@@ -100,6 +100,7 @@ mt7615_tx_cleanup(struct mt7615_dev *dev)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
mt76_queue_tx_cleanup(dev, MT_TXQ_MCU, false);
|
mt76_queue_tx_cleanup(dev, MT_TXQ_MCU, false);
|
||||||
|
mt76_queue_tx_cleanup(dev, MT_TXQ_PSD, false);
|
||||||
if (is_mt7615(&dev->mt76)) {
|
if (is_mt7615(&dev->mt76)) {
|
||||||
mt76_queue_tx_cleanup(dev, MT_TXQ_BE, false);
|
mt76_queue_tx_cleanup(dev, MT_TXQ_BE, false);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -526,22 +526,16 @@ int mt7615_mac_write_txwi(struct mt7615_dev *dev, __le32 *txwi,
|
|||||||
fc_type = (le16_to_cpu(fc) & IEEE80211_FCTL_FTYPE) >> 2;
|
fc_type = (le16_to_cpu(fc) & IEEE80211_FCTL_FTYPE) >> 2;
|
||||||
fc_stype = (le16_to_cpu(fc) & IEEE80211_FCTL_STYPE) >> 4;
|
fc_stype = (le16_to_cpu(fc) & IEEE80211_FCTL_STYPE) >> 4;
|
||||||
|
|
||||||
if (ieee80211_is_data(fc) || ieee80211_is_bufferable_mmpdu(fc)) {
|
if (beacon) {
|
||||||
q_idx = wmm_idx * MT7615_MAX_WMM_SETS +
|
|
||||||
skb_get_queue_mapping(skb);
|
|
||||||
p_fmt = is_usb ? MT_TX_TYPE_SF : MT_TX_TYPE_CT;
|
|
||||||
} else if (beacon) {
|
|
||||||
if (ext_phy)
|
|
||||||
q_idx = MT_LMAC_BCN1;
|
|
||||||
else
|
|
||||||
q_idx = MT_LMAC_BCN0;
|
|
||||||
p_fmt = MT_TX_TYPE_FW;
|
p_fmt = MT_TX_TYPE_FW;
|
||||||
} else {
|
q_idx = ext_phy ? MT_LMAC_BCN1 : MT_LMAC_BCN0;
|
||||||
if (ext_phy)
|
} else if (skb_get_queue_mapping(skb) >= MT_TXQ_PSD) {
|
||||||
q_idx = MT_LMAC_ALTX1;
|
|
||||||
else
|
|
||||||
q_idx = MT_LMAC_ALTX0;
|
|
||||||
p_fmt = is_usb ? MT_TX_TYPE_SF : MT_TX_TYPE_CT;
|
p_fmt = is_usb ? MT_TX_TYPE_SF : MT_TX_TYPE_CT;
|
||||||
|
q_idx = ext_phy ? MT_LMAC_ALTX1 : MT_LMAC_ALTX0;
|
||||||
|
} else {
|
||||||
|
p_fmt = is_usb ? MT_TX_TYPE_SF : MT_TX_TYPE_CT;
|
||||||
|
q_idx = wmm_idx * MT7615_MAX_WMM_SETS +
|
||||||
|
mt7615_lmac_mapping(dev, skb_get_queue_mapping(skb));
|
||||||
}
|
}
|
||||||
|
|
||||||
val = FIELD_PREP(MT_TXD0_TX_BYTES, skb->len + sz_txd) |
|
val = FIELD_PREP(MT_TXD0_TX_BYTES, skb->len + sz_txd) |
|
||||||
|
|||||||
@@ -124,21 +124,6 @@ enum tx_pkt_type {
|
|||||||
MT_TX_TYPE_FW,
|
MT_TX_TYPE_FW,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum tx_pkt_queue_idx {
|
|
||||||
MT_LMAC_AC00,
|
|
||||||
MT_LMAC_AC01,
|
|
||||||
MT_LMAC_AC02,
|
|
||||||
MT_LMAC_AC03,
|
|
||||||
MT_LMAC_ALTX0 = 0x10,
|
|
||||||
MT_LMAC_BMC0,
|
|
||||||
MT_LMAC_BCN0,
|
|
||||||
MT_LMAC_PSMP0,
|
|
||||||
MT_LMAC_ALTX1,
|
|
||||||
MT_LMAC_BMC1,
|
|
||||||
MT_LMAC_BCN1,
|
|
||||||
MT_LMAC_PSMP1,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum tx_port_idx {
|
enum tx_port_idx {
|
||||||
MT_TX_PORT_IDX_LMAC,
|
MT_TX_PORT_IDX_LMAC,
|
||||||
MT_TX_PORT_IDX_MCU
|
MT_TX_PORT_IDX_MCU
|
||||||
|
|||||||
@@ -397,6 +397,7 @@ mt7615_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u16 queue,
|
|||||||
struct mt7615_vif *mvif = (struct mt7615_vif *)vif->drv_priv;
|
struct mt7615_vif *mvif = (struct mt7615_vif *)vif->drv_priv;
|
||||||
struct mt7615_dev *dev = mt7615_hw_dev(hw);
|
struct mt7615_dev *dev = mt7615_hw_dev(hw);
|
||||||
|
|
||||||
|
queue = mt7615_lmac_mapping(dev, queue);
|
||||||
queue += mvif->wmm_idx * MT7615_MAX_WMM_SETS;
|
queue += mvif->wmm_idx * MT7615_MAX_WMM_SETS;
|
||||||
|
|
||||||
return mt7615_mcu_set_wmm(dev, queue, params);
|
return mt7615_mcu_set_wmm(dev, queue, params);
|
||||||
@@ -735,9 +736,12 @@ static void
|
|||||||
mt7615_set_coverage_class(struct ieee80211_hw *hw, s16 coverage_class)
|
mt7615_set_coverage_class(struct ieee80211_hw *hw, s16 coverage_class)
|
||||||
{
|
{
|
||||||
struct mt7615_phy *phy = mt7615_hw_phy(hw);
|
struct mt7615_phy *phy = mt7615_hw_phy(hw);
|
||||||
|
struct mt7615_dev *dev = phy->dev;
|
||||||
|
|
||||||
|
mutex_lock(&dev->mt76.mutex);
|
||||||
phy->coverage_class = max_t(s16, coverage_class, 0);
|
phy->coverage_class = max_t(s16, coverage_class, 0);
|
||||||
mt7615_mac_set_timing(phy);
|
mt7615_mac_set_timing(phy);
|
||||||
|
mutex_unlock(&dev->mt76.mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ int mt7615_mmio_probe(struct device *pdev, void __iomem *mem_base,
|
|||||||
static const struct mt76_driver_ops drv_ops = {
|
static const struct mt76_driver_ops drv_ops = {
|
||||||
/* txwi_size = txd size + txp size */
|
/* txwi_size = txd size + txp size */
|
||||||
.txwi_size = MT_TXD_SIZE + sizeof(struct mt7615_txp_common),
|
.txwi_size = MT_TXD_SIZE + sizeof(struct mt7615_txp_common),
|
||||||
.drv_flags = MT_DRV_TXWI_NO_FREE,
|
.drv_flags = MT_DRV_TXWI_NO_FREE | MT_DRV_HW_MGMT_TXQ,
|
||||||
.survey_flags = SURVEY_INFO_TIME_TX |
|
.survey_flags = SURVEY_INFO_TIME_TX |
|
||||||
SURVEY_INFO_TIME_RX |
|
SURVEY_INFO_TIME_RX |
|
||||||
SURVEY_INFO_TIME_BSS_RX,
|
SURVEY_INFO_TIME_BSS_RX,
|
||||||
|
|||||||
@@ -282,6 +282,21 @@ struct mt7615_dev {
|
|||||||
struct list_head wd_head;
|
struct list_head wd_head;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum tx_pkt_queue_idx {
|
||||||
|
MT_LMAC_AC00,
|
||||||
|
MT_LMAC_AC01,
|
||||||
|
MT_LMAC_AC02,
|
||||||
|
MT_LMAC_AC03,
|
||||||
|
MT_LMAC_ALTX0 = 0x10,
|
||||||
|
MT_LMAC_BMC0,
|
||||||
|
MT_LMAC_BCN0,
|
||||||
|
MT_LMAC_PSMP0,
|
||||||
|
MT_LMAC_ALTX1,
|
||||||
|
MT_LMAC_BMC1,
|
||||||
|
MT_LMAC_BCN1,
|
||||||
|
MT_LMAC_PSMP1,
|
||||||
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
HW_BSSID_0 = 0x0,
|
HW_BSSID_0 = 0x0,
|
||||||
HW_BSSID_1,
|
HW_BSSID_1,
|
||||||
@@ -447,6 +462,21 @@ static inline u16 mt7615_wtbl_size(struct mt7615_dev *dev)
|
|||||||
return MT7615_WTBL_SIZE;
|
return MT7615_WTBL_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline u8 mt7615_lmac_mapping(struct mt7615_dev *dev, u8 ac)
|
||||||
|
{
|
||||||
|
static const u8 lmac_queue_map[] = {
|
||||||
|
[IEEE80211_AC_BK] = MT_LMAC_AC00,
|
||||||
|
[IEEE80211_AC_BE] = MT_LMAC_AC01,
|
||||||
|
[IEEE80211_AC_VI] = MT_LMAC_AC02,
|
||||||
|
[IEEE80211_AC_VO] = MT_LMAC_AC03,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (WARN_ON_ONCE(ac >= ARRAY_SIZE(lmac_queue_map)))
|
||||||
|
return MT_LMAC_AC01; /* BE */
|
||||||
|
|
||||||
|
return lmac_queue_map[ac];
|
||||||
|
}
|
||||||
|
|
||||||
void mt7615_dma_reset(struct mt7615_dev *dev);
|
void mt7615_dma_reset(struct mt7615_dev *dev);
|
||||||
void mt7615_scan_work(struct work_struct *work);
|
void mt7615_scan_work(struct work_struct *work);
|
||||||
void mt7615_roc_work(struct work_struct *work);
|
void mt7615_roc_work(struct work_struct *work);
|
||||||
|
|||||||
@@ -270,7 +270,7 @@ static int mt7663u_probe(struct usb_interface *usb_intf,
|
|||||||
{
|
{
|
||||||
static const struct mt76_driver_ops drv_ops = {
|
static const struct mt76_driver_ops drv_ops = {
|
||||||
.txwi_size = MT_USB_TXD_SIZE,
|
.txwi_size = MT_USB_TXD_SIZE,
|
||||||
.drv_flags = MT_DRV_RX_DMA_HDR,
|
.drv_flags = MT_DRV_RX_DMA_HDR | MT_DRV_HW_MGMT_TXQ,
|
||||||
.tx_prepare_skb = mt7663u_tx_prepare_skb,
|
.tx_prepare_skb = mt7663u_tx_prepare_skb,
|
||||||
.tx_complete_skb = mt7663u_tx_complete_skb,
|
.tx_complete_skb = mt7663u_tx_complete_skb,
|
||||||
.tx_status_data = mt7663u_tx_status_data,
|
.tx_status_data = mt7663u_tx_status_data,
|
||||||
|
|||||||
@@ -716,9 +716,12 @@ static void
|
|||||||
mt7915_set_coverage_class(struct ieee80211_hw *hw, s16 coverage_class)
|
mt7915_set_coverage_class(struct ieee80211_hw *hw, s16 coverage_class)
|
||||||
{
|
{
|
||||||
struct mt7915_phy *phy = mt7915_hw_phy(hw);
|
struct mt7915_phy *phy = mt7915_hw_phy(hw);
|
||||||
|
struct mt7915_dev *dev = phy->dev;
|
||||||
|
|
||||||
|
mutex_lock(&dev->mt76.mutex);
|
||||||
phy->coverage_class = max_t(s16, coverage_class, 0);
|
phy->coverage_class = max_t(s16, coverage_class, 0);
|
||||||
mt7915_mac_set_timing(phy);
|
mt7915_mac_set_timing(phy);
|
||||||
|
mutex_unlock(&dev->mt76.mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|||||||
@@ -264,6 +264,13 @@ mt76_tx(struct mt76_phy *phy, struct ieee80211_sta *sta,
|
|||||||
skb_set_queue_mapping(skb, qid);
|
skb_set_queue_mapping(skb, qid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((dev->drv->drv_flags & MT_DRV_HW_MGMT_TXQ) &&
|
||||||
|
!ieee80211_is_data(hdr->frame_control) &&
|
||||||
|
!ieee80211_is_bufferable_mmpdu(hdr->frame_control)) {
|
||||||
|
qid = MT_TXQ_PSD;
|
||||||
|
skb_set_queue_mapping(skb, qid);
|
||||||
|
}
|
||||||
|
|
||||||
if (!(wcid->tx_info & MT_WCID_TX_INFO_SET))
|
if (!(wcid->tx_info & MT_WCID_TX_INFO_SET))
|
||||||
ieee80211_get_tx_rates(info->control.vif, sta, skb,
|
ieee80211_get_tx_rates(info->control.vif, sta, skb,
|
||||||
info->control.rates, 1);
|
info->control.rates, 1);
|
||||||
|
|||||||
@@ -1010,17 +1010,18 @@ static void mt76u_tx_kick(struct mt76_dev *dev, struct mt76_queue *q)
|
|||||||
static u8 mt76u_ac_to_hwq(struct mt76_dev *dev, u8 ac)
|
static u8 mt76u_ac_to_hwq(struct mt76_dev *dev, u8 ac)
|
||||||
{
|
{
|
||||||
if (mt76_chip(dev) == 0x7663) {
|
if (mt76_chip(dev) == 0x7663) {
|
||||||
static const u8 wmm_queue_map[] = {
|
static const u8 lmac_queue_map[] = {
|
||||||
[IEEE80211_AC_VO] = 0,
|
/* ac to lmac mapping */
|
||||||
[IEEE80211_AC_VI] = 1,
|
[IEEE80211_AC_BK] = 0,
|
||||||
[IEEE80211_AC_BE] = 2,
|
[IEEE80211_AC_BE] = 1,
|
||||||
[IEEE80211_AC_BK] = 4,
|
[IEEE80211_AC_VI] = 2,
|
||||||
|
[IEEE80211_AC_VO] = 4,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (WARN_ON(ac >= ARRAY_SIZE(wmm_queue_map)))
|
if (WARN_ON(ac >= ARRAY_SIZE(lmac_queue_map)))
|
||||||
return 2; /* BE */
|
return 1; /* BE */
|
||||||
|
|
||||||
return wmm_queue_map[ac];
|
return lmac_queue_map[ac];
|
||||||
}
|
}
|
||||||
|
|
||||||
return mt76_ac_to_hwq(ac);
|
return mt76_ac_to_hwq(ac);
|
||||||
|
|||||||
Reference in New Issue
Block a user