From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0077.outbound.protection.outlook.com [104.47.0.77]) by dpdk.org (Postfix) with ESMTP id A8B395B32 for ; Thu, 1 Nov 2018 21:36:24 +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=hth4KjfYimq0RnMg7MBAkS7Y1wgqd73WmcXBu7Rw31E=; b=BIEUQKC98jERCmzzIFCQOqErw6n2qFZ4zCDKkryI/OOlUJnUtIaIA2i1/jmYPFkSx4L1RNPM/8dM3xwv2a4VqCAaZG94OoldSE+2T6LC0E1uTOumE33dk+S1DVZ6+r6Xzecrwza9Jltef3QB3N9w1qdsdCRI8ueket3jtTGT3AU= 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:36:23 +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:36:23 +0000 From: Yongseok Koh To: Slava Ovsiienko CC: Shahaf Shuler , "dev@dpdk.org" Thread-Topic: [PATCH v3 04/13] net/mlx5: add necessary structures for e-switch VXLAN Thread-Index: AQHUcd0hKqbYz1xMZ0KnhiLTtUEuzqU7YVgA Date: Thu, 1 Nov 2018 20:36:23 +0000 Message-ID: <20181101203615.GE6118@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-5-git-send-email-viacheslavo@mellanox.com> In-Reply-To: <1541074741-41368-5-git-send-email-viacheslavo@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BYAPR01CA0033.prod.exchangelabs.com (2603:10b6:a02:80::46) 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:wnZpVogPvqLfJqnLztsuJ5FF9PwL09UXnYLufZWOQVAGp411mxmhqeFUov344245uaYp+7CyF0t1E4hlPX2nbZih6WDjciUrZtG9wlwGAJIhKmx2CALebuC/LI93IUoGO/EM4BeBIKwwju4aJ8iCF8FIHyfkjqpza4k75fdFju3yRG6pPjUo2j++GVHl49D5yemUxfmAZfTqXSnQwNYtU6GMXSu+Il2bVqrar7QsiycrzLVkRlc1l+hiJ+LRzFSODlFjH6QI+dmYHMd1IXLLtxY1/giWbdEiwBEWzO8sBBaPqT9cYsuIYRy4pJsfrzgRcAUQUyQfr0vxROt06iWC+hmG7s5qWbkMLm5DGJUSMTNP987SWW7pcNlrXp6Od/16EV1IKgh+Roz9QJ4HXCPwqnorYJ6F7/yJkd4S2ogOkTvHm0znLQBjdlYFIQkETNrsYCc70wwjqSk0XHakNfinsQ==; 5:aDcH9nuf6kO5ZHjVP451/IVk/iceZgsDmVVuH9+2C4NE7LRfBorhiZS55CHVS088rMOKjLbD00kQCk4VHeAKjWjRaYPJLY+Qbegq1SSDCv0+gFEew26qsko1ESdCAImptTIq+YO5Qqog2moNYQ+cqJzhIOm67nLTNDiBvw6LAnk=; 7:gq1UmhJoumolkltN97PH6ZngWk5Vkh7GghjrPf1sxj7G/tZZhHnZEJDvs+/8OntxXu3yImFhLDU21Cyapx2TXUob/zNDi9EAEqYZzurZhbOk6yt3Vmo6IMe/vc86laIC1oYWEKIoXmi+AQEPnTISCA== x-ms-office365-filtering-correlation-id: 4c242976-afea-45f3-5076-08d64039b037 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)(5024004)(256004)(14444005)(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: ApPFvBzvg207fksJn0EqcMdjxOpC/gcMFu3KhXmR4VrXi/UD8koDRxXOF95UkbmG4Oy1e0ozLbNjDRTY02z1K7IitUtYmZvzX8TYcV88xRYHkVoWIPXmJAQLLR6cpDz3dgmyI1bureZG+ds+/PWvft4TeWRUowVSTvMZeodPCMGyA3An66ECSh2XtY7g3q1Z6HDFvh6az/uOgF7yiuA65so4YyLBK6oiGWD5mOKFwAO9/tEtnJ3OSc061dV4jJwKDrY86B45/paTM9W3FpDGSFh2WJtftQUxscejCbJITGZHRX+4Dsa19Dp2aqC1Meof8ASbfVH4onXFgDJrDMJ0jTW3NGtx7OTGC+Xw5TskgJ0= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4c242976-afea-45f3-5076-08d64039b037 X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Nov 2018 20:36:23.6184 (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 04/13] net/mlx5: add necessary structures 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:36:25 -0000 On Thu, Nov 01, 2018 at 05:19:25AM -0700, Slava Ovsiienko wrote: > This patch introduces the data structures needed to implement VXLAN > encapsulation/decapsulation hardware offload support for E-Switch. >=20 > Suggested-by: Adrien Mazarguil > Signed-off-by: Viacheslav Ovsiienko > --- Acked-by: Yongseok Koh Thanks > drivers/net/mlx5/mlx5_flow.h | 9 ++++ > drivers/net/mlx5/mlx5_flow_tcf.c | 99 ++++++++++++++++++++++++++++++++++= ++++++ > 2 files changed, 108 insertions(+) >=20 > diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h > index 392c525..3887ee9 100644 > --- a/drivers/net/mlx5/mlx5_flow.h > +++ b/drivers/net/mlx5/mlx5_flow.h > @@ -191,6 +191,15 @@ struct mlx5_flow_dv { > struct mlx5_flow_tcf { > struct nlmsghdr *nlh; > struct tcmsg *tcm; > + union { /**< Tunnel encap/decap descriptor. */ > + struct flow_tcf_tunnel_hdr *tunnel; > + struct flow_tcf_vxlan_decap *vxlan_decap; > + struct flow_tcf_vxlan_encap *vxlan_encap; > + }; > + uint32_t applied:1; /**< Whether rule is currently applied. */ > +#ifndef NDEBUG > + uint32_t nlsize; /**< Size of NL message buffer for debug check. */ > +#endif > }; > =20 > /* Verbs specification header. */ > diff --git a/drivers/net/mlx5/mlx5_flow_tcf.c b/drivers/net/mlx5/mlx5_flo= w_tcf.c > index 4d54112..55c77e3 100644 > --- a/drivers/net/mlx5/mlx5_flow_tcf.c > +++ b/drivers/net/mlx5/mlx5_flow_tcf.c > @@ -348,6 +348,100 @@ struct mlx5_flow_tcf_context { > uint8_t *buf; /* Message buffer. */ > }; > =20 > +/** > + * Neigh rule structure. The neigh rule is applied via Netlink to > + * outer tunnel iface in order to provide destination MAC address > + * for the VXLAN encapsultion. The neigh rule is implicitly related > + * to the Flow itself and can be shared by multiple Flows. > + */ > +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[IPV6_ADDR_LEN]; > + } ipv6; > + }; > +}; > + > +/** > + * Local rule structure. The local rule is applied via Netlink to > + * outer tunnel iface in order to provide local and peer IP addresses > + * of the VXLAN tunnel for encapsulation. The local rule is implicitly > + * related to the Flow itself and can be shared by multiple Flows. > + */ > +struct tcf_local_rule { > + LIST_ENTRY(tcf_local_rule) next; > + uint32_t refcnt; > + uint16_t mask; > + union { > + struct { > + rte_be32_t dst; > + rte_be32_t src; > + } ipv4; > + struct { > + uint8_t dst[IPV6_ADDR_LEN]; > + uint8_t src[IPV6_ADDR_LEN]; > + } ipv6; > + }; > +}; > + > +/** VXLAN virtual netdev. */ > +struct tcf_vtep { > + LIST_ENTRY(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 flow_tcf_tunnel_hdr { > + uint32_t type; /**< Tunnel action type. */ > + struct tcf_vtep *vtep; /**< Virtual tunnel endpoint device. */ > + unsigned int ifindex_org; /**< Original dst/src interface */ > + unsigned int *ifindex_ptr; /**< Interface ptr in message. */ > +}; > + > +struct flow_tcf_vxlan_decap { > + struct flow_tcf_tunnel_hdr hdr; > + uint16_t udp_port; > +}; > + > +struct flow_tcf_vxlan_encap { > + struct 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[IPV6_ADDR_LEN]; > + uint8_t src[IPV6_ADDR_LEN]; > + } ipv6; > + }; > +struct { > + rte_be16_t src; > + rte_be16_t dst; > + } udp; > + struct { > + uint8_t vni[3]; > + } vxlan; > +}; > + > /** Structure used when extracting the values of a flow counters > * from a netlink message. > */ > @@ -365,6 +459,7 @@ struct flow_tcf_stats_basic { > struct rte_flow_item_ipv6 ipv6; > struct rte_flow_item_tcp tcp; > struct rte_flow_item_udp udp; > + struct rte_flow_item_vxlan vxlan; > } flow_tcf_mask_empty; > =20 > /** Supported masks for known item types. */ > @@ -376,6 +471,7 @@ struct flow_tcf_stats_basic { > struct rte_flow_item_ipv6 ipv6; > struct rte_flow_item_tcp tcp; > struct rte_flow_item_udp udp; > + struct rte_flow_item_vxlan vxlan; > } flow_tcf_mask_supported =3D { > .port_id =3D { > .id =3D 0xffffffff, > @@ -413,6 +509,9 @@ struct flow_tcf_stats_basic { > .src_port =3D RTE_BE16(0xffff), > .dst_port =3D RTE_BE16(0xffff), > }, > + .vxlan =3D { > + .vni =3D "\xff\xff\xff", > + }, > }; > =20 > #define SZ_NLATTR_HDR MNL_ALIGN(sizeof(struct nlattr)) > --=20 > 1.8.3.1 >=20