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

net_sched: make room for (struct qdisc_skb_cb)->pkt_segs

Add a new u16 field, next to pkt_len : pkt_segs

This will cache shinfo->gso_segs to speed up qdisc deqeue().

Move slave_dev_queue_mapping at the end of qdisc_skb_cb,
and move three bits from tc_skb_cb :
- post_ct
- post_ct_snat
- post_ct_dnat

Signed-off-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20251121083256.674562-2-edumazet@google.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

authored by

Eric Dumazet and committed by
Paolo Abeni
b2a38f6d e3daf0e7

+18 -18
+9 -9
include/net/sch_generic.h
··· 429 429 }; 430 430 431 431 struct qdisc_skb_cb { 432 - struct { 433 - unsigned int pkt_len; 434 - u16 slave_dev_queue_mapping; 435 - u16 tc_classid; 436 - }; 432 + unsigned int pkt_len; 433 + u16 pkt_segs; 434 + u16 tc_classid; 437 435 #define QDISC_CB_PRIV_LEN 20 438 436 unsigned char data[QDISC_CB_PRIV_LEN]; 437 + 438 + u16 slave_dev_queue_mapping; 439 + u8 post_ct:1; 440 + u8 post_ct_snat:1; 441 + u8 post_ct_dnat:1; 439 442 }; 440 443 441 444 typedef void tcf_chain_head_change_t(struct tcf_proto *tp_head, void *priv); ··· 1067 1064 struct qdisc_skb_cb qdisc_cb; 1068 1065 u32 drop_reason; 1069 1066 1070 - u16 zone; /* Only valid if post_ct = true */ 1067 + u16 zone; /* Only valid if qdisc_skb_cb(skb)->post_ct = true */ 1071 1068 u16 mru; 1072 - u8 post_ct:1; 1073 - u8 post_ct_snat:1; 1074 - u8 post_ct_dnat:1; 1075 1069 }; 1076 1070 1077 1071 static inline struct tc_skb_cb *tc_skb_cb(const struct sk_buff *skb)
+1 -1
net/core/dev.c
··· 4355 4355 return ret; 4356 4356 4357 4357 tc_skb_cb(skb)->mru = 0; 4358 - tc_skb_cb(skb)->post_ct = false; 4358 + qdisc_skb_cb(skb)->post_ct = false; 4359 4359 tcf_set_drop_reason(skb, *drop_reason); 4360 4360 4361 4361 mini_qdisc_bstats_cpu_update(miniq, skb);
+4 -4
net/sched/act_ct.c
··· 948 948 return err & NF_VERDICT_MASK; 949 949 950 950 if (action & BIT(NF_NAT_MANIP_SRC)) 951 - tc_skb_cb(skb)->post_ct_snat = 1; 951 + qdisc_skb_cb(skb)->post_ct_snat = 1; 952 952 if (action & BIT(NF_NAT_MANIP_DST)) 953 - tc_skb_cb(skb)->post_ct_dnat = 1; 953 + qdisc_skb_cb(skb)->post_ct_dnat = 1; 954 954 955 955 return err; 956 956 #else ··· 986 986 tcf_action_update_bstats(&c->common, skb); 987 987 988 988 if (clear) { 989 - tc_skb_cb(skb)->post_ct = false; 989 + qdisc_skb_cb(skb)->post_ct = false; 990 990 ct = nf_ct_get(skb, &ctinfo); 991 991 if (ct) { 992 992 nf_ct_put(ct); ··· 1097 1097 out_push: 1098 1098 skb_push_rcsum(skb, nh_ofs); 1099 1099 1100 - tc_skb_cb(skb)->post_ct = true; 1100 + qdisc_skb_cb(skb)->post_ct = true; 1101 1101 tc_skb_cb(skb)->zone = p->zone; 1102 1102 out_clear: 1103 1103 if (defrag)
+3 -3
net/sched/cls_api.c
··· 1872 1872 } 1873 1873 ext->chain = last_executed_chain; 1874 1874 ext->mru = cb->mru; 1875 - ext->post_ct = cb->post_ct; 1876 - ext->post_ct_snat = cb->post_ct_snat; 1877 - ext->post_ct_dnat = cb->post_ct_dnat; 1875 + ext->post_ct = qdisc_skb_cb(skb)->post_ct; 1876 + ext->post_ct_snat = qdisc_skb_cb(skb)->post_ct_snat; 1877 + ext->post_ct_dnat = qdisc_skb_cb(skb)->post_ct_dnat; 1878 1878 ext->zone = cb->zone; 1879 1879 } 1880 1880 }
+1 -1
net/sched/cls_flower.c
··· 326 326 struct tcf_result *res) 327 327 { 328 328 struct cls_fl_head *head = rcu_dereference_bh(tp->root); 329 - bool post_ct = tc_skb_cb(skb)->post_ct; 329 + bool post_ct = qdisc_skb_cb(skb)->post_ct; 330 330 u16 zone = tc_skb_cb(skb)->zone; 331 331 struct fl_flow_key skb_key; 332 332 struct fl_flow_mask *mask;