crypto/cnxk: move IPsec SA creation to common
[dpdk.git] / drivers / common / cnxk / roc_npc_parse.c
index 1f21693..0748646 100644 (file)
@@ -21,6 +21,20 @@ npc_parse_meta_items(struct npc_parse_state *pst)
        return 0;
 }
 
+int
+npc_parse_mark_item(struct npc_parse_state *pst)
+{
+       if (pst->pattern->type == ROC_NPC_ITEM_TYPE_MARK) {
+               if (pst->flow->nix_intf != NIX_INTF_RX)
+                       return -EINVAL;
+
+               pst->is_second_pass_rule = true;
+               pst->pattern++;
+       }
+
+       return 0;
+}
+
 static int
 npc_flow_raw_item_prepare(const struct roc_npc_flow_item_raw *raw_spec,
                          const struct roc_npc_flow_item_raw *raw_mask,
@@ -112,6 +126,7 @@ npc_parse_cpt_hdr(struct npc_parse_state *pst)
        info.hw_hdr_len = 0;
 
        /* Prepare for parsing the item */
+       info.def_mask = NULL;
        info.hw_mask = &hw_mask;
        info.len = pst->pattern->size;
        npc_get_hw_supp_mask(pst, &info, lid, lt);
@@ -149,6 +164,7 @@ npc_parse_higig2_hdr(struct npc_parse_state *pst)
        }
 
        /* Prepare for parsing the item */
+       info.def_mask = NULL;
        info.hw_mask = &hw_mask;
        info.len = pst->pattern->size;
        npc_get_hw_supp_mask(pst, &info, lid, lt);
@@ -198,6 +214,7 @@ npc_parse_la(struct npc_parse_state *pst)
        }
 
        /* Prepare for parsing the item */
+       info.def_mask = NULL;
        info.hw_mask = &hw_mask;
        info.len = sizeof(eth_item->hdr);
        npc_get_hw_supp_mask(pst, &info, lid, lt);
@@ -236,6 +253,7 @@ npc_parse_lb(struct npc_parse_state *pst)
        int nr_vlans = 0;
        int rc;
 
+       info.def_mask = NULL;
        info.spec = NULL;
        info.mask = NULL;
        info.def_mask = NULL;
@@ -333,15 +351,10 @@ npc_parse_lb(struct npc_parse_state *pst)
                }
                info.len = pattern->size;
        } else if (pst->pattern->type == ROC_NPC_ITEM_TYPE_QINQ) {
-               vlan_item[0] = pst->pattern->spec;
                info.hw_mask = NULL;
-               info.len = sizeof(vlan_item[0]->hdr);
+               info.len = pattern->size;
                lt = NPC_LT_LB_STAG_QINQ;
                lflags = NPC_F_STAG_CTAG;
-               if (vlan_item[0] && vlan_item[0]->has_more_vlan) {
-                       lflags = NPC_F_LB_L_WITH_QINQ_CTAG &
-                                NPC_F_LB_L_WITH_QINQ_QINQ;
-               }
        } else if (pst->pattern->type == ROC_NPC_ITEM_TYPE_RAW) {
                raw_spec = pst->pattern->spec;
                if (raw_spec->relative)
@@ -396,12 +409,12 @@ npc_parse_mpls_label_stack(struct npc_parse_state *pst, int *flag)
         * pst->pattern points to first MPLS label. We only check
         * that subsequent labels do not have anything to match.
         */
+       info.def_mask = NULL;
        info.hw_mask = NULL;
        info.len = pattern->size;
        info.spec = NULL;
        info.mask = NULL;
        info.hw_hdr_len = 0;
-       info.def_mask = NULL;
 
        while (pattern->type == ROC_NPC_ITEM_TYPE_MPLS) {
                nr_labels++;
@@ -447,6 +460,7 @@ npc_parse_mpls(struct npc_parse_state *pst, int lid)
        info.len = pst->pattern->size;
        info.spec = NULL;
        info.mask = NULL;
+       info.def_mask = NULL;
        info.hw_hdr_len = 0;
 
        npc_get_hw_supp_mask(pst, &info, lid, lt);
@@ -547,6 +561,7 @@ npc_parse_lc(struct npc_parse_state *pst)
        if (pst->pattern->type == ROC_NPC_ITEM_TYPE_MPLS)
                return npc_parse_mpls(pst, NPC_LID_LC);
 
+       info.def_mask = NULL;
        info.hw_mask = &hw_mask;
        info.spec = NULL;
        info.mask = NULL;
@@ -562,9 +577,11 @@ npc_parse_lc(struct npc_parse_state *pst)
                ipv6_spec = pst->pattern->spec;
                lid = NPC_LID_LC;
                lt = NPC_LT_LC_IP6;
-               rc = npc_handle_ipv6ext_attr(ipv6_spec, pst, &flags);
-               if (rc)
-                       return rc;
+               if (ipv6_spec) {
+                       rc = npc_handle_ipv6ext_attr(ipv6_spec, pst, &flags);
+                       if (rc)
+                               return rc;
+               }
                info.len = sizeof(ipv6_spec->hdr);
                break;
        case ROC_NPC_ITEM_TYPE_ARP_ETH_IPV4:
@@ -577,6 +594,13 @@ npc_parse_lc(struct npc_parse_state *pst)
                info.len = pst->pattern->size;
                info.hw_hdr_len = 40;
                break;
+       case ROC_NPC_ITEM_TYPE_IPV6_FRAG_EXT:
+               lid = NPC_LID_LC;
+               lt = NPC_LT_LC_IP6_EXT;
+               flags = NPC_F_LC_U_IP6_FRAG;
+               info.len = pst->pattern->size;
+               info.hw_hdr_len = 40;
+               break;
        case ROC_NPC_ITEM_TYPE_L3_CUSTOM:
                lt = NPC_LT_LC_CUSTOM0;
                info.len = pst->pattern->size;
@@ -638,10 +662,10 @@ npc_parse_ld(struct npc_parse_state *pst)
                        return npc_parse_mpls(pst, NPC_LID_LD);
                return 0;
        }
+       info.def_mask = NULL;
        info.hw_mask = &hw_mask;
        info.spec = NULL;
        info.mask = NULL;
-       info.def_mask = NULL;
        info.len = 0;
        info.hw_hdr_len = 0;
 
@@ -797,6 +821,7 @@ npc_parse_lf(struct npc_parse_state *pst)
        lflags = 0;
 
        /* No match support for vlan tags */
+       info.def_mask = NULL;
        info.hw_mask = NULL;
        info.len = pst->pattern->size;
        info.spec = NULL;
@@ -855,6 +880,7 @@ npc_parse_lg(struct npc_parse_state *pst)
        if (!pst->tunnel)
                return 0;
 
+       info.def_mask = NULL;
        info.hw_mask = &hw_mask;
        info.spec = NULL;
        info.mask = NULL;
@@ -891,6 +917,7 @@ npc_parse_lh(struct npc_parse_state *pst)
        if (!pst->tunnel)
                return 0;
 
+       info.def_mask = NULL;
        info.hw_mask = &hw_mask;
        info.spec = NULL;
        info.mask = NULL;