Search Linux Wireless

Re: [PATCH 1/7] mt76: mt7915: rely on mt76_connac_mcu_alloc_sta_req

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2021-12-17 18:48, Lorenzo Bianconi wrote:
Rely on mt76_connac_mcu_alloc_sta_req routine and remove
duplicated code.
Add MT76_CONNAC_LIB module dependency in mt7915 module

Signed-off-by: Lorenzo Bianconi <lorenzo@xxxxxxxxxx>
---
  .../net/wireless/mediatek/mt76/mt76_connac.h  |  5 ++
  .../wireless/mediatek/mt76/mt76_connac_mcu.c  | 10 +--
  .../wireless/mediatek/mt76/mt76_connac_mcu.h  | 23 ++++++-
  .../net/wireless/mediatek/mt76/mt7915/Kconfig |  2 +-
  .../net/wireless/mediatek/mt76/mt7915/mcu.c   | 66 +++++++------------
  .../wireless/mediatek/mt76/mt7915/mt7915.h    |  5 --
  6 files changed, 54 insertions(+), 57 deletions(-)

  				  struct mt76_connac_pm *pm);
diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
index f79e3d5084f3..fc5c870da420 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
@@ -266,19 +266,19 @@ mt76_connac_mcu_add_nested_tlv(struct sk_buff *skb, int tag, int len,
  EXPORT_SYMBOL_GPL(mt76_connac_mcu_add_nested_tlv);
struct sk_buff *
-mt76_connac_mcu_alloc_sta_req(struct mt76_dev *dev, struct mt76_vif *mvif,
-			      struct mt76_wcid *wcid)
+__mt76_connac_mcu_alloc_sta_req(struct mt76_dev *dev, struct mt76_vif *mvif,
+				struct mt76_wcid *wcid, int len)
  {
  	struct sta_req_hdr hdr = {
  		.bss_idx = mvif->idx,
-		.muar_idx = wcid ? mvif->omac_idx : 0,
  		.is_tlv_append = 1,
  	};
  	struct sk_buff *skb;
+ hdr.muar_idx = mt76_connac_mcu_get_muar_idx(dev, wcid, mvif);
No need for a separate inline function if it's only used in this one place.

diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
index 5baf8370b7bd..4c0220df18b4 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
@@ -570,6 +570,7 @@ struct wtbl_raw {
  					 sizeof(struct sta_rec_muru) +	\
  					 sizeof(struct sta_rec_bfee) +	\
  					 sizeof(struct sta_rec_ra) +	\
+					 sizeof(struct sta_rec_sec) +	\
  					 sizeof(struct sta_rec_ra_fixed) + \
  					 sizeof(struct sta_rec_he_6g_capa) + \
  					 sizeof(struct tlv) +		\
@@ -1436,7 +1437,7 @@ mt76_connac_mcu_get_wlan_idx(struct mt76_dev *dev, struct mt76_wcid *wcid,
  {
  	*wlan_idx_hi = 0;
- if (is_mt7921(dev)) {
+	if (is_mt7921(dev) || is_mt7915(dev)) {
  		*wlan_idx_lo = wcid ? to_wcid_lo(wcid->idx) : 0;
  		*wlan_idx_hi = wcid ? to_wcid_hi(wcid->idx) : 0;
  	} else {
@@ -1444,9 +1445,27 @@ mt76_connac_mcu_get_wlan_idx(struct mt76_dev *dev, struct mt76_wcid *wcid,
  	}
  }
+static inline int
+mt76_connac_mcu_get_muar_idx(struct mt76_dev *dev, struct mt76_wcid *wcid,
+			     struct mt76_vif *mvif)
+{
+	if (is_mt7915(dev))
+		return wcid && wcid->sta ? mvif->omac_idx : 0xe;
+
+	return wcid ? mvif->omac_idx : 0;
From what I can tell, the broadcast muar index should be 0xe for all chips, not just mt7915. Would make sense to do this in a separate patch before this one though.

- Felix



[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux