From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <hyonkim@cisco.com>
Received: from alln-iport-7.cisco.com (alln-iport-7.cisco.com [173.37.142.94])
 by dpdk.org (Postfix) with ESMTP id 3E1FF4CE4;
 Thu, 28 Feb 2019 08:06:13 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
 d=cisco.com; i=@cisco.com; l=1427; q=dns/txt; s=iport;
 t=1551337573; x=1552547173;
 h=from:to:cc:subject:date:message-id:in-reply-to: references;
 bh=fhn+uyjtcsIF5r3lXkgilf9flSuVGStPhrFoEr2nwus=;
 b=j2pm+o/e5mwzzK2oL+sjlFWP7BttdxUo/263ZBdwiQVtui6CXKfdsZUE
 pjMmy2WpN51zxxPnPINI5+OrkGM/wBx+SNTgPe6sSIFwPjYVt5F9CN4dB
 zaB6l8shYjidZIxTL2zFxrLb855HAfpk4EaOMnEveTSIFWsvGQndxfzF6 Y=;
X-IronPort-AV: E=Sophos;i="5.58,422,1544486400"; d="scan'208";a="240673121"
Received: from alln-core-11.cisco.com ([173.36.13.133])
 by alln-iport-7.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 28 Feb 2019 07:06:12 +0000
Received: from cisco.com (savbu-usnic-a.cisco.com [10.193.184.48])
 by alln-core-11.cisco.com (8.15.2/8.15.2) with ESMTP id x1S76CX9030143;
 Thu, 28 Feb 2019 07:06:12 GMT
Received: by cisco.com (Postfix, from userid 508933)
 id 2825620F2001; Wed, 27 Feb 2019 23:06:12 -0800 (PST)
From: Hyong Youb Kim <hyonkim@cisco.com>
To: Ferruh Yigit <ferruh.yigit@intel.com>
Cc: dev@dpdk.org, John Daley <johndale@cisco.com>,
 Hyong Youb Kim <hyonkim@cisco.com>, stable@dpdk.org
Date: Wed, 27 Feb 2019 23:03:14 -0800
Message-Id: <20190228070317.17002-13-hyonkim@cisco.com>
X-Mailer: git-send-email 2.16.2
In-Reply-To: <20190228070317.17002-1-hyonkim@cisco.com>
References: <20190228070317.17002-1-hyonkim@cisco.com>
X-Outbound-SMTP-Client: 10.193.184.48, savbu-usnic-a.cisco.com
X-Outbound-Node: alln-core-11.cisco.com
Subject: [dpdk-stable] [PATCH 12/15] net/enic: fix an endian bug in VLAN
	match
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Thu, 28 Feb 2019 07:06:13 -0000

The VLAN fields in the NIC filter use little endian. The VLAN item is
in big endian, so swap bytes.

Fixes: 6ced137607d0 ("net/enic: flow API for NICs with advanced filters enabled")
Cc: stable@dpdk.org

Signed-off-by: Hyong Youb Kim <hyonkim@cisco.com>
---
 drivers/net/enic/enic_flow.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/net/enic/enic_flow.c b/drivers/net/enic/enic_flow.c
index da43b31dc..b3172e7be 100644
--- a/drivers/net/enic/enic_flow.c
+++ b/drivers/net/enic/enic_flow.c
@@ -579,12 +579,16 @@ enic_copy_item_vlan_v2(struct copy_item_args *arg)
 		/* Outer TPID cannot be matched */
 		if (eth_mask->ether_type)
 			return ENOTSUP;
+		/*
+		 * 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.
+		 */
 		eth_mask->ether_type = mask->inner_type;
 		eth_val->ether_type = spec->inner_type;
-
-		/* Outer header. Use the vlan mask/val fields */
-		gp->mask_vlan = mask->tci;
-		gp->val_vlan = spec->tci;
+		/* 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);
 	} else {
 		/* Inner header. Mask/Val start at *inner_ofst into L5 */
 		if ((*inner_ofst + sizeof(struct vlan_hdr)) >
-- 
2.16.2