From patchwork Thu Nov 1 12:19:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Slava Ovsiienko X-Patchwork-Id: 47663 X-Patchwork-Delegate: shahafs@mellanox.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D6BB11B148; Thu, 1 Nov 2018 13:19:30 +0100 (CET) Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0074.outbound.protection.outlook.com [104.47.1.74]) by dpdk.org (Postfix) with ESMTP id 7945D1B129 for ; Thu, 1 Nov 2018 13:19:26 +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=SG7Ifwt8QtumZbP9U5wD1IXZsV86oK5Px1DUm/Mk6Yg=; b=j/J8eWMVbyLPeyyoXYM0jZDAa3MBQs62ZHCAg1vA8BpV6znrGvZ9KkVGYOKXA8RnZHMhM6ALX+6ebfEMzjOYymORXmRu0c7Vk/3v0oc+0T/2R9M+U4OIPR0wXRD5c7aTw2DRTbY2dYUGCvPZ9Xkv+mGUtpfmPuE7nSauMfKp6Po= Received: from AM4PR05MB3265.eurprd05.prod.outlook.com (10.171.186.150) by AM4PR05MB3505.eurprd05.prod.outlook.com (10.171.188.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.24; Thu, 1 Nov 2018 12:19:24 +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.1273.030; Thu, 1 Nov 2018 12:19:24 +0000 From: Slava Ovsiienko To: Shahaf Shuler CC: "dev@dpdk.org" , Yongseok Koh , Slava Ovsiienko Thread-Topic: [PATCH v3 03/13] net/mlx5: add necessary definitions for e-switch VXLAN Thread-Index: AQHUcd0gjciELgk1VUmjylaq9ybBrQ== Date: Thu, 1 Nov 2018 12:19:24 +0000 Message-ID: <1541074741-41368-4-git-send-email-viacheslavo@mellanox.com> References: <1539612815-47199-1-git-send-email-viacheslavo@mellanox.com> <1541074741-41368-1-git-send-email-viacheslavo@mellanox.com> In-Reply-To: <1541074741-41368-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: LO2P265CA0079.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:8::19) 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; AM4PR05MB3505; 6:uFxSsgcov6jB5PLnRb9c/4gQXrgeIm8sS0wjSHQqWIqXBZZqZdBarD07PWaw7hHIe5x3K58xI7hxhMd5cfHN5KFB4bOYKhatz1XDgcDAELxko2sKJb5foNNSGoP/3TBJnqH+b5oQPyYLLNrl/PdxgNjCif0IOEgxdg2pHld5RWA46Swm5gYBs3VmfMkuM0Xd+drCaMahCB69D0mZTErkC44pqVmTwOAc8I/VvUeh7LQj5iGH/Pl+di/zKafRwmcypctuMSG+fAYKWhazeXCWdiaTNmv6J5kISQhj0e/4GZf8XSmBPHMpu/ICyxd5P83YCug2woD8OHd3goMgoCJukaUdxcaZqL1VixcsKfboM84yphjoCeZ7t0kGHJppPqM6jYz9OQEmMUzIeu8aWeQjGHVjNhv5MH4KjRe0BNGWRt9ej0EFt/fOL6KOjys5p81Mvopy7y3iGW5/a37dg/m41w==; 5:ykrmuD+YaCYZFmbtlL6m1HJWbUK1rQmdT6CiYbqphxlChnja1jwzJuttj37jt77EZZeB/jmsad7DoAF5FxUg9I+CyZhDygy6vwRrs9dkaGsemCmOgEMlNV/w65L3yIPxQZyrlrrjaOsTL7PCJ+Bx9CgC9JTTcV8yO3f1jk9npX0=; 7:7lqecRnKdayhqp69Cyr1Mo9NuGE5d82RfdM9Qv4P1OPMJ+WcEG+4cuepkVPG4XTvfCakpd2SSKYMYP4RdutYbuhRiXIQvtMRBp8MjiK3BqU3OBA0UrErJA94f5n55DeWsRmIUOvvy7RW91Wo+Qum0w== x-ms-office365-filtering-correlation-id: 128435c1-822c-4f62-c2aa-08d63ff442ba 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:AM4PR05MB3505; x-ms-traffictypediagnostic: AM4PR05MB3505: 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)(3231382)(944501410)(52105095)(3002001)(10201501046)(93006095)(93001095)(6055026)(148016)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123564045)(20161123558120)(201708071742011)(7699051)(76991095); SRVR:AM4PR05MB3505; BCL:0; PCL:0; RULEID:; SRVR:AM4PR05MB3505; x-forefront-prvs: 0843C17679 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(396003)(376002)(366004)(136003)(39860400002)(199004)(189003)(7736002)(6506007)(386003)(486006)(52116002)(76176011)(256004)(4326008)(36756003)(25786009)(8676002)(66066001)(81156014)(81166006)(5250100002)(99286004)(14454004)(6436002)(107886003)(6512007)(5660300001)(478600001)(53936002)(68736007)(26005)(86362001)(102836004)(97736004)(305945005)(6636002)(2900100001)(6486002)(8936002)(71190400001)(71200400001)(316002)(2906002)(476003)(3846002)(6116002)(186003)(11346002)(54906003)(105586002)(446003)(2616005)(106356001)(6862004)(37006003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR05MB3505; 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: hTEukOr8gONj7WVI/5P9VmInmRMoLVQP1QqOgAjubz507yYw9IehTbx9XcuIJ9qJ4TdL+bNiNUA2ouNhgx9BFFn4E/QRlult479A3cNqE47E6Zc7i+eufoZnHFJ/A5PujLHOMYoTasoc7On4DVr+Rw7ko3PJcS11FA4LHMyoX1Sse5w+nYccXekqND/wmKsYahm0MSbJlsbpe4L1wn0u68jkQ0nSUw7EupUmpLICUCV8S16++Fp+kuReB+nkP3Etnfm7HViSYVJb9pnxOtvDCMLSt6Pmx6SxULB6eMbovdBsiAJROqASiWJt30YC4iwxBmgoKvJjISnbkXqpBxt1Ot2X8CS+iwgoB/6vw6wob7o= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 128435c1-822c-4f62-c2aa-08d63ff442ba X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Nov 2018 12:19:24.6578 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR05MB3505 Subject: [dpdk-dev] [PATCH v3 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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.h | 2 + drivers/net/mlx5/mlx5_flow_tcf.c | 97 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 99 insertions(+) diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index c24d26e..392c525 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -92,6 +92,8 @@ #define MLX5_FLOW_ACTION_DEC_TTL (1u << 19) #define MLX5_FLOW_ACTION_SET_MAC_SRC (1u << 20) #define MLX5_FLOW_ACTION_SET_MAC_DST (1u << 21) +#define MLX5_FLOW_ACTION_VXLAN_ENCAP (1u << 22) +#define MLX5_FLOW_ACTION_VXLAN_DECAP (1u << 23) #define MLX5_FLOW_FATE_ACTIONS \ (MLX5_FLOW_ACTION_DROP | MLX5_FLOW_ACTION_QUEUE | MLX5_FLOW_ACTION_RSS) 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 { #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 + +#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 +/** 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) +#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 | \