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