doc: announce behavior change in bus probing
[dpdk.git] / drivers / net / octeontx2 / otx2_flow_utils.c
index 14625c9..35f7d0f 100644 (file)
@@ -271,6 +271,7 @@ otx2_flow_update_parse_state(struct otx2_parse_state *pst,
                             uint8_t flags)
 {
        struct npc_lid_lt_xtract_info *xinfo;
+       struct otx2_flow_dump_data *dump;
        struct npc_xtract_info *lfinfo;
        int intf, lf_cfg;
        int i, j, rc = 0;
@@ -320,6 +321,9 @@ otx2_flow_update_parse_state(struct otx2_parse_state *pst,
        }
 
 done:
+       dump = &pst->flow->dump_data[pst->flow->num_patterns++];
+       dump->lid = lid;
+       dump->ltype = lt;
        /* Next pattern to parse by subsequent layers */
        pst->pattern++;
        return 0;
@@ -386,7 +390,8 @@ otx2_flow_parse_item_basic(const struct rte_flow_item *item,
        }
 
        /* We have valid spec */
-       info->spec = item->spec;
+       if (item->type != RTE_FLOW_ITEM_TYPE_RAW)
+               info->spec = item->spec;
 
        /* If mask is not set, use default mask, err if default mask is
         * also NULL.
@@ -401,7 +406,8 @@ otx2_flow_parse_item_basic(const struct rte_flow_item *item,
                }
                info->mask = info->def_mask;
        } else {
-               info->mask = item->mask;
+               if (item->type != RTE_FLOW_ITEM_TYPE_RAW)
+                       info->mask = item->mask;
        }
 
        /* mask specified must be subset of hw supported mask
@@ -884,11 +890,13 @@ flow_check_preallocated_entry_cache(struct otx2_mbox *mbox,
 
 int
 otx2_flow_mcam_alloc_and_write(struct rte_flow *flow, struct otx2_mbox *mbox,
-                              __rte_unused struct otx2_parse_state *pst,
+                              struct otx2_parse_state *pst,
                               struct otx2_npc_flow_info *flow_info)
 {
        int use_ctr = (flow->ctr_id == NPC_COUNTER_NONE ? 0 : 1);
+       struct npc_mcam_read_base_rule_rsp *base_rule_rsp;
        struct npc_mcam_write_entry_req *req;
+       struct mcam_entry *base_entry;
        struct mbox_msghdr *rsp;
        uint16_t ctr = ~(0);
        int rc, idx;
@@ -906,6 +914,21 @@ otx2_flow_mcam_alloc_and_write(struct rte_flow *flow, struct otx2_mbox *mbox,
                otx2_flow_mcam_free_counter(mbox, ctr);
                return NPC_MCAM_ALLOC_FAILED;
        }
+
+       if (pst->is_vf) {
+               (void)otx2_mbox_alloc_msg_npc_read_base_steer_rule(mbox);
+               rc = otx2_mbox_process_msg(mbox, (void *)&base_rule_rsp);
+               if (rc) {
+                       otx2_err("Failed to fetch VF's base MCAM entry");
+                       return rc;
+               }
+               base_entry = &base_rule_rsp->entry_data;
+               for (idx = 0; idx < OTX2_MAX_MCAM_WIDTH_DWORDS; idx++) {
+                       flow->mcam_data[idx] |= base_entry->kw[idx];
+                       flow->mcam_mask[idx] |= base_entry->kw_mask[idx];
+               }
+       }
+
        req = otx2_mbox_alloc_msg_npc_mcam_write_entry(mbox);
        req->set_cntr = use_ctr;
        req->cntr = ctr;
@@ -916,20 +939,7 @@ otx2_flow_mcam_alloc_and_write(struct rte_flow *flow, struct otx2_mbox *mbox,
                (flow->nix_intf == OTX2_INTF_RX) ? NPC_MCAM_RX : NPC_MCAM_TX;
        req->enable_entry = 1;
        req->entry_data.action = flow->npc_action;
-
-       /*
-        * DPDK sets vtag action on per interface basis, not
-        * per flow basis. It is a matter of how we decide to support
-        * this pmd specific behavior. There are two ways:
-        *      1. Inherit the vtag action from the one configured
-        *         for this interface. This can be read from the
-        *         vtag_action configured for default mcam entry of
-        *         this pf_func.
-        *      2. Do not support vtag action with rte_flow.
-        *
-        * Second approach is used now.
-        */
-       req->entry_data.vtag_action = 0ULL;
+       req->entry_data.vtag_action = flow->vtag_action;
 
        for (idx = 0; idx < OTX2_MAX_MCAM_WIDTH_DWORDS; idx++) {
                req->entry_data.kw[idx] = flow->mcam_data[idx];
@@ -940,7 +950,7 @@ otx2_flow_mcam_alloc_and_write(struct rte_flow *flow, struct otx2_mbox *mbox,
                req->entry_data.kw[0] |= flow_info->channel;
                req->entry_data.kw_mask[0] |=  (BIT_ULL(12) - 1);
        } else {
-               uint16_t pf_func = (flow->npc_action >> 4) & 0xffff;
+               uint16_t pf_func = (flow->npc_action >> 48) & 0xffff;
 
                pf_func = htons(pf_func);
                req->entry_data.kw[0] |= ((uint64_t)pf_func << 32);