netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/21] slight optimization of addr compare for some modules
@ 2013-12-23  5:09 Ding Tianhong
  2013-12-23  8:28 ` Joe Perches
  0 siblings, 1 reply; 3+ messages in thread
From: Ding Tianhong @ 2013-12-23  5:09 UTC (permalink / raw)
  To: Netdev, linux-kernel@vger.kernel.org, Joe Perches

Joe Perches add ether_addr_equal_unaligned to test if
possibly unaligned to u16 Ethernet addresses are equal.

If CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is set, this uses
the slightly faster generic routine ether_addr_equal,
otherwise this uses memcmp.

So I use the recently added and possibly more efficient
ether_addr_equal_unaligned to instead of memcmp for slight
optimization.

Ding Tianhong (6):
  net: slight optimization of addr compare for some modules
  net: freescale: slight optimization of addr compare
  net: pcnet: slight optimization of addr compare
  net: atl1: slight optimization of addr compare
  hamradio: slight optimization of addr compare
  ppp: slight optimization of addr compare

Tan Xiaojun (3):
  zd1211rw: slight optimization of addr compare
  ozwpan: slight optimization of addr compare
  batman-adv: slight optimization of addr compare

Wang Weidong (3):
  infiniband: slight optimization of addr compare
  bridge: slight optimization of addr compare
  mac8011: slight optimization of addr compare

Weilong Chen (6):
  rtlwifi: slight optimization of addr compare
  mwifiex: slight optimization of addr compare
  ipw2x00: slight optimization of addr compare
  hostap: slight optimization of addr compare
  cw1200: slight optimization of addr compare
  wireless: slight optimization of addr compare

Yang Yingliang (3):
  atm: slight optimization of addr compare
  isdn: slight optimization of addr compare
  media: dvb_core: slight optimization of addr compare

 drivers/atm/nicstar.c                              |  3 +-
 drivers/infiniband/hw/nes/nes_cm.c                 |  3 +-
 drivers/isdn/i4l/isdn_net.c                        |  4 +--
 drivers/media/dvb-core/dvb_net.c                   | 10 +++---
 drivers/net/bonding/bond_3ad.c                     |  2 +-
 drivers/net/ethernet/3com/3c509.c                  |  3 +-
 drivers/net/ethernet/amd/pcnet32.c                 |  2 +-
 drivers/net/ethernet/atheros/atlx/atl1.c           |  2 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c     | 10 +++---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c  |  2 +-
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c   |  2 +-
 drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c |  2 +-
 drivers/net/ethernet/chelsio/cxgb3/l2t.c           |  2 +-
 drivers/net/ethernet/cisco/enic/enic_pp.c          |  2 +-
 drivers/net/ethernet/emulex/benet/be_main.c        |  2 +-
 drivers/net/ethernet/freescale/ucc_geth.c          |  2 +-
 drivers/net/ethernet/intel/igbvf/netdev.c          |  2 +-
 drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c     |  3 +-
 drivers/net/ethernet/mellanox/mlx4/en_netdev.c     |  4 +--
 .../net/ethernet/mellanox/mlx4/resource_tracker.c  |  2 +-
 drivers/net/ethernet/micrel/ksz884x.c              |  9 +++---
 drivers/net/ethernet/neterion/vxge/vxge-main.c     |  2 +-
 drivers/net/ethernet/packetengines/yellowfin.c     |  8 ++---
 drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c |  2 +-
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c     |  4 +--
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c     |  4 +--
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c   |  4 +--
 drivers/net/ethernet/renesas/sh_eth.c              |  2 +-
 drivers/net/ethernet/seeq/sgiseeq.c                |  2 +-
 drivers/net/ethernet/sun/sunvnet.c                 |  2 +-
 drivers/net/ethernet/ti/cpsw_ale.c                 |  2 +-
 drivers/net/fddi/skfp/fplustm.c                    |  3 +-
 drivers/net/hamradio/bpqether.c                    |  2 +-
 drivers/net/plip/plip.c                            |  2 +-
 drivers/net/ppp/pppoe.c                            |  5 +--
 drivers/net/wireless/adm8211.c                     |  2 +-
 drivers/net/wireless/ath/ath10k/mac.c              |  2 +-
 drivers/net/wireless/ath/ath10k/txrx.c             |  2 +-
 drivers/net/wireless/ath/ath6kl/cfg80211.c         |  2 +-
 drivers/net/wireless/ath/ath6kl/main.c             |  6 ++--
 drivers/net/wireless/ath/ath6kl/txrx.c             |  3 +-
 drivers/net/wireless/ath/ath6kl/wmi.c              |  4 +--
 drivers/net/wireless/ath/wcn36xx/txrx.c            |  2 +-
 drivers/net/wireless/ath/wil6210/cfg80211.c        |  2 +-
 drivers/net/wireless/atmel.c                       | 16 +++++-----
 drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c |  2 +-
 drivers/net/wireless/brcm80211/brcmfmac/p2p.c      |  9 +++---
 .../net/wireless/brcm80211/brcmfmac/wl_cfg80211.c  | 10 +++---
 drivers/net/wireless/cw1200/sta.c                  |  4 +--
 drivers/net/wireless/cw1200/txrx.c                 |  7 ++---
 drivers/net/wireless/hostap/hostap_80211_rx.c      | 24 +++++++--------
 drivers/net/wireless/hostap/hostap_80211_tx.c      |  4 +--
 drivers/net/wireless/hostap/hostap_ap.c            | 28 ++++++++---------
 drivers/net/wireless/hostap/hostap_hw.c            |  2 +-
 drivers/net/wireless/hostap/hostap_info.c          |  2 +-
 drivers/net/wireless/hostap/hostap_ioctl.c         |  4 +--
 drivers/net/wireless/hostap/hostap_main.c          |  8 ++---
 drivers/net/wireless/ipw2x00/ipw2200.c             | 36 ++++++++++++----------
 drivers/net/wireless/ipw2x00/libipw_rx.c           | 10 +++---
 drivers/net/wireless/libertas/main.c               |  2 +-
 drivers/net/wireless/mac80211_hwsim.c              |  7 ++---
 drivers/net/wireless/mwifiex/11n.c                 |  4 +--
 drivers/net/wireless/mwifiex/11n_rxreorder.c       |  4 +--
 drivers/net/wireless/mwifiex/cfg80211.c            |  2 +-
 drivers/net/wireless/mwifiex/scan.c                |  4 +--
 drivers/net/wireless/mwifiex/sta_cmdresp.c         |  3 +-
 drivers/net/wireless/mwifiex/sta_rx.c              |  2 +-
 drivers/net/wireless/mwifiex/uap_event.c           |  2 +-
 drivers/net/wireless/mwifiex/wmm.c                 |  2 +-
 drivers/net/wireless/mwl8k.c                       |  7 ++---
 drivers/net/wireless/orinoco/main.c                |  2 +-
 drivers/net/wireless/prism54/isl_ioctl.c           |  9 +++---
 drivers/net/wireless/ray_cs.c                      |  2 +-
 drivers/net/wireless/rtlwifi/cam.c                 |  4 +--
 drivers/net/wireless/ti/wl1251/main.c              |  2 +-
 drivers/net/wireless/wl3501_cs.c                   |  3 +-
 drivers/net/wireless/zd1211rw/zd_mac.c             |  7 +++--
 drivers/staging/ozwpan/ozcdev.c                    |  3 +-
 drivers/staging/ozwpan/ozproto.c                   |  6 ++--
 net/batman-adv/originator.c                        |  2 +-
 net/batman-adv/translation-table.c                 |  2 +-
 net/bridge/br_stp_if.c                             |  2 +-
 net/caif/cfrfml.c                                  |  2 +-
 net/mac80211/iface.c                               |  6 ++--
 84 files changed, 192 insertions(+), 207 deletions(-)

-- 
1.8.0

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

* Re: [PATCH 00/21] slight optimization of addr compare for some modules
  2013-12-23  5:09 [PATCH 00/21] slight optimization of addr compare for some modules Ding Tianhong
@ 2013-12-23  8:28 ` Joe Perches
  2013-12-23  8:45   ` Ding Tianhong
  0 siblings, 1 reply; 3+ messages in thread
From: Joe Perches @ 2013-12-23  8:28 UTC (permalink / raw)
  To: Ding Tianhong; +Cc: Netdev, linux-kernel@vger.kernel.org

On Mon, 2013-12-23 at 13:09 +0800, Ding Tianhong wrote:
> I use the recently added and possibly more efficient
> ether_addr_equal_unaligned to instead of memcmp for slight
> optimization.

Hi again.

These are the sorts of conversions that could be
either ether_addr_equal or ether_addr_equal_unaligned
depending on the existing alignment of the addresses
being compared.

For instance, in patch 21:
---
diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c
[]
@@ -131,12 +131,13 @@ static inline struct pppoe_net *pppoe_pernet(struct net *net)
 
 static inline int cmp_2_addr(struct pppoe_addr *a, struct pppoe_addr *b)
 {
-	return a->sid == b->sid && !memcmp(a->remote, b->remote, ETH_ALEN);
+	return a->sid == b->sid && ether_addr_equal_unaligned(a->remote,
+		ther					      b->remote);
---

This could be ether_addr_equal instead as remote is after a be16
and so remote is aligned to a u16.

include/uapi/linux/if_pppox.h:typedef __be16 sid_t;
[]
include/uapi/linux/if_pppox.h:struct pppoe_addr {
include/uapi/linux/if_pppox.h-  sid_t         sid;                    /* Session identifier */
include/uapi/linux/if_pppox.h-  unsigned char remote[ETH_ALEN];       /* Remote address */
include/uapi/linux/if_pppox.h-  char          dev[IFNAMSIZ];          /* Local device to use */
include/uapi/linux/if_pppox.h-}; 

It's of course possible to convert the appropriate
ether_addr_equal_unaligned uses to ether_addr_equal later.

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

* Re: [PATCH 00/21] slight optimization of addr compare for some modules
  2013-12-23  8:28 ` Joe Perches
@ 2013-12-23  8:45   ` Ding Tianhong
  0 siblings, 0 replies; 3+ messages in thread
From: Ding Tianhong @ 2013-12-23  8:45 UTC (permalink / raw)
  To: Joe Perches; +Cc: Netdev, linux-kernel@vger.kernel.org

On 2013/12/23 16:28, Joe Perches wrote:
> On Mon, 2013-12-23 at 13:09 +0800, Ding Tianhong wrote:
>> I use the recently added and possibly more efficient
>> ether_addr_equal_unaligned to instead of memcmp for slight
>> optimization.
> 
> Hi again.
> 
> These are the sorts of conversions that could be
> either ether_addr_equal or ether_addr_equal_unaligned
> depending on the existing alignment of the addresses
> being compared.
> 
> For instance, in patch 21:
> ---
> diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c
> []
> @@ -131,12 +131,13 @@ static inline struct pppoe_net *pppoe_pernet(struct net *net)
>  
>  static inline int cmp_2_addr(struct pppoe_addr *a, struct pppoe_addr *b)
>  {
> -	return a->sid == b->sid && !memcmp(a->remote, b->remote, ETH_ALEN);
> +	return a->sid == b->sid && ether_addr_equal_unaligned(a->remote,
> +		ther					      b->remote);
> ---
> 
> This could be ether_addr_equal instead as remote is after a be16
> and so remote is aligned to a u16.
> 
> include/uapi/linux/if_pppox.h:typedef __be16 sid_t;
> []
> include/uapi/linux/if_pppox.h:struct pppoe_addr {
> include/uapi/linux/if_pppox.h-  sid_t         sid;                    /* Session identifier */
> include/uapi/linux/if_pppox.h-  unsigned char remote[ETH_ALEN];       /* Remote address */
> include/uapi/linux/if_pppox.h-  char          dev[IFNAMSIZ];          /* Local device to use */
> include/uapi/linux/if_pppox.h-}; 
> 
> It's of course possible to convert the appropriate
> ether_addr_equal_unaligned uses to ether_addr_equal later.
> 
> 

Yes, I need to review the changes more clearly and then resend them, thanks.

Regards
Ding
> 

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

end of thread, other threads:[~2013-12-23  8:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-23  5:09 [PATCH 00/21] slight optimization of addr compare for some modules Ding Tianhong
2013-12-23  8:28 ` Joe Perches
2013-12-23  8:45   ` 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).