X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fbnxt%2Fbnxt_flow.c;h=59489b591a6f60224044fc02513447016153961a;hb=c6c90a33de906eb40a8eb01e16736cbaa2845b97;hp=9b4780773ad70819e4fc2d8ec0fb8f6cdfd22b43;hpb=94df7953ac6599c2887b859de19c541e5b5830d9;p=dpdk.git diff --git a/drivers/net/bnxt/bnxt_flow.c b/drivers/net/bnxt/bnxt_flow.c index 9b4780773a..59489b591a 100644 --- a/drivers/net/bnxt/bnxt_flow.c +++ b/drivers/net/bnxt/bnxt_flow.c @@ -919,6 +919,19 @@ bnxt_get_l2_filter(struct bnxt *bp, struct bnxt_filter_info *nf, return l2_filter; } +static void bnxt_vnic_cleanup(struct bnxt *bp, struct bnxt_vnic_info *vnic) +{ + if (vnic->rx_queue_cnt > 1) + bnxt_hwrm_vnic_ctx_free(bp, vnic); + + bnxt_hwrm_vnic_free(bp, vnic); + + rte_free(vnic->fw_grp_ids); + vnic->fw_grp_ids = NULL; + + vnic->rx_queue_cnt = 0; +} + static int bnxt_vnic_prep(struct bnxt *bp, struct bnxt_vnic_info *vnic, const struct rte_flow_action *act, struct rte_flow_error *error) @@ -949,11 +962,9 @@ static int bnxt_vnic_prep(struct bnxt *bp, struct bnxt_vnic_info *vnic, goto ret; } - bp->nr_vnics++; - /* RSS context is required only when there is more than one RSS ring */ if (vnic->rx_queue_cnt > 1) { - rc = bnxt_hwrm_vnic_ctx_alloc(bp, vnic, 0 /* ctx_idx 0 */); + rc = bnxt_hwrm_vnic_ctx_alloc(bp, vnic, 0); if (rc) { rte_flow_error_set(error, -rc, RTE_FLOW_ERROR_TYPE_ACTION, @@ -961,8 +972,6 @@ static int bnxt_vnic_prep(struct bnxt *bp, struct bnxt_vnic_info *vnic, "Failed to alloc VNIC context"); goto ret; } - } else { - PMD_DRV_LOG(DEBUG, "No RSS context required\n"); } if (rx_offloads & DEV_RX_OFFLOAD_VLAN_STRIP) @@ -988,9 +997,12 @@ static int bnxt_vnic_prep(struct bnxt *bp, struct bnxt_vnic_info *vnic, goto ret; } + bp->nr_vnics++; + return 0; ret: + bnxt_vnic_cleanup(bp, vnic); return rc; } @@ -1565,10 +1577,7 @@ bnxt_flow_validate(struct rte_eth_dev *dev, vnic = find_matching_vnic(bp, filter); if (vnic) { if (STAILQ_EMPTY(&vnic->filter)) { - rte_free(vnic->fw_grp_ids); - bnxt_hwrm_vnic_ctx_free(bp, vnic); - bnxt_hwrm_vnic_free(bp, vnic); - vnic->rx_queue_cnt = 0; + bnxt_vnic_cleanup(bp, vnic); bp->nr_vnics--; PMD_DRV_LOG(DEBUG, "Free VNIC\n"); } @@ -1957,12 +1966,20 @@ static int bnxt_handle_tunnel_redirect_destroy(struct bnxt *bp, /* Tunnel doesn't belong to this VF, so don't send HWRM * cmd, just delete the flow from driver */ - if (bp->fw_fid != (tun_dst_fid + bp->first_vf_id)) + if (bp->fw_fid != (tun_dst_fid + bp->first_vf_id)) { PMD_DRV_LOG(ERR, "Tunnel does not belong to this VF, skip hwrm_tunnel_redirect_free\n"); - else + } else { ret = bnxt_hwrm_tunnel_redirect_free(bp, filter->tunnel_type); + if (ret) { + rte_flow_error_set(error, -ret, + RTE_FLOW_ERROR_TYPE_HANDLE, + NULL, + "Unable to free tunnel redirection"); + return ret; + } + } } return ret; } @@ -2025,12 +2042,7 @@ done: */ if (vnic && !vnic->func_default && STAILQ_EMPTY(&vnic->flow_list)) { - rte_free(vnic->fw_grp_ids); - if (vnic->rx_queue_cnt > 1) - bnxt_hwrm_vnic_ctx_free(bp, vnic); - - bnxt_hwrm_vnic_free(bp, vnic); - vnic->rx_queue_cnt = 0; + bnxt_vnic_cleanup(bp, vnic); bp->nr_vnics--; } } else {