* [PATCH] staging: rtl8188eu: core: rtw_xmit: Use macros instead of constants
@ 2016-09-28 21:07 Georgiana Rodica Chelu
2016-09-28 21:15 ` [Outreachy kernel] " Julia Lawall
2016-09-28 21:19 ` Georgiana Chelu
0 siblings, 2 replies; 4+ messages in thread
From: Georgiana Rodica Chelu @ 2016-09-28 21:07 UTC (permalink / raw)
To: outreachy-kernel; +Cc: gregkh
Replace the 0x888e with ETH_P_PAE and 0x0806 with ETH_P_ARP.
These macros can be found in drivers/staging/rtl8192e/rtllib.h
Hexadecimal numbers are not case sensitive,
therefore 0x888e is equal with 0x888E.
The modifications improve the readability of the code.
Signed-off-by: Georgiana Rodica Chelu <georgiana.chelu93@gmail.com>
---
drivers/staging/rtl8188eu/core/rtw_xmit.c | 12 ++++++------
drivers/staging/rtl8192e/rtllib.h | 2 +-
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c b/drivers/staging/rtl8188eu/core/rtw_xmit.c
index 1392899..0f8b8e0 100644
--- a/drivers/staging/rtl8188eu/core/rtw_xmit.c
+++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c
@@ -402,7 +402,7 @@ static void set_qos(struct pkt_file *ppktfile, struct pkt_attrib *pattrib)
_rtw_pktfile_read(ppktfile, (u8 *)&ip_hdr, sizeof(ip_hdr));
/* user_prio = (ntohs(ip_hdr.tos) >> 5) & 0x3; */
user_prio = ip_hdr.tos >> 5;
- } else if (pattrib->ether_type == 0x888e) {
+ } else if (pattrib->ether_type == ETH_P_PAE) {
/* "When priority processing of data frames is supported, */
/* a STA's SME should send EAPOL-Key frames at the highest priority." */
user_prio = 7;
@@ -469,15 +469,15 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p
}
}
}
- } else if (pattrib->ether_type == 0x888e) {
+ } else if (pattrib->ether_type == ETH_P_PAE) {
DBG_88E_LEVEL(_drv_info_, "send eapol packet\n");
}
- if ((pattrib->ether_type == 0x888e) || (pattrib->dhcp_pkt == 1))
+ if ((pattrib->ether_type == ETH_P_PAE) || (pattrib->dhcp_pkt == 1))
rtw_set_scan_deny(padapter, 3000);
/* If EAPOL , ARP , OR DHCP packet, driver must be in active mode. */
- if ((pattrib->ether_type == 0x0806) || (pattrib->ether_type == 0x888e) || (pattrib->dhcp_pkt == 1))
+ if ((pattrib->ether_type == ETH_P_ARP) || (pattrib->ether_type == ETH_P_PAE) || (pattrib->dhcp_pkt == 1))
rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_SPECIAL_PACKET, 1);
bmcast = IS_MCAST(pattrib->ra);
@@ -531,8 +531,8 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p
pattrib->encrypt = 0;
- if ((pattrib->ether_type != 0x888e) && !check_fwstate(pmlmepriv, WIFI_MP_STATE)) {
- RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, ("\npsta->ieee8021x_blocked == true, pattrib->ether_type(%.4x) != 0x888e\n", pattrib->ether_type));
+ if ((pattrib->ether_type != ETH_P_PAE) && !check_fwstate(pmlmepriv, WIFI_MP_STATE)) {
+ RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, ("\npsta->ieee8021x_blocked == true, pattrib->ether_type(%.4x) != ETH_P_PAE\n", pattrib->ether_type));
res = _FAIL;
goto exit;
}
diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h
index 38247fa..b895a53 100644
--- a/drivers/staging/rtl8192e/rtllib.h
+++ b/drivers/staging/rtl8192e/rtllib.h
@@ -521,7 +521,7 @@ enum wireless_mode {
};
#ifndef ETH_P_PAE
-#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
+#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
#define ETH_P_IP 0x0800 /* Internet Protocol packet */
#define ETH_P_ARP 0x0806 /* Address Resolution packet */
#endif /* ETH_P_PAE */
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Outreachy kernel] [PATCH] staging: rtl8188eu: core: rtw_xmit: Use macros instead of constants
2016-09-28 21:07 [PATCH] staging: rtl8188eu: core: rtw_xmit: Use macros instead of constants Georgiana Rodica Chelu
@ 2016-09-28 21:15 ` Julia Lawall
2016-09-28 21:19 ` Georgiana Chelu
1 sibling, 0 replies; 4+ messages in thread
From: Julia Lawall @ 2016-09-28 21:15 UTC (permalink / raw)
To: Georgiana Rodica Chelu; +Cc: outreachy-kernel, gregkh
On Thu, 29 Sep 2016, Georgiana Rodica Chelu wrote:
> Replace the 0x888e with ETH_P_PAE and 0x0806 with ETH_P_ARP.
> These macros can be found in drivers/staging/rtl8192e/rtllib.h
>
> Hexadecimal numbers are not case sensitive,
> therefore 0x888e is equal with 0x888E.
It could be good to cite some evidence that these are really the right
values, and don't just coincidentally have the same value. You could look
for ether_type being combined with these values elsewhere in the kernel
(not just staging).
julia
>
> The modifications improve the readability of the code.
>
> Signed-off-by: Georgiana Rodica Chelu <georgiana.chelu93@gmail.com>
> ---
> drivers/staging/rtl8188eu/core/rtw_xmit.c | 12 ++++++------
> drivers/staging/rtl8192e/rtllib.h | 2 +-
> 2 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c b/drivers/staging/rtl8188eu/core/rtw_xmit.c
> index 1392899..0f8b8e0 100644
> --- a/drivers/staging/rtl8188eu/core/rtw_xmit.c
> +++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c
> @@ -402,7 +402,7 @@ static void set_qos(struct pkt_file *ppktfile, struct pkt_attrib *pattrib)
> _rtw_pktfile_read(ppktfile, (u8 *)&ip_hdr, sizeof(ip_hdr));
> /* user_prio = (ntohs(ip_hdr.tos) >> 5) & 0x3; */
> user_prio = ip_hdr.tos >> 5;
> - } else if (pattrib->ether_type == 0x888e) {
> + } else if (pattrib->ether_type == ETH_P_PAE) {
> /* "When priority processing of data frames is supported, */
> /* a STA's SME should send EAPOL-Key frames at the highest priority." */
> user_prio = 7;
> @@ -469,15 +469,15 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p
> }
> }
> }
> - } else if (pattrib->ether_type == 0x888e) {
> + } else if (pattrib->ether_type == ETH_P_PAE) {
> DBG_88E_LEVEL(_drv_info_, "send eapol packet\n");
> }
>
> - if ((pattrib->ether_type == 0x888e) || (pattrib->dhcp_pkt == 1))
> + if ((pattrib->ether_type == ETH_P_PAE) || (pattrib->dhcp_pkt == 1))
> rtw_set_scan_deny(padapter, 3000);
>
> /* If EAPOL , ARP , OR DHCP packet, driver must be in active mode. */
> - if ((pattrib->ether_type == 0x0806) || (pattrib->ether_type == 0x888e) || (pattrib->dhcp_pkt == 1))
> + if ((pattrib->ether_type == ETH_P_ARP) || (pattrib->ether_type == ETH_P_PAE) || (pattrib->dhcp_pkt == 1))
> rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_SPECIAL_PACKET, 1);
>
> bmcast = IS_MCAST(pattrib->ra);
> @@ -531,8 +531,8 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p
>
> pattrib->encrypt = 0;
>
> - if ((pattrib->ether_type != 0x888e) && !check_fwstate(pmlmepriv, WIFI_MP_STATE)) {
> - RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, ("\npsta->ieee8021x_blocked == true, pattrib->ether_type(%.4x) != 0x888e\n", pattrib->ether_type));
> + if ((pattrib->ether_type != ETH_P_PAE) && !check_fwstate(pmlmepriv, WIFI_MP_STATE)) {
> + RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, ("\npsta->ieee8021x_blocked == true, pattrib->ether_type(%.4x) != ETH_P_PAE\n", pattrib->ether_type));
> res = _FAIL;
> goto exit;
> }
> diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h
> index 38247fa..b895a53 100644
> --- a/drivers/staging/rtl8192e/rtllib.h
> +++ b/drivers/staging/rtl8192e/rtllib.h
> @@ -521,7 +521,7 @@ enum wireless_mode {
> };
>
> #ifndef ETH_P_PAE
> -#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
> +#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
> #define ETH_P_IP 0x0800 /* Internet Protocol packet */
> #define ETH_P_ARP 0x0806 /* Address Resolution packet */
> #endif /* ETH_P_PAE */
> --
> 2.7.4
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20160928210715.GA26545%40fireworks.
> For more options, visit https://groups.google.com/d/optout.
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] staging: rtl8188eu: core: rtw_xmit: Use macros instead of constants
2016-09-28 21:07 [PATCH] staging: rtl8188eu: core: rtw_xmit: Use macros instead of constants Georgiana Rodica Chelu
2016-09-28 21:15 ` [Outreachy kernel] " Julia Lawall
@ 2016-09-28 21:19 ` Georgiana Chelu
2016-09-28 21:29 ` [Outreachy kernel] " Julia Lawall
1 sibling, 1 reply; 4+ messages in thread
From: Georgiana Chelu @ 2016-09-28 21:19 UTC (permalink / raw)
To: outreachy-kernel; +Cc: gregkh
[-- Attachment #1.1: Type: text/plain, Size: 4331 bytes --]
I have some doubts about changing the constant with
a string in the 531 line. My opinion is to let this line
unchanged.
Any help?
Also, I forgot to replace the constant from 398 line,
so I will submit the second version of the patch soon.
Georgiana
On Thursday, 29 September 2016 00:07:17 UTC+3, Georgiana Chelu wrote:
>
> Replace the 0x888e with ETH_P_PAE and 0x0806 with ETH_P_ARP.
> These macros can be found in drivers/staging/rtl8192e/rtllib.h
>
> Hexadecimal numbers are not case sensitive,
> therefore 0x888e is equal with 0x888E.
>
> The modifications improve the readability of the code.
>
> Signed-off-by: Georgiana Rodica Chelu <georgiana.chelu93@gmail.com>
> ---
> drivers/staging/rtl8188eu/core/rtw_xmit.c | 12 ++++++------
> drivers/staging/rtl8192e/rtllib.h | 2 +-
> 2 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c
> b/drivers/staging/rtl8188eu/core/rtw_xmit.c
> index 1392899..0f8b8e0 100644
> --- a/drivers/staging/rtl8188eu/core/rtw_xmit.c
> +++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c
> @@ -402,7 +402,7 @@ static void set_qos(struct pkt_file *ppktfile, struct
> pkt_attrib *pattrib)
> _rtw_pktfile_read(ppktfile, (u8 *)&ip_hdr,
> sizeof(ip_hdr));
> /* user_prio = (ntohs(ip_hdr.tos) >> 5) & 0x3; */
> user_prio = ip_hdr.tos >> 5;
> - } else if (pattrib->ether_type == 0x888e) {
> + } else if (pattrib->ether_type == ETH_P_PAE) {
> /* "When priority processing of data frames is
> supported, */
> /* a STA's SME should send EAPOL-Key frames at the
> highest priority." */
> user_prio = 7;
> @@ -469,15 +469,15 @@ static s32 update_attrib(struct adapter *padapter,
> struct sk_buff *pkt, struct p
> }
> }
> }
> - } else if (pattrib->ether_type == 0x888e) {
> + } else if (pattrib->ether_type == ETH_P_PAE) {
> DBG_88E_LEVEL(_drv_info_, "send eapol packet\n");
> }
>
> - if ((pattrib->ether_type == 0x888e) || (pattrib->dhcp_pkt == 1))
> + if ((pattrib->ether_type == ETH_P_PAE) || (pattrib->dhcp_pkt ==
> 1))
> rtw_set_scan_deny(padapter, 3000);
>
> /* If EAPOL , ARP , OR DHCP packet, driver must be in active
> mode. */
> - if ((pattrib->ether_type == 0x0806) || (pattrib->ether_type ==
> 0x888e) || (pattrib->dhcp_pkt == 1))
> + if ((pattrib->ether_type == ETH_P_ARP) || (pattrib->ether_type ==
> ETH_P_PAE) || (pattrib->dhcp_pkt == 1))
> rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_SPECIAL_PACKET,
> 1);
>
> bmcast = IS_MCAST(pattrib->ra);
> @@ -531,8 +531,8 @@ static s32 update_attrib(struct adapter *padapter,
> struct sk_buff *pkt, struct p
>
> pattrib->encrypt = 0;
>
> - if ((pattrib->ether_type != 0x888e) &&
> !check_fwstate(pmlmepriv, WIFI_MP_STATE)) {
> - RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_,
> ("\npsta->ieee8021x_blocked == true, pattrib->ether_type(%.4x) !=
> 0x888e\n", pattrib->ether_type));
> + if ((pattrib->ether_type != ETH_P_PAE) &&
> !check_fwstate(pmlmepriv, WIFI_MP_STATE)) {
> + RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_,
> ("\npsta->ieee8021x_blocked == true, pattrib->ether_type(%.4x) !=
> ETH_P_PAE\n", pattrib->ether_type));
> res = _FAIL;
> goto exit;
> }
> diff --git a/drivers/staging/rtl8192e/rtllib.h
> b/drivers/staging/rtl8192e/rtllib.h
> index 38247fa..b895a53 100644
> --- a/drivers/staging/rtl8192e/rtllib.h
> +++ b/drivers/staging/rtl8192e/rtllib.h
> @@ -521,7 +521,7 @@ enum wireless_mode {
> };
>
> #ifndef ETH_P_PAE
> -#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
> +#define ETH_P_PAE 0x888E /* Port Access Entity
> (IEEE 802.1X) */
> #define ETH_P_IP 0x0800 /* Internet Protocol
> packet */
> #define ETH_P_ARP 0x0806 /* Address Resolution
> packet */
> #endif /* ETH_P_PAE */
> --
> 2.7.4
>
>
[-- Attachment #1.2: Type: text/html, Size: 5712 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Outreachy kernel] Re: [PATCH] staging: rtl8188eu: core: rtw_xmit: Use macros instead of constants
2016-09-28 21:19 ` Georgiana Chelu
@ 2016-09-28 21:29 ` Julia Lawall
0 siblings, 0 replies; 4+ messages in thread
From: Julia Lawall @ 2016-09-28 21:29 UTC (permalink / raw)
To: Georgiana Chelu; +Cc: outreachy-kernel, gregkh
[-- Attachment #1: Type: TEXT/PLAIN, Size: 6214 bytes --]
On Wed, 28 Sep 2016, Georgiana Chelu wrote:
>
> I have some doubts about changing the constant with
> a string in the 531 line. My opinion is to let this line
> unchanged.
>
> Any help?
Maybe move ETH_P_PAE into the argument list? Then if this value changes
for some reason in the future, the code will be robust.
You could also reformat the code in that hunk that you are changing so
that it better respects the 80 character limit. If it seems unnatural,
you don't have to respect that perfectly, but there is no need for the
code to extend as far to the right as it does now.
julia
>
> Also, I forgot to replace the constant from 398 line,
> so I will submit the second version of the patch soon.
>
> Georgiana
>
>
> On Thursday, 29 September 2016 00:07:17 UTC+3, Georgiana Chelu wrote:
> Replace the 0x888e with ETH_P_PAE and 0x0806 with ETH_P_ARP.
> These macros can be found in drivers/staging/rtl8192e/rtllib.h
>
> Hexadecimal numbers are not case sensitive,
> therefore 0x888e is equal with 0x888E.
>
> The modifications improve the readability of the code.
>
> Signed-off-by: Georgiana Rodica Chelu <georgiana.chelu93@gmail.com>
> ---
> drivers/staging/rtl8188eu/core/rtw_xmit.c | 12 ++++++------
> drivers/staging/rtl8192e/rtllib.h | 2 +-
> 2 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c b/drivers/staging/rtl8188eu/core/rtw_xmit.c
> index 1392899..0f8b8e0 100644
> --- a/drivers/staging/rtl8188eu/core/rtw_xmit.c
> +++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c
> @@ -402,7 +402,7 @@ static void set_qos(struct pkt_file *ppktfile, struct pkt_attrib *pattrib)
> _rtw_pktfile_read(ppktfile, (u8 *)&ip_hdr, sizeof(ip_hdr));
> /* user_prio = (ntohs(ip_hdr.tos) >> 5) & 0x3; */
> user_prio = ip_hdr.tos >> 5;
> - } else if (pattrib->ether_type == 0x888e) {
> + } else if (pattrib->ether_type == ETH_P_PAE) {
> /* "When priority processing of data frames is supported, */
> /* a STA's SME should send EAPOL-Key frames at the highest priority." */
> user_prio = 7;
> @@ -469,15 +469,15 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p
> }
> }
> }
> - } else if (pattrib->ether_type == 0x888e) {
> + } else if (pattrib->ether_type == ETH_P_PAE) {
> DBG_88E_LEVEL(_drv_info_, "send eapol packet\n");
> }
>
> - if ((pattrib->ether_type == 0x888e) || (pattrib->dhcp_pkt == 1))
> + if ((pattrib->ether_type == ETH_P_PAE) || (pattrib->dhcp_pkt == 1))
> rtw_set_scan_deny(padapter, 3000);
>
> /* If EAPOL , ARP , OR DHCP packet, driver must be in active mode. */
> - if ((pattrib->ether_type == 0x0806) || (pattrib->ether_type == 0x888e) || (pattrib->dhcp_pkt == 1))
> + if ((pattrib->ether_type == ETH_P_ARP) || (pattrib->ether_type == ETH_P_PAE) || (pattrib->dhcp_pkt == 1))
> rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_SPECIAL_PACKET, 1);
>
> bmcast = IS_MCAST(pattrib->ra);
> @@ -531,8 +531,8 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p
>
> pattrib->encrypt = 0;
>
> - if ((pattrib->ether_type != 0x888e) && !check_fwstate(pmlmepriv, WIFI_MP_STATE)) {
> - RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, ("\npsta->ieee8021x_blocked == true, pattrib->ether_type(%.4x) != 0x888e\n",
> pattrib->ether_type));
> + if ((pattrib->ether_type != ETH_P_PAE) && !check_fwstate(pmlmepriv, WIFI_MP_STATE)) {
> + RT_TRACE(_module_rtl871x_xmit_c_, _drv_err_, ("\npsta->ieee8021x_blocked == true, pattrib->ether_type(%.4x) != ETH_P_PAE\n",
> pattrib->ether_type));
> res = _FAIL;
> goto exit;
> }
> diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h
> index 38247fa..b895a53 100644
> --- a/drivers/staging/rtl8192e/rtllib.h
> +++ b/drivers/staging/rtl8192e/rtllib.h
> @@ -521,7 +521,7 @@ enum wireless_mode {
> };
>
> #ifndef ETH_P_PAE
> -#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
> +#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
> #define ETH_P_IP 0x0800 /* Internet Protocol packet */
> #define ETH_P_ARP 0x0806 /* Address Resolution packet */
> #endif /* ETH_P_PAE */
> --
> 2.7.4
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/a1722811-0eb9-4e28-af52-e234cd6e7107%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-09-28 21:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-28 21:07 [PATCH] staging: rtl8188eu: core: rtw_xmit: Use macros instead of constants Georgiana Rodica Chelu
2016-09-28 21:15 ` [Outreachy kernel] " Julia Lawall
2016-09-28 21:19 ` Georgiana Chelu
2016-09-28 21:29 ` [Outreachy kernel] " Julia Lawall
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.