From a0e2b28801d2ddb5ccf80a7c5d0b9ac9b75f736d Mon Sep 17 00:00:00 2001 From: Vadim Kochan Date: Fri, 5 Aug 2016 15:04:38 +0200 Subject: trafgen: proto: Use field id as array index Usually proto fields array are sorted in the same order as the respective enum. Thus, the id can be used used as an array index for faster lookup. Add an explanatory comment and enforce the correspondence of id and index using bug_on(). This will make csum field calculation a little faster at runtime. Signed-off-by: Vadim Kochan Signed-off-by: Tobias Klauser --- trafgen_l3.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'trafgen_l3.h') diff --git a/trafgen_l3.h b/trafgen_l3.h index a1b1523..e0c9a1c 100644 --- a/trafgen_l3.h +++ b/trafgen_l3.h @@ -10,14 +10,14 @@ enum ip4_field { IP4_LEN, IP4_ID, IP4_FLAGS, + IP4_MF, + IP4_DF, IP4_FRAG_OFFS, IP4_TTL, IP4_PROTO, IP4_CSUM, IP4_SADDR, IP4_DADDR, - IP4_DF, - IP4_MF, }; enum ip6_field { -- cgit v1.2.3-54-g00ecf