aboutgitcodebugslistschat
path: root/flow.h
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2024-07-17 14:52:19 +1000
committerStefano Brivio <sbrivio@redhat.com>2024-07-17 15:29:47 +0200
commit71d7985188a7ef6e6a82efea0c87aa4d50ff8afa (patch)
treede4092f9886e65851e806abe471e051999c7a9fa /flow.h
parent9b125e7776333326b91adfc4cfd54298737004cd (diff)
downloadpasst-71d7985188a7ef6e6a82efea0c87aa4d50ff8afa.tar
passt-71d7985188a7ef6e6a82efea0c87aa4d50ff8afa.tar.gz
passt-71d7985188a7ef6e6a82efea0c87aa4d50ff8afa.tar.bz2
passt-71d7985188a7ef6e6a82efea0c87aa4d50ff8afa.tar.lz
passt-71d7985188a7ef6e6a82efea0c87aa4d50ff8afa.tar.xz
passt-71d7985188a7ef6e6a82efea0c87aa4d50ff8afa.tar.zst
passt-71d7985188a7ef6e6a82efea0c87aa4d50ff8afa.zip
flow, tcp_splice: Prefer 'sidei' for variables referring to side index
In various places we have variables named 'side' or similar which always have the value 0 or 1 (INISIDE or TGTSIDE). Given a flow, this refers to a specific side of it. Upcoming flow table work will make it more useful for "side" to refer to a specific side of a specific flow. To make things less confusing then, prefer the name term "side index" and name 'sidei' for variables with just the 0 or 1 value. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> [sbrivio: Fixed minor detail in comment to struct flow_common] Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'flow.h')
-rw-r--r--flow.h18
1 files changed, 9 insertions, 9 deletions
diff --git a/flow.h b/flow.h
index d1f49c6..b518904 100644
--- a/flow.h
+++ b/flow.h
@@ -132,8 +132,8 @@ extern const uint8_t flow_proto[];
#define SIDES 2
-#define INISIDE 0 /* Initiating side */
-#define TGTSIDE 1 /* Target side */
+#define INISIDE 0 /* Initiating side index */
+#define TGTSIDE 1 /* Target side index */
/**
* struct flow_common - Common fields for packet flows
@@ -164,17 +164,17 @@ struct flow_common {
/**
* struct flow_sidx - ID for one side of a specific flow
- * @side: Side referenced (0 or 1)
- * @flow: Index of flow referenced
+ * @sidei: Index of side referenced (0 or 1)
+ * @flowi: Index of flow referenced
*/
typedef struct flow_sidx {
- unsigned side :1;
- unsigned flow :FLOW_INDEX_BITS;
+ unsigned sidei :1;
+ unsigned flowi :FLOW_INDEX_BITS;
} flow_sidx_t;
static_assert(sizeof(flow_sidx_t) <= sizeof(uint32_t),
"flow_sidx_t must fit within 32 bits");
-#define FLOW_SIDX_NONE ((flow_sidx_t){ .flow = FLOW_MAX })
+#define FLOW_SIDX_NONE ((flow_sidx_t){ .flowi = FLOW_MAX })
/**
* flow_sidx_valid() - Test if a sidx is valid
@@ -184,7 +184,7 @@ static_assert(sizeof(flow_sidx_t) <= sizeof(uint32_t),
*/
static inline bool flow_sidx_valid(flow_sidx_t sidx)
{
- return sidx.flow < FLOW_MAX;
+ return sidx.flowi < FLOW_MAX;
}
/**
@@ -195,7 +195,7 @@ static inline bool flow_sidx_valid(flow_sidx_t sidx)
*/
static inline bool flow_sidx_eq(flow_sidx_t a, flow_sidx_t b)
{
- return (a.flow == b.flow) && (a.side == b.side);
+ return (a.flowi == b.flowi) && (a.sidei == b.sidei);
}
union flow;