From 71d7985188a7ef6e6a82efea0c87aa4d50ff8afa Mon Sep 17 00:00:00 2001 From: David Gibson Date: Wed, 17 Jul 2024 14:52:19 +1000 Subject: 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 [sbrivio: Fixed minor detail in comment to struct flow_common] Signed-off-by: Stefano Brivio --- flow_table.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'flow_table.h') 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); -- cgit v1.2.3