[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-wireless
Subject:    Re: [PATCHv2] zd1211rw: use unaligned safe memcmp() in-place of compare_ether_addr()
From:       Shaddy Baddah <shaddy_baddah () hotmail ! com>
Date:       2008-11-29 13:00:47
Message-ID: 49313CFF.4070005 () hotmail ! com
[Download RAW message or body]

Hi,

On 29/11/08 23:40, Holger Schurig wrote:
>> -        if (likely(!compare_ether_addr(tx_hdr->addr2,
>> rx_hdr->addr1))) +        if (likely(!memcmp(tx_hdr->addr2,
>> rx_hdr->addr1, ETH_ALEN))) {
>>              __skb_unlink(skb, q);
> 
> Wouldn't it be better to fix compile_ether_addr instead?

 From Documentation/unaligned-memory-access.txt in reference to 
compare_ether_addr():

Despite the potential unaligned access problems with the above function, it
is included in the kernel anyway but is understood to only work on
16-bit-aligned addresses. It is up to the caller to ensure this alignment or
not use this function at all. This alignment-unsafe function is still useful
as it is a decent optimization for the cases when you can ensure alignment,
which is true almost all of the time in ethernet networking context.

Hope that helps,
Shaddy


--
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
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic