* When a port is deinit'ed by dpdk. This function is called * and this function clears the ULP context and rest of the * infrastructure associated with it. */
| 1535 | * infrastructure associated with it. |
| 1536 | */ |
| 1537 | static void |
| 1538 | bnxt_ulp_deinit(struct bnxt *bp, |
| 1539 | struct bnxt_ulp_session_state *session) |
| 1540 | { |
| 1541 | bool ha_enabled; |
| 1542 | |
| 1543 | if (!bp->ulp_ctx || !bp->ulp_ctx->cfg_data) |
| 1544 | return; |
| 1545 | |
| 1546 | ha_enabled = bnxt_ulp_cntxt_ha_enabled(bp->ulp_ctx); |
| 1547 | if (ha_enabled && |
| 1548 | bnxt_ulp_session_is_open(session, BNXT_ULP_SESSION_TYPE_DEFAULT)) { |
| 1549 | int32_t rc = ulp_ha_mgr_close(bp->ulp_ctx); |
| 1550 | if (rc) |
| 1551 | BNXT_TF_DBG(ERR, "Failed to close HA (%d)\n", rc); |
| 1552 | } |
| 1553 | |
| 1554 | /* clean up default flows */ |
| 1555 | bnxt_ulp_destroy_df_rules(bp, true); |
| 1556 | |
| 1557 | /* clean up default VFR flows */ |
| 1558 | bnxt_ulp_destroy_vfr_default_rules(bp, true); |
| 1559 | |
| 1560 | /* clean up regular flows */ |
| 1561 | ulp_flow_db_flush_flows(bp->ulp_ctx, BNXT_ULP_FDB_TYPE_REGULAR); |
| 1562 | |
| 1563 | /* cleanup the eem table scope */ |
| 1564 | ulp_eem_tbl_scope_deinit(bp, bp->ulp_ctx); |
| 1565 | |
| 1566 | /* cleanup the flow database */ |
| 1567 | ulp_flow_db_deinit(bp->ulp_ctx); |
| 1568 | |
| 1569 | /* Delete the Mark database */ |
| 1570 | ulp_mark_db_deinit(bp->ulp_ctx); |
| 1571 | |
| 1572 | /* cleanup the ulp mapper */ |
| 1573 | ulp_mapper_deinit(bp->ulp_ctx); |
| 1574 | |
| 1575 | /* Delete the Flow Counter Manager */ |
| 1576 | ulp_fc_mgr_deinit(bp->ulp_ctx); |
| 1577 | |
| 1578 | /* Delete the Port database */ |
| 1579 | ulp_port_db_deinit(bp->ulp_ctx); |
| 1580 | |
| 1581 | /* Disable NAT feature */ |
| 1582 | (void)bnxt_ulp_global_cfg_update(bp, TF_DIR_RX, TF_TUNNEL_ENCAP, |
| 1583 | TF_TUNNEL_ENCAP_NAT, |
| 1584 | BNXT_ULP_NAT_OUTER_MOST_FLAGS, 0); |
| 1585 | |
| 1586 | (void)bnxt_ulp_global_cfg_update(bp, TF_DIR_TX, TF_TUNNEL_ENCAP, |
| 1587 | TF_TUNNEL_ENCAP_NAT, |
| 1588 | BNXT_ULP_NAT_OUTER_MOST_FLAGS, 0); |
| 1589 | |
| 1590 | /* free the flow db lock */ |
| 1591 | pthread_mutex_destroy(&bp->ulp_ctx->cfg_data->flow_db_lock); |
| 1592 | |
| 1593 | if (ha_enabled) |
| 1594 | ulp_ha_mgr_deinit(bp->ulp_ctx); |
no test coverage detected