From 1113f6f470ba59fc2bdfbd966e12d8ba391b766a Mon Sep 17 00:00:00 2001 From: SqTER-PL <26832944+SqTER-PL@users.noreply.github.com> Date: Tue, 25 Feb 2025 22:52:15 +0100 Subject: [PATCH] Update qdisc patches to linux 6.x --- .../iproute2/patches/400-add-nss-qdisc.patch | 92 ++++++++++--------- .../iproute2/patches/500-add-nssmirred.patch | 6 +- 2 files changed, 51 insertions(+), 47 deletions(-) diff --git a/package/network/utils/iproute2/patches/400-add-nss-qdisc.patch b/package/network/utils/iproute2/patches/400-add-nss-qdisc.patch index 299710f791..06106df76e 100644 --- a/package/network/utils/iproute2/patches/400-add-nss-qdisc.patch +++ b/package/network/utils/iproute2/patches/400-add-nss-qdisc.patch @@ -36,6 +36,7 @@ + +#define TCA_NSSWRED_MAX (__TCA_NSSWRED_MAX - 1) +#define NSSWRED_CLASS_MAX 6 ++ +struct tc_red_alg_parameter { + __u32 min; /* qlen_avg < min: pkts are all enqueued */ + __u32 max; /* qlen_avg > max: pkts are all dropped */ @@ -247,7 +248,6 @@ + __u8 set_default; /* Sets qdisc to be the default qdisc for enqueue */ + __u8 accel_mode; /* Dictates which data plane offloads the qdisc */ +}; -+ + /* FIFO section */ @@ -264,7 +264,7 @@ --- /dev/null +++ b/tc/q_nss.c -@@ -0,0 +1,1826 @@ +@@ -0,0 +1,1830 @@ +/* + ************************************************************************** + * Copyright (c) 2015, 2018 The Linux Foundation. All rights reserved. @@ -310,7 +310,7 @@ + fprintf(stderr, " nsswred limit BYTES DP NUMBER min BYTES max BYTES avpkt BYTES dscp NUMBER [ probability VALUE ] [ burst PACKETS ]\n"); +} + -+static int nsswred_setup(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n) ++static int nsswred_setup(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n) +{ + struct rtattr *tail; + struct tc_nsswred_qopt opt; @@ -385,7 +385,7 @@ + return 0; +} + -+static int nsswred_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n) ++static int nsswred_parse_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) +{ + struct rtattr *tail; + struct tc_nsswred_qopt opt; @@ -534,7 +534,7 @@ + return 0; +} + -+static int nsswred_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) ++static int nsswred_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt) +{ + struct rtattr *tb[TCA_NSSWRED_MAX + 1]; + struct tc_nsswred_qopt *qopt; @@ -602,7 +602,7 @@ + fprintf(stderr, "Usage: ... nsspfifo [ limit PACKETS ] [ set_default ] [ accel_mode ]\n"); +} + -+static int nssfifo_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n) ++static int nssfifo_parse_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) +{ + struct rtattr *tail; + struct tc_nssfifo_qopt opt; @@ -652,7 +652,7 @@ + return 0; +} + -+static int nssfifo_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) ++static int nssfifo_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt) +{ + struct rtattr *tb[TCA_NSSFIFO_MAX + 1]; + struct tc_nssfifo_qopt *qopt; @@ -709,7 +709,7 @@ + fprintf(stderr, "Value of target and interval should be greater than 1ms\n"); +} + -+static int nssfq_codel_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n) ++static int nssfq_codel_parse_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) +{ + struct rtattr *tail; + struct tc_nsscodel_qopt opt; @@ -797,7 +797,7 @@ + return 0; +} + -+static int nssfq_codel_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) ++static int nssfq_codel_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt) +{ + struct rtattr *tb[TCA_NSSCODEL_MAX + 1]; + struct tc_nsscodel_qopt *qopt; @@ -835,7 +835,7 @@ + return 0; +} + -+static int nssfq_codel_print_xstats(struct qdisc_util *qu, FILE *f, struct rtattr *xstats) ++static int nssfq_codel_print_xstats(const struct qdisc_util *qu, FILE *f, struct rtattr *xstats) +{ + struct tc_nssfq_codel_xstats *st; + @@ -872,7 +872,7 @@ + fprintf(stderr, "Value of target and interval should be greater than 1ms\n"); +} + -+static int nsscodel_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n) ++static int nsscodel_parse_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) +{ + struct rtattr *tail; + struct tc_nsscodel_qopt opt; @@ -944,7 +944,7 @@ + return 0; +} + -+static int nsscodel_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) ++static int nsscodel_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt) +{ + struct rtattr *tb[TCA_NSSCODEL_MAX + 1]; + struct tc_nsscodel_qopt *qopt; @@ -977,7 +977,7 @@ + return 0; +} + -+static int nsscodel_print_xstats(struct qdisc_util *qu, FILE *f, struct rtattr *xstats) ++static int nsscodel_print_xstats(const struct qdisc_util *qu, FILE *f, struct rtattr *xstats) +{ + struct tc_nsscodel_xstats *st; + @@ -1008,7 +1008,7 @@ + fprintf(stderr, "Usage: ... nsstbl burst BYTES rate BPS [ mtu BYTES ] [ accel_mode ]\n"); +} + -+static int nsstbl_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n) ++static int nsstbl_parse_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) +{ + int ok = 0; + struct rtattr *tail; @@ -1108,10 +1108,11 @@ + return 0; +} + -+static int nsstbl_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) ++static int nsstbl_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt) +{ + struct rtattr *tb[TCA_NSSTBL_MAX + 1]; + struct tc_nsstbl_qopt *qopt; ++ SPRINT_BUF(b1); + + if (opt == NULL) + return 0; @@ -1126,9 +1127,9 @@ + + qopt = RTA_DATA(tb[TCA_NSSTBL_PARMS]); + -+ print_size(PRINT_FP, NULL, "buffer/maxburst %s ", qopt->burst); ++ fprintf(f, "buffer/maxburst %s ", sprint_size(qopt->burst, b1)); + tc_print_rate(PRINT_FP, NULL, "rate %s ", qopt->rate); -+ print_size(PRINT_FP, NULL, "mtu %s ", qopt->mtu); ++ fprintf(f, "mtu %s ", sprint_size(qopt->mtu, b1)); + fprintf(f, "accel_mode %d ", qopt->accel_mode); + + return 0; @@ -1147,7 +1148,7 @@ + fprintf(stderr, "Usage: ... nssprio [ bands NUMBER (default 256) ] [ accel_mode ]\n"); +} + -+static int nssprio_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n) ++static int nssprio_parse_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) +{ + int ok = 0; + struct rtattr *tail; @@ -1204,7 +1205,7 @@ + return 0; +} + -+static int nssprio_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) ++static int nssprio_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt) +{ + struct rtattr *tb[TCA_NSSPRIO_MAX + 1]; + struct tc_nssprio_qopt *qopt; @@ -1254,7 +1255,7 @@ + fprintf(stderr, "NSSBF: Illegal \"%s\"\n", arg); +} + -+static int nssbf_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n) ++static int nssbf_parse_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) +{ + struct tc_nssbf_qopt opt; + struct rtattr *tail; @@ -1306,7 +1307,7 @@ + return 0; +} + -+static int nssbf_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) ++static int nssbf_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt) +{ + struct rtattr *tb[TCA_NSSBF_MAX + 1]; + struct tc_nssbf_qopt *qopt; @@ -1329,7 +1330,7 @@ + return 0; +} + -+static int nssbf_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n) ++static int nssbf_parse_class_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) +{ + int ok = 0; + struct rtattr *tail; @@ -1413,10 +1414,11 @@ + return 0; +} + -+static int nssbf_print_class_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) ++static int nssbf_print_class_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt) +{ + struct rtattr *tb[TCA_NSSBF_MAX + 1]; + struct tc_nssbf_class_qopt *qopt; ++ SPRINT_BUF(b1); + + if (opt == NULL) + return 0; @@ -1431,10 +1433,11 @@ + + qopt = RTA_DATA(tb[TCA_NSSBF_CLASS_PARMS]); + -+ print_size(PRINT_FP, NULL, "burst %s ", qopt->burst); ++ ++ fprintf(f, "burst %s ", sprint_size(qopt->burst, b1)); + tc_print_rate(PRINT_FP, NULL, "rate %s ", qopt->rate); -+ print_size(PRINT_FP, NULL, "quantum %s ", qopt->quantum); -+ print_size(PRINT_FP, NULL, "mtu %s ", qopt->mtu); ++ fprintf(f, "quantum %s ", sprint_size(qopt->quantum, b1)); ++ fprintf(f, "mtu %s ", sprint_size(qopt->mtu, b1)); + + return 0; +} @@ -1459,7 +1462,7 @@ + fprintf(stderr, "Usage (class): ... nsswrr quantum PACKETS ]\n"); +} + -+static int nsswrr_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n) ++static int nsswrr_parse_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) +{ + struct tc_nsswrr_qopt opt; + bool accel_mode = false; @@ -1501,7 +1504,7 @@ + return 0; +} + -+static int nsswrr_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) ++static int nsswrr_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt) +{ + struct rtattr *tb[TCA_NSSWRR_MAX + 1]; + struct tc_nsswrr_qopt *qopt; @@ -1523,7 +1526,7 @@ + return 0; +} + -+static int nsswrr_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n) ++static int nsswrr_parse_class_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) +{ + int ok = 0; + struct rtattr *tail; @@ -1563,7 +1566,7 @@ + return 0; +} + -+static int nsswrr_print_class_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) ++static int nsswrr_print_class_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt) +{ + struct rtattr *tb[TCA_NSSWRR_MAX + 1]; + struct tc_nsswrr_class_qopt *qopt; @@ -1593,6 +1596,7 @@ + .print_copt = nsswrr_print_class_opt, +}; + ++ +/* ======================== NSSWFQ =======================*/ + +static void nsswfq_explain_qdisc(void) @@ -1605,7 +1609,7 @@ + fprintf(stderr, "Usage (class): ... nsswfq quantum BYTES ]\n"); +} + -+static int nsswfq_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n) ++static int nsswfq_parse_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) +{ + struct tc_nsswfq_qopt opt; + bool accel_mode = false; @@ -1647,7 +1651,7 @@ + return 0; +} + -+static int nsswfq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) ++static int nsswfq_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt) +{ + struct rtattr *tb[TCA_NSSWFQ_MAX + 1]; + struct tc_nsswfq_qopt *qopt; @@ -1669,7 +1673,7 @@ + return 0; +} + -+static int nsswfq_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n) ++static int nsswfq_parse_class_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) +{ + int ok = 0; + struct rtattr *tail; @@ -1709,7 +1713,7 @@ + return 0; +} + -+static int nsswfq_print_class_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) ++static int nsswfq_print_class_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt) +{ + struct rtattr *tb[TCA_NSSWFQ_MAX + 1]; + struct tc_nsswfq_class_qopt *qopt; @@ -1761,7 +1765,7 @@ + fprintf(stderr, "NSSHTB: Illegal \"%s\"\n", arg); +} + -+static int nsshtb_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n) ++static int nsshtb_parse_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) +{ + struct tc_nsshtb_qopt opt; + struct rtattr *tail; @@ -1813,7 +1817,7 @@ + return 0; +} + -+static int nsshtb_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) ++static int nsshtb_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt) +{ + struct rtattr *tb[TCA_NSSHTB_MAX + 1]; + struct tc_nsshtb_qopt *qopt; @@ -1839,7 +1843,7 @@ + return 0; +} + -+static int nsshtb_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n) ++static int nsshtb_parse_class_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) +{ + int ok = 0; + struct rtattr *tail; @@ -1971,7 +1975,7 @@ + return 0; +} + -+static int nsshtb_print_class_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) ++static int nsshtb_print_class_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt) +{ + struct rtattr *tb[TCA_NSSHTB_MAX + 1]; + struct tc_nsshtb_class_qopt *qopt; @@ -1990,13 +1994,13 @@ + + qopt = RTA_DATA(tb[TCA_NSSHTB_CLASS_PARMS]); + -+ print_size(PRINT_FP, NULL, "burst %s ", qopt->burst); ++ fprintf(f, "burst %s ", sprint_size(qopt->burst, b1)); + tc_print_rate(PRINT_FP, NULL, "rate %s ", qopt->rate); -+ print_size(PRINT_FP, NULL, "cburst %s ", qopt->cburst); ++ fprintf(f, "cburst %s ", sprint_size(qopt->cburst, b1)); + tc_print_rate(PRINT_FP, NULL, "crate %s ", qopt->crate); + fprintf(f, "priority %u ", qopt->priority); -+ print_size(PRINT_FP, NULL, "quantum %s ", qopt->quantum); -+ print_size(PRINT_FP, NULL, "overhead %s ", qopt->overhead); ++ fprintf(f, "quantum %s ", sprint_size(qopt->quantum, b1)); ++ fprintf(f, "overhead %s ", sprint_size(qopt->overhead, b1)); + + return 0; +} @@ -2016,7 +2020,7 @@ + fprintf(stderr, "Usage: ... nssblackhole [ set_default ] [ accel_mode ]\n"); +} + -+static int nssblackhole_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n) ++static int nssblackhole_parse_opt(const struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev) +{ + struct rtattr *tail; + struct tc_nssblackhole_qopt opt; @@ -2060,7 +2064,7 @@ + return 0; +} + -+static int nssblackhole_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) ++static int nssblackhole_print_opt(const struct qdisc_util *qu, FILE *f, struct rtattr *opt) +{ + struct rtattr *tb[TCA_NSSBLACKHOLE_MAX + 1]; + struct tc_nssblackhole_qopt *qopt; diff --git a/package/network/utils/iproute2/patches/500-add-nssmirred.patch b/package/network/utils/iproute2/patches/500-add-nssmirred.patch index f4c3bc587d..46999ee257 100644 --- a/package/network/utils/iproute2/patches/500-add-nssmirred.patch +++ b/package/network/utils/iproute2/patches/500-add-nssmirred.patch @@ -68,7 +68,7 @@ + * parse_nss_mirred() + * Parse and validate the nssmirred action statement. + */ -+static int parse_nss_mirred(struct action_util *a, int *argc_p, char ***argv_p, ++static int parse_nss_mirred(const struct action_util *a, int *argc_p, char ***argv_p, + int tca_id, struct nlmsghdr *n) +{ + int idx, argc = *argc_p; @@ -142,7 +142,7 @@ + * print_nss_mirred() + * Print information related to nssmirred action. + */ -+static int print_nss_mirred(struct action_util *au, FILE * f, struct rtattr *arg) ++static int print_nss_mirred(const struct action_util *au, FILE *f, struct rtattr *arg) +{ + struct tc_nss_mirred *p; + struct rtattr *tb[TCA_NSS_MIRRED_MAX + 1]; @@ -176,7 +176,7 @@ + if (show_stats) { + if (tb[TCA_NSS_MIRRED_TM]) { + struct tcf_t *tm = RTA_DATA(tb[TCA_NSS_MIRRED_TM]); -+ print_tm(f,tm); ++ print_tm(tm); + } + } + return 0;