.. | .. |
---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (c) 2007-2014 Nicira, Inc. |
---|
3 | | - * |
---|
4 | | - * This program is free software; you can redistribute it and/or |
---|
5 | | - * modify it under the terms of version 2 of the GNU General Public |
---|
6 | | - * License as published by the Free Software Foundation. |
---|
7 | | - * |
---|
8 | | - * This program is distributed in the hope that it will be useful, but |
---|
9 | | - * WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
10 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
11 | | - * General Public License for more details. |
---|
12 | | - * |
---|
13 | | - * You should have received a copy of the GNU General Public License |
---|
14 | | - * along with this program; if not, write to the Free Software |
---|
15 | | - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
---|
16 | | - * 02110-1301, USA |
---|
17 | 4 | */ |
---|
18 | 5 | |
---|
19 | 6 | #ifndef DATAPATH_H |
---|
.. | .. |
---|
33 | 20 | #include "meter.h" |
---|
34 | 21 | #include "vport-internal_dev.h" |
---|
35 | 22 | |
---|
36 | | -#define DP_MAX_PORTS USHRT_MAX |
---|
37 | | -#define DP_VPORT_HASH_BUCKETS 1024 |
---|
| 23 | +#define DP_MAX_PORTS USHRT_MAX |
---|
| 24 | +#define DP_VPORT_HASH_BUCKETS 1024 |
---|
| 25 | +#define DP_MASKS_REBALANCE_INTERVAL 4000 |
---|
38 | 26 | |
---|
39 | 27 | /** |
---|
40 | 28 | * struct dp_stats_percpu - per-cpu packet processing statistics for a given |
---|
.. | .. |
---|
50 | 38 | * @n_mask_hit: Number of masks looked up for flow match. |
---|
51 | 39 | * @n_mask_hit / (@n_hit + @n_missed) will be the average masks looked |
---|
52 | 40 | * up per packet. |
---|
| 41 | + * @n_cache_hit: The number of received packets that had their mask found using |
---|
| 42 | + * the mask cache. |
---|
53 | 43 | */ |
---|
54 | 44 | struct dp_stats_percpu { |
---|
55 | 45 | u64 n_hit; |
---|
56 | 46 | u64 n_missed; |
---|
57 | 47 | u64 n_lost; |
---|
58 | 48 | u64 n_mask_hit; |
---|
| 49 | + u64 n_cache_hit; |
---|
59 | 50 | struct u64_stats_sync syncp; |
---|
60 | 51 | }; |
---|
61 | 52 | |
---|
.. | .. |
---|
95 | 86 | u32 max_headroom; |
---|
96 | 87 | |
---|
97 | 88 | /* Switch meters. */ |
---|
98 | | - struct hlist_head *meters; |
---|
| 89 | + struct dp_meter_table meter_tbl; |
---|
99 | 90 | }; |
---|
100 | 91 | |
---|
101 | 92 | /** |
---|
.. | .. |
---|
144 | 135 | struct ovs_net { |
---|
145 | 136 | struct list_head dps; |
---|
146 | 137 | struct work_struct dp_notify_work; |
---|
| 138 | + struct delayed_work masks_rebalance; |
---|
147 | 139 | #if IS_ENABLED(CONFIG_NETFILTER_CONNCOUNT) |
---|
148 | 140 | struct ovs_ct_limit_info *ct_limit_info; |
---|
149 | 141 | #endif |
---|
150 | 142 | |
---|
151 | 143 | /* Module reference for configuring conntrack. */ |
---|
152 | 144 | bool xt_label; |
---|
| 145 | +}; |
---|
| 146 | + |
---|
| 147 | +/** |
---|
| 148 | + * enum ovs_pkt_hash_types - hash info to include with a packet |
---|
| 149 | + * to send to userspace. |
---|
| 150 | + * @OVS_PACKET_HASH_SW_BIT: indicates hash was computed in software stack. |
---|
| 151 | + * @OVS_PACKET_HASH_L4_BIT: indicates hash is a canonical 4-tuple hash |
---|
| 152 | + * over transport ports. |
---|
| 153 | + */ |
---|
| 154 | +enum ovs_pkt_hash_types { |
---|
| 155 | + OVS_PACKET_HASH_SW_BIT = (1ULL << 32), |
---|
| 156 | + OVS_PACKET_HASH_L4_BIT = (1ULL << 33), |
---|
153 | 157 | }; |
---|
154 | 158 | |
---|
155 | 159 | extern unsigned int ovs_net_id; |
---|
.. | .. |
---|
231 | 235 | extern struct notifier_block ovs_dp_device_notifier; |
---|
232 | 236 | extern struct genl_family dp_vport_genl_family; |
---|
233 | 237 | |
---|
| 238 | +DECLARE_STATIC_KEY_FALSE(tc_recirc_sharing_support); |
---|
| 239 | + |
---|
234 | 240 | void ovs_dp_process_packet(struct sk_buff *skb, struct sw_flow_key *key); |
---|
235 | 241 | void ovs_dp_detach_port(struct vport *); |
---|
236 | 242 | int ovs_dp_upcall(struct datapath *, struct sk_buff *, |
---|