History

net: sched: add erspan option support to act_tunnel_key

This patch is to allow setting erspan options using the act_tunnel_key action. Different from geneve options, only one option can be set. And also, geneve options, vxlan options or erspan options can't be set at the same time. Options are expressed as ver:index:dir:hwid, when ver is set to 1, index will be applied while dir and hwid will be ignored, and when ver is set to 2, dir and hwid will be used while index will be ignored. # ip link add name erspan1 type erspan external # tc qdisc add dev eth0 ingress # tc filter add dev eth0 protocol ip parent ffff: \ flower indev eth0 \ ip_proto udp \ action tunnel_key \ set src_ip 10.0.99.192 \ dst_ip 10.0.99.193 \ dst_port 6081 \ id 11 \ erspan_opts 1:2:0:0 \ action mirred egress redirect dev erspan1 v1->v2: - do the validation when dst is not yet allocated as Jakub suggested. - use Duplicate instead of Wrong in err msg for extack.

Xin Long committed 6 years ago

Commit e20d4ff1 parent fca3f912 files · +134 −0Browse files

Showing the changes to include/uapi/linux (1 of 2 files). Show all

Unified · Split

include/uapi/linux/tc_act/tc_tunnel_key.h+16−0
@@ -54,6 +54,10 @@ enum { · 53 unmodified lines
54 * TCA_TUNNEL_KEY_ENC_OPTS_54 * TCA_TUNNEL_KEY_ENC_OPTS_
55 * attributes55 * attributes
56 */56 */
57 TCA_TUNNEL_KEY_ENC_OPTS_ERSPAN, /* Nested
58 * TCA_TUNNEL_KEY_ENC_OPTS_
59 * attributes
60 */
57 __TCA_TUNNEL_KEY_ENC_OPTS_MAX,61 __TCA_TUNNEL_KEY_ENC_OPTS_MAX,
58};62};
59 63
@@ -80,4 +84,16 @@ enum { · 20 unmodified lines
80#define TCA_TUNNEL_KEY_ENC_OPT_VXLAN_MAX \84#define TCA_TUNNEL_KEY_ENC_OPT_VXLAN_MAX \
81 (__TCA_TUNNEL_KEY_ENC_OPT_VXLAN_MAX - 1)85 (__TCA_TUNNEL_KEY_ENC_OPT_VXLAN_MAX - 1)
82 86
87enum {
88 TCA_TUNNEL_KEY_ENC_OPT_ERSPAN_UNSPEC,
89 TCA_TUNNEL_KEY_ENC_OPT_ERSPAN_VER, /* u8 */
90 TCA_TUNNEL_KEY_ENC_OPT_ERSPAN_INDEX, /* be32 */
91 TCA_TUNNEL_KEY_ENC_OPT_ERSPAN_DIR, /* u8 */
92 TCA_TUNNEL_KEY_ENC_OPT_ERSPAN_HWID, /* u8 */
93 __TCA_TUNNEL_KEY_ENC_OPT_ERSPAN_MAX,
94};
95
96#define TCA_TUNNEL_KEY_ENC_OPT_ERSPAN_MAX \
97 (__TCA_TUNNEL_KEY_ENC_OPT_ERSPAN_MAX - 1)
98
83#endif99#endif