Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a4be7b95 authored by Eric Dumazet's avatar Eric Dumazet Committed by Subash Abhinov Kasiviswanathan
Browse files

net: sk_pacing_shift_update() helper



In commit 3a9b76fd0db9 ("tcp: allow drivers to tweak TSQ logic")
I gave a code sample to set sk->sk_pacing_shift that was not complete.

Better add a helper that can be used by drivers without worries,
and maybe amended in the future.

A wifi driver might use it from its ndo_start_xmit()

Following call would setup TCP to allow up to ~8ms of queued data per
flow.

sk_pacing_shift_update(skb->sk, 7);

CRs-Fixed: 2156182
Change-Id: Id1675d3183004e8ba6eee4f7b1c7ba56124b696b
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Git-commit: c9f1f58dc2eba550f208809d272bf0b14f41edba
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git


Signed-off-by: default avatarSubash Abhinov Kasiviswanathan <subashab@codeaurora.org>
parent 4b9e740f
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -2384,4 +2384,15 @@ extern int sysctl_optmem_max;
extern __u32 sysctl_wmem_default;
extern __u32 sysctl_rmem_default;

/* Default TCP Small queue budget is ~1 ms of data (1sec >> 10)
 * Some wifi drivers need to tweak it to get more chunks.
 * They can use this helper from their ndo_start_xmit()
 */
static inline void sk_pacing_shift_update(struct sock *sk, int val)
{
	if (!sk || !sk_fullsock(sk) || sk->sk_pacing_shift == val)
		return;
	sk->sk_pacing_shift = val;
}

#endif	/* _SOCK_H */