From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0041.outbound.protection.outlook.com [104.47.0.41]) by dpdk.org (Postfix) with ESMTP id 8A8B45F16 for ; Thu, 1 Nov 2018 21:35:40 +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=LY5ZkipJK3y7Bj3acIG1F5ht1y7YVeuhl1YM4vX42hc=; b=W5CMPhl+7g2DrvVSiDcaHiJG3p4pugeLISAXOLKbiHAfyZZWllw+qVtOb39w6MSptUuziDXvcc+4Z2ES4FitJDHPK0VeP6YBNbaX05RK/4+n12ItRDL9+UDH1E+N+TVO1k6qFXvdcRn5DnOWrRKgoqOZY41wabhTLTaPL+hBIsk= Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com (52.134.72.27) by DB3PR0502MB3945.eurprd05.prod.outlook.com (52.134.65.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.26; Thu, 1 Nov 2018 20:35:39 +0000 Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::f8a1:fcab:94f0:97cc]) by DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::f8a1:fcab:94f0:97cc%4]) with mapi id 15.20.1273.030; Thu, 1 Nov 2018 20:35:39 +0000 From: Yongseok Koh To: Slava Ovsiienko CC: Shahaf Shuler , "dev@dpdk.org" Thread-Topic: [PATCH v3 03/13] net/mlx5: add necessary definitions for e-switch VXLAN Thread-Index: AQHUcd0ha/zB2ppPV0+trVWLU6Pk9KU7YSKA Date: Thu, 1 Nov 2018 20:35:39 +0000 Message-ID: <20181101203530.GD6118@mtidpdk.mti.labs.mlnx> References: <1539612815-47199-1-git-send-email-viacheslavo@mellanox.com> <1541074741-41368-1-git-send-email-viacheslavo@mellanox.com> <1541074741-41368-4-git-send-email-viacheslavo@mellanox.com> In-Reply-To: <1541074741-41368-4-git-send-email-viacheslavo@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BYAPR11CA0108.namprd11.prod.outlook.com (2603:10b6:a03:f4::49) To DB3PR0502MB3980.eurprd05.prod.outlook.com (2603:10a6:8:10::27) authentication-results: spf=none (sender IP is ) smtp.mailfrom=yskoh@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [209.116.155.178] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB3PR0502MB3945; 6:qe9v7s/YIyZyGGSIu7BR1wphSlxJXyyAx0QO9nKMrF5XwlNREdX647FDvQsGAcHYbFkh4RRdJITUdk6AENP74w3/aH/T1QKeEN2rPiTJhSsNT5BgFVEpLwB0iNHu93Ka0qlGYYO9g3KZckXDvWnKdfoS3inmMfRWmAF5M3qlkDnzXC1jL9XRUOexjxq53px2UjrBEXXhdZ+AykqhbmIkvv2ZvvRTHEa295A+HtumL96rwcYjlsQF/5/N7dVLg019S2RLimMs5ve/QJWkeKpr86zbm5dKfwQReVffJLeWBCTi8gzfDyiNTrCOLOHxDsArSQ4CLxFoZci09D07RxUV6UzGnsf2NAniONrCYuo9buN+w3BFOrcUXel9Mv6L6uLjeslVQpdOu5/Z1MIR33Buha6f/vJkGbL/uqFI9Wlxyb6RWNiKd45hyLCiFsPyxHkEkeEeYccPqoN1WkZcmd6wEw==; 5:zaIAhRAOEaMpWVoUAPXUH/7nZ2IP/dKmio+lFtfmV7TErGD+UFYh1G9+OH7+ZZX/R5rBfD1dKdyrCcNcqpOWOvg1zk9jxZvGNRpNHWxIu/9kejP4sKN/C658QnW8tLBX+BxqypUkx/tJK+54w33Ezz+vjbI+1/EUicIM3dy5AU8=; 7:PczG4mtkUx9Lq4FQWXnKMmeKF+7jo6Wxyc6eXtaE/c+9NDBmS206jX4UjKgtTjfskDCCUznyYdNIrUjWBJWUkjqtobdWPX4sLxYwKtR5KC96Q9WAscDl9/J+tjhWOqdIM2bbjxb3GDf8kGFlZjvjsw== x-ms-office365-filtering-correlation-id: 898c1516-1095-40a8-91f7-08d6403995c6 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:DB3PR0502MB3945; x-ms-traffictypediagnostic: DB3PR0502MB3945: 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:DB3PR0502MB3945; BCL:0; PCL:0; RULEID:; SRVR:DB3PR0502MB3945; x-forefront-prvs: 0843C17679 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(366004)(346002)(39860400002)(376002)(396003)(189003)(199004)(11346002)(9686003)(8936002)(446003)(486006)(86362001)(52116002)(76176011)(102836004)(26005)(476003)(81156014)(5250100002)(81166006)(8676002)(6512007)(71200400001)(6436002)(53936002)(71190400001)(229853002)(6636002)(386003)(6486002)(99286004)(6506007)(186003)(105586002)(33896004)(256004)(106356001)(5660300001)(4326008)(2906002)(14454004)(316002)(2900100001)(97736004)(7736002)(305945005)(6862004)(6246003)(25786009)(478600001)(3846002)(6116002)(33656002)(54906003)(1076002)(68736007)(66066001); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0502MB3945; H:DB3PR0502MB3980.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: CBisCXkB2ogrPgZDZWB8/B69BjELRORHmuQrE+a51yj73C4xalA5fuS/Z2y0UtjHk6mDMELlU4SQ1bvSwqM7XC+dBnodFucX/Y+SXB0WRNOHbHVVHRtQCNpVbbEXDxdQ/zsCUEnsOBkdKjlQHBv+iGGuAf/DjFRJksiXnp40QOUIEHvW8xIt4qWvRrtDNBuJKNsL7+ne/+GtuupYfqVWC7HKgqBhY+/zbpeS1tITj5K8tz+7OM6EoXCIo/YrrMJvd9SVr1LTOXHuLignOoxz+QElpYochDh0YF1uQZUQ4tmpgy+aV1VreWtAynQ8ky65zak2Xvn7TpT5AC42FqaeGRUHQ6RORFa2FPEj58ngdsQ= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-ID: <84F0D7D9450C5C49946FD08F77C0793A@eurprd05.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 898c1516-1095-40a8-91f7-08d6403995c6 X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Nov 2018 20:35:39.2778 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0502MB3945 Subject: Re: [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: , X-List-Received-Date: Thu, 01 Nov 2018 20:35:40 -0000 On Thu, Nov 01, 2018 at 05:19:24AM -0700, Slava Ovsiienko wrote: > This patch contains tc flower related and some other definitions > needed to implement VXLAN encapsulation/decapsulation hardware > offload support for E-Switch. >=20 > mlx5 driver dynamically creates and manages the VXLAN virtual > tunnel endpoint devices, the following definitions control > the parameters of these network devices: >=20 > - 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 >=20 > 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. >=20 > Suggested-by: Adrien Mazarguil > Signed-off-by: Viacheslav Ovsiienko > --- Acked-by: Yongseok Koh Thanks > drivers/net/mlx5/mlx5_flow.h | 2 + > drivers/net/mlx5/mlx5_flow_tcf.c | 97 ++++++++++++++++++++++++++++++++++= ++++++ > 2 files changed, 99 insertions(+) >=20 > 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) > =20 > #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_flo= w_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 >=20