DPDK patches and discussions
 help / color / mirror / Atom feed
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
Subject: [dpdk-dev] [PATCH v2 12/13] net/enic: fix an endian bug in VLAN match
Date: Sat,  2 Mar 2019 02:42:50 -0800	[thread overview]
Message-ID: <20190302104251.32565-13-hyonkim@cisco.com> (raw)
In-Reply-To: <20190302104251.32565-1-hyonkim@cisco.com>

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>
---
 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

  parent reply	other threads:[~2019-03-02 10:46 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-02 10:42 [dpdk-dev] [PATCH v2 00/13] net/enic: 19.05 updates Hyong Youb Kim
2019-03-02 10:42 ` [dpdk-dev] [PATCH v2 01/13] net/enic: remove unused code Hyong Youb Kim
2019-03-02 10:42 ` [dpdk-dev] [PATCH v2 02/13] net/enic: fix flow director SCTP matching Hyong Youb Kim
2019-03-02 10:42 ` [dpdk-dev] [PATCH v2 03/13] net/enic: fix SCTP match for flow API Hyong Youb Kim
2019-03-02 10:42 ` [dpdk-dev] [PATCH v2 04/13] net/enic: allow flow mark ID 0 Hyong Youb Kim
2019-03-02 10:42 ` [dpdk-dev] [PATCH v2 05/13] net/enic: check for unsupported flow item types Hyong Youb Kim
2019-03-02 10:42 ` [dpdk-dev] [PATCH v2 06/13] net/enic: enable limited RSS flow action Hyong Youb Kim
2019-03-02 10:42 ` [dpdk-dev] [PATCH v2 07/13] net/enic: enable limited PASSTHRU " Hyong Youb Kim
2019-03-02 10:42 ` [dpdk-dev] [PATCH v2 08/13] net/enic: move arguments into struct Hyong Youb Kim
2019-03-02 10:42 ` [dpdk-dev] [PATCH v2 09/13] net/enic: enable limited support for RAW flow item Hyong Youb Kim
2019-03-02 10:42 ` [dpdk-dev] [PATCH v2 10/13] net/enic: reset VXLAN port regardless of overlay offload Hyong Youb Kim
2019-03-02 10:42 ` [dpdk-dev] [PATCH v2 11/13] net/enic: fix a couple issues with VXLAN match Hyong Youb Kim
2019-03-02 10:42 ` Hyong Youb Kim [this message]
2019-03-02 10:42 ` [dpdk-dev] [PATCH v2 13/13] net/enic: fix several issues with inner packet matching Hyong Youb Kim
2019-03-04 16:58   ` Ferruh Yigit
2019-04-10 17:06     ` Kevin Traynor
2019-04-10 17:06       ` Kevin Traynor
2019-03-04 16:56 ` [dpdk-dev] [PATCH v2 00/13] net/enic: 19.05 updates Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190302104251.32565-13-hyonkim@cisco.com \
    --to=hyonkim@cisco.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=johndale@cisco.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).