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.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'flow.h') 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; -- cgit v1.2.3