From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20070.outbound.protection.outlook.com [40.107.2.70]) by dpdk.org (Postfix) with ESMTP id E6A8A1B48D for ; Tue, 23 Oct 2018 12:01:32 +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=K9kFYO9uTRSkypKmp6WY0ncUBrNPh6GCY/Cy5F/w3Hg=; b=IOHYqfxi/aQFf3Vo3eiMKT9HSq3gVzVP0084S80Hzd3RLfBlrubphMAfUWth3kSkLy+0KNtEZGZD0QEEg1pB6tHdHFXZT8ZlmuttvDWqW7RwhO34x62WVjWf6CH8RIlIXkpRsxe3c1CIK9oaZ0tlL78VXJ1DRIthXXuRePJkEQA= Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com (52.134.72.27) by DB3PR0502MB4026.eurprd05.prod.outlook.com (52.134.72.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1250.29; Tue, 23 Oct 2018 10:01:31 +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.1250.028; Tue, 23 Oct 2018 10:01:31 +0000 From: Yongseok Koh To: Slava Ovsiienko CC: Shahaf Shuler , "dev@dpdk.org" Thread-Topic: [PATCH v2 1/7] net/mlx5: e-switch VXLAN configuration and definitions Thread-Index: AQHUZJFXAn6IFwvCd0O52pR+SaFJP6UspZEA Date: Tue, 23 Oct 2018 10:01:31 +0000 Message-ID: <20181023100109.GA14792@mtidpdk.mti.labs.mlnx> References: <1538461807-37507-1-git-send-email-viacheslavo@mellanox.com> <1539612815-47199-1-git-send-email-viacheslavo@mellanox.com> <1539612815-47199-2-git-send-email-viacheslavo@mellanox.com> In-Reply-To: <1539612815-47199-2-git-send-email-viacheslavo@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BYAPR05CA0081.namprd05.prod.outlook.com (2603:10b6:a03:e0::22) 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; DB3PR0502MB4026; 6:csmAH3lqOJccVW+eRaDCsGg8nZj7jxe3HQ7OH0lCE47OL7gPB04YlAZM8YI5F8KhsV1R7sY6NhmTA2l1z43iv6tt1FOxefG8Fp9kibrGhbu0UCxjyoSwSnEBrKtrAyrBfikAVBNXLOI1EzepJX0l3w+XUZq77K7QW9TY9Fa1C8kjYFStFjX21ltyDkhAz0qV4B/ZZqnqd6k7gCfJS9sdN08P6raEidPqw+gHOF4fNDZIxMhmZvMQgUaafo9vEG9pVNvG5nCqoySn/h1H3W1j5o046SghOnEvLTnbyfbmNxZcFFd7Z96F6J5ALAJU5c5CnV/70hjh6nJnTrxSunL4RYNTK+3eMvukaKP0mK40n8F8teIXOMI2I/0QHSStadO2nH89AqcrUBhLpoYtJ/pSXtoX/R8adEDJBT2XM1UqPQs6hoozqH/6sms9wgOeRBWYNOb3WIjYPRbSyvh7227fxw==; 5:zKykN1zB4Y7lY8YvAeQC6Lp1IropnPZjoOFnvwo1NeYnPbj/kIRigGkN0cvMvGBjMyvSymcUaj5kPNkG938ZZ58a4RB3u87xUd5OM5LVFZEMTvy9Aynlh5U2O0HbqLzj9i4N6th9HcvzDvj4Odp8JbsaCf8HXqBnomu3bGxobIY=; 7:1eEmiVpPHpW8Trc11XfYZcqbbDIGtmQsfOZvN53zErOmOBhD28UjOaYXSVQ8iHeFLjOxL2AccyzJc9/X8cu9CEDD48zeP/Ox9RWEl7rdz6HXFIwX0LmGbfRL0PL3UUwzfEHYTwKNNXbTB9iSTrb3o/FbuORAFqv4o+Z6XhDYkE92f2Kw0l20R48Q/93G5n5gTr6A2KB+fPIQ3c+vhgU+PfYpoKTDsSLbvUPsl52XlqUH8mLYdmryQtiylXvm6jpd x-ms-office365-filtering-correlation-id: 8c2bd753-6bac-4668-f909-08d638ce8174 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:DB3PR0502MB4026; x-ms-traffictypediagnostic: DB3PR0502MB4026: 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)(3231355)(944501410)(52105095)(3002001)(10201501046)(93006095)(93001095)(6055026)(148016)(149066)(150057)(6041310)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095); SRVR:DB3PR0502MB4026; BCL:0; PCL:0; RULEID:; SRVR:DB3PR0502MB4026; x-forefront-prvs: 0834BAF534 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(979002)(39860400002)(136003)(376002)(346002)(366004)(396003)(57704003)(199004)(189003)(575784001)(476003)(4326008)(86362001)(478600001)(68736007)(6512007)(8936002)(102836004)(6486002)(229853002)(256004)(105586002)(53936002)(6862004)(6506007)(6246003)(11346002)(186003)(6636002)(446003)(97736004)(5024004)(14444005)(106356001)(486006)(14454004)(66066001)(316002)(4744004)(2900100001)(6116002)(99286004)(5250100002)(3846002)(7736002)(1076002)(386003)(5660300001)(52116002)(33656002)(33896004)(54906003)(81156014)(26005)(305945005)(6436002)(25786009)(2906002)(76176011)(8676002)(9686003)(71190400001)(71200400001)(81166006)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0502MB4026; H:DB3PR0502MB3980.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: /3WFymRisZvkoulwIAxSu0LK9iADH8+4hxNH8Z1gEkNoA43TR0eW1BJhj03BoB8OpRVD6hY6H3B+7tYWSW4VdQ/75rpll1++4uHVWkxnS/tLKLKgMhUozjGGpmvHzi1VAGQSoTie3bfDsyGJ0h3RkKOVYCuxibx4WtY5kncz1dRAx6fRp5I4/J4DgslKLysEWAXE6AhnYlTlxG+Ldh6uP18+/Vq+4MbRy/Nk8BU1XtYmupTLsPE9UYjdA3wwtjdxgnkVMWKkenvlbrSU6MMcO7NzplVPV6bMznGYEzAfgD8VNhrZIsNjp8vV+Ww5xbnfD1yPjFOwExeX2YN3DaKHK7pIIMjW8kVZmqrtr91pWZI= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-ID: <07907098DEACF04A901A75AE70299733@eurprd05.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8c2bd753-6bac-4668-f909-08d638ce8174 X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Oct 2018 10:01:31.3504 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0502MB4026 Subject: Re: [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: Tue, 23 Oct 2018 10:01:33 -0000 On Mon, Oct 15, 2018 at 02:13:29PM +0000, Viacheslav Ovsiienko wrote: > 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. >=20 > 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(+) >=20 > 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-conf= ig-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-conf= ig-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) MLX5_ACTION_* has been changed to MLX5_FLOW_ACTION_* as you can see above.= =20 And make it alphabetical order; decap first and encap later? Or, at least m= ake it consistent. The order (case clause) is different among validate, prepare= and translate. > #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. */ It is used only for assert(), but if prepare() is trusted, why do we need t= o keep it? I don't it is needed. > + uint32_t applied:1; /**< Whether rule is currently applied. */ > + uint64_t item_flags; /**< Item flags. */ This isn't used at all. > + uint64_t action_flags; /**< Action flags. */ I checked following patches and it doesn't seem necessary. Please refer to = the comment on the translation func. But if you think it is really needed, you could've used actions field of struct rte_flow and layers field of struct mlx5_flow in mlx5_flow.h > 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; > + }; What is the reason for keeping pointer even though the actual structure fol= lows after mlx5_flow_tcf? Maybe you don't want to waste memory, as the size of encap/decap struct differs a lot? > }; > =20 > /* Verbs specification header. */ > diff --git a/drivers/net/mlx5/mlx5_flow_tcf.c b/drivers/net/mlx5/mlx5_flo= w_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 { > =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 > + > +#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 > =20 > #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 > =20 > +#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. >=20