diff options
author | Joe Hershberger <joe.hershberger@ni.com> | 2012-05-23 07:58:00 +0000 |
---|---|---|
committer | Joe Hershberger <joe.hershberger@ni.com> | 2012-05-23 14:19:23 -0500 |
commit | 1735188329d8c6357299462275061c05a46e100f (patch) | |
tree | 65b5a8910106cc04ae9c5ed013f51053c6274c8c /include/net.h | |
parent | f575ae1f7d3940efbfc43e4236adb4a8ec1db632 (diff) | |
download | u-boot-imx-1735188329d8c6357299462275061c05a46e100f.zip u-boot-imx-1735188329d8c6357299462275061c05a46e100f.tar.gz u-boot-imx-1735188329d8c6357299462275061c05a46e100f.tar.bz2 |
net: Encapsulate CDP packet identification
Checking for CDP packets should be encapsulated, not copied code.
Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Diffstat (limited to 'include/net.h')
-rw-r--r-- | include/net.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/include/net.h b/include/net.h index 8a5b09f..453231b 100644 --- a/include/net.h +++ b/include/net.h @@ -356,8 +356,6 @@ extern uchar NetEtherNullAddr[6]; extern ushort NetOurVLAN; /* Our VLAN */ extern ushort NetOurNativeVLAN; /* Our Native VLAN */ -extern const uchar NetCDPAddr[6]; /* Ethernet CDP address */ - extern int NetState; /* Network loop state */ #define NETLOOP_CONTINUE 1 #define NETLOOP_RESTART 2 @@ -387,6 +385,16 @@ extern IPaddr_t NetPingIP; /* the ip address to ping */ /* when CDP completes these hold the return values */ extern ushort CDPNativeVLAN; /* CDP returned native VLAN */ extern ushort CDPApplianceVLAN; /* CDP returned appliance VLAN */ + +/* + * Check for a CDP packet by examining the received MAC address field + */ +static inline int is_cdp_packet(const uchar *et_addr) +{ + extern const uchar NetCDPAddr[6]; + + return memcmp(et_addr, NetCDPAddr, 6) == 0; +} #endif #if defined(CONFIG_CMD_SNTP) |