From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80085.outbound.protection.outlook.com [40.107.8.85]) by dpdk.org (Postfix) with ESMTP id CC0541B10C for ; Fri, 2 Nov 2018 22:08: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=TCqMq9uiifJ9s5f+2glbEnqs+K+0Q0h0/et0CwZ7tbg=; b=iGujhaUZ2YCvIstn92KI0TS5vRaqhHQI0IpXYo8QtcMjrt8ewJhsGgdoX6EhHf5lT8kDgW7+aIQxJocz1PeBGu+sXN52dK456n6boeGnYz9UV2g10Xe9cd3X5NlV3J8T9pEOGsu6k94rJYUz21dKEIRSVMdhYzauocg+9rVsqK8= Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com (52.134.72.27) by DB3PR0502MB4092.eurprd05.prod.outlook.com (52.134.73.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.26; Fri, 2 Nov 2018 21:08: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; Fri, 2 Nov 2018 21:08:23 +0000 From: Yongseok Koh To: Shahaf Shuler CC: "dev@dpdk.org" , Yongseok Koh Thread-Topic: [PATCH 3/3] net/mlx5: remove flags setting from flow preparation Thread-Index: AQHUcvAwmuuwFOzIfkOyDkZ3ZlKn5w== Date: Fri, 2 Nov 2018 21:08:23 +0000 Message-ID: <20181102210801.28370-3-yskoh@mellanox.com> References: <20181102210801.28370-1-yskoh@mellanox.com> In-Reply-To: <20181102210801.28370-1-yskoh@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BYAPR02CA0044.namprd02.prod.outlook.com (2603:10b6:a03:54::21) 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; DB3PR0502MB4092; 6:EXdyJQ5v8njRHn/gKAFAbjgqLpNi2bKZfe1PWZuz3nnuLBw3kquNi+nsfvoPXZ9egXG4bYZKL0N/bv6DfIXZmaGIPvM2JFxlnlWqL0QcHi2GjmQWiwNyfG56AKML4YXTUGDNq+5Gd0uDRSO49eU0VgtUWaVDBi98U+1mRLNnH7YDvQFeX4MM8nGWjx7ZQbsse5esniV+7I8dSaERvesSyKGaC+CXf6LIl4kqQp+5P2IHrpslHg7emR8553gdJnDZRDfhHnGVQrMA58kaOtZyKGKe4SmBTv4Mvk+nrFRU9CW8yVwdtlTWgWNTjNclcJd0Fw9gYNObp6y7irMDceVR+YrH/nR1Xpn2j3CuMLAS39k+Uw6LjNbNcfK2SZSkGZJbmLZijCCMNgPmWjEp8iXetVXrNqhZP9O/jY7LlZxIarGEcNxiEcWkBADwKczxmsqt8+TugV33FoYlpx1RQKdqAw==; 5:niBkilFJNx6cK0cNwa38KkR/fb+0JbjuRslRXdtPQSDELxMRTpxcpr2s+mN1bV+BtsxdE7yaB2MtBMvDMMIJt6A/zY/YnDSnOydPLcmLgrWYq3KSwiRTSf9EI1ti3+U61kKBrRvtIwVDgRX5hNjElD894MAN3g/4Z8FK2Oc4mGY=; 7:h7EM9Eqh/VFiGmnc4cuIZYxWz0GAKU7OyT8YGnyBzjL+SKr1l4Iw/p1Do56D9WGAWvNVP8TUr6Vs8gvc3Q7CiWFzTRzTKTTDqADXW2T1uqjyfSauIV755ckuas+jsP2TLJDnD10iNxUtp3wZwYSiYQ== x-ms-office365-filtering-correlation-id: 87061962-37b3-42be-3079-08d641075298 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:DB3PR0502MB4092; x-ms-traffictypediagnostic: DB3PR0502MB4092: 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)(5005006)(8121501046)(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:DB3PR0502MB4092; BCL:0; PCL:0; RULEID:; SRVR:DB3PR0502MB4092; x-forefront-prvs: 08444C7C87 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(396003)(39860400002)(376002)(136003)(346002)(199004)(189003)(51234002)(36756003)(102836004)(26005)(6506007)(6486002)(386003)(53946003)(52116002)(4326008)(76176011)(1076002)(6116002)(3846002)(4744004)(86362001)(2900100001)(68736007)(105586002)(106356001)(99286004)(6862004)(2906002)(446003)(6636002)(81156014)(186003)(81166006)(486006)(66066001)(11346002)(25786009)(14444005)(256004)(2616005)(8676002)(478600001)(71200400001)(71190400001)(8936002)(97736004)(316002)(37006003)(6436002)(107886003)(14454004)(53936002)(7736002)(305945005)(476003)(54906003)(5660300001)(6512007)(579004); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0502MB4092; 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: Zd7D+9HHKWaSfYev1AP58J7eF+eT+qtQ2YCCz3+5VheT3GF+GGRf7iiP7JLceM4rvSIeOWQ8yw0dem5N4VcIAZ/TK8ZkunJfjJm+DlW6VNsgMnRUdU7u+mpt6iD03HrOqvygrgXtc0KRFZe8sZMf+fCgRMfNMtBV8T0YSHBtCipQUtEDerp3kAmyWcena4INRKEcWzODmviRMJviN9DLC+t9LoLrTJkX3QU5F9To2zfApiKG7EQLI31kC6zrTBBQmC3zFzUhpK0a4aJCEnQN9S+hX4yytF1/R17fi2RgyjDogqPi7boO0mgv3x+fEBL+QFLF8dGco/QW5tGHzwh0UGL9Xcg4OW6X7uOB3p3OCuU= 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: 87061962-37b3-42be-3079-08d641075298 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Nov 2018 21:08:23.1660 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0502MB4092 Subject: [dpdk-dev] [PATCH 3/3] net/mlx5: remove flags setting from flow preparation 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: Fri, 02 Nov 2018 21:08:25 -0000 Even though flow_drv_prepare() takes item_flags and action_flags to be filled in, those are not used and will be overwritten by parsing of flow_drv_translate(). There's no reason to keep the flags and fill it. Appropriate notes are added to the documentation of flow_drv_prepare() and flow_drv_translate(). Signed-off-by: Yongseok Koh --- drivers/net/mlx5/mlx5_flow.c | 38 ++++++++++++-------------- drivers/net/mlx5/mlx5_flow.h | 3 +-- drivers/net/mlx5/mlx5_flow_dv.c | 6 ----- drivers/net/mlx5/mlx5_flow_tcf.c | 55 +++++-----------------------------= ---- drivers/net/mlx5/mlx5_flow_verbs.c | 52 +++-------------------------------= - 5 files changed, 29 insertions(+), 125 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 107a4f02f8..fae3bc92dd 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -1657,8 +1657,6 @@ static struct mlx5_flow * flow_null_prepare(const struct rte_flow_attr *attr __rte_unused, const struct rte_flow_item items[] __rte_unused, const struct rte_flow_action actions[] __rte_unused, - uint64_t *item_flags __rte_unused, - uint64_t *action_flags __rte_unused, struct rte_flow_error *error __rte_unused) { rte_errno =3D ENOTSUP; @@ -1786,16 +1784,19 @@ flow_drv_validate(struct rte_eth_dev *dev, * calculates the size of memory required for device flow, allocates the m= emory, * initializes the device flow and returns the pointer. * + * @note + * This function initializes device flow structure such as dv, tcf or ve= rbs in + * struct mlx5_flow. However, it is callee's responsibility to initializ= e the + * rest. For example, adding returning device flow to flow->dev_flow lis= t and + * setting backward reference to the flow should be done out of this fun= ction. + * layers field is not filled either. + * * @param[in] attr * Pointer to the flow attributes. * @param[in] items * Pointer to the list of items. * @param[in] actions * Pointer to the list of actions. - * @param[out] item_flags - * Pointer to bit mask of all items detected. - * @param[out] action_flags - * Pointer to bit mask of all actions detected. * @param[out] error * Pointer to the error structure. * @@ -1803,12 +1804,10 @@ flow_drv_validate(struct rte_eth_dev *dev, * Pointer to device flow on success, otherwise NULL and rte_ernno is se= t. */ static inline struct mlx5_flow * -flow_drv_prepare(struct rte_flow *flow, +flow_drv_prepare(const struct rte_flow *flow, const struct rte_flow_attr *attr, const struct rte_flow_item items[], const struct rte_flow_action actions[], - uint64_t *item_flags, - uint64_t *action_flags, struct rte_flow_error *error) { const struct mlx5_flow_driver_ops *fops; @@ -1816,8 +1815,7 @@ flow_drv_prepare(struct rte_flow *flow, =20 assert(type > MLX5_FLOW_TYPE_MIN && type < MLX5_FLOW_TYPE_MAX); fops =3D flow_get_drv_ops(type); - return fops->prepare(attr, items, actions, item_flags, action_flags, - error); + return fops->prepare(attr, items, actions, error); } =20 /** @@ -1826,6 +1824,12 @@ flow_drv_prepare(struct rte_flow *flow, * translates a generic flow into a driver flow. flow_drv_prepare() must * precede. * + * @note + * dev_flow->layers could be filled as a result of parsing during transl= ation + * if needed by flow_drv_apply(). dev_flow->flow->actions can also be fi= lled + * if necessary. As a flow can have multiple dev_flows by RSS flow expan= sion, + * flow->actions could be overwritten even though all the expanded dev_f= lows + * have the same actions. * * @param[in] dev * Pointer to the rte dev structure. @@ -1889,7 +1893,7 @@ flow_drv_apply(struct rte_eth_dev *dev, struct rte_fl= ow *flow, * Flow driver remove API. This abstracts calling driver specific function= s. * Parent flow (rte_flow) should have driver type (drv_type). It removes a= flow * on device. All the resources of the flow should be freed by calling - * flow_dv_destroy(). + * flow_drv_destroy(). * * @param[in] dev * Pointer to Ethernet device. @@ -2020,8 +2024,6 @@ flow_list_create(struct rte_eth_dev *dev, struct mlx5= _flows *list, { struct rte_flow *flow =3D NULL; struct mlx5_flow *dev_flow; - uint64_t action_flags =3D 0; - uint64_t item_flags =3D 0; const struct rte_flow_action_rss *rss; union { struct rte_flow_expand_rss buf; @@ -2064,16 +2066,10 @@ flow_list_create(struct rte_eth_dev *dev, struct ml= x5_flows *list, } for (i =3D 0; i < buf->entries; ++i) { dev_flow =3D flow_drv_prepare(flow, attr, buf->entry[i].pattern, - actions, &item_flags, &action_flags, - error); + actions, error); if (!dev_flow) goto error; dev_flow->flow =3D flow; - dev_flow->layers =3D item_flags; - /* Store actions once as expanded flows have same actions. */ - if (i =3D=3D 0) - flow->actions =3D action_flags; - assert(flow->actions =3D=3D action_flags); LIST_INSERT_HEAD(&flow->dev_flows, dev_flow, next); ret =3D flow_drv_translate(dev, dev_flow, attr, buf->entry[i].pattern, diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index fadde552c2..f976bff427 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -293,8 +293,7 @@ typedef int (*mlx5_flow_validate_t)(struct rte_eth_dev = *dev, struct rte_flow_error *error); typedef struct mlx5_flow *(*mlx5_flow_prepare_t) (const struct rte_flow_attr *attr, const struct rte_flow_item items[], - const struct rte_flow_action actions[], uint64_t *item_flags, - uint64_t *action_flags, struct rte_flow_error *error); + const struct rte_flow_action actions[], struct rte_flow_error *error); typedef int (*mlx5_flow_translate_t)(struct rte_eth_dev *dev, struct mlx5_flow *dev_flow, const struct rte_flow_attr *attr, diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_d= v.c index 44e2a920eb..0fb791eafa 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -1014,10 +1014,6 @@ flow_dv_validate(struct rte_eth_dev *dev, const stru= ct rte_flow_attr *attr, * Pointer to the list of items. * @param[in] actions * Pointer to the list of actions. - * @param[out] item_flags - * Pointer to bit mask of all items detected. - * @param[out] action_flags - * Pointer to bit mask of all actions detected. * @param[out] error * Pointer to the error structure. * @@ -1029,8 +1025,6 @@ static struct mlx5_flow * flow_dv_prepare(const struct rte_flow_attr *attr __rte_unused, const struct rte_flow_item items[] __rte_unused, const struct rte_flow_action actions[] __rte_unused, - uint64_t *item_flags __rte_unused, - uint64_t *action_flags __rte_unused, struct rte_flow_error *error) { uint32_t size =3D sizeof(struct mlx5_flow); diff --git a/drivers/net/mlx5/mlx5_flow_tcf.c b/drivers/net/mlx5/mlx5_flow_= tcf.c index 719fb10632..483e490843 100644 --- a/drivers/net/mlx5/mlx5_flow_tcf.c +++ b/drivers/net/mlx5/mlx5_flow_tcf.c @@ -664,20 +664,15 @@ flow_tcf_create_pedit_mnl_msg(struct nlmsghdr *nl, * * @param[in,out] actions * actions specification. - * @param[in,out] action_flags - * actions flags - * @param[in,out] size - * accumulated size + * * @return * Max memory size of one TC-pedit action */ static int -flow_tcf_get_pedit_actions_size(const struct rte_flow_action **actions, - uint64_t *action_flags) +flow_tcf_get_pedit_actions_size(const struct rte_flow_action **actions) { int pedit_size =3D 0; int keys =3D 0; - uint64_t flags =3D 0; =20 pedit_size +=3D SZ_NLATTR_NEST + /* na_act_index. */ SZ_NLATTR_STRZ_OF("pedit") + @@ -686,45 +681,35 @@ flow_tcf_get_pedit_actions_size(const struct rte_flow= _action **actions, switch ((*actions)->type) { case RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC: keys +=3D NUM_OF_PEDIT_KEYS(IPV4_ADDR_LEN); - flags |=3D MLX5_FLOW_ACTION_SET_IPV4_SRC; break; case RTE_FLOW_ACTION_TYPE_SET_IPV4_DST: keys +=3D NUM_OF_PEDIT_KEYS(IPV4_ADDR_LEN); - flags |=3D MLX5_FLOW_ACTION_SET_IPV4_DST; break; case RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC: keys +=3D NUM_OF_PEDIT_KEYS(IPV6_ADDR_LEN); - flags |=3D MLX5_FLOW_ACTION_SET_IPV6_SRC; break; case RTE_FLOW_ACTION_TYPE_SET_IPV6_DST: keys +=3D NUM_OF_PEDIT_KEYS(IPV6_ADDR_LEN); - flags |=3D MLX5_FLOW_ACTION_SET_IPV6_DST; break; case RTE_FLOW_ACTION_TYPE_SET_TP_SRC: /* TCP is as same as UDP */ keys +=3D NUM_OF_PEDIT_KEYS(TP_PORT_LEN); - flags |=3D MLX5_FLOW_ACTION_SET_TP_SRC; break; case RTE_FLOW_ACTION_TYPE_SET_TP_DST: /* TCP is as same as UDP */ keys +=3D NUM_OF_PEDIT_KEYS(TP_PORT_LEN); - flags |=3D MLX5_FLOW_ACTION_SET_TP_DST; break; case RTE_FLOW_ACTION_TYPE_SET_TTL: keys +=3D NUM_OF_PEDIT_KEYS(TTL_LEN); - flags |=3D MLX5_FLOW_ACTION_SET_TTL; break; case RTE_FLOW_ACTION_TYPE_DEC_TTL: keys +=3D NUM_OF_PEDIT_KEYS(TTL_LEN); - flags |=3D MLX5_FLOW_ACTION_DEC_TTL; break; case RTE_FLOW_ACTION_TYPE_SET_MAC_SRC: keys +=3D NUM_OF_PEDIT_KEYS(ETHER_ADDR_LEN); - flags |=3D MLX5_FLOW_ACTION_SET_MAC_SRC; break; case RTE_FLOW_ACTION_TYPE_SET_MAC_DST: keys +=3D NUM_OF_PEDIT_KEYS(ETHER_ADDR_LEN); - flags |=3D MLX5_FLOW_ACTION_SET_MAC_DST; break; default: goto get_pedit_action_size_done; @@ -740,7 +725,6 @@ flow_tcf_get_pedit_actions_size(const struct rte_flow_a= ction **actions, /* TCA_PEDIT_KEY_EX + HTYPE + CMD */ (SZ_NLATTR_NEST + SZ_NLATTR_DATA_OF(2) + SZ_NLATTR_DATA_OF(2)); - (*action_flags) |=3D flags; (*actions)--; return pedit_size; } @@ -1415,11 +1399,9 @@ flow_tcf_validate(struct rte_eth_dev *dev, */ static int flow_tcf_get_items_and_size(const struct rte_flow_attr *attr, - const struct rte_flow_item items[], - uint64_t *item_flags) + const struct rte_flow_item items[]) { int size =3D 0; - uint64_t flags =3D 0; =20 size +=3D SZ_NLATTR_STRZ_OF("flower") + SZ_NLATTR_NEST + /* TCA_OPTIONS. */ @@ -1436,7 +1418,6 @@ flow_tcf_get_items_and_size(const struct rte_flow_att= r *attr, size +=3D SZ_NLATTR_TYPE_OF(uint16_t) + /* Ether type. */ SZ_NLATTR_DATA_OF(ETHER_ADDR_LEN) * 4; /* dst/src MAC addr and mask. */ - flags |=3D MLX5_FLOW_LAYER_OUTER_L2; break; case RTE_FLOW_ITEM_TYPE_VLAN: size +=3D SZ_NLATTR_TYPE_OF(uint16_t) + /* Ether type. */ @@ -1444,33 +1425,28 @@ flow_tcf_get_items_and_size(const struct rte_flow_a= ttr *attr, /* VLAN Ether type. */ SZ_NLATTR_TYPE_OF(uint8_t) + /* VLAN prio. */ SZ_NLATTR_TYPE_OF(uint16_t); /* VLAN ID. */ - flags |=3D MLX5_FLOW_LAYER_OUTER_VLAN; break; case RTE_FLOW_ITEM_TYPE_IPV4: size +=3D SZ_NLATTR_TYPE_OF(uint16_t) + /* Ether type. */ SZ_NLATTR_TYPE_OF(uint8_t) + /* IP proto. */ SZ_NLATTR_TYPE_OF(uint32_t) * 4; /* dst/src IP addr and mask. */ - flags |=3D MLX5_FLOW_LAYER_OUTER_L3_IPV4; break; case RTE_FLOW_ITEM_TYPE_IPV6: size +=3D SZ_NLATTR_TYPE_OF(uint16_t) + /* Ether type. */ SZ_NLATTR_TYPE_OF(uint8_t) + /* IP proto. */ SZ_NLATTR_TYPE_OF(IPV6_ADDR_LEN) * 4; /* dst/src IP addr and mask. */ - flags |=3D MLX5_FLOW_LAYER_OUTER_L3_IPV6; break; case RTE_FLOW_ITEM_TYPE_UDP: size +=3D SZ_NLATTR_TYPE_OF(uint8_t) + /* IP proto. */ SZ_NLATTR_TYPE_OF(uint16_t) * 4; /* dst/src port and mask. */ - flags |=3D MLX5_FLOW_LAYER_OUTER_L4_UDP; break; case RTE_FLOW_ITEM_TYPE_TCP: size +=3D SZ_NLATTR_TYPE_OF(uint8_t) + /* IP proto. */ SZ_NLATTR_TYPE_OF(uint16_t) * 4; /* dst/src port and mask. */ - flags |=3D MLX5_FLOW_LAYER_OUTER_L4_TCP; break; default: DRV_LOG(WARNING, @@ -1480,7 +1456,6 @@ flow_tcf_get_items_and_size(const struct rte_flow_att= r *attr, break; } } - *item_flags =3D flags; return size; } =20 @@ -1497,11 +1472,9 @@ flow_tcf_get_items_and_size(const struct rte_flow_at= tr *attr, * Maximum size of memory for actions. */ static int -flow_tcf_get_actions_and_size(const struct rte_flow_action actions[], - uint64_t *action_flags) +flow_tcf_get_actions_and_size(const struct rte_flow_action actions[]) { int size =3D 0; - uint64_t flags =3D 0; =20 size +=3D SZ_NLATTR_NEST; /* TCA_FLOWER_ACT. */ for (; actions->type !=3D RTE_FLOW_ACTION_TYPE_END; actions++) { @@ -1513,35 +1486,28 @@ flow_tcf_get_actions_and_size(const struct rte_flow= _action actions[], SZ_NLATTR_STRZ_OF("mirred") + SZ_NLATTR_NEST + /* TCA_ACT_OPTIONS. */ SZ_NLATTR_TYPE_OF(struct tc_mirred); - flags |=3D MLX5_FLOW_ACTION_PORT_ID; break; case RTE_FLOW_ACTION_TYPE_JUMP: size +=3D SZ_NLATTR_NEST + /* na_act_index. */ SZ_NLATTR_STRZ_OF("gact") + SZ_NLATTR_NEST + /* TCA_ACT_OPTIONS. */ SZ_NLATTR_TYPE_OF(struct tc_gact); - flags |=3D MLX5_FLOW_ACTION_JUMP; break; case RTE_FLOW_ACTION_TYPE_DROP: size +=3D SZ_NLATTR_NEST + /* na_act_index. */ SZ_NLATTR_STRZ_OF("gact") + SZ_NLATTR_NEST + /* TCA_ACT_OPTIONS. */ SZ_NLATTR_TYPE_OF(struct tc_gact); - flags |=3D MLX5_FLOW_ACTION_DROP; break; case RTE_FLOW_ACTION_TYPE_COUNT: break; case RTE_FLOW_ACTION_TYPE_OF_POP_VLAN: - flags |=3D MLX5_FLOW_ACTION_OF_POP_VLAN; goto action_of_vlan; case RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN: - flags |=3D MLX5_FLOW_ACTION_OF_PUSH_VLAN; goto action_of_vlan; case RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID: - flags |=3D MLX5_FLOW_ACTION_OF_SET_VLAN_VID; goto action_of_vlan; case RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_PCP: - flags |=3D MLX5_FLOW_ACTION_OF_SET_VLAN_PCP; goto action_of_vlan; action_of_vlan: size +=3D SZ_NLATTR_NEST + /* na_act_index. */ @@ -1563,8 +1529,7 @@ flow_tcf_get_actions_and_size(const struct rte_flow_a= ction actions[], case RTE_FLOW_ACTION_TYPE_DEC_TTL: case RTE_FLOW_ACTION_TYPE_SET_MAC_SRC: case RTE_FLOW_ACTION_TYPE_SET_MAC_DST: - size +=3D flow_tcf_get_pedit_actions_size(&actions, - &flags); + size +=3D flow_tcf_get_pedit_actions_size(&actions); break; default: DRV_LOG(WARNING, @@ -1574,7 +1539,6 @@ flow_tcf_get_actions_and_size(const struct rte_flow_a= ction actions[], break; } } - *action_flags =3D flags; return size; } =20 @@ -1610,10 +1574,6 @@ flow_tcf_nl_brand(struct nlmsghdr *nlh, uint32_t han= dle) * Pointer to the list of items. * @param[in] actions * Pointer to the list of actions. - * @param[out] item_flags - * Pointer to bit mask of all items detected. - * @param[out] action_flags - * Pointer to bit mask of all actions detected. * @param[out] error * Pointer to the error structure. * @@ -1625,7 +1585,6 @@ static struct mlx5_flow * flow_tcf_prepare(const struct rte_flow_attr *attr, const struct rte_flow_item items[], const struct rte_flow_action actions[], - uint64_t *item_flags, uint64_t *action_flags, struct rte_flow_error *error) { size_t size =3D sizeof(struct mlx5_flow) + @@ -1635,8 +1594,8 @@ flow_tcf_prepare(const struct rte_flow_attr *attr, struct nlmsghdr *nlh; struct tcmsg *tcm; =20 - size +=3D flow_tcf_get_items_and_size(attr, items, item_flags); - size +=3D flow_tcf_get_actions_and_size(actions, action_flags); + size +=3D flow_tcf_get_items_and_size(attr, items); + size +=3D flow_tcf_get_actions_and_size(actions); dev_flow =3D rte_zmalloc(__func__, size, MNL_ALIGNTO); if (!dev_flow) { rte_flow_error_set(error, ENOMEM, diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flo= w_verbs.c index ab58c04db5..453c89e347 100644 --- a/drivers/net/mlx5/mlx5_flow_verbs.c +++ b/drivers/net/mlx5/mlx5_flow_verbs.c @@ -1217,11 +1217,9 @@ flow_verbs_validate(struct rte_eth_dev *dev, * The size of the memory needed for all actions. */ static int -flow_verbs_get_actions_and_size(const struct rte_flow_action actions[], - uint64_t *action_flags) +flow_verbs_get_actions_and_size(const struct rte_flow_action actions[]) { int size =3D 0; - uint64_t detected_actions =3D 0; =20 for (; actions->type !=3D RTE_FLOW_ACTION_TYPE_END; actions++) { switch (actions->type) { @@ -1229,34 +1227,27 @@ flow_verbs_get_actions_and_size(const struct rte_fl= ow_action actions[], break; case RTE_FLOW_ACTION_TYPE_FLAG: size +=3D sizeof(struct ibv_flow_spec_action_tag); - detected_actions |=3D MLX5_FLOW_ACTION_FLAG; break; case RTE_FLOW_ACTION_TYPE_MARK: size +=3D sizeof(struct ibv_flow_spec_action_tag); - detected_actions |=3D MLX5_FLOW_ACTION_MARK; break; case RTE_FLOW_ACTION_TYPE_DROP: size +=3D sizeof(struct ibv_flow_spec_action_drop); - detected_actions |=3D MLX5_FLOW_ACTION_DROP; break; case RTE_FLOW_ACTION_TYPE_QUEUE: - detected_actions |=3D MLX5_FLOW_ACTION_QUEUE; break; case RTE_FLOW_ACTION_TYPE_RSS: - detected_actions |=3D MLX5_FLOW_ACTION_RSS; break; case RTE_FLOW_ACTION_TYPE_COUNT: #if defined(HAVE_IBV_DEVICE_COUNTERS_SET_V42) || \ defined(HAVE_IBV_DEVICE_COUNTERS_SET_V45) size +=3D sizeof(struct ibv_flow_spec_counter_action); #endif - detected_actions |=3D MLX5_FLOW_ACTION_COUNT; break; default: break; } } - *action_flags =3D detected_actions; return size; } =20 @@ -1274,83 +1265,54 @@ flow_verbs_get_actions_and_size(const struct rte_fl= ow_action actions[], * The size of the memory needed for all items. */ static int -flow_verbs_get_items_and_size(const struct rte_flow_item items[], - uint64_t *item_flags) +flow_verbs_get_items_and_size(const struct rte_flow_item items[]) { int size =3D 0; - uint64_t detected_items =3D 0; =20 for (; items->type !=3D RTE_FLOW_ITEM_TYPE_END; items++) { - int tunnel =3D !!(detected_items & MLX5_FLOW_LAYER_TUNNEL); - switch (items->type) { case RTE_FLOW_ITEM_TYPE_VOID: break; case RTE_FLOW_ITEM_TYPE_ETH: size +=3D sizeof(struct ibv_flow_spec_eth); - detected_items |=3D tunnel ? MLX5_FLOW_LAYER_INNER_L2 : - MLX5_FLOW_LAYER_OUTER_L2; break; case RTE_FLOW_ITEM_TYPE_VLAN: size +=3D sizeof(struct ibv_flow_spec_eth); - detected_items |=3D - tunnel ? (MLX5_FLOW_LAYER_INNER_L2 | - MLX5_FLOW_LAYER_INNER_VLAN) : - (MLX5_FLOW_LAYER_OUTER_L2 | - MLX5_FLOW_LAYER_OUTER_VLAN); break; case RTE_FLOW_ITEM_TYPE_IPV4: size +=3D sizeof(struct ibv_flow_spec_ipv4_ext); - detected_items |=3D tunnel ? - MLX5_FLOW_LAYER_INNER_L3_IPV4 : - MLX5_FLOW_LAYER_OUTER_L3_IPV4; break; case RTE_FLOW_ITEM_TYPE_IPV6: size +=3D sizeof(struct ibv_flow_spec_ipv6); - detected_items |=3D tunnel ? - MLX5_FLOW_LAYER_INNER_L3_IPV6 : - MLX5_FLOW_LAYER_OUTER_L3_IPV6; break; case RTE_FLOW_ITEM_TYPE_UDP: size +=3D sizeof(struct ibv_flow_spec_tcp_udp); - detected_items |=3D tunnel ? - MLX5_FLOW_LAYER_INNER_L4_UDP : - MLX5_FLOW_LAYER_OUTER_L4_UDP; break; case RTE_FLOW_ITEM_TYPE_TCP: size +=3D sizeof(struct ibv_flow_spec_tcp_udp); - detected_items |=3D tunnel ? - MLX5_FLOW_LAYER_INNER_L4_TCP : - MLX5_FLOW_LAYER_OUTER_L4_TCP; break; case RTE_FLOW_ITEM_TYPE_VXLAN: size +=3D sizeof(struct ibv_flow_spec_tunnel); - detected_items |=3D MLX5_FLOW_LAYER_VXLAN; break; case RTE_FLOW_ITEM_TYPE_VXLAN_GPE: size +=3D sizeof(struct ibv_flow_spec_tunnel); - detected_items |=3D MLX5_FLOW_LAYER_VXLAN_GPE; break; #ifdef HAVE_IBV_DEVICE_MPLS_SUPPORT case RTE_FLOW_ITEM_TYPE_GRE: size +=3D sizeof(struct ibv_flow_spec_gre); - detected_items |=3D MLX5_FLOW_LAYER_GRE; break; case RTE_FLOW_ITEM_TYPE_MPLS: size +=3D sizeof(struct ibv_flow_spec_mpls); - detected_items |=3D MLX5_FLOW_LAYER_MPLS; break; #else case RTE_FLOW_ITEM_TYPE_GRE: size +=3D sizeof(struct ibv_flow_spec_tunnel); - detected_items |=3D MLX5_FLOW_LAYER_TUNNEL; break; #endif default: break; } } - *item_flags =3D detected_items; return size; } =20 @@ -1365,10 +1327,6 @@ flow_verbs_get_items_and_size(const struct rte_flow_= item items[], * Pointer to the list of items. * @param[in] actions * Pointer to the list of actions. - * @param[out] item_flags - * Pointer to bit mask of all items detected. - * @param[out] action_flags - * Pointer to bit mask of all actions detected. * @param[out] error * Pointer to the error structure. * @@ -1380,15 +1338,13 @@ static struct mlx5_flow * flow_verbs_prepare(const struct rte_flow_attr *attr __rte_unused, const struct rte_flow_item items[], const struct rte_flow_action actions[], - uint64_t *item_flags, - uint64_t *action_flags, struct rte_flow_error *error) { uint32_t size =3D sizeof(struct mlx5_flow) + sizeof(struct ibv_flow_attr)= ; struct mlx5_flow *flow; =20 - size +=3D flow_verbs_get_actions_and_size(actions, action_flags); - size +=3D flow_verbs_get_items_and_size(items, item_flags); + size +=3D flow_verbs_get_actions_and_size(actions); + size +=3D flow_verbs_get_items_and_size(items); flow =3D rte_calloc(__func__, 1, size, 0); if (!flow) { rte_flow_error_set(error, ENOMEM, --=20 2.11.0