net/i40e: fix assignment of enum values
authorTomasz Kulasek <tomaszx.kulasek@intel.com>
Fri, 22 Sep 2017 12:36:25 +0000 (14:36 +0200)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 6 Oct 2017 00:49:49 +0000 (02:49 +0200)
mixed_enums: Mixing enum types enum i40e_vsi_type and enum
             virtchnl_vsi_type for type

Coverity issue 158651
Fixes: a58860f68929 ("net/i40e/base: use new virtchnl header file")
Cc: stable@dpdk.org
Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
drivers/net/i40e/i40e_ethdev_vf.c

index 919f8c7..b35011a 100644 (file)
@@ -1225,7 +1225,15 @@ i40evf_init_vf(struct rte_eth_dev *dev)
        if (hw->mac.type == I40E_MAC_X722_VF)
                vf->flags = I40E_FLAG_RSS_AQ_CAPABLE;
        vf->vsi.vsi_id = vf->vsi_res->vsi_id;
-       vf->vsi.type = (enum i40e_vsi_type)vf->vsi_res->vsi_type;
+
+       switch (vf->vsi_res->vsi_type) {
+       case VIRTCHNL_VSI_SRIOV:
+               vf->vsi.type = I40E_VSI_SRIOV;
+               break;
+       default:
+               vf->vsi.type = I40E_VSI_TYPE_UNKNOWN;
+               break;
+       }
        vf->vsi.nb_qps = vf->vsi_res->num_queue_pairs;
        vf->vsi.adapter = I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);