net/bnxt: allow dynamic creation of VNIC
[dpdk.git] / drivers / net / bnxt / bnxt_flow.c
index be9b6fa..13bdaf0 100644 (file)
@@ -1071,6 +1071,13 @@ bnxt_flow_create(struct rte_eth_dev *dev,
        int ret = 0;
        uint32_t tun_type;
 
+       if (BNXT_VF(bp) && !BNXT_VF_IS_TRUSTED(bp)) {
+               rte_flow_error_set(error, EINVAL,
+                                  RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
+                                  "Failed to create flow, Not a Trusted VF!");
+               return NULL;
+       }
+
        flow = rte_zmalloc("bnxt_flow", sizeof(struct rte_flow), 0);
        if (!flow) {
                rte_flow_error_set(error, ENOMEM,
@@ -1249,6 +1256,11 @@ bnxt_flow_destroy(struct rte_eth_dev *dev,
        struct bnxt_vnic_info *vnic = flow->vnic;
        int ret = 0;
 
+       if (!filter) {
+               ret = -EINVAL;
+               goto done;
+       }
+
        if (filter->filter_type == HWRM_CFA_TUNNEL_REDIRECT_FILTER &&
            filter->enables == filter->tunnel_type) {
                ret = bnxt_handle_tunnel_redirect_destroy(bp,