net/sfc: fence off 8 bits in Rx mark for tunnel offload
[dpdk.git] / drivers / net / bnxt / tf_ulp / bnxt_ulp.c
index 475c7a6..bbaa6dc 100644 (file)
@@ -830,13 +830,12 @@ ulp_ctx_init(struct bnxt *bp,
                goto error_deinit;
        }
 
-       /* TODO: For now we are overriding to APP:1 on this branch*/
-       bp->app_id = 1;
        rc = bnxt_ulp_cntxt_app_id_set(bp->ulp_ctx, bp->app_id);
        if (rc) {
                BNXT_TF_DBG(ERR, "Unable to set app_id for ULP init.\n");
                goto error_deinit;
        }
+       BNXT_TF_DBG(DEBUG, "Ulp initialized with app id %d\n", bp->app_id);
 
        rc = bnxt_ulp_cntxt_app_caps_init(bp->ulp_ctx, bp->app_id, devid);
        if (rc) {
@@ -860,8 +859,6 @@ ulp_ctx_init(struct bnxt *bp,
        if (rc)
                goto error_deinit;
 
-       ulp_tun_tbl_init(ulp_data->tun_tbl);
-
        bnxt_ulp_cntxt_tfp_set(bp->ulp_ctx, &bp->tfp);
        return rc;
 
@@ -1395,13 +1392,17 @@ bnxt_ulp_port_init(struct bnxt *bp)
        uint32_t ulp_flags;
        int32_t rc = 0;
 
-       if (!bp || !BNXT_TRUFLOW_EN(bp))
-               return rc;
-
        if (!BNXT_PF(bp) && !BNXT_VF_IS_TRUSTED(bp)) {
                BNXT_TF_DBG(ERR,
                            "Skip ulp init for port: %d, not a TVF or PF\n",
-                       bp->eth_dev->data->port_id);
+                           bp->eth_dev->data->port_id);
+               return rc;
+       }
+
+       if (!BNXT_TRUFLOW_EN(bp)) {
+               BNXT_TF_DBG(ERR,
+                           "Skip ulp init for port: %d, truflow is not enabled\n",
+                           bp->eth_dev->data->port_id);
                return rc;
        }
 
@@ -1522,9 +1523,6 @@ bnxt_ulp_port_deinit(struct bnxt *bp)
        struct rte_pci_device *pci_dev;
        struct rte_pci_addr *pci_addr;
 
-       if (!BNXT_TRUFLOW_EN(bp))
-               return;
-
        if (!BNXT_PF(bp) && !BNXT_VF_IS_TRUSTED(bp)) {
                BNXT_TF_DBG(ERR,
                            "Skip ULP deinit port:%d, not a TVF or PF\n",
@@ -1532,6 +1530,13 @@ bnxt_ulp_port_deinit(struct bnxt *bp)
                return;
        }
 
+       if (!BNXT_TRUFLOW_EN(bp)) {
+               BNXT_TF_DBG(ERR,
+                           "Skip ULP deinit for port:%d, truflow is not enabled\n",
+                           bp->eth_dev->data->port_id);
+               return;
+       }
+
        if (!bp->ulp_ctx) {
                BNXT_TF_DBG(DEBUG, "ulp ctx already de-allocated\n");
                return;
@@ -2035,7 +2040,7 @@ bnxt_ulp_cntxt_list_del(struct bnxt_ulp_context *ulp_ctx)
        struct ulp_context_list_entry   *entry, *temp;
 
        rte_spinlock_lock(&bnxt_ulp_ctxt_lock);
-       TAILQ_FOREACH_SAFE(entry, &ulp_cntx_list, next, temp) {
+       RTE_TAILQ_FOREACH_SAFE(entry, &ulp_cntx_list, next, temp) {
                if (entry->ulp_ctx == ulp_ctx) {
                        TAILQ_REMOVE(&ulp_cntx_list, entry, next);
                        rte_free(entry);
@@ -2064,3 +2069,13 @@ bnxt_ulp_cntxt_entry_release(void)
 {
        rte_spinlock_unlock(&bnxt_ulp_ctxt_lock);
 }
+
+/* Function to get the app tunnel details from the ulp context. */
+struct bnxt_flow_app_tun_ent *
+bnxt_ulp_cntxt_ptr2_app_tun_list_get(struct bnxt_ulp_context *ulp)
+{
+       if (!ulp || !ulp->cfg_data)
+               return NULL;
+
+       return ulp->cfg_data->app_tun;
+}