diff mbox series

[net] net: tcp: Update the type of scaling_ratio

Message ID 20240506120400.712629-1-horatiu.vultur@microchip.com (mailing list archive)
State Rejected
Delegated to: Netdev Maintainers
Headers show
Series [net] net: tcp: Update the type of scaling_ratio | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net, async
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit fail Errors and warnings before: 2950 this patch: 2000
netdev/build_tools success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 5 of 5 maintainers
netdev/build_clang fail Errors and warnings before: 980 this patch: 54
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn fail Errors and warnings before: 3143 this patch: 2193
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 24 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 4 this patch: 4
netdev/source_inline success Was 0 now: 0

Commit Message

Horatiu Vultur May 6, 2024, 12:04 p.m. UTC
It was noticed the following issue that sometimes the scaling_ratio was
getting a value of 0, meaning that window space was having a value of 0,
so then the tcp connection was stopping.
The reason why the scaling_ratio was getting a value of 0 is because
when it was calculated, it was truncated from a u64 to a u8. So for
example if it scaling_ratio was supposed to be 256 it was getting a
value of 0.
The fix consists in chaning the type of scaling_ratio from u8 to u16.

Fixes: dfa2f0483360 ("tcp: get rid of sysctl_tcp_adv_win_scale")
Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
---
 include/linux/tcp.h | 2 +-
 include/net/tcp.h   | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

Comments

Eric Dumazet May 6, 2024, 12:35 p.m. UTC | #1
On Mon, May 6, 2024 at 2:04 PM Horatiu Vultur
<horatiu.vultur@microchip.com> wrote:
>
> It was noticed the following issue that sometimes the scaling_ratio was
> getting a value of 0, meaning that window space was having a value of 0,
> so then the tcp connection was stopping.
> The reason why the scaling_ratio was getting a value of 0 is because
> when it was calculated, it was truncated from a u64 to a u8. So for
> example if it scaling_ratio was supposed to be 256 it was getting a
> value of 0.
> The fix consists in chaning the type of scaling_ratio from u8 to u16.
>
> Fixes: dfa2f0483360 ("tcp: get rid of sysctl_tcp_adv_win_scale")
> Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
> ---

This is a wrong patch. We need to fix the root cause instead.

By definition, skb->len / skb->truesize must be < 1

If not, a driver is lying to us and this is quite bad.

Please take a look at the following patch for a real fix.

4ce62d5b2f7aecd4900e7d6115588ad7f9acccca net: usb: ax88179_178a: stop
lying about skb->truesize
Eric Dumazet May 6, 2024, 12:42 p.m. UTC | #2
On Mon, May 6, 2024 at 2:35 PM Eric Dumazet <edumazet@google.com> wrote:
>
> On Mon, May 6, 2024 at 2:04 PM Horatiu Vultur
> <horatiu.vultur@microchip.com> wrote:
> >
> > It was noticed the following issue that sometimes the scaling_ratio was
> > getting a value of 0, meaning that window space was having a value of 0,
> > so then the tcp connection was stopping.
> > The reason why the scaling_ratio was getting a value of 0 is because
> > when it was calculated, it was truncated from a u64 to a u8. So for
> > example if it scaling_ratio was supposed to be 256 it was getting a
> > value of 0.
> > The fix consists in chaning the type of scaling_ratio from u8 to u16.
> >
> > Fixes: dfa2f0483360 ("tcp: get rid of sysctl_tcp_adv_win_scale")
> > Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
> > ---
>
> This is a wrong patch. We need to fix the root cause instead.
>
> By definition, skb->len / skb->truesize must be < 1
>
> If not, a driver is lying to us and this is quite bad.
>
> Please take a look at the following patch for a real fix.
>
> 4ce62d5b2f7aecd4900e7d6115588ad7f9acccca net: usb: ax88179_178a: stop
> lying about skb->truesize

Remaining buggy drivers would be these USB drivers:

drivers/net/usb/aqc111.c:1154:          new_skb->truesize =
SKB_TRUESIZE(new_skb->len);
drivers/net/usb/smsc75xx.c:2237:
skb->truesize = size + sizeof(struct sk_buff);
drivers/net/usb/smsc75xx.c:2256:
ax_skb->truesize = size + sizeof(struct sk_buff);
drivers/net/usb/smsc95xx.c:1873:
skb->truesize = size + sizeof(struct sk_buff);
drivers/net/usb/smsc95xx.c:1891:
ax_skb->truesize = size + sizeof(struct sk_buff);
drivers/net/usb/sr9700.c:424:                   skb->truesize = len +
sizeof(struct sk_buff);
drivers/net/usb/sr9700.c:436:           sr_skb->truesize = len +
sizeof(struct sk_buff);
Horatiu Vultur May 6, 2024, 1:13 p.m. UTC | #3
The 05/06/2024 14:35, Eric Dumazet wrote:
> 
> On Mon, May 6, 2024 at 2:04 PM Horatiu Vultur
> <horatiu.vultur@microchip.com> wrote:

Hi Eric,

> >
> > It was noticed the following issue that sometimes the scaling_ratio was
> > getting a value of 0, meaning that window space was having a value of 0,
> > so then the tcp connection was stopping.
> > The reason why the scaling_ratio was getting a value of 0 is because
> > when it was calculated, it was truncated from a u64 to a u8. So for
> > example if it scaling_ratio was supposed to be 256 it was getting a
> > value of 0.
> > The fix consists in chaning the type of scaling_ratio from u8 to u16.
> >
> > Fixes: dfa2f0483360 ("tcp: get rid of sysctl_tcp_adv_win_scale")
> > Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
> > ---
> 
> This is a wrong patch. We need to fix the root cause instead.
> 
> By definition, skb->len / skb->truesize must be < 1
> 
> If not, a driver is lying to us and this is quite bad.
> 
> Please take a look at the following patch for a real fix.
> 
> 4ce62d5b2f7aecd4900e7d6115588ad7f9acccca net: usb: ax88179_178a: stop
> lying about skb->truesize

Thanks for explanation and for the suggestion.
I have tried this on a driver that is not yet upstream.
Sorry for the noise.
kernel test robot May 7, 2024, 5:13 a.m. UTC | #4
Hi Horatiu,

kernel test robot noticed the following build errors:

[auto build test ERROR on net/main]

url:    https://github.com/intel-lab-lkp/linux/commits/Horatiu-Vultur/net-tcp-Update-the-type-of-scaling_ratio/20240506-200600
base:   net/main
patch link:    https://lore.kernel.org/r/20240506120400.712629-1-horatiu.vultur%40microchip.com
patch subject: [PATCH net] net: tcp: Update the type of scaling_ratio
config: openrisc-defconfig
compiler: or1k-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build):

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202405071146.xfGkMKtH-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from <command-line>:
   In function 'tcp_struct_check',
       inlined from 'tcp_init' at net/ipv4/tcp.c:4703:2:
>> include/linux/compiler_types.h:449:45: error: call to '__compiletime_assert_830' declared with attribute error: BUILD_BUG_ON failed: offsetof(struct tcp_sock, __cacheline_group_end__tcp_sock_read_txrx) - offsetofend(struct tcp_sock, __cacheline_group_begin__tcp_sock_read_txrx) > 32
     449 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |                                             ^
   include/linux/compiler_types.h:430:25: note: in definition of macro '__compiletime_assert'
     430 |                         prefix ## suffix();                             \
         |                         ^~~~~~
   include/linux/compiler_types.h:449:9: note: in expansion of macro '_compiletime_assert'
     449 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |         ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
      39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
         |                                     ^~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:50:9: note: in expansion of macro 'BUILD_BUG_ON_MSG'
      50 |         BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
         |         ^~~~~~~~~~~~~~~~
   include/linux/cache.h:108:9: note: in expansion of macro 'BUILD_BUG_ON'
     108 |         BUILD_BUG_ON(offsetof(TYPE, __cacheline_group_end__##GROUP) - \
         |         ^~~~~~~~~~~~
   net/ipv4/tcp.c:4622:9: note: in expansion of macro 'CACHELINE_ASSERT_GROUP_SIZE'
    4622 |         CACHELINE_ASSERT_GROUP_SIZE(struct tcp_sock, tcp_sock_read_txrx, 32);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +/__compiletime_assert_830 +449 include/linux/compiler_types.h

eb5c2d4b45e3d2 Will Deacon 2020-07-21  435  
eb5c2d4b45e3d2 Will Deacon 2020-07-21  436  #define _compiletime_assert(condition, msg, prefix, suffix) \
eb5c2d4b45e3d2 Will Deacon 2020-07-21  437  	__compiletime_assert(condition, msg, prefix, suffix)
eb5c2d4b45e3d2 Will Deacon 2020-07-21  438  
eb5c2d4b45e3d2 Will Deacon 2020-07-21  439  /**
eb5c2d4b45e3d2 Will Deacon 2020-07-21  440   * compiletime_assert - break build and emit msg if condition is false
eb5c2d4b45e3d2 Will Deacon 2020-07-21  441   * @condition: a compile-time constant condition to check
eb5c2d4b45e3d2 Will Deacon 2020-07-21  442   * @msg:       a message to emit if condition is false
eb5c2d4b45e3d2 Will Deacon 2020-07-21  443   *
eb5c2d4b45e3d2 Will Deacon 2020-07-21  444   * In tradition of POSIX assert, this macro will break the build if the
eb5c2d4b45e3d2 Will Deacon 2020-07-21  445   * supplied condition is *false*, emitting the supplied error message if the
eb5c2d4b45e3d2 Will Deacon 2020-07-21  446   * compiler has support to do so.
eb5c2d4b45e3d2 Will Deacon 2020-07-21  447   */
eb5c2d4b45e3d2 Will Deacon 2020-07-21  448  #define compiletime_assert(condition, msg) \
eb5c2d4b45e3d2 Will Deacon 2020-07-21 @449  	_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
eb5c2d4b45e3d2 Will Deacon 2020-07-21  450
kernel test robot May 7, 2024, 6:08 a.m. UTC | #5
Hi Horatiu,

kernel test robot noticed the following build errors:

[auto build test ERROR on net/main]

url:    https://github.com/intel-lab-lkp/linux/commits/Horatiu-Vultur/net-tcp-Update-the-type-of-scaling_ratio/20240506-200600
base:   net/main
patch link:    https://lore.kernel.org/r/20240506120400.712629-1-horatiu.vultur%40microchip.com
patch subject: [PATCH net] net: tcp: Update the type of scaling_ratio
config: riscv-defconfig
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project 37ae4ad0eef338776c7e2cffb3896153d43dcd90)
reproduce (this is a W=1 build):

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202405071346.WIGUjZTJ-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from net/ipv4/tcp.c:252:
   In file included from include/linux/inet_diag.h:5:
   In file included from include/net/netlink.h:6:
   In file included from include/linux/netlink.h:7:
   In file included from include/linux/skbuff.h:17:
   In file included from include/linux/bvec.h:10:
   In file included from include/linux/highmem.h:8:
   In file included from include/linux/cacheflush.h:5:
   In file included from arch/riscv/include/asm/cacheflush.h:9:
   In file included from include/linux/mm.h:2210:
   include/linux/vmstat.h:522:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     522 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
>> net/ipv4/tcp.c:4622:2: error: call to '__compiletime_assert_982' declared with 'error' attribute: BUILD_BUG_ON failed: offsetof(struct tcp_sock, __cacheline_group_end__tcp_sock_read_txrx) - offsetofend(struct tcp_sock, __cacheline_group_begin__tcp_sock_read_txrx) > 32
    4622 |         CACHELINE_ASSERT_GROUP_SIZE(struct tcp_sock, tcp_sock_read_txrx, 32);
         |         ^
   include/linux/cache.h:108:2: note: expanded from macro 'CACHELINE_ASSERT_GROUP_SIZE'
     108 |         BUILD_BUG_ON(offsetof(TYPE, __cacheline_group_end__##GROUP) - \
         |         ^
   include/linux/build_bug.h:50:2: note: expanded from macro 'BUILD_BUG_ON'
      50 |         BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
         |         ^
   include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG'
      39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
         |                                     ^
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:437:2: note: expanded from macro '_compiletime_assert'
     437 |         __compiletime_assert(condition, msg, prefix, suffix)
         |         ^
   include/linux/compiler_types.h:430:4: note: expanded from macro '__compiletime_assert'
     430 |                         prefix ## suffix();                             \
         |                         ^
   <scratch space>:11:1: note: expanded from here
      11 | __compiletime_assert_982
         | ^
   1 warning and 1 error generated.


vim +4622 net/ipv4/tcp.c

4acb41903b2f99 Glauber Costa 2012-01-30  4600  
d5fed5addb2b6b Coco Li       2023-12-04  4601  static void __init tcp_struct_check(void)
d5fed5addb2b6b Coco Li       2023-12-04  4602  {
d5fed5addb2b6b Coco Li       2023-12-04  4603  	/* TX read-mostly hotpath cache lines */
d5fed5addb2b6b Coco Li       2023-12-04  4604  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_tx, max_window);
d5fed5addb2b6b Coco Li       2023-12-04  4605  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_tx, rcv_ssthresh);
d5fed5addb2b6b Coco Li       2023-12-04  4606  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_tx, reordering);
d5fed5addb2b6b Coco Li       2023-12-04  4607  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_tx, notsent_lowat);
d5fed5addb2b6b Coco Li       2023-12-04  4608  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_tx, gso_segs);
d5fed5addb2b6b Coco Li       2023-12-04  4609  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_tx, lost_skb_hint);
d5fed5addb2b6b Coco Li       2023-12-04  4610  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_tx, retransmit_skb_hint);
d5fed5addb2b6b Coco Li       2023-12-04  4611  	CACHELINE_ASSERT_GROUP_SIZE(struct tcp_sock, tcp_sock_read_tx, 40);
d5fed5addb2b6b Coco Li       2023-12-04  4612  
d5fed5addb2b6b Coco Li       2023-12-04  4613  	/* TXRX read-mostly hotpath cache lines */
d5fed5addb2b6b Coco Li       2023-12-04  4614  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_txrx, tsoffset);
d5fed5addb2b6b Coco Li       2023-12-04  4615  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_txrx, snd_wnd);
d5fed5addb2b6b Coco Li       2023-12-04  4616  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_txrx, mss_cache);
d5fed5addb2b6b Coco Li       2023-12-04  4617  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_txrx, snd_cwnd);
d5fed5addb2b6b Coco Li       2023-12-04  4618  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_txrx, prr_out);
d5fed5addb2b6b Coco Li       2023-12-04  4619  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_txrx, lost_out);
d5fed5addb2b6b Coco Li       2023-12-04  4620  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_txrx, sacked_out);
119ff04864a244 Eric Dumazet  2024-02-08  4621  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_txrx, scaling_ratio);
119ff04864a244 Eric Dumazet  2024-02-08 @4622  	CACHELINE_ASSERT_GROUP_SIZE(struct tcp_sock, tcp_sock_read_txrx, 32);
d5fed5addb2b6b Coco Li       2023-12-04  4623  
d5fed5addb2b6b Coco Li       2023-12-04  4624  	/* RX read-mostly hotpath cache lines */
d5fed5addb2b6b Coco Li       2023-12-04  4625  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_rx, copied_seq);
d5fed5addb2b6b Coco Li       2023-12-04  4626  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_rx, rcv_tstamp);
d5fed5addb2b6b Coco Li       2023-12-04  4627  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_rx, snd_wl1);
d5fed5addb2b6b Coco Li       2023-12-04  4628  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_rx, tlp_high_seq);
d5fed5addb2b6b Coco Li       2023-12-04  4629  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_rx, rttvar_us);
d5fed5addb2b6b Coco Li       2023-12-04  4630  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_rx, retrans_out);
d5fed5addb2b6b Coco Li       2023-12-04  4631  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_rx, advmss);
d5fed5addb2b6b Coco Li       2023-12-04  4632  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_rx, urg_data);
d5fed5addb2b6b Coco Li       2023-12-04  4633  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_rx, lost);
d5fed5addb2b6b Coco Li       2023-12-04  4634  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_rx, rtt_min);
d5fed5addb2b6b Coco Li       2023-12-04  4635  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_rx, out_of_order_queue);
d5fed5addb2b6b Coco Li       2023-12-04  4636  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_read_rx, snd_ssthresh);
d5fed5addb2b6b Coco Li       2023-12-04  4637  	CACHELINE_ASSERT_GROUP_SIZE(struct tcp_sock, tcp_sock_read_rx, 69);
d5fed5addb2b6b Coco Li       2023-12-04  4638  
d5fed5addb2b6b Coco Li       2023-12-04  4639  	/* TX read-write hotpath cache lines */
d5fed5addb2b6b Coco Li       2023-12-04  4640  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, segs_out);
d5fed5addb2b6b Coco Li       2023-12-04  4641  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, data_segs_out);
d5fed5addb2b6b Coco Li       2023-12-04  4642  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, bytes_sent);
d5fed5addb2b6b Coco Li       2023-12-04  4643  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, snd_sml);
d5fed5addb2b6b Coco Li       2023-12-04  4644  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, chrono_start);
d5fed5addb2b6b Coco Li       2023-12-04  4645  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, chrono_stat);
d5fed5addb2b6b Coco Li       2023-12-04  4646  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, write_seq);
d5fed5addb2b6b Coco Li       2023-12-04  4647  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, pushed_seq);
d5fed5addb2b6b Coco Li       2023-12-04  4648  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, lsndtime);
d5fed5addb2b6b Coco Li       2023-12-04  4649  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, mdev_us);
d5fed5addb2b6b Coco Li       2023-12-04  4650  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, tcp_wstamp_ns);
d5fed5addb2b6b Coco Li       2023-12-04  4651  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, tcp_clock_cache);
d5fed5addb2b6b Coco Li       2023-12-04  4652  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, tcp_mstamp);
d5fed5addb2b6b Coco Li       2023-12-04  4653  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, rtt_seq);
d5fed5addb2b6b Coco Li       2023-12-04  4654  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, tsorted_sent_queue);
d5fed5addb2b6b Coco Li       2023-12-04  4655  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, highest_sack);
d5fed5addb2b6b Coco Li       2023-12-04  4656  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_tx, ecn_flags);
345a6e2631c126 Eric Dumazet  2024-03-01  4657  	CACHELINE_ASSERT_GROUP_SIZE(struct tcp_sock, tcp_sock_write_tx, 105);
d5fed5addb2b6b Coco Li       2023-12-04  4658  
d5fed5addb2b6b Coco Li       2023-12-04  4659  	/* TXRX read-write hotpath cache lines */
d5fed5addb2b6b Coco Li       2023-12-04  4660  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_txrx, pred_flags);
d5fed5addb2b6b Coco Li       2023-12-04  4661  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_txrx, rcv_nxt);
d5fed5addb2b6b Coco Li       2023-12-04  4662  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_txrx, snd_nxt);
d5fed5addb2b6b Coco Li       2023-12-04  4663  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_txrx, snd_una);
d5fed5addb2b6b Coco Li       2023-12-04  4664  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_txrx, window_clamp);
d5fed5addb2b6b Coco Li       2023-12-04  4665  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_txrx, srtt_us);
d5fed5addb2b6b Coco Li       2023-12-04  4666  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_txrx, packets_out);
d5fed5addb2b6b Coco Li       2023-12-04  4667  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_txrx, snd_up);
d5fed5addb2b6b Coco Li       2023-12-04  4668  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_txrx, delivered);
d5fed5addb2b6b Coco Li       2023-12-04  4669  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_txrx, delivered_ce);
d5fed5addb2b6b Coco Li       2023-12-04  4670  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_txrx, app_limited);
d5fed5addb2b6b Coco Li       2023-12-04  4671  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_txrx, rcv_wnd);
d5fed5addb2b6b Coco Li       2023-12-04  4672  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_txrx, rx_opt);
d5fed5addb2b6b Coco Li       2023-12-04  4673  	CACHELINE_ASSERT_GROUP_SIZE(struct tcp_sock, tcp_sock_write_txrx, 76);
d5fed5addb2b6b Coco Li       2023-12-04  4674  
d5fed5addb2b6b Coco Li       2023-12-04  4675  	/* RX read-write hotpath cache lines */
d5fed5addb2b6b Coco Li       2023-12-04  4676  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, bytes_received);
d5fed5addb2b6b Coco Li       2023-12-04  4677  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, segs_in);
d5fed5addb2b6b Coco Li       2023-12-04  4678  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, data_segs_in);
d5fed5addb2b6b Coco Li       2023-12-04  4679  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, rcv_wup);
d5fed5addb2b6b Coco Li       2023-12-04  4680  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, max_packets_out);
d5fed5addb2b6b Coco Li       2023-12-04  4681  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, cwnd_usage_seq);
d5fed5addb2b6b Coco Li       2023-12-04  4682  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, rate_delivered);
d5fed5addb2b6b Coco Li       2023-12-04  4683  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, rate_interval_us);
d5fed5addb2b6b Coco Li       2023-12-04  4684  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, rcv_rtt_last_tsecr);
d5fed5addb2b6b Coco Li       2023-12-04  4685  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, first_tx_mstamp);
d5fed5addb2b6b Coco Li       2023-12-04  4686  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, delivered_mstamp);
d5fed5addb2b6b Coco Li       2023-12-04  4687  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, bytes_acked);
d5fed5addb2b6b Coco Li       2023-12-04  4688  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, rcv_rtt_est);
d5fed5addb2b6b Coco Li       2023-12-04  4689  	CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, rcvq_space);
d5fed5addb2b6b Coco Li       2023-12-04  4690  	CACHELINE_ASSERT_GROUP_SIZE(struct tcp_sock, tcp_sock_write_rx, 99);
d5fed5addb2b6b Coco Li       2023-12-04  4691  }
d5fed5addb2b6b Coco Li       2023-12-04  4692
diff mbox series

Patch

diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 6a5e08b937b31..cc4fd1cbe6c12 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -221,7 +221,7 @@  struct tcp_sock {
 	u32	lost_out;	/* Lost packets			*/
 	u32	sacked_out;	/* SACK'd packets			*/
 	u16	tcp_header_len;	/* Bytes of tcp header to send		*/
-	u8	scaling_ratio;	/* see tcp_win_from_space() */
+	u16	scaling_ratio;	/* see tcp_win_from_space() */
 	u8	chrono_type : 2,	/* current chronograph type */
 		repair      : 1,
 		tcp_usec_ts : 1, /* TSval values in usec */
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 0a51e6a45bce9..252ae24b0f1c7 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -1510,7 +1510,7 @@  void tcp_select_initial_window(const struct sock *sk, int __space,
 			       __u32 *window_clamp, int wscale_ok,
 			       __u8 *rcv_wscale, __u32 init_rcv_wnd);
 
-static inline int __tcp_win_from_space(u8 scaling_ratio, int space)
+static inline int __tcp_win_from_space(u16 scaling_ratio, int space)
 {
 	s64 scaled_space = (s64)space * scaling_ratio;
 
@@ -1523,7 +1523,7 @@  static inline int tcp_win_from_space(const struct sock *sk, int space)
 }
 
 /* inverse of __tcp_win_from_space() */
-static inline int __tcp_space_from_win(u8 scaling_ratio, int win)
+static inline int __tcp_space_from_win(u16 scaling_ratio, int win)
 {
 	u64 val = (u64)win << TCP_RMEM_TO_WIN_SCALE;