From patchwork Sat Apr 22 01:47:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Tu X-Patchwork-Id: 1772205 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=Nvidia.com header.i=@Nvidia.com header.a=rsa-sha256 header.s=selector2 header.b=hUfIOI3d; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q3DmY6TZlz23ts for ; Sat, 22 Apr 2023 11:47:41 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1pq2Lf-0002Aw-7Q; Sat, 22 Apr 2023 01:47:35 +0000 Received: from mail-dm6nam12on2084.outbound.protection.outlook.com ([40.107.243.84] helo=NAM12-DM6-obe.outbound.protection.outlook.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1pq2Lb-00028u-FE for kernel-team@lists.ubuntu.com; Sat, 22 Apr 2023 01:47:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GZ6Nv0CCF1/67U3yFC9mOS0uqFXtEtxmsxk1TcNGqC2aLDjZ5Q5871KhlCiWsfXueoUXO6bkmxy53wSYbqgoHCScJdPeVfExoqFv3eDOH26geE5wpcyqQQwcfHorKhtu+JoeQEBiqkoPtvde3QRxyCGjJJDofO3K2eZfe1rKd172A6dkh/8bKxUUenzFxj7HHPaQOuxLpCouw52S8WCfXpysXkirglj1GFKnezQNl/HI6QujMJOrcssgVfLA8ki67uUEtWf/JV+yjc8zevJMGNEtlOzyt8Y7tT5Gd5dv2m5bRSVeDByS+Q9yr5pX++QFuKka+HGpdJoqwgpqsByvtw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=k4alRp6LTVBaOnbhuFSLKNFtsJw5C3UcbRl0NvVQ/Cc=; b=KUvIxw4LM/FCPPTfplU8yqzBjSJqXVvDnoaawaT85U/9LtPEaTNQo+VuBkygkNDc3EYF6iqn8oK5Og0fO2eMezteHdADKiZKi0hVLQM/XswxD2wGr5XsLqwBr1jQ9NBz4KipqOhZmV4p/aGgO0ElLa7MOxjpGeGbI0e+lnzQo7BAfkDrkRJDpx0qfShkws6odlqGogkUzv+N+ocJ20wt2alADLIRV/fMF/H5B8J76ogRHhaqwMfBiOfIzm/01PbVzki8EpdVd3MXjNGtySp2IFigL7O0akYXZIQpJI3q2ZZhzbT7070OKnHvEMCm0aszz7ZpZnrrH8/QXVUImo03qw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=canonical.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject 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=k4alRp6LTVBaOnbhuFSLKNFtsJw5C3UcbRl0NvVQ/Cc=; b=hUfIOI3duF3nzgr3K/l1bFbfO49aypKkt3KZlHxPPiNAMch+DeA1ucbJ0dABQZoE4XVmkxHRuJE6DbrorCCsAzPtZ22Ne2jMpRJiPX8uY7ZjqsIsRkCYxlxcFdi4NtOCfXCSPK+j6ersEn+U0Tva4tf/GipQnt6RukxH1YvvaxWlXVfR1vD5x5J+Fnh4LoZC8YJMOrr8DIPACMNshtpW9lwBGNYX0pa9ac7va1Y6HKCH/vt5ULUb9g+AgzzYWxWGL6ZjbjpwxYCPYUC4E8BWKej6PFcIO1MuqFS631FhbAXITsJVzLOFdJPW2lJm1eFSR7iClXuwXlXQVdWsF4ON8g== Received: from DM6PR02CA0112.namprd02.prod.outlook.com (2603:10b6:5:1b4::14) by CY8PR12MB7121.namprd12.prod.outlook.com (2603:10b6:930:62::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.22; Sat, 22 Apr 2023 01:47:27 +0000 Received: from DM6NAM11FT071.eop-nam11.prod.protection.outlook.com (2603:10b6:5:1b4:cafe::37) by DM6PR02CA0112.outlook.office365.com (2603:10b6:5:1b4::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.25 via Frontend Transport; Sat, 22 Apr 2023 01:47:27 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by DM6NAM11FT071.mail.protection.outlook.com (10.13.173.48) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.27 via Frontend Transport; Sat, 22 Apr 2023 01:47:27 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Fri, 21 Apr 2023 18:47:17 -0700 Received: from rnnvmail203.nvidia.com (10.129.68.9) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Fri, 21 Apr 2023 18:47:17 -0700 Received: from mtl123.mtl.labs.mlnx (10.127.8.10) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37 via Frontend Transport; Fri, 21 Apr 2023 18:47:16 -0700 Received: from sw-mtx-002.mtx.labs.mlnx (sw-mtx-002.mtx.labs.mlnx [10.9.151.106]) by mtl123.mtl.labs.mlnx (8.14.4/8.14.4) with ESMTP id 33M1l76U008750; Sat, 22 Apr 2023 04:47:13 +0300 From: William Tu To: Subject: [SRU][F:linux-bluefield][PATCH v1 3/5] Revert "net/sched: flower: Move filter handle initialization earlier" Date: Sat, 22 Apr 2023 04:47:04 +0300 Message-ID: <20230422014706.594733-4-witu@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230422014706.594733-1-witu@nvidia.com> References: <20230422014706.594733-1-witu@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT071:EE_|CY8PR12MB7121:EE_ X-MS-Office365-Filtering-Correlation-Id: 81bb975c-f0fc-40b1-b548-08db42d386e1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kGpPf2F6heM44tRyHaRHtKIsgPYAT7jYH+gGX/+4qxIGvo/9kiZIY+ZlJgOxJ6AENlHyK5IJH1SN6GM0QjN4d7VsCpBrjB/7+A4HTct1WXNV9edJxW5ZDmUufgrJQp+ZEAseQ951OeE5ZtrQVGF30uzxVtbhx6LhM/wndFKfvEzgkKe6s1gd2EEnOrn/Woqh9bOrvkP6VVBjZUB4FSn/HoMqKQP9b8Xv5n7pUXl/ndaskzBl5sCboMcrfZaZjMSCWIQt8Ky/c0oDrgyBUzNvOpUMQQN57+TJP4aj6Qgvl7bZ9dhOLX5Uo4QAEweq7FZ3uwmSpsOP1vgCfxMN2o3HshxL2Oha8Xd/GY/LzCEuWbVfd9LxlHBlVbK+B+U/as+ocWWHn6UVk3d2EcNdyJID131Emmp7wk6cAhqsqyCi04e7GaKe9cUm1BQHiEvUf9N6klb2rExL9O1CqzPXnSQ6NQGZcI+6dKPhrZLNytpgkkQdTztLQJl7MHuRoP8zXNFtoomhJaoPYGX99kJ/VqrJfclXBOzVOB6Hd4UKMYYgp3io1jZmihedUlFDg66dl2EKaJfDlFTuJWlO02rAwoAKpuzXVRQLHex6tlRykfKO+TAXH6CTu4OfMIUUkYQoZUsmO8sat6y9sjYzJXEGpcEdVXSNfxOPE8rEI2bvu5f0Lf2mlyGm0j9BsMp08mU/bfdUw6wXM556jSP9RtQkq0H/jpvXolIzDRyq7hpEoYf/QN/q0CSvJQQCirNadbNyQR8xu7S+u3QJA4SPc4QftX31pDoLsO4FKdwhU+TbzYACmpM= X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230028)(4636009)(396003)(346002)(136003)(376002)(39860400002)(451199021)(40470700004)(36840700001)(46966006)(186003)(26005)(1076003)(6666004)(107886003)(40480700001)(5660300002)(41300700001)(47076005)(2616005)(336012)(70586007)(70206006)(6916009)(4326008)(8676002)(8936002)(54906003)(478600001)(82740400003)(2906002)(316002)(86362001)(36756003)(83380400001)(40460700003)(36860700001)(7636003)(34020700004)(356005)(82310400005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Apr 2023 01:47:27.0122 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 81bb975c-f0fc-40b1-b548-08db42d386e1 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT071.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7121 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dann.frazier@canonical.com, paulb@nvidia.com, vlad@nvidia.com, yifeid@nvidia.com, bodong@nvidia.com Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" This reverts commit 0e6ec758d0354671ddd40e4f254e96bcf159aad2. --- net/sched/cls_flower.c | 62 ++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 35 deletions(-) diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c index 3ef5206cbcbb..f47ae62b7215 100644 --- a/net/sched/cls_flower.c +++ b/net/sched/cls_flower.c @@ -1828,6 +1828,10 @@ static int fl_change(struct net *net, struct sk_buff *in_skb, INIT_LIST_HEAD(&fnew->hw_list); refcount_set(&fnew->refcnt, 1); + err = tcf_exts_init(&fnew->exts, net, TCA_FLOWER_ACT, 0); + if (err < 0) + goto errout; + if (tb[TCA_FLOWER_FLAGS]) { fnew->flags = nla_get_u32(tb[TCA_FLOWER_FLAGS]); @@ -1837,44 +1841,14 @@ static int fl_change(struct net *net, struct sk_buff *in_skb, } } - if (!fold) { - spin_lock(&tp->lock); - if (!handle) { - handle = 1; - err = idr_alloc_u32(&head->handle_idr, fnew, &handle, - INT_MAX, GFP_ATOMIC); - } else { - err = idr_alloc_u32(&head->handle_idr, fnew, &handle, - handle, GFP_ATOMIC); - - /* Filter with specified handle was concurrently - * inserted after initial check in cls_api. This is not - * necessarily an error if NLM_F_EXCL is not set in - * message flags. Returning EAGAIN will cause cls_api to - * try to update concurrently inserted rule. - */ - if (err == -ENOSPC) - err = -EAGAIN; - } - spin_unlock(&tp->lock); - - if (err) - goto errout; - } - fnew->handle = handle; - - err = tcf_exts_init(&fnew->exts, net, TCA_FLOWER_ACT, 0); - if (err < 0) - goto errout_idr; - err = fl_set_parms(net, tp, fnew, mask, base, tb, tca[TCA_RATE], ovr, tp->chain->tmplt_priv, rtnl_held, extack); if (err) - goto errout_idr; + goto errout; err = fl_check_assign_mask(head, fnew, fold, mask); if (err) - goto errout_idr; + goto errout; err = fl_ht_insert_unique(fnew, fold, &in_ht); if (err) @@ -1940,9 +1914,29 @@ static int fl_change(struct net *net, struct sk_buff *in_skb, refcount_dec(&fold->refcnt); __fl_put(fold); } else { - idr_replace(&head->handle_idr, fnew, fnew->handle); + if (handle) { + /* user specifies a handle and it doesn't exist */ + err = idr_alloc_u32(&head->handle_idr, fnew, &handle, + handle, GFP_ATOMIC); + + /* Filter with specified handle was concurrently + * inserted after initial check in cls_api. This is not + * necessarily an error if NLM_F_EXCL is not set in + * message flags. Returning EAGAIN will cause cls_api to + * try to update concurrently inserted rule. + */ + if (err == -ENOSPC) + err = -EAGAIN; + } else { + handle = 1; + err = idr_alloc_u32(&head->handle_idr, fnew, &handle, + INT_MAX, GFP_ATOMIC); + } + if (err) + goto errout_hw; refcount_inc(&fnew->refcnt); + fnew->handle = handle; list_add_tail_rcu(&fnew->list, &fnew->mask->filters); spin_unlock(&tp->lock); } @@ -1965,8 +1959,6 @@ static int fl_change(struct net *net, struct sk_buff *in_skb, fnew->mask->filter_ht_params); errout_mask: fl_mask_put(head, fnew->mask); -errout_idr: - idr_remove(&head->handle_idr, fnew->handle); errout: __fl_put(fnew); errout_tb: