From patchwork Wed Sep 9 14:00:04 2020 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: 77060 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 228DFA04B5; Wed, 9 Sep 2020 16:02:14 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 74C031C0CF; Wed, 9 Sep 2020 16:02:12 +0200 (CEST) Received: from rcdn-iport-6.cisco.com (rcdn-iport-6.cisco.com [173.37.86.77]) by dpdk.org (Postfix) with ESMTP id 2624A1C0C9; Wed, 9 Sep 2020 16:02:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=2464; q=dns/txt; s=iport; t=1599660131; x=1600869731; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=COCBbWzT2qOqvw7ujjZb8YzIHUj3bkcIgN1KZ6/pETc=; b=T9sVqGJwVOe94AIZRt81yQlZGx8iDf3OmV3afIGebMTSOHtp+5oA5tfE RyBXrWKQVstTjK41VbhWFLlOAxoerxE6n8eF+V41A/CFteSxbypfbcxL2 fW4VmfHqyv00OZIuiNnOfTjGrYxPDXkhB8lIKyddrxFhf2MTvifspg5rv I=; X-IronPort-AV: E=Sophos;i="5.76,409,1592870400"; d="scan'208";a="825414301" Received: from rcdn-core-5.cisco.com ([173.37.93.156]) by rcdn-iport-6.cisco.com with ESMTP/TLS/DHE-RSA-SEED-SHA; 09 Sep 2020 14:01:40 +0000 Received: from cisco.com (savbu-usnic-a.cisco.com [10.193.184.48]) by rcdn-core-5.cisco.com (8.15.2/8.15.2) with ESMTP id 089E1d7N010427; Wed, 9 Sep 2020 14:01:40 GMT Received: by cisco.com (Postfix, from userid 508933) id 79BAE20F2005; Wed, 9 Sep 2020 07:01:39 -0700 (PDT) From: Hyong Youb Kim To: Ferruh Yigit Cc: dev@dpdk.org, Hyong Youb Kim , stable@dpdk.org, John Daley Date: Wed, 9 Sep 2020 07:00:04 -0700 Message-Id: <20200909140006.23788-5-hyonkim@cisco.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200909140006.23788-1-hyonkim@cisco.com> References: <20200909140006.23788-1-hyonkim@cisco.com> MIME-Version: 1.0 X-Outbound-SMTP-Client: 10.193.184.48, savbu-usnic-a.cisco.com X-Outbound-Node: rcdn-core-5.cisco.com Subject: [dpdk-dev] [PATCH 4/6] net/enic: ignore vlan inner type when it is zero 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" When a VLAN pattern is present, the flow handler always copies its inner_type to the match buffer regardless of its value (i.e. HW matches inner_type against packet's inner ethertype). When inner_type spec and mask are both 0, adding it to the match buffer is usually harmless but breaks the following pattern used in some applications like OVS-DPDK. flow create 0 ingress ... pattern eth ... type is 0x0800 / vlan tci spec 0x2 \ tci mask 0xefff / ipv4 / end actions count / of_pop_vlan / ... The VLAN pattern's inner_type is 0. And the outer eth pattern's type actually specifies the inner ethertype. The outer ethertype (0x0800) is first copied to the match buffer. Then, the driver copies inner_type (0) to the match buffer, which overwrites the existing 0x0800 with 0 and breaks the app usage above. Simply ignore inner_type when it is 0, which is the correct behavior. As a byproduct, the driver can support the usage like the above. Fixes: ea7768b5bba8 ("net/enic: add flow implementation based on Flow Manager API") Cc: stable@dpdk.org Signed-off-by: Hyong Youb Kim Reviewed-by: John Daley --- drivers/net/enic/enic_fm_flow.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/net/enic/enic_fm_flow.c b/drivers/net/enic/enic_fm_flow.c index 5f22f2a32..a350b29a3 100644 --- a/drivers/net/enic/enic_fm_flow.c +++ b/drivers/net/enic/enic_fm_flow.c @@ -392,8 +392,11 @@ enic_fm_copy_item_vlan(struct copy_item_args *arg) eth_mask = (void *)&fm_mask->l2.eth; eth_val = (void *)&fm_data->l2.eth; - /* Outer TPID cannot be matched */ - if (eth_mask->ether_type) + /* + * Outer TPID cannot be matched. If inner_type is 0, use what is + * in the eth header. + */ + if (eth_mask->ether_type && mask->inner_type) return -ENOTSUP; /* @@ -401,8 +404,10 @@ enic_fm_copy_item_vlan(struct copy_item_args *arg) * 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; + if (mask->inner_type) { + eth_mask->ether_type = mask->inner_type; + eth_val->ether_type = spec->inner_type; + } fm_data->fk_header_select |= FKH_ETHER | FKH_QTAG; fm_mask->fk_header_select |= FKH_ETHER | FKH_QTAG; fm_data->fk_vlan = rte_be_to_cpu_16(spec->tci);