diff mbox

[v4,01/10] rtlwifi: Fill in_4way field by driver

Message ID 20170702181239.17911-2-Larry.Finger@lwfinger.net (mailing list archive)
State Accepted
Commit 11f35c9504669c9c3ff8108c3993a46197edddd3
Delegated to: Kalle Valo
Headers show

Commit Message

Larry Finger July 2, 2017, 6:12 p.m. UTC
From: Ping-Ke Shih <pkshih@realtek.com>

Because it isn't always correct to use EAPOL to check 4-way,
we add a timer to handle exception.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
---
v2 - no changes
v3 - no changes
v4 - no changes
---
 drivers/net/wireless/realtek/rtlwifi/base.c | 11 +++++++++++
 drivers/net/wireless/realtek/rtlwifi/core.c |  2 ++
 drivers/net/wireless/realtek/rtlwifi/wifi.h |  3 +++
 3 files changed, 16 insertions(+)

Comments

Kalle Valo July 25, 2017, 12:20 p.m. UTC | #1
Larry Finger <Larry.Finger@lwfinger.net> writes:

> From: Ping-Ke Shih <pkshih@realtek.com>
>
> Because it isn't always correct to use EAPOL to check 4-way,
> we add a timer to handle exception.
>
> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
> Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
> Cc: Birming Chiu <birming@realtek.com>
> Cc: Shaofu <shaofu@realtek.com>
> Cc: Steven Ting <steventing@realtek.com>
> ---
> v2 - no changes
> v3 - no changes
> v4 - no changes

BTW, for my sake you don't need to have changelogs for every patch. For
me it's enough (and what I also prefer) that the cover letter contains
the changelog.
Kalle Valo July 27, 2017, 9:54 a.m. UTC | #2
Larry Finger <Larry.Finger@lwfinger.net> writes:

> From: Ping-Ke Shih <pkshih@realtek.com>
>
> Because it isn't always correct to use EAPOL to check 4-way,
> we add a timer to handle exception.
>
> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
> Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
> Cc: Birming Chiu <birming@realtek.com>
> Cc: Shaofu <shaofu@realtek.com>
> Cc: Steven Ting <steventing@realtek.com>

[...]

> --- a/drivers/net/wireless/realtek/rtlwifi/base.c
> +++ b/drivers/net/wireless/realtek/rtlwifi/base.c
> @@ -1408,6 +1408,11 @@ u8 rtl_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx,
>  
>  		return true;
>  	} else if (ETH_P_PAE == ether_type) {
> +		/* EAPOL is seens as in-4way */
> +		rtlpriv->btcoexist.btc_info.in_4way = true;
> +		rtlpriv->btcoexist.btc_info.in_4way_ts = jiffies;
> +	rtlpriv->btcoexist.btc_info.in_4way_ts = jiffies;
> +
>  		RT_TRACE(rtlpriv, (COMP_SEND | COMP_RECV), DBG_DMESG,
>  			 "802.1X %s EAPOL pkt!!\n", (is_tx) ? "Tx" : "Rx");

The indentation looks wrong.
Arend van Spriel July 27, 2017, 9:56 a.m. UTC | #3
On 7/27/2017 11:54 AM, Kalle Valo wrote:
> Larry Finger <Larry.Finger@lwfinger.net> writes:
>
>> From: Ping-Ke Shih <pkshih@realtek.com>
>>
>> Because it isn't always correct to use EAPOL to check 4-way,
>> we add a timer to handle exception.
>>
>> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
>> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
>> Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
>> Cc: Birming Chiu <birming@realtek.com>
>> Cc: Shaofu <shaofu@realtek.com>
>> Cc: Steven Ting <steventing@realtek.com>
>
> [...]
>
>> --- a/drivers/net/wireless/realtek/rtlwifi/base.c
>> +++ b/drivers/net/wireless/realtek/rtlwifi/base.c
>> @@ -1408,6 +1408,11 @@ u8 rtl_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx,
>>
>>   		return true;
>>   	} else if (ETH_P_PAE == ether_type) {
>> +		/* EAPOL is seens as in-4way */
>> +		rtlpriv->btcoexist.btc_info.in_4way = true;
>> +		rtlpriv->btcoexist.btc_info.in_4way_ts = jiffies;
>> +	rtlpriv->btcoexist.btc_info.in_4way_ts = jiffies;
>> +
>>   		RT_TRACE(rtlpriv, (COMP_SEND | COMP_RECV), DBG_DMESG,
>>   			 "802.1X %s EAPOL pkt!!\n", (is_tx) ? "Tx" : "Rx");
>
> The indentation looks wrong.

That wrongly indented line seems a bit redundant anyway :-p

Regards,
Arend
Kalle Valo July 27, 2017, 10:08 a.m. UTC | #4
Arend van Spriel <arend.vanspriel@broadcom.com> writes:

> On 7/27/2017 11:54 AM, Kalle Valo wrote:
>> Larry Finger <Larry.Finger@lwfinger.net> writes:
>>
>>> From: Ping-Ke Shih <pkshih@realtek.com>
>>>
>>> Because it isn't always correct to use EAPOL to check 4-way,
>>> we add a timer to handle exception.
>>>
>>> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
>>> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
>>> Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
>>> Cc: Birming Chiu <birming@realtek.com>
>>> Cc: Shaofu <shaofu@realtek.com>
>>> Cc: Steven Ting <steventing@realtek.com>
>>
>> [...]
>>
>>> --- a/drivers/net/wireless/realtek/rtlwifi/base.c
>>> +++ b/drivers/net/wireless/realtek/rtlwifi/base.c
>>> @@ -1408,6 +1408,11 @@ u8 rtl_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx,
>>>
>>>   		return true;
>>>   	} else if (ETH_P_PAE == ether_type) {
>>> +		/* EAPOL is seens as in-4way */
>>> +		rtlpriv->btcoexist.btc_info.in_4way = true;
>>> +		rtlpriv->btcoexist.btc_info.in_4way_ts = jiffies;
>>> +	rtlpriv->btcoexist.btc_info.in_4way_ts = jiffies;
>>> +
>>>   		RT_TRACE(rtlpriv, (COMP_SEND | COMP_RECV), DBG_DMESG,
>>>   			 "802.1X %s EAPOL pkt!!\n", (is_tx) ? "Tx" : "Rx");
>>
>> The indentation looks wrong.
>
> That wrongly indented line seems a bit redundant anyway :-p

Heh, indeed :)
Kalle Valo July 28, 2017, 3:17 p.m. UTC | #5
Larry Finger <Larry.Finger@lwfinger.net> wrote:

> From: Ping-Ke Shih <pkshih@realtek.com>
> 
> Because it isn't always correct to use EAPOL to check 4-way,
> we add a timer to handle exception.
> 
> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
> Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
> Cc: Birming Chiu <birming@realtek.com>
> Cc: Shaofu <shaofu@realtek.com>
> Cc: Steven Ting <steventing@realtek.com>

8 patches applied to wireless-drivers-next.git, thanks.

11f35c950466 rtlwifi: Fill in_4way field by driver
6aad6075ccd5 rtlwifi: Add BT_MP_INFO to c2h handler.
881d53ab1f43 rtlwifi: Add board type for 8723be and 8192ee
ca0e657bda7e rtlwifi: add amplifier type for 8812ae
66970e38e544 rtlwifi: Update 8723be new phy parameters and its parser.
6ec9dfbc057c rtlwifi: Rename rtl_desc92_rate to rtl_desc_rate
e7c528615e34 rtlwifi: Uses addr1 instead DA to determine broadcast and multicast addr.
58438d9ae172 rtlwifi: move IS_HARDWARE_TYPE_xxx checker to wifi.h
Kalle Valo July 28, 2017, 3:20 p.m. UTC | #6
Kalle Valo <kvalo@codeaurora.org> writes:

> Larry Finger <Larry.Finger@lwfinger.net> wrote:
>
>> From: Ping-Ke Shih <pkshih@realtek.com>
>> 
>> Because it isn't always correct to use EAPOL to check 4-way,
>> we add a timer to handle exception.
>> 
>> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
>> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
>> Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
>> Cc: Birming Chiu <birming@realtek.com>
>> Cc: Shaofu <shaofu@realtek.com>
>> Cc: Steven Ting <steventing@realtek.com>
>
> 8 patches applied to wireless-drivers-next.git, thanks.
>
> 11f35c950466 rtlwifi: Fill in_4way field by driver
> 6aad6075ccd5 rtlwifi: Add BT_MP_INFO to c2h handler.
> 881d53ab1f43 rtlwifi: Add board type for 8723be and 8192ee
> ca0e657bda7e rtlwifi: add amplifier type for 8812ae
> 66970e38e544 rtlwifi: Update 8723be new phy parameters and its parser.
> 6ec9dfbc057c rtlwifi: Rename rtl_desc92_rate to rtl_desc_rate
> e7c528615e34 rtlwifi: Uses addr1 instead DA to determine broadcast and multicast addr.
> 58438d9ae172 rtlwifi: move IS_HARDWARE_TYPE_xxx checker to wifi.h

As you can see I applied the first 8 patches anyway because the backlog
of rtlwifi patches is quite long, I had over 40 pending patches in
patchwork. But please submit followup patches for the commented issues.

Of course the use of global variables is not urgent as it has been there
for years but that should be fixed eventually.
diff mbox

Patch

diff --git a/drivers/net/wireless/realtek/rtlwifi/base.c b/drivers/net/wireless/realtek/rtlwifi/base.c
index e36ee592c660..0c9cfb670cec 100644
--- a/drivers/net/wireless/realtek/rtlwifi/base.c
+++ b/drivers/net/wireless/realtek/rtlwifi/base.c
@@ -1408,6 +1408,11 @@  u8 rtl_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx,
 
 		return true;
 	} else if (ETH_P_PAE == ether_type) {
+		/* EAPOL is seens as in-4way */
+		rtlpriv->btcoexist.btc_info.in_4way = true;
+		rtlpriv->btcoexist.btc_info.in_4way_ts = jiffies;
+	rtlpriv->btcoexist.btc_info.in_4way_ts = jiffies;
+
 		RT_TRACE(rtlpriv, (COMP_SEND | COMP_RECV), DBG_DMESG,
 			 "802.1X %s EAPOL pkt!!\n", (is_tx) ? "Tx" : "Rx");
 
@@ -1959,6 +1964,12 @@  void rtl_watchdog_wq_callback(void *data)
 	if (rtlpriv->cfg->ops->get_btc_status())
 		rtlpriv->btcoexist.btc_ops->btc_periodical(rtlpriv);
 
+	if (rtlpriv->btcoexist.btc_info.in_4way) {
+		if (time_after(jiffies, rtlpriv->btcoexist.btc_info.in_4way_ts +
+			       msecs_to_jiffies(IN_4WAY_TIMEOUT_TIME)))
+			rtlpriv->btcoexist.btc_info.in_4way = false;
+	}
+
 	rtlpriv->link_info.bcn_rx_inperiod = 0;
 
 	/* <6> scan list */
diff --git a/drivers/net/wireless/realtek/rtlwifi/core.c b/drivers/net/wireless/realtek/rtlwifi/core.c
index b0ad061048c5..c53cbf3d52bd 100644
--- a/drivers/net/wireless/realtek/rtlwifi/core.c
+++ b/drivers/net/wireless/realtek/rtlwifi/core.c
@@ -1505,6 +1505,8 @@  static int rtl_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 	u8 mac_addr[ETH_ALEN];
 	u8 bcast_addr[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
 
+	rtlpriv->btcoexist.btc_info.in_4way = false;
+
 	if (rtlpriv->cfg->mod_params->sw_crypto || rtlpriv->sec.use_sw_sec) {
 		RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
 			 "not open hw encryption\n");
diff --git a/drivers/net/wireless/realtek/rtlwifi/wifi.h b/drivers/net/wireless/realtek/rtlwifi/wifi.h
index fb1ebb01133f..7ec0d502a0d9 100644
--- a/drivers/net/wireless/realtek/rtlwifi/wifi.h
+++ b/drivers/net/wireless/realtek/rtlwifi/wifi.h
@@ -2477,6 +2477,8 @@  struct rtl_global_var {
 	spinlock_t glb_list_lock;
 };
 
+#define IN_4WAY_TIMEOUT_TIME	(30 * MSEC_PER_SEC)	/* 30 seconds */
+
 struct rtl_btc_info {
 	u8 bt_type;
 	u8 btcoexist;
@@ -2485,6 +2487,7 @@  struct rtl_btc_info {
 
 	u8 ap_num;
 	bool in_4way;
+	unsigned long in_4way_ts;
 };
 
 struct bt_coexist_info {