aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/ethernet/mac_address.h
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2020-02-24 12:45:53 +0000
committerDamjan Marion <dmarion@me.com>2020-02-24 15:46:37 +0000
commite98d71b07eac32e07597e0a3c3c5f7ccd4c27ba9 (patch)
tree2d2f86ccce47756f169cb9a5ee90f6cb6342ef46 /src/vnet/ethernet/mac_address.h
parentf0d8d8fca943a4fec10e99ee74928e41a937e584 (diff)
ethernet: trivial additions
Type: improvement - macros to identify SENDER and TARGET in ARP header - count the number of bits set in a mac_address Signed-off-by: Neale Ranns <nranns@cisco.com> Change-Id: Id31e27a4f5f01a8cfb70d3798416bb2519981654
Diffstat (limited to 'src/vnet/ethernet/mac_address.h')
-rw-r--r--src/vnet/ethernet/mac_address.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/vnet/ethernet/mac_address.h b/src/vnet/ethernet/mac_address.h
index aa773c5c449..68feb3977f0 100644
--- a/src/vnet/ethernet/mac_address.h
+++ b/src/vnet/ethernet/mac_address.h
@@ -149,6 +149,12 @@ mac_address_set_zero (mac_address_t * mac)
mac->u.last_2 = 0;
}
+static_always_inline int
+mac_address_n_bits_set (const mac_address_t * a)
+{
+ return (count_set_bits (mac_address_as_u64 (a)));
+}
+
extern void mac_address_increment (mac_address_t * mac);
extern uword unformat_mac_address_t (unformat_input_t * input,
va_list * args);