net/sctp/stream_sched_rr.c
Source file repositories/reference/linux-study-clean/net/sctp/stream_sched_rr.c
File Facts
- System
- Linux kernel
- Corpus path
net/sctp/stream_sched_rr.c- Extension
.c- Size
- 4651 bytes
- Lines
- 191
- Domain
- Networking Core
- Bucket
- Sockets, Protocols, Packet Path, And Network Policy
- Inferred role
- Networking Core: implementation source
- Status
- source implementation candidate
Why This File Exists
Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/list.hnet/sctp/sctp.hnet/sctp/sm.hnet/sctp/stream_sched.h
Detected Declarations
function sctp_sched_rr_next_streamfunction sctp_sched_rr_unschedfunction sctp_sched_rr_schedfunction sctp_sched_rr_setfunction sctp_sched_rr_getfunction sctp_sched_rr_initfunction sctp_sched_rr_init_sidfunction sctp_sched_rr_free_sidfunction sctp_sched_rr_dequeue_donefunction sctp_sched_rr_sched_allfunction sctp_sched_rr_unsched_allfunction sctp_sched_ops_rr_init
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-or-later
/* SCTP kernel implementation
* (C) Copyright Red Hat Inc. 2017
*
* This file is part of the SCTP kernel implementation
*
* These functions manipulate sctp stream queue/scheduling.
*
* Please send any bug reports or fixes you make to the
* email addresched(es):
* lksctp developers <linux-sctp@vger.kernel.org>
*
* Written or modified by:
* Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
*/
#include <linux/list.h>
#include <net/sctp/sctp.h>
#include <net/sctp/sm.h>
#include <net/sctp/stream_sched.h>
/* Priority handling
* RFC DRAFT ndata section 3.2
*/
static void sctp_sched_rr_unsched_all(struct sctp_stream *stream);
static void sctp_sched_rr_next_stream(struct sctp_stream *stream)
{
struct list_head *pos;
pos = stream->rr_next->rr_list.next;
if (pos == &stream->rr_list)
pos = pos->next;
stream->rr_next = list_entry(pos, struct sctp_stream_out_ext, rr_list);
}
static void sctp_sched_rr_unsched(struct sctp_stream *stream,
struct sctp_stream_out_ext *soute)
{
if (stream->rr_next == soute)
/* Try to move to the next stream */
sctp_sched_rr_next_stream(stream);
list_del_init(&soute->rr_list);
/* If we have no other stream queued, clear next */
if (list_empty(&stream->rr_list))
stream->rr_next = NULL;
}
static void sctp_sched_rr_sched(struct sctp_stream *stream,
struct sctp_stream_out_ext *soute)
{
if (!list_empty(&soute->rr_list))
/* Already scheduled. */
return;
/* Schedule the stream */
list_add_tail(&soute->rr_list, &stream->rr_list);
if (!stream->rr_next)
stream->rr_next = soute;
}
static int sctp_sched_rr_set(struct sctp_stream *stream, __u16 sid,
__u16 prio, gfp_t gfp)
{
return 0;
}
static int sctp_sched_rr_get(struct sctp_stream *stream, __u16 sid,
__u16 *value)
{
return 0;
}
static int sctp_sched_rr_init(struct sctp_stream *stream)
{
INIT_LIST_HEAD(&stream->rr_list);
stream->rr_next = NULL;
return 0;
}
static int sctp_sched_rr_init_sid(struct sctp_stream *stream, __u16 sid,
gfp_t gfp)
{
INIT_LIST_HEAD(&SCTP_SO(stream, sid)->ext->rr_list);
return 0;
Annotation
- Immediate include surface: `linux/list.h`, `net/sctp/sctp.h`, `net/sctp/sm.h`, `net/sctp/stream_sched.h`.
- Detected declarations: `function sctp_sched_rr_next_stream`, `function sctp_sched_rr_unsched`, `function sctp_sched_rr_sched`, `function sctp_sched_rr_set`, `function sctp_sched_rr_get`, `function sctp_sched_rr_init`, `function sctp_sched_rr_init_sid`, `function sctp_sched_rr_free_sid`, `function sctp_sched_rr_dequeue_done`, `function sctp_sched_rr_sched_all`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.