Re: [PATCH] ath10k: htt_rx: Fix signedness bug in ath10k_update_per_peer_tx_stats
On 2018-10-06 00:45, Gustavo A. R. Silva wrote: On 10/5/18 9:14 PM, Gustavo A. R. Silva wrote: On 10/5/18 9:09 PM, Ben Greear wrote: On 10/05/2018 11:42 AM, Gustavo A. R. Silva wrote: Currently, the error handling for the call to function ath10k_get_legacy_rate_idx() doesn't work because *rate_idx* is of type u8 (8 bits, unsigned), which makes it impossible for it to hold a value less than 0. Fix this by changing the type of variable *rate_idx* to s8 (8 bits, signed). There are more than 127 rates, are you sure this is doing what you want? Based on the following function, rate_idx can only hold values from 0 to 11 ... and of course -EINVAL too static inline int ath10k_get_legacy_rate_idx(struct ath10k *ar, u8 rate) { static const u8 legacy_rates[] = {1, 2, 5, 11, 6, 9, 12, 18, 24, 36, 48, 54}; int i; for (i = 0; i < ARRAY_SIZE(legacy_rates); i++) { if (rate == legacy_rates[i]) return i; } ath10k_warn(ar, "Invalid legacy rate %hhd peer stats", rate); return -EINVAL; } Thanks -- Gustavo Thanks, Ben Addresses-Coverity-ID: 1473914 ("Unsigned compared against 0") Fixes: 0189dbd71cbd ("ath10k: get the legacy rate index to update the txrate table") Signed-off-by: Gustavo A. R. Silva --- drivers/net/wireless/ath/ath10k/htt_rx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c index f240525..edd0e74 100644 --- a/drivers/net/wireless/ath/ath10k/htt_rx.c +++ b/drivers/net/wireless/ath/ath10k/htt_rx.c @@ -2753,7 +2753,8 @@ ath10k_update_per_peer_tx_stats(struct ath10k *ar, struct ath10k_per_peer_tx_stats *peer_stats) { struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; - u8 rate = 0, rate_idx = 0, sgi; + u8 rate = 0, sgi; + s8 rate_idx = 0; struct rate_info txrate; lockdep_assert_held(&ar->data_lock); I have sent a patch to address this, https://patchwork.kernel.org/patch/10611943/ Thanks Anil.
Re: [RFC 00/19] wilc: added driver for wilc module
On Sat, 6 Oct 2018 15:45:41 +0300 Kalle Valo wrote: > Ajay Singh writes: > > > This patch set contains the driver files from > > 'driver/staging/wilc1000'. Renamed the driver from 'wilc1000' to > > 'wilc' to have generic name, as the same driver will be used by > > other wilc family members. > > I'm worried that the name 'wilc' is just too generic, I liked the > original name wilc1000 much more. Quite often when we have a new > generation of wireless devices there's also a new driver, so in the > long run I'm worried that a generic name like 'wilc' could be a > source of confusion. I think it's much smaller problem if > 'wilc1000' (the driver) also supports wilc3000 (the device), people > are already used to that. I also thought about retaining the same wilc1000 name, which has be used for quite some time now. But as we are moving this driver to '/driver/net/wireless/' freshly so thought it’s better to change in the first commit. As you know, 'wilc1000' name is used for folder name as well as module name (i.e wilc1000.ko and wilc1000-spi.ko/wilc1000-sdio.ko). WILC3000 is going to use the same modules(.ko). Do you think its good approach to have 'wilc1000' folder but only remove ‘wilc1000’ prefix from .ko modules names in Makefile (i.e wilc.ko and wilc-spio.ko/wilc-sdio.ko). So these .ko becomes generic and give clear name to be used with both wilc1000 and wilc3000 modules. Please let know what do you think about it and based on your input I will make the change. Also should I submit the v2 version by retaining old name or wait for few more comments to include in that. Regards, Ajay
RE: [RFC v3 07/12] rtw88: phy files
> -Original Message- > From: Stanislaw Gruszka [mailto:sgrus...@redhat.com] > Sent: Thursday, October 04, 2018 10:10 PM > To: Tony Chuang > Cc: kv...@codeaurora.org; larry.fin...@lwfinger.net; Pkshih; Andy Huang; > linux-wireless@vger.kernel.org > Subject: Re: [RFC v3 07/12] rtw88: phy files > > On Wed, Oct 03, 2018 at 07:20:54PM +0800, yhchu...@realtek.com wrote: > > +void rtw_phy_cfg_bb(struct rtw_dev *rtwdev, const struct rtw_table *tbl, > > + u32 addr, u32 data) > > +{ > > + if (addr == 0xfe) > > + msleep(50); > > + else if (addr == 0xfd) > > + mdelay(5); > > + else if (addr == 0xfc) > > + mdelay(1); > > + else if (addr == 0xfb) > > + usleep_range(50, 60); > > + else if (addr == 0xfa) > > + udelay(5); > > + else if (addr == 0xf9) > > + udelay(1); > > + else > > + rtw_write32(rtwdev, addr, data); > > This mix of mdelay(), msleep(), udelay() and usleep_range() looks strange. > You should eigher use atomic versions *delay or non-atomic *sleep > versions . This is to make checkpatch.pl happy. > > > +#define bcd_to_dec_pwr_by_rate(val, i) \ > > + ({ \ > > + typeof(val) __val_ = val; \ > > + typeof(i) __i_ = i; \ > > + ((s8)__val_ >> (__i_ * 8 + 4)) & 0xF)) * 10 + \ > > + ((__val_ >> (__i_ * 8)) & 0xF))); \ > > +}) > > Can use bcd2bin from include/linux/bcd.h instead ? > OK > > Thanks > Stanislaw > Yan-Hsuan Chuang
Re: [RFC v2] cfg80211: add peer measurement with FTM API
Hi Lior, Thanks for taking the time :-) > > Results availability is multicast on a new "peer-measurement" > > multicast group, and results can be retrieved by dumping the > > data given the measurement cookie. Note that dumping it from > > the netlink socket that started the measurement will delete > > data, to allow not hanging on to measurement data forever when > > the measurement is long-running and only updates periodically. > > Just curious, what's the advantage of this compared to sending the reply only > on > the socket that started the measurement? TBH, I don't really see any. Some people really wanted this for things like "let's do something in iw for measurements", though even that is not strictly necessary since you can always start listening for events as (before) you send off your request. It's slightly more complicated in terms of socket handling (as you need to be able to handle events while waiting for the netlink ACK message) but that's not so bad. I'm all for it, so perhaps I'll change that. In that case, it might even make sense to continue with the simple "send out results to userspace as we get them" approach, since the application that made the request will know to dedicate a socket with socket buffer to it, and handle it quickly, avoiding the problems with running out of socket buffer space and losing the "measurement complete" event (that I was worried about with our [Intel] original code of just multicasting the results). > > + * @lci_len: length of LCI information (if present) > > + * @civicloc_len: length of civic location information (if present) > > Consider naming lcr (location civic report) instead of civicloc (this is what > we > used in our QCA vendor API) Hmm. I guess we already did "civic location" in the FTM-responder side API, but perhaps we can change it. > > + * @rtt_avg: average of RTTs measured (must have either this or @dist_avg) > For debugging it might be useful to report the distance in each measurement, We did in fact originally report the distance unconditionally (rather than RTT and/or distance) but it ends up a multiplication by the speed of light (in air, but it was approximate enough this didn't matter), but I felt that such a calculation is so easy to do we may as well do it in iw/userspace? Unless I'm misunderstanding? > and > also the raw T1-T4 values. Makes sense. > Having T1-T4 in user space also allow running clock > drift correction algorithm, if only final value is reported the FW/driver > should > probably perform the correction. Anyhow guess this can be added in the future. Yeah, we can add more fields - although then they're sort of immediately optional ones :-) > Also, Wigig chip has multiple antennas in a single array each covering a > sector, > and WiFi may have multiple antenna arrays where one or more will be used for > measurement, this means we may provide low-accuracy AoA result - at minimum > this > may tell you on which side of the AP you are... Consider adding this as > optional > reporting, not critical for initial patch... Hmm. I'm not sure we have the ability to distinguish the TOA by antenna, but I don't know. Frankly, I'm not even sure what you'd want to add here? Timestamp per antenna? > > + * @partial: indicates that this is a partial result for this type > > Is partial set to false for the last result of this measurement type? This may > be useful, for example if requesting multiple measurement types, user space > can > start processing one measurement type before the entire session is completed. Yes, that was the intent, e.g. for multiple FTM bursts, but I see how this might be misleading at this level. I'll clarify the documentation (and probably over in nl80211.h as well) > > +/** > > + * struct cfg80211_pmsr_request_peer - peer data for a peer measurement > > request > > + * @addr: MAC address > > + * @chandef: channel to use > > For connected station, usually you will want to do the measurement on the > connected channel (possibly some chips will not be able to do otherwise) > Maybe add option to use default channel? Perhaps. It's somewhat complicated to look up in general, userspace generally has a decent idea, and making it optional means you end up with an invalid chandef? I'll take a look, perhaps just leaving all the fields 0/NULL can work reasonably well, but drivers would have to support it. > > + * @report_ap_tsf: report the associated AP's TSF > > + * @ftm: FTM data, see in particular @ftm.requested > > + */ > > +struct cfg80211_pmsr_request_peer { > > + u8 addr[ETH_ALEN]; > > + struct cfg80211_chan_def chandef; > > + bool report_ap_tsf; > > + struct { > > + enum nl80211_preamble preamble; > > + u16 burst_period; > > + bool requested; > > Maybe "requested" should be the first field? it is common for all measurement > structures? It's required in all measurement types, but I don't think we care what offset it has inside each, since they'r
Re: [RFC v2] cfg80211: add peer measurement with FTM API
Hi Johannes, On 10/1/2018 4:35 PM, Johannes Berg wrote: > From: Johannes Berg > > Add a new "peer measurement" API, that can be used to measure > certain things related to a peer. Right now, only implement > FTM (flight time measurement) over it, but the idea is that > it'll be extensible to also support measuring the necessary > things to calculate e.g. angle-of-arrival for WiGig. > It's good that you started with FTM only, we are still not sure about how to best support AoA measurement, so better add it as a future patch. > The API is structured to have a generic list of peers and > channels to measure with/on, and then for each of those a > set of measurements (again, only FTM right now) to perform. > > Results availability is multicast on a new "peer-measurement" > multicast group, and results can be retrieved by dumping the > data given the measurement cookie. Note that dumping it from > the netlink socket that started the measurement will delete > data, to allow not hanging on to measurement data forever when > the measurement is long-running and only updates periodically. > Just curious, what's the advantage of this compared to sending the reply only on the socket that started the measurement? > Similarly, closing the controlling netlink socket will abort > a running measurement automatically. > > Signed-off-by: Johannes Berg > --- > include/net/cfg80211.h | 243 > include/uapi/linux/nl80211.h | 411 ++ > net/wireless/Makefile| 1 + > net/wireless/core.c | 33 +++ > net/wireless/core.h | 4 + > net/wireless/nl80211.c | 202 ++--- > net/wireless/nl80211.h | 42 +++ > net/wireless/pmsr.c | 678 > +++ > net/wireless/rdev-ops.h | 25 ++ > net/wireless/trace.h | 70 + > 10 files changed, 1675 insertions(+), 34 deletions(-) > create mode 100644 net/wireless/pmsr.c > > diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h > index 8f5ee2c2da04..f9d4872e5123 100644 > --- a/include/net/cfg80211.h > +++ b/include/net/cfg80211.h > @@ -2841,6 +2841,178 @@ struct cfg80211_ftm_responder_stats { > u32 out_of_window_triggers_num; > }; > > +/** > + * struct cfg80211_pmsr_ftm_result - FTM result > + * @failure_reason: if this measurement failed (PMSR status is > + * %NL80211_PMSR_STATUS_FAILURE), this gives a more precise > + * reason than just "failure" > + * @burst_index: if reporting partial results, this is the index > + * in [0 .. num_bursts-1] of the burst that's being reported > + * @num_ftmr_attempts: number of FTM request frames transmitted > + * @num_ftmr_successes: number of FTM request frames acked > + * @busy_retry_time: if failure_reason is > %NL80211_PMSR_FTM_FAILURE_PEER_BUSY, > + * fill this to indicate in how many seconds a retry is deemed possible > + * by the responder > + * @num_bursts_exp: actual number of bursts exponent negotiated > + * @burst_duration: actual burst duration negotiated > + * @frames_per_burst: actual frames per burst negotiated > + * @lci_len: length of LCI information (if present) > + * @civicloc_len: length of civic location information (if present) Consider naming lcr (location civic report) instead of civicloc (this is what we used in our QCA vendor API) > + * @lci: LCI data (may be %NULL) > + * @civicloc: civic location data (may be %NULL) > + * @rssi_avg: average RSSI over FTM action frames reported > + * @rssi_spread: spread of the RSSI over FTM action frames reported > + * @tx_rate: bitrate for transmitted FTM action frame response > + * @rx_rate: bitrate of received FTM action frame > + * @rtt_avg: average of RTTs measured (must have either this or @dist_avg) > + * @rtt_variance: variance of RTTs measured (note that standard deviation is > + * the square root of the variance) > + * @rtt_spread: spread of the RTTs measured > + * @dist_avg: average of distances (mm) measured > + * (must have either this or @rtt_avg) > + * @dist_variance: variance of distances measured (see also @rtt_variance) > + * @dist_spread: spread of distances measured (see also @rtt_spread) For debugging it might be useful to report the distance in each measurement, and also the raw T1-T4 values. Having T1-T4 in user space also allow running clock drift correction algorithm, if only final value is reported the FW/driver should probably perform the correction. Anyhow guess this can be added in the future. Also, Wigig chip has multiple antennas in a single array each covering a sector, and WiFi may have multiple antenna arrays where one or more will be used for measurement, this means we may provide low-accuracy AoA result - at minimum this may tell you on which side of the AP you are... Consider adding this as optional reporting, not critical for initial patch... > + * @num_ftmr_attempts_valid: @num_ftmr_attempts is valid > + * @num_ftmr_successes_valid: @num_ftmr_successes is valid > + *
Re: pull-request: wireless-drivers-next 2018-10-07
From: Kalle Valo Date: Sun, 07 Oct 2018 10:37:06 +0300 > another pull request to net-next for 4.20. I'm sending this a bit > earlier than I prefer as I'm not sure if the merge window starts today > or not. Not all of these patches have been in linux-next, and also the > kbuild bot has been offline this week due to a service break, so there > might be some build problems which I have missed. Though a local > allmodconfig build with GCC 7.3.0 did work without problems. Pulled and crossing fingers :-) Thanks.
[PATCH 0/3] enable sta mode in mt76x0e driver
Enable client mode in mt76x0e driver registering the device to the mac80211 layer. Moreover add missing mac80211 callbacks in mt76x0e_ops data structure. Sta mode has been tested connecting to a 802.11ac AP on 5GHz band Lorenzo Bianconi (3): mt76x0: pci: add missing mac80211 callbacks mt76: disable ldpc coding for mt76x0 devices mt76x0: pci: add mt76x0_register_device in mt76x0e_register_device .../net/wireless/mediatek/mt76/mt76x0/pci.c | 31 +++- drivers/net/wireless/mediatek/mt76/mt76x02.h | 7 ++ .../net/wireless/mediatek/mt76/mt76x02_mac.c | 77 --- 3 files changed, 70 insertions(+), 45 deletions(-) -- 2.19.0
[PATCH 3/3] mt76x0: pci: add mt76x0_register_device in mt76x0e_register_device
Run mt76x0_register_device routine in mt76x0e_register_device in order to register the device to the mac80211 layer. Moreover init mt76_driver_ops data structure and register interrupt line Signed-off-by: Lorenzo Bianconi --- .../net/wireless/mediatek/mt76/mt76x0/pci.c | 20 ++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/pci.c b/drivers/net/wireless/mediatek/mt76/mt76x0/pci.c index ab91a22b4f05..10845f37af37 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x0/pci.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/pci.c @@ -127,12 +127,25 @@ static int mt76x0e_register_device(struct mt76x02_dev *dev) mt76_clear(dev, 0x110, BIT(9)); mt76_set(dev, MT_MAX_LEN_CFG, BIT(13)); + err = mt76x0_register_device(dev); + if (err < 0) + return err; + + set_bit(MT76_STATE_INITIALIZED, &dev->mt76.state); + return 0; } static int mt76x0e_probe(struct pci_dev *pdev, const struct pci_device_id *id) { + static const struct mt76_driver_ops drv_ops = { + .txwi_size = sizeof(struct mt76x02_txwi), + .tx_prepare_skb = mt76x02_tx_prepare_skb, + .tx_complete_skb = mt76x02_tx_complete_skb, + .rx_skb = mt76x02_queue_rx_skb, + .rx_poll_complete = mt76x02_rx_poll_complete, + }; struct mt76x02_dev *dev; int ret; @@ -150,7 +163,7 @@ mt76x0e_probe(struct pci_dev *pdev, const struct pci_device_id *id) if (ret) return ret; - dev = mt76x0_alloc_device(&pdev->dev, NULL, &mt76x0e_ops); + dev = mt76x0_alloc_device(&pdev->dev, &drv_ops, &mt76x0e_ops); if (!dev) return -ENOMEM; @@ -159,6 +172,11 @@ mt76x0e_probe(struct pci_dev *pdev, const struct pci_device_id *id) dev->mt76.rev = mt76_rr(dev, MT_ASIC_VERSION); dev_info(dev->mt76.dev, "ASIC revision: %08x\n", dev->mt76.rev); + ret = devm_request_irq(dev->mt76.dev, pdev->irq, mt76x02_irq_handler, + IRQF_SHARED, KBUILD_MODNAME, dev); + if (ret) + goto error; + ret = mt76x0e_register_device(dev); if (ret < 0) goto error; -- 2.19.0
[PATCH 2/3] mt76: disable ldpc coding for mt76x0 devices
Disable ldpc coding for mt76x0 devices. Morover remove mt76x02_mac_fill_txwi routine since it is used just in mt76x02_mac_write_txwi Signed-off-by: Lorenzo Bianconi --- drivers/net/wireless/mediatek/mt76/mt76x02.h | 7 ++ .../net/wireless/mediatek/mt76/mt76x02_mac.c | 77 --- 2 files changed, 41 insertions(+), 43 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02.h b/drivers/net/wireless/mediatek/mt76/mt76x02.h index e78708d55baf..fe731529144c 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x02.h +++ b/drivers/net/wireless/mediatek/mt76/mt76x02.h @@ -161,6 +161,13 @@ void mt76x02_set_beacon_offsets(struct mt76x02_dev *dev); void mt76x02_set_irq_mask(struct mt76x02_dev *dev, u32 clear, u32 set); void mt76x02_mac_start(struct mt76x02_dev *dev); +static inline bool is_mt76x2(struct mt76x02_dev *dev) +{ + return mt76_chip(&dev->mt76) == 0x7612 || + mt76_chip(&dev->mt76) == 0x7662 || + mt76_chip(&dev->mt76) == 0x7602; +} + static inline void mt76x02_irq_enable(struct mt76x02_dev *dev, u32 mask) { mt76x02_set_irq_mask(dev, 0, mask); diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c index 69132b971c30..10578e4cb269 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c @@ -156,48 +156,6 @@ void mt76x02_txq_init(struct mt76x02_dev *dev, struct ieee80211_txq *txq) } EXPORT_SYMBOL_GPL(mt76x02_txq_init); -static void -mt76x02_mac_fill_txwi(struct mt76x02_txwi *txwi, struct sk_buff *skb, - struct ieee80211_sta *sta, int len, u8 nss) -{ - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; - u16 txwi_flags = 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; - 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; - - txwi->flags |= cpu_to_le16(txwi_flags); - txwi->len_ctl = cpu_to_le16(len); -} - static __le16 mt76x02_mac_tx_rate_val(struct mt76x02_dev *dev, const struct ieee80211_tx_rate *rate, u8 *nss_val) @@ -344,10 +302,12 @@ void mt76x02_mac_write_txwi(struct mt76x02_dev *dev, struct mt76x02_txwi *txwi, struct sk_buff *skb, struct mt76_wcid *wcid, struct ieee80211_sta *sta, int len) { + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 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; 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], nstreams = dev->mt76.chainmask & 0xf; @@ -396,7 +356,38 @@ void mt76x02_mac_write_txwi(struct mt76x02_dev *dev, struct mt76x02_txwi *txwi, !(txwi->rate & cpu_to_le16(rate_ht_mask))) txwi->txstream = 0x93; - mt76x02_mac_fill_txwi(txwi, skb, sta, len, nss); + if (is_mt76x2(dev) && (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_
[PATCH 1/3] mt76x0: pci: add missing mac80211 callbacks
Add missing mac80211 callbacks in mt76x0e_ops data structure Signed-off-by: Lorenzo Bianconi --- drivers/net/wireless/mediatek/mt76/mt76x0/pci.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/pci.c b/drivers/net/wireless/mediatek/mt76/mt76x0/pci.c index f1a1c70c4263..ab91a22b4f05 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x0/pci.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/pci.c @@ -71,10 +71,19 @@ static const struct ieee80211_ops mt76x0e_ops = { .tx = mt76x02_tx, .start = mt76x0e_start, .stop = mt76x0e_stop, - .config = mt76x0_config, .add_interface = mt76x02_add_interface, .remove_interface = mt76x02_remove_interface, + .config = mt76x0_config, .configure_filter = mt76x02_configure_filter, + .sta_add = mt76x02_sta_add, + .sta_remove = mt76x02_sta_remove, + .set_key = mt76x02_set_key, + .conf_tx = mt76x02_conf_tx, + .sw_scan_start = mt76x0_sw_scan, + .sw_scan_complete = mt76x0_sw_scan_complete, + .ampdu_action = mt76x02_ampdu_action, + .sta_rate_tbl_update = mt76x02_sta_rate_tbl_update, + .wake_tx_queue = mt76_wake_tx_queue, }; static int mt76x0e_register_device(struct mt76x02_dev *dev) -- 2.19.0
[PATCH v2] mt76x0: pci: report firmware version using ethtool
Report via ethtool fw_ver and build_ver members of mt76x02_fw_header data structure similarly to what is reported in the syslog Signed-off-by: Lorenzo Bianconi --- Changes since v1: - rebase on top of 'mt76x02_dev data structure cleanup' series --- drivers/net/wireless/mediatek/mt76/mt76x0/pci_mcu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/pci_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76x0/pci_mcu.c index 6c66656c21f4..569861289aa5 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x0/pci_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/pci_mcu.c @@ -116,6 +116,7 @@ static int mt76x0e_load_firmware(struct mt76x02_dev *dev) goto out; } + mt76x02_set_ethtool_fwver(dev, hdr); dev_dbg(dev->mt76.dev, "Firmware running!\n"); out: -- 2.19.0
[PATCH 4/7] mt76: use mt76x02_dev instead of mt76_dev in mt76x02_usb_mcu.c
Use mt76x02_dev data structure as reference in mt76x02_usb_mcu.c instead of mt76_dev Signed-off-by: Lorenzo Bianconi --- .../wireless/mediatek/mt76/mt76x0/usb_mcu.c | 7 +++-- .../net/wireless/mediatek/mt76/mt76x02_usb.h | 6 ++--- .../wireless/mediatek/mt76/mt76x02_usb_mcu.c | 27 +-- .../wireless/mediatek/mt76/mt76x2/usb_mcu.c | 11 4 files changed, 24 insertions(+), 27 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/usb_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76x0/usb_mcu.c index fb6fa1fa5548..a9f14d5149d1 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x0/usb_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/usb_mcu.c @@ -40,8 +40,7 @@ mt76x0u_upload_firmware(struct mt76x02_dev *dev, ilm_len = le32_to_cpu(hdr->ilm_len) - MT_MCU_IVB_SIZE; dev_dbg(dev->mt76.dev, "loading FW - ILM %u + IVB %u\n", ilm_len, MT_MCU_IVB_SIZE); - err = mt76x02u_mcu_fw_send_data(&dev->mt76, - fw_payload + MT_MCU_IVB_SIZE, + err = mt76x02u_mcu_fw_send_data(dev, fw_payload + MT_MCU_IVB_SIZE, ilm_len, MCU_FW_URB_MAX_PAYLOAD, MT_MCU_IVB_SIZE); if (err) @@ -49,7 +48,7 @@ mt76x0u_upload_firmware(struct mt76x02_dev *dev, dlm_len = le32_to_cpu(hdr->dlm_len); dev_dbg(dev->mt76.dev, "loading FW - DLM %u\n", dlm_len); - err = mt76x02u_mcu_fw_send_data(&dev->mt76, + err = mt76x02u_mcu_fw_send_data(dev, fw_payload + le32_to_cpu(hdr->ilm_len), dlm_len, MCU_FW_URB_MAX_PAYLOAD, MT_MCU_DLM_OFFSET); @@ -121,7 +120,7 @@ static int mt76x0u_load_firmware(struct mt76x02_dev *dev) mt76_set(dev, MT_USB_DMA_CFG, (MT_USB_DMA_CFG_RX_BULK_EN | MT_USB_DMA_CFG_TX_BULK_EN) | FIELD_PREP(MT_USB_DMA_CFG_RX_BULK_AGG_TOUT, 0x20)); - mt76x02u_mcu_fw_reset(&dev->mt76); + mt76x02u_mcu_fw_reset(dev); usleep_range(5000, 6000); /* mt76x0_rmw(dev, MT_PBF_CFG, 0, (MT_PBF_CFG_TX0Q_EN | diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_usb.h b/drivers/net/wireless/mediatek/mt76/mt76x02_usb.h index 6b2138328eb2..28aabcfd1195 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x02_usb.h +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_usb.h @@ -17,11 +17,11 @@ #ifndef __MT76x02_USB_H #define __MT76x02_USB_H -#include "mt76.h" +#include "mt76x02.h" void mt76x02u_init_mcu(struct mt76_dev *dev); -void mt76x02u_mcu_fw_reset(struct mt76_dev *dev); -int mt76x02u_mcu_fw_send_data(struct mt76_dev *dev, const void *data, +void mt76x02u_mcu_fw_reset(struct mt76x02_dev *dev); +int mt76x02u_mcu_fw_send_data(struct mt76x02_dev *dev, const void *data, int data_len, u32 max_payload, u32 offset); int mt76x02u_skb_dma_info(struct sk_buff *skb, int port, u32 flags); diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_usb_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76x02_usb_mcu.c index cb5f073f08af..da299b8a1334 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x02_usb_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_usb_mcu.c @@ -17,8 +17,7 @@ #include #include -#include "mt76.h" -#include "mt76x02_dma.h" +#include "mt76x02.h" #include "mt76x02_mcu.h" #include "mt76x02_usb.h" @@ -255,16 +254,16 @@ mt76x02u_mcu_rd_rp(struct mt76_dev *dev, u32 base, return ret; } -void mt76x02u_mcu_fw_reset(struct mt76_dev *dev) +void mt76x02u_mcu_fw_reset(struct mt76x02_dev *dev) { - mt76u_vendor_request(dev, MT_VEND_DEV_MODE, + mt76u_vendor_request(&dev->mt76, MT_VEND_DEV_MODE, USB_DIR_OUT | USB_TYPE_VENDOR, 0x1, 0, NULL, 0); } EXPORT_SYMBOL_GPL(mt76x02u_mcu_fw_reset); static int -__mt76x02u_mcu_fw_send_data(struct mt76_dev *dev, struct mt76u_buf *buf, +__mt76x02u_mcu_fw_send_data(struct mt76x02_dev *dev, struct mt76u_buf *buf, const void *fw_data, int len, u32 dst_addr) { u8 *data = sg_virt(&buf->urb->sg[0]); @@ -281,14 +280,14 @@ __mt76x02u_mcu_fw_send_data(struct mt76_dev *dev, struct mt76u_buf *buf, memcpy(data + sizeof(info), fw_data, len); memset(data + sizeof(info) + len, 0, 4); - mt76u_single_wr(dev, MT_VEND_WRITE_FCE, + mt76u_single_wr(&dev->mt76, MT_VEND_WRITE_FCE, MT_FCE_DMA_ADDR, dst_addr); len = roundup(len, 4); - mt76u_single_wr(dev, MT_VEND_WRITE_FCE, + mt76u_single_wr(&dev->mt76, MT_VEND_WRITE_FCE, MT_FCE_DMA_LEN, len << 16); buf->len = MT_CMD_HDR_LEN + len + sizeof(info); - err = mt76u_submit_buf(dev, USB_DIR_OUT, + err = mt76u_submit_buf(&dev->mt76, USB_DIR_OUT, MT_EP_OUT_INBAND_CMD,
[PATCH 2/7] mt76: use mt76x02_dev instead of mt76_dev in mt76x02_phy.c
Use mt76x02_dev data structure as reference in mt76x02_phy.c instead of mt76_dev Signed-off-by: Lorenzo Bianconi --- .../net/wireless/mediatek/mt76/mt76x0/phy.c | 8 +- .../net/wireless/mediatek/mt76/mt76x02_phy.c | 89 +-- .../net/wireless/mediatek/mt76/mt76x02_phy.h | 8 +- .../wireless/mediatek/mt76/mt76x2/pci_phy.c | 2 +- .../net/wireless/mediatek/mt76/mt76x2/phy.c | 2 +- .../wireless/mediatek/mt76/mt76x2/usb_init.c | 4 +- .../wireless/mediatek/mt76/mt76x2/usb_phy.c | 2 +- 7 files changed, 56 insertions(+), 59 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c b/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c index d5fe248e7839..fdf1b3482fd0 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c @@ -618,7 +618,7 @@ void mt76x0_phy_set_txpower(struct mt76x02_dev *dev) dev->mt76.txpower_cur = mt76x02_get_max_rate_power(t); mt76x02_add_rate_power_offset(t, -info[0]); - mt76x02_phy_set_txpower(&dev->mt76, info[0], info[1]); + mt76x02_phy_set_txpower(dev, info[0], info[1]); } int mt76x0_phy_set_channel(struct mt76x02_dev *dev, @@ -815,7 +815,7 @@ static void mt76x0_dynamic_vga_tuning(struct mt76x02_dev *dev) int avg_rssi; init_vga = chandef->chan->band == NL80211_BAND_5GHZ ? 0x54 : 0x4E; - avg_rssi = mt76x02_phy_get_min_avg_rssi(&dev->mt76); + avg_rssi = mt76x02_phy_get_min_avg_rssi(dev); if (avg_rssi > -60) init_vga -= 0x20; else if (avg_rssi > -70) @@ -897,6 +897,6 @@ void mt76x0_phy_init(struct mt76x02_dev *dev) INIT_DELAYED_WORK(&dev->cal_work, mt76x0_phy_calibrate); mt76x0_rf_init(dev); - mt76x02_phy_set_rxpath(&dev->mt76); - mt76x02_phy_set_txdac(&dev->mt76); + mt76x02_phy_set_rxpath(dev); + mt76x02_phy_set_txdac(dev); } diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_phy.c b/drivers/net/wireless/mediatek/mt76/mt76x02_phy.c index d31ce1d7b689..c398471b6376 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x02_phy.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_phy.c @@ -17,18 +17,17 @@ #include -#include "mt76.h" +#include "mt76x02.h" #include "mt76x02_phy.h" -#include "mt76x02_mac.h" -void mt76x02_phy_set_rxpath(struct mt76_dev *dev) +void mt76x02_phy_set_rxpath(struct mt76x02_dev *dev) { u32 val; - val = __mt76_rr(dev, MT_BBP(AGC, 0)); + val = mt76_rr(dev, MT_BBP(AGC, 0)); val &= ~BIT(4); - switch (dev->chainmask & 0xf) { + switch (dev->mt76.chainmask & 0xf) { case 2: val |= BIT(3); break; @@ -37,23 +36,23 @@ void mt76x02_phy_set_rxpath(struct mt76_dev *dev) break; } - __mt76_wr(dev, MT_BBP(AGC, 0), val); + mt76_wr(dev, MT_BBP(AGC, 0), val); mb(); - val = __mt76_rr(dev, MT_BBP(AGC, 0)); + val = mt76_rr(dev, MT_BBP(AGC, 0)); } EXPORT_SYMBOL_GPL(mt76x02_phy_set_rxpath); -void mt76x02_phy_set_txdac(struct mt76_dev *dev) +void mt76x02_phy_set_txdac(struct mt76x02_dev *dev) { int txpath; - txpath = (dev->chainmask >> 8) & 0xf; + txpath = (dev->mt76.chainmask >> 8) & 0xf; switch (txpath) { case 2: - __mt76_set(dev, MT_BBP(TXBE, 5), 0x3); + mt76_set(dev, MT_BBP(TXBE, 5), 0x3); break; default: - __mt76_clear(dev, MT_BBP(TXBE, 5), 0x3); + mt76_clear(dev, MT_BBP(TXBE, 5), 0x3); break; } } @@ -102,40 +101,38 @@ void mt76x02_add_rate_power_offset(struct mt76_rate_power *r, int offset) } EXPORT_SYMBOL_GPL(mt76x02_add_rate_power_offset); -void mt76x02_phy_set_txpower(struct mt76_dev *dev, int txp_0, int txp_1) +void mt76x02_phy_set_txpower(struct mt76x02_dev *dev, int txp_0, int txp_1) { - struct mt76_rate_power *t = &dev->rate_power; - - __mt76_rmw_field(dev, MT_TX_ALC_CFG_0, MT_TX_ALC_CFG_0_CH_INIT_0, -txp_0); - __mt76_rmw_field(dev, MT_TX_ALC_CFG_0, MT_TX_ALC_CFG_0_CH_INIT_1, -txp_1); - - __mt76_wr(dev, MT_TX_PWR_CFG_0, - mt76x02_tx_power_mask(t->cck[0], t->cck[2], t->ofdm[0], - t->ofdm[2])); - __mt76_wr(dev, MT_TX_PWR_CFG_1, - mt76x02_tx_power_mask(t->ofdm[4], t->ofdm[6], t->ht[0], - t->ht[2])); - __mt76_wr(dev, MT_TX_PWR_CFG_2, - mt76x02_tx_power_mask(t->ht[4], t->ht[6], t->ht[8], - t->ht[10])); - __mt76_wr(dev, MT_TX_PWR_CFG_3, - mt76x02_tx_power_mask(t->ht[12], t->ht[14], t->stbc[0], - t->stbc[2])); - __mt76_wr(dev, MT_TX_PWR_CFG_4, - mt76x02_tx_power_mask(t->stbc[4], t->stbc[6], 0, 0)); - __mt76_wr(dev,
[PATCH 0/7] use mt76x02_dev instead of mt76_dev as reference
Use mt76x02_dev data structure as reference in mt76x02 code instead of mt76_dev one Lorenzo Bianconi (7): mt76: use mt76x02_dev instead of mt76_dev in mt76x02_mcu.c mt76: use mt76x02_dev instead of mt76_dev in mt76x02_phy.c mt76: use mt76x02_dev instead of mt76_dev in mt76x02_util.c mt76: use mt76x02_dev instead of mt76_dev in mt76x02_usb_mcu.c mt76: use mt76x02_dev instead of mt76_dev in mt76x02_mac.c mt76: use mt76x02_dev instead of mt76_dev in mt76x02_txrx.c mt76: use mt76x02_dev instead of mt76_dev in mt76x02_eeprom.c .../wireless/mediatek/mt76/mt76x0/eeprom.c| 53 --- .../net/wireless/mediatek/mt76/mt76x0/init.c | 4 +- .../net/wireless/mediatek/mt76/mt76x0/pci.c | 4 +- .../net/wireless/mediatek/mt76/mt76x0/phy.c | 34 +++-- .../wireless/mediatek/mt76/mt76x0/usb_mcu.c | 7 +- drivers/net/wireless/mediatek/mt76/mt76x02.h | 13 +- .../wireless/mediatek/mt76/mt76x02_eeprom.c | 33 ++--- .../wireless/mediatek/mt76/mt76x02_eeprom.h | 20 +-- .../net/wireless/mediatek/mt76/mt76x02_mac.c | 129 +- .../net/wireless/mediatek/mt76/mt76x02_mac.h | 31 +++-- .../net/wireless/mediatek/mt76/mt76x02_mcu.c | 74 +- .../net/wireless/mediatek/mt76/mt76x02_mcu.h | 14 +- .../net/wireless/mediatek/mt76/mt76x02_mmio.c | 2 +- .../net/wireless/mediatek/mt76/mt76x02_phy.c | 89 ++-- .../net/wireless/mediatek/mt76/mt76x02_phy.h | 8 +- .../net/wireless/mediatek/mt76/mt76x02_txrx.c | 29 ++-- .../net/wireless/mediatek/mt76/mt76x02_usb.h | 8 +- .../wireless/mediatek/mt76/mt76x02_usb_core.c | 3 +- .../wireless/mediatek/mt76/mt76x02_usb_mcu.c | 27 ++-- .../net/wireless/mediatek/mt76/mt76x02_util.c | 120 .../wireless/mediatek/mt76/mt76x2/eeprom.c| 80 +-- .../wireless/mediatek/mt76/mt76x2/eeprom.h| 2 +- .../net/wireless/mediatek/mt76/mt76x2/mcu.c | 5 +- .../wireless/mediatek/mt76/mt76x2/pci_init.c | 18 +-- .../wireless/mediatek/mt76/mt76x2/pci_mac.c | 2 +- .../wireless/mediatek/mt76/mt76x2/pci_main.c | 2 +- .../wireless/mediatek/mt76/mt76x2/pci_mcu.c | 6 +- .../wireless/mediatek/mt76/mt76x2/pci_phy.c | 32 ++--- .../net/wireless/mediatek/mt76/mt76x2/phy.c | 17 ++- .../wireless/mediatek/mt76/mt76x2/usb_init.c | 11 +- .../wireless/mediatek/mt76/mt76x2/usb_mac.c | 6 +- .../wireless/mediatek/mt76/mt76x2/usb_main.c | 4 +- .../wireless/mediatek/mt76/mt76x2/usb_mcu.c | 18 ++- .../wireless/mediatek/mt76/mt76x2/usb_phy.c | 28 ++-- 34 files changed, 456 insertions(+), 477 deletions(-) -- 2.19.0
[PATCH 6/7] mt76: use mt76x02_dev instead of mt76_dev in mt76x02_txrx.c
Use mt76x02_dev data structure as reference in mt76x02_txrx.c instead of mt76_dev Signed-off-by: Lorenzo Bianconi --- drivers/net/wireless/mediatek/mt76/mt76x02.h | 5 +++-- .../net/wireless/mediatek/mt76/mt76x02_mac.c | 5 ++--- .../net/wireless/mediatek/mt76/mt76x02_txrx.c | 22 +-- .../net/wireless/mediatek/mt76/mt76x02_util.c | 2 +- 4 files changed, 16 insertions(+), 18 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02.h b/drivers/net/wireless/mediatek/mt76/mt76x02.h index 30a9790793d3..e78708d55baf 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x02.h +++ b/drivers/net/wireless/mediatek/mt76/mt76x02.h @@ -136,9 +136,10 @@ 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); -s8 mt76x02_tx_get_max_txpwr_adj(struct mt76_dev *dev, +s8 mt76x02_tx_get_max_txpwr_adj(struct mt76x02_dev *dev, const struct ieee80211_tx_rate *rate); -s8 mt76x02_tx_get_txpwr_adj(struct mt76_dev *mdev, s8 txpwr, s8 max_txpwr_adj); +s8 mt76x02_tx_get_txpwr_adj(struct mt76x02_dev *dev, s8 txpwr, + s8 max_txpwr_adj); void mt76x02_tx_set_txpwr_auto(struct mt76x02_dev *dev, s8 txpwr); int mt76x02_insert_hdr_pad(struct sk_buff *skb); void mt76x02_remove_hdr_pad(struct sk_buff *skb, int len); diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c index e217dcec28d9..69132b971c30 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c @@ -382,12 +382,11 @@ void mt76x02_mac_write_txwi(struct mt76x02_dev *dev, struct mt76x02_txwi *txwi, nss = wcid->tx_rate_nss; } else { txwi->rate = mt76x02_mac_tx_rate_val(dev, rate, &nss); - max_txpwr_adj = mt76x02_tx_get_max_txpwr_adj(&dev->mt76, rate); + max_txpwr_adj = mt76x02_tx_get_max_txpwr_adj(dev, rate); } spin_unlock_bh(&dev->mt76.lock); - txpwr_adj = mt76x02_tx_get_txpwr_adj(&dev->mt76, -dev->mt76.txpower_conf, + txpwr_adj = mt76x02_tx_get_txpwr_adj(dev, dev->mt76.txpower_conf, max_txpwr_adj); txwi->ctl2 = FIELD_PREP(MT_TX_PWR_ADJ, txpwr_adj); diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_txrx.c b/drivers/net/wireless/mediatek/mt76/mt76x02_txrx.c index 865fa1b84086..d3de08872d6e 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x02_txrx.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_txrx.c @@ -71,7 +71,7 @@ void mt76x02_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q, } EXPORT_SYMBOL_GPL(mt76x02_queue_rx_skb); -s8 mt76x02_tx_get_max_txpwr_adj(struct mt76_dev *dev, +s8 mt76x02_tx_get_max_txpwr_adj(struct mt76x02_dev *dev, const struct ieee80211_tx_rate *rate) { s8 max_txpwr; @@ -80,23 +80,23 @@ s8 mt76x02_tx_get_max_txpwr_adj(struct mt76_dev *dev, u8 mcs = ieee80211_rate_get_vht_mcs(rate); if (mcs == 8 || mcs == 9) { - max_txpwr = dev->rate_power.vht[8]; + max_txpwr = dev->mt76.rate_power.vht[8]; } else { u8 nss, idx; nss = ieee80211_rate_get_vht_nss(rate); idx = ((nss - 1) << 3) + mcs; - max_txpwr = dev->rate_power.ht[idx & 0xf]; + max_txpwr = dev->mt76.rate_power.ht[idx & 0xf]; } } else if (rate->flags & IEEE80211_TX_RC_MCS) { - max_txpwr = dev->rate_power.ht[rate->idx & 0xf]; + max_txpwr = dev->mt76.rate_power.ht[rate->idx & 0xf]; } else { - enum nl80211_band band = dev->chandef.chan->band; + enum nl80211_band band = dev->mt76.chandef.chan->band; if (band == NL80211_BAND_2GHZ) { const struct ieee80211_rate *r; - struct wiphy *wiphy = dev->hw->wiphy; - struct mt76_rate_power *rp = &dev->rate_power; + struct wiphy *wiphy = dev->mt76.hw->wiphy; + struct mt76_rate_power *rp = &dev->mt76.rate_power; r = &wiphy->bands[band]->bitrates[rate->idx]; if (r->flags & IEEE80211_RATE_SHORT_PREAMBLE) @@ -104,7 +104,7 @@ s8 mt76x02_tx_get_max_txpwr_adj(struct mt76_dev *dev, else max_txpwr = rp->ofdm[r->hw_value & 0x7]; } else { - max_txpwr = dev->rate_power.ofdm[rate->idx & 0x7]; + max_txpwr = dev->mt76.rate_power.ofdm[rate->idx & 0x7];
[PATCH 1/7] mt76: use mt76x02_dev instead of mt76_dev in mt76x02_mcu.c
Use mt76x02_dev data structure as reference in mt76x02_mcu.c instead of mt76_dev Signed-off-by: Lorenzo Bianconi --- .../net/wireless/mediatek/mt76/mt76x0/init.c | 2 +- .../net/wireless/mediatek/mt76/mt76x0/pci.c | 2 +- .../net/wireless/mediatek/mt76/mt76x0/phy.c | 24 +++--- .../net/wireless/mediatek/mt76/mt76x02_mcu.c | 74 +-- .../net/wireless/mediatek/mt76/mt76x02_mcu.h | 14 ++-- .../wireless/mediatek/mt76/mt76x2/pci_init.c | 4 +- .../wireless/mediatek/mt76/mt76x2/pci_mcu.c | 4 +- .../wireless/mediatek/mt76/mt76x2/pci_phy.c | 22 +++--- .../net/wireless/mediatek/mt76/mt76x2/phy.c | 3 +- .../wireless/mediatek/mt76/mt76x2/usb_init.c | 2 +- .../wireless/mediatek/mt76/mt76x2/usb_mcu.c | 7 +- .../wireless/mediatek/mt76/mt76x2/usb_phy.c | 20 +++-- 12 files changed, 86 insertions(+), 92 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/init.c b/drivers/net/wireless/mediatek/mt76/mt76x0/init.c index ee2b8e885608..abd8313f22e7 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x0/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/init.c @@ -280,7 +280,7 @@ int mt76x0_init_hardware(struct mt76x02_dev *dev) return -ETIMEDOUT; mt76x0_reset_csr_bbp(dev); - ret = mt76x02_mcu_function_select(&dev->mt76, Q_SELECT, 1, false); + ret = mt76x02_mcu_function_select(dev, Q_SELECT, 1, false); if (ret) return ret; diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/pci.c b/drivers/net/wireless/mediatek/mt76/mt76x0/pci.c index 87997cddf0d6..4b29cd52aa44 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x0/pci.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/pci.c @@ -167,7 +167,7 @@ static void mt76x0e_cleanup(struct mt76x02_dev *dev) mt76x0_chip_onoff(dev, false, false); mt76x0e_stop_hw(dev); mt76x02_dma_cleanup(dev); - mt76x02_mcu_cleanup(&dev->mt76); + mt76x02_mcu_cleanup(dev); } static void diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c b/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c index 4419c0078a6f..d5fe248e7839 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c @@ -602,7 +602,7 @@ mt76x0_bbp_set_bw(struct mt76x02_dev *dev, enum nl80211_chan_width width) return ; } - mt76x02_mcu_function_select(&dev->mt76, BW_SETTING, bw, false); + mt76x02_mcu_function_select(dev, BW_SETTING, bw, false); } void mt76x0_phy_set_txpower(struct mt76x02_dev *dev) @@ -712,7 +712,7 @@ int mt76x0_phy_set_channel(struct mt76x02_dev *dev, mt76x0_vco_cal(dev, channel); if (scan) - mt76x02_mcu_calibrate(&dev->mt76, MCU_CAL_RXDCOC, 1, false); + mt76x02_mcu_calibrate(dev, MCU_CAL_RXDCOC, 1, false); mt76x0_phy_set_txpower(dev); @@ -725,7 +725,7 @@ void mt76x0_phy_recalibrate_after_assoc(struct mt76x02_dev *dev) u8 channel = dev->mt76.chandef.chan->hw_value; int is_5ghz = (dev->mt76.chandef.chan->band == NL80211_BAND_5GHZ) ? 1 : 0; - mt76x02_mcu_calibrate(&dev->mt76, MCU_CAL_R, 0, false); + mt76x02_mcu_calibrate(dev, MCU_CAL_R, 0, false); mt76x0_vco_cal(dev, channel); @@ -737,22 +737,20 @@ void mt76x0_phy_recalibrate_after_assoc(struct mt76x02_dev *dev) reg_val &= 0xff7e; mt76_wr(dev, 0x2124, reg_val); - mt76x02_mcu_calibrate(&dev->mt76, MCU_CAL_RXDCOC, 0, false); + mt76x02_mcu_calibrate(dev, MCU_CAL_RXDCOC, 0, false); - mt76x02_mcu_calibrate(&dev->mt76, MCU_CAL_LC, is_5ghz, false); - mt76x02_mcu_calibrate(&dev->mt76, MCU_CAL_LOFT, is_5ghz, false); - mt76x02_mcu_calibrate(&dev->mt76, MCU_CAL_TXIQ, is_5ghz, false); - mt76x02_mcu_calibrate(&dev->mt76, MCU_CAL_TX_GROUP_DELAY, - is_5ghz, false); - mt76x02_mcu_calibrate(&dev->mt76, MCU_CAL_RXIQ, is_5ghz, false); - mt76x02_mcu_calibrate(&dev->mt76, MCU_CAL_RX_GROUP_DELAY, - is_5ghz, false); + mt76x02_mcu_calibrate(dev, MCU_CAL_LC, is_5ghz, false); + mt76x02_mcu_calibrate(dev, MCU_CAL_LOFT, is_5ghz, false); + mt76x02_mcu_calibrate(dev, MCU_CAL_TXIQ, is_5ghz, false); + mt76x02_mcu_calibrate(dev, MCU_CAL_TX_GROUP_DELAY, is_5ghz, false); + mt76x02_mcu_calibrate(dev, MCU_CAL_RXIQ, is_5ghz, false); + mt76x02_mcu_calibrate(dev, MCU_CAL_RX_GROUP_DELAY, is_5ghz, false); mt76_wr(dev, 0x2124, reg_val); mt76_wr(dev, MT_TX_ALC_CFG_0, tx_alc); msleep(100); - mt76x02_mcu_calibrate(&dev->mt76, MCU_CAL_RXDCOC, 1, false); + mt76x02_mcu_calibrate(dev, MCU_CAL_RXDCOC, 1, false); } void mt76x0_agc_save(struct mt76x02_dev *dev) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76x02_mcu.c index 6d565133b7af..1b853bb723fb 100644 --- a/drivers/net/wireless/mediatek/m
[PATCH 3/7] mt76: use mt76x02_dev instead of mt76_dev in mt76x02_util.c
Use mt76x02_dev data structure as reference in mt76x02_util.c instead of mt76_dev Signed-off-by: Lorenzo Bianconi --- .../net/wireless/mediatek/mt76/mt76x0/init.c | 2 +- drivers/net/wireless/mediatek/mt76/mt76x02.h | 6 +- .../net/wireless/mediatek/mt76/mt76x02_util.c | 138 +- .../wireless/mediatek/mt76/mt76x2/pci_init.c | 2 +- .../wireless/mediatek/mt76/mt76x2/usb_main.c | 2 +- 5 files changed, 77 insertions(+), 73 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/init.c b/drivers/net/wireless/mediatek/mt76/mt76x0/init.c index abd8313f22e7..578f1b34f0f1 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x0/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/init.c @@ -138,7 +138,7 @@ static void mt76x0_init_mac_registers(struct mt76x02_dev *dev) RANDOM_WRITE(dev, common_mac_reg_table); - mt76x02_set_beacon_offsets(&dev->mt76); + mt76x02_set_beacon_offsets(dev); /* Enable PBF and MAC clock SYS_CTRL[11:10] = 0x3 */ RANDOM_WRITE(dev, mt76x0_mac_reg_table); diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02.h b/drivers/net/wireless/mediatek/mt76/mt76x02.h index 65174817ebc4..724c46b137e8 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x02.h +++ b/drivers/net/wireless/mediatek/mt76/mt76x02.h @@ -119,8 +119,8 @@ int mt76x02_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 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); +void mt76x02_vif_init(struct mt76x02_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, @@ -156,7 +156,7 @@ int mt76x02_tx_prepare_skb(struct mt76_dev *mdev, void *txwi, u32 *tx_info); extern const u16 mt76x02_beacon_offsets[16]; -void mt76x02_set_beacon_offsets(struct mt76_dev *dev); +void mt76x02_set_beacon_offsets(struct mt76x02_dev *dev); void mt76x02_set_irq_mask(struct mt76x02_dev *dev, u32 clear, u32 set); void mt76x02_mac_start(struct mt76x02_dev *dev); diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c index 5851ab6b7e26..8263b785df5c 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c @@ -48,21 +48,21 @@ struct ieee80211_rate mt76x02_rates[] = { EXPORT_SYMBOL_GPL(mt76x02_rates); void mt76x02_configure_filter(struct ieee80211_hw *hw, -unsigned int changed_flags, -unsigned int *total_flags, u64 multicast) + unsigned int changed_flags, + unsigned int *total_flags, u64 multicast) { - struct mt76_dev *dev = hw->priv; + struct mt76x02_dev *dev = hw->priv; u32 flags = 0; #define MT76_FILTER(_flag, _hw) do { \ flags |= *total_flags & FIF_##_flag;\ - dev->rxfilter &= ~(_hw);\ - dev->rxfilter |= !(flags & FIF_##_flag) * (_hw);\ + dev->mt76.rxfilter &= ~(_hw); \ + dev->mt76.rxfilter |= !(flags & FIF_##_flag) * (_hw); \ } while (0) - mutex_lock(&dev->mutex); + mutex_lock(&dev->mt76.mutex); - dev->rxfilter &= ~MT_RX_FILTR_CFG_OTHER_BSS; + dev->mt76.rxfilter &= ~MT_RX_FILTR_CFG_OTHER_BSS; MT76_FILTER(FCSFAIL, MT_RX_FILTR_CFG_CRC_ERR); MT76_FILTER(PLCPFAIL, MT_RX_FILTR_CFG_PHY_ERR); @@ -75,25 +75,25 @@ void mt76x02_configure_filter(struct ieee80211_hw *hw, MT76_FILTER(PSPOLL, MT_RX_FILTR_CFG_PSPOLL); *total_flags = flags; - dev->bus->wr(dev, MT_RX_FILTR_CFG, dev->rxfilter); + mt76_wr(dev, MT_RX_FILTR_CFG, dev->mt76.rxfilter); - mutex_unlock(&dev->mutex); + mutex_unlock(&dev->mt76.mutex); } EXPORT_SYMBOL_GPL(mt76x02_configure_filter); int mt76x02_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - struct ieee80211_sta *sta) + struct ieee80211_sta *sta) { - struct mt76_dev *dev = hw->priv; - struct mt76x02_sta *msta = (struct mt76x02_sta *) sta->drv_priv; - struct mt76x02_vif *mvif = (struct mt76x02_vif *) vif->drv_priv; + struct mt76x02_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->mutex); + mutex_lock(&dev->mt76.mutex); - idx = mt76_wcid_alloc(dev->wcid_mask, ARRAY_
[PATCH 5/7] mt76: use mt76x02_dev instead of mt76_dev in mt76x02_mac.c
Use mt76x02_dev data structure as reference in mt76x02_mac.c instead of mt76_dev Signed-off-by: Lorenzo Bianconi --- .../wireless/mediatek/mt76/mt76x0/eeprom.c| 3 +- drivers/net/wireless/mediatek/mt76/mt76x02.h | 2 +- .../net/wireless/mediatek/mt76/mt76x02_mac.c | 132 +- .../net/wireless/mediatek/mt76/mt76x02_mac.h | 31 ++-- .../net/wireless/mediatek/mt76/mt76x02_mmio.c | 2 +- .../net/wireless/mediatek/mt76/mt76x02_txrx.c | 7 +- .../net/wireless/mediatek/mt76/mt76x02_usb.h | 2 +- .../wireless/mediatek/mt76/mt76x02_usb_core.c | 3 +- .../net/wireless/mediatek/mt76/mt76x02_util.c | 24 ++-- .../wireless/mediatek/mt76/mt76x2/pci_init.c | 6 +- .../wireless/mediatek/mt76/mt76x2/pci_mac.c | 2 +- .../wireless/mediatek/mt76/mt76x2/pci_main.c | 2 +- .../wireless/mediatek/mt76/mt76x2/usb_init.c | 3 +- .../wireless/mediatek/mt76/mt76x2/usb_main.c | 2 +- 14 files changed, 111 insertions(+), 110 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.c b/drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.c index 5735038c0e2d..bea1af7ffa73 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.c @@ -337,8 +337,7 @@ int mt76x0_eeprom_init(struct mt76x02_dev *dev) dev_info(dev->mt76.dev, "EEPROM ver:%02hhx fae:%02hhx\n", version, fae); - mt76x02_mac_setaddr(&dev->mt76, - dev->mt76.eeprom.data + MT_EE_MAC_ADDR); + mt76x02_mac_setaddr(dev, dev->mt76.eeprom.data + MT_EE_MAC_ADDR); mt76x0_set_chip_cap(dev); mt76x0_set_freq_offset(dev); mt76x0_set_temp_offset(dev); diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02.h b/drivers/net/wireless/mediatek/mt76/mt76x02.h index 724c46b137e8..30a9790793d3 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x02.h +++ b/drivers/net/wireless/mediatek/mt76/mt76x02.h @@ -143,7 +143,7 @@ void mt76x02_tx_set_txpwr_auto(struct mt76x02_dev *dev, s8 txpwr); int mt76x02_insert_hdr_pad(struct sk_buff *skb); void mt76x02_remove_hdr_pad(struct sk_buff *skb, int len); void mt76x02_tx_complete(struct mt76_dev *dev, struct sk_buff *skb); -bool mt76x02_tx_status_data(struct mt76_dev *dev, u8 *update); +bool mt76x02_tx_status_data(struct mt76_dev *mdev, u8 *update); void mt76x02_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q, struct sk_buff *skb); void mt76x02_rx_poll_complete(struct mt76_dev *mdev, enum mt76_rxq_id q); diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c index 244245418ebb..e217dcec28d9 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c @@ -45,8 +45,8 @@ mt76x02_mac_get_key_info(struct ieee80211_key_conf *key, u8 *key_data) } EXPORT_SYMBOL_GPL(mt76x02_mac_get_key_info); -int mt76x02_mac_shared_key_setup(struct mt76_dev *dev, u8 vif_idx, u8 key_idx, - struct ieee80211_key_conf *key) +int mt76x02_mac_shared_key_setup(struct mt76x02_dev *dev, u8 vif_idx, +u8 key_idx, struct ieee80211_key_conf *key) { enum mt76x02_cipher_type cipher; u8 key_data[32]; @@ -56,20 +56,20 @@ int mt76x02_mac_shared_key_setup(struct mt76_dev *dev, u8 vif_idx, u8 key_idx, if (cipher == MT_CIPHER_NONE && key) return -EOPNOTSUPP; - val = __mt76_rr(dev, MT_SKEY_MODE(vif_idx)); + val = mt76_rr(dev, MT_SKEY_MODE(vif_idx)); val &= ~(MT_SKEY_MODE_MASK << MT_SKEY_MODE_SHIFT(vif_idx, key_idx)); val |= cipher << MT_SKEY_MODE_SHIFT(vif_idx, key_idx); - __mt76_wr(dev, MT_SKEY_MODE(vif_idx), val); + mt76_wr(dev, MT_SKEY_MODE(vif_idx), val); - __mt76_wr_copy(dev, MT_SKEY(vif_idx, key_idx), key_data, - sizeof(key_data)); + mt76_wr_copy(dev, MT_SKEY(vif_idx, key_idx), key_data, +sizeof(key_data)); return 0; } EXPORT_SYMBOL_GPL(mt76x02_mac_shared_key_setup); -int mt76x02_mac_wcid_set_key(struct mt76_dev *dev, u8 idx, - struct ieee80211_key_conf *key) +int mt76x02_mac_wcid_set_key(struct mt76x02_dev *dev, u8 idx, +struct ieee80211_key_conf *key) { enum mt76x02_cipher_type cipher; u8 key_data[32]; @@ -79,25 +79,26 @@ int mt76x02_mac_wcid_set_key(struct mt76_dev *dev, u8 idx, if (cipher == MT_CIPHER_NONE && key) return -EOPNOTSUPP; - __mt76_wr_copy(dev, MT_WCID_KEY(idx), key_data, sizeof(key_data)); - __mt76_rmw_field(dev, MT_WCID_ATTR(idx), MT_WCID_ATTR_PKEY_MODE, cipher); + mt76_wr_copy(dev, MT_WCID_KEY(idx), key_data, sizeof(key_data)); + mt76_rmw_field(dev, MT_WCID_ATTR(idx), MT_WCID_ATTR_PKEY_MODE, cipher); memset(iv_data, 0, sizeof(iv_data)); if (key) { - _
[PATCH 7/7] mt76: use mt76x02_dev instead of mt76_dev in mt76x02_eeprom.c
Use mt76x02_dev data structure as reference in mt76x02_eeprom.c instead of mt76_dev Signed-off-by: Lorenzo Bianconi --- .../wireless/mediatek/mt76/mt76x0/eeprom.c| 50 ++-- .../net/wireless/mediatek/mt76/mt76x0/pci.c | 2 +- .../net/wireless/mediatek/mt76/mt76x0/phy.c | 2 +- .../wireless/mediatek/mt76/mt76x02_eeprom.c | 33 .../wireless/mediatek/mt76/mt76x02_eeprom.h | 20 ++--- .../wireless/mediatek/mt76/mt76x2/eeprom.c| 80 +-- .../wireless/mediatek/mt76/mt76x2/eeprom.h| 2 +- .../net/wireless/mediatek/mt76/mt76x2/mcu.c | 5 +- .../wireless/mediatek/mt76/mt76x2/pci_init.c | 6 +- .../wireless/mediatek/mt76/mt76x2/pci_mcu.c | 2 +- .../wireless/mediatek/mt76/mt76x2/pci_phy.c | 8 +- .../net/wireless/mediatek/mt76/mt76x2/phy.c | 12 +-- .../wireless/mediatek/mt76/mt76x2/usb_init.c | 2 +- .../wireless/mediatek/mt76/mt76x2/usb_mac.c | 6 +- .../wireless/mediatek/mt76/mt76x2/usb_phy.c | 6 +- 15 files changed, 112 insertions(+), 124 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.c b/drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.c index bea1af7ffa73..1defb072ccbf 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.c @@ -31,8 +31,8 @@ mt76x0_efuse_physical_size_check(struct mt76x02_dev *dev) int ret, i; u32 start = 0, end = 0, cnt_free; - ret = mt76x02_get_efuse_data(&dev->mt76, MT_EE_USAGE_MAP_START, -data, sizeof(data), MT_EE_PHYSICAL_READ); + ret = mt76x02_get_efuse_data(dev, MT_EE_USAGE_MAP_START, data, +sizeof(data), MT_EE_PHYSICAL_READ); if (ret) return ret; @@ -55,10 +55,10 @@ mt76x0_efuse_physical_size_check(struct mt76x02_dev *dev) static void mt76x0_set_chip_cap(struct mt76x02_dev *dev) { - u16 nic_conf0 = mt76x02_eeprom_get(&dev->mt76, MT_EE_NIC_CONF_0); - u16 nic_conf1 = mt76x02_eeprom_get(&dev->mt76, MT_EE_NIC_CONF_1); + u16 nic_conf0 = mt76x02_eeprom_get(dev, MT_EE_NIC_CONF_0); + u16 nic_conf1 = mt76x02_eeprom_get(dev, MT_EE_NIC_CONF_1); - mt76x02_eeprom_parse_hw_cap(&dev->mt76); + mt76x02_eeprom_parse_hw_cap(dev); dev_dbg(dev->mt76.dev, "2GHz %d 5GHz %d\n", dev->mt76.cap.has_2ghz, dev->mt76.cap.has_5ghz); @@ -86,7 +86,7 @@ static void mt76x0_set_temp_offset(struct mt76x02_dev *dev) { u8 val; - val = mt76x02_eeprom_get(&dev->mt76, MT_EE_2G_TARGET_POWER) >> 8; + val = mt76x02_eeprom_get(dev, MT_EE_2G_TARGET_POWER) >> 8; if (mt76x02_field_valid(val)) dev->cal.rx.temp_offset = mt76x02_sign_extend(val, 8); else @@ -98,12 +98,12 @@ static void mt76x0_set_freq_offset(struct mt76x02_dev *dev) struct mt76x02_rx_freq_cal *caldata = &dev->cal.rx; u8 val; - val = mt76x02_eeprom_get(&dev->mt76, MT_EE_FREQ_OFFSET); + val = mt76x02_eeprom_get(dev, MT_EE_FREQ_OFFSET); if (!mt76x02_field_valid(val)) val = 0; caldata->freq_offset = val; - val = mt76x02_eeprom_get(&dev->mt76, MT_EE_TSSI_BOUND4) >> 8; + val = mt76x02_eeprom_get(dev, MT_EE_TSSI_BOUND4) >> 8; if (!mt76x02_field_valid(val)) val = 0; @@ -118,10 +118,8 @@ void mt76x0_read_rx_gain(struct mt76x02_dev *dev) u16 rssi_offset; int i; - mt76x02_get_rx_gain(&dev->mt76, chan->band, &rssi_offset, - &lna_2g, lna_5g); - caldata->lna_gain = mt76x02_get_lna_gain(&dev->mt76, &lna_2g, -lna_5g, chan); + mt76x02_get_rx_gain(dev, chan->band, &rssi_offset, &lna_2g, lna_5g); + caldata->lna_gain = mt76x02_get_lna_gain(dev, &lna_2g, lna_5g, chan); for (i = 0; i < ARRAY_SIZE(caldata->rssi_offset); i++) { val = rssi_offset >> (8 * i); @@ -132,9 +130,9 @@ void mt76x0_read_rx_gain(struct mt76x02_dev *dev) } } -static s8 mt76x0_get_delta(struct mt76_dev *dev) +static s8 mt76x0_get_delta(struct mt76x02_dev *dev) { - struct cfg80211_chan_def *chandef = &dev->chandef; + struct cfg80211_chan_def *chandef = &dev->mt76.chandef; u8 val; if (mt76x02_tssi_enabled(dev)) @@ -162,54 +160,54 @@ void mt76x0_get_tx_power_per_rate(struct mt76x02_dev *dev) struct ieee80211_channel *chan = dev->mt76.chandef.chan; bool is_2ghz = chan->band == NL80211_BAND_2GHZ; struct mt76_rate_power *t = &dev->mt76.rate_power; - s8 delta = mt76x0_get_delta(&dev->mt76); + s8 delta = mt76x0_get_delta(dev); u16 val, addr; memset(t, 0, sizeof(*t)); /* cck 1M, 2M, 5.5M, 11M */ - val = mt76x02_eeprom_get(&dev->mt76, MT_EE_TX_POWER_BYRATE_BASE); + val = mt76x02_eeprom_get(dev, MT_EE_TX_POWER_BYRATE_BASE); t->cck[0] = t->cck[1] = s6_to_
[PATCH] mt76x0: phy: fix bank check in mt76x0_rf_csr_{wr,rr}
Fix typo in bank check in mt76x0_rf_csr_{wr,rr} routines. This issue has never been hit since mt76x0_rf_csr_{wr,rr} are actually used just by pci code Fixes: 10de7a8b4ab9 ("mt76x0: phy files") Signed-off-by: Lorenzo Bianconi --- drivers/net/wireless/mediatek/mt76/mt76x0/phy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c b/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c index e2b62ce2306b..4419c0078a6f 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c @@ -37,7 +37,7 @@ mt76x0_rf_csr_wr(struct mt76x02_dev *dev, u32 offset, u8 value) bank = MT_RF_BANK(offset); reg = MT_RF_REG(offset); - if (WARN_ON_ONCE(reg > 127) || WARN_ON_ONCE(bank) > 8) + if (WARN_ON_ONCE(reg > 127) || WARN_ON_ONCE(bank > 8)) return -EINVAL; mutex_lock(&dev->phy_mutex); @@ -76,7 +76,7 @@ static int mt76x0_rf_csr_rr(struct mt76x02_dev *dev, u32 offset) bank = MT_RF_BANK(offset); reg = MT_RF_REG(offset); - if (WARN_ON_ONCE(reg > 127) || WARN_ON_ONCE(bank) > 8) + if (WARN_ON_ONCE(reg > 127) || WARN_ON_ONCE(bank > 8)) return -EINVAL; mutex_lock(&dev->phy_mutex); -- 2.19.0
pull-request: wireless-drivers-next 2018-10-07
Hi Dave, another pull request to net-next for 4.20. I'm sending this a bit earlier than I prefer as I'm not sure if the merge window starts today or not. Not all of these patches have been in linux-next, and also the kbuild bot has been offline this week due to a service break, so there might be some build problems which I have missed. Though a local allmodconfig build with GCC 7.3.0 did work without problems. Kalle The following changes since commit 4e6d47206c32d1bbb4931f1d851dae3870e0df81: tls: Add support for inplace records encryption (2018-10-02 23:03:47 -0700) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git tags/wireless-drivers-next-for-davem-2018-10-07 for you to fetch changes up to 5580d810560da33804053ae3bca13110c9a8d5e8: Merge tag 'mt76-for-kvalo-2018-10-05' of https://github.com/nbd168/wireless (2018-10-06 14:22:47 +0300) wireless-drivers-next patches for 4.20 Second set of patches for 4.20. Heavy refactoring on mt76 continues and the usual drivers in active development (iwlwifi, qtnfmac, ath10k) getting new features. And as always, fixes and cleanup all over. Major changes: mt76 * more major refactoring to make it easier add new hardware support * more work on mt76x0e support * support for getting firmware version via ethtool * add mt7650 PCI ID iwlwifi * HE radiotap cleanup and improvements * reorder channel optimization for scans * bump the FW API version qtnfmac * fixes for 'iw' output: rates for enabled SGI, 'dump station' * expose more scan features to host: scan flush and dwell time * inform cfg80211 when OBSS is not supported by firmware wlcore * add support for optional wakeirq ath10k * retrieve MAC address from system firmware if provided * support extended board data download for dual-band QCA9984 * extended per sta tx statistics support via debugfs * average ack rssi support for data frames * speed up QCA6174 and QCA9377 firmware download using diag Copy Engine * HTT High Latency mode support needed by SDIO and USB support * get STA power save state via debugfs ath9k * add reset functionality for airtime station debugfs file Anilkumar Kolli (4): ath10k: get the legacy rate index to update the txrate table ath10k: add debugfs entry to enable extended tx stats ath10k: add extended per sta tx statistics support ath10k: add debugfs support to dump per sta tx stats Ayala Beker (1): iwlwifi: mvm: allow channel reorder optimization during scan Balaji Pothunoori (1): ath10k: average ack rssi support for data frames Ben Greear (1): ath10k: fix vdev-start timeout on error Brian Norris (3): ath10k: retrieve MAC address from system firmware if provided ath10k: utilize random MAC address if none is provided ath10k: add missing sanity check on diag download Carl Huang (3): ath10k: optimize pci diag mem read & write operations ath10k: support to access target space below 1M for qca6174 and qca9377 ath10k: download firmware via diag Copy Engine for QCA6174 and QCA9377. Chung-Hsien Hsu (2): brcmfmac: reduce timeout for action frame scan brcmfmac: fix full timeout waiting for action frame on-channel tx Colin Ian King (1): mt76: fix header guard macro define names Davide Caratti (1): mt76: report firmware version using ethtool Emmanuel Grumbach (1): iwlwifi: mvm: clear HW_RESTART_REQUESTED when stopping the interface Erik Stromdahl (14): ath10k: add struct ath10k_bus_params ath10k: add device type enum to ath10k_bus_params ath10k: add bus type check in ath10k_init_hw_params ath10k: use hw_params.num_peers for num_tids in TLV init ath10k: add per target config of max_num_peers ath10k: DMA related fixes for high latency devices ath10k: add HTT TX HL ops ath10k: add HTT RX HL ops ath10k: htt: RX ring config HL support ath10k: htt: High latency TX support ath10k: htt: High latency RX support ath10k: wmi: disable softirq's while calling ieee80211_rx ath10k: add default value for num_peers in WMI TLV init ath10k: remove num_peers in hw_params for most targets Felix Fietkau (7): mt76: add stbc entries to mt76_rate_power mt76: include linux/module.h in files using MODULE_* mt76x2: disable WLAN core before probe mt76: fix handling ps-poll frames mt76: check aggregation sequence number for frames sent via drv_tx mt76: mt76x2: fix multi-interface beacon configuration ath9k: add back support for using active monitor interfaces for tx99 Govind Singh (4): ath10k: introduce CE_ATTR_POLL attribute for polling pipe ath10k: enable pktlog for WCN3990 target ath10k: move napi_enable to hif_start for consistent pairing