From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-eopbgr40048.outbound.protection.outlook.com [40.107.4.48]) by dpdk.org (Postfix) with ESMTP id 1295E58C4 for ; Sat, 3 Nov 2018 07:18:38 +0100 (CET) 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=8irzTJC7Dw8JaWRrbAWW81SRx33N/R33gv3tUA8W6/A=; b=Gfu5qHmAaax6m5Z3sg/VYiYzZzp2CMpTdhk1tLz29JdsqfmfPWyZJsokaRXsAXWQ68p1sIQ2BK7OgcheZeXYEVuXjxIgDK1SPNW8MPILAQYo+q4Dr9yC9XBkpkMftOQ3WGWopXHsf4RHAsxMf0RH9EJi1KOuN3HZABGNuo+VMi0= Received: from AM4PR05MB3265.eurprd05.prod.outlook.com (10.171.186.150) by AM4PR05MB1620.eurprd05.prod.outlook.com (10.165.245.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1250.30; Sat, 3 Nov 2018 06:18:37 +0000 Received: from AM4PR05MB3265.eurprd05.prod.outlook.com ([fe80::544b:a68d:e6a5:ba6e]) by AM4PR05MB3265.eurprd05.prod.outlook.com ([fe80::544b:a68d:e6a5:ba6e%2]) with mapi id 15.20.1294.027; Sat, 3 Nov 2018 06:18:37 +0000 From: Slava Ovsiienko To: Shahaf Shuler CC: "dev@dpdk.org" , Yongseok Koh , Slava Ovsiienko Thread-Topic: [PATCH v5 03/13] net/mlx5: add necessary definitions for E-Switch VXLAN Thread-Index: AQHUcz0O2a1oCYAxG0emdsDQuzi1kg== Date: Sat, 3 Nov 2018 06:18:36 +0000 Message-ID: <1541225876-8817-4-git-send-email-viacheslavo@mellanox.com> References: <1541181152-15788-2-git-send-email-viacheslavo@mellanox.com> <1541225876-8817-1-git-send-email-viacheslavo@mellanox.com> In-Reply-To: <1541225876-8817-1-git-send-email-viacheslavo@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: CWLP123CA0088.GBRP123.PROD.OUTLOOK.COM (2603:10a6:401:5b::28) To AM4PR05MB3265.eurprd05.prod.outlook.com (2603:10a6:205:4::22) authentication-results: spf=none (sender IP is ) smtp.mailfrom=viacheslavo@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [37.142.13.130] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM4PR05MB1620; 6:sDsFchGZZbwrvM1XCRlBYrfcvkId3j6GGZXE2ix0tQnDSNe7lCzf2sscJ76R9t/tD2fRC000DLZljvZLSwAUBwuFze8iLy5WcraGxqoVq2OQEXWmNCizesHV4v6pIM+C908ZcBJKCggwy5l+h6oHy0dfKqG7LXZLq/ZsBLdR28gXLKe4hThC1MfpdSr+lJtikeidCL/VHaNEHaAM6ZANfCwJ+6tFpQaJa0BeG1N73M61pChNvJV07uX3RWEp/Y+nOB7Q1cDU+VCTGTA/r5rSiC/572ZfMG8Uuj3GdQnWeJEbGXutBOYq/aY/NWN2GOKECYPtQVoBn9JADOz9sBJDdDU8drXy286IAtfSxSsSCKtEwKRAOctVAtiPR/8DzhmMkrk8FKJcJW+p/gODC1KMWWL9k39L+57HcHJeyAsTucBcwHyLcF3Ug4vE9jBVTy37zm1aI8ws0IqX0PVZ6YdyiA==; 5:sjToOvOmd2gxD+H46MfsrqADuKdjMCVU0Zq4r39z+xeQWf6X4v5990Mkd/lzg+3m/Nxv0MD4heWMuxpg1HU9lX712u/g1xPIrZRQAKyLaYe8J108Nz/400mswsl9u5i3o5hbt3V/5dYcVLhIrX9PVRQYLyZoPumaEqFS7RedVt0=; 7:wUrPSEwRAdlq8MLSgTXI7oAfeE6vE2XVpb5UbCe2VptO0+qhnzD3m905uM/YLcZnhCB7lFfqnvwjFJGezr5DsM4Xd/M5cO8l3kLZCqqVHEtRDoxMzX6ikk/Q9bUx6OJDL0lrMU3EzYHI3UFojTHLSbzZ6Jeqqjr3mK46UAiTj6SKW4PeramNyaPAI3TQVVIRMhuHmZ0OmL8wUswbKagg7UTN0IdGK0UHZfOCGHbM4UH9/tF2DED8pz4E8ckXxNo7 x-ms-office365-filtering-correlation-id: 841c9aa4-72eb-4ca8-62cf-08d64154308c 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:AM4PR05MB1620; x-ms-traffictypediagnostic: AM4PR05MB1620: 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)(5005006)(8121501046)(93006095)(93001095)(3231382)(944501410)(52105095)(10201501046)(3002001)(6055026)(148016)(149066)(150057)(6041310)(20161123558120)(20161123560045)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095); SRVR:AM4PR05MB1620; BCL:0; PCL:0; RULEID:; SRVR:AM4PR05MB1620; x-forefront-prvs: 08457955C4 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(39860400002)(366004)(346002)(376002)(136003)(199004)(189003)(6636002)(52116002)(36756003)(486006)(102836004)(386003)(6506007)(6116002)(2906002)(86362001)(25786009)(2900100001)(476003)(71190400001)(106356001)(26005)(305945005)(2616005)(76176011)(3846002)(256004)(53936002)(66066001)(4326008)(107886003)(11346002)(14454004)(105586002)(6436002)(8936002)(446003)(81166006)(97736004)(6512007)(8676002)(316002)(54906003)(6486002)(186003)(68736007)(7736002)(5660300001)(6862004)(71200400001)(37006003)(478600001)(81156014)(99286004); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR05MB1620; H:AM4PR05MB3265.eurprd05.prod.outlook.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-antispam-message-info: C61NIoRkSBLXhB+G0lsHVTOAMNxphVTFRB819kApoOl5baOHfmv/UGEgclYzY7Q6JVCkYU/sl8TBkk60qXhRfr4Oodo/Z8HR44cNQVi2YKrmHHQYG/Byrlt+KfaZy1J+WVYOtgaLZn/Ixukq7RyZkpgqUgNn6cTSLt9Myg/XDk3AqlpcW6x4iNbS4bQQ1bUyqenyJhkgNnR9FnsuaGLujf7DVQ8SbKwPwRbtNfIf6aDFbcKr7oc1lmY5lvI/2kicgGWXWFb5O0qyxKHK0MgDbrW559diGNaaj8j7ul3NfwB6eIUYdWhXffzjCbDlx/MyMvSlxehc05qkWgPbXZZta2Z0NtEA4QcHBujATKXP9FU= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 841c9aa4-72eb-4ca8-62cf-08d64154308c X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Nov 2018 06:18:36.9190 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR05MB1620 Subject: [dpdk-dev] [PATCH v5 03/13] net/mlx5: add necessary definitions for E-Switch VXLAN 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: Sat, 03 Nov 2018 06:18:38 -0000 This patch contains tc flower related and some other definitions needed to implement VXLAN encapsulation/decapsulation hardware offload support for E-Switch. mlx5 driver dynamically creates and manages the VXLAN virtual tunnel endpoint devices, the following definitions control the parameters of these network devices: - MLX5_VXLAN_PORT_MIN - minimal allowed UDP port for VXLAN device - MLX5_VXLAN_PORT_MAX - maximal allowed UDP port for VXLAN device - MLX5_VXLAN_DEVICE_PFX - name prefix of driver created VXLAN device The mlx5 drivers creates the VXLAN devices with UDP port within specified range, devices have the names with specified prefix, followed by decimal digits of UDP port. Suggested-by: Adrien Mazarguil Signed-off-by: Viacheslav Ovsiienko Acked-by: Yongseok Koh --- drivers/net/mlx5/mlx5_flow_tcf.c | 97 ++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 97 insertions(+) diff --git a/drivers/net/mlx5/mlx5_flow_tcf.c b/drivers/net/mlx5/mlx5_flow_= tcf.c index 719fb10..4d54112 100644 --- a/drivers/net/mlx5/mlx5_flow_tcf.c +++ b/drivers/net/mlx5/mlx5_flow_tcf.c @@ -113,6 +113,39 @@ struct tc_pedit_sel { =20 #endif /* HAVE_TC_ACT_VLAN */ =20 +#ifdef HAVE_TC_ACT_TUNNEL_KEY + +#include + +#ifndef HAVE_TCA_TUNNEL_KEY_ENC_DST_PORT +#define TCA_TUNNEL_KEY_ENC_DST_PORT 9 +#endif + +#ifndef HAVE_TCA_TUNNEL_KEY_NO_CSUM +#define TCA_TUNNEL_KEY_NO_CSUM 10 +#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 */ + /* Normally found in linux/netlink.h. */ #ifndef NETLINK_CAP_ACK #define NETLINK_CAP_ACK 10 @@ -211,6 +244,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 @@ -241,6 +313,28 @@ struct tc_pedit_sel { #define TCA_ACT_MAX_PRIO 32 #endif =20 +/** UDP port range of VXLAN devices created by driver. */ +#define MLX5_VXLAN_PORT_MIN 30000 +#define MLX5_VXLAN_PORT_MAX 60000 +#define MLX5_VXLAN_DEVICE_PFX "vmlx_" + +/** Tunnel action type, used for @p type in header structure. */ +enum flow_tcf_tunact_type { + FLOW_TCF_TUNACT_VXLAN_DECAP, + FLOW_TCF_TUNACT_VXLAN_ENCAP, +}; + +/** Flags used for @p mask in tunnel action encap descriptors. */ +#define FLOW_TCF_ENCAP_ETH_SRC (1u << 0) +#define FLOW_TCF_ENCAP_ETH_DST (1u << 1) +#define FLOW_TCF_ENCAP_IPV4_SRC (1u << 2) +#define FLOW_TCF_ENCAP_IPV4_DST (1u << 3) +#define FLOW_TCF_ENCAP_IPV6_SRC (1u << 4) +#define FLOW_TCF_ENCAP_IPV6_DST (1u << 5) +#define FLOW_TCF_ENCAP_UDP_SRC (1u << 6) +#define FLOW_TCF_ENCAP_UDP_DST (1u << 7) +#define FLOW_TCF_ENCAP_VXLAN_VNI (1u << 8) + /** * Structure for holding netlink context. * Note the size of the message buffer which is MNL_SOCKET_BUFFER_SIZE. @@ -347,6 +441,9 @@ struct flow_tcf_ptoi { (MLX5_FLOW_ACTION_OF_POP_VLAN | MLX5_FLOW_ACTION_OF_PUSH_VLAN | \ MLX5_FLOW_ACTION_OF_SET_VLAN_VID | MLX5_FLOW_ACTION_OF_SET_VLAN_PCP) =20 +#define MLX5_TCF_VXLAN_ACTIONS \ + (MLX5_FLOW_ACTION_VXLAN_ENCAP | MLX5_FLOW_ACTION_VXLAN_DECAP) + #define MLX5_TCF_PEDIT_ACTIONS \ (MLX5_FLOW_ACTION_SET_IPV4_SRC | MLX5_FLOW_ACTION_SET_IPV4_DST | \ MLX5_FLOW_ACTION_SET_IPV6_SRC | MLX5_FLOW_ACTION_SET_IPV6_DST | \ --=20 1.8.3.1