From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-eopbgr30089.outbound.protection.outlook.com [40.107.3.89]) by dpdk.org (Postfix) with ESMTP id D13B323D for ; Mon, 15 Oct 2018 16:14:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Q2q0UMamfwKFo1qXuyxMAapcrc/ySa8x0h8jBoP5On8=; b=Xp5EymBtFemg7OwGQKbM0B2cfITjpZ+aVViQY9in7E3R+Ls7BIFtvKlWCW5I4h3nYbJa3ZSLd7oPIvOYXQdCgpFoAKP/h3ptt9rPEqvujKMp4BAE7q05EQmdzErrdWFyTkxMizSDJHxixFezG5tH1raUYsh1wy4xQbWl/dCFo5g= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=viacheslavo@mellanox.com; Received: from mellanox.com (37.142.13.130) by VI1PR05MB3277.eurprd05.prod.outlook.com (2603:10a6:802:1c::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.24; Mon, 15 Oct 2018 14:14:09 +0000 From: Viacheslav Ovsiienko To: shahafs@mellanox.com, yskoh@mellanox.com Cc: dev@dpdk.org, Viacheslav Ovsiienko Date: Mon, 15 Oct 2018 14:13:29 +0000 Message-Id: <1539612815-47199-2-git-send-email-viacheslavo@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1539612815-47199-1-git-send-email-viacheslavo@mellanox.com> References: <1538461807-37507-1-git-send-email-viacheslavo@mellanox.com> <1539612815-47199-1-git-send-email-viacheslavo@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: CWLP265CA0084.GBRP265.PROD.OUTLOOK.COM (2603:10a6:401:50::24) To VI1PR05MB3277.eurprd05.prod.outlook.com (2603:10a6:802:1c::22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 98e61dbb-5966-4573-2b1a-08d632a879bb X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:VI1PR05MB3277; X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB3277; 3:5hBugUCZXHXSuu6qDIRFTIA0XUqqzx3ZbFwLb7cMNcVYVKWZ8C/jmE8Ml04kdQJQJztv3t/xJhLu0jXPUQKS4qCQa6L7v55ngpRM03mF0DIaGmJw89ySbJYr5GKG/a2QJfZUwszF5EQvqAOKt1IhuEhOmvmpVOiro3kbSvKbZ951UbRcSca+w0CwOtBuTMglQCtg7nsvtvKKRwUD2IHg8LdX5RmRYUln1RNT6rG9G47Zl131qi8iNGratuPYg84y; 25:P/1JqzyF9g4T4JYu3owzlA+nWzrRDXR1JfiS5QsNLDbW4aTWwXY9gTNFYcG/QvZ4jud6nV1blk7El51W00gwltwWaF+XuAxZz3S6RenZFBIrJRaMIrzUvZ/VPXQQd4JxmPLlwoTu1wmhNeEXOLLA1HeWInsSDj6JCokDFmx5G2Nc4XmX7wIKYT1tj+dK14o3OPGhEAiOT3pLFlkhq5Ntj7f5nrxfoJqAzgSfddFn8ndTn+h62dijCPbtVPitLiZ8BJfearhdzQonbDkkERVIfG/Ob504Mt6Gmrae8msqvHjusHzmUgaKyrgE8f7DLckR65G36Z4c3ReOGzVUBZKlsg==; 31:KtShIT95vIN5/4rsy6OJk4TZmser6YWxWUmxrqZiK7e7yeJoqHYC+xLCnfd49AXaXbu91wkGtXzq3OR4LowaWYa4+Gy1NdLa4SG4+R9J2cgtWYSWL0qDnCkCsDjOBTABlI1PnU2OaybanIBusAyqNcdewkUUOUtbk9kdF0iMkg59uqSwn0kvcpBq6rME+xny8lstBsOYP+rHJs2/WEDgWILl5t4Uq2vzkPB4ypdp+1U= X-MS-TrafficTypeDiagnostic: VI1PR05MB3277: X-Microsoft-Exchange-Diagnostics: 1; VI1PR05MB3277; 20:Ly//bLPAXnUG+gyoLLSn9XtpTsPFaxOhQOqP88eVadvgXi4iB0qkxN4IWIOSyJCMkRYdVScwxXDsOciBfwycgKzzXmZ/F35N0dToNQC7P37+qsJEuEZ2xLPHMNb6dYnJafBKvbHOYBMrk8PJq9sSQvFu6suZruEpJUwLDEfru/7dgov6BGQrZD5MQNvl0jCYPs62ekLcEr5NkVSolktShjNLBlabs6/+DQ2nC/JjYpIvCXwKC65Q8Hwx3rVslFArOnALbWJJdmLuuAbq3TbpDs2qHTNBZPHKXzJA4utIM7klJ4qhIh5PG0UNYwSi3qUrGEHECH24NrKbg2fCq04E38CqKZajm0ylhi+iO5DA+cG+6xULhgwAg8vyElzWHe+0z5qo2OJluaY6Q45wXwKzHlsblcDe8Ml2pcWHXqrZXMdtMoQNd+X+1+XXjpdmlyh8FPgaYvkE3BfV0RN+aLuQI//yh1mz/B5damPzG+2x8iISv/IKaBw1MPZDZeq+CFcD; 4:7sS0o2rC9EJWCVuChJAGPrApXBmbnkRiUCvx4WftL7UU+Ud/eSd5Dc2WUUKyTrCcvltdZyEYEB5d+sIEyeEaDYwOxvcjM7RJbHFeXI/qqtgVxhmnOgUGJSZEk1oJ855nwbxOi4ErOvGRUxoeZvq0oD9F75SoKGtrEMYlDRHDWLPH+2moLVcWoAicKxImW4I3M7nVk3NyqxciLJguvouD1WoBInrFb8EX439fjXn8F+KfeDF9X2aP0qfiYh0pBwMZ9cK3eYtTOl7m5pC/OetizQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(3231355)(944501410)(52105095)(10201501046)(93006095)(93001095)(6055026)(149066)(150057)(6041310)(20161123560045)(20161123558120)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051); SRVR:VI1PR05MB3277; BCL:0; PCL:0; RULEID:; SRVR:VI1PR05MB3277; X-Forefront-PRVS: 0826B2F01B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(136003)(39860400002)(376002)(346002)(366004)(396003)(199004)(189003)(107886003)(16526019)(66066001)(7736002)(8676002)(47776003)(106356001)(51416003)(7696005)(52116002)(25786009)(68736007)(105586002)(186003)(16586007)(305945005)(8936002)(3846002)(81166006)(81156014)(6116002)(386003)(50226002)(6666004)(50466002)(11346002)(5024004)(86362001)(575784001)(446003)(76176011)(97736004)(6636002)(21086003)(36756003)(2906002)(33026002)(4720700003)(69596002)(53936002)(55016002)(48376002)(85306007)(478600001)(476003)(8886007)(316002)(26005)(4326008)(4744004)(486006)(2616005)(5660300001)(956004); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR05MB3277; H:mellanox.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR05MB3277; 23:vQ0uII02yEuP4XgG+yghqEJUpelKpGPQrezNJh2kY?= =?us-ascii?Q?HStRSNDe0A+Qukv1UZeiNlVoZwnKCPGHo8KHc6tPzK/IKRvH56sgwXFC31WK?= =?us-ascii?Q?L0jDfxWcKSlp+ccb8vdaFIXK1qx6QA1SOdJLQw7grxgR5AQFkp7mgHk4RoyU?= =?us-ascii?Q?vFqFWSZGC2jCjbT0DD5ykMvOOguWidgHPzb8kTHdhl0Oka5TLrqhnpMK8uF5?= =?us-ascii?Q?MnhvpHFGcl6uaesOEZ46QphRy2hEt1ZPxQLGQYXtZn+ti1f/ovpyEaeJB0DG?= =?us-ascii?Q?8tIDbZG4rPXK/STYeCgqBechfNj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kyMcxGnWACORdSaBBE8lgSNFTnCYgvSmGf5GpI4A==; 5:kkcsv5IrD3zivzbiozpLP5erj6ouVEkhP5vrQSdGdiZNPfFXvNVYXzH8+wRuzI6iwxpA/viiWOMWDcmPnJXnzJgtUptYnV49zJ/IW/jam++UDWQpL2b9Mrf4GH3SmMFa7sfBeCVGv3A2Sp46wjgHrBVcMF78CsoIyXu4tITjj5w=; 7:xUKzvIzIqZ9GkI2kasNthxP7MuQtvVV+iuTmeGHTpWv43rXm5euZlL+nWbIFqie50eT9mKPVi1qQAq/3xGloN1dTeh0ducyoZMHgV23SWFCAdDlf1VLkjOt9ygWe8WXcAfuhzGMk0QsjBKfTiQNvzL1ORF5olggyZTpFPR4TYLAZlWBFZq66HAXWBfjDztc+++yeHfVtvFFO8am8F6OX/hQA6CagwNnLgzkxKAj+gYwuoAUTRZkYT6MRXgMB1WSX SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2018 14:14:09.1926 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 98e61dbb-5966-4573-2b1a-08d632a879bb X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB3277 Subject: [dpdk-dev] [PATCH v2 1/7] net/mlx5: e-switch VXLAN configuration and definitions X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Oct 2018 14:14:11 -0000 This part of patchset adds configuration changes in makefile and meson.build for Mellanox MLX5 PMD. Also necessary defenitions for VXLAN support are made and appropriate data structures are presented. Suggested-by: Adrien Mazarguil Signed-off-by: Viacheslav Ovsiienko --- drivers/net/mlx5/Makefile | 80 ++++++++++++++++++ drivers/net/mlx5/meson.build | 32 +++++++ drivers/net/mlx5/mlx5_flow.h | 11 +++ drivers/net/mlx5/mlx5_flow_tcf.c | 175 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 298 insertions(+) diff --git a/drivers/net/mlx5/Makefile b/drivers/net/mlx5/Makefile index 1e9c0b4..fec7779 100644 --- a/drivers/net/mlx5/Makefile +++ b/drivers/net/mlx5/Makefile @@ -207,6 +207,11 @@ mlx5_autoconf.h.new: $(RTE_SDK)/buildtools/auto-config-h.sh enum IFLA_PHYS_PORT_NAME \ $(AUTOCONF_OUTPUT) $Q sh -- '$<' '$@' \ + HAVE_IFLA_VXLAN_COLLECT_METADATA \ + linux/if_link.h \ + enum IFLA_VXLAN_COLLECT_METADATA \ + $(AUTOCONF_OUTPUT) + $Q sh -- '$<' '$@' \ HAVE_TCA_CHAIN \ linux/rtnetlink.h \ enum TCA_CHAIN \ @@ -367,6 +372,81 @@ mlx5_autoconf.h.new: $(RTE_SDK)/buildtools/auto-config-h.sh enum TCA_VLAN_PUSH_VLAN_PRIORITY \ $(AUTOCONF_OUTPUT) $Q sh -- '$<' '$@' \ + HAVE_TCA_FLOWER_KEY_ENC_KEY_ID \ + linux/pkt_cls.h \ + enum TCA_FLOWER_KEY_ENC_KEY_ID \ + $(AUTOCONF_OUTPUT) + $Q sh -- '$<' '$@' \ + HAVE_TCA_FLOWER_KEY_ENC_IPV4_SRC \ + linux/pkt_cls.h \ + enum TCA_FLOWER_KEY_ENC_IPV4_SRC \ + $(AUTOCONF_OUTPUT) + $Q sh -- '$<' '$@' \ + HAVE_TCA_FLOWER_KEY_ENC_IPV4_SRC_MASK \ + linux/pkt_cls.h \ + enum TCA_FLOWER_KEY_ENC_IPV4_SRC_MASK \ + $(AUTOCONF_OUTPUT) + $Q sh -- '$<' '$@' \ + HAVE_TCA_FLOWER_KEY_ENC_IPV4_DST \ + linux/pkt_cls.h \ + enum TCA_FLOWER_KEY_ENC_IPV4_DST \ + $(AUTOCONF_OUTPUT) + $Q sh -- '$<' '$@' \ + HAVE_TCA_FLOWER_KEY_ENC_IPV4_DST_MASK \ + linux/pkt_cls.h \ + enum TCA_FLOWER_KEY_ENC_IPV4_DST_MASK \ + $(AUTOCONF_OUTPUT) + $Q sh -- '$<' '$@' \ + HAVE_TCA_FLOWER_KEY_ENC_IPV6_SRC \ + linux/pkt_cls.h \ + enum TCA_FLOWER_KEY_ENC_IPV6_SRC \ + $(AUTOCONF_OUTPUT) + $Q sh -- '$<' '$@' \ + HAVE_TCA_FLOWER_KEY_ENC_IPV6_SRC_MASK \ + linux/pkt_cls.h \ + enum TCA_FLOWER_KEY_ENC_IPV6_SRC_MASK \ + $(AUTOCONF_OUTPUT) + $Q sh -- '$<' '$@' \ + HAVE_TCA_FLOWER_KEY_ENC_IPV6_DST \ + linux/pkt_cls.h \ + enum TCA_FLOWER_KEY_ENC_IPV6_DST \ + $(AUTOCONF_OUTPUT) + $Q sh -- '$<' '$@' \ + HAVE_TCA_FLOWER_KEY_ENC_IPV6_DST_MASK \ + linux/pkt_cls.h \ + enum TCA_FLOWER_KEY_ENC_IPV6_DST_MASK \ + $(AUTOCONF_OUTPUT) + $Q sh -- '$<' '$@' \ + HAVE_TCA_FLOWER_KEY_ENC_UDP_SRC_PORT \ + linux/pkt_cls.h \ + enum TCA_FLOWER_KEY_ENC_UDP_SRC_PORT \ + $(AUTOCONF_OUTPUT) + $Q sh -- '$<' '$@' \ + HAVE_TCA_FLOWER_KEY_ENC_UDP_SRC_PORT_MASK \ + linux/pkt_cls.h \ + enum TCA_FLOWER_KEY_ENC_UDP_SRC_PORT_MASK \ + $(AUTOCONF_OUTPUT) + $Q sh -- '$<' '$@' \ + HAVE_TCA_FLOWER_KEY_ENC_UDP_DST_PORT \ + linux/pkt_cls.h \ + enum TCA_FLOWER_KEY_ENC_UDP_DST_PORT \ + $(AUTOCONF_OUTPUT) + $Q sh -- '$<' '$@' \ + HAVE_TCA_FLOWER_KEY_ENC_UDP_DST_PORT_MASK \ + linux/pkt_cls.h \ + enum TCA_FLOWER_KEY_ENC_UDP_DST_PORT_MASK \ + $(AUTOCONF_OUTPUT) + $Q sh -- '$<' '$@' \ + HAVE_TC_ACT_TUNNEL_KEY \ + linux/tc_act/tc_tunnel_key.h \ + define TCA_ACT_TUNNEL_KEY \ + $(AUTOCONF_OUTPUT) + $Q sh -- '$<' '$@' \ + HAVE_TCA_TUNNEL_KEY_ENC_DST_PORT \ + linux/tc_act/tc_tunnel_key.h \ + enum TCA_TUNNEL_KEY_ENC_DST_PORT \ + $(AUTOCONF_OUTPUT) + $Q sh -- '$<' '$@' \ HAVE_TC_ACT_PEDIT \ linux/tc_act/tc_pedit.h \ enum TCA_PEDIT_KEY_EX_HDR_TYPE_UDP \ diff --git a/drivers/net/mlx5/meson.build b/drivers/net/mlx5/meson.build index c192d44..43aabf2 100644 --- a/drivers/net/mlx5/meson.build +++ b/drivers/net/mlx5/meson.build @@ -126,6 +126,8 @@ if build 'IFLA_PHYS_SWITCH_ID' ], [ 'HAVE_IFLA_PHYS_PORT_NAME', 'linux/if_link.h', 'IFLA_PHYS_PORT_NAME' ], + [ 'HAVE_IFLA_VXLAN_COLLECT_METADATA', 'linux/if_link.h', + 'IFLA_VXLAN_COLLECT_METADATA' ], [ 'HAVE_TCA_CHAIN', 'linux/rtnetlink.h', 'TCA_CHAIN' ], [ 'HAVE_TCA_FLOWER_ACT', 'linux/pkt_cls.h', @@ -190,6 +192,36 @@ if build 'TC_ACT_GOTO_CHAIN' ], [ 'HAVE_TC_ACT_VLAN', 'linux/tc_act/tc_vlan.h', 'TCA_VLAN_PUSH_VLAN_PRIORITY' ], + [ 'HAVE_TCA_FLOWER_KEY_ENC_KEY_ID', 'linux/pkt_cls.h', + 'TCA_FLOWER_KEY_ENC_KEY_ID' ], + [ 'HAVE_TCA_FLOWER_KEY_ENC_IPV4_SRC', 'linux/pkt_cls.h', + 'TCA_FLOWER_KEY_ENC_IPV4_SRC' ], + [ 'HAVE_TCA_FLOWER_KEY_ENC_IPV4_SRC_MASK', 'linux/pkt_cls.h', + 'TCA_FLOWER_KEY_ENC_IPV4_SRC_MASK' ], + [ 'HAVE_TCA_FLOWER_KEY_ENC_IPV4_DST', 'linux/pkt_cls.h', + 'TCA_FLOWER_KEY_ENC_IPV4_DST' ], + [ 'HAVE_TCA_FLOWER_KEY_ENC_IPV4_DST_MASK', 'linux/pkt_cls.h', + 'TCA_FLOWER_KEY_ENC_IPV4_DST_MASK' ], + [ 'HAVE_TCA_FLOWER_KEY_ENC_IPV6_SRC', 'linux/pkt_cls.h', + 'TCA_FLOWER_KEY_ENC_IPV6_SRC' ], + [ 'HAVE_TCA_FLOWER_KEY_ENC_IPV6_SRC_MASK', 'linux/pkt_cls.h', + 'TCA_FLOWER_KEY_ENC_IPV6_SRC_MASK' ], + [ 'HAVE_TCA_FLOWER_KEY_ENC_IPV6_DST', 'linux/pkt_cls.h', + 'TCA_FLOWER_KEY_ENC_IPV6_DST' ], + [ 'HAVE_TCA_FLOWER_KEY_ENC_IPV6_DST_MASK', 'linux/pkt_cls.h', + 'TCA_FLOWER_KEY_ENC_IPV6_DST_MASK' ], + [ 'HAVE_TCA_FLOWER_KEY_ENC_UDP_SRC_PORT', 'linux/pkt_cls.h', + 'TCA_FLOWER_KEY_ENC_UDP_SRC_PORT' ], + [ 'HAVE_TCA_FLOWER_KEY_ENC_UDP_SRC_PORT_MASK', 'linux/pkt_cls.h', + 'TCA_FLOWER_KEY_ENC_UDP_SRC_PORT_MASK' ], + [ 'HAVE_TCA_FLOWER_KEY_ENC_UDP_DST_PORT', 'linux/pkt_cls.h', + 'TCA_FLOWER_KEY_ENC_UDP_DST_PORT' ], + [ 'HAVE_TCA_FLOWER_KEY_ENC_UDP_DST_PORT_MASK', 'linux/pkt_cls.h', + 'TCA_FLOWER_KEY_ENC_UDP_DST_PORT_MASK' ], + [ 'HAVE_TC_ACT_TUNNEL_KEY', 'linux/tc_act/tc_tunnel_key.h', + 'TCA_ACT_TUNNEL_KEY' ], + [ 'HAVE_TCA_TUNNEL_KEY_ENC_DST_PORT', 'linux/tc_act/tc_tunnel_key.h', + 'TCA_TUNNEL_KEY_ENC_DST_PORT' ], [ 'HAVE_TC_ACT_PEDIT', 'linux/tc_act/tc_pedit.h', 'TCA_PEDIT_KEY_EX_HDR_TYPE_UDP' ], [ 'HAVE_RDMA_NL_NLDEV', 'rdma/rdma_netlink.h', diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index 840d645..b838ab0 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -85,6 +85,8 @@ #define MLX5_FLOW_ACTION_SET_TP_SRC (1u << 15) #define MLX5_FLOW_ACTION_SET_TP_DST (1u << 16) #define MLX5_FLOW_ACTION_JUMP (1u << 17) +#define MLX5_ACTION_VXLAN_ENCAP (1u << 11) +#define MLX5_ACTION_VXLAN_DECAP (1u << 12) #define MLX5_FLOW_FATE_ACTIONS \ (MLX5_FLOW_ACTION_DROP | MLX5_FLOW_ACTION_QUEUE | MLX5_FLOW_ACTION_RSS) @@ -182,8 +184,17 @@ struct mlx5_flow_dv { struct mlx5_flow_tcf { struct nlmsghdr *nlh; struct tcmsg *tcm; + uint32_t nlsize; /**< Size of NL message buffer. */ + uint32_t applied:1; /**< Whether rule is currently applied. */ + uint64_t item_flags; /**< Item flags. */ + uint64_t action_flags; /**< Action flags. */ uint64_t hits; uint64_t bytes; + union { /**< Tunnel encap/decap descriptor. */ + struct mlx5_flow_tcf_tunnel_hdr *tunnel; + struct mlx5_flow_tcf_vxlan_decap *vxlan_decap; + struct mlx5_flow_tcf_vxlan_encap *vxlan_encap; + }; }; /* Verbs specification header. */ diff --git a/drivers/net/mlx5/mlx5_flow_tcf.c b/drivers/net/mlx5/mlx5_flow_tcf.c index 5c46f35..8f9c78a 100644 --- a/drivers/net/mlx5/mlx5_flow_tcf.c +++ b/drivers/net/mlx5/mlx5_flow_tcf.c @@ -54,6 +54,37 @@ struct tc_vlan { #endif /* HAVE_TC_ACT_VLAN */ +#ifdef HAVE_TC_ACT_TUNNEL_KEY + +#include + +#ifndef HAVE_TCA_TUNNEL_KEY_ENC_DST_PORT +#define TCA_TUNNEL_KEY_ENC_DST_PORT 9 +#endif + +#else /* HAVE_TC_ACT_TUNNEL_KEY */ + +#define TCA_ACT_TUNNEL_KEY 17 +#define TCA_TUNNEL_KEY_ACT_SET 1 +#define TCA_TUNNEL_KEY_ACT_RELEASE 2 +#define TCA_TUNNEL_KEY_PARMS 2 +#define TCA_TUNNEL_KEY_ENC_IPV4_SRC 3 +#define TCA_TUNNEL_KEY_ENC_IPV4_DST 4 +#define TCA_TUNNEL_KEY_ENC_IPV6_SRC 5 +#define TCA_TUNNEL_KEY_ENC_IPV6_DST 6 +#define TCA_TUNNEL_KEY_ENC_KEY_ID 7 +#define TCA_TUNNEL_KEY_ENC_DST_PORT 9 +#define TCA_TUNNEL_KEY_NO_CSUM 10 + +struct tc_tunnel_key { + tc_gen; + int t_action; +}; + +#endif /* HAVE_TC_ACT_TUNNEL_KEY */ + + + #ifdef HAVE_TC_ACT_PEDIT #include @@ -210,6 +241,45 @@ struct tc_pedit_sel { #ifndef HAVE_TCA_FLOWER_KEY_VLAN_ETH_TYPE #define TCA_FLOWER_KEY_VLAN_ETH_TYPE 25 #endif +#ifndef HAVE_TCA_FLOWER_KEY_ENC_KEY_ID +#define TCA_FLOWER_KEY_ENC_KEY_ID 26 +#endif +#ifndef HAVE_TCA_FLOWER_KEY_ENC_IPV4_SRC +#define TCA_FLOWER_KEY_ENC_IPV4_SRC 27 +#endif +#ifndef HAVE_TCA_FLOWER_KEY_ENC_IPV4_SRC_MASK +#define TCA_FLOWER_KEY_ENC_IPV4_SRC_MASK 28 +#endif +#ifndef HAVE_TCA_FLOWER_KEY_ENC_IPV4_DST +#define TCA_FLOWER_KEY_ENC_IPV4_DST 29 +#endif +#ifndef HAVE_TCA_FLOWER_KEY_ENC_IPV4_DST_MASK +#define TCA_FLOWER_KEY_ENC_IPV4_DST_MASK 30 +#endif +#ifndef HAVE_TCA_FLOWER_KEY_ENC_IPV6_SRC +#define TCA_FLOWER_KEY_ENC_IPV6_SRC 31 +#endif +#ifndef HAVE_TCA_FLOWER_KEY_ENC_IPV6_SRC_MASK +#define TCA_FLOWER_KEY_ENC_IPV6_SRC_MASK 32 +#endif +#ifndef HAVE_TCA_FLOWER_KEY_ENC_IPV6_DST +#define TCA_FLOWER_KEY_ENC_IPV6_DST 33 +#endif +#ifndef HAVE_TCA_FLOWER_KEY_ENC_IPV6_DST_MASK +#define TCA_FLOWER_KEY_ENC_IPV6_DST_MASK 34 +#endif +#ifndef HAVE_TCA_FLOWER_KEY_ENC_UDP_SRC_PORT +#define TCA_FLOWER_KEY_ENC_UDP_SRC_PORT 43 +#endif +#ifndef HAVE_TCA_FLOWER_KEY_ENC_UDP_SRC_PORT_MASK +#define TCA_FLOWER_KEY_ENC_UDP_SRC_PORT_MASK 44 +#endif +#ifndef HAVE_TCA_FLOWER_KEY_ENC_UDP_DST_PORT +#define TCA_FLOWER_KEY_ENC_UDP_DST_PORT 45 +#endif +#ifndef HAVE_TCA_FLOWER_KEY_ENC_UDP_DST_PORT_MASK +#define TCA_FLOWER_KEY_ENC_UDP_DST_PORT_MASK 46 +#endif #ifndef HAVE_TCA_FLOWER_KEY_TCP_FLAGS #define TCA_FLOWER_KEY_TCP_FLAGS 71 #endif @@ -232,6 +302,111 @@ struct tc_pedit_sel { #define TP_PORT_LEN 2 /* Transport Port (UDP/TCP) Length */ #endif +#define MLX5_VXLAN_PORT_RANGE_MIN 30000 +#define MLX5_VXLAN_PORT_RANGE_MAX 60000 +#define MLX5_VXLAN_DEVICE_PFX "vmlx_" + +/** Tunnel action type, used for @p type in header structure. */ +enum mlx5_flow_tcf_tunact_type { + MLX5_FLOW_TCF_TUNACT_VXLAN_ENCAP, + MLX5_FLOW_TCF_TUNACT_VXLAN_DECAP, +}; + +/** Flags used for @p mask in tunnel action encap descriptors. */ +#define MLX5_FLOW_TCF_ENCAP_ETH_SRC (1u << 0) +#define MLX5_FLOW_TCF_ENCAP_ETH_DST (1u << 1) +#define MLX5_FLOW_TCF_ENCAP_IPV4_SRC (1u << 2) +#define MLX5_FLOW_TCF_ENCAP_IPV4_DST (1u << 3) +#define MLX5_FLOW_TCF_ENCAP_IPV6_SRC (1u << 4) +#define MLX5_FLOW_TCF_ENCAP_IPV6_DST (1u << 5) +#define MLX5_FLOW_TCF_ENCAP_UDP_SRC (1u << 6) +#define MLX5_FLOW_TCF_ENCAP_UDP_DST (1u << 7) +#define MLX5_FLOW_TCF_ENCAP_VXLAN_VNI (1u << 8) + +/** Neigh rule structure */ +struct tcf_neigh_rule { + LIST_ENTRY(tcf_neigh_rule) next; + uint32_t refcnt; + struct ether_addr eth; + uint16_t mask; + union { + struct { + rte_be32_t dst; + } ipv4; + struct { + uint8_t dst[16]; + } ipv6; + }; +}; + +/** Local rule structure */ +struct tcf_local_rule { + LIST_ENTRY(tcf_neigh_rule) next; + uint32_t refcnt; + uint16_t mask; + union { + struct { + rte_be32_t dst; + rte_be32_t src; + } ipv4; + struct { + uint8_t dst[16]; + uint8_t src[16]; + } ipv6; + }; +}; + +/** VXLAN virtual netdev. */ +struct mlx5_flow_tcf_vtep { + LIST_ENTRY(mlx5_flow_tcf_vtep) next; + LIST_HEAD(, tcf_neigh_rule) neigh; + LIST_HEAD(, tcf_local_rule) local; + uint32_t refcnt; + unsigned int ifindex; /**< Own interface index. */ + unsigned int ifouter; /**< Index of device attached to. */ + uint16_t port; + uint8_t created; +}; + +/** Tunnel descriptor header, common for all tunnel types. */ +struct mlx5_flow_tcf_tunnel_hdr { + uint32_t type; /**< Tunnel action type. */ + unsigned int ifindex_tun; /**< Tunnel endpoint interface. */ + unsigned int ifindex_org; /**< Original dst/src interface */ + unsigned int *ifindex_ptr; /**< Interface ptr in message. */ +}; + +struct mlx5_flow_tcf_vxlan_decap { + struct mlx5_flow_tcf_tunnel_hdr hdr; + uint16_t udp_port; +}; + +struct mlx5_flow_tcf_vxlan_encap { + struct mlx5_flow_tcf_tunnel_hdr hdr; + uint32_t mask; + struct { + struct ether_addr dst; + struct ether_addr src; + } eth; + union { + struct { + rte_be32_t dst; + rte_be32_t src; + } ipv4; + struct { + uint8_t dst[16]; + uint8_t src[16]; + } ipv6; + }; +struct { + rte_be16_t src; + rte_be16_t dst; + } udp; + struct { + uint8_t vni[3]; + } vxlan; +}; + /** * Structure for holding netlink context. * Note the size of the message buffer which is MNL_SOCKET_BUFFER_SIZE. -- 1.8.3.1