Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e9715228 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'addr_compare'



Ding Tianhong says:

====================
slight optimization of addr compare for net modules

This is the second patchset for slight optimization of address compare,
mainly for net tree, just following the Joe's opinion, it will help review
the code for maintainers and supports.

v2: Change some style for patch 2.
    According Eric's suggestion, use the ether_addr_equal_64bits to instead
    of ether_addr_equal for patch 19.
    In fact, there are a lot of places which could use ether_addr_equal_64bits
    to instead of ether_addr_equal, but not this time, thanks for Joe's
    opinion.

v3: Change some style for patch 11/19:
    (net: packetengines: slight optimization of addr compare).
    Joe pointed out that is_broadcast_ether_addr(addr) would be appropriate here,
    but this should be left alone and not in this patch, so fix it later.

    In the patch (net: caif: slight optimization of addr compare), the operand for
    memcmp is not mac address, so it is unsuitable to use the ether_addr_equal
    to compare a non mac address, so remove the patch from the series.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 21eb2189 2d87650a
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -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,
+4 −6
Original line number Diff line number Diff line
@@ -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;
+1 −1
Original line number Diff line number Diff line
@@ -3616,7 +3616,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);
	}
+1 −1
Original line number Diff line number Diff line
@@ -1714,7 +1714,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);

+1 −1
Original line number Diff line number Diff line
@@ -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);
Loading