Commit d502e300 authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by Felix Fietkau

mt76: mt7915: rely on mt76_dev in mt7915_mac_write_txwi signature

This is a preliminary patch to share txwi configuration code.
Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent e00b3e40
...@@ -1010,8 +1010,8 @@ mt7915_mac_write_txwi_tm(struct mt7915_phy *phy, __le32 *txwi, ...@@ -1010,8 +1010,8 @@ mt7915_mac_write_txwi_tm(struct mt7915_phy *phy, __le32 *txwi,
} }
static void static void
mt7915_mac_write_txwi_8023(struct mt7915_dev *dev, __le32 *txwi, mt7915_mac_write_txwi_8023(__le32 *txwi, struct sk_buff *skb,
struct sk_buff *skb, struct mt76_wcid *wcid) struct mt76_wcid *wcid)
{ {
u8 tid = skb->priority & IEEE80211_QOS_CTL_TID_MASK; u8 tid = skb->priority & IEEE80211_QOS_CTL_TID_MASK;
...@@ -1050,9 +1050,8 @@ mt7915_mac_write_txwi_8023(struct mt7915_dev *dev, __le32 *txwi, ...@@ -1050,9 +1050,8 @@ mt7915_mac_write_txwi_8023(struct mt7915_dev *dev, __le32 *txwi,
} }
static void static void
mt7915_mac_write_txwi_80211(struct mt7915_dev *dev, __le32 *txwi, mt7915_mac_write_txwi_80211(__le32 *txwi, struct sk_buff *skb,
struct sk_buff *skb, struct ieee80211_key_conf *key, struct ieee80211_key_conf *key, bool *mcast)
bool *mcast)
{ {
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)skb->data; struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)skb->data;
...@@ -1175,13 +1174,13 @@ mt7915_mac_tx_rate_val(struct mt76_phy *mphy, struct ieee80211_vif *vif, ...@@ -1175,13 +1174,13 @@ mt7915_mac_tx_rate_val(struct mt76_phy *mphy, struct ieee80211_vif *vif,
FIELD_PREP(MT_TX_RATE_MODE, mode); FIELD_PREP(MT_TX_RATE_MODE, mode);
} }
void mt7915_mac_write_txwi(struct mt7915_dev *dev, __le32 *txwi, void mt7915_mac_write_txwi(struct mt76_dev *dev, __le32 *txwi,
struct sk_buff *skb, struct mt76_wcid *wcid, int pid, struct sk_buff *skb, struct mt76_wcid *wcid, int pid,
struct ieee80211_key_conf *key, u32 changed) struct ieee80211_key_conf *key, u32 changed)
{ {
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
struct ieee80211_vif *vif = info->control.vif; struct ieee80211_vif *vif = info->control.vif;
struct mt76_phy *mphy = &dev->mphy; struct mt76_phy *mphy = &dev->phy;
bool ext_phy = info->hw_queue & MT_TX_HW_QUEUE_EXT_PHY; bool ext_phy = info->hw_queue & MT_TX_HW_QUEUE_EXT_PHY;
u8 p_fmt, q_idx, omac_idx = 0, wmm_idx = 0, band_idx = 0; u8 p_fmt, q_idx, omac_idx = 0, wmm_idx = 0, band_idx = 0;
bool is_8023 = info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP; bool is_8023 = info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP;
...@@ -1201,8 +1200,8 @@ void mt7915_mac_write_txwi(struct mt7915_dev *dev, __le32 *txwi, ...@@ -1201,8 +1200,8 @@ void mt7915_mac_write_txwi(struct mt7915_dev *dev, __le32 *txwi,
band_idx = mvif->mt76.band_idx; band_idx = mvif->mt76.band_idx;
} }
if (ext_phy && dev->mt76.phy2) if (ext_phy && dev->phy2)
mphy = dev->mt76.phy2; mphy = dev->phy2;
if (inband_disc) { if (inband_disc) {
p_fmt = MT_TX_TYPE_FW; p_fmt = MT_TX_TYPE_FW;
...@@ -1254,9 +1253,9 @@ void mt7915_mac_write_txwi(struct mt7915_dev *dev, __le32 *txwi, ...@@ -1254,9 +1253,9 @@ void mt7915_mac_write_txwi(struct mt7915_dev *dev, __le32 *txwi,
txwi[7] = wcid->amsdu ? cpu_to_le32(MT_TXD7_HW_AMSDU) : 0; txwi[7] = wcid->amsdu ? cpu_to_le32(MT_TXD7_HW_AMSDU) : 0;
if (is_8023) if (is_8023)
mt7915_mac_write_txwi_8023(dev, txwi, skb, wcid); mt7915_mac_write_txwi_8023(txwi, skb, wcid);
else else
mt7915_mac_write_txwi_80211(dev, txwi, skb, key, &mcast); mt7915_mac_write_txwi_80211(txwi, skb, key, &mcast);
if (txwi[2] & cpu_to_le32(MT_TXD2_FIX_RATE)) { if (txwi[2] & cpu_to_le32(MT_TXD2_FIX_RATE)) {
u16 rate = mt7915_mac_tx_rate_val(mphy, vif, beacon, mcast); u16 rate = mt7915_mac_tx_rate_val(mphy, vif, beacon, mcast);
...@@ -1315,7 +1314,7 @@ int mt7915_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr, ...@@ -1315,7 +1314,7 @@ int mt7915_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
return id; return id;
pid = mt76_tx_status_skb_add(mdev, wcid, tx_info->skb); pid = mt76_tx_status_skb_add(mdev, wcid, tx_info->skb);
mt7915_mac_write_txwi(dev, txwi_ptr, tx_info->skb, wcid, pid, key, 0); mt7915_mac_write_txwi(mdev, txwi_ptr, tx_info->skb, wcid, pid, key, 0);
txp = (struct mt7915_txp *)(txwi + MT_TXD_SIZE); txp = (struct mt7915_txp *)(txwi + MT_TXD_SIZE);
for (i = 0; i < nbuf; i++) { for (i = 0; i < nbuf; i++) {
......
...@@ -1853,7 +1853,7 @@ mt7915_mcu_beacon_cont(struct mt7915_dev *dev, struct ieee80211_vif *vif, ...@@ -1853,7 +1853,7 @@ mt7915_mcu_beacon_cont(struct mt7915_dev *dev, struct ieee80211_vif *vif,
} }
buf = (u8 *)tlv + sizeof(*cont); buf = (u8 *)tlv + sizeof(*cont);
mt7915_mac_write_txwi(dev, (__le32 *)buf, skb, wcid, 0, NULL, mt7915_mac_write_txwi(&dev->mt76, (__le32 *)buf, skb, wcid, 0, NULL,
BSS_CHANGED_BEACON); BSS_CHANGED_BEACON);
memcpy(buf + MT_TXD_SIZE, skb->data, skb->len); memcpy(buf + MT_TXD_SIZE, skb->data, skb->len);
} }
...@@ -1992,7 +1992,7 @@ mt7915_mcu_beacon_inband_discov(struct mt7915_dev *dev, struct ieee80211_vif *vi ...@@ -1992,7 +1992,7 @@ mt7915_mcu_beacon_inband_discov(struct mt7915_dev *dev, struct ieee80211_vif *vi
buf = (u8 *)tlv + sizeof(*discov); buf = (u8 *)tlv + sizeof(*discov);
mt7915_mac_write_txwi(dev, (__le32 *)buf, skb, wcid, 0, NULL, mt7915_mac_write_txwi(&dev->mt76, (__le32 *)buf, skb, wcid, 0, NULL,
changed); changed);
memcpy(buf + MT_TXD_SIZE, skb->data, skb->len); memcpy(buf + MT_TXD_SIZE, skb->data, skb->len);
......
...@@ -564,7 +564,7 @@ bool mt7915_mac_wtbl_update(struct mt7915_dev *dev, int idx, u32 mask); ...@@ -564,7 +564,7 @@ bool mt7915_mac_wtbl_update(struct mt7915_dev *dev, int idx, u32 mask);
void mt7915_mac_reset_counters(struct mt7915_phy *phy); void mt7915_mac_reset_counters(struct mt7915_phy *phy);
void mt7915_mac_cca_stats_reset(struct mt7915_phy *phy); void mt7915_mac_cca_stats_reset(struct mt7915_phy *phy);
void mt7915_mac_enable_nf(struct mt7915_dev *dev, bool ext_phy); void mt7915_mac_enable_nf(struct mt7915_dev *dev, bool ext_phy);
void mt7915_mac_write_txwi(struct mt7915_dev *dev, __le32 *txwi, void mt7915_mac_write_txwi(struct mt76_dev *dev, __le32 *txwi,
struct sk_buff *skb, struct mt76_wcid *wcid, int pid, struct sk_buff *skb, struct mt76_wcid *wcid, int pid,
struct ieee80211_key_conf *key, u32 changed); struct ieee80211_key_conf *key, u32 changed);
void mt7915_mac_set_timing(struct mt7915_phy *phy); void mt7915_mac_set_timing(struct mt7915_phy *phy);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment