net: slight optimization of addr compare for some modules
Subsystems (16)
PATCH v2 1/20 net: slight optimization of addr compare for some modules
Use possibly more efficient ether_addr_equal_unaligned and ether_addr_equal to instead of memcmp.
--- drivers/net/bonding/bond_3ad.c | 2 +- drivers/net/ethernet/3com/3c509.c | 3 +-- 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/intel/igbvf/netdev.c | 2 +- drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 3 +-- drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 4 ++-- drivers/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/plip/plip.c | 2 +- net/caif/cfrfml.c | 2 +- 27 files changed, 39 insertions(+), 47 deletions(-)
drivers/net/bonding/bond_3ad.c +1 -1
@@ -91,7 +91,7 @@//endalloun // compare MAC addresses -#define MAC_ADDRESS_COMPARE (A ,B ) memcmp(A, B, ETH_ALEN) +#define MAC_ADDRESS_COMPARE (A ,B ) !ether_addr_equal((u8 *)A, (u8 *)B)static struct mac_addr null_mac_addr = { {0 ,0 ,0 ,0 ,0 ,0 } };static u16 ad_ticks_per_sec;
drivers/net/ethernet/3com/3c509.c +1 -2
@@ -252,8 +252,7 @@ static int el3_isa_id_sequence(__be16 *phys_addr)for (i =0 ; i < el3_cards; i++) {struct el3_private *lp =netdev_priv (el3_devs[i]);if (lp->type ==EL3_PNP && - !memcmp (phys_addr, el3_devs[i]->dev_addr, -ETH_ALEN )) { +ether_addr_equal (phys_addr, el3_devs[i]->dev_addr)) {if (el3_debug >3 ) pr_debug("3c509 with address %02x %02x %02x %02x %02x %02x was found by ISAPnP\n", phys_addr[0] & 0xff, phys_addr[0] >> 8,
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c +4 -6
@@ -663,7 +663,7 @@ static int bnx2x_check_mac_add(struct bnx2x *bp,/* Check if a requested MAC already exists */ list_for_each_entry (pos, &o->head, link) -if (!memcmp (data->mac.mac, pos->u.mac.mac,ETH_ALEN ) && +if (ether_addr_equal (data->mac.mac, pos->u.mac.mac) && (data->mac.is_inner_mac == pos->u.mac.is_inner_mac))return -EEXIST ;
@@ -696,8 +696,7 @@ static int bnx2x_check_vlan_mac_add(struct bnx2x *bp,list_for_each_entry (pos, &o->head, link)if ((data->vlan_mac.vlan == pos->u.vlan_mac.vlan) && - (!memcmp (data->vlan_mac.mac, pos->u.vlan_mac.mac, -ETH_ALEN )) && + (ether_addr_equal_unaligned (data->vlan_mac.mac, pos->u.vlan_mac.mac)) && (data->vlan_mac.is_inner_mac == pos->u.vlan_mac.is_inner_mac))return -EEXIST ;
@@ -716,7 +715,7 @@ static struct bnx2x_vlan_mac_registry_elem *DP (BNX2X_MSG_SP ,"Checking MAC %pM for DEL command\n" , data->mac.mac);list_for_each_entry (pos, &o->head, link) -if ((!memcmp (data->mac.mac, pos->u.mac.mac,ETH_ALEN )) && +if ((ether_addr_equal (data->mac.mac, pos->u.mac.mac)) && (data->mac.is_inner_mac == pos->u.mac.is_inner_mac))return pos;
@@ -751,8 +750,7 @@ static struct bnx2x_vlan_mac_registry_elem *list_for_each_entry (pos, &o->head, link)if ((data->vlan_mac.vlan == pos->u.vlan_mac.vlan) && - (!memcmp (data->vlan_mac.mac, pos->u.vlan_mac.mac, -ETH_ALEN )) && + (ether_addr_equal_unaligned (data->vlan_mac.mac, pos->u.vlan_mac.mac)) && (data->vlan_mac.is_inner_mac == pos->u.vlan_mac.is_inner_mac))return pos;
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c +1 -1
@@ -3605,7 +3605,7 @@ enum sample_bulletin_result bnx2x_sample_bulletin(struct bnx2x *bp)/* the mac address in bulletin board is valid and is new */ if (bulletin.valid_bitmap &1 <<MAC_ADDR_VALID && -memcmp (bulletin.mac, bp->old_bulletin.mac,ETH_ALEN )) { + !ether_addr_equal (bulletin.mac, bp->old_bulletin.mac)) {/* update new mac to net device */ memcpy (bp->dev->dev_addr, bulletin.mac,ETH_ALEN ); }
drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c +1 -1
@@ -1702,7 +1702,7 @@ static void bnx2x_vf_mbx_set_q_filters(struct bnx2x *bp,/* ...and only the mac set by the ndo */ if (filters->n_mac_vlan_filters ==1 && -memcmp (filters->filters->mac, bulletin->mac,ETH_ALEN )) { + !ether_addr_equal (filters->filters->mac, bulletin->mac)) {BNX2X_ERR ("VF[%d] requested the addition of a mac address not matching the one configured by set_vf_mac ndo\n" , vf->abs_vfid);
drivers/net/ethernet/chelsio/cxgb3/cxgb3_offload.c +1 -1
@@ -182,7 +182,7 @@ static struct net_device *get_iff_from_mac(struct adapter *adapter,for_each_port (adapter, i) {struct net_device *dev = adapter->port[i]; -if (!memcmp (dev->dev_addr, mac,ETH_ALEN )) { +if (ether_addr_equal (dev->dev_addr, mac)) {rcu_read_lock ();if (vlan && vlan !=VLAN_VID_MASK ) { dev =__vlan_find_dev_deep (dev,htons (ETH_P_8021Q ), vlan);
drivers/net/ethernet/chelsio/cxgb3/l2t.c +1 -1
@@ -429,7 +429,7 @@ found: }else { e->state = neigh->nud_state &NUD_CONNECTED ?L2T_STATE_VALID :L2T_STATE_STALE ; -if (memcmp (e->dmac, neigh->ha,6 )) +if (!ether_addr_equal (e->dmac, neigh->ha))setup_l2e_send_pending (dev,NULL , e); } }
drivers/net/ethernet/cisco/enic/enic_pp.c +1 -1
@@ -162,7 +162,7 @@ static int enic_are_pp_different(struct enic_port_profile *pp1,return strcmp (pp1->name, pp2->name) | !!memcmp (pp1->instance_uuid, pp2->instance_uuid,PORT_UUID_MAX ) | !!memcmp (pp1->host_uuid, pp2->host_uuid,PORT_UUID_MAX ) | - !!memcmp (pp1->mac_addr, pp2->mac_addr,ETH_ALEN ); + !ether_addr_equal (pp1->mac_addr, pp2->mac_addr); } static int enic_pp_preassociate(struct enic *enic, int vf,
drivers/net/ethernet/emulex/benet/be_main.c +1 -1
@@ -287,7 +287,7 @@ static int be_mac_addr_set(struct net_device *netdev, void *p)/* The MAC change did not happen, either due to lack of privilege * or PF didn't pre-provision. */ -if (memcmp (addr->sa_data, mac,ETH_ALEN )) { +if (!ether_addr_equal (addr->sa_data, mac)) { status = -EPERM ; goto err; }
drivers/net/ethernet/intel/igbvf/netdev.c +1 -1
@@ -1745,7 +1745,7 @@ static int igbvf_set_mac(struct net_device *netdev, void *p) hw->mac.ops.rar_set (hw, hw->mac.addr,0 ); -if (memcmp (addr->sa_data, hw->mac.addr,6 )) +if (!ether_addr_equal (addr->sa_data, hw->mac.addr))return -EADDRNOTAVAIL ;memcpy (netdev->dev_addr, addr->sa_data, netdev->addr_len);
drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c +1 -2
@@ -715,8 +715,7 @@ static int ixgbe_set_vf_mac_addr(struct ixgbe_adapter *adapter, }if (adapter->vfinfo[vf].pf_set_mac && -memcmp (adapter->vfinfo[vf].vf_mac_addresses, new_mac, -ETH_ALEN )) { + !ether_addr_equal (adapter->vfinfo[vf].vf_mac_addresses, new_mac)) { e_warn(drv, "VF %d attempted to override administratively set MAC address\n" "Reload the VF driver to resume operations\n",
drivers/net/ethernet/mellanox/mlx4/en_netdev.c +2 -2
@@ -782,7 +782,7 @@ static void update_mclist_flags(struct mlx4_en_priv *priv,list_for_each_entry (dst_tmp, dst, list) { found = false;list_for_each_entry (src_tmp, src, list) { -if (!memcmp (dst_tmp->addr, src_tmp->addr,ETH_ALEN )) { +if (ether_addr_equal (dst_tmp->addr, src_tmp->addr)) { found = true;break ; }
@@ -797,7 +797,7 @@ static void update_mclist_flags(struct mlx4_en_priv *priv,list_for_each_entry (src_tmp, src, list) { found = false;list_for_each_entry (dst_tmp, dst, list) { -if (!memcmp (dst_tmp->addr, src_tmp->addr,ETH_ALEN )) { +if (ether_addr_equal (dst_tmp->addr, src_tmp->addr)) { dst_tmp->action =MCLIST_NONE ; found = true;break ;
drivers/net/ethernet/mellanox/mlx4/resource_tracker.c +1 -1
@@ -3634,7 +3634,7 @@ static int validate_eth_header_mac(int slave, struct _rule_hw *eth_header, !is_broadcast_ether_addr(eth_header->eth.dst_mac)) {list_for_each_entry_safe (res, tmp, rlist, list) { be_mac =cpu_to_be64 (res->mac <<16 ); -if (!memcmp (&be_mac, eth_header->eth.dst_mac,ETH_ALEN )) +if (ether_addr_equal (&be_mac, eth_header->eth.dst_mac))return 0 ; } pr_err("MAC %pM doesn't belong to VF %d, Steering rule rejected\n",
drivers/net/ethernet/micrel/ksz884x.c +4 -5
@@ -4128,10 +4128,10 @@ static int hw_add_addr(struct ksz_hw *hw, u8 *mac_addr)int i;int j =ADDITIONAL_ENTRIES ; -if (!memcmp (hw->override_addr, mac_addr,ETH_ALEN )) +if (ether_addr_equal (hw->override_addr, mac_addr))return 0 ;for (i =0 ; i < hw->addr_list_size; i++) { -if (!memcmp (hw->address[i], mac_addr,ETH_ALEN )) +if (ether_addr_equal (hw->address[i], mac_addr))return 0 ;if (ADDITIONAL_ENTRIES == j &&empty_addr (hw->address[i])) j = i;
@@ -4149,7 +4149,7 @@ static int hw_del_addr(struct ksz_hw *hw, u8 *mac_addr)int i;for (i =0 ; i < hw->addr_list_size; i++) { -if (!memcmp (hw->address[i], mac_addr,ETH_ALEN )) { +if (ether_addr_equal (hw->address[i], mac_addr)) {memset (hw->address[i],0 ,ETH_ALEN );writel (0 , hw->io +ADD_ADDR_INCR * i +KS_ADD_ADDR_0_HI );
@@ -7104,8 +7104,7 @@ static int pcidev_init(struct pci_dev *pdev, const struct pci_device_id *id) ETH_ALEN); else {memcpy (dev->dev_addr, sw->other_addr,ETH_ALEN ); -if (!memcmp (sw->other_addr, hw->override_addr, -ETH_ALEN )) +if (ether_addr_equal (sw->other_addr, hw->override_addr)) dev->dev_addr[5 ] += port->first_port; }
drivers/net/ethernet/neterion/vxge/vxge-main.c +1 -1
@@ -1430,7 +1430,7 @@ vxge_search_mac_addr_in_da_table(struct vxge_vpath *vpath, struct macInfo *mac)return status; } -while (memcmp (mac->macaddr, macaddr,ETH_ALEN )) { +while (!ether_addr_equal (mac->macaddr, macaddr)) { status =vxge_hw_vpath_mac_addr_get_next (vpath->handle, macaddr, macmask);if (status !=VXGE_HW_OK )
drivers/net/ethernet/packetengines/yellowfin.c +2 -6
@@ -1096,12 +1096,8 @@ static int yellowfin_rx(struct net_device *dev)if (status2 &0x80 ) dev->stats.rx_dropped++; #ifdef YF_PROTOTYPE /* Support for prototype hardware errata. */ }else if ((yp->flags & HasMACAddrBug) && -memcmp (le32_to_cpu (yp->rx_ring_dma + - entry*sizeof (struct yellowfin_desc )), - dev->dev_addr,6 ) !=0 && -memcmp (le32_to_cpu (yp->rx_ring_dma + - entry*sizeof (struct yellowfin_desc )), -"\377\377\377\377\377\377" ,6 ) !=0 ) { + !ether_addr_equal (le32_to_cpu (yp->rx_ring_dma + entry *sizeof (struct yellowfin_desc )), dev->dev_addr) && + !ether_addr_equal (le32_to_cpu (yp->rx_ring_dma + entry *sizeof (struct yellowfin_desc )),"\377\377\377\377\377\377" )) {if (bogus_rx++ ==0 )netdev_warn (dev,"Bad frame to %pM\n" , buf_addr);
drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c +1 -1
@@ -661,7 +661,7 @@ static int nx_p3_nic_add_mac(struct netxen_adapter *adapter,list_for_each (head, del_list) { cur =list_entry (head, nx_mac_list_t, list); -if (memcmp (addr, cur->mac_addr,ETH_ALEN ) ==0 ) { +if (ether_addr_equal (addr, cur->mac_addr)) {list_move_tail (head, &adapter->mac_list);return 0 ; }
drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c +2 -2
@@ -462,7 +462,7 @@ int qlcnic_nic_del_mac(struct qlcnic_adapter *adapter, const u8 *addr)/* Delete MAC from the existing list */ list_for_each (head, &adapter->mac_list) { cur = list_entry(head, struct qlcnic_mac_vlan_list, list); -if (memcmp (addr, cur->mac_addr,ETH_ALEN ) ==0 ) { +if (ether_addr_equal (addr, cur->mac_addr)) { err =qlcnic_sre_macaddr_change (adapter, cur->mac_addr,0 ,QLCNIC_MAC_DEL );if (err)
@@ -483,7 +483,7 @@ int qlcnic_nic_add_mac(struct qlcnic_adapter *adapter, const u8 *addr, u16 vlan)/* look up if already exists */ list_for_each (head, &adapter->mac_list) { cur = list_entry(head, struct qlcnic_mac_vlan_list, list); -if (memcmp (addr, cur->mac_addr,ETH_ALEN ) ==0 && +if (ether_addr_equal (addr, cur->mac_addr) && cur->vlan_id == vlan)return 0 ; }
drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c +2 -2
@@ -202,7 +202,7 @@ static struct qlcnic_filter *qlcnic_find_mac_filter(struct hlist_head *head,struct hlist_node *n;hlist_for_each_entry_safe (tmp_fil, n, head, fnode) { -if (!memcmp (tmp_fil->faddr, addr,ETH_ALEN ) && +if (ether_addr_equal (tmp_fil->faddr, addr) && tmp_fil->vlan_id == vlan_id)return tmp_fil; }
@@ -346,7 +346,7 @@ static void qlcnic_send_filter(struct qlcnic_adapter *adapter, head = &(adapter->fhash.fhead[hindex]);hlist_for_each_entry_safe (tmp_fil, n, head, fnode) { -if (!memcmp (tmp_fil->faddr, &src_addr,ETH_ALEN ) && +if (ether_addr_equal (tmp_fil->faddr, &src_addr) && tmp_fil->vlan_id == vlan_id) {if (jiffies > (QLCNIC_READD_AGE *HZ + tmp_fil->ftime)) qlcnic_change_filter(adapter, &src_addr,
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +2 -2
@@ -313,7 +313,7 @@ static void qlcnic_delete_adapter_mac(struct qlcnic_adapter *adapter)list_for_each (head, &adapter->mac_list) { cur = list_entry(head, struct qlcnic_mac_vlan_list, list); -if (!memcmp (adapter->mac_addr, cur->mac_addr,ETH_ALEN )) { +if (ether_addr_equal_unaligned (adapter->mac_addr, cur->mac_addr)) {qlcnic_sre_macaddr_change (adapter, cur->mac_addr,0 ,QLCNIC_MAC_DEL );list_del (&cur->list);
@@ -337,7 +337,7 @@ static int qlcnic_set_mac(struct net_device *netdev, void *p)if (!is_valid_ether_addr (addr->sa_data))return -EINVAL ; -if (!memcmp (adapter->mac_addr, addr->sa_data,ETH_ALEN )) +if (ether_addr_equal_unaligned (adapter->mac_addr, addr->sa_data))return 0 ;if (test_bit (__QLCNIC_DEV_UP, &adapter->state)) {
drivers/net/ethernet/renesas/sh_eth.c +1 -1
@@ -2207,7 +2207,7 @@ static int sh_eth_tsu_find_entry(struct net_device *ndev, const u8 *addr)for (i =0 ; i <SH_ETH_TSU_CAM_ENTRIES ; i++, reg_offset +=8 ) {sh_eth_tsu_read_entry (reg_offset, c_addr); -if (memcmp (addr, c_addr,ETH_ALEN ) ==0 ) +if (ether_addr_equal (addr, c_addr))return i; }
drivers/net/ethernet/seeq/sgiseeq.c +1 -1
@@ -356,7 +356,7 @@ static inline void sgiseeq_rx(struct net_device *dev, struct sgiseeq_private *spif (pkt_status &SEEQ_RSTAT_FIG ) {/* Packet is OK. */ /* We don't want to receive our own packets */ -if (memcmp (rd->skb->data +6 , dev->dev_addr,ETH_ALEN )) { +if (!ether_addr_equal (rd->skb->data +6 , dev->dev_addr)) {if (len > rx_copybreak) { skb = rd->skb; newskb =netdev_alloc_skb (dev,PKT_BUF_SZ );
drivers/net/ethernet/sun/sunvnet.c +1 -1
@@ -751,7 +751,7 @@ static struct vnet_mcast_entry *__vnet_mc_find(struct vnet *vp, u8 *addr)struct vnet_mcast_entry *m;for (m = vp->mcast_list; m; m = m->next) { -if (!memcmp (m->addr, addr,ETH_ALEN )) +if (ether_addr_equal (m->addr, addr))return m; }return NULL ;
drivers/net/ethernet/ti/cpsw_ale.c +1 -1
@@ -163,7 +163,7 @@ int cpsw_ale_match_addr(struct cpsw_ale *ale, u8 *addr, u16 vid)if (cpsw_ale_get_vlan_id (ale_entry) != vid)continue ;cpsw_ale_get_addr (ale_entry, entry_addr); -if (memcmp (entry_addr, addr,6 ) ==0 ) +if (ether_addr_equal (entry_addr, addr))return idx; }return -ENOENT ;
drivers/net/fddi/skfp/fplustm.c +2 -1
@@ -23,6 +23,7 @@#include "h/smc.h" #include "h/supern_2.h" #include <linux/bitrev.h> +#include <linux/etherdevice.h> #ifndef lintstatic const char ID_sccs[] ="@(#)fplustm.c 1.32 99/02/23 (C) SK " ;
@@ -1082,7 +1083,7 @@ static struct s_fpmc* mac_get_mc_table(struct s_smc *smc, slot = tb ;continue ; } -if (memcmp ((char *)&tb->a,(char *)own,6 )) +if (!ether_addr_equal ((char *)&tb->a, (char *)own))continue ;return tb; }
drivers/net/plip/plip.c +1 -1
@@ -549,7 +549,7 @@ static __be16 plip_type_trans(struct sk_buff *skb, struct net_device *dev)if (*eth->h_dest&1 ) { -if (memcmp (eth->h_dest,dev->broadcast,ETH_ALEN )==0 ) +if (ether_addr_equal (eth->h_dest, dev->broadcast)) skb->pkt_type=PACKET_BROADCAST ;else skb->pkt_type=PACKET_MULTICAST ;
net/caif/cfrfml.c +1 -1
@@ -79,7 +79,7 @@ static struct cfpkt *rfm_append(struct cfrfml *rfml, char *seghead,return NULL ;/* Verify correct header */ -if (memcmp (seghead, rfml->seghead,6 ) !=0 ) +if (!ether_addr_equal (seghead, rfml->seghead))return NULL ; tmppkt = cfpkt_append(rfml->incomplete_frm, pkt,
Signature · 17 lines
1.8.0 ------------------------------------------------------------------------------ Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk _______________________________________________ E1000-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/e1000-devel To learn more about Intel® Ethernet, visit http://communities.intel.com/community/wired
Quoted 2 lines · Ding Tianhong
Use possibly more efficient
ether_addr_equal_unalignedandether_addr_equalto instead of memcmp.
A negative of adding so many different drivers in a single patch is that you miss sending patches to the named maintainers.
Most of these below have separate individual maintainers. (a suggested patch below this too)
Quoted 20 lines
drivers/net/bonding/bond_3ad.c | 2 +- drivers/net/ethernet/3com/3c509.c | 3 +-- 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/intel/igbvf/netdev.c | 2 +- drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 3 +-- drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 4 ++-- drivers/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 ++--
Quoted 8 lines
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/plip/plip.c | 2 +- net/caif/cfrfml.c | 2 +- 27 files changed, 39 insertions(+), 47 deletions(-)
Also for bonding, my preference would be to rename the macro and use ether_addr_equal as it seems that all references are u16 aligned.
I also removed some superfluous parentheses.
--- drivers/net/bonding/bond_3ad.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-)
drivers/net/bonding/bond_3ad.c +12 -11
@@ -91,7 +91,8 @@//endalloun // compare MAC addresses -#define MAC_ADDRESS_COMPARE (A ,B ) memcmp(A, B, ETH_ALEN) +#define MAC_ADDRESS_EQUAL (A ,B ) \ + ether_addr_equal((const u8 *)A, (const u8 *)B)static struct mac_addr null_mac_addr = { {0 ,0 ,0 ,0 ,0 ,0 } };static u16 ad_ticks_per_sec;
@@ -419,7 +420,7 @@ static void __choose_matched(struct lacpdu *lacpdu, struct port *port)// check if all parameters are alike if (((ntohs(lacpdu->partner_port) == port->actor_port_number) && (ntohs(lacpdu->partner_port_priority) == port->actor_port_priority) && - !MAC_ADDRESS_COMPARE(&(lacpdu->partner_system), &(port->actor_system)) && + MAC_ADDRESS_EQUAL(&lacpdu->partner_system, &port->actor_system) && (ntohs(lacpdu->partner_system_priority) == port->actor_system_priority) && (ntohs(lacpdu->partner_key) == port->actor_oper_port_key) && ((lacpdu->partner_state & AD_STATE_AGGREGATION) == (port->actor_oper_port_state & AD_STATE_AGGREGATION))) ||
@@ -509,7 +510,7 @@ static void __update_selected(struct lacpdu *lacpdu, struct port *port)// check if any parameter is different if (ntohs (lacpdu->actor_port) != partner->port_number ||ntohs (lacpdu->actor_port_priority) != partner->port_priority || -MAC_ADDRESS_COMPARE (&lacpdu->actor_system, &partner->system) || + !MAC_ADDRESS_EQUAL (&lacpdu->actor_system, &partner->system) ||ntohs (lacpdu->actor_system_priority) != partner->system_priority ||ntohs (lacpdu->actor_key) != partner->key || (lacpdu->actor_state &AD_STATE_AGGREGATION ) != (partner->port_state &AD_STATE_AGGREGATION )) {
@@ -540,7 +541,7 @@ static void __update_default_selected(struct port *port)// check if any parameter is different if (admin->port_number != oper->port_number || admin->port_priority != oper->port_priority || -MAC_ADDRESS_COMPARE (&admin->system, &oper->system) || + !MAC_ADDRESS_EQUAL (&admin->system, &oper->system) || admin->system_priority != oper->system_priority || admin->key != oper->key || (admin->port_state & AD_STATE_AGGREGATION)
@@ -570,7 +571,7 @@ static void __update_ntt(struct lacpdu *lacpdu, struct port *port)// check if any parameter is different if ((ntohs(lacpdu->partner_port) != port->actor_port_number) || (ntohs(lacpdu->partner_port_priority) != port->actor_port_priority) || - MAC_ADDRESS_COMPARE(&(lacpdu->partner_system), &(port->actor_system)) || + !MAC_ADDRESS_EQUAL(&lacpdu->partner_system, &port->actor_system) || (ntohs(lacpdu->partner_system_priority) != port->actor_system_priority) || (ntohs(lacpdu->partner_key) != port->actor_oper_port_key) || ((lacpdu->partner_state & AD_STATE_LACP_ACTIVITY) != (port->actor_oper_port_state & AD_STATE_LACP_ACTIVITY)) ||
@@ -1072,7 +1073,7 @@ static void ad_rx_machine(struct lacpdu *lacpdu, struct port *port)break ;case AD_RX_CURRENT :// detect loopback situation -if (!MAC_ADDRESS_COMPARE (&(lacpdu->actor_system), &(port->actor_system))) { +if (MAC_ADDRESS_EQUAL (&lacpdu->actor_system, &port->actor_system)) {// INFO_RECEIVED_LOOPBACK_FRAMES pr_err("%s: An illegal loopback occurred on adapter (%s).\n" "Check the configuration to verify that all adapters are connected to 802.3ad compliant switch ports\n",
@@ -1278,11 +1279,11 @@ static void ad_port_selection_logic(struct port *port) }// check if current aggregator suits us if (((aggregator->actor_oper_aggregator_key == port->actor_oper_port_key) &&// if all parameters match AND - !MAC_ADDRESS_COMPARE (&(aggregator->partner_system), &(port->partner_oper.system)) && +MAC_ADDRESS_EQUAL (&aggregator->partner_system, &port->partner_oper.system) && (aggregator->partner_system_priority == port->partner_oper.system_priority) && (aggregator->partner_oper_aggregator_key == port->partner_oper.key) ) && - ((MAC_ADDRESS_COMPARE (&(port->partner_oper.system), &(null_mac_addr)) &&// partner answers + ((!MAC_ADDRESS_EQUAL (&port->partner_oper.system, &null_mac_addr) &&// partner answers !aggregator->is_individual)// but is not individual OR ) ) {
@@ -1696,7 +1697,7 @@ static void ad_enable_collecting_distributing(struct port *port)*/ static void ad_disable_collecting_distributing (struct port *port) { -if (port->aggregator &&MAC_ADDRESS_COMPARE (&(port->aggregator->partner_system), &(null_mac_addr))) { +if (port->aggregator && !MAC_ADDRESS_EQUAL (&port->aggregator->partner_system, &null_mac_addr)) {pr_debug ("Disabling port %d(LAG %d)\n" , port->actor_port_number, port->aggregator->aggregator_identifier);
@@ -1818,8 +1819,8 @@ static u16 aggregator_identifier;void bond_3ad_initialize (struct bonding *bond,u16 tick_resolution) {// check that the bond is not initialized yet -if (MAC_ADDRESS_COMPARE (&(BOND_AD_INFO (bond).system.sys_mac_addr), - bond->dev->dev_addr)) { +if (!MAC_ADDRESS_EQUAL (&BOND_AD_INFO (bond).system.sys_mac_addr, + bond->dev->dev_addr)) { aggregator_identifier =0 ;
Quoted 10 lines · Joe Perches
Quoted 2 lines · Ding Tianhong
Use possibly more efficient
ether_addr_equal_unalignedandether_addr_equalto instead of memcmp.A negative of adding so many different drivers in a single patch is that you miss sending patches to the named maintainers.
Most of these below have separate individual maintainers. (a suggested patch below this too)
you mean that I should send below by separate patch? It seemed that I misunderstood, I use the ./script/getmainter and found the only maintainer is David, and others are support, so maybe I was wrong, but it really a big patchset, could I send them by seperate patchset? I think it could be more clearly.
Quoted 29 lines
Quoted 20 lines
drivers/net/bonding/bond_3ad.c | 2 +- drivers/net/ethernet/3com/3c509.c | 3 +-- 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/intel/igbvf/netdev.c | 2 +- drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 3 +-- drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 4 ++-- drivers/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 ++--Quoted 8 lines
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/plip/plip.c | 2 +- net/caif/cfrfml.c | 2 +- 27 files changed, 39 insertions(+), 47 deletions(-)
Quoted 4 lines
Also for bonding, my preference would be to rename the macro and use
ether_addr_equalas it seems that all references are u16 aligned.
Agree, I make it in the early patchset, as same as yours,
[PATCH net-next 1/6] bonding: use ether_addr_equal_unaligned for bond addr compare
in my opinion, I think it would be better in the bonding patchset, because I am making a patchset for bonding.
Regards
Ding
Quoted 101 lines
I also removed some superfluous parentheses.
--- drivers/net/bonding/bond_3ad.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-)drivers/net/bonding/bond_3ad.c +12
-12@@ -91,7 +91,8 @@//endalloun // compare MAC addresses -#define MAC_ADDRESS_COMPARE (A ,B ) memcmp(A, B, ETH_ALEN) +#define MAC_ADDRESS_EQUAL (A ,B ) \ + ether_addr_equal((const u8 *)A, (const u8 *)B)static struct mac_addr null_mac_addr = { {0 ,0 ,0 ,0 ,0 ,0 } };static u16 ad_ticks_per_sec;@@ -419,7 +420,7 @@ static void __choose_matched(struct lacpdu *lacpdu, struct port *port)// check if all parameters are alike if (((ntohs(lacpdu->partner_port) == port->actor_port_number) && (ntohs(lacpdu->partner_port_priority) == port->actor_port_priority) && - !MAC_ADDRESS_COMPARE(&(lacpdu->partner_system), &(port->actor_system)) && + MAC_ADDRESS_EQUAL(&lacpdu->partner_system, &port->actor_system) && (ntohs(lacpdu->partner_system_priority) == port->actor_system_priority) && (ntohs(lacpdu->partner_key) == port->actor_oper_port_key) && ((lacpdu->partner_state & AD_STATE_AGGREGATION) == (port->actor_oper_port_state & AD_STATE_AGGREGATION))) ||@@ -509,7 +510,7 @@ static void __update_selected(struct lacpdu *lacpdu, struct port *port)// check if any parameter is different if (ntohs (lacpdu->actor_port) != partner->port_number ||ntohs (lacpdu->actor_port_priority) != partner->port_priority || -MAC_ADDRESS_COMPARE (&lacpdu->actor_system, &partner->system) || + !MAC_ADDRESS_EQUAL (&lacpdu->actor_system, &partner->system) ||ntohs (lacpdu->actor_system_priority) != partner->system_priority ||ntohs (lacpdu->actor_key) != partner->key || (lacpdu->actor_state &AD_STATE_AGGREGATION ) != (partner->port_state &AD_STATE_AGGREGATION )) {@@ -540,7 +541,7 @@ static void __update_default_selected(struct port *port)// check if any parameter is different if (admin->port_number != oper->port_number || admin->port_priority != oper->port_priority || -MAC_ADDRESS_COMPARE (&admin->system, &oper->system) || + !MAC_ADDRESS_EQUAL (&admin->system, &oper->system) || admin->system_priority != oper->system_priority || admin->key != oper->key || (admin->port_state & AD_STATE_AGGREGATION)@@ -570,7 +571,7 @@ static void __update_ntt(struct lacpdu *lacpdu, struct port *port)// check if any parameter is different if ((ntohs(lacpdu->partner_port) != port->actor_port_number) || (ntohs(lacpdu->partner_port_priority) != port->actor_port_priority) || - MAC_ADDRESS_COMPARE(&(lacpdu->partner_system), &(port->actor_system)) || + !MAC_ADDRESS_EQUAL(&lacpdu->partner_system, &port->actor_system) || (ntohs(lacpdu->partner_system_priority) != port->actor_system_priority) || (ntohs(lacpdu->partner_key) != port->actor_oper_port_key) || ((lacpdu->partner_state & AD_STATE_LACP_ACTIVITY) != (port->actor_oper_port_state & AD_STATE_LACP_ACTIVITY)) ||@@ -1072,7 +1073,7 @@ static void ad_rx_machine(struct lacpdu *lacpdu, struct port *port)break ;case AD_RX_CURRENT :// detect loopback situation -if (!MAC_ADDRESS_COMPARE (&(lacpdu->actor_system), &(port->actor_system))) { +if (MAC_ADDRESS_EQUAL (&lacpdu->actor_system, &port->actor_system)) {// INFO_RECEIVED_LOOPBACK_FRAMES pr_err("%s: An illegal loopback occurred on adapter (%s).\n" "Check the configuration to verify that all adapters are connected to 802.3ad compliant switch ports\n",@@ -1278,11 +1279,11 @@ static void ad_port_selection_logic(struct port *port) }// check if current aggregator suits us if (((aggregator->actor_oper_aggregator_key == port->actor_oper_port_key) &&// if all parameters match AND - !MAC_ADDRESS_COMPARE (&(aggregator->partner_system), &(port->partner_oper.system)) && +MAC_ADDRESS_EQUAL (&aggregator->partner_system, &port->partner_oper.system) && (aggregator->partner_system_priority == port->partner_oper.system_priority) && (aggregator->partner_oper_aggregator_key == port->partner_oper.key) ) && - ((MAC_ADDRESS_COMPARE (&(port->partner_oper.system), &(null_mac_addr)) &&// partner answers + ((!MAC_ADDRESS_EQUAL (&port->partner_oper.system, &null_mac_addr) &&// partner answers !aggregator->is_individual)// but is not individual OR ) ) {@@ -1696,7 +1697,7 @@ static void ad_enable_collecting_distributing(struct port *port)*/ static void ad_disable_collecting_distributing (struct port *port) { -if (port->aggregator &&MAC_ADDRESS_COMPARE (&(port->aggregator->partner_system), &(null_mac_addr))) { +if (port->aggregator && !MAC_ADDRESS_EQUAL (&port->aggregator->partner_system, &null_mac_addr)) {pr_debug ("Disabling port %d(LAG %d)\n" , port->actor_port_number, port->aggregator->aggregator_identifier);@@ -1818,8 +1819,8 @@ static u16 aggregator_identifier;void bond_3ad_initialize (struct bonding *bond,u16 tick_resolution) {// check that the bond is not initialized yet -if (MAC_ADDRESS_COMPARE (&(BOND_AD_INFO (bond).system.sys_mac_addr), - bond->dev->dev_addr)) { +if (!MAC_ADDRESS_EQUAL (&BOND_AD_INFO (bond).system.sys_mac_addr, + bond->dev->dev_addr)) { aggregator_identifier =0 ; --
Quoted 4 lines
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
E1000-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel® Ethernet, visit http://communities.intel.com/community/wired
Quoted 11 lines · Ding Tianhong
Quoted 8 lines · Joe Perches
Quoted 2 lines · Ding Tianhong
Use possibly more efficient
ether_addr_equal_unalignedandether_addr_equalto instead of memcmp.A negative of adding so many different drivers in a single patch is that you miss sending patches to the named maintainers.
Most of these below have separate individual maintainers.
you mean that I should send below by separate patch?
I think yes,
You can send them to netdev, but cc'ing the named maintainers is a polite thing to do.
Sending individual patches can make it easier for maintainers to review the bits that are specific to their projects without having to wade through other changes that aren't relevant to them.
Quoted 5 lines
It seemed that I
misunderstood, I use the ./script/getmainter and found the only maintainer is David, and others are support, so maybe I was wrong, but it really a big patchset, could I send them by seperate patchset? I think it could be more clearly.
From the MAINTAINERS file:
S: Status, one of the following:
Supported: Someone is actually paid to look after this.
Maintained: Someone actually looks after it.
Odd Fixes: It has a maintainer but they don't have time to do
much other than throw the odd patch in. See below..
Orphan: No current maintainer [but maybe you could take the
role as you write your new code].
Obsolete: Old code. Something tagged obsolete generally means
it has been replaced by a better system and you should be using that.
So "supported" is "higher/better" than "maintained".
Quoted 15 lines · Joe Perches
Quoted 11 lines · Ding Tianhong
Quoted 8 lines · Joe Perches
Quoted 2 lines · Ding Tianhong
Use possibly more efficient
ether_addr_equal_unalignedandether_addr_equalto instead of memcmp.A negative of adding so many different drivers in a single patch is that you miss sending patches to the named maintainers.
Most of these below have separate individual maintainers.
you mean that I should send below by separate patch?
I think yes,
Quoted 8 lines
You can send them to netdev, but cc'ing the named maintainers is a polite thing to do.
Sending individual patches can make it easier for maintainers to review the bits that are specific to their projects without having to wade through other changes that aren't relevant to them.
OK, I will rebuild the 01/20 patch and make it to seperate patches follow your opinion. and the rest of the patches I think is fit and no need to modify, if you agree with me, I will send the rest 19 patch as the first step, and then seperate this patch as the second step, send them in net-next.
Regards
Ding
Quoted 18 lines
Quoted 7 lines
It seemed that I
misunderstood, I use the ./script/getmainter and found the only maintainer is David, and others are support, so maybe I was wrong, but it really a big patchset, could I send them by seperate patchset? I think it could be more clearly.From the
MAINTAINERSfile:S: Status, one of the following:
Supported: Someone is actually paid to look after this.
Maintained: Someone actually looks after it.
Odd Fixes: It has a maintainer but they don't have time to do
much other than throw the odd patch in. See below..
Orphan: No current maintainer [but maybe you could take the
role as you write your new code].
Obsolete: Old code. Something tagged obsolete generally means
it has been replaced by a better system and you should be using that.
Quoted 2 lines
So "supported" is "higher/better" than "maintained".
OK
Quoted 2 lines
------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
E1000-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel® Ethernet, visit http://communities.intel.com/community/wired