diff options
author | Matteo Croce <mcroce@redhat.com> | 2019-10-29 14:50:50 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-10-30 17:21:35 -0700 |
commit | 98298e6ca6d5908f96e529e70a254a4d5bf754e7 (patch) | |
tree | 6ac75b9530965e78a7bc6ae19c038de6f8722325 /net/core | |
parent | c4917bfc3a6f768508e820c10294149de259fa74 (diff) | |
download | linux-stable-98298e6ca6d5908f96e529e70a254a4d5bf754e7.tar.gz linux-stable-98298e6ca6d5908f96e529e70a254a4d5bf754e7.tar.bz2 linux-stable-98298e6ca6d5908f96e529e70a254a4d5bf754e7.zip |
flow_dissector: add meaningful comments
Documents two piece of code which can't be understood at a glance.
Signed-off-by: Matteo Croce <mcroce@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/flow_dissector.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c index dbf502c18656..bc22b384ac6c 100644 --- a/net/core/flow_dissector.c +++ b/net/core/flow_dissector.c @@ -1408,6 +1408,9 @@ static inline size_t flow_keys_hash_length(const struct flow_keys *flow) { size_t diff = FLOW_KEYS_HASH_OFFSET + sizeof(flow->addrs); BUILD_BUG_ON((sizeof(*flow) - FLOW_KEYS_HASH_OFFSET) % sizeof(u32)); + /* flow.addrs MUST be the last member in struct flow_keys because + * different L3 protocols have different address length + */ BUILD_BUG_ON(offsetof(typeof(*flow), addrs) != sizeof(*flow) - sizeof(flow->addrs)); @@ -1455,6 +1458,9 @@ __be32 flow_get_u32_dst(const struct flow_keys *flow) } EXPORT_SYMBOL(flow_get_u32_dst); +/* Sort the source and destination IP (and the ports if the IP are the same), + * to have consistent hash within the two directions + */ static inline void __flow_hash_consistentify(struct flow_keys *keys) { int addr_diff, i; |