-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hadar Hen Zion says: ==================== net/sched: ip tunnel metadata set/release/classify by using TC This patchset introduces ip tunnel manipulation support using the TC subsystem. In the decap flow, it enables the user to redirect packets from a shared tunnel device and classify by outer and inner headers. The outer headers are extracted from the metadata and used by the flower filter. A new action act_tunnel_key, releases the metadata. In the encap flow, act_tunnel_key creates a metadata object to be used by the shared tunnel device. The actual redirection to the tunnel device is done using act_mirred. For example: $ tc qdisc add dev vnet0 ingress $ tc filter add dev vnet0 protocol ip parent ffff: \ flower \ ip_proto 1 \ action tunnel_key set \ src_ip 11.11.0.1 \ dst_ip 11.11.0.2 \ id 11 \ action mirred egress redirect dev vxlan0 $ tc qdisc add dev vxlan0 ingress $ tc filter add dev vxlan0 protocol ip parent ffff: \ flower \ enc_src_ip 11.11.0.2 \ enc_dst_ip 11.11.0.1 \ enc_key_id 11 \ action tunnel_key release \ action mirred egress redirect dev vnet0 Amir & Hadar Changes from V6: - Add kfree_rcu to tunnel_key_release function - Use reverse Christmas tree order in tunnel_key_init function Changes from V5: - Add __rcu notation to struct tcf_tunnel_key_params in struct tcf_tunnel_key - Fix indentation in include/net/dst_metadata.h - Fix syntx error in commit message Changes from V4: - Fix tunnel_key_init function error flow. - Add 'action' variable to struct tcf_tunnel_key_params and use it instead of tcf_action variable which is not protected by rcu lock. Changes from V3: - Use percpu stats - No spinlock on datapatch - protecting parameters with rcu - Fix buggy handling of set/release dst - Use nla_get_in_addr and nla_put_in_addr - Fix change logs - Pass in6_addr by pointer - Rename utility functions to start with double underscore Changes from V2: - Use union in struct fl_flow_key for enc_ipv6 and enc_ipv4. - Rename functions _ip_tun_rx_dst and _ipv6_tun_rx_dst to _ip_tun_set_dst and _ipv6_tun_set_dst accordingly. - Remove local parameter 'encapdecap' from tunnel_key_init function. - Don't copy in6_addr values in tunnel_key_dump_addresses function, use pointers. Changes from V1: - More cleanups to key32_to_tunnel_id() and tunnel_id_to_key32() - IPv6 Support added - Set TUNNEL_KEY flag to make GRE work - Handle zero tunnel id properly in act_tunnel_key - Don't leave junk in decap action - Fix bug in act_tunnel_key initialization where (exists & ocr) is true - Remove BUG() from code - Rename action to tunnel_key - Improve grep-ability of code - Reuse code from ip_tun_rx_dst() and ipv6_tun_rx_dst() Changes from RFC: - Add a new action instead of making mirred too complex - No need to specify UDP port in action - it is already in the tunnel device configuration - Added a decap operation to drop tunnel metadata ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
- Loading branch information
Showing
12 changed files
with
606 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright (c) 2016, Amir Vadai <amir@vadai.me> | ||
* Copyright (c) 2016, Mellanox Technologies. All rights reserved. | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
*/ | ||
|
||
#ifndef __NET_TC_TUNNEL_KEY_H | ||
#define __NET_TC_TUNNEL_KEY_H | ||
|
||
#include <net/act_api.h> | ||
|
||
struct tcf_tunnel_key_params { | ||
struct rcu_head rcu; | ||
int tcft_action; | ||
int action; | ||
struct metadata_dst *tcft_enc_metadata; | ||
}; | ||
|
||
struct tcf_tunnel_key { | ||
struct tc_action common; | ||
struct tcf_tunnel_key_params __rcu *params; | ||
}; | ||
|
||
#define to_tunnel_key(a) ((struct tcf_tunnel_key *)a) | ||
|
||
#endif /* __NET_TC_TUNNEL_KEY_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright (c) 2016, Amir Vadai <amir@vadai.me> | ||
* Copyright (c) 2016, Mellanox Technologies. All rights reserved. | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
*/ | ||
|
||
#ifndef __LINUX_TC_TUNNEL_KEY_H | ||
#define __LINUX_TC_TUNNEL_KEY_H | ||
|
||
#include <linux/pkt_cls.h> | ||
|
||
#define TCA_ACT_TUNNEL_KEY 17 | ||
|
||
#define TCA_TUNNEL_KEY_ACT_SET 1 | ||
#define TCA_TUNNEL_KEY_ACT_RELEASE 2 | ||
|
||
struct tc_tunnel_key { | ||
tc_gen; | ||
int t_action; | ||
}; | ||
|
||
enum { | ||
TCA_TUNNEL_KEY_UNSPEC, | ||
TCA_TUNNEL_KEY_TM, | ||
TCA_TUNNEL_KEY_PARMS, | ||
TCA_TUNNEL_KEY_ENC_IPV4_SRC, /* be32 */ | ||
TCA_TUNNEL_KEY_ENC_IPV4_DST, /* be32 */ | ||
TCA_TUNNEL_KEY_ENC_IPV6_SRC, /* struct in6_addr */ | ||
TCA_TUNNEL_KEY_ENC_IPV6_DST, /* struct in6_addr */ | ||
TCA_TUNNEL_KEY_ENC_KEY_ID, /* be64 */ | ||
TCA_TUNNEL_KEY_PAD, | ||
__TCA_TUNNEL_KEY_MAX, | ||
}; | ||
|
||
#define TCA_TUNNEL_KEY_MAX (__TCA_TUNNEL_KEY_MAX - 1) | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.