From patchwork Thu May 11 17:38:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Tu X-Patchwork-Id: 1780220 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=Uqol9fco; 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 4QHK002s5bz214l for ; Fri, 12 May 2023 03:39:27 +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 1pxAG7-0005Bt-Er; Thu, 11 May 2023 17:39:19 +0000 Received: from mail-mw2nam12on2054.outbound.protection.outlook.com ([40.107.244.54] helo=NAM12-MW2-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 1pxAG4-0005B5-75 for kernel-team@lists.ubuntu.com; Thu, 11 May 2023 17:39:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b/eGs2sbv6W6OJWkzczHM+zsWflbJ0cuRFvhZIj9Flsu4WgcGwQrLn0EayNDzQcZrw2HLTN2lG3wALY8BDV3FiT0VKef6w29wz+Psh7gV6AF52Q/2B2RkYwqKv+eIaasqZzjJG8KCKz2uSrBXOv18761kexFcUfw3Cw4YPepmVlJ3WgwTdkh8EN0xDcokAgFz2Hw3qESaqce3qFW2qBxkob1efj8O9NKUNiGAhEOyodQpInzC9yycSQZ9pI6kMnwBhcHxrVXJV2YKJ8k8zAIYBRfhx0AuRnkodVl9PBF75c+hV46FCeiu5lxreuuX9BsxRjmBRVB7kmdtJ0Vaaw8DA== 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=O/48gZuznPeIoxyEFFtCyeWxpV76ASQn+zbz4aIXSxU=; b=DTIGc6QVKHdNiE/U0iPk/VFbZSWi1X7S/hhLKxGWojRLSM/CfnFW2M1vVSOWUSV5fU2me83M2eDER1JJdR5hP9T7WJ7WS9aEDMDuRn4O70QMQW1IpN7d84f2Xwfiy6JgKCkAuMvPltLdi0YSXRX+/G+bKMB17HO3yjndLCkE+uZ+rOLjB7ksN7cJM5HoAdKT48EqPP890GMjdp52N92g/GQLbTxZyRok6X7tXv+zaFQU4LTsst3dHrNLPl/V/gQ+DrZarlZOn71NKNgB+GyrV+u9208QWEAhJpaqV+5DD0ewU+oihJM2HbqvCHA/OsEIb+iY4Nf5g5c3rM2pmDzLIw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) 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=O/48gZuznPeIoxyEFFtCyeWxpV76ASQn+zbz4aIXSxU=; b=Uqol9fconyKp2QaHPVO20fqlgG3O6YnbsYLu7dzcoS59yeMQX17pNOlgXFQQRMSFrLMQrnbSU4cQMQ8mRdr8iQZQ4Jvij9t8ugH30fQZh6EVA5N6sXxRtpQqCE8YjdWToazLT4zhnEcYNEZkR442Au2vyY01BhcayFd1OqRjVZbX5er+xcssyKNWJOqLGaTON8HUNNJI7oiE5LBNXhv9RIhDf4+E+kdE9pIhy6SraenSEj1PxtOV5YWv/WZLTg0lg9hLusolqKpEPUs/pqlNEPZcLjD8R1V4zQareJDB75L5if+rmNnrnLXyzbgL8bD7HzRpxlxyw2NcfjGjsd5m/A== Received: from MW4PR04CA0385.namprd04.prod.outlook.com (2603:10b6:303:81::30) by DS0PR12MB7948.namprd12.prod.outlook.com (2603:10b6:8:152::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.20; Thu, 11 May 2023 17:39:13 +0000 Received: from CO1NAM11FT105.eop-nam11.prod.protection.outlook.com (2603:10b6:303:81:cafe::b7) by MW4PR04CA0385.outlook.office365.com (2603:10b6:303:81::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.22 via Frontend Transport; Thu, 11 May 2023 17:39:12 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) 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.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by CO1NAM11FT105.mail.protection.outlook.com (10.13.175.159) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.22 via Frontend Transport; Thu, 11 May 2023 17:39:12 +0000 Received: from drhqmail202.nvidia.com (10.126.190.181) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Thu, 11 May 2023 10:39:04 -0700 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail202.nvidia.com (10.126.190.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Thu, 11 May 2023 10:39:04 -0700 Received: from mtl123.mtl.labs.mlnx (10.127.8.10) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37 via Frontend Transport; Thu, 11 May 2023 10:39:03 -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 34BHcvs5018109; Thu, 11 May 2023 20:38:59 +0300 From: William Tu To: Subject: [SRU][J:linux-bluefield][PATCH v1 1/5] UBUNTU: SAUCE: net/sched: Provide act to offload action Date: Thu, 11 May 2023 20:38:52 +0300 Message-ID: <20230511173856.706923-2-witu@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230511173856.706923-1-witu@nvidia.com> References: <20230511173856.706923-1-witu@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT105:EE_|DS0PR12MB7948:EE_ X-MS-Office365-Filtering-Correlation-Id: d1e6a397-257a-4407-0e30-08db5246a25d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: weYYNAxkLBJ6adQrlpkTBZGGNDJNBilA2ScQEhOcC9fnUzfmAZbyQqfUDXHlyaVRb1q0RBjxShPU2M7gp1NePuu61dhmdbTdK4SHuXCI2whcs9Ae2cDPk62Zy+rRvg8fq5yYbeWjT8tDhslW9AiPav6GzMtN7PP18MyuB0lgo0BQ2uZR5YJq/jSh6/1QgW1t7KCRHP5Bb9TDG2XygbZgOAD6EL0O0kZ9tVXZSjM4zME8IxXF1fUtxCmMK0UngA9YpIsq5cGfjbBER/vLkLNl0/Pyt3GSgJSleNbJOBKi0k0unmut6wryQOlda3M10OtUILyvj818x7A0I0o/IiJ5w3BQqasaUk4YRx1B0wBj5zzlsX9e/CVFXz37F+h12+ITnyzpQU0FFIWqsEF6y8V/TZ64p7w9pOQrrTYv4Bje4ehtBlM7TEXX1FZsbX0+H6oKwob/hJ+Jb0JkjLaJ8vaTexV4/g7yXfPXY3vYo1Wig3cl5RDgX+4RiBqJtShsHG0O7DfETNuDh897uAEPlq0wd/jnkPgzG/n4MDO0OB7KyknNqzHDjKwaxCch68nn1q0/jt1SDIp4FTaJFOzfFInJ8wd7KFO4ECkIex5fN0ySdFRqvFHvtUQ/E/ZJlnGYvcYYnRwQrzk5MCR9aPxDEZMgINkpc5Rt7UqP7JY/W0ywpSfVns/B0qR/Ouya8i0XzouPihKhaE199fmkOE5zIKTvjnxH8mqbAfgUoCetZEMFBK6+XqwkU7NnT872MIE2GDdmeMy2n0DXCrzjDmtHN/flpw== X-Forefront-Antispam-Report: CIP:216.228.118.233; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc7edge2.nvidia.com; CAT:NONE; SFS:(13230028)(4636009)(346002)(396003)(39860400002)(136003)(376002)(451199021)(40470700004)(46966006)(36840700001)(966005)(8936002)(36860700001)(5660300002)(336012)(40480700001)(36756003)(47076005)(2616005)(8676002)(86362001)(83380400001)(70586007)(6666004)(70206006)(54906003)(478600001)(82310400005)(107886003)(41300700001)(316002)(4326008)(6916009)(26005)(1076003)(186003)(356005)(7636003)(2906002)(82740400003)(40460700003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2023 17:39:12.7315 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d1e6a397-257a-4407-0e30-08db5246a25d X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.118.233]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT105.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7948 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" From: Paul Blakey BugLink: https://bugs.launchpad.net/bugs/2012571 To support act stats, provide the action instance in flow offload operation. This instance will be saved by drivers, and used to directly update the stats on. Signed-off-by: Paul Blakey Signed-off-by: William Tu Reviewed-by: William Tu Acked-by: Tim Gardner Acked-by: Bartlomiej Zolnierkiewicz Signed-off-by: Bartlomiej Zolnierkiewicz --- include/net/flow_offload.h | 1 + net/sched/cls_api.c | 1 + 2 files changed, 2 insertions(+) diff --git a/include/net/flow_offload.h b/include/net/flow_offload.h index 7a2b0223a02c..5cc43cf3e075 100644 --- a/include/net/flow_offload.h +++ b/include/net/flow_offload.h @@ -198,6 +198,7 @@ void flow_action_cookie_destroy(struct flow_action_cookie *cookie); struct flow_action_entry { enum flow_action_id id; enum flow_action_hw_stats hw_stats; + void *act; action_destr destructor; void *destructor_priv; union { diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index 62ce6981942b..9574bf9037b9 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c @@ -3571,6 +3571,7 @@ int tc_setup_flow_action(struct flow_action *flow_action, struct flow_action_entry *entry; entry = &flow_action->entries[j]; + entry->act = act; spin_lock_bh(&act->tcfa_lock); err = tcf_act_get_cookie(entry, act); if (err) From patchwork Thu May 11 17:38:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Tu X-Patchwork-Id: 1780222 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=iRUuXNi/; 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 4QHK075hZMz214S for ; Fri, 12 May 2023 03:39:35 +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 1pxAGG-0005I4-W5; Thu, 11 May 2023 17:39:28 +0000 Received: from mail-dm6nam12on2065.outbound.protection.outlook.com ([40.107.243.65] 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 1pxAGC-0005EC-5Q for kernel-team@lists.ubuntu.com; Thu, 11 May 2023 17:39:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=A3NGGyYIUGPZdwFsRtN8NHv7U9NUxE9fOVZu26ETydt7fDUtDR2WhdeX1q1lll16bgBVg/KpE6sH6ClRvp7WRLf1eU8HwOSh6WLUCDW3cQFrKMLovATnEjC0kmL+6AZed5DfCHSR65Ljgyb6/Cwgh08K6j7LNvePUi9OhfoKRzoDNq2SJHocnlevLAFcuRkbfug4QKPW/rNamEknbhY5xopzXWHqRD2e19Zo7HZg8nrJOGeIvmCf8JCcsZs6KojgmJrNr/r1ODv2Ybcy/2Vwi6huKi2loJ9RpRhztadVvWM24u/gPeZoXTyILreXaVdP3pe2Es+dlaiqy8iBiXXcow== 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=p4VegpIO0ulG3T5C+dgc1VsirBn9LtbtioAaLUmrEL0=; b=hK4QrjqVF/CTHNp0Dz8xy5oNbqIc4jHGxr34idprxKOYizj693cmgiDAtIVzXROVz/k6MkrGBBo/lyBJRkBQgsNu7Ly7hiEqO9ICBBdh+to0Ovqt7eFinmUwIhV43CqGoaWP69fn11EWrddMUZOT9cDPBpCMZ5R344/tv9dspQ0eGI8ehtqDPQzlp4k97hKn9CGezXjlIvXvGmcoL2xYmcjEddrIZ05LHT/eP3V2YyFO5OEi3LlOWmUWoHFsZCDDlPBjYED0ACn/mZSOY+kPLqL8boey4J62G/c/y0FxcNHDvsi4Fhy6Xp0dabBWJ+fYY4m7IHrKzYeSQvUupwvjsA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.232) 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=p4VegpIO0ulG3T5C+dgc1VsirBn9LtbtioAaLUmrEL0=; b=iRUuXNi/8jwtAHIhWYPBb1D3z5eWrT1LexCi/aofq7TkAJiVFqeZj9Ukb5CgM43+HGvZnpIaE3yEd+tvod4uXxorr7Id+yF9XUmR1oC+329SlPhbvlNXMZN3DJuQPwqfDRLzkfEi9ub7QyFuWmgEwtzPp+U6qjlFcaz1E+zs18p0NElZRAw/jqe9OX/5biFJtTAd5g1tBO6HTRm8x14KsAfZinlx4tQb+KhzWABOJWCMZc8T1vVRaFSD15nagVhoVkGyHtnSH4e/BC1R+Ho4mqujYWh7syE2nHmxhXrgjW1BKpF5We2eYtopHQSEkW+H8N4Hm7LcCvNW/8LFz2L1FA== Received: from BYAPR07CA0083.namprd07.prod.outlook.com (2603:10b6:a03:12b::24) by MW4PR12MB5642.namprd12.prod.outlook.com (2603:10b6:303:187::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.33; Thu, 11 May 2023 17:39:14 +0000 Received: from DM6NAM11FT101.eop-nam11.prod.protection.outlook.com (2603:10b6:a03:12b:cafe::ac) by BYAPR07CA0083.outlook.office365.com (2603:10b6:a03:12b::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.20 via Frontend Transport; Thu, 11 May 2023 17:39:14 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.232) 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.118.232 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.232; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.232) by DM6NAM11FT101.mail.protection.outlook.com (10.13.172.208) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.22 via Frontend Transport; Thu, 11 May 2023 17:39:14 +0000 Received: from drhqmail202.nvidia.com (10.126.190.181) by mail.nvidia.com (10.127.129.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Thu, 11 May 2023 10:39:05 -0700 Received: from drhqmail202.nvidia.com (10.126.190.181) by drhqmail202.nvidia.com (10.126.190.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Thu, 11 May 2023 10:39:05 -0700 Received: from mtl123.mtl.labs.mlnx (10.127.8.10) by mail.nvidia.com (10.126.190.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37 via Frontend Transport; Thu, 11 May 2023 10:39:04 -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 34BHcvs6018109; Thu, 11 May 2023 20:39:01 +0300 From: William Tu To: Subject: [SRU][J:linux-bluefield][PATCH v1 2/5] net/sched: cls_api: Support hardware miss to tc action Date: Thu, 11 May 2023 20:38:53 +0300 Message-ID: <20230511173856.706923-3-witu@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230511173856.706923-1-witu@nvidia.com> References: <20230511173856.706923-1-witu@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT101:EE_|MW4PR12MB5642:EE_ X-MS-Office365-Filtering-Correlation-Id: ed4ffcf5-b293-4d7f-2b9e-08db5246a336 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iiVdEkdNOKGaHp0XerIQkioYq3tLo7nUZl1bVwbW+6I4fLPXFrntT02sR9Wno5ArmwcdSlpO8b+SgGQzPTTKrkfgK0GFRvxwBcbQOBSE6jvCFUGMjTVedZOsbKMdTDXsqN3XMwkzHz8nwVU6yWZs+C12dQCNdtMTyHufj4rGAZjQcbedCaNC/+Nh0YYjTMO+mYKkHhIW1AfS6rL+/xgyR7EBmDX/B8T2Bihxk9Axze5gMwRvUg0M/cOFwgDOkHds+lm83iGr6asqw0HLn+APOzo+SJz4XDCVPZg8lRCUCgIu/eHEZoop5c7+7ZU+lRMSPWlvw83TXcH++vfdQDUDfqU5hPDRtvbKqjMA37KH/EFukq0ghh3Egd0OSr7wiKtSQJAWXyQdXaHPL9nzLJyb431FcgicApRUUzvSfEOCnuMg5VeDf71AoJrGJuRdcUACn+NHL2Wk5s5CyC34WXwI2cbMew7shNuB+3atC45lq1bVtMWSWbL+1ZGzNfcdOstLDnRYz+Wt90hiUKEFa9xyM50+VCLopNH+gvMdgntFeI8laijWtjrYKNqcIZBISe+Iaz15kCZhkke30GsV5KkbqpMHmBh2xg7p2ts/08xSO2ZT/PRln2tGo+696JV3+0qsDXeyENy3asElSMGHhsmmm5xufV1bwynTp1vmiJXfZ1XU1S6IqAezTavmA80oMN2Bn8Gq2+6ywin0gL34rlNLhqD/0KDZtvzUz1i7vQCr57tlRgIvEZg8tNGxmSlMuc1o X-Forefront-Antispam-Report: CIP:216.228.118.232; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc7edge1.nvidia.com; CAT:NONE; SFS:(13230028)(4636009)(346002)(136003)(396003)(39860400002)(376002)(451199021)(36840700001)(40470700004)(46966006)(8676002)(6916009)(8936002)(2616005)(36860700001)(966005)(4326008)(5660300002)(41300700001)(83380400001)(70206006)(70586007)(336012)(316002)(47076005)(36756003)(478600001)(186003)(6666004)(356005)(7636003)(1076003)(26005)(40460700003)(54906003)(82740400003)(86362001)(30864003)(107886003)(82310400005)(40480700001)(2906002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2023 17:39:14.1231 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ed4ffcf5-b293-4d7f-2b9e-08db5246a336 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.118.232]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT101.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB5642 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" From: Paul Blakey BugLink: https://bugs.launchpad.net/bugs/2012571 For drivers to support partial offload of a filter's action list, add support for action miss to specify an action instance to continue from in sw. CT action in particular can't be fully offloaded, as new connections need to be handled in software. This imposes other limitations on the actions that can be offloaded together with the CT action, such as packet modifications. Assign each action on a filter's action list a unique miss_cookie which drivers can then use to fill action_miss part of the tc skb extension. On getting back this miss_cookie, find the action instance with relevant cookie and continue classifying from there. Signed-off-by: Paul Blakey Reviewed-by: Jiri Pirko Reviewed-by: Simon Horman Reviewed-by: Marcelo Ricardo Leitner Acked-by: Jamal Hadi Salim Signed-off-by: Jakub Kicinski (backported from commit 80cd22c35c9001fe72bf614d29439de41933deca) [paulb: adjust for context differences and lack of tc_setup_action()] Signed-off-by: Paul Blakey Signed-off-by: William Tu Acked-by: Tim Gardner Acked-by: Bartlomiej Zolnierkiewicz Signed-off-by: Bartlomiej Zolnierkiewicz --- include/linux/skbuff.h | 6 +- include/net/flow_offload.h | 1 + include/net/pkt_cls.h | 30 ++++-- include/net/sch_generic.h | 2 + net/openvswitch/flow.c | 3 +- net/sched/cls_api.c | 215 +++++++++++++++++++++++++++++++++++-- 6 files changed, 235 insertions(+), 22 deletions(-) diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 19e595cab23a..4f64a37d853e 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -284,12 +284,16 @@ struct nf_bridge_info { * and read by ovs to recirc_id. */ struct tc_skb_ext { - __u32 chain; + union { + u64 act_miss_cookie; + __u32 chain; + }; __u16 mru; __u16 zone; u8 post_ct:1; u8 post_ct_snat:1; u8 post_ct_dnat:1; + u8 act_miss:1; /* Set if act_miss_cookie is used */ }; #endif diff --git a/include/net/flow_offload.h b/include/net/flow_offload.h index 5cc43cf3e075..ae618fda8922 100644 --- a/include/net/flow_offload.h +++ b/include/net/flow_offload.h @@ -199,6 +199,7 @@ struct flow_action_entry { enum flow_action_id id; enum flow_action_hw_stats hw_stats; void *act; + u64 miss_cookie; action_destr destructor; void *destructor_priv; union { diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h index 83a6d0792180..0644ba083115 100644 --- a/include/net/pkt_cls.h +++ b/include/net/pkt_cls.h @@ -59,6 +59,8 @@ int tcf_block_get_ext(struct tcf_block **p_block, struct Qdisc *q, void tcf_block_put(struct tcf_block *block); void tcf_block_put_ext(struct tcf_block *block, struct Qdisc *q, struct tcf_block_ext_info *ei); +int tcf_exts_init_ex(struct tcf_exts *exts, struct net *net, int action, + int police, struct tcf_proto *tp, u32 handle, bool used_action_miss); static inline bool tcf_block_shared(struct tcf_block *block) { @@ -203,6 +205,7 @@ struct tcf_exts { int nr_actions; struct tc_action **actions; struct net *net; + struct tcf_exts_miss_cookie_node *miss_cookie_node; #endif /* Map to export classifier specific extension TLV types to the * generic extensions API. Unsupported extensions must be set to 0. @@ -214,18 +217,11 @@ struct tcf_exts { static inline int tcf_exts_init(struct tcf_exts *exts, struct net *net, int action, int police) { -#ifdef CONFIG_NET_CLS_ACT - exts->type = 0; - exts->nr_actions = 0; - exts->net = net; - exts->actions = kcalloc(TCA_ACT_MAX_PRIO, sizeof(struct tc_action *), - GFP_KERNEL); - if (!exts->actions) - return -ENOMEM; +#ifdef CONFIG_NET_CLS + return tcf_exts_init_ex(exts, net, action, police, NULL, 0, false); +#else + return -EOPNOTSUPP; #endif - exts->action = action; - exts->police = police; - return 0; } /* Return false if the netns is being destroyed in cleanup_net(). Callers @@ -317,6 +313,18 @@ tcf_exts_exec(struct sk_buff *skb, struct tcf_exts *exts, return TC_ACT_OK; } +static inline int +tcf_exts_exec_ex(struct sk_buff *skb, struct tcf_exts *exts, int act_index, + struct tcf_result *res) +{ +#ifdef CONFIG_NET_CLS_ACT + return tcf_action_exec(skb, exts->actions + act_index, + exts->nr_actions - act_index, res); +#else + return TC_ACT_OK; +#endif +} + int tcf_exts_validate(struct net *net, struct tcf_proto *tp, struct nlattr **tb, struct nlattr *rate_tlv, struct tcf_exts *exts, u32 flags, diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index 6906da5c733e..5bf56737a664 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h @@ -367,6 +367,8 @@ struct tcf_proto_ops { struct nlattr **tca, struct netlink_ext_ack *extack); void (*tmplt_destroy)(void *tmplt_priv); + struct tcf_exts * (*get_exts)(const struct tcf_proto *tp, + u32 handle); /* rtnetlink specific */ int (*dump)(struct net*, struct tcf_proto*, void *, diff --git a/net/openvswitch/flow.c b/net/openvswitch/flow.c index 1b81d71bac3c..e6b8966ddb54 100644 --- a/net/openvswitch/flow.c +++ b/net/openvswitch/flow.c @@ -897,7 +897,8 @@ int ovs_flow_key_extract(const struct ip_tunnel_info *tun_info, #if IS_ENABLED(CONFIG_NET_TC_SKB_EXT) if (static_branch_unlikely(&tc_recirc_sharing_support)) { tc_ext = skb_ext_find(skb, TC_SKB_EXT); - key->recirc_id = tc_ext ? tc_ext->chain : 0; + key->recirc_id = tc_ext && !tc_ext->act_miss ? + tc_ext->chain : 0; OVS_CB(skb)->mru = tc_ext ? tc_ext->mru : 0; post_ct = tc_ext ? tc_ext->post_ct : false; post_ct_snat = post_ct ? tc_ext->post_ct_snat : false; diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index 9574bf9037b9..5911e83388e7 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -49,6 +50,109 @@ static LIST_HEAD(tcf_proto_base); /* Protects list of registered TC modules. It is pure SMP lock. */ static DEFINE_RWLOCK(cls_mod_lock); +static struct xarray tcf_exts_miss_cookies_xa; +struct tcf_exts_miss_cookie_node { + const struct tcf_chain *chain; + const struct tcf_proto *tp; + const struct tcf_exts *exts; + u32 chain_index; + u32 tp_prio; + u32 handle; + u32 miss_cookie_base; + struct rcu_head rcu; +}; + +/* Each tc action entry cookie will be comprised of 32bit miss_cookie_base + + * action index in the exts tc actions array. + */ +union tcf_exts_miss_cookie { + struct { + u32 miss_cookie_base; + u32 act_index; + }; + u64 miss_cookie; +}; + +#if IS_ENABLED(CONFIG_NET_TC_SKB_EXT) +static int +tcf_exts_miss_cookie_base_alloc(struct tcf_exts *exts, struct tcf_proto *tp, + u32 handle) +{ + struct tcf_exts_miss_cookie_node *n; + static u32 next; + int err; + + if (WARN_ON(!handle || !tp->ops->get_exts)) + return -EINVAL; + + n = kzalloc(sizeof(*n), GFP_KERNEL); + if (!n) + return -ENOMEM; + + n->chain_index = tp->chain->index; + n->chain = tp->chain; + n->tp_prio = tp->prio; + n->tp = tp; + n->exts = exts; + n->handle = handle; + + err = xa_alloc_cyclic(&tcf_exts_miss_cookies_xa, &n->miss_cookie_base, + n, xa_limit_32b, &next, GFP_KERNEL); + if (err) + goto err_xa_alloc; + + exts->miss_cookie_node = n; + return 0; + +err_xa_alloc: + kfree(n); + return err; +} + +static void tcf_exts_miss_cookie_base_destroy(struct tcf_exts *exts) +{ + struct tcf_exts_miss_cookie_node *n; + + if (!exts->miss_cookie_node) + return; + + n = exts->miss_cookie_node; + xa_erase(&tcf_exts_miss_cookies_xa, n->miss_cookie_base); + kfree_rcu(n, rcu); +} + +static struct tcf_exts_miss_cookie_node * +tcf_exts_miss_cookie_lookup(u64 miss_cookie, int *act_index) +{ + union tcf_exts_miss_cookie mc = { .miss_cookie = miss_cookie, }; + + *act_index = mc.act_index; + return xa_load(&tcf_exts_miss_cookies_xa, mc.miss_cookie_base); +} +#else /* IS_ENABLED(CONFIG_NET_TC_SKB_EXT) */ +static int +tcf_exts_miss_cookie_base_alloc(struct tcf_exts *exts, struct tcf_proto *tp, + u32 handle) +{ + return 0; +} + +static void tcf_exts_miss_cookie_base_destroy(struct tcf_exts *exts) +{ +} +#endif /* IS_ENABLED(CONFIG_NET_TC_SKB_EXT) */ + +static u64 tcf_exts_miss_cookie_get(u32 miss_cookie_base, int act_index) +{ + union tcf_exts_miss_cookie mc = { .act_index = act_index, }; + + if (!miss_cookie_base) + return 0; + + mc.miss_cookie_base = miss_cookie_base; + return mc.miss_cookie; +} + static u32 destroy_obj_hashfn(const struct tcf_proto *tp) { return jhash_3words(tp->chain->index, tp->prio, @@ -1529,6 +1633,8 @@ static inline int __tcf_classify(struct sk_buff *skb, const struct tcf_proto *orig_tp, struct tcf_result *res, bool compat_mode, + struct tcf_exts_miss_cookie_node *n, + int act_index, u32 *last_executed_chain) { #ifdef CONFIG_NET_CLS_ACT @@ -1540,13 +1646,36 @@ static inline int __tcf_classify(struct sk_buff *skb, #endif for (; tp; tp = rcu_dereference_bh(tp->next)) { __be16 protocol = skb_protocol(skb, false); - int err; + int err = 0; - if (tp->protocol != protocol && - tp->protocol != htons(ETH_P_ALL)) - continue; + if (n) { + struct tcf_exts *exts; + + if (n->tp_prio != tp->prio) + continue; + + /* We re-lookup the tp and chain based on index instead + * of having hard refs and locks to them, so do a sanity + * check if any of tp,chain,exts was replaced by the + * time we got here with a cookie from hardware. + */ + if (unlikely(n->tp != tp || n->tp->chain != n->chain || + !tp->ops->get_exts)) + return TC_ACT_SHOT; + + exts = tp->ops->get_exts(tp, n->handle); + if (unlikely(!exts || n->exts != exts)) + return TC_ACT_SHOT; + + n = NULL; + err = tcf_exts_exec_ex(skb, exts, act_index, res); + } else { + if (tp->protocol != protocol && + tp->protocol != htons(ETH_P_ALL)) + continue; - err = tp->classify(skb, tp, res); + err = tp->classify(skb, tp, res); + } #ifdef CONFIG_NET_CLS_ACT if (unlikely(err == TC_ACT_RECLASSIFY && !compat_mode)) { first_tp = orig_tp; @@ -1562,6 +1691,9 @@ static inline int __tcf_classify(struct sk_buff *skb, return err; } + if (unlikely(n)) + return TC_ACT_SHOT; + return TC_ACT_UNSPEC; /* signal: continue lookup */ #ifdef CONFIG_NET_CLS_ACT reset: @@ -1586,21 +1718,35 @@ int tcf_classify(struct sk_buff *skb, #if !IS_ENABLED(CONFIG_NET_TC_SKB_EXT) u32 last_executed_chain = 0; - return __tcf_classify(skb, tp, tp, res, compat_mode, + return __tcf_classify(skb, tp, tp, res, compat_mode, NULL, 0, &last_executed_chain); #else u32 last_executed_chain = tp ? tp->chain->index : 0; + struct tcf_exts_miss_cookie_node *n = NULL; const struct tcf_proto *orig_tp = tp; struct tc_skb_ext *ext; + int act_index = 0; int ret; if (block) { ext = skb_ext_find(skb, TC_SKB_EXT); - if (ext && ext->chain) { + if (ext && (ext->chain || ext->act_miss)) { struct tcf_chain *fchain; + u32 chain; + + if (ext->act_miss) { + n = tcf_exts_miss_cookie_lookup(ext->act_miss_cookie, + &act_index); + if (!n) + return TC_ACT_SHOT; - fchain = tcf_chain_lookup_rcu(block, ext->chain); + chain = n->chain_index; + } else { + chain = ext->chain; + } + + fchain = tcf_chain_lookup_rcu(block, chain); if (!fchain) return TC_ACT_SHOT; @@ -1612,7 +1758,7 @@ int tcf_classify(struct sk_buff *skb, } } - ret = __tcf_classify(skb, tp, orig_tp, res, compat_mode, + ret = __tcf_classify(skb, tp, orig_tp, res, compat_mode, n, act_index, &last_executed_chain); /* If we missed on some chain */ @@ -3022,9 +3168,48 @@ static int tc_dump_chain(struct sk_buff *skb, struct netlink_callback *cb) return skb->len; } +int tcf_exts_init_ex(struct tcf_exts *exts, struct net *net, int action, + int police, struct tcf_proto *tp, u32 handle, + bool use_action_miss) +{ + int err = 0; + +#ifdef CONFIG_NET_CLS_ACT + exts->type = 0; + exts->nr_actions = 0; + /* Note: we do not own yet a reference on net. + * This reference might be taken later from tcf_exts_get_net(). + */ + exts->net = net; + exts->actions = kcalloc(TCA_ACT_MAX_PRIO, sizeof(struct tc_action *), + GFP_KERNEL); + if (!exts->actions) + return -ENOMEM; +#endif + + exts->action = action; + exts->police = police; + + if (!use_action_miss) + return 0; + + err = tcf_exts_miss_cookie_base_alloc(exts, tp, handle); + if (err) + goto err_miss_alloc; + + return 0; + +err_miss_alloc: + tcf_exts_destroy(exts); + return err; +} +EXPORT_SYMBOL(tcf_exts_init_ex); + void tcf_exts_destroy(struct tcf_exts *exts) { #ifdef CONFIG_NET_CLS_ACT + tcf_exts_miss_cookie_base_destroy(exts); + if (exts->actions) { tcf_action_destroy(exts->actions, TCA_ACT_UNBIND); kfree(exts->actions); @@ -3557,6 +3742,7 @@ int tc_setup_flow_action(struct flow_action *flow_action, const struct tcf_exts *exts) { struct tc_action *act; + u32 miss_cookie_base; int i, j, k, err = 0; BUILD_BUG_ON(TCA_ACT_HW_STATS_ANY != FLOW_ACTION_HW_STATS_ANY); @@ -3566,6 +3752,8 @@ int tc_setup_flow_action(struct flow_action *flow_action, if (!exts) return 0; + miss_cookie_base = exts->miss_cookie_node ? + exts->miss_cookie_node->miss_cookie_base : 0; j = 0; tcf_exts_for_each_action(i, act, exts) { struct flow_action_entry *entry; @@ -3573,12 +3761,16 @@ int tc_setup_flow_action(struct flow_action *flow_action, entry = &flow_action->entries[j]; entry->act = act; spin_lock_bh(&act->tcfa_lock); + err = tcf_act_get_cookie(entry, act); if (err) goto err_out_locked; entry->hw_stats = tc_act_hw_stats(act->hw_stats); + if (!is_tcf_pedit(act)) + entry->miss_cookie = tcf_exts_miss_cookie_get(miss_cookie_base, i); + if (is_tcf_gact_ok(act)) { entry->id = FLOW_ACTION_ACCEPT; } else if (is_tcf_gact_shot(act)) { @@ -3646,6 +3838,9 @@ int tc_setup_flow_action(struct flow_action *flow_action, entry->mangle.val = tcf_pedit_val(act, k); entry->mangle.offset = tcf_pedit_offset(act, k); entry->hw_stats = tc_act_hw_stats(act->hw_stats); + entry->miss_cookie = + tcf_exts_miss_cookie_get(miss_cookie_base, i); + entry = &flow_action->entries[++j]; } } else if (is_tcf_csum(act)) { @@ -3902,6 +4097,8 @@ static int __init tc_filter_init(void) if (err) goto err_register_pernet_subsys; + xa_init_flags(&tcf_exts_miss_cookies_xa, XA_FLAGS_ALLOC1); + rtnl_register(PF_UNSPEC, RTM_NEWTFILTER, tc_new_tfilter, NULL, RTNL_FLAG_DOIT_UNLOCKED); rtnl_register(PF_UNSPEC, RTM_DELTFILTER, tc_del_tfilter, NULL, From patchwork Thu May 11 17:38:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Tu X-Patchwork-Id: 1780223 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=VFI9C6yW; 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 4QHK0F0P5Lz214S for ; Fri, 12 May 2023 03:39: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 1pxAGL-0005Mb-H1; Thu, 11 May 2023 17:39:33 +0000 Received: from mail-bn1nam02on2069.outbound.protection.outlook.com ([40.107.212.69] helo=NAM02-BN1-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 1pxAGH-0005I3-M4 for kernel-team@lists.ubuntu.com; Thu, 11 May 2023 17:39:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Sl0bR/pQQJMn/9Z4xcdBMoDcAhlFEf2/zQhPf+0F7QFrm2utxJYT+KzQbs3cgR0GP00s90SWq+X7+gq3T38isCh7ZL6ugG1V8T8OK4P/sqgBaefc3epJr8dScjDTo8tL4H5RsL4vov7ageEuREf3Ume4QK3bR/q1BE0MWBOGQ4KslBlDCKDV9KwP8XYv51VLHtLwWWl9OGyzq5WSOWYm0FiWwtZomNK8z1Z/Ggs8mM7fOwloGAcxRedolIltf4eCK5VSzVp1Z+BMmmqy7uXVnvXW157g+bCEAcXryP3JsPyon3AiOwcdWEzEDj06a4F0BtrQp3gxwGgn7TRiKU8aAg== 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=mGuac8QgLVrpHN4bNqxuoiwog3tl6JMN/6IoZzzBnzs=; b=QFtAioK7mRRpIhnvAWhL80YtTIES1ZxPOQb/mJz9/ETW7gRyn6g6i8CRCkEzoIV6ZhKpZ278AqpzpXwlTm0S+QM+rf9kvs04XmY4lqkEox8qSswSFaW3qoHZafaVqAEmTj3/5qLajPNv+dikygY5c9OjSxIFQcyeWE1Tj776ODY7j1NBu7bm/Hr31Iu1hSQUms7gAt5HE72UantDMZrTAmRGAsW9wIOgbCU1/pigEW+y1Vti3oHy033uifCFD8Hn7UdfRYYddeDqdxo2cn8t6LixMlQsE9U1dXijOb89gq2KJUtCCN/aQUlNktbB2Oj7tNQkmkRlffw2rzFWVDV9kg== 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=mGuac8QgLVrpHN4bNqxuoiwog3tl6JMN/6IoZzzBnzs=; b=VFI9C6yWDMGhu+iJS36XM2IOtRjPWkGIFja8e4rL13h4Ja5gmfg4SeH8WSu3ukaRMBYvGOPet5VdQ8l2SWShKm8ioeiuLXOdcwj0OKwxugk9ZK/9ywr/+og7PLGEDTe8QL04zgePepp7zdjAIwrhjJmLilwuaxgQFPgrZh6IjBNT3uEmj1Ul+pxyuGWky7+pu40EYbBspd4qMLyhIOyWm90SISfa6OQAWlUX5+msqyqM/FHycy2KozHPQ6u50yPKFfRjAnJZMsLRj12P5t42QXVQe94kDdySqTTxbD1Xyw6RR3WeyTaNr/eB5w8EvY8zmWGrhHr4zFVDrrzI2Kxpbw== Received: from MW4PR03CA0351.namprd03.prod.outlook.com (2603:10b6:303:dc::26) by PH7PR12MB6612.namprd12.prod.outlook.com (2603:10b6:510:210::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.32; Thu, 11 May 2023 17:39:26 +0000 Received: from CO1NAM11FT016.eop-nam11.prod.protection.outlook.com (2603:10b6:303:dc:cafe::f3) by MW4PR03CA0351.outlook.office365.com (2603:10b6:303:dc::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.21 via Frontend Transport; Thu, 11 May 2023 17:39:26 +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 CO1NAM11FT016.mail.protection.outlook.com (10.13.175.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.22 via Frontend Transport; Thu, 11 May 2023 17:39:26 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) 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; Thu, 11 May 2023 10:39:07 -0700 Received: from rnnvmail205.nvidia.com (10.129.68.10) by rnnvmail203.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; Thu, 11 May 2023 10:39:07 -0700 Received: from mtl123.mtl.labs.mlnx (10.127.8.10) by mail.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37 via Frontend Transport; Thu, 11 May 2023 10:39:06 -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 34BHcvs7018109; Thu, 11 May 2023 20:39:03 +0300 From: William Tu To: Subject: [SRU][J:linux-bluefield][PATCH v1 3/5] net/sched: flower: Move filter handle initialization earlier Date: Thu, 11 May 2023 20:38:54 +0300 Message-ID: <20230511173856.706923-4-witu@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230511173856.706923-1-witu@nvidia.com> References: <20230511173856.706923-1-witu@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT016:EE_|PH7PR12MB6612:EE_ X-MS-Office365-Filtering-Correlation-Id: 6d97687c-4915-451e-22c4-08db5246aa9b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: s76kB3vgUeyyMPC84FfHQrZwfopa73G90R9zj1G8x1+I1SOiHcnCU58za4DXutAT7moY+k737QZEzw4P2f9PrWiD2N/O9uygOxbMMRiWNw57RMyJHN941Oi2ATQTUm+jphXxkwyegmx77qzvzwMfQQv56MKXwtX0lgEsLUuGRDcPbH7QUKlhMizfNY7qvyunRLFKF4z4gI2ZO/CzdWqG2FXN4Z3Sw795ObVd+ssGgFpq7HKz3X3ROCSICeKjodIKyAIe+YHcXzBcOgkHSfdcLTtd/gfgpNOWVv/LC/MCwtBHggcyX2QM6Yk05bJNE+Cb8lsSqJby8A4CifxIABFUr4JEAaHpqgXErkIY4pfj192tLGd4yo8WSEU9raSaOa8ecoXFRtQlZtxD3hQw6uejID9W018Wal2ohLOGdNbhZMpxVzdFTmiaJhdnBw4vr4VkhQFB6+io4lIBEjbAEIdkRdCl6PXta5vd/b3t1aFlqLz+KmpPj811pTpy8vOeuuDhRQ7rNKAV3uBzz1r9oKriXBER0PQSy6s8WQL0dcF5ENXGdQxjJr9ashgTku/rWYeai9BPnFraqsT53O+xLdCHisBY0yibW+c19yH6Ch6ZE+4MQ8y+V7TTH7iXdCxflT5UCkyOGqWEn0Y4niPLIeJ4lJccPHDoQCe8c29XXncGlaPlyPXYOb+XAWPr2D7p12IfdcRvDjuS/K8MmmURom3pHL9BS/bp9B1oX7zShFAqfpT5FBLHoJ8d++EAoYu0Ega0 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)(39860400002)(346002)(136003)(396003)(376002)(451199021)(40470700004)(46966006)(36840700001)(356005)(36756003)(86362001)(4326008)(70586007)(966005)(54906003)(478600001)(316002)(6916009)(70206006)(186003)(5660300002)(2906002)(40480700001)(82310400005)(41300700001)(7636003)(8936002)(8676002)(82740400003)(1076003)(107886003)(36860700001)(26005)(336012)(2616005)(83380400001)(47076005)(6666004)(40460700003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2023 17:39:26.5601 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6d97687c-4915-451e-22c4-08db5246aa9b 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: CO1NAM11FT016.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6612 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" From: Paul Blakey BugLink: https://bugs.launchpad.net/bugs/2012571 To support miss to action during hardware offload the filter's handle is needed when setting up the actions (tcf_exts_init()), and before offloading. Move filter handle initialization earlier. Signed-off-by: Paul Blakey Reviewed-by: Jiri Pirko Reviewed-by: Simon Horman Reviewed-by: Marcelo Ricardo Leitner Signed-off-by: Jakub Kicinski (cherry picked from commit 08a0063df3aed8d76a4034279117db12dbc1050f) Signed-off-by: Paul Blakey Signed-off-by: William Tu Acked-by: Tim Gardner Acked-by: Bartlomiej Zolnierkiewicz Signed-off-by: Bartlomiej Zolnierkiewicz --- net/sched/cls_flower.c | 62 ++++++++++++++++++++++++------------------ 1 file changed, 35 insertions(+), 27 deletions(-) diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c index e3e6c44cf016..54228e684f86 100644 --- a/net/sched/cls_flower.c +++ b/net/sched/cls_flower.c @@ -2032,10 +2032,6 @@ 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]); @@ -2045,14 +2041,44 @@ 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], tp->chain->tmplt_priv, flags, extack); if (err) - goto errout; + goto errout_idr; err = fl_check_assign_mask(head, fnew, fold, mask); if (err) - goto errout; + goto errout_idr; err = fl_ht_insert_unique(fnew, fold, &in_ht); if (err) @@ -2118,29 +2144,9 @@ static int fl_change(struct net *net, struct sk_buff *in_skb, refcount_dec(&fold->refcnt); __fl_put(fold); } else { - 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; + idr_replace(&head->handle_idr, fnew, fnew->handle); refcount_inc(&fnew->refcnt); - fnew->handle = handle; list_add_tail_rcu(&fnew->list, &fnew->mask->filters); spin_unlock(&tp->lock); } @@ -2163,6 +2169,8 @@ 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: From patchwork Thu May 11 17:38:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Tu X-Patchwork-Id: 1780224 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=q9tTf4Pn; 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 4QHK0G2C2Tz214S for ; Fri, 12 May 2023 03:39:42 +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 1pxAGN-0005OG-CC; Thu, 11 May 2023 17:39:35 +0000 Received: from mail-bn8nam12on2057.outbound.protection.outlook.com ([40.107.237.57] helo=NAM12-BN8-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 1pxAGI-0005J0-HM for kernel-team@lists.ubuntu.com; Thu, 11 May 2023 17:39:30 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=joIBR81diirqvKpr9VPgjxot/+P08U41nHauIsASVBfZvgxov8qXVB3Cn6ZxVASEffEypxWugwE7PwT7wSzzVSVcyUVsuP5P13ScRIXg+9yQLsdBOGJ50oTG5PYKSNIS0lALCAHXjR0UMrjid6fWHB0IDuRjPpsomSboFmxbe6krQU3HH8OW+Xyhy7g+4qpPfmajOWD7YmyBHLZ9Qin/7Mk6Cxonc9fJbr6ODt9SfHm4ni520qUkpjv+DFCN1sIjpJvKx0Z0FM/+3wrfdC4glRpEJuBKwVZBt56A/MfHb2zh7LJLlCW8bfeSpSbWU9Qvt9lm8OvB/3DP3kSm+Wqv9Q== 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=UH3cllK555q/7yh7Iu2quB0S8XxIkfZMSfYiTek3wkk=; b=Pq6b3g+XVjDWZW9qSbIwqaC3d1EkR0zQSdPRWvH9XnUoM7wkOzkqT2ZQx6oY5E2GoYB49lidqVq13y4eupUPem2cMd40FD+6oej3kI8oGBygKu+jRLTYnKPKV/TCs6qpxMJtB8pClPZ5rqKNsKH9aCUkRf6vjiy3Qi04brSROdN1BATtLNyMPmiLSxHUABM/OBLkSnTlAd2E8As1bFyv7FR/SkQeBJnXZE3vKV2lSFcMQ4pRMkund/7teyX0KD+CHc4nKiN/o/7gyaJnw1JWLS4G7JY71j0WB9VVUJsAJCplpWLBrNMbAGZp/yZiIjSNhq7sh8hyOFUmoXXWwG4+Qw== 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=UH3cllK555q/7yh7Iu2quB0S8XxIkfZMSfYiTek3wkk=; b=q9tTf4Pn1xcU93UsrtxEiKKGIQThFm41ClGmD4P75SXB+DDr/qbWiBFu7h0WYIS1AzgWemkapUnLZKLbtgwD/MmPBsy/8jYW5W84tlWjtAIx0NcBF7A8eZ2ZK27lORe3oO+O1/aOQ15RHrlBDzayXv0TnYuv1yTQbkNAoXbD9mEVFlH4+rbf/CzOVdZB6OgU+hR0UFYaUtab9wO2k1Wfs/lRe7gB+QDdArV66q12hfp+XBJ+QNx1me3gkff0APAbZV/V38Eeei6yqhdhrQv+KcrOm09bK7MxNcC9s9VfMv9anXYSZkID+ulL1BcQfu9x6DIoigC3LsPztx7mLLmRJg== Received: from MWH0EPF00056D10.namprd21.prod.outlook.com (2603:10b6:30f:fff2:0:1:0:13) by BL1PR12MB5352.namprd12.prod.outlook.com (2603:10b6:208:314::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.18; Thu, 11 May 2023 17:39:27 +0000 Received: from CO1NAM11FT110.eop-nam11.prod.protection.outlook.com (2a01:111:f400:7eab::201) by MWH0EPF00056D10.outlook.office365.com (2603:1036:d20::b) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.6 via Frontend Transport; Thu, 11 May 2023 17:39: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 CO1NAM11FT110.mail.protection.outlook.com (10.13.175.125) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.23 via Frontend Transport; Thu, 11 May 2023 17:39:27 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) 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; Thu, 11 May 2023 10:39:09 -0700 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail204.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Thu, 11 May 2023 10:39:09 -0700 Received: from mtl123.mtl.labs.mlnx (10.127.8.10) by mail.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 via Frontend Transport; Thu, 11 May 2023 10:39:08 -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 34BHcvs8018109; Thu, 11 May 2023 20:39:05 +0300 From: William Tu To: Subject: [SRU][J:linux-bluefield][PATCH v1 4/5] net/sched: flower: Support hardware miss to tc action Date: Thu, 11 May 2023 20:38:55 +0300 Message-ID: <20230511173856.706923-5-witu@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230511173856.706923-1-witu@nvidia.com> References: <20230511173856.706923-1-witu@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT110:EE_|BL1PR12MB5352:EE_ X-MS-Office365-Filtering-Correlation-Id: 1213a1cb-3741-49c4-a36b-08db5246aaea X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: F5ycDRXhwfldj6sYL3jvSeEWLUc902LfXkUs9ba7y8B6hdORlkIaiASi2BP/k8mEBZ+/uv+BeQhzDl2Z1UhJSYXaBvP4cVbRwB4wXNRF8WBDCkTQusHGaARqIwrX5hmBKedmWf6C1aXzB1dFL1I4YPKgaZxjGkqs7Tfsz5shr41lc+WjD9rB+7cjVwWPCaGvOjrgp7VT13X/6p58Wwh0EKjTYENFciH1WWS2ub3ZgLxk64Y8GthY2juX1Q22TbTp2tQEUWJ2YecJRGDZ4Og36fFLy/7MRQD5brd7FfgWWHzsqnoT/JWD6NzHfTd8uUFOo8EHmXb0ncKWocsmk2AJdDMcqxLS9JwngDdqKYBrq2858ZKXZ/BFCUKFIzL6CKDd4Ttpdk0YTTuB6kOcxQTwyjMPzEajbto3zrbT+JNJwcrE3cuKoGBYl5GmHlNzWWvkdUciix5dhe08Ln2R65MlAEqVJUkEAREuabRQPQ14mrUPvj7deFnPh5upDyBoG3nDe0URUUO2WQDz2fCwht9Q5PysYAy6u1dvIWI5T+k6yiGsb5QZ4+/jaj921VsgPATACm+ZKpRkvgA8b6kTqLK38JAi/CuvxVh27pKhn9mtZDsh89vYQGy+MGrCMteUKbKwlHWZqfAv92f4GrOqO5250nKv3fEhFy9oXPHELrfuj84fcr3V7NhCZAfED1oJGo8Nr5BEXfQttmGb2T7OGKR8c1kIUDsHcxR0YOB+KVXMn9A3xokFLT8sCdfVm3oNjfa4ragoYnEukRExjXQv2pzwndw86daZ4GKm5yXXcsZoW/g= 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)(136003)(346002)(376002)(39860400002)(396003)(451199021)(36840700001)(40470700004)(46966006)(356005)(1076003)(26005)(82740400003)(336012)(86362001)(40480700001)(41300700001)(7636003)(2616005)(6666004)(47076005)(36756003)(82310400005)(966005)(186003)(83380400001)(107886003)(36860700001)(70586007)(70206006)(54906003)(478600001)(40460700003)(4326008)(6916009)(8936002)(316002)(8676002)(5660300002)(2906002); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2023 17:39:27.0812 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1213a1cb-3741-49c4-a36b-08db5246aaea 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: CO1NAM11FT110.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5352 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" From: Paul Blakey BugLink: https://bugs.launchpad.net/bugs/2012571 To support hardware miss to tc action in actions on the flower classifier, implement the required getting of filter actions, and setup filter exts (actions) miss by giving it the filter's handle and actions. Signed-off-by: Paul Blakey Reviewed-by: Jiri Pirko Reviewed-by: Simon Horman Reviewed-by: Marcelo Ricardo Leitner Signed-off-by: Jakub Kicinski (cherry picked from commit 606c7c43d08c4daf954ec8d58ae6dd39292fb457) Signed-off-by: Paul Blakey Signed-off-by: William Tu Acked-by: Tim Gardner Acked-by: Bartlomiej Zolnierkiewicz Signed-off-by: Bartlomiej Zolnierkiewicz --- net/sched/cls_flower.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c index 54228e684f86..311637e9e875 100644 --- a/net/sched/cls_flower.c +++ b/net/sched/cls_flower.c @@ -535,6 +535,15 @@ static struct cls_fl_filter *__fl_get(struct cls_fl_head *head, u32 handle) return f; } +static struct tcf_exts *fl_get_exts(const struct tcf_proto *tp, u32 handle) +{ + struct cls_fl_head *head = rcu_dereference_bh(tp->root); + struct cls_fl_filter *f; + + f = idr_find(&head->handle_idr, handle); + return f ? &f->exts : NULL; +} + static int __fl_delete(struct tcf_proto *tp, struct cls_fl_filter *f, bool *last, bool rtnl_held, struct netlink_ext_ack *extack) @@ -2067,7 +2076,8 @@ static int fl_change(struct net *net, struct sk_buff *in_skb, } fnew->handle = handle; - err = tcf_exts_init(&fnew->exts, net, TCA_FLOWER_ACT, 0); + err = tcf_exts_init_ex(&fnew->exts, net, TCA_FLOWER_ACT, 0, tp, handle, + !tc_skip_hw(fnew->flags)); if (err < 0) goto errout_idr; @@ -3237,6 +3247,7 @@ static struct tcf_proto_ops cls_fl_ops __read_mostly = { .tmplt_create = fl_tmplt_create, .tmplt_destroy = fl_tmplt_destroy, .tmplt_dump = fl_tmplt_dump, + .get_exts = fl_get_exts, .owner = THIS_MODULE, .flags = TCF_PROTO_OPS_DOIT_UNLOCKED, }; From patchwork Thu May 11 17:38:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Tu X-Patchwork-Id: 1780225 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=ZXbbxKo1; 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 4QHK0c3qTpz214S for ; Fri, 12 May 2023 03:40:00 +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 1pxAGh-0005ie-A6; Thu, 11 May 2023 17:39:55 +0000 Received: from mail-dm6nam04on2075.outbound.protection.outlook.com ([40.107.102.75] helo=NAM04-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 1pxAGe-0005fE-DF for kernel-team@lists.ubuntu.com; Thu, 11 May 2023 17:39:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=d3Jxur2qAG0NxVf2KWcKIEiBdMEfmUBdPyJ/ToKHhHaBBp+JKSOvdS8egM2vUGPE5pd7NNCNvokx6AJMq9I2TJZM4ALBj7+08S7HllIXDxPHQIEsh546M4x6Mp9lZEgDD0Dtxyal8rojT6zy9u0EDwuuieLzqalCCZOtvoxMWB8q3jevvvlfPoP2VDz2Gkv+lFXHS5lXSGDOy/AAeOtCR5/kDZ8pvEB4/jd2H5FO1c69V6kPnYHr6iSBgcOIK2DkIT5bsFRVXAYolEDtfTfUyi5ZlgCxmZLiLJ7TYQEFk+zf0sPJAvIBbj0OW8qvQJUuaQNv+o8sNIqyr7cED6pTJw== 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=xSkUklq/SWhXCgn9wLxx96k/SGvt2K4ocBQwiWaqDzM=; b=lAc60grgfqN4ta3wQTVSMveKCITKZYSS2gHRT23CEuijhJ65Rk+sYiXsrPKCS8oIwLfW9+nxND4ZF+Y8hjhYWcn05/9bMxvZ60yb23nxpZ1aXWcCWAZlEWM5vZWNcEItLXexeSD0XgioT7458Wb4jWJACBgxSWgki+3MT2hmYC+50ue3ZKs6nmx7BuoAqfSv1dhsivvR5UKkyeF0rJ5OnauGiaiShNY/E7wqRA2RcZuy1n5aDsgG3t9rAdjwkvem8ImTP7nXEwz7Y0WswA/kWpfnxl7fNvZYdEd3fLEac//cZ1b1n3FRiuMcV63pCpfPFhtiBlm+qI2vEicIK3hQgQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) 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=xSkUklq/SWhXCgn9wLxx96k/SGvt2K4ocBQwiWaqDzM=; b=ZXbbxKo1kYlHNCNe2yiFskCGXn/+zF6pS7h8FLnaHWpEo0ecQbAr1oWW4iTEEhjbHP6l9r8lhJtA5cu0+6+uZXTl2Y2lXHMxgrAQoEAN3rwKKmRcYRVdLGiasaNvCk6cgHMuNIx3IS+EjyklE4zba3pLxLPtHRMxkp8cpdNn9zBZF8WUAbNuY4Az1TOamnEbg+v0qx/npzwDOwbawgo5bTnGyfr40GBEumFN1UDXGsXdRRJXGlSMv5ggesKOU36xS/aFssAub+NZgOA1K8lvBxHX7TlBPE3lzdDgTgYlSBmfM4xaxcdI20A+t+fJKh3ybDqqX/9TGTRzV+44Z9yKPg== Received: from BYAPR11CA0055.namprd11.prod.outlook.com (2603:10b6:a03:80::32) by SN7PR12MB7022.namprd12.prod.outlook.com (2603:10b6:806:261::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.22; Thu, 11 May 2023 17:39:50 +0000 Received: from CO1PEPF000042AB.namprd03.prod.outlook.com (2603:10b6:a03:80:cafe::87) by BYAPR11CA0055.outlook.office365.com (2603:10b6:a03:80::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.21 via Frontend Transport; Thu, 11 May 2023 17:39:49 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) 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.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by CO1PEPF000042AB.mail.protection.outlook.com (10.167.243.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.20 via Frontend Transport; Thu, 11 May 2023 17:39:49 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Thu, 11 May 2023 10:39:11 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) 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; Thu, 11 May 2023 10:39:10 -0700 Received: from mtl123.mtl.labs.mlnx (10.127.8.10) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37 via Frontend Transport; Thu, 11 May 2023 10:39:10 -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 34BHcvs9018109; Thu, 11 May 2023 20:39:07 +0300 From: William Tu To: Subject: [SRU][J:linux-bluefield][PATCH v1 5/5] netfilter: ctnetlink: Support offloaded conntrack entry deletion Date: Thu, 11 May 2023 20:38:56 +0300 Message-ID: <20230511173856.706923-6-witu@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230511173856.706923-1-witu@nvidia.com> References: <20230511173856.706923-1-witu@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000042AB:EE_|SN7PR12MB7022:EE_ X-MS-Office365-Filtering-Correlation-Id: cff418dd-0ad1-400d-3a05-08db5246b838 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: i5BHCNSEe/qOGXW2oUdbrYDovzDfsFSjFKAqt/yxIlsmIrRrekjqP6LRvx5qqm7hgxkp7y3KJDVOvAvYO82rvVzbJxVqv9ScWJfwMq/BtkfY7wfxRzK+UtCAQb99wPDC96aj8Owyw893M8L0bqp6k67Hk4XGTSLGgbASOxyUHN0hmrZU9AuPYh9worb4cy4u4Jz1ynxKqLd4SyEhrH3nttz1E/i1kltDqj3bR4ZKRiAkezfWOUypODHDLqfy2GufREtJGYoQBp1NLLTGBd6Jo+fEb/nleUvpndpYTA0iZ+VR3sRotD9N03FPBMmOdHAeKvYOhqiHaQb+LBMdN4x4/HdlsG7SAip0nifLa8h+I/KjaFRgyUl8V+arW9gky5hhYPrudYP6Q0E7G+CrRT6uHTOZ2XLePMKdYbA0zD351PxMDXthq2Vrch9Bw22Wq3VbFqm5/AfI2Vc4tqbpVs4/MbOAit1V41pyqu0CkhVQBKwdYXIQ2tByoZMLa4BaV0ZFu4cFudHMQDdzbiUU5WTIZGDk1aFeBvPMdUeUF8f6Y9s79DoefrZget3KNP2Zwp/Xcqd0TUtNJoElKLAPQCpDEAqNJfxy1vYAV45YSPipNqZdbQEbFicSSeh12zZk1arcPFm0FXL4CWdJX1hbwbPvTiw1jPyp6BYAiYy5yn7Jc143RtowTPJ1vMRdkitnbDZiirX8rmOdGSBUxjR0nmHFRD0Bw/ubkeXuSGmMftkP9OT1X4qvosaS0fESHkr+LLY8vggdbksKviNLWQraElKyTAo8FglsV5w8i0ujwmgLkco= X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230028)(4636009)(376002)(136003)(39860400002)(346002)(396003)(451199021)(36840700001)(40470700004)(46966006)(86362001)(2616005)(2906002)(336012)(6666004)(41300700001)(7636003)(356005)(36860700001)(47076005)(26005)(1076003)(83380400001)(186003)(107886003)(54906003)(8676002)(5660300002)(966005)(8936002)(40460700003)(82310400005)(478600001)(36756003)(82740400003)(316002)(4326008)(70586007)(6916009)(40480700001)(70206006); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2023 17:39:49.3531 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cff418dd-0ad1-400d-3a05-08db5246b838 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.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000042AB.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7022 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" From: Paul Blakey BugLink: https://bugs.launchpad.net/bugs/2015293 Currently, offloaded conntrack entries (flows) can only be deleted after they are removed from offload, which is either by timeout, tcp state change or tc ct rule deletion. This can cause issues for users wishing to manually delete or flush existing entries. Support deletion of offloaded conntrack entries. Example usage: # Delete all offloaded (and non offloaded) conntrack entries # whose source address is 1.2.3.4 $ conntrack -D -s 1.2.3.4 # Delete all entries $ conntrack -F Signed-off-by: Paul Blakey Reviewed-by: Simon Horman Acked-by: Pablo Neira Ayuso Signed-off-by: Florian Westphal (cherry picked from commit 9b7c68b3911aef84afa4cbfc31bce20f10570d51 linux-next) Signed-off-by: Paul Blakey Signed-off-by: William Tu Acked-by: Bartlomiej Zolnierkiewicz Acked-by: Andrei Gherzan [bzolnier: mention linux-next in the cherry-pick line] Signed-off-by: Bartlomiej Zolnierkiewicz --- net/netfilter/nf_conntrack_netlink.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c index 2d0bce25bddd..c335c06db240 100644 --- a/net/netfilter/nf_conntrack_netlink.c +++ b/net/netfilter/nf_conntrack_netlink.c @@ -1556,9 +1556,6 @@ static const struct nla_policy ct_nla_policy[CTA_MAX+1] = { static int ctnetlink_flush_iterate(struct nf_conn *ct, void *data) { - if (test_bit(IPS_OFFLOAD_BIT, &ct->status)) - return 0; - return ctnetlink_filter_match(ct, data); } @@ -1622,11 +1619,6 @@ static int ctnetlink_del_conntrack(struct sk_buff *skb, ct = nf_ct_tuplehash_to_ctrack(h); - if (test_bit(IPS_OFFLOAD_BIT, &ct->status)) { - nf_ct_put(ct); - return -EBUSY; - } - if (cda[CTA_ID]) { __be32 id = nla_get_be32(cda[CTA_ID]);