mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 21:36:52 +00:00
mt7603: init interfaces with index
Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
#include "mt76.h"
|
||||
#include "mt7603_regs.h"
|
||||
|
||||
#define MT7603_MAX_INTERFACES 4
|
||||
#define MT7603_WTBL_SIZE 128
|
||||
#define MT7603_WTBL_RESERVED (MT7603_WTBL_SIZE - 1)
|
||||
|
||||
@@ -48,6 +49,16 @@ struct mt7603_mcu {
|
||||
bool running;
|
||||
};
|
||||
|
||||
struct mt7603_vif {
|
||||
u8 idx;
|
||||
|
||||
struct mt76_wcid group_wcid;
|
||||
};
|
||||
|
||||
struct mt7603_sta {
|
||||
struct mt76_wcid wcid; /* must be first */
|
||||
};
|
||||
|
||||
struct mt7603_dev {
|
||||
struct mt76_dev mt76; /* must be first */
|
||||
|
||||
@@ -59,6 +70,9 @@ struct mt7603_dev {
|
||||
|
||||
u32 rxfilter;
|
||||
|
||||
u8 vif_mask;
|
||||
unsigned long wcid_mask[MT7603_WTBL_SIZE / BITS_PER_LONG];
|
||||
|
||||
u8 rx_chains;
|
||||
u8 tx_chains;
|
||||
|
||||
|
||||
+4
-1
@@ -287,7 +287,7 @@ static const struct ieee80211_iface_limit if_limits[] = {
|
||||
.max = 1,
|
||||
.types = BIT(NL80211_IFTYPE_ADHOC)
|
||||
}, {
|
||||
.max = 4,
|
||||
.max = MT7603_MAX_INTERFACES,
|
||||
.types = BIT(NL80211_IFTYPE_STATION) |
|
||||
#ifdef CONFIG_MAC80211_MESH
|
||||
BIT(NL80211_IFTYPE_MESH_POINT) |
|
||||
@@ -328,6 +328,9 @@ int mt7603_register_device(struct mt7603_dev *dev)
|
||||
hw->max_rate_tries = 1;
|
||||
hw->extra_tx_headroom = 2;
|
||||
|
||||
hw->sta_data_size = sizeof(struct mt7603_sta);
|
||||
hw->vif_data_size = sizeof(struct mt7603_vif);
|
||||
|
||||
SET_IEEE80211_PERM_ADDR(hw, dev->macaddr);
|
||||
|
||||
wiphy->iface_combinations = if_comb;
|
||||
|
||||
+24
-1
@@ -34,12 +34,35 @@ mt7603_stop(struct ieee80211_hw *hw)
|
||||
static int
|
||||
mt7603_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
|
||||
{
|
||||
return -EINVAL;
|
||||
struct mt7603_vif *mvif = (struct mt7603_vif *) vif->drv_priv;
|
||||
struct mt7603_dev *dev = hw->priv;
|
||||
int ret = 0;
|
||||
|
||||
mutex_lock(&dev->mutex);
|
||||
|
||||
mvif->idx = ffs(~dev->vif_mask) - 1;
|
||||
if (mvif->idx >= MT7603_MAX_INTERFACES) {
|
||||
ret = -ENOSPC;
|
||||
goto out;
|
||||
}
|
||||
|
||||
dev->vif_mask |= BIT(mvif->idx);
|
||||
|
||||
out:
|
||||
mutex_unlock(&dev->mutex);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
mt7603_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
|
||||
{
|
||||
struct mt7603_vif *mvif = (struct mt7603_vif *) vif->drv_priv;
|
||||
struct mt7603_dev *dev = hw->priv;
|
||||
|
||||
mutex_lock(&dev->mutex);
|
||||
dev->vif_mask &= ~BIT(mvif->idx);
|
||||
mutex_unlock(&dev->mutex);
|
||||
}
|
||||
|
||||
static int
|
||||
|
||||
Reference in New Issue
Block a user