hc
2024-05-14 bedbef8ad3e75a304af6361af235302bcc61d06b
kernel/net/openvswitch/datapath.h
....@@ -1,19 +1,6 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * 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
174 */
185
196 #ifndef DATAPATH_H
....@@ -33,8 +20,9 @@
3320 #include "meter.h"
3421 #include "vport-internal_dev.h"
3522
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
3826
3927 /**
4028 * struct dp_stats_percpu - per-cpu packet processing statistics for a given
....@@ -50,12 +38,15 @@
5038 * @n_mask_hit: Number of masks looked up for flow match.
5139 * @n_mask_hit / (@n_hit + @n_missed) will be the average masks looked
5240 * up per packet.
41
+ * @n_cache_hit: The number of received packets that had their mask found using
42
+ * the mask cache.
5343 */
5444 struct dp_stats_percpu {
5545 u64 n_hit;
5646 u64 n_missed;
5747 u64 n_lost;
5848 u64 n_mask_hit;
49
+ u64 n_cache_hit;
5950 struct u64_stats_sync syncp;
6051 };
6152
....@@ -95,7 +86,7 @@
9586 u32 max_headroom;
9687
9788 /* Switch meters. */
98
- struct hlist_head *meters;
89
+ struct dp_meter_table meter_tbl;
9990 };
10091
10192 /**
....@@ -144,12 +135,25 @@
144135 struct ovs_net {
145136 struct list_head dps;
146137 struct work_struct dp_notify_work;
138
+ struct delayed_work masks_rebalance;
147139 #if IS_ENABLED(CONFIG_NETFILTER_CONNCOUNT)
148140 struct ovs_ct_limit_info *ct_limit_info;
149141 #endif
150142
151143 /* Module reference for configuring conntrack. */
152144 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),
153157 };
154158
155159 extern unsigned int ovs_net_id;
....@@ -231,6 +235,8 @@
231235 extern struct notifier_block ovs_dp_device_notifier;
232236 extern struct genl_family dp_vport_genl_family;
233237
238
+DECLARE_STATIC_KEY_FALSE(tc_recirc_sharing_support);
239
+
234240 void ovs_dp_process_packet(struct sk_buff *skb, struct sw_flow_key *key);
235241 void ovs_dp_detach_port(struct vport *);
236242 int ovs_dp_upcall(struct datapath *, struct sk_buff *,