From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 92303A0A0E for ; Mon, 10 May 2021 18:07:03 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8C14F4003E; Mon, 10 May 2021 18:07:03 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2040.outbound.protection.outlook.com [40.107.220.40]) by mails.dpdk.org (Postfix) with ESMTP id 410D7410FE for ; Mon, 10 May 2021 18:07:02 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H0w/W9tdMsFNz2DN85Ll4xHXvKf6WZn4OZyHJk1K4wnt6vwfdni/VBc2H/XEXF+2Sz2rVOAW0cwt2xV9QOgAE7O14U+d+Ln+rBv8CZZh8bcJi/YE29t+M6jWtcDOtJ7KfaIvbgwH+4YeX6pBTkngZKgStxElXH5EjgbDE/GgfDzJS8c0NT7RoKCVGYJdlU7E+LPB4Bl0UqJ/r0z9uIcVrPYVIlu22DDRWo31s0DUMD1E/i6KDBJXFwHZakWMXxzE8K2By1mRk0Tb4dqeQ2i2BEIgXGMDyLI2laBL/Xuhx30hbMbQsNii9/utc1e7WNP4sUJBJQl0BrjxeHWFMts/sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lTwO0ZpN9b0xGD961SDows1SCHgHpavzmCxSNCJE1S0=; b=LKsOQvkL4imIMBS4JQOw2YJi8MzwZWsu6U2m0AE09rpteaTFlQbG9nSgduNkc8fR6526fcRa/PVkc266qWRnzibM3HnZE1NO+kxueinpClYbUU/tpgKgssErPnOE8Rxtv0Uf5rnE55x9IWXcd8ffs0wFdrxw2IlzHiMwGmq9Q4bheChLfdhx5D8cc9FB8qlrVpLoHDQm73/j20AjRdSOKmHviXYvkT9QBV8/8+arTHx02w5z1cmRgdxxNDaZcNRM7raKPkSbnxzSW/NnAvEj+uH1Uxfqwgn0HdjiSd6sddPIbtLuexX6nHFvgTSDwQMT9FfCFj4xK16MD1OJoISMFQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=intel.com smtp.mailfrom=nvidia.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lTwO0ZpN9b0xGD961SDows1SCHgHpavzmCxSNCJE1S0=; b=l0i+AP3BVDk6Br2qwu+ih5jYk5F2uQVXWx+NSqIlk18wXIQSH7p1dl8JWSNrUAPUxNaFI8C5WZPH2sWXCxbC5sniZc0a2t5cXbV9UlkVsWMRwW/0tfsAxbYvo7EaQxt9WWURxetYQPoVGohj6bA1aVT2XdCGnnP+i27TpHgz9Pv4/r12Le7zz3YXzR2QaEHhhN9LQ96P4ksOsO9lPVCdoB1VAU/1VhxvqxcdX+kF6RlNODm8v+qsV8JkwaZ4PUByHUxpWvxkkkMv7jkuKPolIQ0ZdrohZLkoYihvRed9rCn3EuiSHQM6rV59wr7Hp7yhIM1G2EF23+xxkO+fAvYBJg== Received: from BN7PR06CA0056.namprd06.prod.outlook.com (2603:10b6:408:34::33) by MWHPR12MB1374.namprd12.prod.outlook.com (2603:10b6:300:12::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.26; Mon, 10 May 2021 16:07:00 +0000 Received: from BN8NAM11FT036.eop-nam11.prod.protection.outlook.com (2603:10b6:408:34:cafe::be) by BN7PR06CA0056.outlook.office365.com (2603:10b6:408:34::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Mon, 10 May 2021 16:07:00 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by BN8NAM11FT036.mail.protection.outlook.com (10.13.177.168) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4108.25 via Frontend Transport; Mon, 10 May 2021 16:07:00 +0000 Received: from nvidia.com (172.20.145.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 10 May 2021 16:06:57 +0000 From: Xueming Li To: Xiaoyun Li CC: Luca Boccassi , Beilei Xing , dpdk stable Date: Mon, 10 May 2021 23:59:49 +0800 Message-ID: <20210510160258.30982-40-xuemingl@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210510160258.30982-1-xuemingl@nvidia.com> References: <20210510160258.30982-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.145.6] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 347ff8d2-257b-4389-0cfb-08d913cda4db X-MS-TrafficTypeDiagnostic: MWHPR12MB1374: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JhrWse8Mu70e2kUF5u7qeuZL7w0wEizIRCVxdDzNHnPYXZD/qE8uRGcqu1GqxsLMJRUbJBtkzJQdD4PGKPb3tNBm79jfWslb234u21hS/ha66GMWWzj4hx+Tb4+Nn6AsG5IYkJ8d3Jv0cqkshhKU4yPDcwr6DcyrOA7fVNoNpBhSGhcOPF40OoJQwJc18DI40rCT84WvNi+M/ivD/MI/T67dMQTi/3AtYApULzbNw8qDIzak+XblN26aMtZi1H5O1pqXWwb82PwfC7/8kWBHzkIIT1FCn3wCAhNaT0TD8IhEjQdjhlPTT2Oc+IMOC5rDYSYqueTZvnugCcW71ERiJbFUJSFzojwsfUqWQCAGiTELEURZwPQVX3Gxr/k6glRFb9pezukKwYXphkwWCoWWqay7kepH7yMUk0vfceGZKRCU0mw1Ym4YtVV05n5IshUl1bAqVI3kS8cNITZGFkWy7GFUqNClLTdhflwBrzAeE31ByMHphHoUGfoOte291joOqOiHQHOWUbHXqS2pskFFX1gvFbCEsI3r00RHbYdjyfKu/56lATN/HXReas0w/2dgD6YG/T63qZjsIa04iCsZupQIlgbrkwY41eQPy/qXeGkJd0qCQWFu1oqvACVvCqVh/dbgFYoDad2KYf7c2TFtpC5gsIsP8+suXX5Vu6eLU9UsyH0ifrl4jlsw/CV1cxYQHUY0YZoxjJhE4pgnL6NUmxQElRhciZGpjj1ch/HXUc0= X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(396003)(136003)(39860400002)(376002)(346002)(36840700001)(46966006)(1076003)(26005)(186003)(4326008)(16526019)(356005)(8936002)(82310400003)(316002)(82740400003)(36906005)(47076005)(54906003)(6286002)(55016002)(83380400001)(2906002)(966005)(70206006)(336012)(70586007)(36756003)(36860700001)(86362001)(53546011)(478600001)(7696005)(2616005)(6666004)(6916009)(426003)(7636003)(8676002)(5660300002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 May 2021 16:07:00.2929 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 347ff8d2-257b-4389-0cfb-08d913cda4db X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT036.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1374 Subject: [dpdk-stable] patch 'net/i40e: fix IPv4 fragment offload' has been queued to stable release 20.11.2 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 20.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/12/21. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/steevenlee/dpdk This queued commit can be viewed at: https://github.com/steevenlee/dpdk/commit/d0de930b7b5cd26106ad1660628283acf20af2b3 Thanks. Xueming Li --- >From d0de930b7b5cd26106ad1660628283acf20af2b3 Mon Sep 17 00:00:00 2001 From: Xiaoyun Li Date: Tue, 2 Mar 2021 15:03:20 +0800 Subject: [PATCH] net/i40e: fix IPv4 fragment offload Cc: Luca Boccassi [ upstream commit 10127dbacf7c041a1b67b9e962635b31184bd604 ] IPv4 fragment_offset mask was required to be 0 no matter what the spec value was. But zero mask means not caring about fragment_offset field then both non-frag and frag packets should hit the rule. But the actual fragment rules should be like the following: Only non-fragment packets can hit Rule 1: Rule 1: mask=0x3fff, spec=0 Only fragment packets can hit rule 2: Rule 2: mask=0x3fff, spec=0x8, last=0x2000 This patch allows the above rules. Fixes: 42044b69c67d ("net/i40e: support input set selection for FDIR") Signed-off-by: Xiaoyun Li Acked-by: Beilei Xing --- drivers/net/i40e/i40e_flow.c | 87 ++++++++++++++++++++++++++++++++---- 1 file changed, 78 insertions(+), 9 deletions(-) diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c index bbd666b7a0..5bef8c76a7 100644 --- a/drivers/net/i40e/i40e_flow.c +++ b/drivers/net/i40e/i40e_flow.c @@ -2433,7 +2433,7 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, const struct rte_flow_item *item = pattern; const struct rte_flow_item_eth *eth_spec, *eth_mask; const struct rte_flow_item_vlan *vlan_spec, *vlan_mask; - const struct rte_flow_item_ipv4 *ipv4_spec, *ipv4_mask; + const struct rte_flow_item_ipv4 *ipv4_spec, *ipv4_last, *ipv4_mask; const struct rte_flow_item_ipv6 *ipv6_spec, *ipv6_mask; const struct rte_flow_item_tcp *tcp_spec, *tcp_mask; const struct rte_flow_item_udp *udp_spec, *udp_mask; @@ -2446,7 +2446,6 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, uint8_t pctype = 0; uint64_t input_set = I40E_INSET_NONE; - uint16_t frag_off; enum rte_flow_item_type item_type; enum rte_flow_item_type next_type; enum rte_flow_item_type l3 = RTE_FLOW_ITEM_TYPE_END; @@ -2472,7 +2471,7 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, memset(len_arr, 0, sizeof(len_arr)); filter->input.flow_ext.customized_pctype = false; for (; item->type != RTE_FLOW_ITEM_TYPE_END; item++) { - if (item->last) { + if (item->last && item->type != RTE_FLOW_ITEM_TYPE_IPV4) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, @@ -2611,15 +2610,40 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, l3 = RTE_FLOW_ITEM_TYPE_IPV4; ipv4_spec = item->spec; ipv4_mask = item->mask; + ipv4_last = item->last; pctype = I40E_FILTER_PCTYPE_NONF_IPV4_OTHER; layer_idx = I40E_FLXPLD_L3_IDX; + if (ipv4_last) { + if (!ipv4_spec || !ipv4_mask || !outer_ip) { + rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ITEM, + item, + "Not support range"); + return -rte_errno; + } + /* Only fragment_offset supports range */ + if (ipv4_last->hdr.version_ihl || + ipv4_last->hdr.type_of_service || + ipv4_last->hdr.total_length || + ipv4_last->hdr.packet_id || + ipv4_last->hdr.time_to_live || + ipv4_last->hdr.next_proto_id || + ipv4_last->hdr.hdr_checksum || + ipv4_last->hdr.src_addr || + ipv4_last->hdr.dst_addr) { + rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ITEM, + item, + "Not support range"); + return -rte_errno; + } + } if (ipv4_spec && ipv4_mask && outer_ip) { /* Check IPv4 mask and update input set */ if (ipv4_mask->hdr.version_ihl || ipv4_mask->hdr.total_length || ipv4_mask->hdr.packet_id || - ipv4_mask->hdr.fragment_offset || ipv4_mask->hdr.hdr_checksum) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, @@ -2640,11 +2664,56 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, input_set |= I40E_INSET_IPV4_PROTO; /* Check if it is fragment. */ - frag_off = ipv4_spec->hdr.fragment_offset; - frag_off = rte_be_to_cpu_16(frag_off); - if (frag_off & RTE_IPV4_HDR_OFFSET_MASK || - frag_off & RTE_IPV4_HDR_MF_FLAG) - pctype = I40E_FILTER_PCTYPE_FRAG_IPV4; + uint16_t frag_mask = + ipv4_mask->hdr.fragment_offset; + uint16_t frag_spec = + ipv4_spec->hdr.fragment_offset; + uint16_t frag_last = 0; + if (ipv4_last) + frag_last = + ipv4_last->hdr.fragment_offset; + if (frag_mask) { + frag_mask = rte_be_to_cpu_16(frag_mask); + frag_spec = rte_be_to_cpu_16(frag_spec); + frag_last = rte_be_to_cpu_16(frag_last); + /* frag_off mask has to be 0x3fff */ + if (frag_mask != + (RTE_IPV4_HDR_OFFSET_MASK | + RTE_IPV4_HDR_MF_FLAG)) { + rte_flow_error_set(error, + EINVAL, + RTE_FLOW_ERROR_TYPE_ITEM, + item, + "Invalid IPv4 fragment_offset mask"); + return -rte_errno; + } + /* + * non-frag rule: + * mask=0x3fff,spec=0 + * frag rule: + * mask=0x3fff,spec=0x8,last=0x2000 + */ + if (frag_spec == + (1 << RTE_IPV4_HDR_FO_SHIFT) && + frag_last == RTE_IPV4_HDR_MF_FLAG) { + pctype = + I40E_FILTER_PCTYPE_FRAG_IPV4; + } else if (frag_spec || frag_last) { + rte_flow_error_set(error, + EINVAL, + RTE_FLOW_ERROR_TYPE_ITEM, + item, + "Invalid IPv4 fragment_offset rule"); + return -rte_errno; + } + } else if (frag_spec || frag_last) { + rte_flow_error_set(error, + EINVAL, + RTE_FLOW_ERROR_TYPE_ITEM, + item, + "Invalid fragment_offset"); + return -rte_errno; + } if (input_set & (I40E_INSET_DMAC | I40E_INSET_SMAC)) { if (input_set & (I40E_INSET_IPV4_SRC | -- 2.25.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-05-10 23:59:27.728231900 +0800 +++ 0041-net-i40e-fix-IPv4-fragment-offload.patch 2021-05-10 23:59:26.380000000 +0800 @@ -1 +1 @@ -From 10127dbacf7c041a1b67b9e962635b31184bd604 Mon Sep 17 00:00:00 2001 +From d0de930b7b5cd26106ad1660628283acf20af2b3 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Luca Boccassi + +[ upstream commit 10127dbacf7c041a1b67b9e962635b31184bd604 ] @@ -19 +21,0 @@ -Cc: stable@dpdk.org @@ -28 +30 @@ -index 4d44282312..3e514d5f38 100644 +index bbd666b7a0..5bef8c76a7 100644