From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60084.outbound.protection.outlook.com [40.107.6.84]) by dpdk.org (Postfix) with ESMTP id F09AA58F6 for ; Thu, 25 Oct 2018 14:50:28 +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=0Wwsk4ksUtkl0jHWtznbqHRhZkiTjQsgo8sJ3kcW5K4=; b=DQc+/k9/Ajv7yPV3j78LnE9PROCAlPngCLw5j54XGvaijGnaLmYGFnyoVxJuY8iAn8nCG6JR8dqSzZrcCDoSxjRYu52WXtVEGse4G9Aq3+HGhYQfdDDYQ/490ops/0rA/ZTwPMIdsjpV31OF8V0fDmR9TPhI73R9Hh6vbLEjxPQ= Received: from VI1PR05MB3278.eurprd05.prod.outlook.com (10.170.238.23) by VI1PR05MB4765.eurprd05.prod.outlook.com (20.176.4.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1273.21; Thu, 25 Oct 2018 12:50:26 +0000 Received: from VI1PR05MB3278.eurprd05.prod.outlook.com ([fe80::5140:2fb:bbd8:1b7d]) by VI1PR05MB3278.eurprd05.prod.outlook.com ([fe80::5140:2fb:bbd8:1b7d%5]) with mapi id 15.20.1250.032; Thu, 25 Oct 2018 12:50:26 +0000 From: Slava Ovsiienko To: Yongseok Koh CC: Shahaf Shuler , "dev@dpdk.org" Thread-Topic: [PATCH v2 1/7] net/mlx5: e-switch VXLAN configuration and definitions Thread-Index: AQHUZJFXdA/Ag4Ie3EaivISYkqPzWaUspZuAgANHn+A= Date: Thu, 25 Oct 2018 12:50:26 +0000 Message-ID: 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> <20181023100109.GA14792@mtidpdk.mti.labs.mlnx> In-Reply-To: <20181023100109.GA14792@mtidpdk.mti.labs.mlnx> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=viacheslavo@mellanox.com; x-originating-ip: [95.67.35.250] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; VI1PR05MB4765; 6:2SQfkVKT7/ErPyeeAojzPhL/CzTLZ87uG5HINPhSeZghsK1aBIUshEo8BjdRnJAyuYc26YLuwd/5lad9PQWVNPgMZXejjlReBQFcX1e6X6uWOWrizRCZEzHlFyrdqVbaYiGZFXO7Wo3QIIsc/8UIRF4dkn3AVkvnXSMG25RdR5s+vl+/qeGmVSRf4SGnPDadM3WlfQ3noF/j85drHgi0yoyGHY6XQl5fpkmWpxSVIb9dfsBSf3GN2ehkEiKVdXh02LzesolFunM/l4YBBFp7YBFAIaHkLm+mEQjRE9dB2ItOgTua8s48hox/TfjXKfZe6TAmlVYRh7H9dMPSD5+fMVR4FehTRdjVGizOPkFDMKeT6BYyQSCrZ5W2taUnrLAvBUoiSND6/rWDc/mflqhYG9o8lskyZ57EOV1eep45T3REtP6o7LoEabE5123p+gKY7YuJAmh/0bL1jvgv40Z7Tw==; 5:DO6ACpHPrl/MEyWHjlDxJtA1n81dZIaUKG/HewyRYONbOC25D2x1zrVw2Aj6nJgVeJRTFLtrz9Ey13IHKMb3ihm7waL8lrNLD/Ug2EM4cgxb/2H/2NyfQ0XksCrS9TPmscihNBnUCzypzAxAC2hjVU6jhyxjM+ABrYFRsommBRo=; 7:ifETgXrFR1aXVZv3k5glbQDqWQyyc+8N+Njv8KhyE6Q+r4/3Y9I/b9uT/GHehlXb/WEiuD1TqU6/g4/YdeOCKLsgpaaaWasYoQjL/XcKorW9UJtTQTeIG02RI2y+ekJRW58N+ryBirTD5A2fYtTSgg== x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: 4c448dec-71bb-47f5-72c6-08d63a786fac x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:VI1PR05MB4765; x-ms-traffictypediagnostic: VI1PR05MB4765: 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)(148016)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123560045)(20161123562045)(201708071742011)(7699051)(76991095); SRVR:VI1PR05MB4765; BCL:0; PCL:0; RULEID:; SRVR:VI1PR05MB4765; x-forefront-prvs: 083691450C x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(39860400002)(136003)(396003)(376002)(346002)(199004)(189003)(57704003)(13464003)(2900100001)(102836004)(7696005)(6506007)(53546011)(7736002)(33656002)(74316002)(25786009)(99286004)(76176011)(8936002)(5250100002)(11346002)(2906002)(6116002)(305945005)(97736004)(3846002)(476003)(106356001)(68736007)(54906003)(81156014)(81166006)(486006)(14444005)(5024004)(186003)(8676002)(256004)(26005)(446003)(105586002)(316002)(53946003)(6436002)(71200400001)(71190400001)(4744004)(53936002)(55016002)(9686003)(6636002)(6246003)(86362001)(575784001)(478600001)(93886005)(229853002)(14454004)(6862004)(5660300001)(4326008)(66066001)(21314003); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR05MB4765; H:VI1PR05MB3278.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: WVoIgu6odzZYkCpdGjokP6hEOvwiSLk6llhFLgtSoRgbFph2PM2tip6Pw6tWVau4q6LGDvfqf2qIilFlEbBvlaKlPPqQD1EDMqwQ8NImnVtXHe1Cx2A9hQnTVfcERIgTUiHDiIDP6o2c7TgyDiRL9r6dg3umvYVwfpbpSyzSDVPE82wnr7LbffjSc0cXR+m/8uK0HoasmRYZrxxkxrdQzsAETvehPcy1dYswCvWBj+p7ZzdbANlmxys0lShcIuKmSR33w3brph6y0RUwWgxZ1zoKmJFxxNU+Mcskp/2TqdxWMVjsPZBXu4WMdZMl/wWFdl8YG1TuJnUD+uZc20501ZKX4Rs5x/dK4zG2eTB2krA= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4c448dec-71bb-47f5-72c6-08d63a786fac X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Oct 2018 12:50:26.1291 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB4765 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: Thu, 25 Oct 2018 12:50:29 -0000 > -----Original Message----- > From: Yongseok Koh > Sent: Tuesday, October 23, 2018 13:02 > To: Slava Ovsiienko > Cc: Shahaf Shuler ; dev@dpdk.org > Subject: Re: [PATCH v2 1/7] net/mlx5: e-switch VXLAN configuration and > definitions >=20 > 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. > > > > 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.buil= d > > 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) >=20 > MLX5_ACTION_* has been changed to MLX5_FLOW_ACTION_* as you can > see above. OK. Miscopied from previous version of patch. > And make it alphabetical order; decap first and encap later? Or, at least= make > it consistent. The order (case clause) is different among validate, prepa= re and > translate. OK. Will reorder. >=20 > > #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. */ >=20 > It is used only for assert(), but if prepare() is trusted, why do we need= to > keep it? I don't it is needed. >=20 Q? Let's keep the nlsize under NDEBUG flag?=20 It's extremely useful to have assert() on allocated size for debugging purposes. > > + uint32_t applied:1; /**< Whether rule is currently applied. */ > > + uint64_t item_flags; /**< Item flags. */ >=20 > This isn't used at all. OK, now no dependencies on it, should be removed, good. >=20 > > + uint64_t action_flags; /**< Action flags. */ >=20 > I checked following patches and it doesn't seem necessary. Please refer t= o > the > comment on the translation func. But if you think it is really needed, yo= u > could've used actions field of struct rte_flow and layers field of struct > mlx5_flow in mlx5_flow.h When translating item list into NL-message we have to know whether there is= =20 some tunneling action in the actions list. This is due to possible=20 changing of the item meanings if tunneling action is present. For example, usually the ipv4 item provides IPv4 addresses for matching and translated t= o TCA_FLOWER_KEY_IPV4_SRC (+ xxx_DST) Netlink attribute(s), but if there is VXLAN decap action specified, this item becames outer tunnel source IPs and should be translated to TCA_FLOWER_KEY_ENC_IPV4_SRC. The action list is scanned in the preperd list, so we can save action flags and use = these gathered results in translation routine. As we can see from mlx5_flow_list_= create() source, it does not save item/actions flags, gathered by flow_drv_prepare(). That's= why there are item_flags/action_flags in the struct mlx5_flow_tcf. item_flags = is not needed, should be removed. action_flags is in use. BTW, do we need item_flags, action_flags params in flow_drv_prepare() ? We would avoid the item_flags field if flags were transferred from flow_drv_prepare() to flow_drv_translate() (as local variable of mlx5_flow_list_create(). > > 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; > > + }; >=20 > What is the reason for keeping pointer even though the actual structure > follows > after mlx5_flow_tcf? Maybe you don't want to waste memory, as the size of > encap/decap struct differs a lot? Sizes differ, but not a lot (especially comparing with DV rule size).=20 Would you prefer to simplify and just include the union? On other hand we could declare something like that: ... uint8_t tunnel_type; alignas(struct mlx5_flow_tcf_tunnel_hdr) uint8_t buf[]; and eliminate the pointer at all. The buf beginning contains either tunnel = structure or Netlink message (if no tunnel), depending on the tunnel_type field. With best regards, Slava >=20 > > }; > > > > /* 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. > >