LKML Archive on lore.kernel.org
 help / color / Atom feed
From: Joe Perches <joe@perches.com>
To: Michael Straube <straube.linux@gmail.com>, gregkh@linuxfoundation.org
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
	Alexander Duyck <alexander.h.duyck@redhat.com>,
	"David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH 3/5] staging: rtl8188eu: use is_multicast_ether_addr in rtw_xmit.c
Date: Thu, 09 Aug 2018 10:51:49 -0700
Message-ID: <cf3e257702a93e4fcfab666e42e49f363eb447f7.camel@perches.com> (raw)
In-Reply-To: <d1f2ab32-ff10-9575-ad61-0286ee3811ae@gmail.com>

On Thu, 2018-08-09 at 19:42 +0200, Michael Straube wrote:
> On 8/9/18 7:13 PM, Joe Perches wrote:
> > On Thu, 2018-08-09 at 19:01 +0200, Michael Straube wrote:
> > > Use is_multicast_ether_addr instead of custom IS_MCAST in
> > > core/rtw_xmit.c.
> > 
> > Have you verified that all accesses are __aligned(2) ?
> > 
> > If so, please state that in the patch description.
> > 
> > > diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c b/drivers/staging/rtl8188eu/core/rtw_xmit.c
> > 
> > []
> > > @@ -460,10 +460,10 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p
> > >   	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);
> > > +	mcast = is_multicast_ether_addr(pattrib->ra);
> > 
> > i.e.:  is pattrib->ra __aligned(2) ?
> > 
> > etc...
> > 
> 
> Hi Joe,
> 
> I looked at the function comment for is_multicast_ether_addr in etherdevice.h.
> There is not mentioned that __aligned(2) is required. If it is, I will check.
> 
> So, is it required although it's not mentioned for is_multicast_ether_addr?

Well, it wasn't required initially, but

commit d54385ce68cd18ab002b46f61246ad197cec92de
Author: Alexander Duyck <alexander.h.duyck@redhat.com>
Date:   Thu Apr 30 14:53:54 2015 -0700

    etherdev: Process is_multicast_ether_addr at same size as other operations
    
    This change makes it so that we process the address in
    is_multicast_ether_addr at the same size as the other calls.  This allows
    us to avoid duplicate reads when used with other calls such as
    is_zero_ether_addr or eth_addr_copy.  In addition I have added a 64 bit
    version of the function so in eth_type_trans we can process the destination
    address as a 64 bit value throughout.
    
    Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

changed it without adding a note in the kernel-doc.

So this is likely appropriate to avoid unaligned access traps:
---
 include/linux/etherdevice.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index 572e11bb8696..0f7086b4836a 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -115,6 +115,8 @@ static inline bool is_zero_ether_addr(const u8 *addr)
  *
  * Return true if the address is a multicast address.
  * By definition the broadcast address is also a multicast address.
+ *
+ * Please note: addr must be aligned to u16.
  */
 static inline bool is_multicast_ether_addr(const u8 *addr)
 {

  reply index

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-09 17:01 [PATCH 1/5] staging: rtl8188eu: use is_multicast_ether_addr in rtw_security.c Michael Straube
2018-08-09 17:01 ` [PATCH 2/5] staging: rtl8188eu: use is_multicast_ether_addr in rtw_recv.c Michael Straube
2018-08-09 17:01 ` [PATCH 3/5] staging: rtl8188eu: use is_multicast_ether_addr in rtw_xmit.c Michael Straube
2018-08-09 17:13   ` Joe Perches
2018-08-09 17:42     ` Michael Straube
2018-08-09 17:51       ` Joe Perches [this message]
2018-08-09 18:03         ` Michael Straube
2018-08-09 19:44           ` Michael Straube
2018-08-09 19:46             ` Dan Carpenter
2018-08-09 19:59               ` Joe Perches
2018-08-09 17:01 ` [PATCH 4/5] staging: rtl8188eu: remove unused IS_MCAST Michael Straube
2018-08-09 17:01 ` [PATCH 5/5] staging: rtl8188eu: use phydm_reg.h from rtlwifi Michael Straube

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cf3e257702a93e4fcfab666e42e49f363eb447f7.camel@perches.com \
    --to=joe@perches.com \
    --cc=alexander.h.duyck@redhat.com \
    --cc=davem@davemloft.net \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=straube.linux@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git
	git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
		linux-kernel@vger.kernel.org linux-kernel@archiver.kernel.org
	public-inbox-index lkml


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/ public-inbox