Skip to content

Commit

Permalink
mt76: fix mt76_rates for the multiple devices
Browse files Browse the repository at this point in the history
PHY offset in either .hw_value or .hw_value_short for mt7615, mt7663,
mt7915 and mt7921 device all start at bit 6, not 8.

Suggested-by: Ryder Lee <[email protected]>
Signed-off-by: Sean Wang <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
  • Loading branch information
moore-bros authored and nbd168 committed Jul 14, 2021
1 parent 7f5ea5e commit ca64a36
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 28 deletions.
24 changes: 12 additions & 12 deletions mac80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,18 @@ static const struct ieee80211_tpt_blink mt76_tpt_blink[] = {
};

struct ieee80211_rate mt76_rates[] = {
CCK_RATE(0, 10),
CCK_RATE(1, 20),
CCK_RATE(2, 55),
CCK_RATE(3, 110),
OFDM_RATE(11, 60),
OFDM_RATE(15, 90),
OFDM_RATE(10, 120),
OFDM_RATE(14, 180),
OFDM_RATE(9, 240),
OFDM_RATE(13, 360),
OFDM_RATE(8, 480),
OFDM_RATE(12, 540),
CCK_RATE(0, 10, 6),
CCK_RATE(1, 20, 6),
CCK_RATE(2, 55, 6),
CCK_RATE(3, 110, 6),
OFDM_RATE(11, 60, 6),
OFDM_RATE(15, 90, 6),
OFDM_RATE(10, 120, 6),
OFDM_RATE(14, 180, 6),
OFDM_RATE(9, 240, 6),
OFDM_RATE(13, 360, 6),
OFDM_RATE(8, 480, 6),
OFDM_RATE(12, 540, 6),
};
EXPORT_SYMBOL_GPL(mt76_rates);

Expand Down
12 changes: 6 additions & 6 deletions mt76.h
Original file line number Diff line number Diff line change
Expand Up @@ -755,17 +755,17 @@ enum mt76_phy_type {
MT_PHY_TYPE_HE_MU,
};

#define CCK_RATE(_idx, _rate) { \
#define CCK_RATE(_idx, _rate, _offset) { \
.bitrate = _rate, \
.flags = IEEE80211_RATE_SHORT_PREAMBLE, \
.hw_value = (MT_PHY_TYPE_CCK << 8) | (_idx), \
.hw_value_short = (MT_PHY_TYPE_CCK << 8) | (4 + _idx), \
.hw_value = (MT_PHY_TYPE_CCK << (_offset)) | (_idx), \
.hw_value_short = (MT_PHY_TYPE_CCK << (_offset)) | (4 + _idx), \
}

#define OFDM_RATE(_idx, _rate) { \
#define OFDM_RATE(_idx, _rate, _offset) { \
.bitrate = _rate, \
.hw_value = (MT_PHY_TYPE_OFDM << 8) | (_idx), \
.hw_value_short = (MT_PHY_TYPE_OFDM << 8) | (_idx), \
.hw_value = (MT_PHY_TYPE_OFDM << (_offset)) | (_idx), \
.hw_value_short = (MT_PHY_TYPE_OFDM << (_offset)) | (_idx), \
}

extern struct ieee80211_rate mt76_rates[12];
Expand Down
19 changes: 17 additions & 2 deletions mt7603/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,21 @@ mt7603_init_hardware(struct mt7603_dev *dev)
return 0;
}

static struct ieee80211_rate mt7603_rates[] = {
CCK_RATE(0, 10, 8),
CCK_RATE(1, 20, 8),
CCK_RATE(2, 55, 8),
CCK_RATE(3, 110, 8),
OFDM_RATE(11, 60, 8),
OFDM_RATE(15, 90, 8),
OFDM_RATE(10, 120, 8),
OFDM_RATE(14, 180, 8),
OFDM_RATE(9, 240, 8),
OFDM_RATE(13, 360, 8),
OFDM_RATE(8, 480, 8),
OFDM_RATE(12, 540, 8),
};

static const struct ieee80211_iface_limit if_limits[] = {
{
.max = 1,
Expand Down Expand Up @@ -541,8 +556,8 @@ int mt7603_register_device(struct mt7603_dev *dev)

wiphy->reg_notifier = mt7603_regd_notifier;

ret = mt76_register_device(&dev->mt76, true, mt76_rates,
ARRAY_SIZE(mt76_rates));
ret = mt76_register_device(&dev->mt76, true, mt7603_rates,
ARRAY_SIZE(mt7603_rates));
if (ret)
return ret;

Expand Down
16 changes: 8 additions & 8 deletions mt76x02_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ struct ieee80211_rate mt76x02_rates[] = {
MT76x02_CCK_RATE(1, 20),
MT76x02_CCK_RATE(2, 55),
MT76x02_CCK_RATE(3, 110),
OFDM_RATE(0, 60),
OFDM_RATE(1, 90),
OFDM_RATE(2, 120),
OFDM_RATE(3, 180),
OFDM_RATE(4, 240),
OFDM_RATE(5, 360),
OFDM_RATE(6, 480),
OFDM_RATE(7, 540),
OFDM_RATE(0, 60, 8),
OFDM_RATE(1, 90, 8),
OFDM_RATE(2, 120, 8),
OFDM_RATE(3, 180, 8),
OFDM_RATE(4, 240, 8),
OFDM_RATE(5, 360, 8),
OFDM_RATE(6, 480, 8),
OFDM_RATE(7, 540, 8),
};
EXPORT_SYMBOL_GPL(mt76x02_rates);

Expand Down

0 comments on commit ca64a36

Please sign in to comment.