提交 aecbd4e4 编写于 作者: S Stephen Hemminger 提交者: David S. Miller

[LLC]: use more efficient ether address routines

Use more cache efficient Ethernet address manipulation functions
in etherdevice.h.
Signed-off-by: NStephen Hemminger <shemminger@osdl.org>
上级 17f3ae08
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <linux/if.h> #include <linux/if.h>
#include <linux/if_arp.h> #include <linux/if_arp.h>
#include <linux/llc.h> #include <linux/llc.h>
#include <linux/etherdevice.h>
#include <net/llc.h> #include <net/llc.h>
#define LLC_DATAUNIT_PRIM 1 #define LLC_DATAUNIT_PRIM 1
...@@ -61,8 +62,6 @@ ...@@ -61,8 +62,6 @@
#define LLC_STATUS_CONFLICT 7 /* disconnect conn */ #define LLC_STATUS_CONFLICT 7 /* disconnect conn */
#define LLC_STATUS_RESET_DONE 8 /* */ #define LLC_STATUS_RESET_DONE 8 /* */
extern u8 llc_mac_null_var[IFHWADDRLEN];
/** /**
* llc_mac_null - determines if a address is a null mac address * llc_mac_null - determines if a address is a null mac address
* @mac: Mac address to test if null. * @mac: Mac address to test if null.
...@@ -70,12 +69,12 @@ extern u8 llc_mac_null_var[IFHWADDRLEN]; ...@@ -70,12 +69,12 @@ extern u8 llc_mac_null_var[IFHWADDRLEN];
* Determines if a given address is a null mac address. Returns 0 if the * Determines if a given address is a null mac address. Returns 0 if the
* address is not a null mac, 1 if the address is a null mac. * address is not a null mac, 1 if the address is a null mac.
*/ */
static __inline__ int llc_mac_null(u8 *mac) static inline int llc_mac_null(const u8 *mac)
{ {
return !memcmp(mac, llc_mac_null_var, IFHWADDRLEN); return is_zero_ether_addr(mac);
} }
static __inline__ int llc_addrany(struct llc_addr *addr) static inline int llc_addrany(const struct llc_addr *addr)
{ {
return llc_mac_null(addr->mac) && !addr->lsap; return llc_mac_null(addr->mac) && !addr->lsap;
} }
...@@ -89,9 +88,9 @@ static __inline__ int llc_addrany(struct llc_addr *addr) ...@@ -89,9 +88,9 @@ static __inline__ int llc_addrany(struct llc_addr *addr)
* is not a complete match up to len, 1 if a complete match up to len is * is not a complete match up to len, 1 if a complete match up to len is
* found. * found.
*/ */
static __inline__ int llc_mac_match(u8 *mac1, u8 *mac2) static inline int llc_mac_match(const u8 *mac1, const u8 *mac2)
{ {
return !memcmp(mac1, mac2, IFHWADDRLEN); return !compare_ether_addr(mac1, mac2);
} }
extern int llc_establish_connection(struct sock *sk, u8 *lmac, extern int llc_establish_connection(struct sock *sk, u8 *lmac,
......
...@@ -26,8 +26,6 @@ ...@@ -26,8 +26,6 @@
#include <net/llc_c_st.h> #include <net/llc_c_st.h>
#include <net/tcp_states.h> #include <net/tcp_states.h>
u8 llc_mac_null_var[IFHWADDRLEN];
/** /**
* llc_build_and_send_pkt - Connection data sending for upper layers. * llc_build_and_send_pkt - Connection data sending for upper layers.
* @sk: connection * @sk: connection
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册