aboutgitcodebugslistschat
path: root/flow_table.h
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2024-07-17 14:52:20 +1000
committerStefano Brivio <sbrivio@redhat.com>2024-07-17 15:30:07 +0200
commit5235c47c791919333aec8707ff2839d50bdf727a (patch)
treec08fc1375c377e93b21da890606193d70bee3dd5 /flow_table.h
parent71d7985188a7ef6e6a82efea0c87aa4d50ff8afa (diff)
downloadpasst-5235c47c791919333aec8707ff2839d50bdf727a.tar
passt-5235c47c791919333aec8707ff2839d50bdf727a.tar.gz
passt-5235c47c791919333aec8707ff2839d50bdf727a.tar.bz2
passt-5235c47c791919333aec8707ff2839d50bdf727a.tar.lz
passt-5235c47c791919333aec8707ff2839d50bdf727a.tar.xz
passt-5235c47c791919333aec8707ff2839d50bdf727a.tar.zst
passt-5235c47c791919333aec8707ff2839d50bdf727a.zip
flow: Introduce flow_foreach_sidei() macro
We have a handful of places where we use a loop to step through each side of a flow or flows, and we're probably going to have mroe in future. Introduce a macro to implement this loop for convenience. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'flow_table.h')
-rw-r--r--flow_table.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/flow_table.h b/flow_table.h
index 8a5f8f2..4f5d041 100644
--- a/flow_table.h
+++ b/flow_table.h
@@ -41,6 +41,12 @@ union flow {
extern unsigned flow_first_free;
extern union flow flowtab[];
+/**
+ * flow_foreach_sidei() - 'for' type macro to step through each side of flow
+ * @sidei_: Takes value INISIDE, then TGTSIDE
+ */
+#define flow_foreach_sidei(sidei_) \
+ for ((sidei_) = INISIDE; (sidei_) < SIDES; (sidei_)++)
/** flow_idx() - Index of flow from common structure
* @f: Common flow fields pointer