From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 13F63A05D3 for ; Fri, 26 Apr 2019 09:08:08 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0766A1B431; Fri, 26 Apr 2019 09:08:08 +0200 (CEST) Received: from rcdn-iport-5.cisco.com (rcdn-iport-5.cisco.com [173.37.86.76]) by dpdk.org (Postfix) with ESMTP id 7391A1B431 for ; Fri, 26 Apr 2019 09:08:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=2557; q=dns/txt; s=iport; t=1556262486; x=1557472086; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=0daG5f/THJMjszPj0digVv6uJQOqbwYspLJTURhWa8Y=; b=lSb124h33f22irt03ZS0WNzhR8hCZkhnR5sENdLX7pz0dl6lRMLdb4rp TDbwC60ArBP4sbPKK3V+2BDk2naDEO0TgtBd9HcyHqDnsaiqWP/ytI76B 7yVzTqNEdax7e8YovEy+4Fw57CbKbktozLQBxZwyhEqaIK9w39FDz5Cqy Y=; X-IronPort-AV: E=Sophos;i="5.60,396,1549929600"; d="scan'208";a="332816043" Received: from rcdn-core-12.cisco.com ([173.37.93.148]) by rcdn-iport-5.cisco.com with ESMTP/TLS/DHE-RSA-SEED-SHA; 26 Apr 2019 07:08:05 +0000 Received: from cisco.com (savbu-usnic-a.cisco.com [10.193.184.48]) by rcdn-core-12.cisco.com (8.15.2/8.15.2) with ESMTP id x3Q784L7027011; Fri, 26 Apr 2019 07:08:04 GMT Received: by cisco.com (Postfix, from userid 508933) id 6EB0820F2001; Fri, 26 Apr 2019 00:08:04 -0700 (PDT) From: Hyong Youb Kim To: stable@dpdk.org, Kevin Traynor Cc: John Daley , Hyong Youb Kim Date: Fri, 26 Apr 2019 00:05:20 -0700 Message-Id: <20190426070520.12375-4-hyonkim@cisco.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20190426070520.12375-1-hyonkim@cisco.com> References: <20190426070520.12375-1-hyonkim@cisco.com> X-Outbound-SMTP-Client: 10.193.184.48, savbu-usnic-a.cisco.com X-Outbound-Node: rcdn-core-12.cisco.com Subject: [dpdk-stable] [PATCH 18.11 3/3] net/enic: fix VLAN inner type matching for old hardware X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" [ upstream commit 6e54c8ac5c15935d42d47950a55406c7f5517117 ] The vlan pattern handler currently assumes the NIC always strips vlan header from the L2 buffer, regardless of the vlan strip setting. But, with older VIC models, the vlan header is actually present in the L2 buffer if stripping is disabled. So in this case, the inner ether type needs to be shifted by that much. Fixes: 6ced137607d0 ("net/enic: flow API for NICs with advanced filters enabled") Signed-off-by: Hyong Youb Kim Reviewed-by: John Daley --- drivers/net/enic/enic_flow.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/drivers/net/enic/enic_flow.c b/drivers/net/enic/enic_flow.c index ab6783f67..dbc8de839 100644 --- a/drivers/net/enic/enic_flow.c +++ b/drivers/net/enic/enic_flow.c @@ -39,6 +39,7 @@ struct copy_item_args { uint8_t *inner_ofst; uint8_t l2_proto_off; uint8_t l3_proto_off; + struct enic *enic; }; /* functions for copying items into enic filters */ @@ -698,12 +699,26 @@ enic_copy_item_vlan_v2(struct copy_item_args *arg) if (eth_mask->ether_type) return ENOTSUP; /* + * For recent models: * When packet matching, the VIC always compares vlan-stripped * L2, regardless of vlan stripping settings. So, the inner type * from vlan becomes the ether type of the eth header. + * + * Older models w/o hardware vxlan parser have a different + * behavior when vlan stripping is disabled. In this case, + * vlan tag remains in the L2 buffer. */ - eth_mask->ether_type = mask->inner_type; - eth_val->ether_type = spec->inner_type; + if (!arg->enic->vxlan && !arg->enic->ig_vlan_strip_en) { + struct vlan_hdr *vlan; + + vlan = (struct vlan_hdr *)(eth_mask + 1); + vlan->eth_proto = mask->inner_type; + vlan = (struct vlan_hdr *)(eth_val + 1); + vlan->eth_proto = spec->inner_type; + } else { + eth_mask->ether_type = mask->inner_type; + eth_val->ether_type = spec->inner_type; + } /* For TCI, use the vlan mask/val fields (little endian). */ gp->mask_vlan = rte_be_to_cpu_16(mask->tci); gp->val_vlan = rte_be_to_cpu_16(spec->tci); @@ -1009,6 +1024,7 @@ enic_copy_filter(const struct rte_flow_item pattern[], args.filter = enic_filter; args.inner_ofst = &inner_ofst; + args.enic = enic; for (; item->type != RTE_FLOW_ITEM_TYPE_END; item++) { /* Get info about how to validate and copy the item. If NULL * is returned the nic does not support the item. -- 2.16.2