* Re: [RFC/RFT] mac80211: Switch to a virtual time-based airtime scheduler
From: Yibo Zhao @ 2019-04-30 9:45 UTC (permalink / raw)
To: Toke Høiland-Jørgensen
Cc: make-wifi-fast, linux-wireless, Felix Fietkau, Rajkumar Manoharan,
Kan Yan, linux-wireless-owner
In-Reply-To: <87bm10ped0.fsf@toke.dk>
On 2019-04-21 05:15, Toke Høiland-Jørgensen wrote:
> Yibo Zhao <yiboz@codeaurora.org> writes:
>
>> On 2019-04-11 19:24, Toke Høiland-Jørgensen wrote:
>>> Yibo Zhao <yiboz@codeaurora.org> writes:
>>>
>>>> On 2019-04-10 18:40, Toke Høiland-Jørgensen wrote:
>>>>> Yibo Zhao <yiboz@codeaurora.org> writes:
>>>>>
>>>>>> On 2019-04-10 04:41, Toke Høiland-Jørgensen wrote:
>>>>>>> Yibo Zhao <yiboz@codeaurora.org> writes:
>>>>>>>
>>>>>>>> On 2019-04-04 16:31, Toke Høiland-Jørgensen wrote:
>>>>>>>>> Yibo Zhao <yiboz@codeaurora.org> writes:
>>>>>>>>>
>>>>>>>>>> On 2019-02-16 01:05, Toke Høiland-Jørgensen wrote:
>>>>>>>>>>> This switches the airtime scheduler in mac80211 to use a
>>>>>>>>>>> virtual
>>>>>>>>>>> time-based
>>>>>>>>>>> scheduler instead of the round-robin scheduler used before.
>>>>>>>>>>> This
>>>>>>>>>>> has
>>>>>>>>>>> a
>>>>>>>>>>> couple of advantages:
>>>>>>>>>>>
>>>>>>>>>>> - No need to sync up the round-robin scheduler in
>>>>>>>>>>> firmware/hardware
>>>>>>>>>>> with
>>>>>>>>>>> the round-robin airtime scheduler.
>>>>>>>>>>>
>>>>>>>>>>> - If several stations are eligible for transmission we can
>>>>>>>>>>> schedule
>>>>>>>>>>> both of
>>>>>>>>>>> them; no need to hard-block the scheduling rotation until
>>>>>>>>>>> the
>>>>>>>>>>> head
>>>>>>>>>>> of
>>>>>>>>>>> the
>>>>>>>>>>> queue has used up its quantum.
>>>>>>>>>>>
>>>>>>>>>>> - The check of whether a station is eligible for transmission
>>>>>>>>>>> becomes
>>>>>>>>>>> simpler (in ieee80211_txq_may_transmit()).
>>>>>>>>>>>
>>>>>>>>>>> The drawback is that scheduling becomes slightly more
>>>>>>>>>>> expensive,
>>>>>>>>>>> as
>>>>>>>>>>> we
>>>>>>>>>>> need
>>>>>>>>>>> to maintain an rbtree of TXQs sorted by virtual time. This
>>>>>>>>>>> means
>>>>>>>>>>> that
>>>>>>>>>>> ieee80211_register_airtime() becomes O(logN) in the number of
>>>>>>>>>>> currently
>>>>>>>>>>> scheduled TXQs. However, hopefully this number rarely grows
>>>>>>>>>>> too
>>>>>>>>>>> big
>>>>>>>>>>> (it's
>>>>>>>>>>> only TXQs currently backlogged, not all associated stations),
>>>>>>>>>>> so
>>>>>>>>>>> it
>>>>>>>>>>> shouldn't be too big of an issue.
>>>>>>>>>>>
>>>>>>>>>>> @@ -1831,18 +1830,32 @@ void
>>>>>>>>>>> ieee80211_sta_register_airtime(struct
>>>>>>>>>>> ieee80211_sta *pubsta, u8 tid,
>>>>>>>>>>> {
>>>>>>>>>>> struct sta_info *sta = container_of(pubsta, struct
>>>>>>>>>>> sta_info,
>>>>>>>>>>> sta);
>>>>>>>>>>> struct ieee80211_local *local = sta->sdata->local;
>>>>>>>>>>> + struct ieee80211_txq *txq = sta->sta.txq[tid];
>>>>>>>>>>> u8 ac = ieee80211_ac_from_tid(tid);
>>>>>>>>>>> - u32 airtime = 0;
>>>>>>>>>>> + u64 airtime = 0, weight_sum;
>>>>>>>>>>> +
>>>>>>>>>>> + if (!txq)
>>>>>>>>>>> + return;
>>>>>>>>>>>
>>>>>>>>>>> if (sta->local->airtime_flags & AIRTIME_USE_TX)
>>>>>>>>>>> airtime += tx_airtime;
>>>>>>>>>>> if (sta->local->airtime_flags & AIRTIME_USE_RX)
>>>>>>>>>>> airtime += rx_airtime;
>>>>>>>>>>>
>>>>>>>>>>> + /* Weights scale so the unit weight is 256 */
>>>>>>>>>>> + airtime <<= 8;
>>>>>>>>>>> +
>>>>>>>>>>> spin_lock_bh(&local->active_txq_lock[ac]);
>>>>>>>>>>> +
>>>>>>>>>>> sta->airtime[ac].tx_airtime += tx_airtime;
>>>>>>>>>>> sta->airtime[ac].rx_airtime += rx_airtime;
>>>>>>>>>>> - sta->airtime[ac].deficit -= airtime;
>>>>>>>>>>> +
>>>>>>>>>>> + weight_sum = local->airtime_weight_sum[ac] ?:
>>>>>>>>>>> sta->airtime_weight;
>>>>>>>>>>> +
>>>>>>>>>>> + local->airtime_v_t[ac] += airtime / weight_sum;
>> Hi Toke,
>>
>> I was porting this version of ATF design to my ath10k platform and
>> found
>> my old kernel version not supporting 64bit division. I'm wondering if
>> it
>> is necessary to use u64 for airtime and weight_sum here though I can
>> find a solution for it. I think u32 might be enough. For airtime,
>> u32_max / 256 = 7182219 us(718 ms). As for weight_sum, u32_max / 8092
>> us
>> = 130490, meaning we can support more than 130000 nodes with airtime
>> weight 8092 us.
>
> As Felix said, we don't really want divides in the fast path at all.
> And
> since the divisors are constant, we should be able to just pre-compute
> reciprocals and turn the whole thing into multiplications...
>
>> Another finding was when I configured two 11ac STAs with different
>> airtime weight, such as 256 and 1024 meaning ratio is 1:4, the
>> throughput ratio was not roughly matching the ratio. Could you please
>> share your results? I am not sure if it is due to platform difference.
>
> Hmm, I tested them with ath9k where things seemed to work equivalently
> to the DRR. Are you testing the same hardware with that? Would be a
> good
> baseline.
>
> I am on vacation until the end of the month, but can share my actual
> test results once I get back...
Hi Toke,
I saw your commit in hostapd in
http://patchwork.ozlabs.org/patch/1059334/
For dynamic and limit mode described in above hostapd patch, do I need
to change any code in this kernel patch or any other patches am I
missing?
After a quick look at the hostapd patch, I guess all the efforts for
both modes are done in hostapd. Correct me if I am wrong. :)
>
> -Toke
--
Yibo
^ permalink raw reply
* Re: [PATCH] ath10k: add peer id check in ath10k_peer_find_by_id
From: Kalle Valo @ 2019-04-30 9:36 UTC (permalink / raw)
To: Nicolas Boichat; +Cc: Wen Gong, Claire Chang, linux-wireless, ath10k
In-Reply-To: <CANMq1KAU1B4Bweq3O6O8HOMwT7fHjj9tDyxqMsn_vn4gwxXL=Q@mail.gmail.com>
Nicolas Boichat <drinkcat@chromium.org> writes:
> On Wed, Apr 3, 2019 at 3:01 AM Wen Gong <wgong@codeaurora.org> wrote:
>>
>> For some SDIO chip, the peer id is 65535 for MPDU with error status,
>> then test_bit will trigger buffer overflow for peer's memory, if kasan
>> enabled, it will report error.
>>
>> Add check for overflow the size of peer's peer_ids will avoid the buffer
>> overflow access.
>>
[...]
>> --- a/drivers/net/wireless/ath/ath10k/txrx.c
>> +++ b/drivers/net/wireless/ath/ath10k/txrx.c
>> @@ -157,6 +157,9 @@ struct ath10k_peer *ath10k_peer_find_by_id(struct ath10k *ar, int peer_id)
>> {
>> struct ath10k_peer *peer;
>>
>> + if (peer_id >= sizeof(peer->peer_ids) * BITS_PER_BYTE)
>
> I'd use >= BITS_PER_TYPE(peer->peer_ids).
Nice, I didn't know about that. Wen, please submit v2 using this.
--
Kalle Valo
^ permalink raw reply
* Re: [PATCH v2 5/5] mt76: mt7603: enable/disable pre_tbtt_tasklet in mt7603_set_channel
From: Felix Fietkau @ 2019-04-30 9:34 UTC (permalink / raw)
To: Lorenzo Bianconi; +Cc: lorenzo.bianconi, linux-wireless, sgruszka
In-Reply-To: <ad6f286f30e8d9080320164a5551c2ee37bd6a95.1556525110.git.lorenzo@kernel.org>
On 2019-04-29 10:13, Lorenzo Bianconi wrote:
> Disable pre_tbtt_tasklet tasklet before setting the operating channel.
> Enable/disable beacon_timer in mt7603_set_channel
>
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
This doesn't seem right to me - I don't think we should send beacons
while off-channel.
- Felix
^ permalink raw reply
* Re: [PATCH v2] mt76: mt7615: add TX/RX antenna pattern capabilities
From: Felix Fietkau @ 2019-04-30 9:24 UTC (permalink / raw)
To: Ryder Lee, Lorenzo Bianconi
Cc: Roy Luo, YF Luo, Yiwei Chung, Sean Wang, linux-wireless,
linux-mediatek, linux-kernel
In-Reply-To: <4f7160cb9f52335ce15fccac087fec25e7650884.1556255852.git.ryder.lee@mediatek.com>
On 2019-04-26 07:23, Ryder Lee wrote:
> Announce antenna pattern cap to adapt PHY and baseband settings.
>
> Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
> ---
> Changes since v2:
> - Add a prefix mt76 in the title.
> ---
> drivers/net/wireless/mediatek/mt76/mt7615/init.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/init.c b/drivers/net/wireless/mediatek/mt76/mt7615/init.c
> index 3ab3ff553ef2..122f7a565540 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7615/init.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7615/init.c
> @@ -190,6 +190,8 @@ int mt7615_register_device(struct mt7615_dev *dev)
> IEEE80211_VHT_CAP_SHORT_GI_160 |
> IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 |
> IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK |
> + IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN |
> + IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN |
If I read the standard correctly, these flags indicate that the rx/tx
antenna pattern does NOT change during association.
Doesn't that mean that we should set it in mac80211.c instead, so that
it also applies to MT76x2?
Thanks,
- Felix
^ permalink raw reply
* Re: [PATCH V2 1/3] mac80211: dynamically enable the TWT requester support on STA interfaces
From: Kalle Valo @ 2019-04-30 9:11 UTC (permalink / raw)
To: John Crispin; +Cc: Johannes Berg, linux-wireless, Shashidhar Lakkavalli
In-Reply-To: <20190430070338.4006-2-john@phrozen.org>
John Crispin <john@phrozen.org> writes:
> Turn TWT for STA interfaces when they associate and/or receive a
> beacon where the twt_responder bit has changed.
>
> Signed-off-by: Shashidhar Lakkavalli <slakkavalli@datto.com>
> Signed-off-by: John Crispin <john@phrozen.org>
Nothing important, but nowadays we have Co-developed-by which is a nice
way to document multiple authors (I'm assuming that's the case here):
https://www.kernel.org/doc/html/latest/process/submitting-patches.html#when-to-use-acked-by-cc-and-co-developed-by
--
Kalle Valo
^ permalink raw reply
* Re: [PATCH] brcmfmac: change the order of things in brcmf_detach()
From: Piotr Figiel @ 2019-04-30 8:11 UTC (permalink / raw)
To: Arend van Spriel; +Cc: Rafał Miłecki, linux-wireless@vger.kernel.org
In-Reply-To: <1556532561-24428-1-git-send-email-arend.vanspriel@broadcom.com>
Hi Arend,
On Mon, Apr 29, 2019 at 12:09:21PM +0200, Arend van Spriel wrote:
> When brcmf_detach() from the bus layer upon rmmod we can no longer
> communicate. Hence we will set the bus state to DOWN and cleanup
> the event and protocol layer. The network interfaces need to be
> deleted before brcmf_cfg80211_detach() because the latter does the
> wiphy_unregister() which issues a warning if there are still network
> devices linked to the wiphy instance.
This seems to already happen - brcmf_cfg80211_detach() is called after the
interfaces are removed.
> This change solves a null pointer dereference issue which happened
> upon issueing rmmod while there are packets queued in bus protocol
> layer.
>
> Reported-by: Rafał Miłecki <rafal@milecki.pl>
> Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
> Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
> Reviewed-by: Franky Lin <franky.lin@broadcom.com>
> Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
> ---
> Hi Piotr,
>
> While working on an issue with msgbuf protocol (used for PCIe devices)
> your change 5cdb0ef6144f ("brcmfmac: fix NULL pointer derefence during
> USB disconnect") conflicted. I suspect my reordering stuff in
> brcmf_detach() also fixes your issue so could you retest this patch,
> which basically reverts your change and applies my reordering, and see
> whether my suspicion can be confirmed.
Does the issue reported by Rafał you are trying to solve with this patch occur
on current linux-next?
Best regards,
--
Piotr Figiel
^ permalink raw reply
* [PATCH v2] mt76: usb: use EP max packet aligned buffer sizes for rx
From: Stanislaw Gruszka @ 2019-04-30 8:10 UTC (permalink / raw)
To: linux-wireless; +Cc: Felix Fietkau, Lorenzo Bianconi
If buffer size is not usb_endpoint_maxp (512 or 1024 bytes) multiple,
usb host driver has to use bounce buffer and copy data. For RX we can
avoid that since we alreay allocate q->buf_size (2kB) buffers and
mt76usb hardware will not fill more data as rx packet size is limited
by network protocol. However add error message if this assumption
somehow will be not true.
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
v2: use dev_err_ratelimited
drivers/net/wireless/mediatek/mt76/usb.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/usb.c b/drivers/net/wireless/mediatek/mt76/usb.c
index c299c6591072..bbaa1365bbda 100644
--- a/drivers/net/wireless/mediatek/mt76/usb.c
+++ b/drivers/net/wireless/mediatek/mt76/usb.c
@@ -286,7 +286,6 @@ static int
mt76u_fill_rx_sg(struct mt76_dev *dev, struct mt76_queue *q, struct urb *urb,
int nsgs, gfp_t gfp)
{
- int sglen = SKB_WITH_OVERHEAD(q->buf_size);
int i;
for (i = 0; i < nsgs; i++) {
@@ -300,7 +299,7 @@ mt76u_fill_rx_sg(struct mt76_dev *dev, struct mt76_queue *q, struct urb *urb,
page = virt_to_head_page(data);
offset = data - page_address(page);
- sg_set_page(&urb->sg[i], page, sglen, offset);
+ sg_set_page(&urb->sg[i], page, q->buf_size, offset);
}
if (i < nsgs) {
@@ -312,7 +311,7 @@ mt76u_fill_rx_sg(struct mt76_dev *dev, struct mt76_queue *q, struct urb *urb,
}
urb->num_sgs = max_t(int, i, urb->num_sgs);
- urb->transfer_buffer_length = urb->num_sgs * sglen,
+ urb->transfer_buffer_length = urb->num_sgs * q->buf_size,
sg_init_marker(urb->sg, urb->num_sgs);
return i ? : -ENOMEM;
@@ -326,7 +325,7 @@ mt76u_refill_rx(struct mt76_dev *dev, struct urb *urb, int nsgs, gfp_t gfp)
if (dev->usb.sg_en) {
return mt76u_fill_rx_sg(dev, q, urb, nsgs, gfp);
} else {
- urb->transfer_buffer_length = SKB_WITH_OVERHEAD(q->buf_size);
+ urb->transfer_buffer_length = q->buf_size;
urb->transfer_buffer = page_frag_alloc(&q->rx_page,
q->buf_size, gfp);
return urb->transfer_buffer ? 0 : -ENOMEM;
@@ -447,8 +446,10 @@ mt76u_process_rx_entry(struct mt76_dev *dev, struct urb *urb)
return 0;
data_len = min_t(int, len, data_len - MT_DMA_HDR_LEN);
- if (MT_DMA_HDR_LEN + data_len > SKB_WITH_OVERHEAD(q->buf_size))
+ if (MT_DMA_HDR_LEN + data_len > SKB_WITH_OVERHEAD(q->buf_size)) {
+ dev_err_ratelimited(dev->dev, "rx data too big %d\n", data_len);
return 0;
+ }
skb = build_skb(data, q->buf_size);
if (!skb)
--
2.20.1
^ permalink raw reply related
* Re: [PATCH] mt76: usb: use EP max packet aligned buffer sizes for rx
From: Felix Fietkau @ 2019-04-30 7:59 UTC (permalink / raw)
To: Stanislaw Gruszka, linux-wireless; +Cc: Lorenzo Bianconi
In-Reply-To: <20190430074219.8495-1-sgruszka@redhat.com>
On 2019-04-30 09:42, Stanislaw Gruszka wrote:
> If buffer size is not usb_endpoint_maxp (512 or 1024 bytes) multiple,
> usb host driver has to use bounce buffer and copy data. For RX we can
> avoid that since we alreay allocate q->buf_size (2kB) buffers and
> mt76usb hardware will not fill more data as rx packet size is limited
> by network protocol. However add error message if this assumption
> somehow will be not true.
>
> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
> ---
> drivers/net/wireless/mediatek/mt76/usb.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/wireless/mediatek/mt76/usb.c b/drivers/net/wireless/mediatek/mt76/usb.c
> index c299c6591072..025e072cff28 100644
> --- a/drivers/net/wireless/mediatek/mt76/usb.c
> +++ b/drivers/net/wireless/mediatek/mt76/usb.c
> @@ -447,8 +446,10 @@ mt76u_process_rx_entry(struct mt76_dev *dev, struct urb *urb)
> return 0;
>
> data_len = min_t(int, len, data_len - MT_DMA_HDR_LEN);
> - if (MT_DMA_HDR_LEN + data_len > SKB_WITH_OVERHEAD(q->buf_size))
> + if (MT_DMA_HDR_LEN + data_len > SKB_WITH_OVERHEAD(q->buf_size)) {
> + dev_err(dev->dev, "rx data too big %d\n", data_len);
Please use WARN_ON_ONCE here, or at least dev_err_ratelimited if you
think it's necessary to print data_len.
- Felix
^ permalink raw reply
* [PATCH] mt76: usb: use EP max packet aligned buffer sizes for rx
From: Stanislaw Gruszka @ 2019-04-30 7:42 UTC (permalink / raw)
To: linux-wireless; +Cc: Felix Fietkau, Lorenzo Bianconi
If buffer size is not usb_endpoint_maxp (512 or 1024 bytes) multiple,
usb host driver has to use bounce buffer and copy data. For RX we can
avoid that since we alreay allocate q->buf_size (2kB) buffers and
mt76usb hardware will not fill more data as rx packet size is limited
by network protocol. However add error message if this assumption
somehow will be not true.
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
drivers/net/wireless/mediatek/mt76/usb.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/usb.c b/drivers/net/wireless/mediatek/mt76/usb.c
index c299c6591072..025e072cff28 100644
--- a/drivers/net/wireless/mediatek/mt76/usb.c
+++ b/drivers/net/wireless/mediatek/mt76/usb.c
@@ -286,7 +286,6 @@ static int
mt76u_fill_rx_sg(struct mt76_dev *dev, struct mt76_queue *q, struct urb *urb,
int nsgs, gfp_t gfp)
{
- int sglen = SKB_WITH_OVERHEAD(q->buf_size);
int i;
for (i = 0; i < nsgs; i++) {
@@ -300,7 +299,7 @@ mt76u_fill_rx_sg(struct mt76_dev *dev, struct mt76_queue *q, struct urb *urb,
page = virt_to_head_page(data);
offset = data - page_address(page);
- sg_set_page(&urb->sg[i], page, sglen, offset);
+ sg_set_page(&urb->sg[i], page, q->buf_size, offset);
}
if (i < nsgs) {
@@ -312,7 +311,7 @@ mt76u_fill_rx_sg(struct mt76_dev *dev, struct mt76_queue *q, struct urb *urb,
}
urb->num_sgs = max_t(int, i, urb->num_sgs);
- urb->transfer_buffer_length = urb->num_sgs * sglen,
+ urb->transfer_buffer_length = urb->num_sgs * q->buf_size,
sg_init_marker(urb->sg, urb->num_sgs);
return i ? : -ENOMEM;
@@ -326,7 +325,7 @@ mt76u_refill_rx(struct mt76_dev *dev, struct urb *urb, int nsgs, gfp_t gfp)
if (dev->usb.sg_en) {
return mt76u_fill_rx_sg(dev, q, urb, nsgs, gfp);
} else {
- urb->transfer_buffer_length = SKB_WITH_OVERHEAD(q->buf_size);
+ urb->transfer_buffer_length = q->buf_size;
urb->transfer_buffer = page_frag_alloc(&q->rx_page,
q->buf_size, gfp);
return urb->transfer_buffer ? 0 : -ENOMEM;
@@ -447,8 +446,10 @@ mt76u_process_rx_entry(struct mt76_dev *dev, struct urb *urb)
return 0;
data_len = min_t(int, len, data_len - MT_DMA_HDR_LEN);
- if (MT_DMA_HDR_LEN + data_len > SKB_WITH_OVERHEAD(q->buf_size))
+ if (MT_DMA_HDR_LEN + data_len > SKB_WITH_OVERHEAD(q->buf_size)) {
+ dev_err(dev->dev, "rx data too big %d\n", data_len);
return 0;
+ }
skb = build_skb(data, q->buf_size);
if (!skb)
--
2.20.1
^ permalink raw reply related
* Re: [PATCHv5 1/9] nl80211: New netlink command for TID specific configuration
From: Tamizh chelvam @ 2019-04-30 7:38 UTC (permalink / raw)
To: Johannes Berg; +Cc: ath10k, linux-wireless
In-Reply-To: <b90f20a45af63a3261ee14eda38239521dce6486.camel@sipsolutions.net>
>> +enum ieee80211_tid_conf_mask {
>> + IEEE80211_TID_CONF_NOACK = BIT(0),
>> +};
>> +
>> +/**
>> + * struct ieee80211_tid_cfg - TID specific configuration
>> + * @tid: TID number
>> + * @tid_conf_mask: bitmap indicating which parameter changed
>> + * see %enum ieee80211_tid_conf_mask
>> + * @noack: noack configuration value for the TID
>> + */
>> +struct ieee80211_tid_cfg {
>> + u8 tid;
>> + enum ieee80211_tid_conf_mask tid_conf_mask;
>
> This shouldn't use the enum type if it's a bitmap. Doing the enum type
> above is only useful for documentation, which you should add there.
>
Okay. I will change this to u32.
>> + * @set_tid_config: TID specific configuration. Apply this
>> configuration for
>> + * all the connected stations in the BSS if peer is NULL. Otherwise
>
> %NULL renders better, IIRC
>
Sure.
>> + * @NL80211_ATTR_TID_CONFIG: TID specific configuration in a
>> + * nested attribute with %NL80211_ATTR_TID_* sub-attributes.
>
> Please use NL80211_TID_ATTR_* to disambiguate the namespaces
>
Sure.
>> +enum nl80211_tid_config {
>> + NL80211_TID_CONFIG_DEFAULT,
>> + NL80211_TID_CONFIG_ENABLE,
>> + NL80211_TID_CONFIG_DISABLE,
>> +};
>
>
> That could do with some documentation
>
Sure.
>> +
>> +/* enum nl80211_attr_tid_config - TID specific configuration.
>> + * @NL80211_ATTR_TID_CONFIG_TID: a TID value (u8 attribute).
>
> See above - TID_ATTR_* is better.
>
>> + * @NL80211_ATTR_TID_CONFIG_NOACK: Configure ack policy for the TID.
>> + * specified in %NL80211_ATTR_TID_CONFIG_TID. see %enum
>> nl80211_tid_config.
>> + * Its type is u8, if the peer MAC address is passed in
>> %NL80211_ATTR_MAC,
>> + * then the noack configuration is applied to the data frame for the
>> tid
>> + * to that connected station. This configuration is valid only for
>> STA's
>> + * current connection. i.e. the configuration will be reset to
>> default when
>> + * the station connects back after disconnection/roaming.
>> + * when user-space does not include %NL80211_ATTR_MAC, then this
>
> please use tabs consistently
>
>> + * configuration should be treated as per-netdev configuration.
>> + * This configuration will be cleared when the interface goes down
>> and on
>> + * the disconnection from a BSS.
>
> "goes down" is redundant then? Or do you mean that's for the AP case?
>
In AP case, if a station disconnects from AP then the configuration will
be cleared for the station. Similarly in STA mode if it disconnected
from the BSS then the configuration also will be cleared.
>> +static const struct nla_policy
>> +nl80211_attr_tid_config_policy[NL80211_ATTR_TID_CONFIG_MAX + 1] = {
>> + [NL80211_ATTR_TID_CONFIG_TID] = { .type = NLA_U8 },
>
> Shouldn't this use NLA_POLICY_RANGE() or MAX()?
>
To give option to apply configuration for all TIDs if the value is
255(likely).
>> + [NL80211_ATTR_TID_CONFIG_NOACK] =
>> + NLA_POLICY_MAX(NLA_U8, NL80211_TID_CONFIG_DISABLE),
>> +};
>> +
>> const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
>> [NL80211_ATTR_WIPHY] = { .type = NLA_U32 },
>> [NL80211_ATTR_WIPHY_NAME] = { .type = NLA_NUL_STRING,
>> @@ -541,6 +548,8 @@ static int validate_ie_attr(const struct nlattr
>> *attr,
>> [NL80211_ATTR_PEER_MEASUREMENTS] =
>> NLA_POLICY_NESTED(nl80211_pmsr_attr_policy),
>> [NL80211_ATTR_AIRTIME_WEIGHT] = NLA_POLICY_MIN(NLA_U16, 1),
>> + [NL80211_ATTR_TID_CONFIG] =
>> + NLA_POLICY_NESTED(nl80211_attr_tid_config_policy),
>> };
>
> Great! :-)
>
>> /* policy for the key attributes */
>> @@ -13259,6 +13268,93 @@ static int
>> nl80211_get_ftm_responder_stats(struct sk_buff *skb,
>> return -ENOBUFS;
>> }
>>
>> +static int parse_tid_conf(struct cfg80211_registered_device *rdev,
>> + struct nlattr *attrs[],
>> + struct ieee80211_tid_cfg *tid_conf,
>> + const u8 *peer)
>> +{
>> + tid_conf->tid = nla_get_u8(attrs[NL80211_ATTR_TID_CONFIG_TID]);
>
> You need to check that this is even present!
>
>> + size_of_conf = sizeof(struct ieee80211_tid_config) +
>> + num_conf * sizeof(struct ieee80211_tid_cfg);
>
> use struct_size()
Sure
>
>> + tid_conf = kzalloc(size_of_conf, GFP_KERNEL);
>> + if (!tid_conf)
>> + return -ENOMEM;
>> +
>> + tid_conf->n_tid_conf = num_conf;
>> +
>> + if (info->attrs[NL80211_ATTR_MAC])
>> + tid_conf->peer = nla_data(info->attrs[NL80211_ATTR_MAC]);
>> + else
>> + tid_conf->peer = NULL;
>
> No need to initialize to NULL after kzalloc()
okay sure.
>
>> + nla_for_each_nested(tid, info->attrs[NL80211_ATTR_TID_CONFIG],
>> + rem_conf) {
>> + ret = nla_parse_nested(attrs, NL80211_ATTR_TID_CONFIG_MAX, tid,
>> + NULL, NULL);
>> +
>> + if (ret)
>> + goto bad_tid_conf;
>> +
>> + if (!attrs[NL80211_ATTR_TID_CONFIG_TID]) {
>> + ret = -EINVAL;
>> + goto bad_tid_conf;
>> + }
>
> Oh, you check here. Perhaps easier to do inside though?
Checked here since the parse_tid_conf function called after this check.
>
>> + {
>> + .cmd = NL80211_CMD_SET_TID_CONFIG,
>> + .doit = nl80211_set_tid_config,
>> + .policy = nl80211_policy,
>
> The .policy field no longer exists.
Sure, I will remove this
>
> johannes
^ permalink raw reply
* [PATCH V2 3/3] ath11k: add TWT support
From: John Crispin @ 2019-04-30 7:03 UTC (permalink / raw)
To: Johannes Berg, Kalle Valo
Cc: linux-wireless, John Crispin, Shashidhar Lakkavalli
In-Reply-To: <20190430070338.4006-1-john@phrozen.org>
Add target wait time wmi calls to the driver. En/disable the support
from when the bss_config changes. We ignore the cmd completion events.
Signed-off-by: Shashidhar Lakkavalli <slakkavalli@datto.com>
Signed-off-by: John Crispin <john@phrozen.org>
---
drivers/net/wireless/ath/ath11k/mac.c | 7 +++
drivers/net/wireless/ath/ath11k/wmi.c | 91 +++++++++++++++++++++++++++++++++++
drivers/net/wireless/ath/ath11k/wmi.h | 71 +++++++++++++++++++++++++++
3 files changed, 169 insertions(+)
diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index 2c7afbc7b9a6..e3f9d288c357 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -1938,6 +1938,13 @@ static void ath11k_bss_info_changed(struct ieee80211_hw *hw,
ath11k_mac_txpower_recalc(ar);
}
+ if (changed & BSS_CHANGED_TWT) {
+ if (info->twt_requester || info->twt_responder)
+ ath11k_wmi_send_twt_enable_cmd(ar, ar->pdev_idx);
+ else
+ ath11k_wmi_send_twt_disable_cmd(ar, ar->pdev_idx);
+ }
+
mutex_unlock(&ar->conf_mutex);
}
diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c
index 7edaed5c97df..52d6fb200d07 100644
--- a/drivers/net/wireless/ath/ath11k/wmi.c
+++ b/drivers/net/wireless/ath/ath11k/wmi.c
@@ -1797,6 +1797,10 @@ ath11k_wmi_copy_peer_flags(struct wmi_peer_assoc_complete_cmd *cmd,
cmd->peer_flags |= WMI_PEER_VHT;
if (param->he_flag)
cmd->peer_flags |= WMI_PEER_HE;
+ if (param->twt_requester)
+ cmd->peer_flags |= WMI_PEER_TWT_REQ;
+ if (param->twt_responder)
+ cmd->peer_flags |= WMI_PEER_TWT_RESP;
}
/* Suppress authorization for all AUTH modes that need 4-way handshake
@@ -2787,6 +2791,86 @@ int ath11k_wmi_pdev_pktlog_disable(struct ath11k *ar)
return ret;
}
+int
+ath11k_wmi_send_twt_enable_cmd(struct ath11k *ar, u32 pdev_id)
+{
+ struct ath11k_pdev_wmi *wmi = ar->wmi;
+ struct ath11k_base *ab = wmi->wmi_sc->sc;
+ struct wmi_twt_enable_params_cmd *cmd;
+ struct sk_buff *skb;
+ int ret, len;
+
+ len = sizeof(*cmd);
+
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, len);
+ if (!skb)
+ return -ENOMEM;
+
+ cmd = (void *)skb->data;
+ cmd->tlv_header = FIELD_PREP(WMI_TLV_TAG, WMI_TAG_TWT_ENABLE_CMD) |
+ FIELD_PREP(WMI_TLV_LEN, len - TLV_HDR_SIZE);
+ cmd->pdev_id = pdev_id;
+ cmd->sta_cong_timer_ms = ATH11K_TWT_DEF_STA_CONG_TIMER_MS;
+ cmd->default_slot_size = ATH11K_TWT_DEF_DEFAULT_SLOT_SIZE;
+ cmd->congestion_thresh_setup = ATH11K_TWT_DEF_CONGESTION_THRESH_SETUP;
+ cmd->congestion_thresh_teardown =
+ ATH11K_TWT_DEF_CONGESTION_THRESH_TEARDOWN;
+ cmd->congestion_thresh_critical =
+ ATH11K_TWT_DEF_CONGESTION_THRESH_CRITICAL;
+ cmd->interference_thresh_teardown =
+ ATH11K_TWT_DEF_INTERFERENCE_THRESH_TEARDOWN;
+ cmd->interference_thresh_setup =
+ ATH11K_TWT_DEF_INTERFERENCE_THRESH_SETUP;
+ cmd->min_no_sta_setup = ATH11K_TWT_DEF_MIN_NO_STA_SETUP;
+ cmd->min_no_sta_teardown = ATH11K_TWT_DEF_MIN_NO_STA_TEARDOWN;
+ cmd->no_of_bcast_mcast_slots = ATH11K_TWT_DEF_NO_OF_BCAST_MCAST_SLOTS;
+ cmd->min_no_twt_slots = ATH11K_TWT_DEF_MIN_NO_TWT_SLOTS;
+ cmd->max_no_sta_twt = ATH11K_TWT_DEF_MAX_NO_STA_TWT;
+ cmd->mode_check_interval = ATH11K_TWT_DEF_MODE_CHECK_INTERVAL;
+ cmd->add_sta_slot_interval = ATH11K_TWT_DEF_ADD_STA_SLOT_INTERVAL;
+ cmd->remove_sta_slot_interval =
+ ATH11K_TWT_DEF_REMOVE_STA_SLOT_INTERVAL;
+ /* TODO add MBSSID support */
+ cmd->mbss_support = 0;
+
+ ret = ath11k_wmi_cmd_send(wmi, skb,
+ WMI_TWT_ENABLE_CMDID);
+ if (ret) {
+ ath11k_warn(ab, "Failed to send WMI_TWT_ENABLE_CMDID");
+ dev_kfree_skb(skb);
+ }
+ return ret;
+}
+
+int
+ath11k_wmi_send_twt_disable_cmd(struct ath11k *ar, u32 pdev_id)
+{
+ struct ath11k_pdev_wmi *wmi = ar->wmi;
+ struct ath11k_base *ab = wmi->wmi_sc->sc;
+ struct wmi_twt_disable_params_cmd *cmd;
+ struct sk_buff *skb;
+ int ret, len;
+
+ len = sizeof(*cmd);
+
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, len);
+ if (!skb)
+ return -ENOMEM;
+
+ cmd = (void *)skb->data;
+ cmd->tlv_header = FIELD_PREP(WMI_TLV_TAG, WMI_TAG_TWT_DISABLE_CMD) |
+ FIELD_PREP(WMI_TLV_LEN, len - TLV_HDR_SIZE);
+ cmd->pdev_id = pdev_id;
+
+ ret = ath11k_wmi_cmd_send(wmi, skb,
+ WMI_TWT_DISABLE_CMDID);
+ if (ret) {
+ ath11k_warn(ab, "Failed to send WMI_TWT_DIeABLE_CMDID");
+ dev_kfree_skb(skb);
+ }
+ return ret;
+}
+
static inline void ath11k_fill_band_to_mac_param(struct ath11k_base *soc,
struct wmi_host_pdev_band_to_mac *band_to_mac)
{
@@ -2877,6 +2961,9 @@ ath11k_wmi_copy_resource_config(struct wmi_resource_config *wmi_cfg,
wmi_cfg->use_pdev_id = tg_cfg->use_pdev_id;
wmi_cfg->flag1 = tg_cfg->atf_config;
wmi_cfg->peer_map_unmap_v2_support = tg_cfg->peer_map_unmap_v2_support;
+ wmi_cfg->sched_params = tg_cfg->sched_params;
+ wmi_cfg->twt_ap_pdev_count = tg_cfg->twt_ap_pdev_count;
+ wmi_cfg->twt_ap_sta_count = tg_cfg->twt_ap_sta_count;
}
static int ath11k_init_cmd_send(struct ath11k_pdev_wmi *wmi,
@@ -3068,6 +3155,8 @@ int ath11k_wmi_cmd_init(struct ath11k_base *sc)
config.beacon_tx_offload_max_vdev = sc->num_radios * TARGET_MAX_BCN_OFFLD;
config.rx_batchmode = TARGET_RX_BATCHMODE;
config.peer_map_unmap_v2_support = 1;
+ config.twt_ap_pdev_count = 2;
+ config.twt_ap_sta_count = 1000;
memcpy(&wmi_sc->wlan_resource_config, &config, sizeof(config));
@@ -5859,6 +5948,8 @@ static void ath11k_wmi_tlv_op_rx(struct ath11k_base *ab, struct sk_buff *skb)
/* add Unsupported events here */
case WMI_TBTTOFFSET_EXT_UPDATE_EVENTID:
case WMI_VDEV_DELETE_RESP_EVENTID:
+ case WMI_TWT_ENABLE_EVENTID:
+ case WMI_TWT_DISABLE_EVENTID:
ath11k_dbg(ab, ATH11K_DBG_WMI,
"ignoring unsupported event 0x%x\n", id);
break;
diff --git a/drivers/net/wireless/ath/ath11k/wmi.h b/drivers/net/wireless/ath/ath11k/wmi.h
index 071537850c68..99f69fc3cf53 100644
--- a/drivers/net/wireless/ath/ath11k/wmi.h
+++ b/drivers/net/wireless/ath/ath11k/wmi.h
@@ -169,6 +169,10 @@ enum wmi_cmd_group {
WMI_GRP_MONITOR, /* 0x39 */
WMI_GRP_REGULATORY, /* 0x3a */
WMI_GRP_HW_DATA_FILTER, /* 0x3b */
+ WMI_GRP_WLM, /* 0x3c */
+ WMI_GRP_11K_OFFLOAD, /* 0x3d */
+ WMI_GRP_TWT, /* 0x3e */
+
};
#define WMI_CMD_GRP(grp_id) (((grp_id) << 12) | 0x1)
@@ -531,6 +535,12 @@ enum wmi_tlv_cmd_id {
WMI_NDP_RESPONDER_REQ_CMDID,
WMI_NDP_END_REQ_CMDID,
WMI_HW_DATA_FILTER_CMDID = WMI_TLV_CMD(WMI_GRP_HW_DATA_FILTER),
+ WMI_TWT_ENABLE_CMDID = WMI_TLV_CMD(WMI_GRP_TWT),
+ WMI_TWT_DISABLE_CMDID,
+ WMI_TWT_ADD_DIALOG_CMDID,
+ WMI_TWT_DEL_DIALOG_CMDID,
+ WMI_TWT_PAUSE_DIALOG_CMDID,
+ WMI_TWT_RESUME_DIALOG_CMDID,
};
enum wmi_tlv_event_id {
@@ -713,6 +723,13 @@ enum wmi_tlv_event_id {
WMI_NDP_INDICATION_EVENTID,
WMI_NDP_CONFIRM_EVENTID,
WMI_NDP_END_INDICATION_EVENTID,
+
+ WMI_TWT_ENABLE_EVENTID = WMI_TLV_CMD(WMI_GRP_TWT),
+ WMI_TWT_DISABLE_EVENTID,
+ WMI_TWT_ADD_DIALOG_EVENTID,
+ WMI_TWT_DEL_DIALOG_EVENTID,
+ WMI_TWT_PAUSE_DIALOG_EVENTID,
+ WMI_TWT_RESUME_DIALOG_EVENTID,
};
enum wmi_tlv_pdev_param {
@@ -2736,6 +2753,9 @@ struct wmi_resource_config {
u32 max_num_dbs_scan_duty_cycle;
u32 max_num_group_keys;
u32 peer_map_unmap_v2_support;
+ u32 sched_params;
+ u32 twt_ap_pdev_count;
+ u32 twt_ap_sta_count;
} __packed;
struct wmi_service_ready_event {
@@ -3907,6 +3927,8 @@ struct peer_assoc_params {
u32 peer_he_mcs_count;
u32 peer_he_rx_mcs_set[WMI_HOST_MAX_HE_RATE_SET];
u32 peer_he_tx_mcs_set[WMI_HOST_MAX_HE_RATE_SET];
+ bool twt_responder;
+ bool twt_requester;
struct ath11k_ppe_threshold peer_ppet;
};
@@ -4130,6 +4152,8 @@ struct wmi_pktlog_disable_cmd {
#define WMI_PEER_DYN_MIMOPS 0x00020000
#define WMI_PEER_STATIC_MIMOPS 0x00040000
#define WMI_PEER_SPATIAL_MUX 0x00200000
+#define WMI_PEER_TWT_REQ 0x00400000
+#define WMI_PEER_TWT_RESP 0x00800000
#define WMI_PEER_VHT 0x02000000
#define WMI_PEER_80MHZ 0x04000000
#define WMI_PEER_PMF 0x08000000
@@ -5005,6 +5029,48 @@ struct wmi_wmm_params_all_arg {
struct wmi_wmm_params_arg ac_vo;
};
+#define ATH11K_TWT_DEF_STA_CONG_TIMER_MS 5000
+#define ATH11K_TWT_DEF_DEFAULT_SLOT_SIZE 10
+#define ATH11K_TWT_DEF_CONGESTION_THRESH_SETUP 50
+#define ATH11K_TWT_DEF_CONGESTION_THRESH_TEARDOWN 20
+#define ATH11K_TWT_DEF_CONGESTION_THRESH_CRITICAL 100
+#define ATH11K_TWT_DEF_INTERFERENCE_THRESH_TEARDOWN 80
+#define ATH11K_TWT_DEF_INTERFERENCE_THRESH_SETUP 50
+#define ATH11K_TWT_DEF_MIN_NO_STA_SETUP 10
+#define ATH11K_TWT_DEF_MIN_NO_STA_TEARDOWN 2
+#define ATH11K_TWT_DEF_NO_OF_BCAST_MCAST_SLOTS 2
+#define ATH11K_TWT_DEF_MIN_NO_TWT_SLOTS 2
+#define ATH11K_TWT_DEF_MAX_NO_STA_TWT 500
+#define ATH11K_TWT_DEF_MODE_CHECK_INTERVAL 10000
+#define ATH11K_TWT_DEF_ADD_STA_SLOT_INTERVAL 1000
+#define ATH11K_TWT_DEF_REMOVE_STA_SLOT_INTERVAL 5000
+
+struct wmi_twt_enable_params_cmd {
+ u32 tlv_header;
+ u32 pdev_id;
+ u32 sta_cong_timer_ms;
+ u32 mbss_support;
+ u32 default_slot_size;
+ u32 congestion_thresh_setup;
+ u32 congestion_thresh_teardown;
+ u32 congestion_thresh_critical;
+ u32 interference_thresh_teardown;
+ u32 interference_thresh_setup;
+ u32 min_no_sta_setup;
+ u32 min_no_sta_teardown;
+ u32 no_of_bcast_mcast_slots;
+ u32 min_no_twt_slots;
+ u32 max_no_sta_twt;
+ u32 mode_check_interval;
+ u32 add_sta_slot_interval;
+ u32 remove_sta_slot_interval;
+};
+
+struct wmi_twt_disable_params_cmd {
+ u32 tlv_header;
+ u32 pdev_id;
+};
+
struct target_resource_config {
u32 num_vdevs;
u32 num_peers;
@@ -5065,6 +5131,9 @@ struct target_resource_config {
u32 max_bssid_rx_filters;
u32 use_pdev_id;
u32 peer_map_unmap_v2_support;
+ u32 sched_params;
+ u32 twt_ap_pdev_count;
+ u32 twt_ap_sta_count;
};
#define WMI_MAX_MEM_REQS 32
@@ -5190,4 +5259,6 @@ size_t ath11k_wmi_fw_stats_num_vdevs(struct list_head *head);
void ath11k_wmi_fw_stats_fill(struct ath11k *ar,
struct ath11k_fw_stats *fw_stats, u32 stats_id,
char *buf);
+int ath11k_wmi_send_twt_enable_cmd(struct ath11k *ar, u32 pdev_id);
+int ath11k_wmi_send_twt_disable_cmd(struct ath11k *ar, u32 pdev_id);
#endif
--
2.11.0
^ permalink raw reply related
* [PATCH V2 2/3] mac80211: allow turning TWT responder support on and off via netlink
From: John Crispin @ 2019-04-30 7:03 UTC (permalink / raw)
To: Johannes Berg, Kalle Valo
Cc: linux-wireless, John Crispin, Shashidhar Lakkavalli
In-Reply-To: <20190430070338.4006-1-john@phrozen.org>
Allow the userland daemon to en/disable TWT support for an AP.
Signed-off-by: Shashidhar Lakkavalli <slakkavalli@datto.com>
Signed-off-by: John Crispin <john@phrozen.org>
---
include/net/cfg80211.h | 2 ++
include/net/mac80211.h | 3 +++
include/uapi/linux/nl80211.h | 4 ++++
net/mac80211/cfg.c | 4 +++-
net/wireless/nl80211.c | 5 +++++
5 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index bb307a11ee63..c4fe1bf10289 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -876,6 +876,7 @@ enum cfg80211_ap_settings_flags {
* @he_cap: HE capabilities (or %NULL if HE isn't enabled)
* @ht_required: stations must support HT
* @vht_required: stations must support VHT
+ * @twt_responder: Enable Target Wait Time
* @flags: flags, as defined in enum cfg80211_ap_settings_flags
*/
struct cfg80211_ap_settings {
@@ -902,6 +903,7 @@ struct cfg80211_ap_settings {
const struct ieee80211_vht_cap *vht_cap;
const struct ieee80211_he_cap_elem *he_cap;
bool ht_required, vht_required;
+ bool twt_responder;
u32 flags;
};
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 2504a6cd8ca9..3c916d5de8c8 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -506,6 +506,8 @@ struct ieee80211_ftm_responder_params {
* @he_support: does this BSS support HE
* @twt_requester: does this BSS support TWT requester (relevant for managed
* mode only, set if the AP advertises TWT responder role)
+ * @twt_responder: does this BSS support TWT requester (relevant for managed
+ * mode only, set if the AP advertises TWT responder role)
* @assoc: association status
* @ibss_joined: indicates whether this station is part of an IBSS
* or not
@@ -613,6 +615,7 @@ struct ieee80211_bss_conf {
u16 frame_time_rts_th;
bool he_support;
bool twt_requester;
+ bool twt_responder;
/* association related data */
bool assoc, ibss_joined;
bool ibss_creator;
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index dd4f86ee286e..ba1f69751a4a 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -2308,6 +2308,8 @@ enum nl80211_commands {
* @NL80211_ATTR_AIRTIME_WEIGHT: Station's weight when scheduled by the airtime
* scheduler.
*
+ * @NL80211_ATTR_TWT_RESPONDER: Enable target wait time responder support.
+ *
* @NUM_NL80211_ATTR: total number of nl80211_attrs available
* @NL80211_ATTR_MAX: highest attribute number currently defined
* @__NL80211_ATTR_AFTER_LAST: internal use
@@ -2759,6 +2761,8 @@ enum nl80211_attrs {
NL80211_ATTR_AIRTIME_WEIGHT,
+ NL80211_ATTR_TWT_RESPONDER,
+
/* add attributes here, update the policy in nl80211.c */
__NL80211_ATTR_AFTER_LAST,
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 09dd1c2860fc..8be2f32fedfc 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -939,7 +939,8 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
BSS_CHANGED_BEACON |
BSS_CHANGED_SSID |
BSS_CHANGED_P2P_PS |
- BSS_CHANGED_TXPOWER;
+ BSS_CHANGED_TXPOWER |
+ BSS_CHANGED_TWT;
int err;
int prev_beacon_int;
@@ -1009,6 +1010,7 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
sdata->vif.bss_conf.dtim_period = params->dtim_period;
sdata->vif.bss_conf.enable_beacon = true;
sdata->vif.bss_conf.allow_p2p_go_ps = sdata->vif.p2p;
+ sdata->vif.bss_conf.twt_responder = params->twt_responder;
sdata->vif.bss_conf.ssid_len = params->ssid_len;
if (params->ssid_len)
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 25a9e3b5c154..643f53dc2c89 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -541,6 +541,7 @@ const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
[NL80211_ATTR_PEER_MEASUREMENTS] =
NLA_POLICY_NESTED(nl80211_pmsr_attr_policy),
[NL80211_ATTR_AIRTIME_WEIGHT] = NLA_POLICY_MIN(NLA_U16, 1),
+ [NL80211_ATTR_TWT_RESPONDER] = { .type = NLA_FLAG },
};
/* policy for the key attributes */
@@ -4531,6 +4532,10 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
return PTR_ERR(params.acl);
}
+ if (info->attrs[NL80211_ATTR_TWT_RESPONDER])
+ params.twt_responder =
+ nla_get_flag(info->attrs[NL80211_ATTR_TWT_RESPONDER]);
+
nl80211_calculate_ap_params(¶ms);
if (info->attrs[NL80211_ATTR_EXTERNAL_AUTH_SUPPORT])
--
2.11.0
^ permalink raw reply related
* [PATCH V2 1/3] mac80211: dynamically enable the TWT requester support on STA interfaces
From: John Crispin @ 2019-04-30 7:03 UTC (permalink / raw)
To: Johannes Berg, Kalle Valo
Cc: linux-wireless, John Crispin, Shashidhar Lakkavalli
In-Reply-To: <20190430070338.4006-1-john@phrozen.org>
Turn TWT for STA interfaces when they associate and/or receive a
beacon where the twt_responder bit has changed.
Signed-off-by: Shashidhar Lakkavalli <slakkavalli@datto.com>
Signed-off-by: John Crispin <john@phrozen.org>
---
include/net/mac80211.h | 2 ++
net/mac80211/mlme.c | 18 ++++++++++++++++--
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index ac2ed8ec662b..2504a6cd8ca9 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -317,6 +317,7 @@ struct ieee80211_vif_chanctx_switch {
* @BSS_CHANGED_MCAST_RATE: Multicast Rate setting changed for this interface
* @BSS_CHANGED_FTM_RESPONDER: fime timing reasurement request responder
* functionality changed for this BSS (AP mode).
+ * @BSS_CHANGED_TWT: TWT status changed
*
*/
enum ieee80211_bss_change {
@@ -347,6 +348,7 @@ enum ieee80211_bss_change {
BSS_CHANGED_KEEP_ALIVE = 1<<24,
BSS_CHANGED_MCAST_RATE = 1<<25,
BSS_CHANGED_FTM_RESPONDER = 1<<26,
+ BSS_CHANGED_TWT = 1<<27,
/* when adding here, make sure to change ieee80211_reconfig */
};
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 2dbcf5d5512e..0d6ede3b6320 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -3151,6 +3151,19 @@ static bool ieee80211_twt_req_supported(const struct sta_info *sta,
IEEE80211_HE_MAC_CAP0_TWT_RES;
}
+static int ieee80211_recalc_twt_req(struct ieee80211_sub_if_data *sdata,
+ struct sta_info *sta,
+ struct ieee802_11_elems *elems)
+{
+ bool twt = ieee80211_twt_req_supported(sta, elems);
+
+ if (sdata->vif.bss_conf.twt_requester != twt) {
+ sdata->vif.bss_conf.twt_requester = twt;
+ return BSS_CHANGED_TWT;
+ }
+ return 0;
+}
+
static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata,
struct cfg80211_bss *cbss,
struct ieee80211_mgmt *mgmt, size_t len)
@@ -3333,8 +3346,7 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata,
sta);
bss_conf->he_support = sta->sta.he_cap.has_he;
- bss_conf->twt_requester =
- ieee80211_twt_req_supported(sta, &elems);
+ changed |= ieee80211_recalc_twt_req(sdata, sta, &elems);
} else {
bss_conf->he_support = false;
bss_conf->twt_requester = false;
@@ -3994,6 +4006,8 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
mutex_lock(&local->sta_mtx);
sta = sta_info_get(sdata, bssid);
+ changed |= ieee80211_recalc_twt_req(sdata, sta, &elems);
+
if (ieee80211_config_bw(sdata, sta,
elems.ht_cap_elem, elems.ht_operation,
elems.vht_operation, elems.he_operation,
--
2.11.0
^ permalink raw reply related
* [PATCH V2 0/3] mac80211: add code to explicitly enable TWT support inside the driver
From: John Crispin @ 2019-04-30 7:03 UTC (permalink / raw)
To: Johannes Berg, Kalle Valo; +Cc: linux-wireless, John Crispin
At least ath11k needs an extra FW call to enable TWT inside the HW. This
series adds code to trigger this from within start_ap() and also STA assoc
events.
Changes in V2
* fix 2 typos
* move from bbs_config to start_ap
John Crispin (3):
mac80211: dynamically enable the TWT requester support on STA
interfaces
mac80211: allow turning TWT responder support on and off via netlink
ath11k: add TWT support
drivers/net/wireless/ath/ath11k/mac.c | 7 +++
drivers/net/wireless/ath/ath11k/wmi.c | 91 +++++++++++++++++++++++++++++++++++
drivers/net/wireless/ath/ath11k/wmi.h | 71 +++++++++++++++++++++++++++
include/net/cfg80211.h | 2 +
include/net/mac80211.h | 5 ++
include/uapi/linux/nl80211.h | 4 ++
net/mac80211/cfg.c | 4 +-
net/mac80211/mlme.c | 18 ++++++-
net/wireless/nl80211.c | 5 ++
9 files changed, 204 insertions(+), 3 deletions(-)
--
2.11.0
^ permalink raw reply
* Re: [PATCH V2 2/3] mac80211: dynamically turn TWT requester support on and off
From: John Crispin @ 2019-04-30 6:58 UTC (permalink / raw)
To: Rajkumar Manoharan
Cc: linux-wireless-owner, linux-wireless, Rajkumar Manoharan,
Srini Kode, Shashidhar Lakkavalli, Johannes Berg, ath11k,
Kalle Valo
In-Reply-To: <a580242a242ec6126928bba5227f1e2d@codeaurora.org>
On 30/04/2019 08:45, Rajkumar Manoharan wrote:
> On 2019-04-26 02:41, John Crispin wrote:
>> Turn TWT on/off for STA interfaces when they associate and/or receive a
>> beacon where the twt_responder bit has changed.
>>
>
> Does it mean that TWT responder can be turn on/off when AP is UP and
> running?
> I thought any change in beacon needs AP restart. no?
>
> -Rajkumar
>
> _______________________________________________
> ath11k mailing list
> ath11k@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/ath11k
Hi Rajkumar,
I am about to send a V2 that already addresses allthose comments, Thanks
for the review
John
^ permalink raw reply
* Re: [PATCH V2 3/3] ath11k: add TWT support
From: Rajkumar Manoharan @ 2019-04-30 6:50 UTC (permalink / raw)
To: John Crispin
Cc: Johannes Berg, Kalle Valo, Srini Kode, Rajkumar Manoharan,
linux-wireless, ath11k, Shashidhar Lakkavalli,
linux-wireless-owner
In-Reply-To: <20190426094150.18078-4-john@phrozen.org>
On 2019-04-26 02:41, John Crispin wrote:
> diff --git a/drivers/net/wireless/ath/ath11k/mac.c
> b/drivers/net/wireless/ath/ath11k/mac.c
> index 8bb4ff82fb6f..a38c101e0140 100644
> --- a/drivers/net/wireless/ath/ath11k/mac.c
> +++ b/drivers/net/wireless/ath/ath11k/mac.c
> @@ -1938,6 +1938,13 @@ static void ath11k_bss_info_changed(struct
> ieee80211_hw *hw,
> ath11k_mac_txpower_recalc(ar);
> }
>
> + if (changed & BSS_CHANGED_TWT) {
> + if (info->twt_responder || info->twt_responder)
>
typo? two twt_responder checks?
-Rajkumar
^ permalink raw reply
* Re: [PATCH V2 2/3] mac80211: dynamically turn TWT requester support on and off
From: Rajkumar Manoharan @ 2019-04-30 6:45 UTC (permalink / raw)
To: John Crispin
Cc: Johannes Berg, Kalle Valo, Srini Kode, Rajkumar Manoharan,
linux-wireless, ath11k, Shashidhar Lakkavalli,
linux-wireless-owner
In-Reply-To: <20190426094150.18078-3-john@phrozen.org>
On 2019-04-26 02:41, John Crispin wrote:
> Turn TWT on/off for STA interfaces when they associate and/or receive a
> beacon where the twt_responder bit has changed.
>
Does it mean that TWT responder can be turn on/off when AP is UP and
running?
I thought any change in beacon needs AP restart. no?
-Rajkumar
^ permalink raw reply
* Re: [PATCH V2 1/3] mac80211: allow turning TWT responder support on and off via netlink
From: Rajkumar Manoharan @ 2019-04-30 6:42 UTC (permalink / raw)
To: John Crispin
Cc: Johannes Berg, Kalle Valo, Srini Kode, Rajkumar Manoharan,
linux-wireless, ath11k, Shashidhar Lakkavalli,
linux-wireless-owner
In-Reply-To: <20190426094150.18078-2-john@phrozen.org>
On 2019-04-26 02:41, John Crispin wrote:
> Allow the userland daemon to en/disable TWT support for an AP.
>
> Signed-off-by: Shashidhar Lakkavalli <slakkavalli@datto.com>
> Signed-off-by: John Crispin <john@phrozen.org>
> ---
> include/net/cfg80211.h | 2 ++
> include/net/mac80211.h | 5 +++++
> include/uapi/linux/nl80211.h | 4 ++++
> net/mac80211/cfg.c | 6 ++++++
> net/wireless/nl80211.c | 6 ++++++
> 5 files changed, 23 insertions(+)
>
> diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
> index bb307a11ee63..8a20f5a42977 100644
> --- a/include/net/cfg80211.h
> +++ b/include/net/cfg80211.h
> @@ -1511,6 +1511,7 @@ struct mpath_info {
> * (u16 = opmode, -1 = do not change)
> * @p2p_ctwindow: P2P CT Window (-1 = no change)
> * @p2p_opp_ps: P2P opportunistic PS (-1 = no change)
> + * @twt_responder: HE Target Wait Time support.
>
Responder support. Perhaps it could named as he_twt_resp to
differentiate from ah.
> */
> struct bss_parameters {
> int use_cts_prot;
> @@ -1521,6 +1522,7 @@ struct bss_parameters {
> int ap_isolate;
> int ht_opmode;
> s8 p2p_ctwindow, p2p_opp_ps;
> + int twt_responder;
> };
>
Same here. Better fix he_ in other places as well. thoughts?
> /**
> diff --git a/include/net/mac80211.h b/include/net/mac80211.h
> index ac2ed8ec662b..87a6e149abda 100644
> --- a/include/net/mac80211.h
> +++ b/include/net/mac80211.h
> @@ -317,6 +317,7 @@ struct ieee80211_vif_chanctx_switch {
> * @BSS_CHANGED_MCAST_RATE: Multicast Rate setting changed for this
> interface
> * @BSS_CHANGED_FTM_RESPONDER: fime timing reasurement request
> responder
> * functionality changed for this BSS (AP mode).
> + * @BSS_CHANGED_TWT: TWT enable status changed
> *
> */
> enum ieee80211_bss_change {
> @@ -347,6 +348,7 @@ enum ieee80211_bss_change {
> BSS_CHANGED_KEEP_ALIVE = 1<<24,
> BSS_CHANGED_MCAST_RATE = 1<<25,
> BSS_CHANGED_FTM_RESPONDER = 1<<26,
> + BSS_CHANGED_TWT = 1<<27,
>
> /* when adding here, make sure to change ieee80211_reconfig */
> };
> @@ -504,6 +506,8 @@ struct ieee80211_ftm_responder_params {
> * @he_support: does this BSS support HE
> * @twt_requester: does this BSS support TWT requester (relevant for
> managed
> * mode only, set if the AP advertises TWT responder role)
> + * @twt_responder: does this BSS support TWT responder (relevant for
> AP
> + * mode only, set if the AP advertises TWT responder role)
> * @assoc: association status
> * @ibss_joined: indicates whether this station is part of an IBSS
> * or not
> @@ -611,6 +615,7 @@ struct ieee80211_bss_conf {
> u16 frame_time_rts_th;
> bool he_support;
> bool twt_requester;
> + bool twt_responder;
>
ah.. I see existing twt_requester config.
> /* association related data */
> bool assoc, ibss_joined;
> bool ibss_creator;
> diff --git a/include/uapi/linux/nl80211.h
> b/include/uapi/linux/nl80211.h
> index dd4f86ee286e..ba1f69751a4a 100644
> --- a/include/uapi/linux/nl80211.h
> +++ b/include/uapi/linux/nl80211.h
> @@ -2308,6 +2308,8 @@ enum nl80211_commands {
> * @NL80211_ATTR_AIRTIME_WEIGHT: Station's weight when scheduled by
> the airtime
> * scheduler.
> *
> + * @NL80211_ATTR_TWT_RESPONDER: Enable target wait time responder
> support.
> + *
> * @NUM_NL80211_ATTR: total number of nl80211_attrs available
> * @NL80211_ATTR_MAX: highest attribute number currently defined
> * @__NL80211_ATTR_AFTER_LAST: internal use
> @@ -2759,6 +2761,8 @@ enum nl80211_attrs {
>
> NL80211_ATTR_AIRTIME_WEIGHT,
>
> + NL80211_ATTR_TWT_RESPONDER,
> +
> /* add attributes here, update the policy in nl80211.c */
>
> __NL80211_ATTR_AFTER_LAST,
> diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
> index 09dd1c2860fc..a66600bf9cef 100644
> --- a/net/mac80211/cfg.c
> +++ b/net/mac80211/cfg.c
> @@ -2176,6 +2176,12 @@ static int ieee80211_change_bss(struct wiphy
> *wiphy,
> changed |= BSS_CHANGED_P2P_PS;
> }
>
> + if (params->twt_responder >= 0) {
> + sdata->vif.bss_conf.twt_responder =
> + params->twt_responder;
> + changed |= BSS_CHANGED_TWT;
> + }
> +
> ieee80211_bss_info_change_notify(sdata, changed);
>
> return 0;
> diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
> index 25a9e3b5c154..afd04a98a601 100644
> --- a/net/wireless/nl80211.c
> +++ b/net/wireless/nl80211.c
> @@ -541,6 +541,7 @@ const struct nla_policy
> nl80211_policy[NUM_NL80211_ATTR] = {
> [NL80211_ATTR_PEER_MEASUREMENTS] =
> NLA_POLICY_NESTED(nl80211_pmsr_attr_policy),
> [NL80211_ATTR_AIRTIME_WEIGHT] = NLA_POLICY_MIN(NLA_U16, 1),
> + [NL80211_ATTR_BSS_SHORT_PREAMBLE] = NLA_POLICY_RANGE(NLA_U8, 0, 1),
> };
>
Why SHORT_PREAMBLE? Why not attribute be NLA_FLAG?
-Rajkumar
^ permalink raw reply
* RE: [PATCHv2] ath10k: Add wrapper function to ath10k debug
From: Venkateswara Naralasetty @ 2019-04-30 6:13 UTC (permalink / raw)
To: Ben Greear, Michał Kazior, Venkateswara Naralasetty
Cc: Kan Yan, linux-wireless, ath10k@lists.infradead.org
In-Reply-To: <52f8d2ff-9bd0-d456-e29a-c60b99a1eb8a@candelatech.com>
> -----Original Message-----
> From: ath10k <ath10k-bounces@lists.infradead.org> On Behalf Of Ben
> Greear
> Sent: Friday, April 26, 2019 7:27 PM
> To: Michał Kazior <kazikcz@gmail.com>; Venkateswara Naralasetty
> <vnaralas@codeaurora.org>
> Cc: Kan Yan <kyan@chromium.org>; linux-wireless <linux-
> wireless@vger.kernel.org>; ath10k@lists.infradead.org
> Subject: [EXT] Re: [PATCHv2] ath10k: Add wrapper function to ath10k debug
>
> On 4/26/19 6:44 AM, Michał Kazior wrote:
> > On Fri, 26 Apr 2019 at 14:58, Venkateswara Naralasetty
> > <vnaralas@codeaurora.org> wrote:
> >>
> >> ath10k_dbg() is called in ath10k_process_rx() with huge set of
> >> arguments which is causing CPU overhead even when debug_mask is not
> set.
> >> Good improvement was observed in the receive side performance when
> >> call to ath10k_dbg() is avoided in the RX path.
> > [...]
> >
> >> +/* Avoid calling __ath10k_dbg() if debug_mask is not set and tracing
> >> + * disabled.
> >> + */
> >> +#define ath10k_dbg(ar, dbg_mask, fmt, ...) \
> >> +do { \
> >> + if ((ath10k_debug_mask & dbg_mask) || \
> >> + trace_ath10k_log_dbg_enabled()) \
> >> + __ath10k_dbg(ar, dbg_mask, fmt, ##__VA_ARGS__); \ }
> >> +while (0)
> >
> > Did you consider using jump labels (see include/linux/jump_label.h)?
> > It's what tracing uses under the hood. I wonder if you could squeeze
> > out a bit more performance with that? I guess you'd need to add
> > `struct static_key ath10k_dbg_mask_keys[ATH10K_DBG_MAX]` and re-do
> > ath10k_debug_mask enum a bit.
>
> Maybe first test with debugging just compiled out to see if there is still any
> significant overhead with this new patch applied?
Since this macro ath10k_dbg defined outside of CONFIG_ATH10K_DEBUG will it make any difference even if debugging compiled out?
Thanks,
Venkatesh.
>
> Thanks,
> Ben
>
> --
> Ben Greear <greearb@candelatech.com>
> Candela Technologies Inc http://www.candelatech.com
>
>
> _______________________________________________
> ath10k mailing list
> ath10k@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/ath10k
^ permalink raw reply
* Re: linux-next: manual merge of the wireless-drivers-next tree with the wireless-drivers tree
From: Luciano Coelho @ 2019-04-30 5:30 UTC (permalink / raw)
To: Stephen Rothwell, Kalle Valo, Wireless
Cc: Linux Next Mailing List, Linux Kernel Mailing List,
Shahar S Matityahu
In-Reply-To: <20190430140831.6095243c@canb.auug.org.au>
On Tue, 2019-04-30 at 14:08 +1000, Stephen Rothwell wrote:
> Hi all,
>
> Today's linux-next merge of the wireless-drivers-next tree got a
> conflict in:
>
> drivers/net/wireless/intel/iwlwifi/fw/file.h
>
> between commit:
>
> b35f63972c5c ("iwlwifi: dbg_ini: check debug TLV type explicitly")
>
> from the wireless-drivers tree and commit:
>
> aee1b6385e29 ("iwlwifi: support fseq tlv and print fseq version")
>
> from the wireless-drivers-next tree.
>
> I fixed it up (the latter is a superset of the former) and can carry the
> fix as necessary. This is now fixed as far as linux-next is concerned,
> but any non trivial conflicts should be mentioned to your upstream
> maintainer when your tree is submitted for merging. You may also want
> to consider cooperating with the maintainer of the conflicting tree to
> minimise any particularly complex conflicts.
Thanks, Stephen!
Your resolution is correct, thanks. I accidentally included the block
that was already in b35f63972c5c when I rebased aee1b6385e29, but it's
harmless (except for the minimal conflict it causes).
--
Cheers,
Luca.
^ permalink raw reply
* linux-next: manual merge of the wireless-drivers-next tree with the wireless-drivers tree
From: Stephen Rothwell @ 2019-04-30 4:08 UTC (permalink / raw)
To: Kalle Valo, Wireless
Cc: Linux Next Mailing List, Linux Kernel Mailing List, Luca Coelho,
Shahar S Matityahu
[-- Attachment #1: Type: text/plain, Size: 829 bytes --]
Hi all,
Today's linux-next merge of the wireless-drivers-next tree got a
conflict in:
drivers/net/wireless/intel/iwlwifi/fw/file.h
between commit:
b35f63972c5c ("iwlwifi: dbg_ini: check debug TLV type explicitly")
from the wireless-drivers tree and commit:
aee1b6385e29 ("iwlwifi: support fseq tlv and print fseq version")
from the wireless-drivers-next tree.
I fixed it up (the latter is a superset of the former) and can carry the
fix as necessary. This is now fixed as far as linux-next is concerned,
but any non trivial conflicts should be mentioned to your upstream
maintainer when your tree is submitted for merging. You may also want
to consider cooperating with the maintainer of the conflicting tree to
minimise any particularly complex conflicts.
--
Cheers,
Stephen Rothwell
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply
* Re: [PATCH v2] mmc: dw_mmc: Disable SDIO interrupts while suspended to fix suspend/resume
From: Guenter Roeck @ 2019-04-29 20:46 UTC (permalink / raw)
To: Douglas Anderson
Cc: Jaehoon Chung, Ulf Hansson, Shawn Lin, Kalle Valo,
Heiko Stübner, open list:ARM/Rockchip SoC..., Guenter Roeck,
Brian Norris, linux-wireless, Sonny Rao, Emil Renner Berthing,
Matthias Kaehlcke, Ryan Case, # v4 . 10+, linux-mmc, linux-kernel
In-Reply-To: <20190429204040.18725-1-dianders@chromium.org>
On Mon, Apr 29, 2019 at 1:41 PM Douglas Anderson <dianders@chromium.org> wrote:
>
> Processing SDIO interrupts while dw_mmc is suspended (or partly
> suspended) seems like a bad idea. We really don't want to be
> processing them until we've gotten ourselves fully powered up.
>
> You might be wondering how it's even possible to become suspended when
> an SDIO interrupt is active. As can be seen in
> dw_mci_enable_sdio_irq(), we explicitly keep dw_mmc out of runtime
> suspend when the SDIO interrupt is enabled. ...but even though we
> stop normal runtime suspend transitions when SDIO interrupts are
> enabled, the dw_mci_runtime_suspend() can still get called for a full
> system suspend.
>
> Let's handle all this by explicitly masking SDIO interrupts in the
> suspend call and unmasking them later in the resume call. To do this
> cleanly I'll keep track of whether the client requested that SDIO
> interrupts be enabled so that we can reliably restore them regardless
> of whether we're masking them for one reason or another.
>
> It should be noted that if dw_mci_enable_sdio_irq() is never called
> (for instance, if we don't have an SDIO card plugged in) that
> "client_sdio_enb" will always be false. In those cases this patch
> adds a tiny bit of overhead to suspend/resume (a spinlock and a
> read/write of INTMASK) but other than that is a no-op. The
> SDMMC_INT_SDIO bit should always be clear and clearing it again won't
> hurt.
>
> Without this fix it can be seen that rk3288-veyron Chromebooks with
> Marvell WiFi would sometimes fail to resume WiFi even after picking my
> recent mwifiex patch [1]. Specifically you'd see messages like this:
> mwifiex_sdio mmc1:0001:1: Firmware wakeup failed
> mwifiex_sdio mmc1:0001:1: PREP_CMD: FW in reset state
>
> ...and tracing through the resume code in the failing cases showed
> that we were processing a SDIO interrupt really early in the resume
> call.
>
> NOTE: downstream in Chrome OS 3.14 and 3.18 kernels (both of which
> support the Marvell SDIO WiFi card) we had a patch ("CHROMIUM: sdio:
> Defer SDIO interrupt handling until after resume") [2]. Presumably
> this is the same problem that was solved by that patch.
>
> [1] https://lkml.kernel.org/r/20190404040106.40519-1-dianders@chromium.org
> [2] https://crrev.com/c/230765
>
> Cc: <stable@vger.kernel.org> # 4.14.x
> Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
> ---
> I didn't put any "Fixes" tag here, but presumably this could be
> backported to whichever kernels folks found it useful for. I have at
> least confirmed that kernels v4.14 and v4.19 (as well as v5.1-rc2)
> show the problem. It is very easy to pick this to v4.19 and it
> definitely fixes the problem there.
>
> I haven't spent the time to pick this to 4.14 myself, but presumably
> it wouldn't be too hard to backport this as far as v4.13 since that
> contains commit 32dba73772f8 ("mmc: dw_mmc: Convert to use
> MMC_CAP2_SDIO_IRQ_NOTHREAD for SDIO IRQs"). Prior to that it might
> make sense for anyone experiencing this problem to just pick the old
> CHROMIUM patch to fix them.
>
> Changes in v2:
> - Suggested 4.14+ in the stable tag (Sasha-bot)
> - Extra note that this is a noop on non-SDIO (Shawn / Emil)
> - Make boolean logic cleaner as per https://crrev.com/c/1586207/1
> - Hopefully clear comments as per https://crrev.com/c/1586207/1
>
> drivers/mmc/host/dw_mmc.c | 27 +++++++++++++++++++++++----
> drivers/mmc/host/dw_mmc.h | 3 +++
> 2 files changed, 26 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> index 80dc2fd6576c..480067b87a94 100644
> --- a/drivers/mmc/host/dw_mmc.c
> +++ b/drivers/mmc/host/dw_mmc.c
> @@ -1664,7 +1664,8 @@ static void dw_mci_init_card(struct mmc_host *mmc, struct mmc_card *card)
> }
> }
>
> -static void __dw_mci_enable_sdio_irq(struct dw_mci_slot *slot, int enb)
> +static void __dw_mci_enable_sdio_irq(struct dw_mci_slot *slot, bool enb,
> + bool client_requested)
> {
> struct dw_mci *host = slot->host;
> unsigned long irqflags;
> @@ -1672,6 +1673,20 @@ static void __dw_mci_enable_sdio_irq(struct dw_mci_slot *slot, int enb)
>
> spin_lock_irqsave(&host->irq_lock, irqflags);
>
> + /*
> + * If we're being called directly from dw_mci_enable_sdio_irq()
> + * (which means that the client driver actually wants to enable or
> + * disable interrupts) then save the request. Otherwise this
> + * wasn't directly requested by the client and we should logically
> + * AND it with the client request since we want to disable if
> + * _either_ the client disabled OR we have some other reason to
> + * disable temporarily.
> + */
> + if (client_requested)
> + host->client_sdio_enb = enb;
> + else
> + enb &= host->client_sdio_enb;
> +
> /* Enable/disable Slot Specific SDIO interrupt */
> int_mask = mci_readl(host, INTMASK);
> if (enb)
> @@ -1688,7 +1703,7 @@ static void dw_mci_enable_sdio_irq(struct mmc_host *mmc, int enb)
> struct dw_mci_slot *slot = mmc_priv(mmc);
> struct dw_mci *host = slot->host;
>
> - __dw_mci_enable_sdio_irq(slot, enb);
> + __dw_mci_enable_sdio_irq(slot, enb, true);
>
> /* Avoid runtime suspending the device when SDIO IRQ is enabled */
> if (enb)
> @@ -1701,7 +1716,7 @@ static void dw_mci_ack_sdio_irq(struct mmc_host *mmc)
> {
> struct dw_mci_slot *slot = mmc_priv(mmc);
>
> - __dw_mci_enable_sdio_irq(slot, 1);
> + __dw_mci_enable_sdio_irq(slot, true, false);
> }
>
> static int dw_mci_execute_tuning(struct mmc_host *mmc, u32 opcode)
> @@ -2734,7 +2749,7 @@ static irqreturn_t dw_mci_interrupt(int irq, void *dev_id)
> if (pending & SDMMC_INT_SDIO(slot->sdio_id)) {
> mci_writel(host, RINTSTS,
> SDMMC_INT_SDIO(slot->sdio_id));
> - __dw_mci_enable_sdio_irq(slot, 0);
> + __dw_mci_enable_sdio_irq(slot, false, false);
> sdio_signal_irq(slot->mmc);
> }
>
> @@ -3424,6 +3439,8 @@ int dw_mci_runtime_suspend(struct device *dev)
> {
> struct dw_mci *host = dev_get_drvdata(dev);
>
> + __dw_mci_enable_sdio_irq(host->slot, false, false);
> +
> if (host->use_dma && host->dma_ops->exit)
> host->dma_ops->exit(host);
>
> @@ -3490,6 +3507,8 @@ int dw_mci_runtime_resume(struct device *dev)
> /* Now that slots are all setup, we can enable card detect */
> dw_mci_enable_cd(host);
>
> + __dw_mci_enable_sdio_irq(host->slot, true, false);
> +
> return 0;
>
> err:
> diff --git a/drivers/mmc/host/dw_mmc.h b/drivers/mmc/host/dw_mmc.h
> index 46e9f8ec5398..dfbace0f5043 100644
> --- a/drivers/mmc/host/dw_mmc.h
> +++ b/drivers/mmc/host/dw_mmc.h
> @@ -127,6 +127,7 @@ struct dw_mci_dma_slave {
> * @cmd11_timer: Timer for SD3.0 voltage switch over scheme.
> * @cto_timer: Timer for broken command transfer over scheme.
> * @dto_timer: Timer for broken data transfer over scheme.
> + * @client_sdio_enb: The value last passed to enable_sdio_irq.
> *
> * Locking
> * =======
> @@ -234,6 +235,8 @@ struct dw_mci {
> struct timer_list cmd11_timer;
> struct timer_list cto_timer;
> struct timer_list dto_timer;
> +
> + bool client_sdio_enb;
> };
>
> /* DMA ops for Internal/External DMAC interface */
> --
> 2.21.0.593.g511ec345e18-goog
>
^ permalink raw reply
* [PATCH v2] mmc: dw_mmc: Disable SDIO interrupts while suspended to fix suspend/resume
From: Douglas Anderson @ 2019-04-29 20:40 UTC (permalink / raw)
To: Jaehoon Chung, Ulf Hansson, Shawn Lin
Cc: Kalle Valo, heiko, linux-rockchip, Guenter Roeck, briannorris,
linux-wireless, Sonny Rao, Emil Renner Berthing, mka, ryandcase,
Douglas Anderson, stable, linux-mmc, linux-kernel
Processing SDIO interrupts while dw_mmc is suspended (or partly
suspended) seems like a bad idea. We really don't want to be
processing them until we've gotten ourselves fully powered up.
You might be wondering how it's even possible to become suspended when
an SDIO interrupt is active. As can be seen in
dw_mci_enable_sdio_irq(), we explicitly keep dw_mmc out of runtime
suspend when the SDIO interrupt is enabled. ...but even though we
stop normal runtime suspend transitions when SDIO interrupts are
enabled, the dw_mci_runtime_suspend() can still get called for a full
system suspend.
Let's handle all this by explicitly masking SDIO interrupts in the
suspend call and unmasking them later in the resume call. To do this
cleanly I'll keep track of whether the client requested that SDIO
interrupts be enabled so that we can reliably restore them regardless
of whether we're masking them for one reason or another.
It should be noted that if dw_mci_enable_sdio_irq() is never called
(for instance, if we don't have an SDIO card plugged in) that
"client_sdio_enb" will always be false. In those cases this patch
adds a tiny bit of overhead to suspend/resume (a spinlock and a
read/write of INTMASK) but other than that is a no-op. The
SDMMC_INT_SDIO bit should always be clear and clearing it again won't
hurt.
Without this fix it can be seen that rk3288-veyron Chromebooks with
Marvell WiFi would sometimes fail to resume WiFi even after picking my
recent mwifiex patch [1]. Specifically you'd see messages like this:
mwifiex_sdio mmc1:0001:1: Firmware wakeup failed
mwifiex_sdio mmc1:0001:1: PREP_CMD: FW in reset state
...and tracing through the resume code in the failing cases showed
that we were processing a SDIO interrupt really early in the resume
call.
NOTE: downstream in Chrome OS 3.14 and 3.18 kernels (both of which
support the Marvell SDIO WiFi card) we had a patch ("CHROMIUM: sdio:
Defer SDIO interrupt handling until after resume") [2]. Presumably
this is the same problem that was solved by that patch.
[1] https://lkml.kernel.org/r/20190404040106.40519-1-dianders@chromium.org
[2] https://crrev.com/c/230765
Cc: <stable@vger.kernel.org> # 4.14.x
Signed-off-by: Douglas Anderson <dianders@chromium.org>
---
I didn't put any "Fixes" tag here, but presumably this could be
backported to whichever kernels folks found it useful for. I have at
least confirmed that kernels v4.14 and v4.19 (as well as v5.1-rc2)
show the problem. It is very easy to pick this to v4.19 and it
definitely fixes the problem there.
I haven't spent the time to pick this to 4.14 myself, but presumably
it wouldn't be too hard to backport this as far as v4.13 since that
contains commit 32dba73772f8 ("mmc: dw_mmc: Convert to use
MMC_CAP2_SDIO_IRQ_NOTHREAD for SDIO IRQs"). Prior to that it might
make sense for anyone experiencing this problem to just pick the old
CHROMIUM patch to fix them.
Changes in v2:
- Suggested 4.14+ in the stable tag (Sasha-bot)
- Extra note that this is a noop on non-SDIO (Shawn / Emil)
- Make boolean logic cleaner as per https://crrev.com/c/1586207/1
- Hopefully clear comments as per https://crrev.com/c/1586207/1
drivers/mmc/host/dw_mmc.c | 27 +++++++++++++++++++++++----
drivers/mmc/host/dw_mmc.h | 3 +++
2 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 80dc2fd6576c..480067b87a94 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -1664,7 +1664,8 @@ static void dw_mci_init_card(struct mmc_host *mmc, struct mmc_card *card)
}
}
-static void __dw_mci_enable_sdio_irq(struct dw_mci_slot *slot, int enb)
+static void __dw_mci_enable_sdio_irq(struct dw_mci_slot *slot, bool enb,
+ bool client_requested)
{
struct dw_mci *host = slot->host;
unsigned long irqflags;
@@ -1672,6 +1673,20 @@ static void __dw_mci_enable_sdio_irq(struct dw_mci_slot *slot, int enb)
spin_lock_irqsave(&host->irq_lock, irqflags);
+ /*
+ * If we're being called directly from dw_mci_enable_sdio_irq()
+ * (which means that the client driver actually wants to enable or
+ * disable interrupts) then save the request. Otherwise this
+ * wasn't directly requested by the client and we should logically
+ * AND it with the client request since we want to disable if
+ * _either_ the client disabled OR we have some other reason to
+ * disable temporarily.
+ */
+ if (client_requested)
+ host->client_sdio_enb = enb;
+ else
+ enb &= host->client_sdio_enb;
+
/* Enable/disable Slot Specific SDIO interrupt */
int_mask = mci_readl(host, INTMASK);
if (enb)
@@ -1688,7 +1703,7 @@ static void dw_mci_enable_sdio_irq(struct mmc_host *mmc, int enb)
struct dw_mci_slot *slot = mmc_priv(mmc);
struct dw_mci *host = slot->host;
- __dw_mci_enable_sdio_irq(slot, enb);
+ __dw_mci_enable_sdio_irq(slot, enb, true);
/* Avoid runtime suspending the device when SDIO IRQ is enabled */
if (enb)
@@ -1701,7 +1716,7 @@ static void dw_mci_ack_sdio_irq(struct mmc_host *mmc)
{
struct dw_mci_slot *slot = mmc_priv(mmc);
- __dw_mci_enable_sdio_irq(slot, 1);
+ __dw_mci_enable_sdio_irq(slot, true, false);
}
static int dw_mci_execute_tuning(struct mmc_host *mmc, u32 opcode)
@@ -2734,7 +2749,7 @@ static irqreturn_t dw_mci_interrupt(int irq, void *dev_id)
if (pending & SDMMC_INT_SDIO(slot->sdio_id)) {
mci_writel(host, RINTSTS,
SDMMC_INT_SDIO(slot->sdio_id));
- __dw_mci_enable_sdio_irq(slot, 0);
+ __dw_mci_enable_sdio_irq(slot, false, false);
sdio_signal_irq(slot->mmc);
}
@@ -3424,6 +3439,8 @@ int dw_mci_runtime_suspend(struct device *dev)
{
struct dw_mci *host = dev_get_drvdata(dev);
+ __dw_mci_enable_sdio_irq(host->slot, false, false);
+
if (host->use_dma && host->dma_ops->exit)
host->dma_ops->exit(host);
@@ -3490,6 +3507,8 @@ int dw_mci_runtime_resume(struct device *dev)
/* Now that slots are all setup, we can enable card detect */
dw_mci_enable_cd(host);
+ __dw_mci_enable_sdio_irq(host->slot, true, false);
+
return 0;
err:
diff --git a/drivers/mmc/host/dw_mmc.h b/drivers/mmc/host/dw_mmc.h
index 46e9f8ec5398..dfbace0f5043 100644
--- a/drivers/mmc/host/dw_mmc.h
+++ b/drivers/mmc/host/dw_mmc.h
@@ -127,6 +127,7 @@ struct dw_mci_dma_slave {
* @cmd11_timer: Timer for SD3.0 voltage switch over scheme.
* @cto_timer: Timer for broken command transfer over scheme.
* @dto_timer: Timer for broken data transfer over scheme.
+ * @client_sdio_enb: The value last passed to enable_sdio_irq.
*
* Locking
* =======
@@ -234,6 +235,8 @@ struct dw_mci {
struct timer_list cmd11_timer;
struct timer_list cto_timer;
struct timer_list dto_timer;
+
+ bool client_sdio_enb;
};
/* DMA ops for Internal/External DMAC interface */
--
2.21.0.593.g511ec345e18-goog
^ permalink raw reply related
* [PATCH][next] mac80211_hwsim: mark expected switch fall-through
From: Gustavo A. R. Silva @ 2019-04-29 18:19 UTC (permalink / raw)
To: Johannes Berg, Kalle Valo, David S. Miller
Cc: linux-wireless, netdev, linux-kernel, Gustavo A. R. Silva,
Kees Cook
In preparation to enabling -Wimplicit-fallthrough, mark switch
cases where we are expecting to fall through.
This patch fixes the following warning:
drivers/net/wireless/mac80211_hwsim.c: In function ‘init_mac80211_hwsim’:
drivers/net/wireless/mac80211_hwsim.c:3853:21: warning: this statement may fall through [-Wimplicit-fallthrough=]
param.reg_strict = true;
~~~~~~~~~~~~~~~~~^~~~~~
drivers/net/wireless/mac80211_hwsim.c:3854:3: note: here
case HWSIM_REGTEST_DRIVER_REG_ALL:
^~~~
Warning level 3 was used: -Wimplicit-fallthrough=3
This patch is part of the ongoing efforts to enable
-Wimplicit-fallthrough.
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
drivers/net/wireless/mac80211_hwsim.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index 60ca13e0f15b..b5274d1f30fa 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -3851,6 +3851,7 @@ static int __init init_mac80211_hwsim(void)
break;
case HWSIM_REGTEST_STRICT_ALL:
param.reg_strict = true;
+ /* fall through */
case HWSIM_REGTEST_DRIVER_REG_ALL:
param.reg_alpha2 = hwsim_alpha2s[0];
break;
--
2.21.0
^ permalink raw reply related
* Re: pull-request: iwlwifi-next 2019-04-29
From: Kalle Valo @ 2019-04-29 17:58 UTC (permalink / raw)
To: Luca Coelho; +Cc: linux-wireless, linuxwifi, david.e.box, joe.konno
In-Reply-To: <491e2c7557a981d2e1a721ffe7571ec992dfe62d.camel@coelho.fi>
Luca Coelho <luca@coelho.fi> writes:
> This is the fourth batch of patches intended for v5.2. This includes
> the last patchset I sent. Usual development work. More details about
> the contents in the tag description.
>
> I have sent this out before and kbuildbot reported success.
>
> Please let me know if there are any issues.
>
> Cheers,
> Luca.
>
>
> The following changes since commit 9ef77fbedad9ea8895cd5d7fb7aee16071f527dc:
>
> brcmfmac: send mailbox interrupt twice for specific hardware device (2019-04-26 15:00:53 +0300)
>
> are available in the Git repository at:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-next.git tags/iwlwifi-next-for-kalle-2019-04-29
>
> for you to fetch changes up to a0eaead41db98c08614c4b1ef453bdfaacde962d:
>
> iwlwifi: dbg_ini: check for valid region type during regions parsing (2019-04-29 18:42:48 +0300)
>
> ----------------------------------------------------------------
> Fourth batch of patches intended for v5.2
>
> * Fix a bug we introduced in the RX path in a previous patch;
> * Add command version parsing from the FW TLVs;
> * Some fixes and improvements in the new debugging framework;
> * Bump the FW API supported for 22000 series;
> * Small improvement in FTM;
> * Some RF-Kill interrupt handling fixes;
> * Support for a new WoWLAN patterns FW API;
> * Other small fixes and improvements;
>
> ----------------------------------------------------------------
Pulled, thanks Luca.
--
Kalle Valo
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox