diff mbox series

[mptcp-next,RFC,1/4] mptcp: add push sched callback

Message ID 20240527-sched_per_packet-v1-1-09a41d405f7c@gmail.com (mailing list archive)
State Needs ACK
Headers show
Series mptcp: update scheduler API | expand

Checks

Context Check Description
matttbe/build success Build and static analysis OK
matttbe/checkpatch success total: 0 errors, 0 warnings, 0 checks, 39 lines checked
matttbe/shellcheck success MPTCP selftests files have not been modified
matttbe/KVM_Validation__normal success Success! ✅
matttbe/KVM_Validation__debug success Success! ✅
matttbe/KVM_Validation__btf__only_bpftest_all_ success Success! ✅

Commit Message

Gregory Detal May 27, 2024, 1:17 p.m. UTC
The callback is optional. It takes the current subflow and the current
chunk of data that is scheduled on that subflow.

When defined, a scheduler will be able to:
 - update the limit field to limit the number of bytes sent on the
   ongoing scheduled subflow.
 - set the flag MPTCP_SCHED_FLAG_RESCHEDULE to force the get_subflow
   to be called again after sending the chunk.

Signed-off-by: Gregory Detal <gregory.detal@gmail.com>
---
 include/net/mptcp.h | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
diff mbox series

Patch

diff --git a/include/net/mptcp.h b/include/net/mptcp.h
index 0bc4ab03f487..2e00ee6b56f6 100644
--- a/include/net/mptcp.h
+++ b/include/net/mptcp.h
@@ -108,10 +108,39 @@  struct mptcp_sched_data {
 	struct mptcp_subflow_context *contexts[MPTCP_SUBFLOWS_MAX];
 };
 
+/* MPTCP scheduler push flags */
+#define MPTCP_SCHED_FLAG_RESCHEDULE BIT(0)
+
+/* Represent a chunk of data that will be sent on a subflow */
+struct mptcp_sched_chunk {
+	/* The data sequence number of the first byte of the chunk. read-only. */
+	u64 data_seq;
+
+	/* The maximum number of bytes to send in this chunk.
+	 * Update this value to limit the amount of data to be sent.
+	 */
+	u16 limit;
+
+	/* Define the behavior of the scheduler to apply to this chunk.
+	 * Available flags are:
+	 * - MPTCP_SCHED_FLAG_RESCHEDULE: the scheduler will be called again
+	 *   after processing this chunk (potentially limited).
+	 *
+	 * 0 means default behavior, ie. full chunk sent and subflow continue
+	 * being used for further chunks.
+	 */
+	u16 flags;
+};
+
 struct mptcp_sched_ops {
 	int (*get_subflow)(struct mptcp_sock *msk,
 			   struct mptcp_sched_data *data);
 
+	/* Called before sending data on a subflow. (optional) */
+	void (*push)(struct mptcp_sock *msk,
+		     struct mptcp_subflow_context *subflow,
+		     struct mptcp_sched_chunk *chunk);
+
 	char			name[MPTCP_SCHED_NAME_MAX];
 	struct module		*owner;
 	struct list_head	list;