From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from alln-iport-5.cisco.com (alln-iport-5.cisco.com [173.37.142.92]) by dpdk.org (Postfix) with ESMTP id BB4DF2B9E; Sat, 2 Mar 2019 11:46:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=3229; q=dns/txt; s=iport; t=1551523563; x=1552733163; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=Q5FVgCoRgrL12wvL5QS9YvoEWhpOFA+f+o/eDOFZaBo=; b=ZXgF4kOO8qDnGXZ0ULvzL/YFkMXVHEa2TM05VHcXudJoF+A7BjqiVVAv b2geRzLTV9iOH+OvIUxs2G7HwonYcTBkK93lnPsMVYcFqu+h9K8lTrlnI Px6B2rN0b3Xa+/INXLyMuZHAhOFcZ8gg3b55U3ZG+hWQRNbtJFIkbdyaa 4=; X-IronPort-AV: E=Sophos;i="5.58,431,1544486400"; d="scan'208";a="241307553" Received: from rcdn-core-11.cisco.com ([173.37.93.147]) by alln-iport-5.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Mar 2019 10:46:01 +0000 Received: from cisco.com (savbu-usnic-a.cisco.com [10.193.184.48]) by rcdn-core-11.cisco.com (8.15.2/8.15.2) with ESMTP id x22Ak0Cn004550; Sat, 2 Mar 2019 10:46:00 GMT Received: by cisco.com (Postfix, from userid 508933) id 9131520F2001; Sat, 2 Mar 2019 02:46:00 -0800 (PST) From: Hyong Youb Kim To: Ferruh Yigit Cc: dev@dpdk.org, John Daley , Hyong Youb Kim , stable@dpdk.org Date: Sat, 2 Mar 2019 02:42:50 -0800 Message-Id: <20190302104251.32565-13-hyonkim@cisco.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20190302104251.32565-1-hyonkim@cisco.com> References: <20190302104251.32565-1-hyonkim@cisco.com> X-Outbound-SMTP-Client: 10.193.184.48, savbu-usnic-a.cisco.com X-Outbound-Node: rcdn-core-11.cisco.com Subject: [dpdk-dev] [PATCH v2 12/13] 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: , X-List-Received-Date: Sat, 02 Mar 2019 10:46:03 -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 --- doc/guides/nics/enic.rst | 10 ++++++++-- drivers/net/enic/enic_flow.c | 12 ++++++++---- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/doc/guides/nics/enic.rst b/doc/guides/nics/enic.rst index c1415dc0d..d4241ef45 100644 --- a/doc/guides/nics/enic.rst +++ b/doc/guides/nics/enic.rst @@ -247,7 +247,7 @@ Generic Flow API is supported. The baseline support is: in the pattern. - Attributes: ingress - - Items: eth, ipv4, ipv6, udp, tcp, vxlan, inner eth, ipv4, ipv6, udp, tcp + - Items: eth, vlan, ipv4, ipv6, udp, tcp, vxlan, inner eth, vlan, ipv4, ipv6, udp, tcp - Actions: queue and void - Selectors: 'is', 'spec' and 'mask'. 'last' is not supported - In total, up to 64 bytes of mask is allowed across all headers @@ -255,7 +255,7 @@ Generic Flow API is supported. The baseline support is: - **1300 and later series VICS with advanced filters enabled** - Attributes: ingress - - Items: eth, ipv4, ipv6, udp, tcp, vxlan, raw, inner eth, ipv4, ipv6, udp, tcp + - Items: eth, vlan, ipv4, ipv6, udp, tcp, vxlan, raw, inner eth, vlan, ipv4, ipv6, udp, tcp - Actions: queue, mark, drop, flag, rss, passthru, and void - Selectors: 'is', 'spec' and 'mask'. 'last' is not supported - In total, up to 64 bytes of mask is allowed across all headers @@ -266,6 +266,12 @@ Generic Flow API is supported. The baseline support is: - Action: count +The VIC performs packet matching after applying VLAN strip. If VLAN +stripping is enabled, EtherType in the ETH item corresponds to the +stripped VLAN header's EtherType. Stripping does not affect the VLAN +item. TCI and EtherType in the VLAN item are matched against those in +the (stripped) VLAN header whether stripping is enabled or disabled. + More features may be added in future firmware and new versions of the VIC. Please refer to the release notes. 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