hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/net/openvswitch/flow.h
....@@ -1,19 +1,6 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * Copyright (c) 2007-2017 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 FLOW_H
....@@ -30,7 +17,6 @@
3017 #include <linux/in6.h>
3118 #include <linux/jiffies.h>
3219 #include <linux/time.h>
33
-#include <linux/flex_array.h>
3420 #include <linux/cpumask.h>
3521 #include <net/inet_ecn.h>
3622 #include <net/ip_tunnels.h>
....@@ -44,13 +30,14 @@
4430 MAC_PROTO_ETHERNET,
4531 };
4632 #define SW_FLOW_KEY_INVALID 0x80
33
+#define MPLS_LABEL_DEPTH 3
4734
4835 /* Store options at the end of the array if they are less than the
4936 * maximum size. This allows us to get the benefits of variable length
5037 * matching for small options.
5138 */
5239 #define TUN_METADATA_OFFSET(opt_len) \
53
- (FIELD_SIZEOF(struct sw_flow_key, tun_opts) - opt_len)
40
+ (sizeof_field(struct sw_flow_key, tun_opts) - opt_len)
5441 #define TUN_METADATA_OPTS(flow_key, opt_len) \
5542 ((void *)((flow_key)->tun_opts + TUN_METADATA_OFFSET(opt_len)))
5643
....@@ -60,12 +47,12 @@
6047
6148 struct vlan_head {
6249 __be16 tpid; /* Vlan type. Generally 802.1q or 802.1ad.*/
63
- __be16 tci; /* 0 if no VLAN, VLAN_TAG_PRESENT set otherwise. */
50
+ __be16 tci; /* 0 if no VLAN, VLAN_CFI_MASK set otherwise. */
6451 };
6552
6653 #define OVS_SW_FLOW_KEY_METADATA_SIZE \
6754 (offsetof(struct sw_flow_key, recirc_id) + \
68
- FIELD_SIZEOF(struct sw_flow_key, recirc_id))
55
+ sizeof_field(struct sw_flow_key, recirc_id))
6956
7057 struct ovs_key_nsh {
7158 struct ovs_nsh_key_base base;
....@@ -98,9 +85,6 @@
9885 * protocol.
9986 */
10087 union {
101
- struct {
102
- __be32 top_lse; /* top label stack entry */
103
- } mpls;
10488 struct {
10589 u8 proto; /* IP protocol or lower 8 bits of ARP opcode. */
10690 u8 tos; /* IP ToS. */
....@@ -149,6 +133,11 @@
149133 } nd;
150134 };
151135 } ipv6;
136
+ struct {
137
+ u32 num_labels_mask; /* labels present bitmap of effective length MPLS_LABEL_DEPTH */
138
+ __be32 lse[MPLS_LABEL_DEPTH]; /* label stack entry */
139
+ } mpls;
140
+
152141 struct ovs_key_nsh nsh; /* network service header */
153142 };
154143 struct {
....@@ -180,7 +169,6 @@
180169 struct sw_flow_mask {
181170 int ref_count;
182171 struct rcu_head rcu;
183
- struct list_head list;
184172 struct sw_flow_key_range range;
185173 struct sw_flow_key key;
186174 };
....@@ -208,7 +196,7 @@
208196 struct nlattr actions[];
209197 };
210198
211
-struct flow_stats {
199
+struct sw_flow_stats {
212200 u64 packet_count; /* Number of packets matched. */
213201 u64 byte_count; /* Number of bytes matched. */
214202 unsigned long used; /* Last used time (in jiffies). */
....@@ -230,7 +218,7 @@
230218 struct cpumask cpu_used_mask;
231219 struct sw_flow_mask *mask;
232220 struct sw_flow_actions __rcu *sf_acts;
233
- struct flow_stats __rcu *stats[]; /* One for each CPU. First one
221
+ struct sw_flow_stats __rcu *stats[]; /* One for each CPU. First one
234222 * is allocated at flow creation time,
235223 * the rest are allocated on demand
236224 * while holding the 'stats[0].lock'.
....@@ -284,6 +272,7 @@
284272 u64 ovs_flow_used_time(unsigned long flow_jiffies);
285273
286274 int ovs_flow_key_update(struct sk_buff *skb, struct sw_flow_key *key);
275
+int ovs_flow_key_update_l3l4(struct sk_buff *skb, struct sw_flow_key *key);
287276 int ovs_flow_key_extract(const struct ip_tunnel_info *tun_info,
288277 struct sk_buff *skb,
289278 struct sw_flow_key *key);