MCPcopy Create free account
hub / github.com/F-Stack/f-stack / bnxt_ulp_port_deinit

Function bnxt_ulp_port_deinit

dpdk/drivers/net/bnxt/tf_ulp/bnxt_ulp.c:1910–1989  ·  view source on GitHub ↗

* When a port is de-initialized by dpdk. This functions clears up * the port specific details. */

Source from the content-addressed store, hash-verified

1908 * the port specific details.
1909 */
1910void
1911bnxt_ulp_port_deinit(struct bnxt *bp)
1912{
1913 struct bnxt_ulp_session_state *session;
1914 struct rte_pci_device *pci_dev;
1915 struct rte_pci_addr *pci_addr;
1916
1917 if (!BNXT_TRUFLOW_EN(bp)) {
1918 BNXT_TF_DBG(DEBUG,
1919 "Skip ULP deinit for port:%d, TF is not enabled\n",
1920 bp->eth_dev->data->port_id);
1921 return;
1922 }
1923
1924 if (!BNXT_PF(bp) && !BNXT_VF_IS_TRUSTED(bp)) {
1925 BNXT_TF_DBG(DEBUG,
1926 "Skip ULP deinit port:%d, not a TVF or PF\n",
1927 bp->eth_dev->data->port_id);
1928 return;
1929 }
1930
1931 if (!bp->ulp_ctx) {
1932 BNXT_TF_DBG(DEBUG, "ulp ctx already de-allocated\n");
1933 return;
1934 }
1935
1936 BNXT_TF_DBG(DEBUG, "BNXT Port:%d ULP port deinit\n",
1937 bp->eth_dev->data->port_id);
1938
1939 /* Get the session details */
1940 pci_dev = RTE_DEV_TO_PCI(bp->eth_dev->device);
1941 pci_addr = &pci_dev->addr;
1942 pthread_mutex_lock(&bnxt_ulp_global_mutex);
1943 session = ulp_get_session(bp, pci_addr);
1944 pthread_mutex_unlock(&bnxt_ulp_global_mutex);
1945
1946 /* session not found then just exit */
1947 if (!session) {
1948 /* Free the ulp context */
1949 rte_free(bp->ulp_ctx);
1950 bp->ulp_ctx = NULL;
1951 return;
1952 }
1953
1954 /* Check the reference count to deinit or deattach*/
1955 if (bp->ulp_ctx->cfg_data && bp->ulp_ctx->cfg_data->ref_cnt) {
1956 bp->ulp_ctx->cfg_data->ref_cnt--;
1957 if (bp->ulp_ctx->cfg_data->ref_cnt) {
1958 /* Free tunnel configurations */
1959 ulp_cust_vxlan_free(bp);
1960
1961 /* free the port details */
1962 /* Free the default flow rule associated to this port */
1963 bnxt_ulp_destroy_df_rules(bp, false);
1964 bnxt_ulp_destroy_vfr_default_rules(bp, false);
1965
1966 /* free flows associated with this port */
1967 bnxt_ulp_flush_port_flows(bp);

Callers 2

bnxt_dev_stopFunction · 0.85
bnxt_ulp_port_initFunction · 0.85

Calls 13

pthread_mutex_lockFunction · 0.85
ulp_get_sessionFunction · 0.85
pthread_mutex_unlockFunction · 0.85
rte_freeFunction · 0.85
ulp_cust_vxlan_freeFunction · 0.85
ulp_ctx_detachFunction · 0.85
bnxt_ulp_deinitFunction · 0.85
bnxt_ulp_cntxt_list_delFunction · 0.85

Tested by

no test coverage detected