From patchwork Thu Feb 28 07:03:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hyong Youb Kim (hyonkim)" X-Patchwork-Id: 50609 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 29BB74D3A; Thu, 28 Feb 2019 08:06:15 +0100 (CET) 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 To: Ferruh Yigit Cc: dev@dpdk.org, John Daley , Hyong Youb Kim , 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-dev] [PATCH 12/15] net/enic: fix an endian bug in VLAN match X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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)) >