Skip to content

Commit 16c8a79

Browse files
Stanislaw GruszkaKalle Valo
authored andcommitted
mt76x0: use mt76x02_sta and mt76x02_tx_status
Use common mt76x02_sta and mt76x02_tx_status structures in mt76x0 sub-driver. Signed-off-by: Stanislaw Gruszka <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
1 parent 78dae93 commit 16c8a79

File tree

7 files changed

+28
-42
lines changed

7 files changed

+28
-42
lines changed

drivers/net/wireless/mediatek/mt76/mt76x0/init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ int mt76x0_register_device(struct mt76x0_dev *dev)
688688
hw->max_report_rates = 7;
689689
hw->max_rate_tries = 1;
690690

691-
hw->sta_data_size = sizeof(struct mt76_sta);
691+
hw->sta_data_size = sizeof(struct mt76x02_sta);
692692
hw->vif_data_size = sizeof(struct mt76x02_vif);
693693

694694
SET_IEEE80211_PERM_ADDR(hw, dev->macaddr);

drivers/net/wireless/mediatek/mt76/mt76x0/mac.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ mt76_mac_process_tx_rate(struct ieee80211_tx_rate *txrate, u16 rate,
7676

7777
static void
7878
mt76_mac_fill_tx_status(struct mt76x0_dev *dev, struct ieee80211_tx_info *info,
79-
struct mt76_tx_status *st, int n_frames)
79+
struct mt76x02_tx_status *st, int n_frames)
8080
{
8181
struct ieee80211_tx_rate *rate = info->status.rates;
8282
int cur_idx, last_rate;
@@ -177,9 +177,9 @@ void mt76x0_mac_wcid_set_rate(struct mt76x0_dev *dev, struct mt76_wcid *wcid,
177177
spin_unlock_irqrestore(&dev->mt76.lock, flags);
178178
}
179179

180-
struct mt76_tx_status mt76x0_mac_fetch_tx_status(struct mt76x0_dev *dev)
180+
struct mt76x02_tx_status mt76x0_mac_fetch_tx_status(struct mt76x0_dev *dev)
181181
{
182-
struct mt76_tx_status stat = {};
182+
struct mt76x02_tx_status stat = {};
183183
u32 stat2, stat1;
184184

185185
stat2 = mt76_rr(dev, MT_TX_STAT_FIFO_EXT);
@@ -198,20 +198,20 @@ struct mt76_tx_status mt76x0_mac_fetch_tx_status(struct mt76x0_dev *dev)
198198
return stat;
199199
}
200200

201-
void mt76x0_send_tx_status(struct mt76x0_dev *dev, struct mt76_tx_status *stat, u8 *update)
201+
void mt76x0_send_tx_status(struct mt76x0_dev *dev, struct mt76x02_tx_status *stat, u8 *update)
202202
{
203203
struct ieee80211_tx_info info = {};
204204
struct ieee80211_sta *sta = NULL;
205205
struct mt76_wcid *wcid = NULL;
206-
struct mt76_sta *msta = NULL;
206+
struct mt76x02_sta *msta = NULL;
207207

208208
rcu_read_lock();
209209
if (stat->wcid < ARRAY_SIZE(dev->wcid))
210210
wcid = rcu_dereference(dev->wcid[stat->wcid]);
211211

212212
if (wcid) {
213213
void *priv;
214-
priv = msta = container_of(wcid, struct mt76_sta, wcid);
214+
priv = msta = container_of(wcid, struct mt76x02_sta, wcid);
215215
sta = container_of(priv, struct ieee80211_sta, drv_priv);
216216
}
217217

@@ -413,7 +413,7 @@ void mt76x0_mac_set_ampdu_factor(struct mt76x0_dev *dev)
413413
if (!wcid)
414414
continue;
415415

416-
msta = container_of(wcid, struct mt76_sta, wcid);
416+
msta = container_of(wcid, struct mt76x02_sta, wcid);
417417
sta = container_of(msta, struct ieee80211_sta, drv_priv);
418418

419419
min_factor = min(min_factor, sta->ht_cap.ampdu_factor);

drivers/net/wireless/mediatek/mt76/mt76x0/mac.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ void mt76x0_mac_wcid_set_rate(struct mt76x0_dev *dev, struct mt76_wcid *wcid,
143143

144144
u16 mt76x0_mac_tx_rate_val(struct mt76x0_dev *dev,
145145
const struct ieee80211_tx_rate *rate, u8 *nss_val);
146-
struct mt76_tx_status
146+
struct mt76x02_tx_status
147147
mt76x0_mac_fetch_tx_status(struct mt76x0_dev *dev);
148-
void mt76x0_send_tx_status(struct mt76x0_dev *dev, struct mt76_tx_status *stat, u8 *update);
148+
void mt76x0_send_tx_status(struct mt76x0_dev *dev, struct mt76x02_tx_status *stat, u8 *update);
149149

150150
#endif

drivers/net/wireless/mediatek/mt76/mt76x0/main.c

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ mt76x0_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
161161
struct ieee80211_sta *sta)
162162
{
163163
struct mt76x0_dev *dev = hw->priv;
164-
struct mt76_sta *msta = (struct mt76_sta *) sta->drv_priv;
164+
struct mt76x02_sta *msta = (struct mt76x02_sta *) sta->drv_priv;
165165
struct mt76x02_vif *mvif = (struct mt76x02_vif *) vif->drv_priv;
166166
int ret = 0;
167167
int idx = 0;
@@ -196,7 +196,7 @@ mt76x0_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
196196
struct ieee80211_sta *sta)
197197
{
198198
struct mt76x0_dev *dev = hw->priv;
199-
struct mt76_sta *msta = (struct mt76_sta *) sta->drv_priv;
199+
struct mt76x02_sta *msta = (struct mt76x02_sta *) sta->drv_priv;
200200
int idx = msta->wcid.idx;
201201
int i;
202202

@@ -251,7 +251,7 @@ mt76x0_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
251251
{
252252
struct mt76x0_dev *dev = hw->priv;
253253
struct mt76x02_vif *mvif = (struct mt76x02_vif *) vif->drv_priv;
254-
struct mt76_sta *msta = sta ? (struct mt76_sta *) sta->drv_priv : NULL;
254+
struct mt76x02_sta *msta = sta ? (struct mt76x02_sta *) sta->drv_priv : NULL;
255255
struct mt76_wcid *wcid = msta ? &msta->wcid : &mvif->group_wcid;
256256
int idx = key->keyidx;
257257
int ret;
@@ -294,12 +294,17 @@ mt76_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
294294
{
295295
struct mt76x0_dev *dev = hw->priv;
296296
struct ieee80211_sta *sta = params->sta;
297+
struct mt76x02_sta *msta = (struct mt76x02_sta *) sta->drv_priv;
297298
enum ieee80211_ampdu_mlme_action action = params->action;
299+
struct ieee80211_txq *txq = sta->txq[params->tid];
298300
u16 tid = params->tid;
299301
u16 *ssn = &params->ssn;
300-
struct mt76_sta *msta = (struct mt76_sta *) sta->drv_priv;
302+
struct mt76_txq *mtxq;
301303

302-
WARN_ON(msta->wcid.idx > N_WCIDS);
304+
if (!txq)
305+
return -EINVAL;
306+
307+
mtxq = (struct mt76_txq *)txq->drv_priv;
303308

304309
switch (action) {
305310
case IEEE80211_AMPDU_RX_START:
@@ -309,13 +314,13 @@ mt76_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
309314
mt76_clear(dev, MT_WCID_ADDR(msta->wcid.idx) + 4, BIT(16 + tid));
310315
break;
311316
case IEEE80211_AMPDU_TX_OPERATIONAL:
312-
ieee80211_send_bar(vif, sta->addr, tid, msta->agg_ssn[tid]);
317+
ieee80211_send_bar(vif, sta->addr, tid, mtxq->agg_ssn);
313318
break;
314319
case IEEE80211_AMPDU_TX_STOP_FLUSH:
315320
case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT:
316321
break;
317322
case IEEE80211_AMPDU_TX_START:
318-
msta->agg_ssn[tid] = *ssn << 4;
323+
mtxq->agg_ssn = *ssn << 4;
319324
ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid);
320325
break;
321326
case IEEE80211_AMPDU_TX_STOP_CONT:
@@ -331,7 +336,7 @@ mt76_sta_rate_tbl_update(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
331336
struct ieee80211_sta *sta)
332337
{
333338
struct mt76x0_dev *dev = hw->priv;
334-
struct mt76_sta *msta = (struct mt76_sta *) sta->drv_priv;
339+
struct mt76x02_sta *msta = (struct mt76x02_sta *) sta->drv_priv;
335340
struct ieee80211_sta_rates *rates;
336341
struct ieee80211_tx_rate rate = {};
337342

drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -219,25 +219,6 @@ struct mt76x0_wcid {
219219
u8 tx_rate_nss;
220220
};
221221

222-
struct mt76_tx_status {
223-
u8 valid:1;
224-
u8 success:1;
225-
u8 aggr:1;
226-
u8 ack_req:1;
227-
u8 is_probe:1;
228-
u8 wcid;
229-
u8 pktid;
230-
u8 retry;
231-
u16 rate;
232-
} __packed __aligned(2);
233-
234-
struct mt76_sta {
235-
struct mt76_wcid wcid;
236-
struct mt76_tx_status status;
237-
int n_frames;
238-
u16 agg_ssn[IEEE80211_NUM_TIDS];
239-
};
240-
241222
struct mt76_reg_pair {
242223
u32 reg;
243224
u32 value;

drivers/net/wireless/mediatek/mt76/mt76x0/trace.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,13 +197,13 @@ TRACE_EVENT(mt76x0_rx,
197197

198198
TRACE_EVENT(mt76x0_tx,
199199
TP_PROTO(struct mt76_dev *dev, struct sk_buff *skb,
200-
struct mt76_sta *sta, struct mt76_txwi *h),
200+
struct mt76x02_sta *sta, struct mt76_txwi *h),
201201
TP_ARGS(dev, skb, sta, h),
202202
TP_STRUCT__entry(
203203
DEV_ENTRY
204204
__field_struct(struct mt76_txwi, h)
205205
__field(struct sk_buff *, skb)
206-
__field(struct mt76_sta *, sta)
206+
__field(struct mt76x02_sta *, sta)
207207
),
208208
TP_fast_assign(
209209
DEV_ASSIGN;

drivers/net/wireless/mediatek/mt76/mt76x0/tx.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ void mt76x0_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control,
149149
struct mt76x0_dev *dev = hw->priv;
150150
struct ieee80211_vif *vif = info->control.vif;
151151
struct ieee80211_sta *sta = control->sta;
152-
struct mt76_sta *msta = NULL;
152+
struct mt76x02_sta *msta = NULL;
153153
struct mt76_wcid *wcid = dev->mon_wcid;
154154
struct mt76_txwi *txwi;
155155
int pkt_len = skb->len;
@@ -164,7 +164,7 @@ void mt76x0_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control,
164164
}
165165

166166
if (sta) {
167-
msta = (struct mt76_sta *) sta->drv_priv;
167+
msta = (struct mt76x02_sta *) sta->drv_priv;
168168
wcid = &msta->wcid;
169169
} else if (vif && (!info->control.hw_key && wcid->hw_key_idx != 0xff)) {
170170
struct mt76x02_vif *mvif = (struct mt76x02_vif *)vif->drv_priv;
@@ -184,7 +184,7 @@ void mt76x0_tx_stat(struct work_struct *work)
184184
{
185185
struct mt76x0_dev *dev = container_of(work, struct mt76x0_dev,
186186
stat_work.work);
187-
struct mt76_tx_status stat;
187+
struct mt76x02_tx_status stat;
188188
unsigned long flags;
189189
int cleaned = 0;
190190
u8 update = 1;

0 commit comments

Comments
 (0)