net/enic: ignore VLAN inner type when it is zero
[dpdk.git] / drivers / net / enic / enic_fm_flow.c
index 28ed518..94e39a9 100644 (file)
@@ -392,8 +392,11 @@ enic_fm_copy_item_vlan(struct copy_item_args *arg)
        eth_mask = (void *)&fm_mask->l2.eth;
        eth_val = (void *)&fm_data->l2.eth;
 
-       /* Outer TPID cannot be matched */
-       if (eth_mask->ether_type)
+       /*
+        * Outer TPID cannot be matched. If inner_type is 0, use what is
+        * in the eth header.
+        */
+       if (eth_mask->ether_type && mask->inner_type)
                return -ENOTSUP;
 
        /*
@@ -401,8 +404,10 @@ enic_fm_copy_item_vlan(struct copy_item_args *arg)
         * L2, regardless of vlan stripping settings. So, the inner type
         * from vlan becomes the ether type of the eth header.
         */
-       eth_mask->ether_type = mask->inner_type;
-       eth_val->ether_type = spec->inner_type;
+       if (mask->inner_type) {
+               eth_mask->ether_type = mask->inner_type;
+               eth_val->ether_type = spec->inner_type;
+       }
        fm_data->fk_header_select |= FKH_ETHER | FKH_QTAG;
        fm_mask->fk_header_select |= FKH_ETHER | FKH_QTAG;
        fm_data->fk_vlan = rte_be_to_cpu_16(spec->tci);
@@ -1712,9 +1717,10 @@ enic_fm_dump_tcam_match(const struct fm_tcam_match_entry *match,
        memset(buf, 0, sizeof(buf));
        __enic_fm_dump_tcam_match(&match->ftm_mask.fk_hdrset[0],
                                  buf, sizeof(buf));
-       ENICPMD_LOG(DEBUG, " TCAM %s Outer: %s %scounter",
+       ENICPMD_LOG(DEBUG, " TCAM %s Outer: %s %scounter position %u",
                    (ingress) ? "IG" : "EG", buf,
-                   (match->ftm_flags & FMEF_COUNTER) ? "" : "no ");
+                   (match->ftm_flags & FMEF_COUNTER) ? "" : "no ",
+                   match->ftm_position);
        memset(buf, 0, sizeof(buf));
        __enic_fm_dump_tcam_match(&match->ftm_mask.fk_hdrset[1],
                                  buf, sizeof(buf));
@@ -1761,11 +1767,11 @@ enic_fm_flow_parse(struct enic_flowman *fm,
        }
 
        if (attrs) {
-               if (attrs->priority) {
+               if (attrs->group != FM_TCAM_RTE_GROUP && attrs->priority) {
                        rte_flow_error_set(error, ENOTSUP,
                                           RTE_FLOW_ERROR_TYPE_ATTR_PRIORITY,
                                           NULL,
-                                          "priorities are not supported");
+                                          "priorities are not supported for non-default (0) groups");
                        return -rte_errno;
                } else if (!fm->owner_enic->switchdev_mode && attrs->transfer) {
                        rte_flow_error_set(error, ENOTSUP,
@@ -2193,6 +2199,7 @@ enic_fm_flow_add_entry(struct enic_flowman *fm,
        struct rte_flow *flow;
 
        ENICPMD_FUNC_TRACE();
+       match_in->ftm_position = attrs->priority;
        enic_fm_dump_tcam_entry(match_in, action_in, attrs->ingress);
        flow = calloc(1, sizeof(*flow));
        fm_flow = calloc(1, sizeof(*fm_flow));