summaryrefslogtreecommitdiffstats
path: root/src/vnet/interface_funcs.h
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2022-01-05 01:52:38 +0100
committerDamjan Marion <damarion@cisco.com>2022-01-05 19:04:07 +0100
commitd4f88cc0967ea1de66396ac07b20cf6e33a3fa1a (patch)
tree1f316431b414ac3adf693eb876132dd675c73a2a /src/vnet/interface_funcs.h
parent7c11bd7a87b901106bb14d40572fddc703b74e5b (diff)
interface: refactor interface capabilities code
Make it shorter to type, easier to debug, make adding callbacks in future simpler. Type: improvement Change-Id: I6cdd6375e36da23bd452a7c7273ff42789e94433 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vnet/interface_funcs.h')
-rw-r--r--src/vnet/interface_funcs.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/vnet/interface_funcs.h b/src/vnet/interface_funcs.h
index eef5596644c..7dfa617e2fe 100644
--- a/src/vnet/interface_funcs.h
+++ b/src/vnet/interface_funcs.h
@@ -557,6 +557,31 @@ pcap_add_buffer (pcap_main_t *pm, struct vlib_main_t *vm, u32 buffer_index,
clib_spinlock_unlock_if_init (&pm->lock);
}
}
+
+typedef struct
+{
+ vnet_hw_if_caps_t val;
+ vnet_hw_if_caps_t mask;
+} vnet_hw_if_caps_change_t;
+
+void vnet_hw_if_change_caps (vnet_main_t *vnm, u32 hw_if_index,
+ vnet_hw_if_caps_change_t *caps);
+
+static_always_inline void
+vnet_hw_if_set_caps (vnet_main_t *vnm, u32 hw_if_index, vnet_hw_if_caps_t caps)
+{
+ vnet_hw_if_caps_change_t cc = { .val = caps, .mask = caps };
+ vnet_hw_if_change_caps (vnm, hw_if_index, &cc);
+}
+
+static_always_inline void
+vnet_hw_if_unset_caps (vnet_main_t *vnm, u32 hw_if_index,
+ vnet_hw_if_caps_t caps)
+{
+ vnet_hw_if_caps_change_t cc = { .val = 0, .mask = caps };
+ vnet_hw_if_change_caps (vnm, hw_if_index, &cc);
+}
+
#endif /* included_vnet_interface_funcs_h */
/*