diff mbox

rtl8192cu : add support to send beacon frame.

Message ID 1421736594-28262-1-git-send-email-ap420073@gmail.com (mailing list archive)
State Changes Requested
Delegated to: Kalle Valo
Headers show

Commit Message

Taehee Yoo Jan. 20, 2015, 6:49 a.m. UTC
In AP mode, beacon frame is necessary to keep connection.
this patch adds a sending beacon frame routine in initialize routine.

Signed-off-by: Taehee Yoo <ap420073@gmail.com>
---
 drivers/net/wireless/rtlwifi/core.c          |  3 +++
 drivers/net/wireless/rtlwifi/rtl8192cu/sw.c  |  1 +
 drivers/net/wireless/rtlwifi/rtl8192cu/trx.c | 11 +++++++++++
 drivers/net/wireless/rtlwifi/rtl8192cu/trx.h |  1 +
 drivers/net/wireless/rtlwifi/wifi.h          |  2 ++
 5 files changed, 18 insertions(+)

Comments

Larry Finger Jan. 20, 2015, 6:33 p.m. UTC | #1
On 01/20/2015 12:49 AM, Taehee Yoo wrote:
> In AP mode, beacon frame is necessary to keep connection.
> this patch adds a sending beacon frame routine in initialize routine.
>
> Signed-off-by: Taehee Yoo <ap420073@gmail.com>
> ---
>   drivers/net/wireless/rtlwifi/core.c          |  3 +++
>   drivers/net/wireless/rtlwifi/rtl8192cu/sw.c  |  1 +
>   drivers/net/wireless/rtlwifi/rtl8192cu/trx.c | 11 +++++++++++
>   drivers/net/wireless/rtlwifi/rtl8192cu/trx.h |  1 +
>   drivers/net/wireless/rtlwifi/wifi.h          |  2 ++
>   5 files changed, 18 insertions(+)

This patch has a couple of issues reported by checkpatch.pl. These are noted 
inline. It will also have a conflict with "[PATCH V2 for 3.19 2/7] rtlwifi: 
rtl8192ee: Fix handling of new style descriptors" that I submitted today. As I 
note later, this conflict can be avoided and the patch should be made more general.

>
> diff --git a/drivers/net/wireless/rtlwifi/core.c b/drivers/net/wireless/rtlwifi/core.c
> index eb20316..2ebd1fd 100644
> --- a/drivers/net/wireless/rtlwifi/core.c
> +++ b/drivers/net/wireless/rtlwifi/core.c
> @@ -1040,6 +1040,9 @@ static void rtl_op_bss_info_changed(struct ieee80211_hw *hw,
>
>   				if (rtlpriv->cfg->ops->linked_set_reg)
>   					rtlpriv->cfg->ops->linked_set_reg(hw);
> +				if (rtlpriv->cfg->ops->set_bcn_frame)
> +					rtlpriv->cfg->ops->set_bcn_frame(hw,
> +							vif);
>   			}
>   		}
>   		if ((changed & BSS_CHANGED_BEACON_ENABLED &&
> diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
> index 90a714c..d88ee35 100644
> --- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
> +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
> @@ -155,6 +155,7 @@ static struct rtl_hal_ops rtl8192cu_hal_ops = {
>   	.dm_dynamic_txpower = rtl92cu_dm_dynamic_txpower,
>   	.fill_h2c_cmd = rtl92c_fill_h2c_cmd,
>   	.get_btc_status = rtl92cu_get_btc_status,
> +	.set_bcn_frame = rtl92cu_set_bcn_frame,
>   };
>
>   static struct rtl_mod_params rtl92cu_mod_params = {
> diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c
> index cbead00..e27da8f 100644
> --- a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c
> +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c
> @@ -684,3 +684,14 @@ bool rtl92cu_cmd_send_packet(struct ieee80211_hw *hw, struct sk_buff *skb)
>   {
>   	return true;
>   }
> +
> +void rtl92cu_set_bcn_frame(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
> +{
> +	struct rtl_priv *rtlpriv = rtl_priv(hw);
> +	struct sk_buff *skb = ieee80211_beacon_get(hw, vif);
> +
> +	if (skb == NULL)
> +		return;

Checkpatch wants this to be "if (!skb)".

> +
> +	rtlpriv->intf_ops->adapter_tx(hw, NULL, skb, NULL);
> +}
> diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.h b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.h
> index fd8051d..0d57431 100644
> --- a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.h
> +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.h
> @@ -431,5 +431,6 @@ void rtl92cu_tx_fill_cmddesc(struct ieee80211_hw *hw,
>   			     u8 *pdesc, bool b_firstseg,
>   			     bool b_lastseg, struct sk_buff *skb);
>   bool rtl92cu_cmd_send_packet(struct ieee80211_hw *hw, struct sk_buff *skb);
> +void rtl92cu_set_bcn_frame(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
>
>   #endif
> diff --git a/drivers/net/wireless/rtlwifi/wifi.h b/drivers/net/wireless/rtlwifi/wifi.h
> index b53d9dd..daf8142 100644
> --- a/drivers/net/wireless/rtlwifi/wifi.h
> +++ b/drivers/net/wireless/rtlwifi/wifi.h
> @@ -2182,6 +2182,8 @@ struct rtl_hal_ops {
>   	void (*add_wowlan_pattern)(struct ieee80211_hw *hw,
>   				   struct rtl_wow_pattern *rtl_pattern,
>   				   u8 index);
> +	void (*set_bcn_frame) (struct ieee80211_hw *hw,

Checkpatch warns about the space before the function pointer arguments.

> +			       struct ieee80211_vif *vif);
>   };
>
>   struct rtl_intf_ops {
>

As all of the drivers that use rtlwifi will be helped by this routine, I suggest 
that you rename your new routine rtl92cu_set_bcn_frame() to send_bcn_frame(), 
make it static, and add it to core.c just before rtl_op_bss_info_changed(). It 
can then be called directly, none of the device-specific drivers need be 
modified, yet all will use it.

Thanks,

Larry

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Taehee Yoo Jan. 21, 2015, 4:59 a.m. UTC | #2
2015-01-21 3:33 GMT+09:00 Larry Finger <Larry.Finger@lwfinger.net>:
>
> On 01/20/2015 12:49 AM, Taehee Yoo wrote:
>>
>> In AP mode, beacon frame is necessary to keep connection.
>> this patch adds a sending beacon frame routine in initialize routine.
>>
>> Signed-off-by: Taehee Yoo <ap420073@gmail.com>
>> ---
>>   drivers/net/wireless/rtlwifi/core.c          |  3 +++
>>   drivers/net/wireless/rtlwifi/rtl8192cu/sw.c  |  1 +
>>   drivers/net/wireless/rtlwifi/rtl8192cu/trx.c | 11 +++++++++++
>>   drivers/net/wireless/rtlwifi/rtl8192cu/trx.h |  1 +
>>   drivers/net/wireless/rtlwifi/wifi.h          |  2 ++
>>   5 files changed, 18 insertions(+)
>
>
> This patch has a couple of issues reported by checkpatch.pl. These are noted inline. It will also have a conflict with "[PATCH V2 for 3.19 2/7] rtlwifi: rtl8192ee: Fix handling of new style descriptors" that I submitted today. As I note later, this conflict can be avoided and the patch should be made more general.
>
>
>>
>> diff --git a/drivers/net/wireless/rtlwifi/core.c b/drivers/net/wireless/rtlwifi/core.c
>> index eb20316..2ebd1fd 100644
>> --- a/drivers/net/wireless/rtlwifi/core.c
>> +++ b/drivers/net/wireless/rtlwifi/core.c
>> @@ -1040,6 +1040,9 @@ static void rtl_op_bss_info_changed(struct ieee80211_hw *hw,
>>
>>                                 if (rtlpriv->cfg->ops->linked_set_reg)
>>                                         rtlpriv->cfg->ops->linked_set_reg(hw);
>> +                               if (rtlpriv->cfg->ops->set_bcn_frame)
>> +                                       rtlpriv->cfg->ops->set_bcn_frame(hw,
>> +                                                       vif);
>>                         }
>>                 }
>>                 if ((changed & BSS_CHANGED_BEACON_ENABLED &&
>> diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
>> index 90a714c..d88ee35 100644
>> --- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
>> +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
>> @@ -155,6 +155,7 @@ static struct rtl_hal_ops rtl8192cu_hal_ops = {
>>         .dm_dynamic_txpower = rtl92cu_dm_dynamic_txpower,
>>         .fill_h2c_cmd = rtl92c_fill_h2c_cmd,
>>         .get_btc_status = rtl92cu_get_btc_status,
>> +       .set_bcn_frame = rtl92cu_set_bcn_frame,
>>   };
>>
>>   static struct rtl_mod_params rtl92cu_mod_params = {
>> diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c
>> index cbead00..e27da8f 100644
>> --- a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c
>> +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c
>> @@ -684,3 +684,14 @@ bool rtl92cu_cmd_send_packet(struct ieee80211_hw *hw, struct sk_buff *skb)
>>   {
>>         return true;
>>   }
>> +
>> +void rtl92cu_set_bcn_frame(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
>> +{
>> +       struct rtl_priv *rtlpriv = rtl_priv(hw);
>> +       struct sk_buff *skb = ieee80211_beacon_get(hw, vif);
>> +
>> +       if (skb == NULL)
>> +               return;
>
>
> Checkpatch wants this to be "if (!skb)".
>
>> +
>> +       rtlpriv->intf_ops->adapter_tx(hw, NULL, skb, NULL);
>> +}
>> diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.h b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.h
>> index fd8051d..0d57431 100644
>> --- a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.h
>> +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.h
>> @@ -431,5 +431,6 @@ void rtl92cu_tx_fill_cmddesc(struct ieee80211_hw *hw,
>>                              u8 *pdesc, bool b_firstseg,
>>                              bool b_lastseg, struct sk_buff *skb);
>>   bool rtl92cu_cmd_send_packet(struct ieee80211_hw *hw, struct sk_buff *skb);
>> +void rtl92cu_set_bcn_frame(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
>>
>>   #endif
>> diff --git a/drivers/net/wireless/rtlwifi/wifi.h b/drivers/net/wireless/rtlwifi/wifi.h
>> index b53d9dd..daf8142 100644
>> --- a/drivers/net/wireless/rtlwifi/wifi.h
>> +++ b/drivers/net/wireless/rtlwifi/wifi.h
>> @@ -2182,6 +2182,8 @@ struct rtl_hal_ops {
>>         void (*add_wowlan_pattern)(struct ieee80211_hw *hw,
>>                                    struct rtl_wow_pattern *rtl_pattern,
>>                                    u8 index);
>> +       void (*set_bcn_frame) (struct ieee80211_hw *hw,
>
>
> Checkpatch warns about the space before the function pointer arguments.
>
>> +                              struct ieee80211_vif *vif);
>>   };
>>
>>   struct rtl_intf_ops {
>>
>
> As all of the drivers that use rtlwifi will be helped by this routine, I suggest that you rename your new routine rtl92cu_set_bcn_frame() to send_bcn_frame(), make it static, and add it to core.c just before rtl_op_bss_info_changed(). It can then be called directly, none of the device-specific drivers need be modified, yet all will use it.
>
> Thanks,
>
> Larry
>


I will send a modified patch as rtlwifi.


Thanks!
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/wireless/rtlwifi/core.c b/drivers/net/wireless/rtlwifi/core.c
index eb20316..2ebd1fd 100644
--- a/drivers/net/wireless/rtlwifi/core.c
+++ b/drivers/net/wireless/rtlwifi/core.c
@@ -1040,6 +1040,9 @@  static void rtl_op_bss_info_changed(struct ieee80211_hw *hw,
 
 				if (rtlpriv->cfg->ops->linked_set_reg)
 					rtlpriv->cfg->ops->linked_set_reg(hw);
+				if (rtlpriv->cfg->ops->set_bcn_frame)
+					rtlpriv->cfg->ops->set_bcn_frame(hw,
+							vif);
 			}
 		}
 		if ((changed & BSS_CHANGED_BEACON_ENABLED &&
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
index 90a714c..d88ee35 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
@@ -155,6 +155,7 @@  static struct rtl_hal_ops rtl8192cu_hal_ops = {
 	.dm_dynamic_txpower = rtl92cu_dm_dynamic_txpower,
 	.fill_h2c_cmd = rtl92c_fill_h2c_cmd,
 	.get_btc_status = rtl92cu_get_btc_status,
+	.set_bcn_frame = rtl92cu_set_bcn_frame,
 };
 
 static struct rtl_mod_params rtl92cu_mod_params = {
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c
index cbead00..e27da8f 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c
@@ -684,3 +684,14 @@  bool rtl92cu_cmd_send_packet(struct ieee80211_hw *hw, struct sk_buff *skb)
 {
 	return true;
 }
+
+void rtl92cu_set_bcn_frame(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
+{
+	struct rtl_priv *rtlpriv = rtl_priv(hw);
+	struct sk_buff *skb = ieee80211_beacon_get(hw, vif);
+
+	if (skb == NULL)
+		return;
+
+	rtlpriv->intf_ops->adapter_tx(hw, NULL, skb, NULL);
+}
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.h b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.h
index fd8051d..0d57431 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.h
@@ -431,5 +431,6 @@  void rtl92cu_tx_fill_cmddesc(struct ieee80211_hw *hw,
 			     u8 *pdesc, bool b_firstseg,
 			     bool b_lastseg, struct sk_buff *skb);
 bool rtl92cu_cmd_send_packet(struct ieee80211_hw *hw, struct sk_buff *skb);
+void rtl92cu_set_bcn_frame(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
 
 #endif
diff --git a/drivers/net/wireless/rtlwifi/wifi.h b/drivers/net/wireless/rtlwifi/wifi.h
index b53d9dd..daf8142 100644
--- a/drivers/net/wireless/rtlwifi/wifi.h
+++ b/drivers/net/wireless/rtlwifi/wifi.h
@@ -2182,6 +2182,8 @@  struct rtl_hal_ops {
 	void (*add_wowlan_pattern)(struct ieee80211_hw *hw,
 				   struct rtl_wow_pattern *rtl_pattern,
 				   u8 index);
+	void (*set_bcn_frame) (struct ieee80211_hw *hw,
+			       struct ieee80211_vif *vif);
 };
 
 struct rtl_intf_ops {