--- zzzz-none-000/linux-4.9.218/net/sched/cls_u32.c 2020-04-02 15:20:41.000000000 +0000 +++ seale-7590ac-750/linux-4.9.218/net/sched/cls_u32.c 2022-11-30 09:46:20.000000000 +0000 @@ -65,6 +65,9 @@ u32 mask; u32 __percpu *pcpu_success; #endif +#ifdef CONFIG_CLS_U32_EXTMARK + struct tc_u32_mark extmark; +#endif struct tcf_proto *tp; struct rcu_head rcu; /* The 'sel' field MUST be the last field in structure to allow for @@ -148,6 +151,14 @@ __this_cpu_inc(*n->pcpu_success); } #endif +#ifdef CONFIG_CLS_U32_EXTMARK + if ((skb->extmark & n->extmark.mask) != n->extmark.val) { + n = n->next; + goto next_knode; + } else { + n->extmark.success++; + } +#endif for (i = n->sel.nkeys; i > 0; i--, key++) { int toff = off + key->off + (off2 & key->offmask); @@ -691,14 +702,17 @@ } static const struct nla_policy u32_policy[TCA_U32_MAX + 1] = { - [TCA_U32_CLASSID] = { .type = NLA_U32 }, - [TCA_U32_HASH] = { .type = NLA_U32 }, - [TCA_U32_LINK] = { .type = NLA_U32 }, - [TCA_U32_DIVISOR] = { .type = NLA_U32 }, - [TCA_U32_SEL] = { .len = sizeof(struct tc_u32_sel) }, - [TCA_U32_INDEV] = { .type = NLA_STRING, .len = IFNAMSIZ }, - [TCA_U32_MARK] = { .len = sizeof(struct tc_u32_mark) }, - [TCA_U32_FLAGS] = { .type = NLA_U32 }, + [TCA_U32_CLASSID] = { .type = NLA_U32 }, + [TCA_U32_HASH] = { .type = NLA_U32 }, + [TCA_U32_LINK] = { .type = NLA_U32 }, + [TCA_U32_DIVISOR] = { .type = NLA_U32 }, + [TCA_U32_SEL] = { .len = sizeof(struct tc_u32_sel) }, + [TCA_U32_INDEV] = { .type = NLA_STRING, .len = IFNAMSIZ }, + [TCA_U32_MARK] = { .len = sizeof(struct tc_u32_mark) }, +#ifdef CONFIG_CLS_U32_EXTMARK + [TCA_U32_EXTMARK] = { .len = sizeof(struct tc_u32_mark) }, +#endif + [TCA_U32_FLAGS] = { .type = NLA_U32 }, }; static int u32_set_parms(struct net *net, struct tcf_proto *tp, @@ -1011,6 +1025,15 @@ n->mask = mark->mask; } #endif +#ifdef CONFIG_CLS_U32_EXTMARK + if (tb[TCA_U32_EXTMARK]) { + struct tc_u32_mark *extmark; + + extmark = nla_data(tb[TCA_U32_EXTMARK]); + memcpy(&n->extmark, extmark, sizeof(struct tc_u32_mark)); + n->extmark.success = 0; + } +#endif err = u32_set_parms(net, tp, base, ht, n, tb, tca[TCA_RATE], ovr); if (err == 0) { @@ -1155,6 +1178,12 @@ goto nla_put_failure; } #endif +#ifdef CONFIG_CLS_U32_EXTMARK + if ((n->extmark.val || n->extmark.mask) && + nla_put(skb, TCA_U32_EXTMARK, + sizeof(n->extmark), &n->extmark)) + goto nla_put_failure; +#endif if (tcf_exts_dump(skb, &n->exts) < 0) goto nla_put_failure;