| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* SCTP kernel implementation |
|---|
| 2 | 3 | * (C) Copyright Red Hat Inc. 2017 |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * This file is part of the SCTP kernel implementation |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * These functions manipulate sctp stream queue/scheduling. |
|---|
| 7 | | - * |
|---|
| 8 | | - * This SCTP implementation is free software; |
|---|
| 9 | | - * you can redistribute it and/or modify it under the terms of |
|---|
| 10 | | - * the GNU General Public License as published by |
|---|
| 11 | | - * the Free Software Foundation; either version 2, or (at your option) |
|---|
| 12 | | - * any later version. |
|---|
| 13 | | - * |
|---|
| 14 | | - * This SCTP implementation is distributed in the hope that it |
|---|
| 15 | | - * will be useful, but WITHOUT ANY WARRANTY; without even the implied |
|---|
| 16 | | - * ************************ |
|---|
| 17 | | - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|---|
| 18 | | - * See the GNU General Public License for more details. |
|---|
| 19 | | - * |
|---|
| 20 | | - * You should have received a copy of the GNU General Public License |
|---|
| 21 | | - * along with GNU CC; see the file COPYING. If not, see |
|---|
| 22 | | - * <http://www.gnu.org/licenses/>. |
|---|
| 23 | 8 | * |
|---|
| 24 | 9 | * Please send any bug reports or fixes you make to the |
|---|
| 25 | 10 | * email addresched(es): |
|---|
| .. | .. |
|---|
| 219 | 204 | return sctp_sched_prio_set(stream, sid, 0, gfp); |
|---|
| 220 | 205 | } |
|---|
| 221 | 206 | |
|---|
| 207 | +static void sctp_sched_prio_free_sid(struct sctp_stream *stream, __u16 sid) |
|---|
| 208 | +{ |
|---|
| 209 | + struct sctp_stream_priorities *prio = SCTP_SO(stream, sid)->ext->prio_head; |
|---|
| 210 | + int i; |
|---|
| 211 | + |
|---|
| 212 | + if (!prio) |
|---|
| 213 | + return; |
|---|
| 214 | + |
|---|
| 215 | + SCTP_SO(stream, sid)->ext->prio_head = NULL; |
|---|
| 216 | + for (i = 0; i < stream->outcnt; i++) { |
|---|
| 217 | + if (SCTP_SO(stream, i)->ext && |
|---|
| 218 | + SCTP_SO(stream, i)->ext->prio_head == prio) |
|---|
| 219 | + return; |
|---|
| 220 | + } |
|---|
| 221 | + |
|---|
| 222 | + kfree(prio); |
|---|
| 223 | +} |
|---|
| 224 | + |
|---|
| 222 | 225 | static void sctp_sched_prio_free(struct sctp_stream *stream) |
|---|
| 223 | 226 | { |
|---|
| 224 | 227 | struct sctp_stream_priorities *prio, *n; |
|---|
| .. | .. |
|---|
| 338 | 341 | .get = sctp_sched_prio_get, |
|---|
| 339 | 342 | .init = sctp_sched_prio_init, |
|---|
| 340 | 343 | .init_sid = sctp_sched_prio_init_sid, |
|---|
| 344 | + .free_sid = sctp_sched_prio_free_sid, |
|---|
| 341 | 345 | .free = sctp_sched_prio_free, |
|---|
| 342 | 346 | .enqueue = sctp_sched_prio_enqueue, |
|---|
| 343 | 347 | .dequeue = sctp_sched_prio_dequeue, |
|---|