xref: /linux/include/net/hotdata.h (revision 07fdad3a93756b872da7b53647715c48d0f4a2d0)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 #ifndef _NET_HOTDATA_H
3 #define _NET_HOTDATA_H
4 
5 #include <linux/llist.h>
6 #include <linux/types.h>
7 #include <linux/netdevice.h>
8 #include <net/protocol.h>
9 
10 struct skb_defer_node {
11 	struct llist_head	defer_list;
12 	atomic_long_t		defer_count;
13 } ____cacheline_aligned_in_smp;
14 
15 /* Read mostly data used in network fast paths. */
16 struct net_hotdata {
17 #if IS_ENABLED(CONFIG_INET)
18 	struct packet_offload	ip_packet_offload;
19 	struct net_offload	tcpv4_offload;
20 	struct net_protocol	tcp_protocol;
21 	struct net_offload 	udpv4_offload;
22 	struct net_protocol	udp_protocol;
23 	struct packet_offload	ipv6_packet_offload;
24 	struct net_offload	tcpv6_offload;
25 #if IS_ENABLED(CONFIG_IPV6)
26 	struct inet6_protocol	tcpv6_protocol;
27 	struct inet6_protocol	udpv6_protocol;
28 #endif
29 	struct net_offload	udpv6_offload;
30 #endif
31 	struct list_head	offload_base;
32 	struct kmem_cache	*skbuff_cache;
33 	struct kmem_cache	*skbuff_fclone_cache;
34 	struct kmem_cache	*skb_small_head_cache;
35 #ifdef CONFIG_RPS
36 	struct rps_sock_flow_table __rcu *rps_sock_flow_table;
37 	u32			rps_cpu_mask;
38 #endif
39 	struct skb_defer_node __percpu *skb_defer_nodes;
40 	int			gro_normal_batch;
41 	int			netdev_budget;
42 	int			netdev_budget_usecs;
43 	int			tstamp_prequeue;
44 	int			max_backlog;
45 	int			dev_tx_weight;
46 	int			dev_rx_weight;
47 	int			sysctl_max_skb_frags;
48 	int			sysctl_skb_defer_max;
49 	int			sysctl_mem_pcpu_rsv;
50 };
51 
52 #define inet_ehash_secret	net_hotdata.tcp_protocol.secret
53 #define udp_ehash_secret	net_hotdata.udp_protocol.secret
54 #define inet6_ehash_secret	net_hotdata.tcpv6_protocol.secret
55 #define tcp_ipv6_hash_secret	net_hotdata.tcpv6_offload.secret
56 #define udp6_ehash_secret	net_hotdata.udpv6_protocol.secret
57 #define udp_ipv6_hash_secret	net_hotdata.udpv6_offload.secret
58 
59 extern struct net_hotdata net_hotdata;
60 
61 #endif /* _NET_HOTDATA_H */
62