Commit b2d91fb3 authored by Stanislaw Gruszka's avatar Stanislaw Gruszka Committed by Kalle Valo
Browse files

mt76: unify sta structure part 2



Second part of unifying mt76x02_sta structure between mt76x0 and mt76x2.

Signed-off-by: default avatarStanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent f5a7f126
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -18,6 +18,8 @@
#ifndef __MT76X02_MAC_H
#define __MT76X02_MAC_H

#include <linux/average.h>

struct mt76x02_tx_status {
	u8 valid:1;
	u8 success:1;
@@ -35,12 +37,17 @@ struct mt76x02_vif {
	struct mt76_wcid group_wcid;
};

DECLARE_EWMA(signal, 10, 8);

struct mt76x02_sta {
	struct mt76_wcid wcid; /* must be first */

	struct mt76x02_vif *vif;
	struct mt76x02_tx_status status;
	int n_frames;

	struct ewma_signal rssi;
	int inactive_count;
};

static inline bool mt76x02_wait_for_mac(struct mt76_dev *dev)
+3 −17
Original line number Diff line number Diff line
@@ -27,7 +27,6 @@
#include <linux/mutex.h>
#include <linux/bitops.h>
#include <linux/kfifo.h>
#include <linux/average.h>

#define MT7662_FIRMWARE		"mt7662.bin"
#define MT7662_ROM_PATCH	"mt7662_rom_patch.bin"
@@ -51,8 +50,6 @@
#include "mt76x2_mac.h"
#include "mt76x2_dfs.h"

DECLARE_EWMA(signal, 10, 8)

struct mt76x2_mcu {
	struct mutex mutex;

@@ -104,7 +101,7 @@ struct mt76x2_dev {
	int txpower_cur;

	u8 txdone_seq;
	DECLARE_KFIFO_PTR(txstatus_fifo, struct mt76x2_tx_status);
	DECLARE_KFIFO_PTR(txstatus_fifo, struct mt76x02_tx_status);

	struct mt76x2_mcu mcu;
	struct sk_buff *rx_head;
@@ -144,17 +141,6 @@ struct mt76x2_dev {
	struct mt76x2_dfs_pattern_detector dfs_pd;
};

struct mt76x2_sta {
	struct mt76_wcid wcid; /* must be first */

	struct mt76x02_vif *vif;
	struct mt76x2_tx_status status;
	int n_frames;

	struct ewma_signal rssi;
	int inactive_count;
};

static inline bool is_mt7612(struct mt76x2_dev *dev)
{
	return mt76_chip(&dev->mt76) == 0x7612;
@@ -264,9 +250,9 @@ void mt76x2_tx_set_txpwr_auto(struct mt76x2_dev *dev, s8 txpwr);
int mt76x2_insert_hdr_pad(struct sk_buff *skb);

bool mt76x2_mac_load_tx_status(struct mt76x2_dev *dev,
			       struct mt76x2_tx_status *stat);
			       struct mt76x02_tx_status *stat);
void mt76x2_send_tx_status(struct mt76x2_dev *dev,
			   struct mt76x2_tx_status *stat, u8 *update);
			   struct mt76x02_tx_status *stat, u8 *update);
void mt76x2_reset_wlan(struct mt76x2_dev *dev, bool enable);
void mt76x2_init_txpower(struct mt76x2_dev *dev,
			 struct ieee80211_supported_band *sband);
+6 −6
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ int mt76x2_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
	enum ieee80211_ampdu_mlme_action action = params->action;
	struct ieee80211_sta *sta = params->sta;
	struct mt76x2_dev *dev = hw->priv;
	struct mt76x2_sta *msta = (struct mt76x2_sta *) sta->drv_priv;
	struct mt76x02_sta *msta = (struct mt76x02_sta *) sta->drv_priv;
	struct ieee80211_txq *txq = sta->txq[params->tid];
	u16 tid = params->tid;
	u16 *ssn = &params->ssn;
@@ -73,7 +73,7 @@ int mt76x2_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
		   struct ieee80211_sta *sta)
{
	struct mt76x2_dev *dev = hw->priv;
	struct mt76x2_sta *msta = (struct mt76x2_sta *) sta->drv_priv;
	struct mt76x02_sta *msta = (struct mt76x02_sta *) sta->drv_priv;
	struct mt76x02_vif *mvif = (struct mt76x02_vif *) vif->drv_priv;
	int ret = 0;
	int idx = 0;
@@ -114,7 +114,7 @@ int mt76x2_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
		      struct ieee80211_sta *sta)
{
	struct mt76x2_dev *dev = hw->priv;
	struct mt76x2_sta *msta = (struct mt76x2_sta *) sta->drv_priv;
	struct mt76x02_sta *msta = (struct mt76x02_sta *) sta->drv_priv;
	int idx = msta->wcid.idx;
	int i;

@@ -146,7 +146,7 @@ int mt76x2_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
{
	struct mt76x2_dev *dev = hw->priv;
	struct mt76x02_vif *mvif = (struct mt76x02_vif *) vif->drv_priv;
	struct mt76x2_sta *msta;
	struct mt76x02_sta *msta;
	struct mt76_wcid *wcid;
	int idx = key->keyidx;
	int ret;
@@ -173,7 +173,7 @@ int mt76x2_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
	    !(key->flags & IEEE80211_KEY_FLAG_PAIRWISE))
		return -EOPNOTSUPP;

	msta = sta ? (struct mt76x2_sta *) sta->drv_priv : NULL;
	msta = sta ? (struct mt76x02_sta *) sta->drv_priv : NULL;
	wcid = msta ? &msta->wcid : &mvif->group_wcid;

	if (cmd == SET_KEY) {
@@ -256,7 +256,7 @@ void mt76x2_sta_rate_tbl_update(struct ieee80211_hw *hw,
				struct ieee80211_sta *sta)
{
	struct mt76x2_dev *dev = hw->priv;
	struct mt76x2_sta *msta = (struct mt76x2_sta *) sta->drv_priv;
	struct mt76x02_sta *msta = (struct mt76x02_sta *) sta->drv_priv;
	struct ieee80211_sta_rates *rates = rcu_dereference(sta->rates);
	struct ieee80211_tx_rate rate = {};

+1 −1
Original line number Diff line number Diff line
@@ -533,7 +533,7 @@ int mt76x2_register_device(struct mt76x2_dev *dev)
	int fifo_size;
	int i, ret;

	fifo_size = roundup_pow_of_two(32 * sizeof(struct mt76x2_tx_status));
	fifo_size = roundup_pow_of_two(32 * sizeof(struct mt76x02_tx_status));
	status_fifo = devm_kzalloc(dev->mt76.dev, fifo_size, GFP_KERNEL);
	if (!status_fifo)
		return -ENOMEM;
+1 −1
Original line number Diff line number Diff line
@@ -208,7 +208,7 @@ void mt76x2_init_device(struct mt76x2_dev *dev)
	hw->max_rate_tries = 1;
	hw->extra_tx_headroom = 2;

	hw->sta_data_size = sizeof(struct mt76x2_sta);
	hw->sta_data_size = sizeof(struct mt76x02_sta);
	hw->vif_data_size = sizeof(struct mt76x02_vif);

	ieee80211_hw_set(hw, SUPPORTS_HT_CCK_RATES);
Loading