netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3.5 17/19] mwifiex: slight optimization of addr compare
@ 2013-12-26 11:41 Ding Tianhong
       [not found] ` <52BC15E7.7050205-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Ding Tianhong @ 2013-12-26 11:41 UTC (permalink / raw)
  To: Bing Zhao, John W. Linville, linux-wireless, Netdev,
	linux-kernel@vger.kernel.org

Use possibly more efficient ether_addr_equal
instead of memcmp.

Cc: Bing Zhao <bzhao@marvell.com>
Cc: John W. Linville <linville@tuxdriver.com>
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Weilong Chen <chenweilong@huawei.com>
Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
---
 drivers/net/wireless/mwifiex/11n.c         | 2 +-
 drivers/net/wireless/mwifiex/sta_cmdresp.c | 3 +--
 drivers/net/wireless/mwifiex/sta_rx.c      | 2 +-
 3 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/mwifiex/11n.c b/drivers/net/wireless/mwifiex/11n.c
index 0b803c0..6261f8c 100644
--- a/drivers/net/wireless/mwifiex/11n.c
+++ b/drivers/net/wireless/mwifiex/11n.c
@@ -483,7 +483,7 @@ mwifiex_get_ba_tbl(struct mwifiex_private *priv, int tid, u8 *ra)
 
 	spin_lock_irqsave(&priv->tx_ba_stream_tbl_lock, flags);
 	list_for_each_entry(tx_ba_tsr_tbl, &priv->tx_ba_stream_tbl_ptr, list) {
-		if (!memcmp(tx_ba_tsr_tbl->ra, ra, ETH_ALEN) &&
+		if (ether_addr_equal_unaligned(tx_ba_tsr_tbl->ra, ra) &&
 		    tx_ba_tsr_tbl->tid == tid) {
 			spin_unlock_irqrestore(&priv->tx_ba_stream_tbl_lock,
 					       flags);
diff --git a/drivers/net/wireless/mwifiex/sta_cmdresp.c b/drivers/net/wireless/mwifiex/sta_cmdresp.c
index 5511946..24523e4 100644
--- a/drivers/net/wireless/mwifiex/sta_cmdresp.c
+++ b/drivers/net/wireless/mwifiex/sta_cmdresp.c
@@ -782,8 +782,7 @@ static int mwifiex_ret_ibss_coalescing_status(struct mwifiex_private *priv,
 	}
 
 	/* If BSSID is diff, modify current BSS parameters */
-	if (memcmp(priv->curr_bss_params.bss_descriptor.mac_address,
-		   ibss_coal_resp->bssid, ETH_ALEN)) {
+	if (!ether_addr_equal(priv->curr_bss_params.bss_descriptor.mac_address, ibss_coal_resp->bssid)) {
 		/* BSSID */
 		memcpy(priv->curr_bss_params.bss_descriptor.mac_address,
 		       ibss_coal_resp->bssid, ETH_ALEN);
diff --git a/drivers/net/wireless/mwifiex/sta_rx.c b/drivers/net/wireless/mwifiex/sta_rx.c
index 0bb510d..4651d67 100644
--- a/drivers/net/wireless/mwifiex/sta_rx.c
+++ b/drivers/net/wireless/mwifiex/sta_rx.c
@@ -224,7 +224,7 @@ int mwifiex_process_sta_rx_packet(struct mwifiex_private *priv,
 	 * directly to os. Don't pass thru rx reordering
 	 */
 	if (!IS_11N_ENABLED(priv) ||
-	    memcmp(priv->curr_addr, rx_pkt_hdr->eth803_hdr.h_dest, ETH_ALEN)) {
+	    !ether_addr_equal_unaligned(priv->curr_addr, rx_pkt_hdr->eth803_hdr.h_dest)) {
 		mwifiex_process_rx_packet(priv, skb);
 		return ret;
 	}
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH v3.5 17/19] mwifiex: slight optimization of addr compare
       [not found] ` <52BC15E7.7050205-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
@ 2014-01-08  2:50   ` Bing Zhao
       [not found]     ` <477F20668A386D41ADCC57781B1F70430F534B5541-r8ILAu4/owuHXkj8w7BxOhL4W9x8LtSr@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Bing Zhao @ 2014-01-08  2:50 UTC (permalink / raw)
  To: Ding Tianhong
  Cc: John W. Linville,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Netdev,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

Hi Ding,

> Use possibly more efficient ether_addr_equal
> instead of memcmp.

> @@ -782,8 +782,7 @@ static int mwifiex_ret_ibss_coalescing_status(struct mwifiex_private *priv,
>  	}
> 
>  	/* If BSSID is diff, modify current BSS parameters */
> -	if (memcmp(priv->curr_bss_params.bss_descriptor.mac_address,
> -		   ibss_coal_resp->bssid, ETH_ALEN)) {
> +	if (!ether_addr_equal(priv->curr_bss_params.bss_descriptor.mac_address, ibss_coal_resp->bssid))

Could you break the line?
If you run "checkpatch.pl" you will spot this warning.

>  	if (!IS_11N_ENABLED(priv) ||
> -	    memcmp(priv->curr_addr, rx_pkt_hdr->eth803_hdr.h_dest, ETH_ALEN)) {
> +	    !ether_addr_equal_unaligned(priv->curr_addr, rx_pkt_hdr->eth803_hdr.h_dest)) {

Also over 80 characters here.

Thanks,
Bing


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v3.5 17/19] mwifiex: slight optimization of addr compare
       [not found]     ` <477F20668A386D41ADCC57781B1F70430F534B5541-r8ILAu4/owuHXkj8w7BxOhL4W9x8LtSr@public.gmane.org>
@ 2014-01-08  2:58       ` Ding Tianhong
  0 siblings, 0 replies; 3+ messages in thread
From: Ding Tianhong @ 2014-01-08  2:58 UTC (permalink / raw)
  To: Bing Zhao
  Cc: John W. Linville,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Netdev,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

On 2014/1/8 10:50, Bing Zhao wrote:
> Hi Ding,
> 
>> Use possibly more efficient ether_addr_equal
>> instead of memcmp.
> 
>> @@ -782,8 +782,7 @@ static int mwifiex_ret_ibss_coalescing_status(struct mwifiex_private *priv,
>>  	}
>>
>>  	/* If BSSID is diff, modify current BSS parameters */
>> -	if (memcmp(priv->curr_bss_params.bss_descriptor.mac_address,
>> -		   ibss_coal_resp->bssid, ETH_ALEN)) {
>> +	if (!ether_addr_equal(priv->curr_bss_params.bss_descriptor.mac_address, ibss_coal_resp->bssid))
> 
> Could you break the line?
> If you run "checkpatch.pl" you will spot this warning.
> 
>>  	if (!IS_11N_ENABLED(priv) ||
>> -	    memcmp(priv->curr_addr, rx_pkt_hdr->eth803_hdr.h_dest, ETH_ALEN)) {
>> +	    !ether_addr_equal_unaligned(priv->curr_addr, rx_pkt_hdr->eth803_hdr.h_dest)) {
> 
> Also over 80 characters here.
> 
> Thanks,
> Bing
> 

Ok, thanks

Regards
Ding

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-01-08  2:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-26 11:41 [PATCH v3.5 17/19] mwifiex: slight optimization of addr compare Ding Tianhong
     [not found] ` <52BC15E7.7050205-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2014-01-08  2:50   ` Bing Zhao
     [not found]     ` <477F20668A386D41ADCC57781B1F70430F534B5541-r8ILAu4/owuHXkj8w7BxOhL4W9x8LtSr@public.gmane.org>
2014-01-08  2:58       ` Ding Tianhong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).