aboutgitcodebugslistschat
path: root/flow_table.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_table.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_table.h')
-rw-r--r--flow_table.h18
1 files changed, 9 insertions, 9 deletions
diff --git a/flow_table.h b/flow_table.h
index ab73e44..8a5f8f2 100644
--- a/flow_table.h
+++ b/flow_table.h
@@ -75,7 +75,7 @@ static inline union flow *flow_at_sidx(flow_sidx_t sidx)
{
if (!flow_sidx_valid(sidx))
return NULL;
- return FLOW(sidx.flow);
+ return FLOW(sidx.flowi);
}
/** pif_at_sidx() - Interface for a given flow and side
@@ -89,34 +89,34 @@ static inline uint8_t pif_at_sidx(flow_sidx_t sidx)
if (!flow)
return PIF_NONE;
- return flow->f.pif[sidx.side];
+ return flow->f.pif[sidx.sidei];
}
/** flow_sidx() - Index of one side of a flow from common structure
* @f: Common flow fields pointer
- * @side: Which side to refer to (0 or 1)
+ * @sidei: Which side to refer to (0 or 1)
*
* Return: index of @f and @side in the flow table
*/
static inline flow_sidx_t flow_sidx(const struct flow_common *f,
- int side)
+ unsigned sidei)
{
/* cppcheck-suppress [knownConditionTrueFalse, unmatchedSuppression] */
- ASSERT(side == !!side);
+ ASSERT(sidei == !!sidei);
return (flow_sidx_t){
- .side = side,
- .flow = flow_idx(f),
+ .sidei = sidei,
+ .flowi = flow_idx(f),
};
}
/** FLOW_SIDX() - Find the index of one side of a flow
* @f_: Flow pointer, either union flow * or protocol specific
- * @side: Which side to index (0 or 1)
+ * @sidei: Which side to index (0 or 1)
*
* Return: index of @f and @side in the flow table
*/
-#define FLOW_SIDX(f_, side) (flow_sidx(&(f_)->f, (side)))
+#define FLOW_SIDX(f_, sidei) (flow_sidx(&(f_)->f, (sidei)))
union flow *flow_alloc(void);
void flow_alloc_cancel(union flow *flow);