mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 13:26:48 +00:00
Remove no longer used mt76x0_mac_set_ampdu_factor routine Signed-off-by: Lorenzo Bianconi <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
106 lines
2.8 KiB
C
106 lines
2.8 KiB
C
/*
|
|
* Copyright (C) 2014 Felix Fietkau <[email protected]>
|
|
* Copyright (C) 2015 Jakub Kicinski <[email protected]>
|
|
* Copyright (C) 2018 Stanislaw Gruszka <[email protected]>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2
|
|
* as published by the Free Software Foundation
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*/
|
|
|
|
#include <linux/etherdevice.h>
|
|
|
|
#include "mt76x0.h"
|
|
|
|
void mt76x0_mac_set_protection(struct mt76x02_dev *dev, bool legacy_prot,
|
|
int ht_mode)
|
|
{
|
|
int mode = ht_mode & IEEE80211_HT_OP_MODE_PROTECTION;
|
|
bool non_gf = !!(ht_mode & IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT);
|
|
u32 prot[6];
|
|
bool ht_rts[4] = {};
|
|
int i;
|
|
|
|
prot[0] = MT_PROT_NAV_SHORT |
|
|
MT_PROT_TXOP_ALLOW_ALL |
|
|
MT_PROT_RTS_THR_EN;
|
|
prot[1] = prot[0];
|
|
if (legacy_prot)
|
|
prot[1] |= MT_PROT_CTRL_CTS2SELF;
|
|
|
|
prot[2] = prot[4] = MT_PROT_NAV_SHORT | MT_PROT_TXOP_ALLOW_BW20;
|
|
prot[3] = prot[5] = MT_PROT_NAV_SHORT | MT_PROT_TXOP_ALLOW_ALL;
|
|
|
|
if (legacy_prot) {
|
|
prot[2] |= MT_PROT_RATE_CCK_11;
|
|
prot[3] |= MT_PROT_RATE_CCK_11;
|
|
prot[4] |= MT_PROT_RATE_CCK_11;
|
|
prot[5] |= MT_PROT_RATE_CCK_11;
|
|
} else {
|
|
prot[2] |= MT_PROT_RATE_OFDM_24;
|
|
prot[3] |= MT_PROT_RATE_DUP_OFDM_24;
|
|
prot[4] |= MT_PROT_RATE_OFDM_24;
|
|
prot[5] |= MT_PROT_RATE_DUP_OFDM_24;
|
|
}
|
|
|
|
switch (mode) {
|
|
case IEEE80211_HT_OP_MODE_PROTECTION_NONE:
|
|
break;
|
|
|
|
case IEEE80211_HT_OP_MODE_PROTECTION_NONMEMBER:
|
|
ht_rts[0] = ht_rts[1] = ht_rts[2] = ht_rts[3] = true;
|
|
break;
|
|
|
|
case IEEE80211_HT_OP_MODE_PROTECTION_20MHZ:
|
|
ht_rts[1] = ht_rts[3] = true;
|
|
break;
|
|
|
|
case IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED:
|
|
ht_rts[0] = ht_rts[1] = ht_rts[2] = ht_rts[3] = true;
|
|
break;
|
|
}
|
|
|
|
if (non_gf)
|
|
ht_rts[2] = ht_rts[3] = true;
|
|
|
|
for (i = 0; i < 4; i++)
|
|
if (ht_rts[i])
|
|
prot[i + 2] |= MT_PROT_CTRL_RTS_CTS;
|
|
|
|
for (i = 0; i < 6; i++)
|
|
mt76_wr(dev, MT_CCK_PROT_CFG + i * 4, prot[i]);
|
|
}
|
|
|
|
void mt76x0_mac_set_short_preamble(struct mt76x02_dev *dev, bool short_preamb)
|
|
{
|
|
if (short_preamb)
|
|
mt76_set(dev, MT_AUTO_RSP_CFG, MT_AUTO_RSP_PREAMB_SHORT);
|
|
else
|
|
mt76_clear(dev, MT_AUTO_RSP_CFG, MT_AUTO_RSP_PREAMB_SHORT);
|
|
}
|
|
|
|
void mt76x0_mac_config_tsf(struct mt76x02_dev *dev, bool enable, int interval)
|
|
{
|
|
u32 val = mt76_rr(dev, MT_BEACON_TIME_CFG);
|
|
|
|
val &= ~(MT_BEACON_TIME_CFG_TIMER_EN |
|
|
MT_BEACON_TIME_CFG_SYNC_MODE |
|
|
MT_BEACON_TIME_CFG_TBTT_EN);
|
|
|
|
if (!enable) {
|
|
mt76_wr(dev, MT_BEACON_TIME_CFG, val);
|
|
return;
|
|
}
|
|
|
|
val &= ~MT_BEACON_TIME_CFG_INTVAL;
|
|
val |= FIELD_PREP(MT_BEACON_TIME_CFG_INTVAL, interval << 4) |
|
|
MT_BEACON_TIME_CFG_TIMER_EN |
|
|
MT_BEACON_TIME_CFG_SYNC_MODE |
|
|
MT_BEACON_TIME_CFG_TBTT_EN;
|
|
}
|