From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70075.outbound.protection.outlook.com [40.107.7.75]) by dpdk.org (Postfix) with ESMTP id F3DBB2BF7 for ; Wed, 22 Aug 2018 12:12:50 +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=VPRoNtPZHLD2xmZSQ49bscuAt5+IMJoXYv15c6i8Rbk=; b=tIJzxvgGfbQ8WyQYalmmxcdUznBwYqgLzu4oX0WKBe+Asd45UdvWBDL61ITADO/XH1zzkSeU4lo761p2ZXzDj7Hg18YTvmuTbJVRQIcwBKLMqfrkacA3aEFK0A5IOisNlC1Y4OZvHVQjuxuH+sF5u7qeoSIw5UTlr3/Q9yFmPik= Received: from AM4PR05MB3425.eurprd05.prod.outlook.com (10.171.187.142) by AM4PR05MB3473.eurprd05.prod.outlook.com (10.171.187.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1059.23; Wed, 22 Aug 2018 10:12:49 +0000 Received: from AM4PR05MB3425.eurprd05.prod.outlook.com ([fe80::1b3:8c66:2df0:6d90]) by AM4PR05MB3425.eurprd05.prod.outlook.com ([fe80::1b3:8c66:2df0:6d90%2]) with mapi id 15.20.1059.023; Wed, 22 Aug 2018 10:12:49 +0000 From: Ori Kam To: Shahaf Shuler , Yongseok Koh CC: Ori Kam , "dev@dpdk.org" , Dekel Peled , "Xueming(Steven) Li" Thread-Topic: [RFC] net/mlx5: add DV flow support Thread-Index: AdQ59hD1P9jXPNf6QWKZggQGmJN5lQ== Date: Wed, 22 Aug 2018 10:12:49 +0000 Message-ID: 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=orika@mellanox.com; x-originating-ip: [193.47.165.251] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM4PR05MB3473; 6:CIKpnpToX3nv44xup9/UgQ7SVE9HNHcPeoj7QpQv+vIZz6L3Qeb5XidA0DckS17DKFG1P+rX1d/njEF965BnfnnYexuaUuvNekBhvhXbx0gFaGzTghctJfA03iM6QXKQyiE1rbS03AhIlY/zZYb+s3KrI1U8FcRDcpbb/M50NpuiXCv9bSE+JxZ3MFTgkPfyDXSh0lECiUbjd0piqUIP5k8H7G286RjyAT7YXT8LGb9h03JWpLGlNP8OIx6MVP4o+OwY3WRHgQNOZp3ho8F5tfdj6Li4vSIo3vmcL124VJ7d401TCVSwI9vSrUI3DrTHugrrZKvdnJH76h7kzNZZ95oNWwkKjFhdf4EZQ8svPRDSiKIiuQAUx23UyjQS4sfdPxL7WcGkxnrhBFTGACdFcpMxMM7ErTwruHg4wkJ8QyD9BM8eyDsXojhiazrs5v2zzUKNr30iSXtBBLpQvta1Dw==; 5:/NUguXEurwCC93olPjMRmOmgVf5QFD0eEX47/RU6Dr2mLpqBaG4dM4X129z58qzkCNbNjMIZojS6LlT+PGrGX0tKpbtVtPkHR52fXiI5JNZ07J4bktPVxm19gEc0W/9pyBwPBdw/WtLz1VIjsu3BiuC4nCN1Fz92KYtQurXurmg=; 7:QAb0Hx37XfKkn4G3bXAejZOqhN/Rrf0LnyXuS1uL7NLwEi0YPyc/3BuJSZrgdKcIVKIjBFvjjPdMSUwv1ib2yUsOWLP+U8TA0YkIb5cqHVfSIgC1IAhwUG49dMt86PSdOw14Z/ju67Z9psnDU13jx+4EecPf8a9PI0Yv6HBn7UI3oDHH9HRwP3mjwUK45NN5h7j4tbxsT3AxiOf25j1PMSwRwsEkju4N+VfXpv1EAUHcnPE+xl0Zq3pqzCEtn1EZ x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: 7a84cd51-c021-4153-90b6-08d60817d094 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM4PR05MB3473; x-ms-traffictypediagnostic: AM4PR05MB3473: 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)(823301075)(3002001)(10201501046)(3231311)(944501410)(52105095)(93006095)(93001095)(6055026)(149027)(150027)(6041310)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123564045)(201708071742011)(7699016); SRVR:AM4PR05MB3473; BCL:0; PCL:0; RULEID:; SRVR:AM4PR05MB3473; x-forefront-prvs: 0772E5DAD5 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(136003)(346002)(376002)(39860400002)(396003)(199004)(189003)(4326008)(316002)(6636002)(25786009)(54906003)(110136005)(106356001)(105586002)(33656002)(66066001)(97736004)(2906002)(68736007)(86362001)(14454004)(8676002)(8936002)(476003)(7696005)(6436002)(486006)(26005)(81166006)(81156014)(5250100002)(55016002)(9686003)(14444005)(5660300001)(7736002)(3846002)(6116002)(305945005)(2900100001)(478600001)(256004)(107886003)(6506007)(102836004)(99286004)(74316002)(53936002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR05MB3473; H:AM4PR05MB3425.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: 5uY+Tfp7o54nXL38ibaJ2Ul0dK+sKALK6QP0OlBMq4/LdxxLXAG5ZXsnnerc59OUn4bwtyXsgb/vKnD+hFn/bGxwExHcMUvG7LoYGH5l9j/P1xga4WYm63LCG8MIciV2EQWbT8N8Gn9p9dr/J1I5hB6Zqq9vuHTWXjjOGFabp0yZ0GwaMSHr4h5EMgfO8UAj5V0BrQixhUtl6nNFvnqgXvuU4mwnh105GI1kltd3QodlZS88P0TBYgh6BQlMQcGc+SHxnkYBRYDTKwmhSlPqH7MUtUvK6E+lfniD8++vI1DfBCg41To0rkncZobXE3JGReYOpQxV6DtpRq24Gxbj5d0zs2MeIbZB/+X/+kAWcTQ= 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: 7a84cd51-c021-4153-90b6-08d60817d094 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Aug 2018 10:12:49.5000 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR05MB3473 Subject: [dpdk-dev] [RFC] net/mlx5: add DV flow support 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: Wed, 22 Aug 2018 10:12:51 -0000 Currently the flow steering in MLX5 is done using 2 external APIs (drivers) the verbs API to control the NIC flows and TC API to control the ESWITCH fl= ows. Also in the current implementation some functions are called number of times and each time with different job to do. In order to support advance steering option Mellanox exposed a new set of APIs to control NIC flows. Since this new API will be only supported on new kernels or ones that are using OFED there is a need to support 2 different NIC APIs. This RFC address this issue by separating the MLX5 flow engine into shared and dedicated functions for each API (driver). It is also split the functions that have several tasks into functions=20 that implementing only one task. The call to the specific API will be done via function pointers. mlx5_flow.h: ....... struct mlx5_ind_table { LIST_ENTRY next; rte_atomic32_t refcnt; void *ind_table; /* Pointer to the ind table created by the= driver*/ uint32_t queues_n; /* Number of queues in list */ uint16_t queues[]; /* Queue list */ } struct mlx5_hrxq { LIST_ENTERY next; rte_atomic32_t refcnt; struct mlx5_ind_table *ind_table; union { struct mlx5_ibv_qp *qp; } uint64_t hash_fields; /* hash key length in bytes */ uint32_t rss_key_len; /* hash key length in bytes */ uint8_t rss_key[]; /* hash key */ } struct mlx5_flow_verbs { unsigned int size; /* Size of the attr */ struct { struct ibv_flow_attr *attr; uint8_t *specs; } struct ibv_flow *flow; struct mlx5_hrxq *hrxq; /**< Fields that participate in the hash. */ uint64_t hash_fields;=20 } struct mlx5_flow_dv { uint64_t hash_fields; /**< Fields that participate in the hash. */ struct mlx5_hrxq *hrxq; /**< Hash Rx queues. */ /* Flow DV api: */ struct mlx5_flow_matcher *matcher; /**< Cache to matcher. */ size_t size; /**< size of match value. */ uint32_t match_value[MLX5_ST_SZ_DW(fte_match_param)]; /**< Matcher value. */ struct ibv_flow *flow; /**< Installed flow. */ /**< Action list. */ struct mlx5dv_flow_action_attr actions[MLX5_DV_MAX_NUMBER_OF_ACTIO= NS]; int actions_n; /**< number of actions. */ }; /* Holds data for one rule */ struct mlx5_flow { LIST_ENTREY() next; union { struct mlx5_flow_verbs verbs; struct mlx5_flow_dv dv; } } struct rte_flow { TAILQ_ENTERY() next; uint8_t flow_type; /* verbs / tc / dv */ LIST_HEAD(mlx5_flow) flow; struct flow_counter *counter; } typedef int (*validate_t)(struct priv *priv, struct rte_flow_attr *attr, struct rte_flow_item items[= ], struct rte_flow_action acti= ons[], struct rte_flow_error *erro= r); typedef mlx5_flow * (*prepare_t)(struct rte_flow_attr *attr, struct rte_flow_items items= [], struct rte_flow_actions act= ions[], struct rte_flow_error *erro= r); typedef int (*translate_t)(struct priv *priv, struct mlx5= _flow *flow, struct rte_= flow_attr *attr, struct rte_= flow_item *items[], struct rte_= flow_action actions[], struct rte_= flow_error *error); /* insert the rule to the nic */ typedef int (*apply_t)(struct priv *priv, struct mlx5_flow *flow); /* remove the rule from the nic */ typedef int (*remove_t)(struct priv *priv, struct mlx5_flow *flow); /* delete the rule from memory */ typedef int (*delete_t)(struct priv *priv, struct mlx5_flow *flow); struct driver_ops { validate_t validate; prepare_t prepare; translate_t translate; apply_t apply; remove_t remove; delete_t delete; } ....... Signed-off-by: Ori Kam