浏览代码

fix: add tcp_snd_cwnd helper functions patch for BBRv3 on android13-5.15 sublevel <= 43

The BBRv3 congestion control module requires tcp_snd_cwnd() and
tcp_snd_cwnd_set() helper functions which are missing in
android13-5.15 kernels with sublevel <= 43 (e.g. 5.15.41).

This commit adds:
- Patch file to define tcp_snd_cwnd() and tcp_snd_cwnd_set() helpers
- Conditional application in networking action for affected kernel versions
TheWildJames 2 月之前
父节点
当前提交
981ba6e371

+ 3 - 0
.github/actions/networking/action.yml

@@ -111,6 +111,9 @@ runs:
           patch -p1 < ${{ github.action_path }}/patches/0001-net-tcp-backport-BBRv3-to-android14-5.15.patch
         elif [[ ${{ inputs.version }} == "android13-5.15" ]]; then
           patch -p1 < "${{ github.workspace }}/kernel_patches/common/bbrv3/0001-net-tcp-backport-BBRv3-to-android13-5.15.patch"
+          if [[ ${{ inputs.sublevel }} -le "43" ]]; then
+            patch -p1 < ${{ github.action_path }}/patches/0002-net-tcp-add-tcp_snd_cwnd-and-tcp_snd_cwnd_set-helper-functions.patch
+          fi
         elif [[ ${{ inputs.version }} == "android13-5.10" ]]; then
           patch -p1 < "${{ github.workspace }}/kernel_patches/common/bbrv3/0001-net-tcp-backport-BBRv3-to-android12-5.10.patch"
         elif [[ ${{ inputs.version }} == "android12-5.10" ]]; then

+ 42 - 0
.github/actions/networking/patches/0002-net-tcp-add-tcp_snd_cwnd-and-tcp_snd_cwnd_set-helper-functions.patch

@@ -0,0 +1,42 @@
+From: Zoo <zoo@example.com>
+Date: Thu, 13 Jul 2026 20:55:00 +0000
+Subject: [PATCH] net: tcp: add tcp_snd_cwnd() and tcp_snd_cwnd_set() helper
+ functions
+
+The BBRv3 congestion control module uses tcp_snd_cwnd() and
+tcp_snd_cwnd_set() helper functions to access and modify the
+send cwnd value. These functions were added in later 5.15
+kernel versions and are required for BBRv3 to compile.
+
+This patch backports these helper function definitions to
+the android13-5.15-2022-11 kernel.
+
+Signed-off-by: Zoo <zoo@example.com>
+---
+ include/net/tcp.h | 11 +++++++++++
+ 1 file changed, 11 insertions(+)
+
+diff --git a/include/net/tcp.h b/include/net/tcp.h
+index 834a775..a4c4176 100644
+--- a/include/net/tcp.h
++++ b/include/net/tcp.h
+@@ -1198,6 +1198,17 @@ static inline unsigned int tcp_packets_in_flight(const struct tcp_sock *tp)
+ 
+ #define TCP_INFINITE_SSTHRESH	0x7fffffff
+ 
++static inline u32 tcp_snd_cwnd(const struct tcp_sock *tp)
++{
++	return tp->snd_cwnd;
++}
++
++static inline void tcp_snd_cwnd_set(struct tcp_sock *tp, u32 val)
++{
++	WARN_ON_ONCE((int)val <= 0);
++	tp->snd_cwnd = val;
++}
++
+ static inline bool tcp_in_slow_start(const struct tcp_sock *tp)
+ {
+ 	return tp->snd_cwnd < tp->snd_ssthresh;
+-- 
+2.48.2