From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id C6B85A0583; Fri, 20 Mar 2020 17:48:32 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 72ABCF90; Fri, 20 Mar 2020 17:48:32 +0100 (CET) Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by dpdk.org (Postfix) with ESMTP id 1738B3B5 for ; Fri, 20 Mar 2020 17:48:29 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584722909; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=oGETbJgk5DlYy9kNDCb5WiZgU7LQ7oURDZZX3mPOdRM=; b=BC//rgW98h3Aal1mmSR5qzxw3pHOAHcz7k74SgKKXDFNi0JF0N7OyMRFRc/R6nMNLOxE2x F0iKpZnqA58gBwxHyXVzLxgHzM1nFx+3skEpTmx8uWJ01aVqlEhc7/uBe8O1f42nQdq2Ap spEYB1S1BD/6OM1US5Yby3sogeeRzbs= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-404-V0WY6Ng5N_G3M_HT0iio9Q-1; Fri, 20 Mar 2020 12:48:27 -0400 X-MC-Unique: V0WY6Ng5N_G3M_HT0iio9Q-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BACCB18FE860; Fri, 20 Mar 2020 16:48:26 +0000 (UTC) Received: from rh.redhat.com (unknown [10.33.36.202]) by smtp.corp.redhat.com (Postfix) with ESMTP id B17B11001925; Fri, 20 Mar 2020 16:48:25 +0000 (UTC) From: Kevin Traynor To: dev@dpdk.org, rasland@mellanox.com Cc: Kevin Traynor Date: Fri, 20 Mar 2020 16:47:42 +0000 Message-Id: <20200320164742.14721-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [dpdk-dev] [PATCH] net/mlx5: fix gcc 10 enum-conversion warning 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" gcc 10.0.1 reports warnings when using mlx5_rte_flow enums with rte_flow type enums. For example: ../drivers/net/mlx5/mlx5_flow.c: In function =E2=80=98flow_hairpin_split=E2= =80=99: ../drivers/net/mlx5/mlx5_flow.c:3406:19: warning: implicit conversion from =E2=80=98enum mlx5_rte_flow_action_type= =E2=80=99 to =E2=80=98enum rte_flow_action_type=E2=80=99 [-Wenum-conversion= ] 3406 | tag_action->type =3D MLX5_RTE_FLOW_ACTION_TYPE_TAG; | ^ ../drivers/net/mlx5/mlx5_flow.c:3419:13: warning: implicit conversion from =E2=80=98enum mlx5_rte_flow_item_type=E2= =80=99 to =E2=80=98enum rte_flow_item_type=E2=80=99 [-Wenum-conversion] 3419 | item->type =3D MLX5_RTE_FLOW_ITEM_TYPE_TAG; | ^ Fix by casting to the correct enum. Signed-off-by: Kevin Traynor --- drivers/net/mlx5/mlx5_flow.c | 46 ++++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 41072da6d..c1b87a3ed 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -3002,5 +3002,6 @@ flow_mreg_add_copy_action(struct rte_eth_dev *dev, ui= nt32_t mark_id, =09if (mark_id !=3D MLX5_DEFAULT_COPY_ID) { =09=09items[0] =3D (struct rte_flow_item){ -=09=09=09.type =3D MLX5_RTE_FLOW_ITEM_TYPE_TAG, +=09=09=09.type =3D (enum rte_flow_item_type) +=09=09=09=09MLX5_RTE_FLOW_ITEM_TYPE_TAG, =09=09=09.spec =3D &tag_spec, =09=09}; @@ -3009,9 +3010,11 @@ flow_mreg_add_copy_action(struct rte_eth_dev *dev, u= int32_t mark_id, =09=09}; =09=09actions[0] =3D (struct rte_flow_action){ -=09=09=09.type =3D MLX5_RTE_FLOW_ACTION_TYPE_MARK, +=09=09=09.type =3D (enum rte_flow_action_type) +=09=09=09=09MLX5_RTE_FLOW_ACTION_TYPE_MARK, =09=09=09.conf =3D &ftag, =09=09}; =09=09actions[1] =3D (struct rte_flow_action){ -=09=09=09.type =3D MLX5_RTE_FLOW_ACTION_TYPE_COPY_MREG, +=09=09=09.type =3D (enum rte_flow_action_type) +=09=09=09=09MLX5_RTE_FLOW_ACTION_TYPE_COPY_MREG, =09=09=09.conf =3D &cp_mreg, =09=09}; @@ -3030,5 +3033,6 @@ flow_mreg_add_copy_action(struct rte_eth_dev *dev, ui= nt32_t mark_id, =09=09}; =09=09actions[0] =3D (struct rte_flow_action){ -=09=09=09.type =3D MLX5_RTE_FLOW_ACTION_TYPE_COPY_MREG, +=09=09=09.type =3D (enum rte_flow_action_type) +=09=09=09=09MLX5_RTE_FLOW_ACTION_TYPE_COPY_MREG, =09=09=09.conf =3D &cp_mreg, =09=09}; @@ -3404,5 +3408,6 @@ flow_hairpin_split(struct rte_eth_dev *dev, =09/* Add set meta action and end action for the Rx flow. */ =09tag_action =3D actions_rx; -=09tag_action->type =3D MLX5_RTE_FLOW_ACTION_TYPE_TAG; +=09tag_action->type =3D (enum rte_flow_action_type) +=09=09=09 MLX5_RTE_FLOW_ACTION_TYPE_TAG; =09actions_rx++; =09rte_memcpy(actions_rx, actions, sizeof(struct rte_flow_action)); @@ -3417,5 +3422,6 @@ flow_hairpin_split(struct rte_eth_dev *dev, =09addr =3D (void *)&pattern_tx[2]; =09item =3D pattern_tx; -=09item->type =3D MLX5_RTE_FLOW_ITEM_TYPE_TAG; +=09item->type =3D (enum rte_flow_item_type) +=09=09 MLX5_RTE_FLOW_ITEM_TYPE_TAG; =09tag_item =3D (void *)addr; =09tag_item->data =3D *flow_id; @@ -3549,5 +3555,6 @@ flow_meter_split_prep(struct rte_eth_dev *dev, =09=09=09/* Add the extra tag action first. */ =09=09=09tag_action =3D actions_pre; -=09=09=09tag_action->type =3D MLX5_RTE_FLOW_ACTION_TYPE_TAG; +=09=09=09tag_action->type =3D (enum rte_flow_action_type) +=09=09=09=09=09 MLX5_RTE_FLOW_ACTION_TYPE_TAG; =09=09=09actions_pre++; =09=09=09action_cur =3D &actions_pre; @@ -3610,5 +3617,6 @@ flow_meter_split_prep(struct rte_eth_dev *dev, =09=09=09=09 * for vlan push and set vid. =09=09=09=09 */ -=09=09=09=09sfx_items->type =3D MLX5_RTE_FLOW_ITEM_TYPE_VLAN; +=09=09=09=09sfx_items->type =3D (enum rte_flow_item_type) +=09=09=09=09=09=09 MLX5_RTE_FLOW_ITEM_TYPE_VLAN; =09=09=09=09sfx_items++; =09=09=09} @@ -3625,5 +3633,6 @@ flow_meter_split_prep(struct rte_eth_dev *dev, =09tag_mask =3D tag_spec + 1; =09tag_mask->data =3D 0xffffff00; -=09tag_item->type =3D MLX5_RTE_FLOW_ITEM_TYPE_TAG; +=09tag_item->type =3D (enum rte_flow_item_type) +=09=09=09 MLX5_RTE_FLOW_ITEM_TYPE_TAG; =09tag_item->spec =3D tag_spec; =09tag_item->last =3D NULL; @@ -3728,5 +3737,6 @@ flow_mreg_split_qrss_prep(struct rte_eth_dev *dev, =09=09/* Replace QUEUE/RSS action. */ =09=09split_actions[qrss_idx] =3D (struct rte_flow_action){ -=09=09=09.type =3D MLX5_RTE_FLOW_ACTION_TYPE_TAG, +=09=09=09.type =3D (enum rte_flow_action_type) +=09=09=09=09MLX5_RTE_FLOW_ACTION_TYPE_TAG, =09=09=09.conf =3D set_tag, =09=09}; @@ -3791,5 +3801,6 @@ flow_mreg_tx_copy_prep(struct rte_eth_dev *dev, =09if (encap_idx =3D=3D actions_n - 1) { =09=09ext_actions[actions_n - 1] =3D (struct rte_flow_action){ -=09=09=09.type =3D MLX5_RTE_FLOW_ACTION_TYPE_COPY_MREG, +=09=09=09.type =3D (enum rte_flow_action_type) +=09=09=09=09MLX5_RTE_FLOW_ACTION_TYPE_COPY_MREG, =09=09=09.conf =3D cp_mreg, =09=09}; @@ -3799,5 +3810,6 @@ flow_mreg_tx_copy_prep(struct rte_eth_dev *dev, =09} else { =09=09ext_actions[encap_idx] =3D (struct rte_flow_action){ -=09=09=09.type =3D MLX5_RTE_FLOW_ACTION_TYPE_COPY_MREG, +=09=09=09.type =3D (enum rte_flow_action_type) +=09=09=09=09MLX5_RTE_FLOW_ACTION_TYPE_COPY_MREG, =09=09=09.conf =3D cp_mreg, =09=09}; @@ -3913,4 +3925,5 @@ flow_create_split_metadata(struct rte_eth_dev *dev, =09=09else =09=09=09ext_actions[qrss - actions].type =3D +=09=09=09=09=09=09(enum rte_flow_action_type) =09=09=09=09=09=09MLX5_RTE_FLOW_ACTION_TYPE_TAG; =09=09/* @@ -3964,5 +3977,6 @@ flow_create_split_metadata(struct rte_eth_dev *dev, =09=09struct rte_flow_item q_items[] =3D { =09=09=09{ -=09=09=09=09.type =3D MLX5_RTE_FLOW_ITEM_TYPE_TAG, +=09=09=09=09.type =3D (enum rte_flow_item_type) +=09=09=09=09=09MLX5_RTE_FLOW_ITEM_TYPE_TAG, =09=09=09=09.spec =3D &q_tag_spec, =09=09=09=09.last =3D NULL, @@ -4605,5 +4619,6 @@ mlx5_ctrl_flow_source_queue(struct rte_eth_dev *dev, =09struct rte_flow_item items[] =3D { =09=09{ -=09=09=09.type =3D MLX5_RTE_FLOW_ITEM_TYPE_TX_QUEUE, +=09=09=09.type =3D (enum rte_flow_item_type) +=09=09=09=09MLX5_RTE_FLOW_ITEM_TYPE_TX_QUEUE, =09=09=09.spec =3D &queue_spec, =09=09=09.last =3D NULL, @@ -5722,5 +5737,6 @@ mlx5_flow_discover_mreg_c(struct rte_eth_dev *dev) =09=09struct rte_flow_action actions[] =3D { =09=09=09[0] =3D { -=09=09=09=09.type =3D MLX5_RTE_FLOW_ACTION_TYPE_COPY_MREG, +=09=09=09=09.type =3D (enum rte_flow_action_type) +=09=09=09=09=09MLX5_RTE_FLOW_ACTION_TYPE_COPY_MREG, =09=09=09=09.conf =3D &(struct mlx5_flow_action_copy_mreg){ =09=09=09=09=09.src =3D REG_C_1, --=20 2.21.1