[NPC_DMAC]      = "dmac",
        [NPC_SMAC]      = "smac",
        [NPC_ETYPE]     = "ether type",
+       [NPC_VLAN_ETYPE_CTAG] = "vlan ether type ctag",
+       [NPC_VLAN_ETYPE_STAG] = "vlan ether type stag",
        [NPC_OUTER_VID] = "outer vlan id",
        [NPC_TOS]       = "tos",
        [NPC_SIP_IPV4]  = "ipv4 source ip",
        if (*features & BIT_ULL(NPC_OUTER_VID))
                if (!npc_check_field(rvu, blkaddr, NPC_LB, intf))
                        *features &= ~BIT_ULL(NPC_OUTER_VID);
+
+       /* for vlan ethertypes corresponding layer type should be in the key */
+       if (npc_check_field(rvu, blkaddr, NPC_LB, intf))
+               *features |= BIT_ULL(NPC_VLAN_ETYPE_CTAG) |
+                            BIT_ULL(NPC_VLAN_ETYPE_STAG);
 }
 
 /* Scan key extraction profile and record how fields of our interest
        }
 }
 
+static void npc_update_vlan_features(struct rvu *rvu, struct mcam_entry *entry,
+                                    u64 features, u8 intf)
+{
+       bool ctag = !!(features & BIT_ULL(NPC_VLAN_ETYPE_CTAG));
+       bool stag = !!(features & BIT_ULL(NPC_VLAN_ETYPE_STAG));
+       bool vid = !!(features & BIT_ULL(NPC_OUTER_VID));
+
+       /* If only VLAN id is given then always match outer VLAN id */
+       if (vid && !ctag && !stag) {
+               npc_update_entry(rvu, NPC_LB, entry,
+                                NPC_LT_LB_STAG_QINQ | NPC_LT_LB_CTAG, 0,
+                                NPC_LT_LB_STAG_QINQ & NPC_LT_LB_CTAG, 0, intf);
+               return;
+       }
+       if (ctag)
+               npc_update_entry(rvu, NPC_LB, entry, NPC_LT_LB_CTAG, 0,
+                                ~0ULL, 0, intf);
+       if (stag)
+               npc_update_entry(rvu, NPC_LB, entry, NPC_LT_LB_STAG_QINQ, 0,
+                                ~0ULL, 0, intf);
+}
+
 static void npc_update_flow(struct rvu *rvu, struct mcam_entry *entry,
                            u64 features, struct flow_msg *pkt,
                            struct flow_msg *mask,
                npc_update_entry(rvu, NPC_LD, entry, NPC_LT_LD_ICMP6,
                                 0, ~0ULL, 0, intf);
 
-       if (features & BIT_ULL(NPC_OUTER_VID))
-               npc_update_entry(rvu, NPC_LB, entry,
-                                NPC_LT_LB_STAG_QINQ | NPC_LT_LB_CTAG, 0,
-                                NPC_LT_LB_STAG_QINQ & NPC_LT_LB_CTAG, 0, intf);
-
        /* For AH, LTYPE should be present in entry */
        if (features & BIT_ULL(NPC_IPPROTO_AH))
                npc_update_entry(rvu, NPC_LD, entry, NPC_LT_LD_AH,
                       ntohs(mask->vlan_tci), 0);
 
        npc_update_ipv6_flow(rvu, entry, features, pkt, mask, output, intf);
+       npc_update_vlan_features(rvu, entry, features, intf);
 }
 
 static struct rvu_npc_mcam_rule *rvu_mcam_find_rule(struct npc_mcam *mcam,
 
        return 0;
 }
 
-int otx2_prepare_flow_request(struct ethtool_rx_flow_spec *fsp,
+static int otx2_prepare_flow_request(struct ethtool_rx_flow_spec *fsp,
                              struct npc_install_flow_req *req)
 {
        struct ethhdr *eth_mask = &fsp->m_u.ether_spec;
                return -EOPNOTSUPP;
        }
        if (fsp->flow_type & FLOW_EXT) {
-               if (fsp->m_ext.vlan_etype)
-                       return -EINVAL;
+               u16 vlan_etype;
+
+               if (fsp->m_ext.vlan_etype) {
+                       /* Partial masks not supported */
+                       if (be16_to_cpu(fsp->m_ext.vlan_etype) != 0xFFFF)
+                               return -EINVAL;
+
+                       vlan_etype = be16_to_cpu(fsp->h_ext.vlan_etype);
+                       /* Only ETH_P_8021Q and ETH_P_802AD types supported */
+                       if (vlan_etype != ETH_P_8021Q &&
+                           vlan_etype != ETH_P_8021AD)
+                               return -EINVAL;
+
+                       memcpy(&pkt->vlan_etype, &fsp->h_ext.vlan_etype,
+                              sizeof(pkt->vlan_etype));
+                       memcpy(&pmask->vlan_etype, &fsp->m_ext.vlan_etype,
+                              sizeof(pmask->vlan_etype));
+
+                       if (vlan_etype == ETH_P_8021Q)
+                               req->features |= BIT_ULL(NPC_VLAN_ETYPE_CTAG);
+                       else
+                               req->features |= BIT_ULL(NPC_VLAN_ETYPE_STAG);
+               }
+
                if (fsp->m_ext.vlan_tci) {
                        memcpy(&pkt->vlan_tci, &fsp->h_ext.vlan_tci,
                               sizeof(pkt->vlan_tci));
                if (!flow)
                        return -ENOMEM;
                flow->location = fsp->location;
+               flow->entry = flow_cfg->flow_ent[flow->location];
                new = true;
        }
        /* struct copy */
                                    flow_cfg->max_flows - 1);
                        err = -EINVAL;
                } else {
-                       flow->entry = flow_cfg->flow_ent[flow->location];
                        err = otx2_add_flow_msg(pfvf, flow);
                }
        }