Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

gro: move the tc_ext comparison to a helper

The double ifdefs (one for the variable declaration and
one around the code) are quite aesthetically displeasing.
Factor this code out into a helper for easier wrapping.

This will become even more ugly when another skb ext
comparison is added in the future.

The resulting machine code looks the same, the compiler
seems to try to use %rax more and some blocks more around
but I haven't spotted minor differences.

Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Jakub Kicinski and committed by
David S. Miller
2dc6af8b 988e8d90

+19 -13
+19 -13
net/core/gro.c
··· 304 304 } 305 305 EXPORT_SYMBOL(napi_gro_flush); 306 306 307 + static unsigned long gro_list_prepare_tc_ext(const struct sk_buff *skb, 308 + const struct sk_buff *p, 309 + unsigned long diffs) 310 + { 311 + #if IS_ENABLED(CONFIG_NET_TC_SKB_EXT) 312 + struct tc_skb_ext *skb_ext; 313 + struct tc_skb_ext *p_ext; 314 + 315 + skb_ext = skb_ext_find(skb, TC_SKB_EXT); 316 + p_ext = skb_ext_find(p, TC_SKB_EXT); 317 + 318 + diffs |= (!!p_ext) ^ (!!skb_ext); 319 + if (!diffs && unlikely(skb_ext)) 320 + diffs |= p_ext->chain ^ skb_ext->chain; 321 + #endif 322 + return diffs; 323 + } 324 + 307 325 static void gro_list_prepare(const struct list_head *head, 308 326 const struct sk_buff *skb) 309 327 { ··· 356 338 * avoid trying too hard to skip each of them individually 357 339 */ 358 340 if (!diffs && unlikely(skb->slow_gro | p->slow_gro)) { 359 - #if IS_ENABLED(CONFIG_SKB_EXTENSIONS) && IS_ENABLED(CONFIG_NET_TC_SKB_EXT) 360 - struct tc_skb_ext *skb_ext; 361 - struct tc_skb_ext *p_ext; 362 - #endif 363 - 364 341 diffs |= p->sk != skb->sk; 365 342 diffs |= skb_metadata_dst_cmp(p, skb); 366 343 diffs |= skb_get_nfct(p) ^ skb_get_nfct(skb); 367 344 368 - #if IS_ENABLED(CONFIG_SKB_EXTENSIONS) && IS_ENABLED(CONFIG_NET_TC_SKB_EXT) 369 - skb_ext = skb_ext_find(skb, TC_SKB_EXT); 370 - p_ext = skb_ext_find(p, TC_SKB_EXT); 371 - 372 - diffs |= (!!p_ext) ^ (!!skb_ext); 373 - if (!diffs && unlikely(skb_ext)) 374 - diffs |= p_ext->chain ^ skb_ext->chain; 375 - #endif 345 + diffs |= gro_list_prepare_tc_ext(skb, p, diffs); 376 346 } 377 347 378 348 NAPI_GRO_CB(p)->same_flow = !diffs;