Re: [PATCH] net: Initialize entire flowi struct
From: Julian Anastasov <ja@ssi.bg>
Date: 2011-09-03 07:27:46
Hello, On Thu, 1 Sep 2011, Ward, David - 0663 - MITLL wrote:
quoted
Not sure if adding size as parameter to flow_hash_code is better approach. May be flow_cache_lookup needs to determine size from family that can be used for flow_hash_code, flow_key_compare and the memcpy(&fle->key, key, sizeof(*key)) after fle = kmem_cache_alloc(flow_cachep, GFP_ATOMIC).Makes sense to me. However should we just replace flow_key_compare with memcmp then, since the assumptions about constant size and alignment will no longer apply? Or should there be a separate flow_key_compare function for each family, and have all of the flowi* structures become __attribute__((__aligned__(BITS_PER_LONG/8))) ?
I don't know this code well but I guess memcmp is not preferred. IMHO, as the callers provide per-family structures and we do not want to change that, these structures must be aligned to long type as required by flow_compare_t and jhash2 (at least u32) usage. The second option is to use memcmp and jhash instead of jhash2 to avoid such alignment but I guess other developers will oppose it. More opinions are needed here. Regards -- Julian Anastasov [off-list ref]