From: Helin Zhang Date: Thu, 5 Jun 2014 05:08:50 +0000 (+0800) Subject: ethdev: function to compare ethernet addresses X-Git-Tag: spdx-start~10675 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=0bb4a2b51a63fa29cbe0e9f7f3878c37358fd35e;p=dpdk.git ethdev: function to compare ethernet addresses To support i40e, function is_same_ether_addr() has been added to compare two ethernet address. Signed-off-by: Helin Zhang Signed-off-by: Jing Chen Acked-by: Cunming Liang Acked-by: Jijiang Liu Acked-by: Jingjing Wu Acked-by: Heqing Zhu Tested-by: Waterman Cao --- diff --git a/lib/librte_ether/rte_ether.h b/lib/librte_ether/rte_ether.h index 08feb412de..a25ca109bf 100644 --- a/lib/librte_ether/rte_ether.h +++ b/lib/librte_ether/rte_ether.h @@ -85,6 +85,30 @@ struct ether_addr { #define ETHER_LOCAL_ADMIN_ADDR 0x02 /**< Locally assigned Eth. address. */ #define ETHER_GROUP_ADDR 0x01 /**< Multicast or broadcast Eth. address. */ +/** + * Check if two Ethernet addresses are the same. + * + * @param ea1 + * A pointer to the first ether_addr structure containing + * the ethernet address. + * @param ea2 + * A pointer to the second ether_addr structure containing + * the ethernet address. + * + * @return + * True (1) if the given two ethernet address are the same; + * False (0) otherwise. + */ +static inline int is_same_ether_addr(const struct ether_addr *ea1, + const struct ether_addr *ea2) +{ + int i; + for (i = 0; i < ETHER_ADDR_LEN; i++) + if (ea1->addr_bytes[i] != ea2->addr_bytes[i]) + return 0; + return 1; +} + /** * Check if an Ethernet address is filled with zeros. *