From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hyong Youb Kim Subject: [PATCH 12/15] net/enic: fix an endian bug in VLAN match Date: Wed, 27 Feb 2019 23:03:14 -0800 Message-ID: <20190228070317.17002-13-hyonkim@cisco.com> References: <20190228070317.17002-1-hyonkim@cisco.com> Cc: dev@dpdk.org, John Daley , Hyong Youb Kim , stable@dpdk.org To: Ferruh Yigit Return-path: In-Reply-To: <20190228070317.17002-1-hyonkim@cisco.com> 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)) > -- 2.16.2