Skip to contentSkip to conversation

net: caif: slight optimization of addr compare

PATCH Superseded Ding Tianhong 3 participants 5 messages Dec 28, 2013 – Dec 30, 2013

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 20/20 net: caif: slight optimization of addr compare

Use possibly more efficient ether_addr_equal to instead of memcmp.

Cc Dmitry Tarnyagin <[email protected]>
Cc "David S. Miller" <[email protected]>
---
 net/caif/cfrfml.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/caif/cfrfml.c +1 -1
index 61d7617..c680414 100644
@@ -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 · 1 line
1.8.0
#1 lore raw
Quoted 2 lines · Ding Tianhong

Use possibly more efficient ether_addr_equal
to instead of memcmp.

This may be a distinction without difference, but
is a CAIF seghead also an ethernet address?

net/caif/cfrfml.c

Quoted 1 line
net/caif/cfrfml.c +0 -0

[]

net/caif/cfrfml.c static struct cfpkt *rfm_append(struct cfrfml *rfml, char *seghead,

Quoted 1 line
net/caif/cfrfml.c +0 -0
@@ -79,7 +79,7 @@ static struct cfpkt *rfm_append(struct cfrfml *rfml, char *seghead,

[]

Quoted 3 lines
net/caif/cfrfml.c +1 -1
 	/* Verify correct header */
-	if (memcmp(seghead, rfml->seghead, 6) != 0)
+	if (!ether_addr_equal(seghead, rfml->seghead))
#2 lore raw
Quoted 7 lines · Joe Perches
Quoted 2 lines · Ding Tianhong

Use possibly more efficient ether_addr_equal
to instead of memcmp.

This may be a distinction without difference, but
is a CAIF seghead also an ethernet address?

NO,this is a coincidence, the CAIF seghead is 6 bytes too, So from a logical point of view, maybe a new function with suitable name will be more reasonable here, but the name of ether_addr_equal is not correctly here.:)

thanks

Regards
Ding

Quoted 14 lines

net/caif/cfrfml.c

Quoted 1 line
net/caif/cfrfml.c +0 -0

[]

net/caif/cfrfml.c static struct cfpkt *rfm_append(struct cfrfml *rfml, char *seghead,

Quoted 1 line
net/caif/cfrfml.c +0 -0
@@ -79,7 +79,7 @@ static struct cfpkt *rfm_append(struct cfrfml *rfml, char *seghead,

[]

net/caif/cfrfml.c static struct cfpkt *rfm_append(struct cfrfml *rfml, char *seghead, · line 82

Quoted 3 lines
net/caif/cfrfml.c +1 -1
 	/* Verify correct header */
-	if (memcmp(seghead, rfml->seghead, 6) != 0)
+	if (!ether_addr_equal(seghead, rfml->seghead))

--
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

#3 lore raw
Quoted 5 lines · Ding Tianhong
Quoted 4 lines · Joe Perches
Quoted 2 lines · Ding Tianhong

Use possibly more efficient ether_addr_equal
to instead of memcmp.

Quoted 7 lines
Quoted 3 lines

This may be a distinction without difference, but
is a CAIF seghead also an ethernet address?

NO,this is a coincidence, the CAIF seghead is 6 bytes too, So from a logical point of view, maybe a new function with suitable name will be more reasonable here, but the name of ether_addr_equal is not correctly here.:)

So please remove this one from the series.

#4 lore raw
Quoted 9 lines · Joe Perches
Quoted 8 lines · Ding Tianhong
Quoted 7 lines · Joe Perches
Quoted 2 lines · Ding Tianhong

Use possibly more efficient ether_addr_equal
to instead of memcmp.

This may be a distinction without difference, but
is a CAIF seghead also an ethernet address?

Quoted 8 lines
Quoted 4 lines

NO,this is a coincidence, the CAIF seghead is 6 bytes too, So from a logical point of view, maybe a new function with suitable name will be more reasonable here, but the name of ether_addr_equal is not correctly here.:)

So please remove this one from the series.

Yes, Ok!

Regards
Ding

Quoted 2 lines