From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10080.outbound.protection.outlook.com [40.107.1.80]) by dpdk.org (Postfix) with ESMTP id 7345E1B10E for ; Tue, 25 Sep 2018 01:17: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=KQIfoa7sdiYQmsaWUU8ULw6t0rbQp+0iEnPjRIODTdU=; b=iwujc9gSrj4ZiD8kUEaZQi8gZZ/4eB/j6eyPMvDpvjSOHvYz+P+Tw7Oj8+E3xH9Oot1CXaz5S5BL54oIlBkurdBuzV59/S7N4XtjrgRslecPOfdhpiKEGKYR9Cb/TjiwnmhJFJzre2qfLMirQWq5cAiNH2qywEzyOaZyaWShTr4= Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com (52.134.72.27) by DB3PR0502MB3996.eurprd05.prod.outlook.com (52.134.65.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1164.25; Mon, 24 Sep 2018 23:17:49 +0000 Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::1cb0:661b:ecab:6045]) by DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::1cb0:661b:ecab:6045%2]) with mapi id 15.20.1164.017; Mon, 24 Sep 2018 23:17:49 +0000 From: Yongseok Koh To: Thomas Monjalon , Shahaf Shuler CC: "dev@dpdk.org" , Ori Kam Thread-Topic: [PATCH v3 08/11] net/mlx5: add Direct Verbs translate actions Thread-Index: AQHUVFzPycJEA98qvE6JD8Yd0KROCQ== Date: Mon, 24 Sep 2018 23:17:49 +0000 Message-ID: <20180924231721.15799-9-yskoh@mellanox.com> References: <20180919072143.23211-1-yskoh@mellanox.com> <20180924231721.15799-1-yskoh@mellanox.com> In-Reply-To: <20180924231721.15799-1-yskoh@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BN6PR03CA0021.namprd03.prod.outlook.com (2603:10b6:404:23::31) 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; DB3PR0502MB3996; 6:DzoxApaBUuCzJk8ugnIbsLQe/hSWTlsgUxjIj5wn45lFSYH/ReaYTbOryVvkMT/9M6LETi3vWrg3E0h09/p/6ycdTWly1AQjdYRYNU5v94MmnE/gk2m/Usf8z6nhZwooDdtBEL2tZYoQc41YZvjE5ORgSmfeNGvQnU50m2ENuRnqSxpQqga+gMojv4AEDkey7GmBgNVkPt9ozWkYUY3qd7z02Ka8JCEnQfEbtCLDgjnPH1G6Yagu3a2xoQVoVrMFXjPM/+yzkwUbdJzVeo8O1Buu1JUHaR2I6szGDnxJPOQiNcZDbJKiFslhZLYHLNFgMXSo1/AX5Ao+6Qyynp71dyGaWWUTO1URFacoNcbSBFbUEiMhFv0q97hqeq7TNZKIDyvX+QknkUZmGP2d+TK6RIU38EaVA/hUoQio+cqeZyIa7csuUNCZw+Z+c7Nr9JSviJ3CzU2+r4aeYcrn5XC9JQ==; 5:3D79Kc3Tqy52yFQbaQtKG+fiaUuz3w1TFYO61s2igNgDTydczY6WHAi7D+8QC6TvemhIyCZ+64Lj8Y9Ijkjw6YVOptsDKg1CIZynHnWahpm1cEd1+z4ZmdHXIjvdgjv9jKaDfMuwPe2BOpJnpl3W9jcDzYbc9QU3/Xo/i6K1HC4=; 7:tRoz4GC0pGShgFgQj68caIqep7Q2T+GMAj0w81FfJ/QC3Oqqe18d6lPQH1o28dpNmaYvfx0b9+9q3Faa+Qpu8lQbi3Bvi37cin3qSRiLw5vrTpnKSRVwWCHKpP8qCtvpSFSzzHRkuS00frzTvXsL6a0Lo4Kjbi93w7uVQ3qIHbK2oMJ4vFbkOSiZxrvGaeV8KGvSwf1z5ELROduMt1xPjeEDXH10x6TjgNoy8iyGT4LjFegnEoXAL5pLS2TJzd84 x-ms-office365-filtering-correlation-id: 1e2c61fd-36d0-49e2-62dc-08d62273f19a x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534165)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:DB3PR0502MB3996; x-ms-traffictypediagnostic: DB3PR0502MB3996: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr 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)(10201501046)(3002001)(93006095)(93001095)(3231355)(944501410)(52105095)(6055026)(149066)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123560045)(20161123562045)(20161123564045)(201708071742011)(7699051); SRVR:DB3PR0502MB3996; BCL:0; PCL:0; RULEID:; SRVR:DB3PR0502MB3996; x-forefront-prvs: 0805EC9467 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(1496009)(396003)(376002)(346002)(366004)(39860400002)(136003)(199004)(189003)(51234002)(66066001)(2616005)(476003)(446003)(486006)(11346002)(6436002)(305945005)(7736002)(386003)(6506007)(6486002)(6512007)(186003)(102836004)(5250100002)(76176011)(25786009)(26005)(68736007)(6116002)(54906003)(110136005)(99286004)(1076002)(3846002)(71200400001)(52116002)(86362001)(53936002)(71190400001)(97736004)(8936002)(107886003)(256004)(4326008)(316002)(2900100001)(81156014)(8676002)(36756003)(81166006)(105586002)(2906002)(106356001)(6636002)(478600001)(5660300001)(14454004); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0502MB3996; 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: 3GJKSRVCSkuVw/zuT8ZFiboZ54y2TqR4baFSZnthmagyijtHbwV6ff28dUIxWNxLObaLdH2YYVUaPifwfrUD3aQYqAy1xZOrT1UTL08wiKPGz/cyrpy3ppP8tqxRJs4aGsy37kkluULeOHFuyK3LUdeOr/uCRWep6st/fE0PCuUA9A+Mo7xO+8LPbnMYVpy6KudCcSiymN4+rm//snKQ+V9OSaqQ7xs8+Dh1Q7qaWOkMRAnHMg3LHW+n9Gj/CEgURlHWVQtq0FUma2YB9V81+jpJ9TXoXZxgngt6p/KerGNfHhmQYrbPHuZ/u03RbMLd9lTL97IM1XckpRLswOcrN1ahBmD8Vg+5jpjuMhxz/lk= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1e2c61fd-36d0-49e2-62dc-08d62273f19a X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Sep 2018 23:17:49.3732 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0502MB3996 Subject: [dpdk-dev] [PATCH v3 08/11] net/mlx5: add Direct Verbs translate actions 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: Mon, 24 Sep 2018 23:17:50 -0000 From: Ori Kam In this commit we add the translation of flow actions. Unlike the Verbs API actions are separeted from the items and are passed to the API in array structure. Since the target action like RSS require the QP information those actions are handled both in the translate action and in the apply. Signed-off-by: Ori Kam Acked-by: Yongseok Koh --- drivers/net/mlx5/mlx5_flow.h | 7 +++++ drivers/net/mlx5/mlx5_flow_dv.c | 61 +++++++++++++++++++++++++++++++++++++= ++++ 2 files changed, 68 insertions(+) diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index 7f0566fc9..ec860ef4b 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -136,6 +136,8 @@ struct mlx5_flow_dv_match_params { /**< Matcher value. This value is used as the mask or as a key. */ }; =20 +#define MLX5_DV_MAX_NUMBER_OF_ACTIONS 8 + /* Matcher structure. */ struct mlx5_flow_dv_matcher { struct mlx5_cache cache; /**< Cache to struct mlx5dv_flow_matcher. */ @@ -154,6 +156,11 @@ struct mlx5_flow_dv { struct mlx5_flow_dv_match_params value; /**< Holds the value that the packet is compared to. */ struct ibv_flow *flow; /**< Installed flow. */ +#ifdef HAVE_IBV_FLOW_DV_SUPPORT + struct mlx5dv_flow_action_attr actions[MLX5_DV_MAX_NUMBER_OF_ACTIONS]; + /**< Action list. */ +#endif + int actions_n; /**< number of actions. */ }; =20 /* Verbs specification header. */ diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_d= v.c index acb1b7549..916989988 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -942,6 +942,65 @@ flow_dv_create_item(void *matcher, void *key, } } =20 +/** + * Store the requested actions in an array. + * + * @param[in] action + * Flow action to translate. + * @param[in, out] dev_flow + * Pointer to the mlx5_flow. + */ +static void +flow_dv_create_action(const struct rte_flow_action *action, + struct mlx5_flow *dev_flow) +{ + const struct rte_flow_action_queue *queue; + const struct rte_flow_action_rss *rss; + int actions_n =3D dev_flow->dv.actions_n; + struct rte_flow *flow =3D dev_flow->flow; + + switch (action->type) { + case RTE_FLOW_ACTION_TYPE_VOID: + break; + case RTE_FLOW_ACTION_TYPE_FLAG: + dev_flow->dv.actions[actions_n].type =3D MLX5DV_FLOW_ACTION_TAG; + dev_flow->dv.actions[actions_n].tag_value =3D + MLX5_FLOW_MARK_DEFAULT; + actions_n++; + break; + case RTE_FLOW_ACTION_TYPE_MARK: + dev_flow->dv.actions[actions_n].type =3D MLX5DV_FLOW_ACTION_TAG; + dev_flow->dv.actions[actions_n].tag_value =3D + ((const struct rte_flow_action_mark *) + (action->conf))->id; + actions_n++; + break; + case RTE_FLOW_ACTION_TYPE_DROP: + dev_flow->dv.actions[actions_n].type =3D MLX5DV_FLOW_ACTION_DROP; + flow->actions |=3D MLX5_ACTION_DROP; + break; + case RTE_FLOW_ACTION_TYPE_QUEUE: + queue =3D action->conf; + flow->rss.queue_num =3D 1; + (*flow->queue)[0] =3D queue->index; + break; + case RTE_FLOW_ACTION_TYPE_RSS: + rss =3D action->conf; + if (flow->queue) + memcpy((*flow->queue), rss->queue, + rss->queue_num * sizeof(uint16_t)); + flow->rss.queue_num =3D rss->queue_num; + memcpy(flow->key, rss->key, MLX5_RSS_HASH_KEY_LEN); + flow->rss.types =3D rss->types; + flow->rss.level =3D rss->level; + /* Added to array only in apply since we need the QP */ + break; + default: + break; + } + dev_flow->dv.actions_n =3D actions_n; +} + static uint32_t matcher_zero[MLX5_ST_SZ_DW(fte_match_param)] =3D { 0 }; =20 #define HEADER_IS_ZERO(match_criteria, headers) \ @@ -1103,6 +1162,8 @@ flow_dv_translate(struct rte_eth_dev *dev, matcher.egress =3D attr->egress; if (flow_dv_matcher_register(dev, &matcher, dev_flow, error)) return -rte_errno; + for (; actions->type !=3D RTE_FLOW_ACTION_TYPE_END; actions++) + flow_dv_create_action(actions, dev_flow); return 0; } =20 --=20 2.11.0