From: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
To: Peter Chiu <chui-hao.chiu@mediatek.com>
Cc: Felix Fietkau <nbd@nbd.name>, Ryder Lee <ryder.Lee@mediatek.com>,
Evelyn Tsai <evelyn.tsai@mediatek.com>,
Shayne Chen <shayne.chen@mediatek.com>,
linux-wireless@vger.kernel.org,
linux-mediatek@lists.infradead.org
Subject: Re: [PATCH 3/4] mt76: mt7915: reject duplicated twt flows
Date: Thu, 5 May 2022 14:22:03 +0200 [thread overview]
Message-ID: <YnPBaw1d3nA791PP@lore-desk> (raw)
In-Reply-To: <20220505082554.16656-3-chui-hao.chiu@mediatek.com>
[-- Attachment #1: Type: text/plain, Size: 2310 bytes --]
> Reject twt flows with the same parameters to prevent some potential issues
> causing by duplicated establishment.
>
> Reviewed-by: Ryder Lee <ryder.lee@mediatek.com>
> Reviewed-by: Shayne Chen <shayne.chen@mediatek.com>
> Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
> ---
> .../net/wireless/mediatek/mt76/mt7915/mac.c | 31 +++++++++++++++++++
> 1 file changed, 31 insertions(+)
>
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
> index 94a1871fbf43..ff60a3d2d26d 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
> @@ -2601,6 +2601,34 @@ static int mt7915_mac_check_twt_req(struct ieee80211_twt_setup *twt)
> return 0;
> }
>
> +static inline bool
> +mt7915_mac_twt_param_equal(struct mt7915_sta *msta,
> + struct ieee80211_twt_params *twt_agrt)
nit: please do not use inline in .c files.
Regards,
Lorenzo
> +{
> + u16 type = le16_to_cpu(twt_agrt->req_type);
> + u8 exp;
> + int i;
> +
> + exp = FIELD_GET(IEEE80211_TWT_REQTYPE_WAKE_INT_EXP, type);
> + for (i = 0; i < MT7915_MAX_STA_TWT_AGRT; i++) {
> + struct mt7915_twt_flow *f;
> +
> + if (!(msta->twt.flowid_mask & BIT(i)))
> + continue;
> +
> + f = &msta->twt.flow[i];
> + if (f->duration == twt_agrt->min_twt_dur &&
> + f->mantissa == twt_agrt->mantissa &&
> + f->exp == exp &&
> + f->protection == !!(type & IEEE80211_TWT_REQTYPE_PROTECTION) &&
> + f->flowtype == !!(type & IEEE80211_TWT_REQTYPE_FLOWTYPE) &&
> + f->trigger == !!(type & IEEE80211_TWT_REQTYPE_TRIGGER))
> + return true;
> + }
> +
> + return false;
> +}
> +
> void mt7915_mac_add_twt_setup(struct ieee80211_hw *hw,
> struct ieee80211_sta *sta,
> struct ieee80211_twt_setup *twt)
> @@ -2634,6 +2662,9 @@ void mt7915_mac_add_twt_setup(struct ieee80211_hw *hw,
> exp = FIELD_GET(IEEE80211_TWT_REQTYPE_WAKE_INT_EXP, req_type);
> sta_setup_cmd = FIELD_GET(IEEE80211_TWT_REQTYPE_SETUP_CMD, req_type);
>
> + if (mt7915_mac_twt_param_equal(msta, twt_agrt))
> + goto unlock;
> +
> flow = &msta->twt.flow[flowid];
> memset(flow, 0, sizeof(*flow));
> INIT_LIST_HEAD(&flow->list);
> --
> 2.18.0
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2022-05-05 12:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-05 8:25 [PATCH 1/4] mt76: mt7915: update mt7986 patch in mt7986_wmac_adie_patch_7976() Peter Chiu
2022-05-05 8:25 ` [PATCH 2/4] mt76: mt7915: fix twt table_mask to u16 in mt7915_dev Peter Chiu
2022-05-05 8:25 ` [PATCH 3/4] mt76: mt7915: reject duplicated twt flows Peter Chiu
2022-05-05 12:22 ` Lorenzo Bianconi [this message]
2022-05-05 12:26 ` Felix Fietkau
2022-05-05 8:25 ` [PATCH 4/4] mt76: mt7915: limit minimum twt duration Peter Chiu
2022-05-05 12:23 ` Lorenzo Bianconi
2022-05-05 12:28 ` Felix Fietkau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YnPBaw1d3nA791PP@lore-desk \
--to=lorenzo.bianconi@redhat.com \
--cc=chui-hao.chiu@mediatek.com \
--cc=evelyn.tsai@mediatek.com \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
--cc=nbd@nbd.name \
--cc=ryder.Lee@mediatek.com \
--cc=shayne.chen@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox