mt76 patches 2018-09-04
Subsystems (2)
cover mt76 patches 2018-09-04
More mt76x0/mt76x2 integration.
This set is quite big but I would like to move patches upstream from my github tree as fast as possible. I have there 42 more ready to post patches from me and Lorenzo.
https://github.com/sgruszka/wireless-drivers-next/commits/mt76x0-draft-v3
Note this set include:
"mt76x0: fix wrong usage of wcid_mask in remove_interface" patch with I posted as fix for 4.19 . I assume this will be auto (or manually?) merged when -next will go to 4.20.
Stanislaw Gruszka (22):
mt76: move wcid fields to common mt76_dev struct
mt76: unify sta_add / sta_remove
mt76: pratially unify add_interface
mt76x0: fix wrong usage of wcid_mask in remove_interface
mt76: unify ampdu_action
mt76: unify set_key
mt76x0: remove empty sta_notify
mt76: unify AC to hw queue mapping
mt76: remove q->hw_idx
mt76: unify conf_tx
mt76x0: remove vif_mask
mt76: unify remove_interface
mt76: unify add_interface
mt76: unify sta_rate_tbl_update and related helpers
mt76: unify txwi and rxwi structures
mt76: unify load_tx_status
mt76: unify send_tx_status and related helpers
mt76: use mt76_rx_status in mt76x0
mt76: unify mac_process_rate
mt76x0: reserve enough space in mac80211
mt76: unify {insert/remove}_hdr_pad
mt76: partially unify filling txwi fields
drivers/net/wireless/mediatek/mt76/mac80211.c | 3 +- drivers/net/wireless/mediatek/mt76/mt76.h | 23 +- drivers/net/wireless/mediatek/mt76/mt76x0/Makefile | 2 +- drivers/net/wireless/mediatek/mt76/mt76x0/dma.c | 14 +- drivers/net/wireless/mediatek/mt76/mt76x0/init.c | 24 +- drivers/net/wireless/mediatek/mt76/mt76x0/mac.c | 310 +---------------- drivers/net/wireless/mediatek/mt76/mt76x0/mac.h | 130 -------- drivers/net/wireless/mediatek/mt76/mt76x0/main.c | 215 +----------- drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h | 26 +- drivers/net/wireless/mediatek/mt76/mt76x0/phy.c | 2 +- drivers/net/wireless/mediatek/mt76/mt76x0/trace.h | 12 +- drivers/net/wireless/mediatek/mt76/mt76x0/tx.c | 144 +------- drivers/net/wireless/mediatek/mt76/mt76x0/util.c | 42 --- drivers/net/wireless/mediatek/mt76/mt76x02_mac.c | 347 +++++++++++++++++++ drivers/net/wireless/mediatek/mt76/mt76x02_mac.h | 122 ++++++- drivers/net/wireless/mediatek/mt76/mt76x02_util.c | 325 ++++++++++++++++++ drivers/net/wireless/mediatek/mt76/mt76x02_util.h | 23 ++ drivers/net/wireless/mediatek/mt76/mt76x2.h | 23 +- drivers/net/wireless/mediatek/mt76/mt76x2_common.c | 254 +------------- drivers/net/wireless/mediatek/mt76/mt76x2_dma.c | 17 +- drivers/net/wireless/mediatek/mt76/mt76x2_init.c | 3 +- .../wireless/mediatek/mt76/mt76x2_init_common.c | 4 +- drivers/net/wireless/mediatek/mt76/mt76x2_mac.c | 12 +- drivers/net/wireless/mediatek/mt76/mt76x2_mac.h | 110 +----- .../net/wireless/mediatek/mt76/mt76x2_mac_common.c | 368 +-------------------- drivers/net/wireless/mediatek/mt76/mt76x2_main.c | 50 +-- .../net/wireless/mediatek/mt76/mt76x2_phy_common.c | 6 +- drivers/net/wireless/mediatek/mt76/mt76x2_tx.c | 3 +- .../net/wireless/mediatek/mt76/mt76x2_tx_common.c | 21 +- drivers/net/wireless/mediatek/mt76/mt76x2u_core.c | 18 +- drivers/net/wireless/mediatek/mt76/mt76x2u_main.c | 22 +- drivers/net/wireless/mediatek/mt76/tx.c | 16 + drivers/net/wireless/mediatek/mt76/usb.c | 6 +- 33 files changed, 974 insertions(+), 1723 deletions(-) delete mode 100644 drivers/net/wireless/mediatek/mt76/mt76x0/util.c
Signature · 1 line
2.7.5
A message that is not in the archive (sent off-list or not yet received): 1536072075-6990-1-git-send-email-sgruszka-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
PATCH 1/22 mt76: move wcid fields to common mt76_dev struct
All current MT devices including new MT7603 type chips support 128 WCIDs, we can unify wcid data in common mt76_dev structure.
--- drivers/net/wireless/mediatek/mt76/mt76.h | 7 +++++++ drivers/net/wireless/mediatek/mt76/mt76x0/init.c | 22 +++++++++------------- drivers/net/wireless/mediatek/mt76/mt76x0/mac.c | 8 ++++---- drivers/net/wireless/mediatek/mt76/mt76x0/main.c | 10 +++++----- drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h | 5 ----- drivers/net/wireless/mediatek/mt76/mt76x0/tx.c | 2 +- drivers/net/wireless/mediatek/mt76/mt76x2.h | 5 ----- drivers/net/wireless/mediatek/mt76/mt76x2_common.c | 8 ++++---- .../wireless/mediatek/mt76/mt76x2_init_common.c | 4 ++-- .../net/wireless/mediatek/mt76/mt76x2_mac_common.c | 8 ++++---- .../net/wireless/mediatek/mt76/mt76x2_phy_common.c | 6 +++--- .../net/wireless/mediatek/mt76/mt76x2_tx_common.c | 2 +- 12 files changed, 40 insertions(+), 47 deletions(-)
drivers/net/wireless/mediatek/mt76/mt76.h +7 -0
@@ -148,6 +148,8 @@ enum mt76_wcid_flags { MT_WCID_FLAG_PS, }; +#define MT76_N_WCIDS 128 +struct mt76_wcid {struct mt76_rx_tid __rcu *aggr[IEEE80211_NUM_TIDS ];
@@ -348,6 +350,11 @@ struct mt76_dev {wait_queue_head_t tx_wait; +unsigned long wcid_mask[MT76_N_WCIDS /BITS_PER_LONG ]; + +struct mt76_wcid global_wcid; +struct mt76_wcid __rcu *wcid[MT76_N_WCIDS ]; +u8 macaddr[ETH_ALEN ];u32 rev;unsigned long state;
drivers/net/wireless/mediatek/mt76/mt76x0/init.c +9 -13
@@ -230,17 +230,17 @@ static int mt76x0_init_wcid_mem(struct mt76x0_dev *dev)u32 *vals;int i, ret; - vals =kmalloc (sizeof (*vals) *N_WCIDS *2 ,GFP_KERNEL ); + vals =kmalloc (sizeof (*vals) *MT76_N_WCIDS *2 ,GFP_KERNEL );if (!vals)return -ENOMEM ; -for (i =0 ; i <N_WCIDS ; i++) { +for (i =0 ; i <MT76_N_WCIDS ; i++) { vals[i *2 ] =0xffffffff ; vals[i *2 +1 ] =0x00ffffff ; } ret =mt76x0_burst_write_regs (dev,MT_WCID_ADDR_BASE , - vals,N_WCIDS *2 ); + vals,MT76_N_WCIDS *2 );kfree (vals);return ret;
@@ -259,15 +259,15 @@ static int mt76x0_init_wcid_attr_mem(struct mt76x0_dev *dev)u32 *vals;int i, ret; - vals =kmalloc (sizeof (*vals) *N_WCIDS *2 ,GFP_KERNEL ); + vals =kmalloc (sizeof (*vals) *MT76_N_WCIDS *2 ,GFP_KERNEL );if (!vals)return -ENOMEM ; -for (i =0 ; i <N_WCIDS *2 ; i++) +for (i =0 ; i <MT76_N_WCIDS *2 ; i++) vals[i] =1 ; ret =mt76x0_burst_write_regs (dev,MT_WCID_ATTR_BASE , - vals,N_WCIDS *2 ); + vals,MT76_N_WCIDS *2 );kfree (vals);return ret;
@@ -667,15 +667,11 @@ int mt76x0_register_device(struct mt76x0_dev *dev)/* Reserve WCID 0 for mcast - thanks to this APs WCID will go to * entry no. 1 like it does in the vendor driver. */ - dev->wcid_mask[0 ] |=1 ; + dev->mt76.wcid_mask[0 ] |=1 ;/* init fake wcid for monitor interfaces */ - dev->mon_wcid =devm_kmalloc (dev->mt76.dev,sizeof (*dev->mon_wcid), -GFP_KERNEL ); -if (!dev->mon_wcid) -return -ENOMEM ; - dev->mon_wcid->idx =0xff ; - dev->mon_wcid->hw_key_idx =-1 ; + dev->mt76.global_wcid.idx =0xff ; + dev->mt76.global_wcid.hw_key_idx =-1 ;SET_IEEE80211_DEV (hw, dev->mt76.dev);
drivers/net/wireless/mediatek/mt76/mt76x0/mac.c +4 -4
@@ -206,8 +206,8 @@ void mt76x0_send_tx_status(struct mt76x0_dev *dev, struct mt76x02_tx_status *stastruct mt76x02_sta *msta =NULL ;rcu_read_lock (); -if (stat->wcid <ARRAY_SIZE (dev->wcid)) - wcid =rcu_dereference (dev->wcid[stat->wcid]); +if (stat->wcid <ARRAY_SIZE (dev->mt76.wcid)) + wcid =rcu_dereference (dev->mt76.wcid[stat->wcid]);if (wcid) {void *priv;
@@ -408,8 +408,8 @@ void mt76x0_mac_set_ampdu_factor(struct mt76x0_dev *dev)int i;rcu_read_lock (); -for (i =0 ; i <ARRAY_SIZE (dev->wcid); i++) { - wcid =rcu_dereference (dev->wcid[i]); +for (i =0 ; i <ARRAY_SIZE (dev->mt76.wcid); i++) { + wcid =rcu_dereference (dev->mt76.wcid[i]);if (!wcid)continue ;
drivers/net/wireless/mediatek/mt76/mt76x0/main.c +5 -5
@@ -81,7 +81,7 @@ static void mt76x0_remove_interface(struct ieee80211_hw *hw,struct mt76x02_vif *mvif = (struct mt76x02_vif *) vif->drv_priv;unsigned int wcid = mvif->group_wcid.idx; - dev->wcid_mask[wcid /BITS_PER_LONG ] &= ~BIT (wcid %BITS_PER_LONG ); + dev->mt76.wcid_mask[wcid /BITS_PER_LONG ] &= ~BIT (wcid %BITS_PER_LONG );mt76_txq_remove (&dev->mt76, vif->txq); }
@@ -169,7 +169,7 @@ mt76x0_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,mutex_lock (&dev->mt76.mutex); - idx =mt76_wcid_alloc (dev->wcid_mask,ARRAY_SIZE (dev->wcid)); + idx =mt76_wcid_alloc (dev->mt76.wcid_mask,ARRAY_SIZE (dev->mt76.wcid));if (idx <0 ) { ret = -ENOSPC ; goto out;
@@ -180,7 +180,7 @@ mt76x0_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,mt76x02_mac_wcid_setup (&dev->mt76, idx, mvif->idx, sta->addr);mt76x02_mac_wcid_set_drop (&dev->mt76, idx, false);mt76_clear (dev,MT_WCID_DROP (idx),MT_WCID_DROP_MASK (idx)); -rcu_assign_pointer (dev->wcid[idx], &msta->wcid); +rcu_assign_pointer (dev->mt76.wcid[idx], &msta->wcid);for (i =0 ; i <ARRAY_SIZE (sta->txq); i++)mt76x02_txq_init (&dev->mt76, sta->txq[i]);mt76x0_mac_set_ampdu_factor (dev);
@@ -201,9 +201,9 @@ mt76x0_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif,int i;mutex_lock (&dev->mt76.mutex); -rcu_assign_pointer (dev->wcid[idx],NULL ); +rcu_assign_pointer (dev->mt76.wcid[idx],NULL );mt76x02_mac_wcid_set_drop (&dev->mt76, idx, true); -mt76_wcid_free (dev->wcid_mask, idx); +mt76_wcid_free (dev->mt76.wcid_mask, idx);for (i =0 ; i <ARRAY_SIZE (sta->txq); i++)mt76_txq_remove (&dev->mt76, sta->txq[i]);mt76x02_mac_wcid_setup (&dev->mt76, idx,0 ,NULL );
drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h +0 -5
@@ -96,7 +96,6 @@ struct mt76x0_tx_queue {* ...7e: group wcids * 7f: reserved */ -#define N_WCIDS 128#define GROUP_WCID (idx) (254 - idx)struct mt76x0_eeprom_params ;
@@ -144,7 +143,6 @@ struct mt76x0_dev {u8 in_ep[__MT_EP_IN_MAX];u16 in_max_packet; -unsigned long wcid_mask[DIV_ROUND_UP (N_WCIDS ,BITS_PER_LONG )];unsigned long vif_mask;struct delayed_work cal_work;
@@ -153,9 +151,6 @@ struct mt76x0_dev {struct workqueue_struct *stat_wq;struct delayed_work stat_work; -struct mt76_wcid *mon_wcid; -struct mt76_wcid __rcu *wcid[N_WCIDS ]; -spinlock_t mac_lock;const u16 *beacon_offsets;
drivers/net/wireless/mediatek/mt76/mt76x0/tx.c +1 -1
@@ -150,7 +150,7 @@ void mt76x0_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control,struct ieee80211_vif *vif = info->control.vif;struct ieee80211_sta *sta = control->sta;struct mt76x02_sta *msta =NULL ; -struct mt76_wcid *wcid = dev->mon_wcid; +struct mt76_wcid *wcid = &dev->mt76.global_wcid;struct mt76_txwi *txwi;int pkt_len = skb->len;int hw_q =skb2q (skb);
drivers/net/wireless/mediatek/mt76/mt76x2.h +0 -5
@@ -95,8 +95,6 @@ struct mt76x2_dev {struct mutex mutex;const u16 *beacon_offsets; -unsigned long wcid_mask[128 /BITS_PER_LONG ]; -int txpower_conf;int txpower_cur;
@@ -113,9 +111,6 @@ struct mt76x2_dev {u32 aggr_stats[32 ]; -struct mt76_wcid global_wcid; -struct mt76_wcid __rcu *wcid[128 ]; -spinlock_t irq_lock;u32 irqmask;
drivers/net/wireless/mediatek/mt76/mt76x2_common.c +4 -4
@@ -81,7 +81,7 @@ int mt76x2_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,mutex_lock (&dev->mt76.mutex); - idx =mt76_wcid_alloc (dev->wcid_mask,ARRAY_SIZE (dev->wcid)); + idx =mt76_wcid_alloc (dev->mt76.wcid_mask,ARRAY_SIZE (dev->mt76.wcid));if (idx <0 ) { ret = -ENOSPC ; goto out;
@@ -101,7 +101,7 @@ int mt76x2_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,ewma_signal_init (&msta->rssi); -rcu_assign_pointer (dev->wcid[idx], &msta->wcid); +rcu_assign_pointer (dev->mt76.wcid[idx], &msta->wcid); out:mutex_unlock (&dev->mt76.mutex);
@@ -119,11 +119,11 @@ int mt76x2_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif,int i;mutex_lock (&dev->mt76.mutex); -rcu_assign_pointer (dev->wcid[idx],NULL ); +rcu_assign_pointer (dev->mt76.wcid[idx],NULL );for (i =0 ; i <ARRAY_SIZE (sta->txq); i++)mt76_txq_remove (&dev->mt76, sta->txq[i]);mt76x02_mac_wcid_set_drop (&dev->mt76, idx, true); -mt76_wcid_free (dev->wcid_mask, idx); +mt76_wcid_free (dev->mt76.wcid_mask, idx);mt76x02_mac_wcid_setup (&dev->mt76, idx,0 ,NULL );mutex_unlock (&dev->mt76.mutex);
drivers/net/wireless/mediatek/mt76/mt76x2_init_common.c +2 -2
@@ -213,8 +213,8 @@ void mt76x2_init_device(struct mt76x2_dev *dev) dev->mt76.sband_5g.sband.ht_cap.cap |=IEEE80211_HT_CAP_LDPC_CODING ; dev->chainmask =0x202 ; - dev->global_wcid.idx =255 ; - dev->global_wcid.hw_key_idx =-1 ; + dev->mt76.global_wcid.idx =255 ; + dev->mt76.global_wcid.hw_key_idx =-1 ; dev->slottime =9 ;/* init antenna configuration */
drivers/net/wireless/mediatek/mt76/mt76x2_mac_common.c +4 -4
@@ -186,8 +186,8 @@ void mt76x2_send_tx_status(struct mt76x2_dev *dev,struct mt76x02_sta *msta =NULL ;rcu_read_lock (); -if (stat->wcid <ARRAY_SIZE (dev->wcid)) - wcid =rcu_dereference (dev->wcid[stat->wcid]); +if (stat->wcid <ARRAY_SIZE (dev->mt76.wcid)) + wcid =rcu_dereference (dev->mt76.wcid[stat->wcid]);if (wcid) {void *priv;
@@ -477,10 +477,10 @@ mt76x2_rx_get_sta(struct mt76x2_dev *dev, u8 idx) {struct mt76_wcid *wcid; -if (idx >=ARRAY_SIZE (dev->wcid)) +if (idx >=ARRAY_SIZE (dev->mt76.wcid))return NULL ; - wcid =rcu_dereference (dev->wcid[idx]); + wcid =rcu_dereference (dev->mt76.wcid[idx]);if (!wcid)return NULL ;
drivers/net/wireless/mediatek/mt76/mt76x2_phy_common.c +3 -3
@@ -311,8 +311,8 @@ int mt76x2_phy_get_min_avg_rssi(struct mt76x2_dev *dev)local_bh_disable ();rcu_read_lock (); -for (i =0 ; i <ARRAY_SIZE (dev->wcid_mask); i++) { -unsigned long mask = dev->wcid_mask[i]; +for (i =0 ; i <ARRAY_SIZE (dev->mt76.wcid_mask); i++) { +unsigned long mask = dev->mt76.wcid_mask[i];if (!mask)continue ;
@@ -321,7 +321,7 @@ int mt76x2_phy_get_min_avg_rssi(struct mt76x2_dev *dev)if (!(mask &1 ))continue ; - wcid =rcu_dereference (dev->wcid[j]); + wcid =rcu_dereference (dev->mt76.wcid[j]);if (!wcid)continue ;
drivers/net/wireless/mediatek/mt76/mt76x2_tx_common.c +1 -1
@@ -24,7 +24,7 @@ void mt76x2_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control,struct ieee80211_tx_info *info =IEEE80211_SKB_CB (skb);struct mt76x2_dev *dev = hw->priv;struct ieee80211_vif *vif = info->control.vif; -struct mt76_wcid *wcid = &dev->global_wcid; +struct mt76_wcid *wcid = &dev->mt76.global_wcid;if (control->sta) {struct mt76x02_sta *msta;
Signature · 1 line
2.7.5
PATCH 2/22 mt76: unify sta_add / sta_remove
In reply to a message not in the archiveMerge mt76x0 and mt76x0 sta add/remove callback. We drop mt76x0_mac_set_ampdu_factor() for now. Need to consider to add it to common code, but mt76x2 don't do it so perhaps mt76x0 don't need it as well.
--- drivers/net/wireless/mediatek/mt76/mt76x0/main.c | 61 +-------------------- drivers/net/wireless/mediatek/mt76/mt76x02_util.c | 63 ++++++++++++++++++++++ drivers/net/wireless/mediatek/mt76/mt76x02_util.h | 5 +- drivers/net/wireless/mediatek/mt76/mt76x2_common.c | 62 --------------------- drivers/net/wireless/mediatek/mt76/mt76x2_main.c | 4 +- drivers/net/wireless/mediatek/mt76/mt76x2u_main.c | 4 +- 6 files changed, 73 insertions(+), 126 deletions(-)
drivers/net/wireless/mediatek/mt76/mt76x0/main.c +2 -59
@@ -156,63 +156,6 @@ mt76x0_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,mutex_unlock (&dev->mt76.mutex); } -static int -mt76x0_sta_add (struct ieee80211_hw *hw,struct ieee80211_vif *vif, -struct ieee80211_sta *sta) -{ -struct mt76x0_dev *dev = hw->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 ; -int i; - -mutex_lock (&dev->mt76.mutex); - - idx =mt76_wcid_alloc (dev->mt76.wcid_mask,ARRAY_SIZE (dev->mt76.wcid)); -if (idx <0 ) { - ret = -ENOSPC ; - goto out; - } - - msta->wcid.idx = idx; - msta->wcid.hw_key_idx =-1 ; -mt76x02_mac_wcid_setup (&dev->mt76, idx, mvif->idx, sta->addr); -mt76x02_mac_wcid_set_drop (&dev->mt76, idx, false); -mt76_clear (dev,MT_WCID_DROP (idx),MT_WCID_DROP_MASK (idx)); -rcu_assign_pointer (dev->mt76.wcid[idx], &msta->wcid); -for (i =0 ; i <ARRAY_SIZE (sta->txq); i++) -mt76x02_txq_init (&dev->mt76, sta->txq[i]); -mt76x0_mac_set_ampdu_factor (dev); - -out: -mutex_unlock (&dev->mt76.mutex); - -return ret; -} - -static int -mt76x0_sta_remove (struct ieee80211_hw *hw,struct ieee80211_vif *vif, -struct ieee80211_sta *sta) -{ -struct mt76x0_dev *dev = hw->priv; -struct mt76x02_sta *msta = (struct mt76x02_sta *) sta->drv_priv; -int idx = msta->wcid.idx; -int i; - -mutex_lock (&dev->mt76.mutex); -rcu_assign_pointer (dev->mt76.wcid[idx],NULL ); -mt76x02_mac_wcid_set_drop (&dev->mt76, idx, true); -mt76_wcid_free (dev->mt76.wcid_mask, idx); -for (i =0 ; i <ARRAY_SIZE (sta->txq); i++) -mt76_txq_remove (&dev->mt76, sta->txq[i]); -mt76x02_mac_wcid_setup (&dev->mt76, idx,0 ,NULL ); -mt76x0_mac_set_ampdu_factor (dev); -mutex_unlock (&dev->mt76.mutex); - -return 0 ; -} -static void mt76x0_sta_notify (struct ieee80211_hw *hw,struct ieee80211_vif *vif,enum sta_notify_cmd cmd,struct ieee80211_sta *sta)
@@ -363,8 +306,8 @@ const struct ieee80211_ops mt76x0_ops = { .config = mt76x0_config, .configure_filter = mt76x02_configure_filter, .bss_info_changed = mt76x0_bss_info_changed, - .sta_add = mt76x0_sta_add, - .sta_remove = mt76x0_sta_remove, + .sta_add = mt76x02_sta_add, + .sta_remove = mt76x02_sta_remove, .sta_notify = mt76x0_sta_notify, .set_key = mt76x0_set_key, .conf_tx = mt76x0_conf_tx,
drivers/net/wireless/mediatek/mt76/mt76x02_util.c +63 -0
73 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt76x02_util.h +4 -1
@@ -21,5 +21,8 @@void mt76x02_configure_filter (struct ieee80211_hw *hw,unsigned int changed_flags,unsigned int *total_flags,u64 multicast); - +int mt76x02_sta_add (struct ieee80211_hw *hw,struct ieee80211_vif *vif, +struct ieee80211_sta *sta); +int mt76x02_sta_remove (struct ieee80211_hw *hw,struct ieee80211_vif *vif, +struct ieee80211_sta *sta);#endif
drivers/net/wireless/mediatek/mt76/mt76x2_common.c +0 -62
68 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt76x2_main.c +2 -2
@@ -323,8 +323,8 @@ const struct ieee80211_ops mt76x2_ops = { .config = mt76x2_config, .configure_filter = mt76x02_configure_filter, .bss_info_changed = mt76x2_bss_info_changed, - .sta_add = mt76x2_sta_add, - .sta_remove = mt76x2_sta_remove, + .sta_add = mt76x02_sta_add, + .sta_remove = mt76x02_sta_remove, .set_key = mt76x2_set_key, .conf_tx = mt76x2_conf_tx, .sw_scan_start = mt76x2_sw_scan,
drivers/net/wireless/mediatek/mt76/mt76x2u_main.c +2 -2
@@ -171,8 +171,8 @@ const struct ieee80211_ops mt76x2u_ops = { .stop = mt76x2u_stop, .add_interface = mt76x2u_add_interface, .remove_interface = mt76x2_remove_interface, - .sta_add = mt76x2_sta_add, - .sta_remove = mt76x2_sta_remove, + .sta_add = mt76x02_sta_add, + .sta_remove = mt76x02_sta_remove, .set_key = mt76x2_set_key, .ampdu_action = mt76x2_ampdu_action, .config = mt76x2u_config,
Signature · 1 line
2.7.5
PATCH 3/22 mt76: pratially unify add_interface
In reply to a message not in the archiveCreate common mt76x02_vif_init function and use int on drivers add_interface callback.
--- drivers/net/wireless/mediatek/mt76/mt76x0/main.c | 7 +------ drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h | 9 --------- drivers/net/wireless/mediatek/mt76/mt76x02_mac.h | 3 +++ drivers/net/wireless/mediatek/mt76/mt76x02_util.c | 12 ++++++++++++ drivers/net/wireless/mediatek/mt76/mt76x02_util.h | 3 +++ drivers/net/wireless/mediatek/mt76/mt76x2.h | 3 --- drivers/net/wireless/mediatek/mt76/mt76x2_main.c | 7 +------ drivers/net/wireless/mediatek/mt76/mt76x2u_main.c | 8 +------- 8 files changed, 21 insertions(+), 31 deletions(-)
drivers/net/wireless/mediatek/mt76/mt76x0/main.c +1 -6
@@ -56,7 +56,6 @@ static int mt76x0_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) {struct mt76x0_dev *dev = hw->priv; -struct mt76x02_vif *mvif = (struct mt76x02_vif *) vif->drv_priv;unsigned int idx; idx =ffs (~dev->vif_mask);
@@ -66,11 +65,7 @@ static int mt76x0_add_interface(struct ieee80211_hw *hw, idx--; dev->vif_mask |=BIT (idx); - mvif->idx = idx; - mvif->group_wcid.idx =GROUP_WCID (idx); - mvif->group_wcid.hw_key_idx =-1 ; -mt76x02_txq_init (&dev->mt76, vif->txq); - +mt76x02_vif_init (&dev->mt76, vif, idx);return 0 ; }
drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h +0 -9
@@ -89,15 +89,6 @@ struct mt76x0_tx_queue {unsigned int fifo_seq; }; -/* WCID allocation: -* 0: mcast wcid -* 1: bssid wcid -* 1...: STAs -* ...7e: group wcids -* 7f: reserved -*/ -#define GROUP_WCID (idx) (254 - idx) -struct mt76x0_eeprom_params ;#define MT_EE_TEMPERATURE_SLOPE 39
drivers/net/wireless/mediatek/mt76/mt76x02_mac.h +3 -0
@@ -31,6 +31,9 @@ struct mt76x02_tx_status {u16 rate; } __packed__aligned(2) ; +#define MT_VIF_WCID (_n) (254 - ((_n) & 7)) +#define MT_MAX_VIFS 8 +struct mt76x02_vif {u8 idx;
drivers/net/wireless/mediatek/mt76/mt76x02_util.c +12 -0
@@ -115,4 +115,16 @@ int mt76x02_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif, }EXPORT_SYMBOL_GPL (mt76x02_sta_remove); +void mt76x02_vif_init (struct mt76_dev *dev,struct ieee80211_vif *vif, +unsigned int idx) +{ +struct mt76x02_vif *mvif = (struct mt76x02_vif *) vif->drv_priv; + + mvif->idx = idx; + mvif->group_wcid.idx =MT_VIF_WCID (idx); + mvif->group_wcid.hw_key_idx =-1 ; +mt76x02_txq_init (dev, vif->txq); +} +EXPORT_SYMBOL_GPL (mt76x02_vif_init); +MODULE_LICENSE ("Dual BSD/GPL" );
drivers/net/wireless/mediatek/mt76/mt76x02_util.h +3 -0
@@ -25,4 +25,7 @@ int mt76x02_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta);int mt76x02_sta_remove (struct ieee80211_hw *hw,struct ieee80211_vif *vif,struct ieee80211_sta *sta); + +void mt76x02_vif_init (struct mt76_dev *dev,struct ieee80211_vif *vif, +unsigned int idx);#endif
drivers/net/wireless/mediatek/mt76/mt76x2.h +0 -3
@@ -42,9 +42,6 @@#define MT_CALIBRATE_INTERVAL HZ -#define MT_MAX_VIFS 8 -#define MT_VIF_WCID (_n) (254 - ((_n) & 7)) -#include "mt76.h" #include "mt76x02_regs.h" #include "mt76x2_mac.h"
drivers/net/wireless/mediatek/mt76/mt76x2_main.c +1 -6
@@ -58,7 +58,6 @@ static int mt76x2_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) { struct mt76x2_dev *dev = hw->priv; -struct mt76x02_vif *mvif = (struct mt76x02_vif *) vif->drv_priv;unsigned int idx =0 ;if (vif->addr[0 ] &BIT (1 ))
@@ -80,11 +79,7 @@ mt76x2_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)if (vif->type ==NL80211_IFTYPE_STATION ) idx +=8 ; - mvif->idx = idx; - mvif->group_wcid.idx =MT_VIF_WCID (idx); - mvif->group_wcid.hw_key_idx =-1 ; -mt76x02_txq_init (&dev->mt76, vif->txq); - +mt76x02_vif_init (&dev->mt76, vif, idx);return 0 ; }
drivers/net/wireless/mediatek/mt76/mt76x2u_main.c +0 -6
@@ -49,17 +49,11 @@ static int mt76x2u_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) {struct mt76x2_dev *dev = hw->priv; -struct mt76x02_vif *mvif = (struct mt76x02_vif *)vif->drv_priv; -unsigned int idx =0 ;if (!ether_addr_equal (dev->mt76.macaddr, vif->addr))mt76x2u_mac_setaddr (dev, vif->addr); - mvif->idx = idx; - mvif->group_wcid.idx =MT_VIF_WCID (idx); - mvif->group_wcid.hw_key_idx =-1 ; -mt76x02_txq_init (&dev->mt76, vif->txq);
PATCH 4/22 mt76x0: fix wrong usage of wcid_mask in remove_interface
In reply to a message not in the archiveWe wrongly use wcid_mask instead of vif_mask
--- drivers/net/wireless/mediatek/mt76/mt76x0/main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mt76x0/main.c +1 -2
@@ -74,9 +74,8 @@ static void mt76x0_remove_interface(struct ieee80211_hw *hw, {struct mt76x0_dev *dev = hw->priv;struct mt76x02_vif *mvif = (struct mt76x02_vif *) vif->drv_priv; -unsigned int wcid = mvif->group_wcid.idx; - dev->mt76.wcid_mask[wcid /BITS_PER_LONG ] &= ~BIT (wcid %BITS_PER_LONG ); + dev->vif_mask &= ~BIT (mvif->idx);mt76_txq_remove (&dev->mt76, vif->txq); }
Signature · 1 line
2.7.5
PATCH 5/22 mt76: unify ampdu_action
In reply to a message not in the archiveUse mt76x2_ampdu_action as common function, mt76x0 ampdu_action was diffrent, but mt76x2 version should work for this driver as well.
--- drivers/net/wireless/mediatek/mt76/mt76.h | 3 ++ drivers/net/wireless/mediatek/mt76/mt76x0/main.c | 45 +------------------ drivers/net/wireless/mediatek/mt76/mt76x02_util.c | 50 +++++++++++++++++++++ drivers/net/wireless/mediatek/mt76/mt76x02_util.h | 3 ++ drivers/net/wireless/mediatek/mt76/mt76x2.h | 2 - drivers/net/wireless/mediatek/mt76/mt76x2_common.c | 51 ---------------------- drivers/net/wireless/mediatek/mt76/mt76x2_main.c | 2 +- drivers/net/wireless/mediatek/mt76/mt76x2u_main.c | 2 +- 8 files changed, 59 insertions(+), 99 deletions(-)
drivers/net/wireless/mediatek/mt76/mt76.h +3 -0
@@ -427,6 +427,9 @@ struct mt76_rx_status {#define __mt76_rmw (dev, ...) (dev)->bus->rmw((dev), __VA_ARGS__)#define __mt76_wr_copy (dev, ...) (dev)->bus->copy((dev), __VA_ARGS__) +#define __mt76_set (dev, offset, val) __mt76_rmw(dev, offset, 0, val) +#define __mt76_clear (dev, offset, val) __mt76_rmw(dev, offset, val, 0) +#define mt76_rr (dev, ...) (dev)->mt76.bus->rr(&((dev)->mt76), __VA_ARGS__)#define mt76_wr (dev, ...) (dev)->mt76.bus->wr(&((dev)->mt76), __VA_ARGS__)#define mt76_rmw (dev, ...) (dev)->mt76.bus->rmw(&((dev)->mt76), __VA_ARGS__)
drivers/net/wireless/mediatek/mt76/mt76x0/main.c +1 -44
57 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt76x02_util.c +50 -0
54 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt76x02_util.h +3 -0
@@ -28,4 +28,7 @@ int mt76x02_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif,void mt76x02_vif_init (struct mt76_dev *dev,struct ieee80211_vif *vif,unsigned int idx); + +int mt76x02_ampdu_action (struct ieee80211_hw *hw,struct ieee80211_vif *vif, +struct ieee80211_ampdu_params *params);#endif
drivers/net/wireless/mediatek/mt76/mt76x2.h +0 -2
@@ -250,8 +250,6 @@ void mt76x2_init_txpower(struct mt76x2_dev *dev, struct ieee80211_supported_band *sband);void mt76_write_mac_initvals (struct mt76x2_dev *dev); -int mt76x2_ampdu_action (struct ieee80211_hw *hw,struct ieee80211_vif *vif, -struct ieee80211_ampdu_params *params);int mt76x2_sta_add (struct ieee80211_hw *hw,struct ieee80211_vif *vif,struct ieee80211_sta *sta); int mt76x2_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
drivers/net/wireless/mediatek/mt76/mt76x2_common.c +0 -51
57 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt76x2_main.c +1 -1
@@ -325,7 +325,7 @@ const struct ieee80211_ops mt76x2_ops = { .sw_scan_start = mt76x2_sw_scan, .sw_scan_complete = mt76x2_sw_scan_complete, .flush = mt76x2_flush, - .ampdu_action = mt76x2_ampdu_action, + .ampdu_action = mt76x02_ampdu_action, .get_txpower = mt76x2_get_txpower, .wake_tx_queue = mt76_wake_tx_queue, .sta_rate_tbl_update = mt76x2_sta_rate_tbl_update,
drivers/net/wireless/mediatek/mt76/mt76x2u_main.c +1 -1
@@ -168,7 +168,7 @@ const struct ieee80211_ops mt76x2u_ops = { .sta_add = mt76x02_sta_add, .sta_remove = mt76x02_sta_remove, .set_key = mt76x2_set_key, - .ampdu_action = mt76x2_ampdu_action, + .ampdu_action = mt76x02_ampdu_action, .config = mt76x2u_config, .wake_tx_queue = mt76_wake_tx_queue, .bss_info_changed = mt76x2u_bss_info_changed,
Signature · 1 line
2.7.5
PATCH 6/22 mt76: unify set_key
In reply to a message not in the archiveMerge mt76x0 and mt76x2 set_key mac80211 callback.
--- drivers/net/wireless/mediatek/mt76/mt76x0/main.c | 37 +----------- drivers/net/wireless/mediatek/mt76/mt76x02_util.c | 67 ++++++++++++++++++++++ drivers/net/wireless/mediatek/mt76/mt76x02_util.h | 4 ++ drivers/net/wireless/mediatek/mt76/mt76x2.h | 3 - drivers/net/wireless/mediatek/mt76/mt76x2_common.c | 67 ---------------------- drivers/net/wireless/mediatek/mt76/mt76x2_main.c | 2 +- drivers/net/wireless/mediatek/mt76/mt76x2u_main.c | 2 +- 7 files changed, 74 insertions(+), 108 deletions(-)
drivers/net/wireless/mediatek/mt76/mt76x0/main.c +1 -36
@@ -181,41 +181,6 @@ mt76x0_sw_scan_complete(struct ieee80211_hw *hw, MT_CALIBRATE_INTERVAL); } -static int -mt76x0_set_key (struct ieee80211_hw *hw,enum set_key_cmd cmd, -struct ieee80211_vif *vif,struct ieee80211_sta *sta, -struct ieee80211_key_conf *key) -{ -struct mt76x0_dev *dev = hw->priv; -struct mt76x02_vif *mvif = (struct mt76x02_vif *) vif->drv_priv; -struct mt76x02_sta *msta = sta ? (struct mt76x02_sta *) sta->drv_priv :NULL ; -struct mt76_wcid *wcid = msta ? &msta->wcid : &mvif->group_wcid; -int idx = key->keyidx; -int ret; - -if (cmd ==SET_KEY ) { - key->hw_key_idx = wcid->idx; - wcid->hw_key_idx = idx; - }else { -if (idx == wcid->hw_key_idx) - wcid->hw_key_idx =-1 ; - - key =NULL ; - } - -if (!msta) { -if (key || wcid->hw_key_idx == idx) { - ret =mt76x02_mac_wcid_set_key (&dev->mt76, wcid->idx, key); -if (ret) -return ret; - } - -return mt76x02_mac_shared_key_setup (&dev->mt76, mvif->idx, idx, key); - } - -return mt76x02_mac_wcid_set_key (&dev->mt76, msta->wcid.idx, key); -} -static int mt76x0_set_rts_threshold (struct ieee80211_hw *hw,u32 value) {struct mt76x0_dev *dev = hw->priv;
@@ -260,7 +225,7 @@ const struct ieee80211_ops mt76x0_ops = { .sta_add = mt76x02_sta_add, .sta_remove = mt76x02_sta_remove, .sta_notify = mt76x0_sta_notify, - .set_key = mt76x0_set_key, + .set_key = mt76x02_set_key, .conf_tx = mt76x0_conf_tx, .sw_scan_start = mt76x0_sw_scan, .sw_scan_complete = mt76x0_sw_scan_complete,
drivers/net/wireless/mediatek/mt76/mt76x02_util.c +67 -0
71 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt76x02_util.h +4 -0
@@ -31,4 +31,8 @@ void mt76x02_vif_init(struct mt76_dev *dev, struct ieee80211_vif *vif,int mt76x02_ampdu_action (struct ieee80211_hw *hw,struct ieee80211_vif *vif,struct ieee80211_ampdu_params *params); + +int mt76x02_set_key (struct ieee80211_hw *hw,enum set_key_cmd cmd, +struct ieee80211_vif *vif,struct ieee80211_sta *sta, +struct ieee80211_key_conf *key);#endif
drivers/net/wireless/mediatek/mt76/mt76x2.h +0 -3
@@ -256,9 +256,6 @@ int mt76x2_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_sta *sta);void mt76x2_remove_interface (struct ieee80211_hw *hw,struct ieee80211_vif *vif); -int mt76x2_set_key (struct ieee80211_hw *hw,enum set_key_cmd cmd, -struct ieee80211_vif *vif,struct ieee80211_sta *sta, -struct ieee80211_key_conf *key);int mt76x2_conf_tx (struct ieee80211_hw *hw,struct ieee80211_vif *vif,u16 queue,const struct ieee80211_tx_queue_params *params);void mt76x2_txq_init (struct mt76x2_dev *dev,struct ieee80211_txq *txq);
drivers/net/wireless/mediatek/mt76/mt76x2_common.c +0 -67
73 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt76x2_main.c +1 -1
@@ -320,7 +320,7 @@ const struct ieee80211_ops mt76x2_ops = { .bss_info_changed = mt76x2_bss_info_changed, .sta_add = mt76x02_sta_add, .sta_remove = mt76x02_sta_remove, - .set_key = mt76x2_set_key, + .set_key = mt76x02_set_key, .conf_tx = mt76x2_conf_tx, .sw_scan_start = mt76x2_sw_scan, .sw_scan_complete = mt76x2_sw_scan_complete,
drivers/net/wireless/mediatek/mt76/mt76x2u_main.c +1 -1
@@ -167,7 +167,7 @@ const struct ieee80211_ops mt76x2u_ops = { .remove_interface = mt76x2_remove_interface, .sta_add = mt76x02_sta_add, .sta_remove = mt76x02_sta_remove, - .set_key = mt76x2_set_key, + .set_key = mt76x02_set_key, .ampdu_action = mt76x02_ampdu_action, .config = mt76x2u_config, .wake_tx_queue = mt76_wake_tx_queue,
Signature · 1 line
2.7.5
PATCH 7/22 mt76x0: remove empty sta_notify
In reply to a message not in the archiveRemove empty implementation of sta_notify.
--- drivers/net/wireless/mediatek/mt76/mt76x0/main.c | 7 ------- 1 file changed, 7 deletions(-)
drivers/net/wireless/mediatek/mt76/mt76x0/main.c +0 -4
@@ -151,12 +151,6 @@ mt76x0_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, } static void -mt76x0_sta_notify (struct ieee80211_hw *hw,struct ieee80211_vif *vif, -enum sta_notify_cmd cmd,struct ieee80211_sta *sta) -{ -}
PATCH 8/22 mt76: unify AC to hw queue mapping
In reply to a message not in the archiveUse the same AC to hardware queue mappings for all subdrivers.
Note: this change BK and BE mappings for USB drivers.
--- drivers/net/wireless/mediatek/mt76/mt76.h | 8 +------- drivers/net/wireless/mediatek/mt76/mt76x0/tx.c | 4 ++-- drivers/net/wireless/mediatek/mt76/mt76x2_dma.c | 10 ++-------- drivers/net/wireless/mediatek/mt76/tx.c | 16 ++++++++++++++++ drivers/net/wireless/mediatek/mt76/usb.c | 2 +- 5 files changed, 22 insertions(+), 18 deletions(-)
drivers/net/wireless/mediatek/mt76/mt76.h +1 -7
@@ -519,13 +519,7 @@ static inline int mt76_decr(int val, int size)return (val -1 ) & (size -1 ); } -/* Hardware uses mirrored order of queues with Q3 -* having the highest priority -*/ -static inline u8 q2hwq (u8 q) -{ -return q ^0x3 ; -} +u8 mt76_ac_to_hwq (u8 ac);static inline struct ieee80211_txq *mtxq_to_txq (struct mt76_txq *mtxq)
drivers/net/wireless/mediatek/mt76/mt76x0/tx.c +2 -2
@@ -25,7 +25,7 @@ static u8 skb2q(struct sk_buff *skb)skb_set_queue_mapping (skb, qid); } -return q2hwq (qid); +return mt76_ac_to_hwq (qid); } static void mt76x0_tx_skb_remove_dma_overhead(struct sk_buff *skb,
@@ -216,7 +216,7 @@ int mt76x0_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u16 queue, const struct ieee80211_tx_queue_params *params) { struct mt76x0_dev *dev = hw->priv; -u8 cw_min =5 , cw_max =10 , hw_q =q2hwq (queue); +u8 cw_min =5 , cw_max =10 , hw_q =mt76_ac_to_hwq (queue);u32 val;/* TODO: should we do funny things with the parameters?
drivers/net/wireless/mediatek/mt76/mt76x2_dma.c +2 -8
@@ -102,12 +102,6 @@ mt76x2_tx_tasklet(unsigned long data)int mt76x2_dma_init (struct mt76x2_dev *dev) { -static const u8 wmm_queue_map[] = { - [IEEE80211_AC_BE ] =0 , - [IEEE80211_AC_BK ] =1 , - [IEEE80211_AC_VI ] =2 , - [IEEE80211_AC_VO ] =3 , - };int ret;int i;struct mt76_txwi_cache __maybe_unused *t;
@@ -125,9 +119,9 @@ int mt76x2_dma_init(struct mt76x2_dev *dev)mt76_wr (dev,MT_WPDMA_RST_IDX , ~0 ); -for (i =0 ; i <ARRAY_SIZE (wmm_queue_map); i++) { +for (i =0 ; i <IEEE80211_NUM_ACS ; i++) { ret =mt76x2_init_tx_queue (dev, &dev->mt76.q_tx[i], - wmm_queue_map[i],MT_TX_RING_SIZE ); +mt76_ac_to_hwq (i),MT_TX_RING_SIZE );if (ret)return ret; }
drivers/net/wireless/mediatek/mt76/tx.c +16 -0
@@ -442,3 +442,19 @@ void mt76_txq_init(struct mt76_dev *dev, struct ieee80211_txq *txq) mtxq->hwq = &dev->q_tx[mt76_txq_get_qid (txq)]; }EXPORT_SYMBOL_GPL (mt76_txq_init); + +u8 mt76_ac_to_hwq (u8 ac) +{ +static const u8 wmm_queue_map[] = { + [IEEE80211_AC_BE ] =0 , + [IEEE80211_AC_BK ] =1 , + [IEEE80211_AC_VI ] =2 , + [IEEE80211_AC_VO ] =3 , + }; + +if (WARN_ON (ac >=IEEE80211_NUM_ACS )) +return 0 ; + +return wmm_queue_map[ac]; +} +EXPORT_SYMBOL_GPL (mt76_ac_to_hwq);
drivers/net/wireless/mediatek/mt76/usb.c +1 -1
@@ -715,7 +715,7 @@ static int mt76u_alloc_tx(struct mt76_dev *dev) q = &dev->q_tx[i];spin_lock_init (&q->lock);INIT_LIST_HEAD (&q->swq); - q->hw_idx =q2hwq (i); + q->hw_idx =mt76_ac_to_hwq (i); q->entry = devm_kzalloc(dev->dev, MT_NUM_TX_ENTRIES * sizeof(*q->entry),
Signature · 1 line
2.7.5
PATCH 9/22 mt76: remove q->hw_idx
In reply to a message not in the archiveWe use q->hw_idx in very few places, remove it and provide hwq index by diffrent way. This will allow ot unify conf_tx mac80211 callback.
--- drivers/net/wireless/mediatek/mt76/mt76.h | 1 - drivers/net/wireless/mediatek/mt76/mt76x2_common.c | 2 +- drivers/net/wireless/mediatek/mt76/mt76x2_dma.c | 1 - drivers/net/wireless/mediatek/mt76/mt76x2u_core.c | 3 ++- drivers/net/wireless/mediatek/mt76/usb.c | 6 +++--- 5 files changed, 6 insertions(+), 7 deletions(-)
drivers/net/wireless/mediatek/mt76/mt76.h +0 -1
@@ -113,7 +113,6 @@ struct mt76_queue {int buf_size;u8 buf_offset; -u8 hw_idx;dma_addr_t desc_dma;struct sk_buff *rx_head;
drivers/net/wireless/mediatek/mt76/mt76x2_common.c +1 -1
@@ -34,7 +34,7 @@ int mt76x2_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,u8 cw_min =5 , cw_max =10 , qid;u32 val; - qid = dev->mt76.q_tx[queue].hw_idx; + qid =mt76_ac_to_hwq (queue);if (params->cw_min) cw_min =fls (params->cw_min);
drivers/net/wireless/mediatek/mt76/mt76x2_dma.c +0 -1
@@ -55,7 +55,6 @@ mt76x2_init_tx_queue(struct mt76x2_dev *dev, struct mt76_queue *q, q->regs = dev->mt76.regs +MT_TX_RING_BASE + idx *MT_RING_SIZE ; q->ndesc = n_desc; - q->hw_idx = idx; ret =mt76_queue_alloc (dev, q);if (ret)
drivers/net/wireless/mediatek/mt76/mt76x2u_core.c +2 -1
@@ -84,6 +84,7 @@ int mt76x2u_tx_prepare_skb(struct mt76_dev *mdev, void *data, struct mt76x2_dev *dev = container_of(mdev, struct mt76x2_dev, mt76);struct mt76x2_txwi *txwi;int err, len = skb->len; +int *hwq_ptr = (int *) data; err =mt76x2u_check_skb_rooms (skb);if (err <0 )
@@ -94,7 +95,7 @@ int mt76x2u_tx_prepare_skb(struct mt76_dev *mdev, void *data, txwi =skb_push (skb,sizeof (struct mt76x2_txwi ));mt76x2_mac_write_txwi (dev, txwi, skb, wcid, sta, len); -return mt76x2u_set_txinfo (skb, wcid,q2ep (q->hw_idx)); +return mt76x2u_set_txinfo (skb, wcid,q2ep (*hwq_ptr)); } void mt76x2u_tx_complete_skb(struct mt76_dev *mdev, struct mt76_queue *q,
drivers/net/wireless/mediatek/mt76/usb.c +3 -3
@@ -652,7 +652,8 @@ mt76u_tx_queue_skb(struct mt76_dev *dev, struct mt76_queue *q, {struct usb_interface *intf =to_usb_interface (dev->dev);struct usb_device *udev =interface_to_usbdev (intf); -u8 ep =q2ep (q->hw_idx); +int hwq =mt76_ac_to_hwq (skb_get_queue_mapping (skb)); +u8 ep =q2ep (hwq);struct mt76u_buf *buf;u16 idx = q->tail;unsigned int pipe;
@@ -661,7 +662,7 @@ mt76u_tx_queue_skb(struct mt76_dev *dev, struct mt76_queue *q,if (q->queued == q->ndesc)return -ENOSPC ; - err = dev->drv->tx_prepare_skb (dev,NULL , skb, q, wcid, sta,NULL ); + err = dev->drv->tx_prepare_skb (dev, &hwq, skb, q, wcid, sta,NULL );if (err <0 )return err;
@@ -715,7 +716,6 @@ static int mt76u_alloc_tx(struct mt76_dev *dev) q = &dev->q_tx[i];spin_lock_init (&q->lock);INIT_LIST_HEAD (&q->swq); - q->hw_idx =mt76_ac_to_hwq (i); q->entry = devm_kzalloc(dev->dev, MT_NUM_TX_ENTRIES * sizeof(*q->entry),
Signature · 1 line
2.7.5
A message that is not in the archive (sent off-list or not yet received): 1536072075-6990-10-git-send-email-sgruszka-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
Re: [PATCH 09/22] mt76: remove q->hw_idx
Quoted 4 lines · Stanislaw Gruszka
We use
q->hw_idxin very few places, remove it and provide hwq index by diffrent way. This will allow ot unifyconf_txmac80211 callback.Signed-off-by Stanislaw Gruszka <[email protected]>
I think this patch is a step in the wrong direction, especially when it comes to dealing with extra hardware queues for powersave delivery, or beacons (on MT7603).
Also, removing q->hw_idx is not really necessary for unifying conf_tx callbacks either.
- Felix
PATCH 10/22 mt76: unify conf_tx
In reply to a message not in the archiveUse one conf_tx implementation in mt76x0 and mt76x2. Note this change conf_tx for mt76x0, but it should work with mt76x2 version.
--- drivers/net/wireless/mediatek/mt76/mt76x0/main.c | 2 +- drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h | 2 - drivers/net/wireless/mediatek/mt76/mt76x0/tx.c | 57 ---------------------- drivers/net/wireless/mediatek/mt76/mt76x02_util.c | 44 +++++++++++++++++ drivers/net/wireless/mediatek/mt76/mt76x02_util.h | 3 +- drivers/net/wireless/mediatek/mt76/mt76x2_common.c | 44 ----------------- drivers/net/wireless/mediatek/mt76/mt76x2_main.c | 2 +- drivers/net/wireless/mediatek/mt76/mt76x2u_main.c | 2 +- 8 files changed, 49 insertions(+), 107 deletions(-)
drivers/net/wireless/mediatek/mt76/mt76x0/main.c +1 -1
@@ -219,7 +219,7 @@ const struct ieee80211_ops mt76x0_ops = { .sta_add = mt76x02_sta_add, .sta_remove = mt76x02_sta_remove, .set_key = mt76x02_set_key, - .conf_tx = mt76x0_conf_tx, + .conf_tx = mt76x02_conf_tx, .sw_scan_start = mt76x0_sw_scan, .sw_scan_complete = mt76x0_sw_scan_complete, .ampdu_action = mt76x02_ampdu_action,
drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h +0 -2
@@ -246,8 +246,6 @@ void mt76x0_mac_set_ampdu_factor(struct mt76x0_dev *dev);/* TX */ void mt76x0_tx (struct ieee80211_hw *hw,struct ieee80211_tx_control *control,struct sk_buff *skb); -int mt76x0_conf_tx (struct ieee80211_hw *hw,struct ieee80211_vif *vif, -u16 queue,const struct ieee80211_tx_queue_params *params);void mt76x0_tx_status (struct mt76x0_dev *dev,struct sk_buff *skb);void mt76x0_tx_stat (struct work_struct *work);
drivers/net/wireless/mediatek/mt76/mt76x0/tx.c +0 -57
60 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt76x02_util.c +44 -0
48 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt76x02_util.h +2 -1
@@ -31,8 +31,9 @@ void mt76x02_vif_init(struct mt76_dev *dev, struct ieee80211_vif *vif,int mt76x02_ampdu_action (struct ieee80211_hw *hw,struct ieee80211_vif *vif,struct ieee80211_ampdu_params *params); -int mt76x02_set_key (struct ieee80211_hw *hw,enum set_key_cmd cmd,struct ieee80211_vif *vif,struct ieee80211_sta *sta,struct ieee80211_key_conf *key); +int mt76x02_conf_tx (struct ieee80211_hw *hw,struct ieee80211_vif *vif, +u16 queue,const struct ieee80211_tx_queue_params *params);#endif
drivers/net/wireless/mediatek/mt76/mt76x2_common.c +0 -44
50 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt76x2_main.c +1 -1
@@ -321,7 +321,7 @@ const struct ieee80211_ops mt76x2_ops = { .sta_add = mt76x02_sta_add, .sta_remove = mt76x02_sta_remove, .set_key = mt76x02_set_key, - .conf_tx = mt76x2_conf_tx, + .conf_tx = mt76x02_conf_tx, .sw_scan_start = mt76x2_sw_scan, .sw_scan_complete = mt76x2_sw_scan_complete, .flush = mt76x2_flush,
drivers/net/wireless/mediatek/mt76/mt76x2u_main.c +1 -1
@@ -173,7 +173,7 @@ const struct ieee80211_ops mt76x2u_ops = { .wake_tx_queue = mt76_wake_tx_queue, .bss_info_changed = mt76x2u_bss_info_changed, .configure_filter = mt76x02_configure_filter, - .conf_tx = mt76x2_conf_tx, + .conf_tx = mt76x02_conf_tx, .sw_scan_start = mt76x2u_sw_scan, .sw_scan_complete = mt76x2u_sw_scan_complete, .sta_rate_tbl_update = mt76x2_sta_rate_tbl_update,
Signature · 1 line
2.7.5
PATCH 11/22 mt76x0: remove vif_mask
In reply to a message not in the archiveMake remove_interface more similar to mt76x2.
--- drivers/net/wireless/mediatek/mt76/mt76x0/main.c | 11 +---------- drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h | 2 -- 2 files changed, 1 insertion(+), 12 deletions(-)
drivers/net/wireless/mediatek/mt76/mt76x0/main.c +1 -10
@@ -56,14 +56,7 @@ static int mt76x0_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) {struct mt76x0_dev *dev = hw->priv; -unsigned int idx; - - idx =ffs (~dev->vif_mask); -if (!idx || idx >8 ) -return -ENOSPC ; - - idx--; - dev->vif_mask |=BIT (idx); +unsigned int idx =0 ;mt76x02_vif_init (&dev->mt76, vif, idx);return 0 ;
@@ -73,9 +66,7 @@ static void mt76x0_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) {struct mt76x0_dev *dev = hw->priv; -struct mt76x02_vif *mvif = (struct mt76x02_vif *) vif->drv_priv; - dev->vif_mask &= ~BIT (mvif->idx);mt76_txq_remove (&dev->mt76, vif->txq); }
drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h +0 -1
@@ -134,8 +134,6 @@ struct mt76x0_dev {u8 in_ep[__MT_EP_IN_MAX];u16 in_max_packet; -unsigned long vif_mask;
PATCH 12/22 mt76: unify remove_interface
In reply to a message not in the archiveUse common remove_interface callback in mt76x0 and mt76x2.
--- drivers/net/wireless/mediatek/mt76/mt76x0/main.c | 10 +--------- drivers/net/wireless/mediatek/mt76/mt76x02_util.c | 9 +++++++++ drivers/net/wireless/mediatek/mt76/mt76x02_util.h | 2 ++ drivers/net/wireless/mediatek/mt76/mt76x2_common.c | 9 --------- drivers/net/wireless/mediatek/mt76/mt76x2_main.c | 2 +- drivers/net/wireless/mediatek/mt76/mt76x2u_main.c | 2 +- 6 files changed, 14 insertions(+), 20 deletions(-)
drivers/net/wireless/mediatek/mt76/mt76x0/main.c +1 -9
@@ -62,14 +62,6 @@ static int mt76x0_add_interface(struct ieee80211_hw *hw,return 0 ; } -static void mt76x0_remove_interface (struct ieee80211_hw *hw, -struct ieee80211_vif *vif) -{ -struct mt76x0_dev *dev = hw->priv; - -mt76_txq_remove (&dev->mt76, vif->txq); -} -static int mt76x0_config (struct ieee80211_hw *hw,u32 changed) {struct mt76x0_dev *dev = hw->priv;
@@ -203,7 +195,7 @@ const struct ieee80211_ops mt76x0_ops = { .start = mt76x0_start, .stop = mt76x0_stop, .add_interface = mt76x0_add_interface, - .remove_interface = mt76x0_remove_interface, + .remove_interface = mt76x02_remove_interface, .config = mt76x0_config, .configure_filter = mt76x02_configure_filter, .bss_info_changed = mt76x0_bss_info_changed,
drivers/net/wireless/mediatek/mt76/mt76x02_util.c +9 -0
@@ -127,6 +127,15 @@ void mt76x02_vif_init(struct mt76_dev *dev, struct ieee80211_vif *vif, }EXPORT_SYMBOL_GPL (mt76x02_vif_init); +void mt76x02_remove_interface (struct ieee80211_hw *hw, +struct ieee80211_vif *vif) +{ +struct mt76_dev *dev = hw->priv; + +mt76_txq_remove (dev, vif->txq); +} +EXPORT_SYMBOL_GPL (mt76x02_remove_interface); +int mt76x02_ampdu_action (struct ieee80211_hw *hw,struct ieee80211_vif *vif,struct ieee80211_ampdu_params *params) {
drivers/net/wireless/mediatek/mt76/mt76x02_util.h +2 -0
@@ -28,6 +28,8 @@ int mt76x02_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif,void mt76x02_vif_init (struct mt76_dev *dev,struct ieee80211_vif *vif,unsigned int idx); +void mt76x02_remove_interface (struct ieee80211_hw *hw, +struct ieee80211_vif *vif);int mt76x02_ampdu_action (struct ieee80211_hw *hw,struct ieee80211_vif *vif,struct ieee80211_ampdu_params *params);
drivers/net/wireless/mediatek/mt76/mt76x2_common.c +0 -9
@@ -18,15 +18,6 @@#include "mt76x2.h" #include "mt76x02_mac.h" -void mt76x2_remove_interface (struct ieee80211_hw *hw, -struct ieee80211_vif *vif) -{ -struct mt76x2_dev *dev = hw->priv; - -mt76_txq_remove (&dev->mt76, vif->txq); -} -EXPORT_SYMBOL_GPL (mt76x2_remove_interface); -void mt76x2_sta_rate_tbl_update (struct ieee80211_hw *hw,struct ieee80211_vif *vif,struct ieee80211_sta *sta)
drivers/net/wireless/mediatek/mt76/mt76x2_main.c +1 -1
@@ -314,7 +314,7 @@ const struct ieee80211_ops mt76x2_ops = { .start = mt76x2_start, .stop = mt76x2_stop, .add_interface = mt76x2_add_interface, - .remove_interface = mt76x2_remove_interface, + .remove_interface = mt76x02_remove_interface, .config = mt76x2_config, .configure_filter = mt76x02_configure_filter, .bss_info_changed = mt76x2_bss_info_changed,
drivers/net/wireless/mediatek/mt76/mt76x2u_main.c +1 -1
@@ -164,7 +164,7 @@ const struct ieee80211_ops mt76x2u_ops = { .start = mt76x2u_start, .stop = mt76x2u_stop, .add_interface = mt76x2u_add_interface, - .remove_interface = mt76x2_remove_interface, + .remove_interface = mt76x02_remove_interface, .sta_add = mt76x02_sta_add, .sta_remove = mt76x02_sta_remove, .set_key = mt76x02_set_key,
Signature · 1 line
2.7.5
PATCH 13/22 mt76: unify add_interface
In reply to a message not in the archiveMake common add_interface for mt76x0 and mt76x2e. This change behavior for mt76x0, but it should work with the new implementation.
mt76x2u has different implementation. Maybe it can use common one, but for now leave it as is.
--- drivers/net/wireless/mediatek/mt76/mt76x0/main.c | 13 +--------- drivers/net/wireless/mediatek/mt76/mt76x02_util.c | 30 ++++++++++++++++++++++ drivers/net/wireless/mediatek/mt76/mt76x02_util.h | 2 ++ drivers/net/wireless/mediatek/mt76/mt76x2_main.c | 31 +---------------------- 4 files changed, 34 insertions(+), 42 deletions(-)
drivers/net/wireless/mediatek/mt76/mt76x0/main.c +1 -12
@@ -51,17 +51,6 @@ static void mt76x0_stop(struct ieee80211_hw *hw)mutex_unlock (&dev->mt76.mutex); } - -static int mt76x0_add_interface (struct ieee80211_hw *hw, -struct ieee80211_vif *vif) -{ -struct mt76x0_dev *dev = hw->priv; -unsigned int idx =0 ; - -mt76x02_vif_init (&dev->mt76, vif, idx); -return 0 ; -} -static int mt76x0_config (struct ieee80211_hw *hw,u32 changed) {struct mt76x0_dev *dev = hw->priv;
@@ -194,7 +183,7 @@ const struct ieee80211_ops mt76x0_ops = { .tx = mt76x0_tx, .start = mt76x0_start, .stop = mt76x0_stop, - .add_interface = mt76x0_add_interface, + .add_interface = mt76x02_add_interface, .remove_interface = mt76x02_remove_interface, .config = mt76x0_config, .configure_filter = mt76x02_configure_filter,
drivers/net/wireless/mediatek/mt76/mt76x02_util.c +30 -0
@@ -127,6 +127,36 @@ void mt76x02_vif_init(struct mt76_dev *dev, struct ieee80211_vif *vif, }EXPORT_SYMBOL_GPL (mt76x02_vif_init); +int +mt76x02_add_interface (struct ieee80211_hw *hw,struct ieee80211_vif *vif) +{ +struct mt76_dev *dev = hw->priv; +unsigned int idx =0 ; + +if (vif->addr[0 ] &BIT (1 )) + idx =1 + (((dev->macaddr[0 ] ^ vif->addr[0 ]) >>2 ) &7 ); + +/* +* Client mode typically only has one configurable BSSID register, +* which is used for bssidx=0. This is linked to the MAC address. +* Since mac80211 allows changing interface types, and we cannot +* force the use of the primary MAC address for a station mode +* interface, we need some other way of configuring a per-interface +* remote BSSID. +* The hardware provides an AP-Client feature, where bssidx 0-7 are +* used for AP mode and bssidx 8-15 for client mode. +* We shift the station interface bss index by 8 to force the +* hardware to recognize the BSSID. +* The resulting bssidx mismatch for unicast frames is ignored by hw. +*/ +if (vif->type ==NL80211_IFTYPE_STATION ) + idx +=8 ; + +mt76x02_vif_init (dev, vif, idx); +return 0 ; +} +EXPORT_SYMBOL_GPL (mt76x02_add_interface); +void mt76x02_remove_interface (struct ieee80211_hw *hw,struct ieee80211_vif *vif) {
drivers/net/wireless/mediatek/mt76/mt76x02_util.h +2 -0
@@ -28,6 +28,8 @@ int mt76x02_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif,void mt76x02_vif_init (struct mt76_dev *dev,struct ieee80211_vif *vif,unsigned int idx); +int mt76x02_add_interface (struct ieee80211_hw *hw, +struct ieee80211_vif *vif);void mt76x02_remove_interface (struct ieee80211_hw *hw,struct ieee80211_vif *vif);
drivers/net/wireless/mediatek/mt76/mt76x2_main.c +0 -27
@@ -55,35 +55,6 @@ mt76x2_stop(struct ieee80211_hw *hw) } static int -mt76x2_add_interface (struct ieee80211_hw *hw,struct ieee80211_vif *vif) -{ -struct mt76x2_dev *dev = hw->priv; -unsigned int idx =0 ; - -if (vif->addr[0 ] &BIT (1 )) - idx =1 + (((dev->mt76.macaddr[0 ] ^ vif->addr[0 ]) >>2 ) &7 ); - -/* -* Client mode typically only has one configurable BSSID register, -* which is used for bssidx=0. This is linked to the MAC address. -* Since mac80211 allows changing interface types, and we cannot -* force the use of the primary MAC address for a station mode -* interface, we need some other way of configuring a per-interface -* remote BSSID. -* The hardware provides an AP-Client feature, where bssidx 0-7 are -* used for AP mode and bssidx 8-15 for client mode. -* We shift the station interface bss index by 8 to force the -* hardware to recognize the BSSID. -* The resulting bssidx mismatch for unicast frames is ignored by hw. -*/ -if (vif->type ==NL80211_IFTYPE_STATION ) - idx +=8 ; - -mt76x02_vif_init (&dev->mt76, vif, idx); -return 0 ; -}
PATCH 14/22 mt76: unify sta_rate_tbl_update and related helpers
In reply to a message not in the archiveUse common sta_rate_tbl_update on mt76x0 and mt76x2.
mt76x0 do not have support TPC (transmision power control) implmented, msta->wcid.max_txpwr_adj is only set for mt76x2.
--- drivers/net/wireless/mediatek/mt76/mt76.h | 2 + drivers/net/wireless/mediatek/mt76/mt76x0/init.c | 1 + drivers/net/wireless/mediatek/mt76/mt76x0/mac.c | 63 +-------------------- drivers/net/wireless/mediatek/mt76/mt76x0/mac.h | 59 -------------------- drivers/net/wireless/mediatek/mt76/mt76x0/main.c | 25 +-------- drivers/net/wireless/mediatek/mt76/mt76x0/tx.c | 2 +- drivers/net/wireless/mediatek/mt76/mt76x02_mac.c | 61 ++++++++++++++++++++ drivers/net/wireless/mediatek/mt76/mt76x02_mac.h | 56 +++++++++++++++++++ drivers/net/wireless/mediatek/mt76/mt76x02_util.c | 21 +++++++ drivers/net/wireless/mediatek/mt76/mt76x02_util.h | 3 + drivers/net/wireless/mediatek/mt76/mt76x2.h | 5 +- drivers/net/wireless/mediatek/mt76/mt76x2_common.c | 19 ------- drivers/net/wireless/mediatek/mt76/mt76x2_init.c | 1 + drivers/net/wireless/mediatek/mt76/mt76x2_mac.h | 53 ------------------ .../net/wireless/mediatek/mt76/mt76x2_mac_common.c | 65 +--------------------- drivers/net/wireless/mediatek/mt76/mt76x2_main.c | 2 +- .../net/wireless/mediatek/mt76/mt76x2_tx_common.c | 3 +- drivers/net/wireless/mediatek/mt76/mt76x2u_main.c | 2 +- 18 files changed, 155 insertions(+), 288 deletions(-)
drivers/net/wireless/mediatek/mt76/mt76.h +2 -0
@@ -246,6 +246,8 @@ struct mt76_driver_ops {void (*sta_ps)(struct mt76_dev *dev,struct ieee80211_sta *sta,bool ps); +s8 (*get_max_txpwr_adj)(struct mt76_dev *dev, +const struct ieee80211_tx_rate *rate); };struct mt76_channel_state {
drivers/net/wireless/mediatek/mt76/mt76x0/init.c +1 -0
@@ -493,6 +493,7 @@ struct mt76x0_dev *mt76x0_alloc_device(struct device *pdev) dev = hw->priv; dev->mt76.dev = pdev; dev->mt76.hw = hw; + dev->mt76.drv =NULL ;mutex_init (&dev->usb_ctrl_mtx);mutex_init (&dev->reg_atomic_mutex);mutex_init (&dev->hw_atomic_mutex);
drivers/net/wireless/mediatek/mt76/mt76x0/mac.c +1 -62
75 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt76x0/mac.h +0 -59
71 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt76x0/main.c +1 -24
@@ -156,29 +156,6 @@ static int mt76x0_set_rts_threshold(struct ieee80211_hw *hw, u32 value)return 0 ; } -static void -mt76_sta_rate_tbl_update (struct ieee80211_hw *hw,struct ieee80211_vif *vif, -struct ieee80211_sta *sta) -{ -struct mt76x0_dev *dev = hw->priv; -struct mt76x02_sta *msta = (struct mt76x02_sta *) sta->drv_priv; -struct ieee80211_sta_rates *rates; -struct ieee80211_tx_rate rate = {}; - -rcu_read_lock (); - rates =rcu_dereference (sta->rates); - -if (!rates) - goto out; - - rate.idx = rates->rate[0 ].idx; - rate.flags = rates->rate[0 ].flags; -mt76x0_mac_wcid_set_rate (dev, &msta->wcid, &rate); - -out: -rcu_read_unlock (); -} -const struct ieee80211_ops mt76x0_ops = { .tx = mt76x0_tx, .start = mt76x0_start,
@@ -195,6 +172,6 @@ const struct ieee80211_ops mt76x0_ops = { .sw_scan_start = mt76x0_sw_scan, .sw_scan_complete = mt76x0_sw_scan_complete, .ampdu_action = mt76x02_ampdu_action, - .sta_rate_tbl_update = mt76_sta_rate_tbl_update, + .sta_rate_tbl_update = mt76x02_sta_rate_tbl_update, .set_rts_threshold = mt76x0_set_rts_threshold, };
drivers/net/wireless/mediatek/mt76/mt76x0/tx.c +1 -1
@@ -93,7 +93,7 @@ mt76x0_push_txwi(struct mt76x0_dev *dev, struct sk_buff *skb, rate_ctl = wcid->tx_rate; nss = wcid->tx_rate_nss; }else { - rate_ctl =mt76x0_mac_tx_rate_val (dev, rate, &nss); + rate_ctl =mt76x02_mac_tx_rate_val (&dev->mt76, rate, &nss); }spin_unlock_irqrestore (&dev->mt76.lock, flags);
drivers/net/wireless/mediatek/mt76/mt76x02_mac.c +61 -0
64 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt76x02_mac.h +56 -0
66 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt76x02_util.c +21 -0
@@ -327,4 +327,25 @@ int mt76x02_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, }EXPORT_SYMBOL_GPL (mt76x02_conf_tx); +void mt76x02_sta_rate_tbl_update (struct ieee80211_hw *hw, +struct ieee80211_vif *vif, +struct ieee80211_sta *sta) +{ +struct mt76_dev *dev = hw->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 = {}; + +if (!rates) +return ; + + rate.idx = rates->rate[0 ].idx; + rate.flags = rates->rate[0 ].flags; +mt76x02_mac_wcid_set_rate (dev, &msta->wcid, &rate); + +if (dev->drv && dev->drv->get_max_txpwr_adj) + msta->wcid.max_txpwr_adj = dev->drv->get_max_txpwr_adj (dev, &rate); +} +EXPORT_SYMBOL_GPL (mt76x02_sta_rate_tbl_update); +MODULE_LICENSE ("Dual BSD/GPL" );
drivers/net/wireless/mediatek/mt76/mt76x02_util.h +3 -0
@@ -40,4 +40,7 @@ int mt76x02_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, struct ieee80211_key_conf *key);int mt76x02_conf_tx (struct ieee80211_hw *hw,struct ieee80211_vif *vif,u16 queue,const struct ieee80211_tx_queue_params *params); +void mt76x02_sta_rate_tbl_update (struct ieee80211_hw *hw, +struct ieee80211_vif *vif, +struct ieee80211_sta *sta);#endif
drivers/net/wireless/mediatek/mt76/mt76x2.h +1 -4
@@ -234,7 +234,7 @@ void mt76x2_sta_ps(struct mt76_dev *dev, struct ieee80211_sta *sta, bool ps);void mt76x2_update_channel (struct mt76_dev *mdev); -s8 mt76x2_tx_get_max_txpwr_adj (struct mt76x2_dev *dev, +s8 mt76x2_tx_get_max_txpwr_adj (struct mt76_dev *dev,const struct ieee80211_tx_rate *rate);s8 mt76x2_tx_get_txpwr_adj (struct mt76x2_dev *dev,s8 txpwr,s8 max_txpwr_adj);void mt76x2_tx_set_txpwr_auto (struct mt76x2_dev *dev,s8 txpwr);
@@ -259,9 +259,6 @@ void mt76x2_remove_interface(struct ieee80211_hw *hw,int mt76x2_conf_tx (struct ieee80211_hw *hw,struct ieee80211_vif *vif,u16 queue,const struct ieee80211_tx_queue_params *params);void mt76x2_txq_init (struct mt76x2_dev *dev,struct ieee80211_txq *txq); -void mt76x2_sta_rate_tbl_update (struct ieee80211_hw *hw, -struct ieee80211_vif *vif, -struct ieee80211_sta *sta);void mt76x2_phy_set_txpower_regs (struct mt76x2_dev *dev,enum nl80211_band band);
drivers/net/wireless/mediatek/mt76/mt76x2_common.c +0 -19
@@ -18,25 +18,6 @@#include "mt76x2.h" #include "mt76x02_mac.h" -void mt76x2_sta_rate_tbl_update (struct ieee80211_hw *hw, -struct ieee80211_vif *vif, -struct ieee80211_sta *sta) -{ -struct mt76x2_dev *dev = hw->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 = {}; - -if (!rates) -return ; - - rate.idx = rates->rate[0 ].idx; - rate.flags = rates->rate[0 ].flags; -mt76x2_mac_wcid_set_rate (dev, &msta->wcid, &rate); - msta->wcid.max_txpwr_adj =mt76x2_tx_get_max_txpwr_adj (dev, &rate); -} -EXPORT_SYMBOL_GPL (mt76x2_sta_rate_tbl_update); -void mt76x2_queue_rx_skb (struct mt76_dev *mdev,enum mt76_rxq_id q,struct sk_buff *skb) {
drivers/net/wireless/mediatek/mt76/mt76x2_init.c +1 -0
@@ -424,6 +424,7 @@ struct mt76x2_dev *mt76x2_alloc_device(struct device *pdev) .rx_skb = mt76x2_queue_rx_skb, .rx_poll_complete = mt76x2_rx_poll_complete, .sta_ps = mt76x2_sta_ps, + .get_max_txpwr_adj = mt76x2_tx_get_max_txpwr_adj, };struct mt76x2_dev *dev;struct mt76_dev *mdev;
drivers/net/wireless/mediatek/mt76/mt76x2_mac.h +0 -53
65 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt76x2_mac_common.c +2 -63
77 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt76x2_main.c +1 -1
@@ -299,7 +299,7 @@ const struct ieee80211_ops mt76x2_ops = { .ampdu_action = mt76x02_ampdu_action, .get_txpower = mt76x2_get_txpower, .wake_tx_queue = mt76_wake_tx_queue, - .sta_rate_tbl_update = mt76x2_sta_rate_tbl_update, + .sta_rate_tbl_update = mt76x02_sta_rate_tbl_update, .release_buffered_frames = mt76_release_buffered_frames, .set_coverage_class = mt76x2_set_coverage_class, .get_survey = mt76_get_survey,
drivers/net/wireless/mediatek/mt76/mt76x2_tx_common.c +2 -1
@@ -63,9 +63,10 @@ int mt76x2_insert_hdr_pad(struct sk_buff *skb) }EXPORT_SYMBOL_GPL (mt76x2_insert_hdr_pad); -s8 mt76x2_tx_get_max_txpwr_adj (struct mt76x2_dev *dev, +s8 mt76x2_tx_get_max_txpwr_adj (struct mt76_dev *mdev,const struct ieee80211_tx_rate *rate) { +struct mt76x2_dev *dev = (struct mt76x2_dev *) mdev;s8 max_txpwr;if (rate->flags &IEEE80211_TX_RC_VHT_MCS ) {
drivers/net/wireless/mediatek/mt76/mt76x2u_main.c +1 -1
@@ -176,5 +176,5 @@ const struct ieee80211_ops mt76x2u_ops = { .conf_tx = mt76x02_conf_tx, .sw_scan_start = mt76x2u_sw_scan, .sw_scan_complete = mt76x2u_sw_scan_complete, - .sta_rate_tbl_update = mt76x2_sta_rate_tbl_update, + .sta_rate_tbl_update = mt76x02_sta_rate_tbl_update, };
Signature · 1 line
2.7.5
PATCH 15/22 mt76: unify txwi and rxwi structures
In reply to a message not in the archivetxwi and rxwi are the same for mt76x0 and mt76x2.
--- drivers/net/wireless/mediatek/mt76/mt76x0/dma.c | 12 ++-- drivers/net/wireless/mediatek/mt76/mt76x0/mac.c | 4 +- drivers/net/wireless/mediatek/mt76/mt76x0/mac.h | 67 ---------------------- drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h | 4 +- drivers/net/wireless/mediatek/mt76/mt76x0/phy.c | 2 +- drivers/net/wireless/mediatek/mt76/mt76x0/trace.h | 12 ++-- drivers/net/wireless/mediatek/mt76/mt76x0/tx.c | 18 +++--- drivers/net/wireless/mediatek/mt76/mt76x02_mac.h | 54 +++++++++++++++++ drivers/net/wireless/mediatek/mt76/mt76x2_common.c | 2 +- drivers/net/wireless/mediatek/mt76/mt76x2_dma.c | 6 +- drivers/net/wireless/mediatek/mt76/mt76x2_init.c | 2 +- drivers/net/wireless/mediatek/mt76/mt76x2_mac.c | 6 +- drivers/net/wireless/mediatek/mt76/mt76x2_mac.h | 57 +----------------- .../net/wireless/mediatek/mt76/mt76x2_mac_common.c | 4 +- drivers/net/wireless/mediatek/mt76/mt76x2u_core.c | 8 +-- 15 files changed, 94 insertions(+), 164 deletions(-)
drivers/net/wireless/mediatek/mt76/mt76x0/dma.c +6 -6
@@ -34,7 +34,7 @@ static unsigned int ieee80211_get_hdrlen_from_buf(const u8 *data, unsigned len) }static struct sk_buff * -mt76x0_rx_skb_from_seg (struct mt76x0_dev *dev,struct mt76x0_rxwi *rxwi, +mt76x0_rx_skb_from_seg (struct mt76x0_dev *dev,struct mt76x02_rxwi *rxwi,void *data,u32 seg_len,u32 truesize,struct page *p) {struct sk_buff *skb;
@@ -86,7 +86,7 @@ static void mt76x0_rx_process_seg(struct mt76x0_dev *dev, u8 *data, u32 seg_len, struct page *p) { struct sk_buff *skb; -struct mt76x0_rxwi *rxwi; +struct mt76x02_rxwi *rxwi;u32 fce_info, truesize = seg_len;/* DMA_INFO field at the beginning of the segment contains only some of
@@ -98,9 +98,9 @@ static void mt76x0_rx_process_seg(struct mt76x0_dev *dev, u8 *data, data +=MT_DMA_HDR_LEN ; seg_len -=MT_DMA_HDR_LEN ; - rxwi = (struct mt76x0_rxwi *) data; - data +=sizeof (struct mt76x0_rxwi ); - seg_len -=sizeof (struct mt76x0_rxwi ); + rxwi = (struct mt76x02_rxwi *) data; + data +=sizeof (struct mt76x02_rxwi ); + seg_len -=sizeof (struct mt76x02_rxwi );if (unlikely (FIELD_GET (MT_RXD_INFO_TYPE , fce_info)))dev_err_once (dev->mt76.dev,"Error: RX path seen a non-pkt urb\n" );
@@ -119,7 +119,7 @@ static void mt76x0_rx_process_seg(struct mt76x0_dev *dev, u8 *data,static u16 mt76x0_rx_next_seg_len (u8 *data,u32 data_len) {u32 min_seg_len =MT_DMA_HDR_LEN +MT_RX_INFO_LEN + -sizeof (struct mt76x0_rxwi ) +MT_FCE_INFO_LEN ; +sizeof (struct mt76x02_rxwi ) +MT_FCE_INFO_LEN ;u16 dma_len =get_unaligned_le16 (data); if (data_len < min_seg_len ||
drivers/net/wireless/mediatek/mt76/mt76x0/mac.c +2 -2
@@ -431,7 +431,7 @@ mt76_mac_process_rate(struct ieee80211_rx_status *status, u16 rate) }static void -mt76x0_rx_monitor_beacon (struct mt76x0_dev *dev,struct mt76x0_rxwi *rxwi, +mt76x0_rx_monitor_beacon (struct mt76x0_dev *dev,struct mt76x02_rxwi *rxwi,u16 rate,int rssi) { dev->bcn_phy_mode =FIELD_GET (MT_RXWI_RATE_PHY , rate);
@@ -451,7 +451,7 @@ u32 mt76x0_mac_process_rx(struct mt76x0_dev *dev, struct sk_buff *skb, u8 *data, void *rxi) {struct ieee80211_rx_status *status =IEEE80211_SKB_RXCB (skb); -struct mt76x0_rxwi *rxwi = rxi; +struct mt76x02_rxwi *rxwi = rxi;u32 len, ctl =le32_to_cpu (rxwi->ctl);u16 rate =le16_to_cpu (rxwi->rate);int rssi;
drivers/net/wireless/mediatek/mt76/mt76x0/mac.h +0 -67
73 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h +1 -3
@@ -187,8 +187,6 @@ struct mt76x0_wcid {u8 tx_rate_nss; }; -struct mt76x0_rxwi ; -extern const struct ieee80211_ops mt76x0_ops;static inline bool is_mt7610e (struct mt76x0_dev *dev)
@@ -229,7 +227,7 @@ void mt76x0_agc_restore(struct mt76x0_dev *dev);int mt76x0_phy_set_channel (struct mt76x0_dev *dev,struct cfg80211_chan_def *chandef);void mt76x0_phy_recalibrate_after_assoc (struct mt76x0_dev *dev); -int mt76x0_phy_get_rssi (struct mt76x0_dev *dev,struct mt76x0_rxwi *rxwi); +int mt76x0_phy_get_rssi (struct mt76x0_dev *dev,struct mt76x02_rxwi *rxwi);void mt76x0_phy_con_cal_onoff (struct mt76x0_dev *dev,struct ieee80211_bss_conf *info);
drivers/net/wireless/mediatek/mt76/mt76x0/phy.c +1 -1
@@ -225,7 +225,7 @@ mt76x0_bbp_set_ctrlch(struct mt76x0_dev *dev, enum nl80211_chan_width width,mt76_rmw_field (dev,MT_BBP (TXBE ,0 ),MT_BBP_TXBE_R0_CTRL_CHAN , ctrl); } -int mt76x0_phy_get_rssi (struct mt76x0_dev *dev,struct mt76x0_rxwi *rxwi) +int mt76x0_phy_get_rssi (struct mt76x0_dev *dev,struct mt76x02_rxwi *rxwi) {s8 lna_gain, rssi_offset;int val;
drivers/net/wireless/mediatek/mt76/mt76x0/trace.h +6 -6
@@ -178,11 +178,11 @@ DECLARE_EVENT_CLASS(dev_simple_evt, ); TRACE_EVENT(mt76x0_rx, - TP_PROTO(struct mt76_dev *dev, struct mt76x0_rxwi *rxwi, u32 f), + TP_PROTO(struct mt76_dev *dev, struct mt76x02_rxwi *rxwi, u32 f), TP_ARGS(dev, rxwi, f), TP_STRUCT__entry( DEV_ENTRY - __field_struct(struct mt76x0_rxwi, rxwi) + __field_struct(struct mt76x02_rxwi, rxwi) __field(u32, fce_info) ), TP_fast_assign(
@@ -197,11 +197,11 @@ TRACE_EVENT(mt76x0_rx, TRACE_EVENT(mt76x0_tx, TP_PROTO(struct mt76_dev *dev, struct sk_buff *skb, - struct mt76x02_sta *sta, struct mt76_txwi *h), + struct mt76x02_sta *sta, struct mt76x02_txwi *h), TP_ARGS(dev, skb, sta, h), TP_STRUCT__entry( DEV_ENTRY - __field_struct(struct mt76_txwi, h) + __field_struct(struct mt76x02_txwi, h) __field(struct sk_buff *, skb) __field(struct mt76x02_sta *, sta) ),
@@ -211,11 +211,11 @@ TRACE_EVENT(mt76x0_tx, __entry->skb = skb; __entry->sta = sta; ), -TP_printk (DEV_PR_FMT "skb:%p sta:%p flg:%04hx rate_ctl:%04hx " +TP_printk (DEV_PR_FMT "skb:%p sta:%p flg:%04hx rate:%04hx " "ack:%02hhx wcid:%02hhx len_ctl:%05hx" ,DEV_PR_ARG , __entry->skb, __entry->sta,le16_to_cpu (__entry->h.flags), -le16_to_cpu (__entry->h.rate_ctl), +le16_to_cpu (__entry->h.rate), __entry->h.ack_ctl, __entry->h.wcid,le16_to_cpu (__entry->h.len_ctl)) );
drivers/net/wireless/mediatek/mt76/mt76x0/tx.c +9 -9
@@ -33,7 +33,7 @@ static void mt76x0_tx_skb_remove_dma_overhead(struct sk_buff *skb, {int pkt_len = (unsigned long )info->status.status_driver_data[0 ]; -skb_pull (skb,sizeof (struct mt76_txwi ) +4 ); +skb_pull (skb,sizeof (struct mt76x02_txwi ) +4 );if (ieee80211_get_hdrlen_from_skb (skb) %4 )mt76x0_remove_hdr_pad (skb);
@@ -60,28 +60,28 @@ static int mt76x0_skb_rooms(struct mt76x0_dev *dev, struct sk_buff *skb)int hdr_len =ieee80211_get_hdrlen_from_skb (skb);u32 need_head; - need_head =sizeof (struct mt76_txwi ) +4 ; + need_head =sizeof (struct mt76x02_txwi ) +4 ;if (hdr_len %4 ) need_head +=2 ;return skb_cow (skb, need_head); } -static struct mt76_txwi * +static struct mt76x02_txwi *mt76x0_push_txwi (struct mt76x0_dev *dev,struct sk_buff *skb,struct ieee80211_sta *sta,struct mt76_wcid *wcid,int pkt_len) {struct ieee80211_tx_info *info =IEEE80211_SKB_CB (skb);struct ieee80211_tx_rate *rate = &info->control.rates[0 ]; -struct mt76_txwi *txwi; +struct mt76x02_txwi *txwi;unsigned long flags;u16 txwi_flags =0 ;u32 pkt_id;u16 rate_ctl;u8 nss; - txwi = (struct mt76_txwi *)skb_push (skb,sizeof (struct mt76_txwi )); + txwi = (struct mt76x02_txwi *)skb_push (skb,sizeof (struct mt76x02_txwi ));memset (txwi,0 ,sizeof (*txwi));if (!wcid->tx_rate_set)
@@ -97,12 +97,12 @@ mt76x0_push_txwi(struct mt76x0_dev *dev, struct sk_buff *skb, }spin_unlock_irqrestore (&dev->mt76.lock, flags); - txwi->rate_ctl =cpu_to_le16 (rate_ctl); + txwi->rate =cpu_to_le16 (rate_ctl);if (info->flags &IEEE80211_TX_CTL_LDPC ) - txwi->rate_ctl |=cpu_to_le16 (MT_RXWI_RATE_LDPC ); + txwi->rate |=cpu_to_le16 (MT_RXWI_RATE_LDPC );if ((info->flags &IEEE80211_TX_CTL_STBC ) && nss ==1 ) - txwi->rate_ctl |=cpu_to_le16 (MT_RXWI_RATE_STBC ); + txwi->rate |=cpu_to_le16 (MT_RXWI_RATE_STBC );if (nss >1 && sta && sta->smps_mode ==IEEE80211_SMPS_DYNAMIC ) txwi_flags |=MT_TXWI_FLAGS_MMPS ;
@@ -151,7 +151,7 @@ void mt76x0_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control,struct ieee80211_sta *sta = control->sta;struct mt76x02_sta *msta =NULL ;struct mt76_wcid *wcid = &dev->mt76.global_wcid; -struct mt76_txwi *txwi; +struct mt76x02_txwi *txwi;int pkt_len = skb->len;int hw_q =skb2q (skb);
drivers/net/wireless/mediatek/mt76/mt76x02_mac.h +54 -0
60 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt76x2_common.c +1 -1
@@ -30,7 +30,7 @@ void mt76x2_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,return ; } -skb_pull (skb,sizeof (struct mt76x2_rxwi )); +skb_pull (skb,sizeof (struct mt76x02_rxwi ));if (mt76x2_mac_process_rx (dev, skb, rxwi)) {dev_kfree_skb (skb);return ;
drivers/net/wireless/mediatek/mt76/mt76x2_dma.c +3 -3
@@ -106,8 +106,8 @@ int mt76x2_dma_init(struct mt76x2_dev *dev)struct mt76_txwi_cache __maybe_unused *t;struct mt76_queue *q; -BUILD_BUG_ON (sizeof (t->txwi) <sizeof (struct mt76x2_txwi )); -BUILD_BUG_ON (sizeof (struct mt76x2_rxwi ) >MT_RX_HEADROOM ); +BUILD_BUG_ON (sizeof (t->txwi) <sizeof (struct mt76x02_txwi )); +BUILD_BUG_ON (sizeof (struct mt76x02_rxwi ) >MT_RX_HEADROOM );mt76_dma_attach (&dev->mt76);
@@ -141,7 +141,7 @@ int mt76x2_dma_init(struct mt76x2_dev *dev)return ret; q = &dev->mt76.q_rx[MT_RXQ_MAIN ]; - q->buf_offset =MT_RX_HEADROOM -sizeof (struct mt76x2_rxwi ); + q->buf_offset =MT_RX_HEADROOM -sizeof (struct mt76x02_rxwi ); ret =mt76x2_init_rx_queue (dev, q,0 , MT76x2_RX_RING_SIZE,MT_RX_BUF_SIZE );if (ret)return ret;
drivers/net/wireless/mediatek/mt76/mt76x2_init.c +1 -1
@@ -417,7 +417,7 @@ void mt76x2_cleanup(struct mt76x2_dev *dev)struct mt76x2_dev *mt76x2_alloc_device (struct device *pdev) {static const struct mt76_driver_ops drv_ops = { - .txwi_size =sizeof (struct mt76x2_txwi ), + .txwi_size =sizeof (struct mt76x02_txwi ), .update_survey = mt76x2_update_channel, .tx_prepare_skb = mt76x2_tx_prepare_skb, .tx_complete_skb = mt76x2_tx_complete_skb,
drivers/net/wireless/mediatek/mt76/mt76x2_mac.c +3 -3
@@ -64,7 +64,7 @@ mt76x2_mac_queue_txdone(struct mt76x2_dev *dev, struct sk_buff *skb, void *txwi_ptr) {struct mt76x2_tx_info *txi =mt76x2_skb_tx_info (skb); -struct mt76x2_txwi *txwi = txwi_ptr; +struct mt76x02_txwi *txwi = txwi_ptr;mt76x2_mac_poll_tx_status (dev, false);
@@ -100,9 +100,9 @@ static int mt76_write_beacon(struct mt76x2_dev *dev, int offset, struct sk_buff *skb) { int beacon_len = dev->beacon_offsets[1] - dev->beacon_offsets[0]; -struct mt76x2_txwi txwi; +struct mt76x02_txwi txwi; -if (WARN_ON_ONCE (beacon_len < skb->len +sizeof (struct mt76x2_txwi ))) +if (WARN_ON_ONCE (beacon_len < skb->len +sizeof (struct mt76x02_txwi )))return -ENOSPC ;mt76x2_mac_write_txwi (dev, &txwi, skb,NULL ,NULL , skb->len);
drivers/net/wireless/mediatek/mt76/mt76x2_mac.h +1 -56
75 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt76x2_mac_common.c +2 -2
@@ -229,7 +229,7 @@ void mt76x2_send_tx_status(struct mt76x2_dev *dev, }EXPORT_SYMBOL_GPL (mt76x2_send_tx_status); -void mt76x2_mac_write_txwi (struct mt76x2_dev *dev,struct mt76x2_txwi *txwi, +void mt76x2_mac_write_txwi (struct mt76x2_dev *dev,struct mt76x02_txwi *txwi,struct sk_buff *skb,struct mt76_wcid *wcid,struct ieee80211_sta *sta,int len) {
@@ -443,7 +443,7 @@ int mt76x2_mac_process_rx(struct mt76x2_dev *dev, struct sk_buff *skb, void *rxi) {struct mt76_rx_status *status = (struct mt76_rx_status *) skb->cb; -struct mt76x2_rxwi *rxwi = rxi; +struct mt76x02_rxwi *rxwi = rxi;struct mt76x02_sta *sta;u32 rxinfo =le32_to_cpu (rxwi->rxinfo);u32 ctl =le32_to_cpu (rxwi->ctl);
drivers/net/wireless/mediatek/mt76/mt76x2u_core.c +4 -4
@@ -21,7 +21,7 @@ static void mt76x2u_remove_dma_hdr(struct sk_buff *skb) {int hdr_len; -skb_pull (skb,sizeof (struct mt76x2_txwi ) +MT_DMA_HDR_LEN ); +skb_pull (skb,sizeof (struct mt76x02_txwi ) +MT_DMA_HDR_LEN ); hdr_len =ieee80211_get_hdrlen_from_skb (skb);if (hdr_len %4 ) {memmove (skb->data +2 , skb->data, hdr_len);
@@ -35,7 +35,7 @@ mt76x2u_check_skb_rooms(struct sk_buff *skb)int hdr_len =ieee80211_get_hdrlen_from_skb (skb);u32 need_head; - need_head =sizeof (struct mt76x2_txwi ) +MT_DMA_HDR_LEN ; + need_head =sizeof (struct mt76x02_txwi ) +MT_DMA_HDR_LEN ;if (hdr_len %4 ) need_head +=2 ;return skb_cow (skb, need_head);
@@ -82,7 +82,7 @@ int mt76x2u_tx_prepare_skb(struct mt76_dev *mdev, void *data, u32 *tx_info) { struct mt76x2_dev *dev = container_of(mdev, struct mt76x2_dev, mt76); -struct mt76x2_txwi *txwi; +struct mt76x02_txwi *txwi;int err, len = skb->len;int *hwq_ptr = (int *) data;
@@ -92,7 +92,7 @@ int mt76x2u_tx_prepare_skb(struct mt76_dev *mdev, void *data,mt76x2_insert_hdr_pad (skb); - txwi =skb_push (skb,sizeof (struct mt76x2_txwi )); + txwi =skb_push (skb,sizeof (struct mt76x02_txwi ));mt76x2_mac_write_txwi (dev, txwi, skb, wcid, sta, len);return mt76x2u_set_txinfo (skb, wcid,q2ep (*hwq_ptr));
Signature · 1 line
2.7.5
PATCH 16/22 mt76: unify load_tx_status
In reply to a message not in the archiveUnify load/fetch tx status from mt76x0 and mt76x2
--- drivers/net/wireless/mediatek/mt76/mt76x0/mac.c | 21 ------------------ drivers/net/wireless/mediatek/mt76/mt76x0/tx.c | 3 +-- drivers/net/wireless/mediatek/mt76/mt76x02_mac.c | 25 ++++++++++++++++++++++ drivers/net/wireless/mediatek/mt76/mt76x02_mac.h | 2 ++ drivers/net/wireless/mediatek/mt76/mt76x2.h | 2 -- drivers/net/wireless/mediatek/mt76/mt76x2_mac.c | 2 +- .../net/wireless/mediatek/mt76/mt76x2_mac_common.c | 25 ---------------------- drivers/net/wireless/mediatek/mt76/mt76x2u_core.c | 2 +- 8 files changed, 30 insertions(+), 52 deletions(-)
drivers/net/wireless/mediatek/mt76/mt76x0/mac.c +0 -21
@@ -116,27 +116,6 @@ mt76_mac_fill_tx_status(struct mt76x0_dev *dev, struct ieee80211_tx_info *info, info->flags |=IEEE80211_TX_STAT_ACK ; } -struct mt76x02_tx_status mt76x0_mac_fetch_tx_status (struct mt76x0_dev *dev) -{ -struct mt76x02_tx_status stat = {}; -u32 stat2, stat1; - - stat2 =mt76_rr (dev,MT_TX_STAT_FIFO_EXT ); - stat1 =mt76_rr (dev,MT_TX_STAT_FIFO ); - - stat.valid = !!(stat1 &MT_TX_STAT_FIFO_VALID ); - stat.success = !!(stat1 &MT_TX_STAT_FIFO_SUCCESS ); - stat.aggr = !!(stat1 &MT_TX_STAT_FIFO_AGGR ); - stat.ack_req = !!(stat1 &MT_TX_STAT_FIFO_ACKREQ ); - stat.wcid =FIELD_GET (MT_TX_STAT_FIFO_WCID , stat1); - stat.rate =FIELD_GET (MT_TX_STAT_FIFO_RATE , stat1); - - stat.retry =FIELD_GET (MT_TX_STAT_FIFO_EXT_RETRY , stat2); - stat.pktid =FIELD_GET (MT_TX_STAT_FIFO_EXT_PKTID , stat2); - -return stat; -} -void mt76x0_send_tx_status (struct mt76x0_dev *dev,struct mt76x02_tx_status *stat,u8 *update) {struct ieee80211_tx_info info = {};
drivers/net/wireless/mediatek/mt76/mt76x0/tx.c +1 -2
@@ -190,8 +190,7 @@ void mt76x0_tx_stat(struct work_struct *work)u8 update =1 ;while (!test_bit (MT76_REMOVED , &dev->mt76.state)) { - stat =mt76x0_mac_fetch_tx_status (dev); -if (!stat.valid) +if (!mt76x02_mac_load_tx_status (&dev->mt76, &stat))break ;mt76x0_send_tx_status (dev, &stat, &update);
drivers/net/wireless/mediatek/mt76/mt76x02_mac.c +25 -0
@@ -216,3 +216,28 @@ void mt76x02_mac_wcid_set_rate(struct mt76_dev *dev, struct mt76_wcid *wcid, wcid->tx_rate_set = true;spin_unlock_bh (&dev->lock); } + +bool mt76x02_mac_load_tx_status (struct mt76_dev *dev, +struct mt76x02_tx_status *stat) +{ +u32 stat1, stat2; + + stat2 =__mt76_rr (dev,MT_TX_STAT_FIFO_EXT ); + stat1 =__mt76_rr (dev,MT_TX_STAT_FIFO ); + + stat->valid = !!(stat1 &MT_TX_STAT_FIFO_VALID ); +if (!stat->valid) +return false; + + stat->success = !!(stat1 &MT_TX_STAT_FIFO_SUCCESS ); + stat->aggr = !!(stat1 &MT_TX_STAT_FIFO_AGGR ); + stat->ack_req = !!(stat1 &MT_TX_STAT_FIFO_ACKREQ ); + stat->wcid =FIELD_GET (MT_TX_STAT_FIFO_WCID , stat1); + stat->rate =FIELD_GET (MT_TX_STAT_FIFO_RATE , stat1); + + stat->retry =FIELD_GET (MT_TX_STAT_FIFO_EXT_RETRY , stat2); + stat->pktid =FIELD_GET (MT_TX_STAT_FIFO_EXT_PKTID , stat2); + +return true; +} +EXPORT_SYMBOL_GPL (mt76x02_mac_load_tx_status);
drivers/net/wireless/mediatek/mt76/mt76x02_mac.h +2 -0
@@ -195,4 +195,6 @@ void mt76x02_mac_wcid_set_rate(struct mt76_dev *dev, struct mt76_wcid *wcid,__le16 mt76x02_mac_tx_rate_val (struct mt76_dev *dev,const struct ieee80211_tx_rate *rate,u8 *nss_val); +bool mt76x02_mac_load_tx_status (struct mt76_dev *dev, +struct mt76x02_tx_status *stat);#endif
drivers/net/wireless/mediatek/mt76/mt76x2.h +0 -2
@@ -241,8 +241,6 @@ 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 mt76x02_tx_status *stat);void mt76x2_send_tx_status (struct mt76x2_dev *dev,struct mt76x02_tx_status *stat,u8 *update);void mt76x2_reset_wlan (struct mt76x2_dev *dev,bool enable);
drivers/net/wireless/mediatek/mt76/mt76x2_mac.c +1 -1
@@ -42,7 +42,7 @@ void mt76x2_mac_poll_tx_status(struct mt76x2_dev *dev, bool irq)while (!irq || !kfifo_is_full (&dev->txstatus_fifo)) {spin_lock_irqsave (&dev->irq_lock, flags); - ret =mt76x2_mac_load_tx_status (dev, &stat); + ret =mt76x02_mac_load_tx_status (&dev->mt76, &stat);spin_unlock_irqrestore (&dev->irq_lock, flags);if (!ret)
drivers/net/wireless/mediatek/mt76/mt76x2_mac_common.c +0 -24
@@ -53,31 +53,6 @@ void mt76x2_mac_stop(struct mt76x2_dev *dev, bool force) }EXPORT_SYMBOL_GPL (mt76x2_mac_stop); -bool mt76x2_mac_load_tx_status (struct mt76x2_dev *dev, -struct mt76x02_tx_status *stat) -{ -u32 stat1, stat2; - - stat2 =mt76_rr (dev,MT_TX_STAT_FIFO_EXT ); - stat1 =mt76_rr (dev,MT_TX_STAT_FIFO ); - - stat->valid = !!(stat1 &MT_TX_STAT_FIFO_VALID ); -if (!stat->valid) -return false; - - stat->success = !!(stat1 &MT_TX_STAT_FIFO_SUCCESS ); - stat->aggr = !!(stat1 &MT_TX_STAT_FIFO_AGGR ); - stat->ack_req = !!(stat1 &MT_TX_STAT_FIFO_ACKREQ ); - stat->wcid =FIELD_GET (MT_TX_STAT_FIFO_WCID , stat1); - stat->rate =FIELD_GET (MT_TX_STAT_FIFO_RATE , stat1); - - stat->retry =FIELD_GET (MT_TX_STAT_FIFO_EXT_RETRY , stat2); - stat->pktid =FIELD_GET (MT_TX_STAT_FIFO_EXT_PKTID , stat2); - -return true; -} -EXPORT_SYMBOL_GPL (mt76x2_mac_load_tx_status);
PATCH 17/22 mt76: unify send_tx_status and related helpers
In reply to a message not in the archiveMerge send_tx_status and helper functions from mt76x0 and mt76x2.
--- drivers/net/wireless/mediatek/mt76/mt76x0/mac.c | 147 -------------------- drivers/net/wireless/mediatek/mt76/mt76x0/mac.h | 4 - drivers/net/wireless/mediatek/mt76/mt76x0/tx.c | 2 +- drivers/net/wireless/mediatek/mt76/mt76x02_mac.c | 151 +++++++++++++++++++++ drivers/net/wireless/mediatek/mt76/mt76x02_mac.h | 2 + drivers/net/wireless/mediatek/mt76/mt76x2.h | 2 - drivers/net/wireless/mediatek/mt76/mt76x2_mac.c | 4 +- .../net/wireless/mediatek/mt76/mt76x2_mac_common.c | 151 --------------------- drivers/net/wireless/mediatek/mt76/mt76x2u_core.c | 2 +- 9 files changed, 157 insertions(+), 308 deletions(-)
drivers/net/wireless/mediatek/mt76/mt76x0/mac.c +0 -147
@@ -17,153 +17,6 @@#include "trace.h" #include <linux/etherdevice.h> -static void -mt76_mac_process_tx_rate (struct ieee80211_tx_rate *txrate,u16 rate, -enum nl80211_band band) -{ -u8 idx =FIELD_GET (MT_RXWI_RATE_INDEX , rate); - - txrate->idx =0 ; - txrate->flags =0 ; - txrate->count =1 ; - -switch (FIELD_GET (MT_RXWI_RATE_PHY , rate)) { -case MT_PHY_TYPE_OFDM : -if (band ==NL80211_BAND_2GHZ ) - idx +=4 ; - - txrate->idx = idx; -return ; -case MT_PHY_TYPE_CCK : -if (idx >=8 ) - idx -=8 ; - - txrate->idx = idx; -return ; -case MT_PHY_TYPE_HT_GF : - txrate->flags |=IEEE80211_TX_RC_GREEN_FIELD ; -/* fall through */ -case MT_PHY_TYPE_HT : - txrate->flags |=IEEE80211_TX_RC_MCS ; - txrate->idx = idx; -break ; -case MT_PHY_TYPE_VHT : - txrate->flags |=IEEE80211_TX_RC_VHT_MCS ; - txrate->idx = idx; -break ; -default : -WARN_ON (1 ); -return ; - } - -switch (FIELD_GET (MT_RXWI_RATE_BW , rate)) { -case MT_PHY_BW_20 : -break ; -case MT_PHY_BW_40 : - txrate->flags |=IEEE80211_TX_RC_40_MHZ_WIDTH ; -break ; -case MT_PHY_BW_80 : - txrate->flags |=IEEE80211_TX_RC_80_MHZ_WIDTH ; -break ; -default : -WARN_ON (1 ); -return ; - } - -if (rate &MT_RXWI_RATE_SGI ) - txrate->flags |=IEEE80211_TX_RC_SHORT_GI ; -} - -static void -mt76_mac_fill_tx_status (struct mt76x0_dev *dev,struct ieee80211_tx_info *info, -struct mt76x02_tx_status *st,int n_frames) -{ -struct ieee80211_tx_rate *rate = info->status.rates; -int cur_idx, last_rate; -int i; - -if (!n_frames) -return ; - - last_rate =min_t (int, st->retry,IEEE80211_TX_MAX_RATES -1 ); -mt76_mac_process_tx_rate (&rate[last_rate], st->rate, - dev->mt76.chandef.chan->band); -if (last_rate <IEEE80211_TX_MAX_RATES -1 ) - rate[last_rate +1 ].idx =-1 ; - - cur_idx = rate[last_rate].idx + last_rate; -for (i =0 ; i <= last_rate; i++) { - rate[i].flags = rate[last_rate].flags; - rate[i].idx =max_t (int,0 , cur_idx - i); - rate[i].count =1 ; - } - - rate[last_rate -1 ].count = st->retry +1 - last_rate; - - info->status.ampdu_len = n_frames; - info->status.ampdu_ack_len = st->success ? n_frames :0 ; - -if (st->pktid &MT_TXWI_PKTID_PROBE ) - info->flags |=IEEE80211_TX_CTL_RATE_CTRL_PROBE ; - -if (st->aggr) - info->flags |=IEEE80211_TX_CTL_AMPDU | -IEEE80211_TX_STAT_AMPDU ; - -if (!st->ack_req) - info->flags |=IEEE80211_TX_CTL_NO_ACK ; -else if (st->success) - info->flags |=IEEE80211_TX_STAT_ACK ; -} - -void mt76x0_send_tx_status (struct mt76x0_dev *dev,struct mt76x02_tx_status *stat,u8 *update) -{ -struct ieee80211_tx_info info = {}; -struct ieee80211_sta *sta =NULL ; -struct mt76_wcid *wcid =NULL ; -struct mt76x02_sta *msta =NULL ; - -rcu_read_lock (); -if (stat->wcid <ARRAY_SIZE (dev->mt76.wcid)) - wcid =rcu_dereference (dev->mt76.wcid[stat->wcid]); - -if (wcid) { -void *priv; - priv = msta = container_of(wcid, struct mt76x02_sta, wcid); - sta = container_of(priv, struct ieee80211_sta, drv_priv); - } - -if (msta && stat->aggr) { -u32 stat_val, stat_cache; - - stat_val = stat->rate; - stat_val |= ((u32 ) stat->retry) <<16 ; - stat_cache = msta->status.rate; - stat_cache |= ((u32 ) msta->status.retry) <<16 ; - -if (*update ==0 && stat_val == stat_cache && - stat->wcid == msta->status.wcid && msta->n_frames <32 ) { - msta->n_frames++; - goto out; - } - -mt76_mac_fill_tx_status (dev, &info, &msta->status, - msta->n_frames); - msta->status = *stat; - msta->n_frames =1 ; - *update =0 ; - }else { -mt76_mac_fill_tx_status (dev, &info, stat,1 ); - *update =1 ; - } - -spin_lock_bh (&dev->mac_lock); -ieee80211_tx_status_noskb (dev->mt76.hw, sta, &info); -spin_unlock_bh (&dev->mac_lock); -out: -rcu_read_unlock (); -} -void mt76x0_mac_set_protection (struct mt76x0_dev *dev,bool legacy_prot,int ht_mode) {
drivers/net/wireless/mediatek/mt76/mt76x0/mac.h +0 -4
@@ -17,8 +17,4 @@u32 mt76x0_mac_process_rx (struct mt76x0_dev *dev,struct sk_buff *skb,u8 *data,void *rxi); -struct mt76x02_tx_status -mt76x0_mac_fetch_tx_status (struct mt76x0_dev *dev); -void mt76x0_send_tx_status (struct mt76x0_dev *dev,struct mt76x02_tx_status *stat,u8 *update); -#endif
drivers/net/wireless/mediatek/mt76/mt76x0/tx.c +1 -1
@@ -193,7 +193,7 @@ void mt76x0_tx_stat(struct work_struct *work)if (!mt76x02_mac_load_tx_status (&dev->mt76, &stat))break ; -mt76x0_send_tx_status (dev, &stat, &update); +mt76x02_send_tx_status (&dev->mt76, &stat, &update); cleaned++; }
drivers/net/wireless/mediatek/mt76/mt76x02_mac.c +151 -0
154 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt76x02_mac.h +2 -0
@@ -197,4 +197,6 @@ mt76x02_mac_tx_rate_val(struct mt76_dev *dev, const struct ieee80211_tx_rate *rate, u8 *nss_val);bool mt76x02_mac_load_tx_status (struct mt76_dev *dev,struct mt76x02_tx_status *stat); +void mt76x02_send_tx_status (struct mt76_dev *dev, +struct mt76x02_tx_status *stat,u8 *update);#endif
drivers/net/wireless/mediatek/mt76/mt76x2.h +0 -2
@@ -241,8 +241,6 @@ void mt76x2_tx_set_txpwr_auto(struct mt76x2_dev *dev, s8 txpwr);int mt76x2_insert_hdr_pad (struct sk_buff *skb); -void mt76x2_send_tx_status (struct mt76x2_dev *dev, -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);
drivers/net/wireless/mediatek/mt76/mt76x2_mac.c +2 -2
@@ -51,7 +51,7 @@ void mt76x2_mac_poll_tx_status(struct mt76x2_dev *dev, bool irq)trace_mac_txstat_fetch (dev, &stat);if (!irq) { -mt76x2_send_tx_status (dev, &stat, &update); +mt76x02_send_tx_status (&dev->mt76, &stat, &update);continue ; }
@@ -82,7 +82,7 @@ void mt76x2_mac_process_tx_status_fifo(struct mt76x2_dev *dev)u8 update =1 ;while (kfifo_get (&dev->txstatus_fifo, &stat)) -mt76x2_send_tx_status (dev, &stat, &update); +mt76x02_send_tx_status (&dev->mt76, &stat, &update); } void mt76x2_tx_complete_skb(struct mt76_dev *mdev, struct mt76_queue *q,
drivers/net/wireless/mediatek/mt76/mt76x2_mac_common.c +0 -150
153 lines not on this page · raw message
PATCH 18/22 mt76: use mt76_rx_status in mt76x0
In reply to a message not in the archiveMake rx status processing similar to mt76x2.
--- drivers/net/wireless/mediatek/mt76/mac80211.c | 3 ++- drivers/net/wireless/mediatek/mt76/mt76.h | 2 ++ drivers/net/wireless/mediatek/mt76/mt76x0/dma.c | 2 ++ drivers/net/wireless/mediatek/mt76/mt76x0/mac.c | 4 ++-- 4 files changed, 8 insertions(+), 3 deletions(-)
drivers/net/wireless/mediatek/mt76/mac80211.c +2 -1
@@ -475,7 +475,7 @@ void mt76_wcid_key_setup(struct mt76_dev *dev, struct mt76_wcid *wcid, }EXPORT_SYMBOL (mt76_wcid_key_setup); -static struct ieee80211_sta *mt76_rx_convert (struct sk_buff *skb) +struct ieee80211_sta *mt76_rx_convert (struct sk_buff *skb) {struct ieee80211_rx_status *status =IEEE80211_SKB_RXCB (skb);struct mt76_rx_status mstat;
@@ -500,6 +500,7 @@ static struct ieee80211_sta *mt76_rx_convert(struct sk_buff *skb)return wcid_to_sta (mstat.wcid); } +EXPORT_SYMBOL (mt76_rx_convert);static int mt76_check_ccmp_pn (struct sk_buff *skb)
drivers/net/wireless/mediatek/mt76/mt76.h +2 -0
@@ -572,6 +572,8 @@ void mt76_rx_aggr_stop(struct mt76_dev *dev, struct mt76_wcid *wcid, u8 tid);void mt76_wcid_key_setup (struct mt76_dev *dev,struct mt76_wcid *wcid,struct ieee80211_key_conf *key); +struct ieee80211_sta *mt76_rx_convert (struct sk_buff *skb); +/* internal */ void mt76_tx_free (struct mt76_dev *dev);struct mt76_txwi_cache *mt76_get_txwi (struct mt76_dev *dev);
drivers/net/wireless/mediatek/mt76/mt76x0/dma.c +2 -0
@@ -111,6 +111,8 @@ static void mt76x0_rx_process_seg(struct mt76x0_dev *dev, u8 *data,if (!skb)return ; +mt76_rx_convert (skb); +spin_lock (&dev->mac_lock);ieee80211_rx (dev->mt76.hw, skb);spin_unlock (&dev->mac_lock);
drivers/net/wireless/mediatek/mt76/mt76x0/mac.c +2 -2
@@ -196,7 +196,7 @@ void mt76x0_mac_set_ampdu_factor(struct mt76x0_dev *dev) }static void -mt76_mac_process_rate (struct ieee80211_rx_status *status,u16 rate) +mt76_mac_process_rate (struct mt76_rx_status *status,u16 rate) {u8 idx =FIELD_GET (MT_RXWI_RATE_INDEX , rate);
@@ -282,7 +282,7 @@ mt76x0_rx_is_our_beacon(struct mt76x0_dev *dev, u8 *data)u32 mt76x0_mac_process_rx (struct mt76x0_dev *dev,struct sk_buff *skb,u8 *data,void *rxi) { -struct ieee80211_rx_status *status =IEEE80211_SKB_RXCB (skb); +struct mt76_rx_status *status = (struct mt76_rx_status *) skb->cb;struct mt76x02_rxwi *rxwi = rxi;u32 len, ctl =le32_to_cpu (rxwi->ctl);u16 rate =le16_to_cpu (rxwi->rate);
Signature · 1 line
2.7.5
PATCH 19/22 mt76: unify mac_process_rate
In reply to a message not in the archiveMerge mac_process_rate from mt76x0 and mt76x2.
--- drivers/net/wireless/mediatek/mt76/mt76x0/mac.c | 69 +--------------------- drivers/net/wireless/mediatek/mt76/mt76x02_mac.c | 68 +++++++++++++++++++++ drivers/net/wireless/mediatek/mt76/mt76x02_mac.h | 2 + .../net/wireless/mediatek/mt76/mt76x2_mac_common.c | 69 +--------------------- 4 files changed, 72 insertions(+), 136 deletions(-)
drivers/net/wireless/mediatek/mt76/mt76x0/mac.c +1 -68
@@ -196,73 +196,6 @@ void mt76x0_mac_set_ampdu_factor(struct mt76x0_dev *dev) }static void -mt76_mac_process_rate (struct mt76_rx_status *status,u16 rate) -{ -u8 idx =FIELD_GET (MT_RXWI_RATE_INDEX , rate); - -switch (FIELD_GET (MT_RXWI_RATE_PHY , rate)) { -case MT_PHY_TYPE_OFDM : -if (idx >=8 ) - idx =0 ; - -if (status->band ==NL80211_BAND_2GHZ ) - idx +=4 ; - - status->rate_idx = idx; -return ; -case MT_PHY_TYPE_CCK : -if (idx >=8 ) { - idx -=8 ; - status->enc_flags |=RX_ENC_FLAG_SHORTPRE ; - } - -if (idx >=4 ) - idx =0 ; - - status->rate_idx = idx; -return ; -case MT_PHY_TYPE_HT_GF : - status->enc_flags |=RX_ENC_FLAG_HT_GF ; -/* fall through */ -case MT_PHY_TYPE_HT : - status->encoding =RX_ENC_HT ; - status->rate_idx = idx; -break ; -case MT_PHY_TYPE_VHT : - status->encoding =RX_ENC_VHT ; - status->rate_idx =FIELD_GET (MT_RATE_INDEX_VHT_IDX , idx); - status->nss =FIELD_GET (MT_RATE_INDEX_VHT_NSS , idx) +1 ; -break ; -default : -WARN_ON (1 ); -return ; - } - -if (rate &MT_RXWI_RATE_LDPC ) - status->enc_flags |=RX_ENC_FLAG_LDPC ; - -if (rate &MT_RXWI_RATE_SGI ) - status->enc_flags |=RX_ENC_FLAG_SHORT_GI ; - -if (rate &MT_RXWI_RATE_STBC ) - status->enc_flags |=1 <<RX_ENC_FLAG_STBC_SHIFT ; - -switch (FIELD_GET (MT_RXWI_RATE_BW , rate)) { -case MT_PHY_BW_20 : -break ; -case MT_PHY_BW_40 : - status->bw =RATE_INFO_BW_40 ; -break ; -case MT_PHY_BW_80 : - status->bw =RATE_INFO_BW_80 ; -break ; -default : -WARN_ON (1 ); -break ; - } -} - -static void mt76x0_rx_monitor_beacon (struct mt76x0_dev *dev,struct mt76x02_rxwi *rxwi,u16 rate,int rssi) {
@@ -303,7 +236,7 @@ u32 mt76x0_mac_process_rx(struct mt76x0_dev *dev, struct sk_buff *skb, status->freq = dev->mt76.chandef.chan->center_freq; status->band = dev->mt76.chandef.chan->band; -mt76_mac_process_rate (status, rate); +mt76x02_mac_process_rate (status, rate);spin_lock_bh (&dev->con_mon_lock);if (mt76x0_rx_is_our_beacon (dev, data)) {
drivers/net/wireless/mediatek/mt76/mt76x02_mac.c +68 -0
71 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt76x02_mac.h +2 -0
@@ -199,4 +199,6 @@ bool mt76x02_mac_load_tx_status(struct mt76_dev *dev, struct mt76x02_tx_status *stat);void mt76x02_send_tx_status (struct mt76_dev *dev,struct mt76x02_tx_status *stat,u8 *update); +int +mt76x02_mac_process_rate (struct mt76_rx_status *status,u16 rate);#endif
drivers/net/wireless/mediatek/mt76/mt76x2_mac_common.c +0 -66
69 lines not on this page · raw message
PATCH 20/22 mt76x0: reserve enough space in mac80211
In reply to a message not in the archiveAllocate skg with enough headroom by mac80211 , this eliminate need to add extra skb headroom by the mt76x0 driver.
--- drivers/net/wireless/mediatek/mt76/mt76x0/init.c | 1 + drivers/net/wireless/mediatek/mt76/mt76x0/tx.c | 17 +---------------- 2 files changed, 2 insertions(+), 16 deletions(-)
drivers/net/wireless/mediatek/mt76/mt76x0/init.c +1 -0
@@ -685,6 +685,7 @@ int mt76x0_register_device(struct mt76x0_dev *dev) hw->max_rates =1 ; hw->max_report_rates =7 ; hw->max_rate_tries =1 ; + hw->extra_tx_headroom =sizeof (struct mt76x02_txwi ) +4 +2 ; hw->sta_data_size =sizeof (struct mt76x02_sta ); hw->vif_data_size =sizeof (struct mt76x02_vif );
drivers/net/wireless/mediatek/mt76/mt76x0/tx.c +0 -11
@@ -55,18 +55,6 @@ void mt76x0_tx_status(struct mt76x0_dev *dev, struct sk_buff *skb)spin_unlock (&dev->mac_lock); } -static int mt76x0_skb_rooms (struct mt76x0_dev *dev,struct sk_buff *skb) -{ -int hdr_len =ieee80211_get_hdrlen_from_skb (skb); -u32 need_head; - - need_head =sizeof (struct mt76x02_txwi ) +4 ; -if (hdr_len %4 ) - need_head +=2 ; - -return skb_cow (skb, need_head); -}
PATCH 21/22 mt76: unify {insert/remove}_hdr_pad
In reply to a message not in the archiveMerge insert/remove _hdr_pad from mt76x0 and mt76x2.
--- drivers/net/wireless/mediatek/mt76/mt76x0/Makefile | 2 +- drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h | 4 --- drivers/net/wireless/mediatek/mt76/mt76x0/tx.c | 5 +-- drivers/net/wireless/mediatek/mt76/mt76x0/util.c | 42 ---------------------- drivers/net/wireless/mediatek/mt76/mt76x02_util.c | 29 +++++++++++++++ drivers/net/wireless/mediatek/mt76/mt76x02_util.h | 2 ++ drivers/net/wireless/mediatek/mt76/mt76x2.h | 1 - .../net/wireless/mediatek/mt76/mt76x2_mac_common.c | 15 ++------ drivers/net/wireless/mediatek/mt76/mt76x2_tx.c | 3 +- .../net/wireless/mediatek/mt76/mt76x2_tx_common.c | 16 --------- drivers/net/wireless/mediatek/mt76/mt76x2u_core.c | 3 +- 11 files changed, 41 insertions(+), 81 deletions(-) delete mode 100644 drivers/net/wireless/mediatek/mt76/mt76x0/util.c
drivers/net/wireless/mediatek/mt76/mt76x0/Makefile +1 -1
@@ -2,6 +2,6 @@ obj-$(CONFIG_MT76x0U) += mt76x0.o mt76x0-objs = \ usb.o init.o main.o mcu.o trace.o dma.o eeprom.o phy.o \ - mac.o util.o debugfs.o tx.o + mac.o debugfs.o tx.o # ccflags-y := -DDEBUG CFLAGS_trace.o := -I$(src)
drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h +0 -4
@@ -245,10 +245,6 @@ void mt76x0_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control,void mt76x0_tx_status (struct mt76x0_dev *dev,struct sk_buff *skb);void mt76x0_tx_stat (struct work_struct *work); -/* util */ -void mt76x0_remove_hdr_pad (struct sk_buff *skb); -int mt76x0_insert_hdr_pad (struct sk_buff *skb); -int mt76x0_dma_init (struct mt76x0_dev *dev);void mt76x0_dma_cleanup (struct mt76x0_dev *dev);
drivers/net/wireless/mediatek/mt76/mt76x0/tx.c +3 -2
@@ -14,6 +14,7 @@#include "mt76x0.h" #include "trace.h" +#include "../mt76x02_util.h" /* Take mac80211 Q id from the skb and translate it to hardware Q id */ static u8 skb2q (struct sk_buff *skb)
@@ -35,7 +36,7 @@ static void mt76x0_tx_skb_remove_dma_overhead(struct sk_buff *skb,skb_pull (skb,sizeof (struct mt76x02_txwi ) +4 );if (ieee80211_get_hdrlen_from_skb (skb) %4 ) -mt76x0_remove_hdr_pad (skb); +mt76x02_remove_hdr_pad (skb,2 );skb_trim (skb, pkt_len); }
@@ -146,7 +147,7 @@ void mt76x0_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control,BUILD_BUG_ON (ARRAY_SIZE (info->status.status_driver_data) <1 ); info->status.status_driver_data[0 ] = (void *)(unsigned long )pkt_len; -mt76x0_insert_hdr_pad (skb); +mt76x02_insert_hdr_pad (skb);if (sta) { msta = (struct mt76x02_sta *) sta->drv_priv;
drivers/net/wireless/mediatek/mt76/mt76x0/util.c deleted +0 -42
42 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt76x02_util.c +29 -0
@@ -348,4 +348,33 @@ void mt76x02_sta_rate_tbl_update(struct ieee80211_hw *hw, }EXPORT_SYMBOL_GPL (mt76x02_sta_rate_tbl_update); +int mt76x02_insert_hdr_pad (struct sk_buff *skb) +{ +int len =ieee80211_get_hdrlen_from_skb (skb); + +if (len %4 ==0 ) +return 0 ; + +skb_push (skb,2 ); +memmove (skb->data, skb->data +2 , len); + + skb->data[len] =0 ; + skb->data[len +1 ] =0 ; +return 2 ; +} +EXPORT_SYMBOL_GPL (mt76x02_insert_hdr_pad); + +void mt76x02_remove_hdr_pad (struct sk_buff *skb,int len) +{ +int hdrlen; + +if (!len) +return ; + + hdrlen =ieee80211_get_hdrlen_from_skb (skb); +memmove (skb->data + len, skb->data, hdrlen); +skb_pull (skb, len); +} +EXPORT_SYMBOL_GPL (mt76x02_remove_hdr_pad); +MODULE_LICENSE ("Dual BSD/GPL" );
drivers/net/wireless/mediatek/mt76/mt76x02_util.h +2 -0
@@ -43,4 +43,6 @@ int mt76x02_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,void mt76x02_sta_rate_tbl_update (struct ieee80211_hw *hw,struct ieee80211_vif *vif,struct ieee80211_sta *sta); +int mt76x02_insert_hdr_pad (struct sk_buff *skb); +void mt76x02_remove_hdr_pad (struct sk_buff *skb,int len);#endif
drivers/net/wireless/mediatek/mt76/mt76x2.h +0 -1
@@ -239,7 +239,6 @@ s8 mt76x2_tx_get_max_txpwr_adj(struct mt76_dev *dev,s8 mt76x2_tx_get_txpwr_adj (struct mt76x2_dev *dev,s8 txpwr,s8 max_txpwr_adj);void mt76x2_tx_set_txpwr_auto (struct mt76x2_dev *dev,s8 txpwr); -int mt76x2_insert_hdr_pad (struct sk_buff *skb);void mt76x2_reset_wlan (struct mt76x2_dev *dev,bool enable); void mt76x2_init_txpower(struct mt76x2_dev *dev,
drivers/net/wireless/mediatek/mt76/mt76x2_mac_common.c +2 -13
@@ -16,6 +16,7 @@*/ #include "mt76x2.h" +#include "mt76x02_util.h" void mt76x2_mac_stop (struct mt76x2_dev *dev,bool force) {
@@ -146,18 +147,6 @@ void mt76x2_mac_write_txwi(struct mt76x2_dev *dev, struct mt76x02_txwi *txwi, }EXPORT_SYMBOL_GPL (mt76x2_mac_write_txwi); -static void mt76x2_remove_hdr_pad (struct sk_buff *skb,int len) -{ -int hdrlen; - -if (!len) -return ; - - hdrlen =ieee80211_get_hdrlen_from_skb (skb); -memmove (skb->data + len, skb->data, hdrlen); -skb_pull (skb, len); -} -int mt76x2_mac_get_rssi (struct mt76x2_dev *dev,s8 rssi,int chain) {struct mt76x2_rx_freq_cal *cal = &dev->cal.rx;
@@ -254,7 +243,7 @@ int mt76x2_mac_process_rx(struct mt76x2_dev *dev, struct sk_buff *skb, } } -mt76x2_remove_hdr_pad (skb, pad_len); +mt76x02_remove_hdr_pad (skb, pad_len);if ((rxinfo &MT_RXINFO_BA ) && !(rxinfo &MT_RXINFO_NULL )) status->aggr = true;
drivers/net/wireless/mediatek/mt76/mt76x2_tx.c +2 -1
@@ -16,6 +16,7 @@#include "mt76x2.h" #include "mt76x2_dma.h" +#include "mt76x02_util.h" struct beacon_bc_data {struct mt76x2_dev *dev;
@@ -38,7 +39,7 @@ int mt76x2_tx_prepare_skb(struct mt76_dev *mdev, void *txwi,mt76x2_mac_write_txwi (dev, txwi, skb, wcid, sta, skb->len); - ret =mt76x2_insert_hdr_pad (skb); + ret =mt76x02_insert_hdr_pad (skb);if (ret <0 )return ret;
drivers/net/wireless/mediatek/mt76/mt76x2_tx_common.c +0 -15
@@ -47,22 +47,6 @@ void mt76x2_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control, }EXPORT_SYMBOL_GPL (mt76x2_tx); -int mt76x2_insert_hdr_pad (struct sk_buff *skb) -{ -int len =ieee80211_get_hdrlen_from_skb (skb); - -if (len %4 ==0 ) -return 0 ; - -skb_push (skb,2 ); -memmove (skb->data, skb->data +2 , len); - - skb->data[len] =0 ; - skb->data[len +1 ] =0 ; -return 2 ; -} -EXPORT_SYMBOL_GPL (mt76x2_insert_hdr_pad);
PATCH 22/22 mt76: partially unify filling txwi fields
In reply to a message not in the archiveMerge code filing txwi fields the same way on mt76x0 and mt76x2.
--- drivers/net/wireless/mediatek/mt76/mt76x0/tx.c | 44 ++-------------------- drivers/net/wireless/mediatek/mt76/mt76x02_mac.c | 42 +++++++++++++++++++++ drivers/net/wireless/mediatek/mt76/mt76x02_mac.h | 3 +- .../net/wireless/mediatek/mt76/mt76x2_mac_common.c | 35 +---------------- 4 files changed, 48 insertions(+), 76 deletions(-)
drivers/net/wireless/mediatek/mt76/mt76x0/tx.c +3 -41
@@ -65,8 +65,6 @@ mt76x0_push_txwi(struct mt76x0_dev *dev, struct sk_buff *skb,struct ieee80211_tx_rate *rate = &info->control.rates[0 ];struct mt76x02_txwi *txwi;unsigned long flags; -u16 txwi_flags =0 ; -u32 pkt_id;u16 rate_ctl;u8 nss;
@@ -86,47 +84,11 @@ mt76x0_push_txwi(struct mt76x0_dev *dev, struct sk_buff *skb, }spin_unlock_irqrestore (&dev->mt76.lock, flags); + txwi->wcid = wcid->idx; txwi->rate =cpu_to_le16 (rate_ctl); + txwi->pktid = (!(info->flags &IEEE80211_TX_CTL_NO_ACK )) ?1 :0 ; -if (info->flags &IEEE80211_TX_CTL_LDPC ) - txwi->rate |=cpu_to_le16 (MT_RXWI_RATE_LDPC ); -if ((info->flags &IEEE80211_TX_CTL_STBC ) && nss ==1 ) - txwi->rate |=cpu_to_le16 (MT_RXWI_RATE_STBC ); -if (nss >1 && sta && sta->smps_mode ==IEEE80211_SMPS_DYNAMIC ) - txwi_flags |=MT_TXWI_FLAGS_MMPS ; - -if (!(info->flags &IEEE80211_TX_CTL_NO_ACK )) { - txwi->ack_ctl |=MT_TXWI_ACK_CTL_REQ ; - pkt_id =1 ; - }else { - pkt_id =0 ; - } - -if (info->flags &IEEE80211_TX_CTL_RATE_CTRL_PROBE ) - pkt_id |=MT_TXWI_PKTID_PROBE ; - -if (info->flags &IEEE80211_TX_CTL_ASSIGN_SEQ ) - txwi->ack_ctl |=MT_TXWI_ACK_CTL_NSEQ ; - -if ((info->flags &IEEE80211_TX_CTL_AMPDU ) && sta) { -u8 ba_size =IEEE80211_MIN_AMPDU_BUF ; - - ba_size <<= sta->ht_cap.ampdu_factor; - ba_size =min_t (int,7 , ba_size -1 ); -if (info->flags &IEEE80211_TX_CTL_RATE_CTRL_PROBE ) { - ba_size =0 ; - }else { - txwi_flags |=MT_TXWI_FLAGS_AMPDU ; - txwi_flags |=FIELD_PREP (MT_TXWI_FLAGS_MPDU_DENSITY , - sta->ht_cap.ampdu_density); - } - txwi->ack_ctl |=FIELD_PREP (MT_TXWI_ACK_CTL_BA_WINDOW , ba_size); - } - - txwi->wcid = wcid->idx; - txwi->flags |=cpu_to_le16 (txwi_flags); - txwi->len_ctl =cpu_to_le16 (pkt_len); - txwi->pktid = pkt_id; +mt76x02_mac_fill_txwi (txwi, skb, sta, pkt_len, nss);return txwi; }
drivers/net/wireless/mediatek/mt76/mt76x02_mac.c +42 -0
48 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt76x02_mac.h +2 -1
@@ -180,7 +180,8 @@ static inline bool mt76x02_wait_for_mac(struct mt76_dev *dev) }void mt76x02_txq_init (struct mt76_dev *dev,struct ieee80211_txq *txq); - +void mt76x02_mac_fill_txwi (struct mt76x02_txwi *txwi,struct sk_buff *skb, +struct ieee80211_sta *sta,int len,u8 nss);enum mt76x02_cipher_type mt76x02_mac_get_key_info (struct ieee80211_key_conf *key,u8 *key_data);
drivers/net/wireless/mediatek/mt76/mt76x2_mac_common.c +0 -31
@@ -61,9 +61,7 @@ void mt76x2_mac_write_txwi(struct mt76x2_dev *dev, struct mt76x02_txwi *txwi,struct ieee80211_tx_info *info =IEEE80211_SKB_CB (skb);struct ieee80211_tx_rate *rate = &info->control.rates[0 ];struct ieee80211_key_conf *key = info->control.hw_key; -struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;u16 rate_ht_mask =FIELD_PREP (MT_RXWI_RATE_PHY ,BIT (1 ) |BIT (2 )); -u16 txwi_flags =0 ;u8 nss;s8 txpwr_adj, max_txpwr_adj;u8 ccmp_pn[8 ];
@@ -112,38 +110,7 @@ void mt76x2_mac_write_txwi(struct mt76x2_dev *dev, struct mt76x02_txwi *txwi, !(txwi->rate & cpu_to_le16(rate_ht_mask))) txwi->txstream = 0x93; -if (info->flags &IEEE80211_TX_CTL_LDPC ) - txwi->rate |=cpu_to_le16 (MT_RXWI_RATE_LDPC ); -if ((info->flags &IEEE80211_TX_CTL_STBC ) && nss ==1 ) - txwi->rate |=cpu_to_le16 (MT_RXWI_RATE_STBC ); -if (nss >1 && sta && sta->smps_mode ==IEEE80211_SMPS_DYNAMIC ) - txwi_flags |=MT_TXWI_FLAGS_MMPS ; -if (!(info->flags &IEEE80211_TX_CTL_NO_ACK )) - txwi->ack_ctl |=MT_TXWI_ACK_CTL_REQ ; -if (info->flags &IEEE80211_TX_CTL_ASSIGN_SEQ ) - txwi->ack_ctl |=MT_TXWI_ACK_CTL_NSEQ ; -if (info->flags &IEEE80211_TX_CTL_RATE_CTRL_PROBE ) - txwi->pktid |=MT_TXWI_PKTID_PROBE ; -if ((info->flags &IEEE80211_TX_CTL_AMPDU ) && sta) { -u8 ba_size =IEEE80211_MIN_AMPDU_BUF ; - - ba_size <<= sta->ht_cap.ampdu_factor; - ba_size =min_t (int,63 , ba_size -1 ); -if (info->flags &IEEE80211_TX_CTL_RATE_CTRL_PROBE ) - ba_size =0 ; - txwi->ack_ctl |=FIELD_PREP (MT_TXWI_ACK_CTL_BA_WINDOW , ba_size); - - txwi_flags |=MT_TXWI_FLAGS_AMPDU | -FIELD_PREP (MT_TXWI_FLAGS_MPDU_DENSITY , - sta->ht_cap.ampdu_density); - } - -if (ieee80211_is_probe_resp (hdr->frame_control) || -ieee80211_is_beacon (hdr->frame_control)) - txwi_flags |=MT_TXWI_FLAGS_TS ;
Quoted 11 lines · Stanislaw Gruszka
More mt76x0/mt76x2 integration.
This set is quite big but I would like to move patches upstream from my github tree as fast as possible. I have there 42 more ready to post patches from me and Lorenzo.
https://github.com/sgruszka/wireless-drivers-next/commits/mt76x0-draft-v3Note this set include:
"mt76x0: fix wrong usage ofwcid_maskinremove_interface" patch with I posted as fix for 4.19 . I assume this will be auto (or manually?) merged when -next will go to 4.20.
The problem is that having two identical patches with different commit ids will confuse git and can create annoying merge conflicts. A much safer approach is that the patch is first applied to wireless-drivers and then I merge wireless-drivers into wireless-drivers-next. I'm planning to do that in a day or two, I was away for a long weekend so lagging behind again.
But the patch "mt76x0: fix wrong usage of wcid_mask in remove_interface" should be dropped from this series. But Felix is planning to send all pending mt76 to me via a pull request anyway so you don't need to worry about this.
Signature · 1 line
Kalle Valo