net/bnxt: fix port default rule create/destroy
[dpdk.git] / drivers / net / bnxt / bnxt_ethdev.c
index 0829493..dfc4b41 100644 (file)
@@ -1168,73 +1168,6 @@ static int bnxt_handle_if_change_status(struct bnxt *bp)
        return rc;
 }
 
-static int32_t
-bnxt_create_port_app_df_rule(struct bnxt *bp, uint8_t flow_type,
-                            uint32_t *flow_id)
-{
-       uint16_t port_id = bp->eth_dev->data->port_id;
-       struct ulp_tlv_param param_list[] = {
-               {
-                       .type = BNXT_ULP_DF_PARAM_TYPE_DEV_PORT_ID,
-                       .length = 2,
-                       .value = {(port_id >> 8) & 0xff, port_id & 0xff}
-               },
-               {
-                       .type = BNXT_ULP_DF_PARAM_TYPE_LAST,
-                       .length = 0,
-                       .value = {0}
-               }
-       };
-
-       return ulp_default_flow_create(bp->eth_dev, param_list, flow_type,
-                                      flow_id);
-}
-
-static int32_t
-bnxt_create_df_rules(struct bnxt *bp)
-{
-       struct bnxt_ulp_data *cfg_data;
-       int rc;
-
-       cfg_data = bp->ulp_ctx->cfg_data;
-       rc = bnxt_create_port_app_df_rule(bp, BNXT_ULP_DF_TPL_PORT_TO_VS,
-                                         &cfg_data->port_to_app_flow_id);
-       if (rc) {
-               PMD_DRV_LOG(ERR,
-                           "Failed to create port to app default rule\n");
-               return rc;
-       }
-
-       BNXT_TF_DBG(DEBUG, "***** created port to app default rule ******\n");
-       rc = bnxt_create_port_app_df_rule(bp, BNXT_ULP_DF_TPL_VS_TO_PORT,
-                                         &cfg_data->app_to_port_flow_id);
-       if (!rc) {
-               rc = ulp_default_flow_db_cfa_action_get(bp->ulp_ctx,
-                                                       cfg_data->app_to_port_flow_id,
-                                                       &cfg_data->tx_cfa_action);
-               if (rc)
-                       goto err;
-
-               BNXT_TF_DBG(DEBUG,
-                           "***** created app to port default rule *****\n");
-               return 0;
-       }
-
-err:
-       BNXT_TF_DBG(DEBUG, "Failed to create app to port default rule\n");
-       return rc;
-}
-
-static void
-bnxt_destroy_df_rules(struct bnxt *bp)
-{
-       struct bnxt_ulp_data *cfg_data;
-
-       cfg_data = bp->ulp_ctx->cfg_data;
-       ulp_default_flow_destroy(bp->eth_dev, cfg_data->port_to_app_flow_id);
-       ulp_default_flow_destroy(bp->eth_dev, cfg_data->app_to_port_flow_id);
-}
-
 static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
 {
        struct bnxt *bp = eth_dev->data->dev_private;
@@ -1296,8 +1229,7 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
        bnxt_schedule_fw_health_check(bp);
        pthread_mutex_unlock(&bp->def_cp_lock);
 
-       if (BNXT_TRUFLOW_EN(bp))
-               bnxt_ulp_init(bp);
+       bnxt_ulp_init(bp);
 
        return 0;
 
@@ -1358,6 +1290,9 @@ static void bnxt_dev_stop_op(struct rte_eth_dev *eth_dev)
        /* disable uio/vfio intr/eventfd mapping */
        rte_intr_disable(intr_handle);
 
+       bnxt_ulp_destroy_df_rules(bp, false);
+       bnxt_ulp_deinit(bp);
+
        bnxt_cancel_fw_health_check(bp);
 
        bnxt_dev_set_link_down_op(eth_dev);
@@ -1403,11 +1338,6 @@ static void bnxt_dev_close_op(struct rte_eth_dev *eth_dev)
        rte_eal_alarm_cancel(bnxt_dev_recover, (void *)bp);
        bnxt_cancel_fc_thread(bp);
 
-       if (BNXT_TRUFLOW_EN(bp)) {
-               bnxt_destroy_df_rules(bp);
-               bnxt_ulp_deinit(bp);
-       }
-
        if (eth_dev->data->dev_started)
                bnxt_dev_stop_op(eth_dev);
 
@@ -1656,8 +1586,7 @@ static int bnxt_promiscuous_disable_op(struct rte_eth_dev *eth_dev)
        if (rc != 0)
                vnic->flags = old_flags;
 
-       if (BNXT_TRUFLOW_EN(bp))
-               bnxt_create_df_rules(bp);
+       bnxt_ulp_create_df_rules(bp);
 
        return rc;
 }