trafgen: proto: Use field id as array index
commita0e2b28801d2ddb5ccf80a7c5d0b9ac9b75f736d
authorVadim Kochan <vadim4j@gmail.com>
Fri, 5 Aug 2016 13:04:38 +0000 (5 15:04 +0200)
committerTobias Klauser <tklauser@distanz.ch>
Fri, 5 Aug 2016 13:09:01 +0000 (5 15:09 +0200)
tree3b8f27a81ebec2d53e561fab9961024fc0217088
parentb073c8e5fd7f8c723680b659bd81afd231ef32f5
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 <vadim4j@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
trafgen_l3.h
trafgen_proto.c