| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * net/sched/sch_choke.c CHOKE scheduler |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (c) 2011 Stephen Hemminger <shemminger@vyatta.com> |
|---|
| 5 | 6 | * Copyright (c) 2011 Eric Dumazet <eric.dumazet@gmail.com> |
|---|
| 6 | | - * |
|---|
| 7 | | - * This program is free software; you can redistribute it and/or |
|---|
| 8 | | - * modify it under the terms of the GNU General Public License |
|---|
| 9 | | - * version 2 as published by the Free Software Foundation. |
|---|
| 10 | | - * |
|---|
| 11 | 7 | */ |
|---|
| 12 | 8 | |
|---|
| 13 | 9 | #include <linux/module.h> |
|---|
| .. | .. |
|---|
| 135 | 131 | } |
|---|
| 136 | 132 | |
|---|
| 137 | 133 | struct choke_skb_cb { |
|---|
| 138 | | - u16 classid; |
|---|
| 139 | 134 | u8 keys_valid; |
|---|
| 140 | 135 | struct flow_keys_digest keys; |
|---|
| 141 | 136 | }; |
|---|
| .. | .. |
|---|
| 144 | 139 | { |
|---|
| 145 | 140 | qdisc_cb_private_validate(skb, sizeof(struct choke_skb_cb)); |
|---|
| 146 | 141 | return (struct choke_skb_cb *)qdisc_skb_cb(skb)->data; |
|---|
| 147 | | -} |
|---|
| 148 | | - |
|---|
| 149 | | -static inline void choke_set_classid(struct sk_buff *skb, u16 classid) |
|---|
| 150 | | -{ |
|---|
| 151 | | - choke_skb_cb(skb)->classid = classid; |
|---|
| 152 | 142 | } |
|---|
| 153 | 143 | |
|---|
| 154 | 144 | /* |
|---|
| .. | .. |
|---|
| 325 | 315 | rtnl_qdisc_drop(skb, sch); |
|---|
| 326 | 316 | } |
|---|
| 327 | 317 | |
|---|
| 328 | | - sch->q.qlen = 0; |
|---|
| 329 | | - sch->qstats.backlog = 0; |
|---|
| 330 | 318 | if (q->tab) |
|---|
| 331 | 319 | memset(q->tab, 0, (q->tab_mask + 1) * sizeof(struct sk_buff *)); |
|---|
| 332 | 320 | q->head = q->tail = 0; |
|---|
| .. | .. |
|---|
| 360 | 348 | if (opt == NULL) |
|---|
| 361 | 349 | return -EINVAL; |
|---|
| 362 | 350 | |
|---|
| 363 | | - err = nla_parse_nested(tb, TCA_CHOKE_MAX, opt, choke_policy, NULL); |
|---|
| 351 | + err = nla_parse_nested_deprecated(tb, TCA_CHOKE_MAX, opt, |
|---|
| 352 | + choke_policy, NULL); |
|---|
| 364 | 353 | if (err < 0) |
|---|
| 365 | 354 | return err; |
|---|
| 366 | 355 | |
|---|
| .. | .. |
|---|
| 382 | 371 | if (mask != q->tab_mask) { |
|---|
| 383 | 372 | struct sk_buff **ntab; |
|---|
| 384 | 373 | |
|---|
| 385 | | - ntab = kvmalloc_array((mask + 1), sizeof(struct sk_buff *), GFP_KERNEL | __GFP_ZERO); |
|---|
| 374 | + ntab = kvcalloc(mask + 1, sizeof(struct sk_buff *), GFP_KERNEL); |
|---|
| 386 | 375 | if (!ntab) |
|---|
| 387 | 376 | return -ENOMEM; |
|---|
| 388 | 377 | |
|---|
| .. | .. |
|---|
| 454 | 443 | .Scell_log = q->parms.Scell_log, |
|---|
| 455 | 444 | }; |
|---|
| 456 | 445 | |
|---|
| 457 | | - opts = nla_nest_start(skb, TCA_OPTIONS); |
|---|
| 446 | + opts = nla_nest_start_noflag(skb, TCA_OPTIONS); |
|---|
| 458 | 447 | if (opts == NULL) |
|---|
| 459 | 448 | goto nla_put_failure; |
|---|
| 460 | 449 | |
|---|