Skip to content

Commit aecbd4e

Browse files
Stephen HemmingerDavid S. Miller
authored andcommitted
[LLC]: use more efficient ether address routines
Use more cache efficient Ethernet address manipulation functions in etherdevice.h. Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
1 parent 17f3ae0 commit aecbd4e

2 files changed

Lines changed: 6 additions & 9 deletions

File tree

‎include/net/llc_if.h‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <linux/if.h>
1717
#include <linux/if_arp.h>
1818
#include <linux/llc.h>
19+
#include <linux/etherdevice.h>
1920
#include <net/llc.h>
2021

2122
#define LLC_DATAUNIT_PRIM 1
@@ -61,21 +62,19 @@
6162
#define LLC_STATUS_CONFLICT 7 /* disconnect conn */
6263
#define LLC_STATUS_RESET_DONE 8 /* */
6364

64-
extern u8 llc_mac_null_var[IFHWADDRLEN];
65-
6665
/**
6766
* llc_mac_null - determines if a address is a null mac address
6867
* @mac: Mac address to test if null.
6968
*
7069
* Determines if a given address is a null mac address. Returns 0 if the
7170
* address is not a null mac, 1 if the address is a null mac.
7271
*/
73-
static __inline__ int llc_mac_null(u8 *mac)
72+
static inline int llc_mac_null(const u8 *mac)
7473
{
75-
return !memcmp(mac, llc_mac_null_var, IFHWADDRLEN);
74+
return is_zero_ether_addr(mac);
7675
}
7776

78-
static __inline__ int llc_addrany(struct llc_addr *addr)
77+
static inline int llc_addrany(const struct llc_addr *addr)
7978
{
8079
return llc_mac_null(addr->mac) && !addr->lsap;
8180
}
@@ -89,9 +88,9 @@ static __inline__ int llc_addrany(struct llc_addr *addr)
8988
* is not a complete match up to len, 1 if a complete match up to len is
9089
* found.
9190
*/
92-
static __inline__ int llc_mac_match(u8 *mac1, u8 *mac2)
91+
static inline int llc_mac_match(const u8 *mac1, const u8 *mac2)
9392
{
94-
return !memcmp(mac1, mac2, IFHWADDRLEN);
93+
return !compare_ether_addr(mac1, mac2);
9594
}
9695

9796
extern int llc_establish_connection(struct sock *sk, u8 *lmac,

‎net/llc/llc_if.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626
#include <net/llc_c_st.h>
2727
#include <net/tcp_states.h>
2828

29-
u8 llc_mac_null_var[IFHWADDRLEN];
30-
3129
/**
3230
* llc_build_and_send_pkt - Connection data sending for upper layers.
3331
* @sk: connection

0 commit comments

Comments
 (0)