From patchwork Tue Apr 6 17:52:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roi Dayan X-Patchwork-Id: 1462952 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) 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: 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=O/VyRCf8; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FFFY23KqTz9sW1; Wed, 7 Apr 2021 03:55:01 +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 1lTpuj-0002k8-Gn; Tue, 06 Apr 2021 17:54:57 +0000 Received: from mail-bn8nam11on2072.outbound.protection.outlook.com ([40.107.236.72] helo=NAM11-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 1lTpug-0002jl-8P for kernel-team@lists.ubuntu.com; Tue, 06 Apr 2021 17:54:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BtNKzq22UOjoW6MzxbEWM1aQBD+ZsNkUBHoygRrrvG7romFWovs0aNxXWk2mE40sVbhsozurUVZfMXCOG9HNRA3duv2D6tkvvO3Qeufm7Y+bBP9aCjSgnEfM7DvaW76SQLQy6mHpFBkeOlMRJKaOALb7SQ6ramzDxrUguTVae8whcLIcTRh6dJPFLhSqzv1XV6up0/Mhj2OjdNuR4CcwQIjnX9xptko6S8E7DmgUx0Y5sCIHY0MiJIAs8Kc8LrwK1+vfNRutqFy7NrYS/1gD8bl5+JK4Z7zJV1s+Bo+q2TNk8rrcitTM0oSLGl353UuBpWW6jLy/9NsjumkmtpZeAQ== 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=YIjV69gSFLZJhkT8p/4RbHYaM9SXskzSQyomG/nFOec=; b=GBa3LCpveg8txdfph7u1YCrezP37ciRUi2F3KxxgRNOx0Kvjmxlb6ojrLFQ0CoYhWDQ/q8W+iYcvEPAe5mN1e0bOqg002T4RgGg6Q+UxZYcXnwDmYL8jGKVmKo9TfmD4HCSoy2evNnTyAHIe0kuPyktKjOsO8K0fgnE3PGjStFHC8MEyoBzGetSQWKuN2+yb6qhZuL38tkmGtclH+ZDxDDwwQrWl19LXaXe8ed7HezuXBR+IA0fhrCLc5GsYF8cWDy7b+pCKQ/yj5DstErj+S2OMBbhw+UvrzXTbbbxMpabK/K/+RU7wyyW/aMbNur8YVObhkFXOJi+faMTo9alqlg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.35) smtp.rcpttodomain=lists.ubuntu.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=YIjV69gSFLZJhkT8p/4RbHYaM9SXskzSQyomG/nFOec=; b=O/VyRCf8lbUm8VSw5YPstT9D9V8olU21Obic+HBEqcnKOzwHs0b6Ane1VakoVgD/i5uSNdDLfFUyUeZ+8U2oR27AEQpg3E32dBvrfPzhqSZGDuBF8MApoFwhVIlCsg2f5zOsPIFfMTACFc0Bs9LjaEOU2IndyzSAQ/cTxkWKu5Vdl+eEuYnx6TPAgd/jcaH+pE74SsGsbWMsOtCTglb/i0RLF/lOIP/LOz7xMPj9IJ9R/hOM8RazqeBUlrXCtm+3ze/WKvOfrw/Jut2Yzi+SmG9rnuZc/J5fG+peW+yDrTmgIVVsta9dJuDBnwqE2T9jWGAgFfnwXKYpehA20l7x/w== Received: from BN6PR20CA0057.namprd20.prod.outlook.com (2603:10b6:404:151::19) by BN7PR12MB2836.namprd12.prod.outlook.com (2603:10b6:408:32::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.28; Tue, 6 Apr 2021 17:54:52 +0000 Received: from BN8NAM11FT045.eop-nam11.prod.protection.outlook.com (2603:10b6:404:151:cafe::f6) by BN6PR20CA0057.outlook.office365.com (2603:10b6:404:151::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.27 via Frontend Transport; Tue, 6 Apr 2021 17:54:52 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.35) smtp.mailfrom=nvidia.com; lists.ubuntu.com; dkim=none (message not signed) header.d=none;lists.ubuntu.com; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.35 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.35; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.35) by BN8NAM11FT045.mail.protection.outlook.com (10.13.177.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.3999.28 via Frontend Transport; Tue, 6 Apr 2021 17:54:51 +0000 Received: from HQMAIL101.nvidia.com (172.20.187.10) by HQMAIL111.nvidia.com (172.20.187.18) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 6 Apr 2021 17:54:51 +0000 Received: from dev-r-vrt-138.mtr.labs.mlnx (172.20.145.6) by mail.nvidia.com (172.20.187.10) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 6 Apr 2021 17:54:49 +0000 From: Roi Dayan To: Subject: [SRU][F:linux-bluefield][PATCH 1/9] netfilter: conntrack: Move nf_ct_offload_timeout to header file Date: Tue, 6 Apr 2021 20:52:01 +0300 Message-ID: <20210406175209.1714809-2-roid@nvidia.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210406175209.1714809-1-roid@nvidia.com> References: <20210406175209.1714809-1-roid@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 345c9769-f386-4118-276d-08d8f9251438 X-MS-TrafficTypeDiagnostic: BN7PR12MB2836: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1013; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: deWdwhp6eMXJaNi93Sx1ai8fPatuGNuAjt9CC2cLcrcbzZEDk7bQGJ2WkxIRKVddM55VAGoJnnIt0sGav1zmEIo0bvbigXOWnaA4m6gAG3/bFg7A+QBsHjchlCIxwmdWkiNdzT1kLOG7n9s8ac5W4kzj9KvIf01VjM4fJyQRNTAR7ZMVpDB3+czTZ9DkBjzSuwDq7/7s/4Lai9mX0a8RfxB+bk7dpOEMFtkjOlsLpNz/pRpkWfTFIjM2vs3iG/arPVsgotSNRRXGjraZd090FfSDbOQp4kg2LfMvcixnnbHbQrYoDZXGSUm72Q2LW2Tydwrs3Qo7uL51lQjHw4uaJ1vSjv3dkWqYrHKTUAbvO4jwUyjwCoucd0Cn0Sz69e0tqkEKAjCVyfxwjBf2nSde34RX8nIH00+5KJXAbHCFEFMLaH7GXKm3XsUP6BGjH/b6XPvbOjFRjqZxJcYOGkMQCaKd9MUZIa67svoCykAv4kI+Vg+pTJG3rD6aIhXNkoNL7WaPvTJAFyZXe9JHYtXTd9M4ccO4tGfRHtBMGsywoMdF2/t3lndOrGGvjAXA3AagQUzITV7h5v8SEV9M1Y5Qm3BDEqUjYE92Fe6WHXGhUrJnbaQM9pJuxbDS1NsE7MYKj7g44Uc8gWjjJcVDJcI9At+UaROWyf+L9DfiFCa5tivQy2fRE+Odyyz5wDw2mhCPe2N01CLz1KNubAhNuqQ+2PyF8/PGCLKJZe+i+HuwQ2g= X-Forefront-Antispam-Report: CIP:216.228.112.35; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid02.nvidia.com; CAT:NONE; SFS:(4636009)(376002)(346002)(136003)(396003)(39860400002)(46966006)(36840700001)(26005)(1076003)(70586007)(107886003)(82310400003)(36756003)(5660300002)(4326008)(6916009)(186003)(316002)(70206006)(336012)(426003)(2906002)(966005)(8936002)(2616005)(86362001)(7636003)(83380400001)(6666004)(36860700001)(47076005)(36906005)(8676002)(54906003)(82740400003)(356005)(478600001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Apr 2021 17:54:51.9636 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 345c9769-f386-4118-276d-08d8f9251438 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.35]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT045.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR12MB2836 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: Vladimir Sokolovsky , Daniel Jurgens Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Roi Dayan BugLink: https://bugs.launchpad.net/ubuntu/+source/linux-bluefield/+bug/1922672 To be used by callers from other modules. [ Rename DAY to NF_CT_DAY to avoid possible symbol name pollution issue --Pablo ] Signed-off-by: Roi Dayan Reviewed-by: Oz Shlomo Signed-off-by: Pablo Neira Ayuso (cherry picked from commit 73f9407b3eb893bc8a82293cc8d4dfa3db079c0b) Signed-off-by: Roi Dayan --- include/net/netfilter/nf_conntrack.h | 12 ++++++++++++ net/netfilter/nf_conntrack_core.c | 12 ------------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h index 90690e37a56f..c7bfddfc65b0 100644 --- a/include/net/netfilter/nf_conntrack.h +++ b/include/net/netfilter/nf_conntrack.h @@ -279,6 +279,18 @@ static inline bool nf_ct_should_gc(const struct nf_conn *ct) !nf_ct_is_dying(ct); } +#define NF_CT_DAY (86400 * HZ) + +/* Set an arbitrary timeout large enough not to ever expire, this save + * us a check for the IPS_OFFLOAD_BIT from the packet path via + * nf_ct_is_expired(). + */ +static inline void nf_ct_offload_timeout(struct nf_conn *ct) +{ + if (nf_ct_expires(ct) < NF_CT_DAY / 2) + ct->timeout = nfct_time_stamp + NF_CT_DAY; +} + struct kernel_param; int nf_conntrack_set_hashsize(const char *val, const struct kernel_param *kp); diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c index 1546b59fdc24..7af2c9f5481e 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c @@ -1344,18 +1344,6 @@ static bool gc_worker_can_early_drop(const struct nf_conn *ct) return false; } -#define DAY (86400 * HZ) - -/* Set an arbitrary timeout large enough not to ever expire, this save - * us a check for the IPS_OFFLOAD_BIT from the packet path via - * nf_ct_is_expired(). - */ -static void nf_ct_offload_timeout(struct nf_conn *ct) -{ - if (nf_ct_expires(ct) < DAY / 2) - ct->timeout = nfct_time_stamp + DAY; -} - static void gc_worker(struct work_struct *work) { unsigned int min_interval = max(HZ / GC_MAX_BUCKETS_DIV, 1u); From patchwork Tue Apr 6 17:52:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roi Dayan X-Patchwork-Id: 1462954 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) 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: 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=r0/Fnmsl; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FFFY55tNhz9sX5; Wed, 7 Apr 2021 03:55:05 +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 1lTpun-0002ln-2a; Tue, 06 Apr 2021 17:55:01 +0000 Received: from mail-mw2nam12on2063.outbound.protection.outlook.com ([40.107.244.63] 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 1lTpui-0002k2-Mo for kernel-team@lists.ubuntu.com; Tue, 06 Apr 2021 17:54:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H34Zt1VEoU4s+VApknxiiKXUYVG6lQhA355CkYFsAr2hLdMf6IoKxFm60HnKnlOOKVNp2MaDkdnoR31tFu4REjJyw1GKJ8y9pvohf52I9lMgjm7i3JjxVR7+rLDAy+W66UEKuEXxS9OSybZn5tOi1paj/PazUCUHPFhUEeacCYfsdCyKlvKCkCp0SoykBvSPyUTBSONRonI53onXw4Gf+jz+X7ePYnFPrR5ONIs6Lk6gJtOrta10vmHB2TZoxC70btY2kCdERNDZqifDj1d1nhX6MJO9pUrgM9iY+GyObmqnOlwRAhrqvVf6Va/TSO6hCZRsffMM6eBUjP7JOpZygw== 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=MObjY3q5XHpe+5EEhRPxjMaexEjfoxMfHauUVMr1pNo=; b=UHbOhGXNQNvmQy22JjS/tg24yULgtPVe9kbtddbNopr4YS7Wrg6/CuSDdQd0OO/vjgnLAwpkm3/JzyqCWqj6iwtoSGrd5Fm4rrE/SU8mykJfcfxjvWm6wT0kFGAL8PYAL+c9yltoOUu3xQRrGC+a29mhn6dmXp7bgMezvVKZ48RfxVFUdEH6Y3UxU30FlNmMNFDN3ugFs6PGMQS+qHXDa9RaR35k/el6/V77MgcusGpDA/7jv/FLhIZEa+5mEV97DALNat53JXzCjfRToqQKeVHR5ZzzFWSHacErr3FQZgIb2TyRO2b/pYGk6HLxlIfCbG0gomJ6SSuEmPSEuDR/Bg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.35) smtp.rcpttodomain=lists.ubuntu.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=MObjY3q5XHpe+5EEhRPxjMaexEjfoxMfHauUVMr1pNo=; b=r0/Fnmsl7Ym5ncCbPUaqzq2Pq6jAEC8FyjLSOQ3CQg3b2tt0Mi49Zph1WKNSWbvqWNoJvTLYA25zgky5AFp/jb53eLArUJ3imjG+31y5O8xLslnaOdXOQwXz5ZwACKA7HA+CfQSqnnGjrMWuVeFs7VZ6why0u4V8z1gQyhOLYaDUv8zhhMVnRL6+46J2VgvzUVzmNmr9bHMAOLlhaV+CyxlqGlvAxuoKe9dQCQMPyGOnrzQbwGjrMdheaUOUhjPYyRa8HzCcDWGJ3MZW4VQxz1HKmH+YyIVsV2KnNjCm0foGixUPJC6CyO4iupzqB7FRJ6Wc7UMTISMJN3ofK7cT2Q== Received: from BN9PR03CA0453.namprd03.prod.outlook.com (2603:10b6:408:139::8) by MWHPR12MB1230.namprd12.prod.outlook.com (2603:10b6:300:f::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.32; Tue, 6 Apr 2021 17:54:54 +0000 Received: from BN8NAM11FT065.eop-nam11.prod.protection.outlook.com (2603:10b6:408:139:cafe::f0) by BN9PR03CA0453.outlook.office365.com (2603:10b6:408:139::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.28 via Frontend Transport; Tue, 6 Apr 2021 17:54:53 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.35) smtp.mailfrom=nvidia.com; lists.ubuntu.com; dkim=none (message not signed) header.d=none;lists.ubuntu.com; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.35 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.35; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.35) by BN8NAM11FT065.mail.protection.outlook.com (10.13.177.63) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.3999.28 via Frontend Transport; Tue, 6 Apr 2021 17:54:53 +0000 Received: from HQMAIL101.nvidia.com (172.20.187.10) by HQMAIL111.nvidia.com (172.20.187.18) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 6 Apr 2021 17:54:52 +0000 Received: from dev-r-vrt-138.mtr.labs.mlnx (172.20.145.6) by mail.nvidia.com (172.20.187.10) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 6 Apr 2021 17:54:51 +0000 From: Roi Dayan To: Subject: [SRU][F:linux-bluefield][PATCH 2/9] netfilter: flowtable: Set offload timeout when adding flow Date: Tue, 6 Apr 2021 20:52:02 +0300 Message-ID: <20210406175209.1714809-3-roid@nvidia.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210406175209.1714809-1-roid@nvidia.com> References: <20210406175209.1714809-1-roid@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c4f21a17-c560-4005-8818-08d8f9251534 X-MS-TrafficTypeDiagnostic: MWHPR12MB1230: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:949; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sxTZCA8CpNe94ByFd0laD/SyL5iq0jdyWlPw81ZjQe1ng0wi6XP9zZmbDcJ1EpxSPWuHc7dsDFBVXExAZK2Q/Utt10AYyS2WQcSmnsdZe6bPJQp+BLXecK0NdO1uifqatK3FopRFvJfbmTs0Uqs7mFThLsExa9slaR6yyNuQn/gd5uZ9G9e1I/j8qHTDJixi+LgTRJhcpXEKHapZ2mMdjIwEDoS+/melEhLfp7O/xLVr+XR6vHh+yc3+ftZXM5jfEutd3D3a9buxb95smy3kDheKAfnMst/fQ0GtPnY4vUDMvxS41om7g1LKNhXGLlcfPfgdN9iXFDlwgd6wc2HyosS89DUj5v/1cjmYM0opwtPl8KCW9aeU0qq7k/dJ7xcYUDzjB8rz2ofyvXqhZOPO7wu/EP7iuKtOwzCOn+2sfMkJjhsP8FU13rnP7osJeOiHUtGE9Yy1WBYz6xtJwtD8sXUV2nTkotgFvKzVGPO9cMMQkFIpsoH3xBw8fwsheBy5RA1nTGvdgn0RBt7nmf75mgQD3pk43zO/3KeFxieZk1FXBctu238hri2T30OGcjQI39LAMgBFYsgRFFIKixJU6loBryCvb4zySMcAZQKtBl1GJesQeQxh+/AYhY7bBsh5bI6hNHB/NCldDC5eo6eitX8WZl7XS7Rhm+xUX0D2wD18m//RwIf2kmgdXS+2l9y8Sd4b3Jz5foY2yAQxhXdpYi2qtzjDnDR/vrTeT0WOIjQ= X-Forefront-Antispam-Report: CIP:216.228.112.35; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid02.nvidia.com; CAT:NONE; SFS:(4636009)(39860400002)(396003)(136003)(346002)(376002)(46966006)(36840700001)(4326008)(2906002)(36860700001)(82310400003)(966005)(70206006)(8936002)(316002)(70586007)(86362001)(8676002)(6916009)(83380400001)(36906005)(47076005)(26005)(478600001)(186003)(336012)(426003)(54906003)(107886003)(36756003)(7636003)(2616005)(82740400003)(6666004)(5660300002)(356005)(1076003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Apr 2021 17:54:53.6026 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c4f21a17-c560-4005-8818-08d8f9251534 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.35]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT065.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1230 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: Vladimir Sokolovsky , Daniel Jurgens Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Roi Dayan BugLink: https://bugs.launchpad.net/ubuntu/+source/linux-bluefield/+bug/1922672 On heavily loaded systems the GC can take time to go over all existing conns and reset their timeout. At that time other calls like from nf_conntrack_in() can call of nf_ct_is_expired() and see the conn as expired. To fix this when we set the offload bit we should also reset the timeout instead of counting on GC to finish first iteration over all conns before the initial timeout. Fixes: 90964016e5d3 ("netfilter: nf_conntrack: add IPS_OFFLOAD status bit") Signed-off-by: Roi Dayan Signed-off-by: Pablo Neira Ayuso (cherry picked from commit 4203b19c27967d9eff6928f6a733f81892ffc592) Signed-off-by: Roi Dayan --- net/netfilter/nf_flow_table_core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/netfilter/nf_flow_table_core.c b/net/netfilter/nf_flow_table_core.c index dcdc37d3a748..5144e317caab 100644 --- a/net/netfilter/nf_flow_table_core.c +++ b/net/netfilter/nf_flow_table_core.c @@ -244,6 +244,8 @@ int flow_offload_add(struct nf_flowtable *flow_table, struct flow_offload *flow) return err; } + nf_ct_offload_timeout(flow->ct); + if (nf_flowtable_hw_offload(flow_table)) { __set_bit(NF_FLOW_HW, &flow->flags); nf_flow_offload_add(flow_table, flow); From patchwork Tue Apr 6 17:52:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roi Dayan X-Patchwork-Id: 1462955 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) 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: 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=uQoBJAKI; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FFFY82pzsz9sTD; Wed, 7 Apr 2021 03:55:08 +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 1lTpuo-0002nJ-NX; Tue, 06 Apr 2021 17:55:02 +0000 Received: from mail-co1nam11on2041.outbound.protection.outlook.com ([40.107.220.41] helo=NAM11-CO1-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 1lTpul-0002kI-5G for kernel-team@lists.ubuntu.com; Tue, 06 Apr 2021 17:54:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UugmFgX85Tzmf2RmHjBaIQodhbfMTOxLwQrg0OfD2BBl8NtlT2F/4Src3F6/4XZGz3msjaJydLYQl9pKmC0/75fnF2zJ/lSWEK1Weyq69JrVqeICbjPCoyS9aR/b/R5ukRi0UPR4bE+HCDJeqANlWHH6wr63qbb6nXQ23y6jgzd+jT+H9mkzrB85Jsk3Kaa7o+ZV25FNpLXninvbw9YDtGoHhzIbqbCw6yKBjjUciNmb5gAVSLV6OsVYIE4PWFgnTpWPmOzvN1m8uGnC2S+xoAPsp+ttR3gd1La0hlqyD+KCP9lpOxyVjO++i3aKwyqpznb9k4a9if3BEK6hvaTF0Q== 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=0xqJz7sQwAsJ1YY0h57EYomAQHcZq4GyU6RK67gXQkE=; b=LHvWOv3iPrjZZOPISByzaOWWlVfoazrhj8vIVaOonDKaK14eDfAMdha65g0/t8AB+F2AzaVMqmLswqXV+Fkv7h22hi3n9b8CdA5KSFjO+3eb8L/szsfYYn+KrZV3XuzaZ7gfdzgylOoijtyousZHVqwmAOH6CibRNc8OsjHmY/zdBHE9/PHj8slJDaXc/tVtBG6dA++gibItGwH2WGqPg2NzxO5PrFmGqFZL0Cu2qcoXd/AgrVBAduDzHPvE9wvtCDjDsx/kWLILiyikZSojK4SrFhLtzmVu5ojENirqs0d1P8N1CcZQw8Jzsg4Kj0s/+bpkQtuv/4ge5iefVMIjfw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.35) smtp.rcpttodomain=lists.ubuntu.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=0xqJz7sQwAsJ1YY0h57EYomAQHcZq4GyU6RK67gXQkE=; b=uQoBJAKIFr4+2xxu+n2a1ghWOKnF3zJXXlV7ALGSumikfQe/Q2udrW8pAAQhlmOxWGgnWnKh3lw0mUO/1Xup0ByAu09Xaq1EBICD1rM1Yg1sl4u13jGtuD/yguBKy7wIi5RUwo+XYhRH5ojCA7c0jq69oDyhxTqWAmFbFAhrAJ6EdqlT8P/uAu+MgJ1sahFyUZcmg6jfE3qYVINRaN38Lzk+eoq3NHzqBX8cVoiVzpSs4kndwD6mxGDhxyaXn5QyGewTE6Fsop7klDZdQ8QqVOtxR/goaVbKn3szfS/G5Xl36p50NMC9iwFjP2o3gALyE1MDGIEAFrNnVUnj0YbvYg== Received: from BN8PR12CA0013.namprd12.prod.outlook.com (2603:10b6:408:60::26) by MWHPR1201MB2510.namprd12.prod.outlook.com (2603:10b6:300:e8::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.28; Tue, 6 Apr 2021 17:54:56 +0000 Received: from BN8NAM11FT051.eop-nam11.prod.protection.outlook.com (2603:10b6:408:60:cafe::51) by BN8PR12CA0013.outlook.office365.com (2603:10b6:408:60::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.28 via Frontend Transport; Tue, 6 Apr 2021 17:54:55 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.35) smtp.mailfrom=nvidia.com; lists.ubuntu.com; dkim=none (message not signed) header.d=none;lists.ubuntu.com; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.35 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.35; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.35) by BN8NAM11FT051.mail.protection.outlook.com (10.13.177.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.3999.28 via Frontend Transport; Tue, 6 Apr 2021 17:54:55 +0000 Received: from HQMAIL101.nvidia.com (172.20.187.10) by HQMAIL111.nvidia.com (172.20.187.18) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 6 Apr 2021 17:54:54 +0000 Received: from dev-r-vrt-138.mtr.labs.mlnx (172.20.145.6) by mail.nvidia.com (172.20.187.10) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 6 Apr 2021 17:54:53 +0000 From: Roi Dayan To: Subject: [SRU][F:linux-bluefield][PATCH 3/9] netfilter: flowtable: separate replace, destroy and stats to different workqueues Date: Tue, 6 Apr 2021 20:52:03 +0300 Message-ID: <20210406175209.1714809-4-roid@nvidia.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210406175209.1714809-1-roid@nvidia.com> References: <20210406175209.1714809-1-roid@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3d146a3f-c82b-48d0-77c0-08d8f925162a X-MS-TrafficTypeDiagnostic: MWHPR1201MB2510: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:151; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YEk4FMVg2eq/Mcpl99jWA3HYA/zVI/lDOdtGU4S80s2MszI01XA1JHKWM+GtRiUbJxl5p1xHrlN61UPyJIu7+DUStUx7DYgXFyNrR1sJ/La2arLmTTdqJnyW02chFkoA2fS3P7nBGCMZi8Pd82E3XkRxUfZ7NjXEytt8Rm5cKo8DCuKbnQ6mQICFNeWnEf0N3KXR5E/+huXyrg2dD4WroqD4aqqG7mB8HzFm8lf9iBsoBg7xWO7Gct7Cjo+gNaiQiovOsxC7+4njadw/bWivdeCD5zhdWZtbw0OEjJ/mIlDxfXyETwqskspZxfceHoMCnShc/2RgkBFN1Np9cafDVstb2G6C2XRWXTiL5w4l+thfvG1YgfGhTrLBFVUqSX8Uik1tXpDEJunUCaIratqnlTMbyiRX6U8Vz8cYpyYFqXqYtZMTuIgOL2IrH/Z/e5GzbMCtFLK/WLdOhjWy5C8lwRIDPSZ/v6Q7zZmgndATy53YpZa2S2N+ox4qPlf2GGhaKQPTPXv0C1aZE1dKH0hQb6qrXUyL76RquG1QiXB9H3icoFmgenPj6Iw7v8uUt/winfMvfcqnRE+1aDMi9ioi7WbhMb8nALSUyidnGk64SAax2aTe7ggPzokrIFTkpixfX3k0ECySGiKOcnsIymPjqrKcB0FQG3Y9fcfnI8gNJoWtk0upNrfutOm+s1SSWR++a7hmGZQgm+A0pyAQFhwJIUTmZPo7bNE2FDB3F4kElY0= X-Forefront-Antispam-Report: CIP:216.228.112.35; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid02.nvidia.com; CAT:NONE; SFS:(4636009)(39860400002)(396003)(376002)(136003)(346002)(46966006)(36840700001)(107886003)(4326008)(47076005)(5660300002)(8676002)(186003)(36906005)(54906003)(316002)(36860700001)(356005)(6666004)(82310400003)(8936002)(7636003)(82740400003)(1076003)(966005)(6916009)(336012)(70586007)(426003)(2906002)(36756003)(70206006)(83380400001)(86362001)(26005)(478600001)(2616005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Apr 2021 17:54:55.2054 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3d146a3f-c82b-48d0-77c0-08d8f925162a 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.35]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT051.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR1201MB2510 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: Vladimir Sokolovsky , Daniel Jurgens Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Oz Shlomo BugLink: https://bugs.launchpad.net/ubuntu/+source/linux-bluefield/+bug/1922678 Currently the flow table offload replace, destroy and stats work items are executed on a single workqueue. As such, DESTROY and STATS commands may be backloged after a burst of REPLACE work items. This scenario can bloat up memory and may cause active connections to age. Instatiate add, del and stats workqueues to avoid backlogs of non-dependent actions. Provide sysfs control over the workqueue attributes, allowing userspace applications to control the workqueue cpumask. Signed-off-by: Oz Shlomo Reviewed-by: Paul Blakey Signed-off-by: Pablo Neira Ayuso (backported from commit 2ed37183abb70233146dc82f19cb1cbceed2b505) Signed-off-by: Roi Dayan --- net/netfilter/nf_flow_table_offload.c | 44 ++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/net/netfilter/nf_flow_table_offload.c b/net/netfilter/nf_flow_table_offload.c index db1797e398ae..685ff5b906e4 100644 --- a/net/netfilter/nf_flow_table_offload.c +++ b/net/netfilter/nf_flow_table_offload.c @@ -12,7 +12,9 @@ #include #include -static struct workqueue_struct *nf_flow_offload_wq; +static struct workqueue_struct *nf_flow_offload_add_wq; +static struct workqueue_struct *nf_flow_offload_del_wq; +static struct workqueue_struct *nf_flow_offload_stats_wq; struct flow_offload_work { struct list_head list; @@ -818,7 +820,12 @@ static void flow_offload_work_handler(struct work_struct *work) static void flow_offload_queue_work(struct flow_offload_work *offload) { - queue_work(nf_flow_offload_wq, &offload->work); + if (offload->cmd == FLOW_CLS_REPLACE) + queue_work(nf_flow_offload_add_wq, &offload->work); + else if (offload->cmd == FLOW_CLS_DESTROY) + queue_work(nf_flow_offload_del_wq, &offload->work); + else + queue_work(nf_flow_offload_stats_wq, &offload->work); } static struct flow_offload_work * @@ -890,8 +897,11 @@ void nf_flow_offload_stats(struct nf_flowtable *flowtable, void nf_flow_table_offload_flush(struct nf_flowtable *flowtable) { - if (nf_flowtable_hw_offload(flowtable)) - flush_workqueue(nf_flow_offload_wq); + if (nf_flowtable_hw_offload(flowtable)) { + flush_workqueue(nf_flow_offload_add_wq); + flush_workqueue(nf_flow_offload_del_wq); + flush_workqueue(nf_flow_offload_stats_wq); + } } static int nf_flow_table_block_setup(struct nf_flowtable *flowtable, @@ -1059,18 +1069,36 @@ static struct flow_indr_block_entry block_ing_entry = { int nf_flow_table_offload_init(void) { - nf_flow_offload_wq = alloc_workqueue("nf_flow_table_offload", - WQ_UNBOUND, 0); - if (!nf_flow_offload_wq) + nf_flow_offload_add_wq = alloc_workqueue("nf_ft_offload_add", + WQ_UNBOUND | WQ_SYSFS, 0); + if (!nf_flow_offload_add_wq) return -ENOMEM; + nf_flow_offload_del_wq = alloc_workqueue("nf_ft_offload_del", + WQ_UNBOUND | WQ_SYSFS, 0); + if (!nf_flow_offload_del_wq) + goto err_del_wq; + + nf_flow_offload_stats_wq = alloc_workqueue("nf_ft_offload_stats", + WQ_UNBOUND | WQ_SYSFS, 0); + if (!nf_flow_offload_stats_wq) + goto err_stats_wq; + flow_indr_add_block_cb(&block_ing_entry); return 0; + +err_stats_wq: + destroy_workqueue(nf_flow_offload_del_wq); +err_del_wq: + destroy_workqueue(nf_flow_offload_add_wq); + return -ENOMEM; } void nf_flow_table_offload_exit(void) { flow_indr_del_block_cb(&block_ing_entry); - destroy_workqueue(nf_flow_offload_wq); + destroy_workqueue(nf_flow_offload_add_wq); + destroy_workqueue(nf_flow_offload_del_wq); + destroy_workqueue(nf_flow_offload_stats_wq); } From patchwork Tue Apr 6 17:52:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roi Dayan X-Patchwork-Id: 1462956 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) 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: 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=ltqtZ7ks; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FFFY92Rs0z9sRR; Wed, 7 Apr 2021 03:55:09 +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 1lTpuq-0002oF-L5; Tue, 06 Apr 2021 17:55:04 +0000 Received: from mail-bn8nam11on2088.outbound.protection.outlook.com ([40.107.236.88] helo=NAM11-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 1lTpul-0002kU-KY for kernel-team@lists.ubuntu.com; Tue, 06 Apr 2021 17:54:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cAOd6RF08lUlV6Og2+EyebnfMMvJsiHx53uAJp49eJH60Pmv7z4W6t5jeDn5JxTAovNUgMe4gOm+tJX4JIKZm6cwQUlxBhStrZIx5Ddb3MasLW3Tl9gyMO/uQhz/VpjmYZ9EH99WKZZa6pAuISXGDl0z9CRsMdRMa5ZNZtXCJ7+nFESh03BJyQlzo8X7oXStBVeOQVfG6NwFaWgIfigLErgF/su6tYWQSLZ24Ccg9n+tjvzJ+1PN59qgPZ5yiwcFtEEZtgcrgy0SXWYSo0J55mvdWgG4qwF6/cNc9m2auqwewz93gt1BmqWHOYJwo9t/nBv2z1Zcvfpl0iKsOAuoQw== 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=z7ux5I4ELsn72/QM/cm8IQzT8ypbiIrBwXqzzDFP01c=; b=FjE7nxxVXfncbF7oH6VfwpXj3BCMgf82VkjqslytpiKMN1GVMaOV5c99B1NcjSXZQ0rNZy5VourXS2Cwb12aHc9d6pH+EZvDY9anuk9JEyerswqbpcF46BpZ4lRTqHbQGpFIF2EkQ/4r6ZiMYjik3aElDTjHdZmccoEHCz5AyHTVlskAVb9+/jKlHf47BKnDhaZvX2nFnDA2H786RhaZd38QVKlVdtyBBanwrdP+OfZq+f5xvYmQxqeYhqw2QT91CBUj86KIavydQcc0YqVWEabVcyVkov58WyLMSVefZwMZXnNWhr9tdztTyjs8yci4LLhMmp8Gjhkk3i2ADrzRmw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.35) smtp.rcpttodomain=lists.ubuntu.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=z7ux5I4ELsn72/QM/cm8IQzT8ypbiIrBwXqzzDFP01c=; b=ltqtZ7ksOz8Mo93KTPN3LnRTEvVt+4KmFH+dpSCTDHDsNXNTAl/Lod5lFecTpaM7qV4Yc7fk4A1CSf7Ukd5Zcn/39oz9pjKAY7TAbxXUz0BHkgO6OB2c6bQZKrxG2roJeXqTFAF0WKPq9h6YDEHss1DSz0o6kv+7vZr013kplAvqIGaqabjrxklHgq7DMPD7y4TiqbUXAbXmBo537yGBq8OOGGaG8kyjbA7126SITjqjfbTZaXOIVFaKLoudIh0ywmU47gKIKqtVtKdxbl+m+XUyuW+Izj+XJ/k6mT6I5OV4P1jZKLTDOot++SldH7NINLT3ozu07Lf9aM6pMYRKgQ== Received: from BN8PR12CA0027.namprd12.prod.outlook.com (2603:10b6:408:60::40) by BYAPR12MB2599.namprd12.prod.outlook.com (2603:10b6:a03:6b::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.32; Tue, 6 Apr 2021 17:54:57 +0000 Received: from BN8NAM11FT051.eop-nam11.prod.protection.outlook.com (2603:10b6:408:60:cafe::53) by BN8PR12CA0027.outlook.office365.com (2603:10b6:408:60::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.27 via Frontend Transport; Tue, 6 Apr 2021 17:54:57 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.35) smtp.mailfrom=nvidia.com; lists.ubuntu.com; dkim=none (message not signed) header.d=none;lists.ubuntu.com; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.35 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.35; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.35) by BN8NAM11FT051.mail.protection.outlook.com (10.13.177.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.3999.28 via Frontend Transport; Tue, 6 Apr 2021 17:54:57 +0000 Received: from HQMAIL105.nvidia.com (172.20.187.12) by HQMAIL111.nvidia.com (172.20.187.18) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 6 Apr 2021 17:54:56 +0000 Received: from HQMAIL101.nvidia.com (172.20.187.10) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 6 Apr 2021 17:54:55 +0000 Received: from dev-r-vrt-138.mtr.labs.mlnx (172.20.145.6) by mail.nvidia.com (172.20.187.10) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 6 Apr 2021 17:54:54 +0000 From: Roi Dayan To: Subject: [SRU][F:linux-bluefield][PATCH 4/9] UBUNTU: SAUCE: netfilter: nf_flow_table_offload: Limit work entries on offload add wq Date: Tue, 6 Apr 2021 20:52:04 +0300 Message-ID: <20210406175209.1714809-5-roid@nvidia.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210406175209.1714809-1-roid@nvidia.com> References: <20210406175209.1714809-1-roid@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2b3931e8-21f9-487c-937e-08d8f925177a X-MS-TrafficTypeDiagnostic: BYAPR12MB2599: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:219; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1vC803Osl2goG+dJ9/RNmhvXaDqrid2Ga2OVVumfdPhSjTqHDWycxMeE6g5qIb0Ioh/pz4WYG4ja0LH728seb2rwMDLuaJDTTUiUxNk6PoqiebMfofrBHGKOueqqTF78C3sm6XCxZBFOSLpTo8imdWVsQtHFOQhLQ2VE41fUWCjLMUKxlvfg3DN1RZt074RubGLM00bktsGJl/zdMXbW0lNWaAM0p+bv2eY0L9HjUKlxYCNSZ3ABP7PFNhjPqu1uuJyvmT7HCfPth+kougPYTkhi+s+FT1dw7XwM/GLUDaQjXOkSxPktRIVcNQ0VtUTvt+5WL8MmrFmYoZtQi+0DUf9oWhmKsBPfpYeLoNObEoBIedC2KVTjoB+PFoHlJE2I7QsNvwSaX5MkLNlmoCijF6VsEGvoSwsmtocRnVz3rI37tooVgDtyzxStQexTLnwxncAzBfPNLvxXrAlxkXBe+pcsU+PdzUxPoRMDBwrSj0Yona4Wu8gGNiBVXw0u5iRE8bcp0OKlOjul/OhDMNpPlBHNXi14ZDjgHkw4uZlVBm0QpUouKNaK21/bhqHY4KAB9tZn/GVTciTOxPYZFbJF14nyiEbFPD5pH2fh30nzS8Mrm48RdA56EiN3aWuwTVw3wyA0CcQjBNDCT+0UgCzTKhx3smDA36xzmfiiEZYsuJBDnJNnsQEsIF/zqsAm3Brs0v+oVtXnYT0WgakggXjC/367pwKEk7Z3zcz1S45ZHts= X-Forefront-Antispam-Report: CIP:216.228.112.35; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid02.nvidia.com; CAT:NONE; SFS:(4636009)(396003)(136003)(376002)(346002)(39860400002)(36840700001)(46966006)(36756003)(82310400003)(336012)(966005)(86362001)(36906005)(478600001)(107886003)(8936002)(26005)(186003)(2616005)(5660300002)(70206006)(316002)(6666004)(1076003)(426003)(82740400003)(36860700001)(70586007)(4326008)(2906002)(47076005)(54906003)(8676002)(6916009)(7636003)(356005)(83380400001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Apr 2021 17:54:57.4131 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2b3931e8-21f9-487c-937e-08d8f925177a 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.35]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT051.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB2599 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: Vladimir Sokolovsky , Daniel Jurgens Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" BugLink: https://bugs.launchpad.net/ubuntu/+source/linux-bluefield/+bug/1922678 Allow user to config through sysfs and set default to 10000. Signed-off-by: Roi Dayan Reviewed-by: Oz Shlomo --- net/netfilter/nf_flow_table_offload.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/net/netfilter/nf_flow_table_offload.c b/net/netfilter/nf_flow_table_offload.c index 685ff5b906e4..26a950d2740d 100644 --- a/net/netfilter/nf_flow_table_offload.c +++ b/net/netfilter/nf_flow_table_offload.c @@ -15,6 +15,11 @@ static struct workqueue_struct *nf_flow_offload_add_wq; static struct workqueue_struct *nf_flow_offload_del_wq; static struct workqueue_struct *nf_flow_offload_stats_wq; +static atomic_t nf_flow_offload_wq_count; + +static uint max_offload_add = 10000; +module_param(max_offload_add, uint, 0644); +MODULE_PARM_DESC(max_offload_add, "Limit offload add wq entries"); struct flow_offload_work { struct list_head list; @@ -803,6 +808,7 @@ static void flow_offload_work_handler(struct work_struct *work) switch (offload->cmd) { case FLOW_CLS_REPLACE: flow_offload_work_add(offload); + atomic_dec(&nf_flow_offload_wq_count); break; case FLOW_CLS_DESTROY: flow_offload_work_del(offload); @@ -820,12 +826,14 @@ static void flow_offload_work_handler(struct work_struct *work) static void flow_offload_queue_work(struct flow_offload_work *offload) { - if (offload->cmd == FLOW_CLS_REPLACE) + if (offload->cmd == FLOW_CLS_REPLACE) { queue_work(nf_flow_offload_add_wq, &offload->work); - else if (offload->cmd == FLOW_CLS_DESTROY) + atomic_inc(&nf_flow_offload_wq_count); + } else if (offload->cmd == FLOW_CLS_DESTROY) { queue_work(nf_flow_offload_del_wq, &offload->work); - else + } else { queue_work(nf_flow_offload_stats_wq, &offload->work); + } } static struct flow_offload_work * @@ -858,6 +866,9 @@ void nf_flow_offload_add(struct nf_flowtable *flowtable, { struct flow_offload_work *offload; + if (atomic_read(&nf_flow_offload_wq_count) >= max_offload_add) + return; + offload = nf_flow_offload_work_alloc(flowtable, flow, FLOW_CLS_REPLACE); if (!offload) return; @@ -1084,6 +1095,7 @@ int nf_flow_table_offload_init(void) if (!nf_flow_offload_stats_wq) goto err_stats_wq; + atomic_set(&nf_flow_offload_wq_count, 0); flow_indr_add_block_cb(&block_ing_entry); return 0; From patchwork Tue Apr 6 17:52:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roi Dayan X-Patchwork-Id: 1462957 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) 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: 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=oBgGQWZ1; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FFFYF1N4Vz9sTD; Wed, 7 Apr 2021 03:55:13 +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 1lTpuu-0002rB-7v; Tue, 06 Apr 2021 17:55:08 +0000 Received: from mail-dm6nam11on2076.outbound.protection.outlook.com ([40.107.223.76] helo=NAM11-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 1lTpum-0002l5-E9 for kernel-team@lists.ubuntu.com; Tue, 06 Apr 2021 17:55:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UkaB0inhVUO5cBnsRsW2B7lY7rcnJ8793tEQI5DhclKQOoGiqernqAV0Bz3q1JcVxURvEf2Zy+yfY/Y0NnsNlofNv8SWxZpWpu8/Y/8DVsQ2l2JMhXOIW/zPNeVN2zo0nsC7RJbuSNoDHucwfWv1CAdBWHbkf8Z87ZidtFVe2m5NNcblGY8rjDAGm62104JKTbTWZ/vvnieYKDbX6GTpv5TK+eJNYyFV7aze8jIDQyBpoHaCpOohZsYxjEvOhHdSvTyrY7HoaLrXXYhbuAkm81e7+pB9BIsxEiq0aQKLtnjp86FiyLc1u1eELBrIgjuUXhuij8jtVBSJxv1gaaNENA== 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=p3VLLwcFc2JTxA32MOhNe8Qb4YAuyOp+iH7loPQiQgs=; b=WL917BH+0NDHvft17Q2w+buCHZZKm3oURR4LZbnnu+kLULfnJKaNj1LntKBGEAyH078I7Plyy/IY8zkyimEcwNeFWxwSE1lf+rIUCJmpF2DAH75GnO08ua+V1u9fLAuY68Wr/zWTc/IhnCVmTNhdkdRWO0jOaCQJ4dvTnFd3j3HTgj0yos5IKraPvSPGRAyfhuX0AjyHJOfwgplIRawQcAAUo4T1f9LE1jyGUTLn2JJ7J6NemhX0IFAkIIilpFDhOeVYCfSmbqt+189XOrnGBfU6H3Vv9VipXwxgD2aIip1iUa6fo/fSr9ml6Z+fMSPnp6iYDJ9EYL0jU83zfYQhYg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.35) smtp.rcpttodomain=lists.ubuntu.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=p3VLLwcFc2JTxA32MOhNe8Qb4YAuyOp+iH7loPQiQgs=; b=oBgGQWZ11gRKSvxdUbYsOYwtaM0ph7RZbzt6A9FfKpGKcb4UMwOPycExZ87979ACVAGHVa1DTtGH7x6QoeKDkChVKW06wfWE+tYmKeleT0pTUrpEpXnbfdc2XaxPt4M2euFYuhrirIFZy4NkNh6DoEFctzJJQ5bGwa2J0Ma5UZeUpJJmQ0L9IX+fDJz3p7hyeOCyqqIWYF+bq4t7yU7PhpphXkc/M4uIVbI2ufSaedeo1kuRXKvH8wyylunn9uHMz9jXl2dwup16GXkPpv4J3tJ2spGpLD7XZMJKguFkg0t8Spsn+QT4EpjDOARin4RPCE3+aMG1vL3SalbJ3Pw5DA== Received: from BN8PR12CA0033.namprd12.prod.outlook.com (2603:10b6:408:60::46) by MN2PR12MB4375.namprd12.prod.outlook.com (2603:10b6:208:24f::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.29; Tue, 6 Apr 2021 17:54:58 +0000 Received: from BN8NAM11FT051.eop-nam11.prod.protection.outlook.com (2603:10b6:408:60:cafe::84) by BN8PR12CA0033.outlook.office365.com (2603:10b6:408:60::46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.16 via Frontend Transport; Tue, 6 Apr 2021 17:54:58 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.35) smtp.mailfrom=nvidia.com; lists.ubuntu.com; dkim=none (message not signed) header.d=none;lists.ubuntu.com; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.35 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.35; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.35) by BN8NAM11FT051.mail.protection.outlook.com (10.13.177.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.3999.28 via Frontend Transport; Tue, 6 Apr 2021 17:54:58 +0000 Received: from HQMAIL101.nvidia.com (172.20.187.10) by HQMAIL111.nvidia.com (172.20.187.18) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 6 Apr 2021 17:54:57 +0000 Received: from dev-r-vrt-138.mtr.labs.mlnx (172.20.145.6) by mail.nvidia.com (172.20.187.10) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 6 Apr 2021 17:54:56 +0000 From: Roi Dayan To: Subject: [SRU][F:linux-bluefield][PATCH 5/9] net/sched: cls_flower add CT_FLAGS_INVALID flag support Date: Tue, 6 Apr 2021 20:52:05 +0300 Message-ID: <20210406175209.1714809-6-roid@nvidia.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210406175209.1714809-1-roid@nvidia.com> References: <20210406175209.1714809-1-roid@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1fcdfa85-de05-411e-ef8d-08d8f92517e5 X-MS-TrafficTypeDiagnostic: MN2PR12MB4375: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:346; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EZXURyZl//SQiVsLYfQTHArG+MHHT8I3PMFnHYr5LztYMgUNWFpTaOczzAwjoQfQJr3rjksxOB4mWj6pqRuQon8W0vK7PYD6B4sODx2FQO3P5Ky6SR5AFoA8GoSPVmfadOV6g/FuArdnk+zo0z0Q7UhSd5zMb+ooYD7LBu13fT6S722rvnKPVMxzdVpn536aIap3Ujbr2MyzmuZJCxnANMnZefF6WmUtQbL0L6ZRsP5tWIiRlQ1HL7snvqV1nNz2Kg8uw3L+BmP7NV07mbsDsvzAmFwOnHe/zptDgcnK8LmplugP2TbrJwVbBEDU0bLUv0uNHqwr7OOyWgMTQVAVA8TGfFO2S+bacVnhiimNf+BP90CaZhPbjp0nHFL3ZC9Cc1aQFTDfcujS01Cf1zQFwCLXW0UUAhuMybTnO8PZLDJnc5tUwvqPTGAcVc7Bb0l0tUV9l22IUh5QqW7DbirfE52dCl73z0a6TKt9KzC3yN1bjx4fdtx/PbY5/Au6uMC1hwgOFKuNm2jyeOri8xQDKpRRHheVpur6PDrDAx+OsxS1KnNwYqvr5/Yq4OMRfGh4Q2PiFjUGHkCo5LlnWMYeLqOOyCqSUhMftdnAb9gsU75EWWT2Iy50H5urIcyBNp3wKYZCF66kszf/8e5kieF14QZ2lPMS+z5P05hjU153mb6WrFS4y828U0NS6zJUztE+FTEW2YrnQcnvGqoCN7DT54i7A7uoki65LEI21Y0fO+M= X-Forefront-Antispam-Report: CIP:216.228.112.35; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid02.nvidia.com; CAT:NONE; SFS:(4636009)(396003)(376002)(136003)(346002)(39860400002)(46966006)(36840700001)(2906002)(356005)(26005)(1076003)(83380400001)(36906005)(82310400003)(6666004)(336012)(2616005)(426003)(7636003)(6916009)(86362001)(4326008)(70206006)(70586007)(966005)(54906003)(478600001)(316002)(8676002)(107886003)(5660300002)(8936002)(47076005)(36756003)(186003)(36860700001)(82740400003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Apr 2021 17:54:58.1177 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1fcdfa85-de05-411e-ef8d-08d8f92517e5 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.35]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT051.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4375 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: Vladimir Sokolovsky , Daniel Jurgens Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: wenxu BugLink: https://bugs.launchpad.net/ubuntu/+source/linux-bluefield/+bug/1922682 This patch add the TCA_FLOWER_KEY_CT_FLAGS_INVALID flag to match the ct_state with invalid for conntrack. Signed-off-by: wenxu Acked-by: Marcelo Ricardo Leitner Link: https://lore.kernel.org/r/1611045110-682-1-git-send-email-wenxu@ucloud.cn Signed-off-by: Jakub Kicinski (backported from commit 7baf2429a1a965369b0ce44efb6315cdd515aa9c) Signed-off-by: Roi Dayan --- include/linux/skbuff.h | 4 ++-- include/net/sch_generic.h | 1 + include/uapi/linux/pkt_cls.h | 1 + net/core/dev.c | 2 ++ net/core/flow_dissector.c | 13 +++++++++---- net/sched/act_ct.c | 1 + net/sched/cls_flower.c | 4 +++- 7 files changed, 19 insertions(+), 7 deletions(-) diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 6493c98c8631..66858fe38ffa 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -1329,8 +1329,8 @@ void skb_flow_dissect_ct(const struct sk_buff *skb, struct flow_dissector *flow_dissector, void *target_container, - u16 *ctinfo_map, - size_t mapsize); + u16 *ctinfo_map, size_t mapsize, + bool post_ct); void skb_flow_dissect_tunnel_info(const struct sk_buff *skb, struct flow_dissector *flow_dissector, diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index e71d8e8fdaa7..90241df79a0b 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h @@ -380,6 +380,7 @@ struct qdisc_skb_cb { }; #define QDISC_CB_PRIV_LEN 20 unsigned char data[QDISC_CB_PRIV_LEN]; + bool post_ct; }; typedef void tcf_chain_head_change_t(struct tcf_proto *tp_head, void *priv); diff --git a/include/uapi/linux/pkt_cls.h b/include/uapi/linux/pkt_cls.h index c6ad22f76ede..e82ca1c4edb9 100644 --- a/include/uapi/linux/pkt_cls.h +++ b/include/uapi/linux/pkt_cls.h @@ -563,6 +563,7 @@ enum { TCA_FLOWER_KEY_CT_FLAGS_ESTABLISHED = 1 << 1, /* Part of an existing connection. */ TCA_FLOWER_KEY_CT_FLAGS_RELATED = 1 << 2, /* Related to an established connection. */ TCA_FLOWER_KEY_CT_FLAGS_TRACKED = 1 << 3, /* Conntrack has occurred. */ + TCA_FLOWER_KEY_CT_FLAGS_INVALID = 1 << 4, /* Conntrack is invalid. */ }; enum { diff --git a/net/core/dev.c b/net/core/dev.c index c1ac4f5461af..4107002a0426 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -3499,6 +3499,7 @@ sch_handle_egress(struct sk_buff *skb, int *ret, struct net_device *dev) return skb; /* qdisc_skb_cb(skb)->pkt_len was already set by the caller. */ + qdisc_skb_cb(skb)->post_ct = false; mini_qdisc_bstats_cpu_update(miniq, skb); switch (tcf_classify(skb, miniq->filter_list, &cl_res, false)) { @@ -4568,6 +4569,7 @@ sch_handle_ingress(struct sk_buff *skb, struct packet_type **pt_prev, int *ret, } qdisc_skb_cb(skb)->pkt_len = skb->len; + qdisc_skb_cb(skb)->post_ct = false; skb->tc_at_ingress = 1; mini_qdisc_bstats_cpu_update(miniq, skb); diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c index e3bdd859c895..79377801cf15 100644 --- a/net/core/flow_dissector.c +++ b/net/core/flow_dissector.c @@ -254,9 +254,8 @@ skb_flow_dissect_set_enc_addr_type(enum flow_dissector_key_id type, void skb_flow_dissect_ct(const struct sk_buff *skb, struct flow_dissector *flow_dissector, - void *target_container, - u16 *ctinfo_map, - size_t mapsize) + void *target_container, u16 *ctinfo_map, + size_t mapsize, bool post_ct) { #if IS_ENABLED(CONFIG_NF_CONNTRACK) struct flow_dissector_key_ct *key; @@ -268,13 +267,19 @@ skb_flow_dissect_ct(const struct sk_buff *skb, return; ct = nf_ct_get(skb, &ctinfo); - if (!ct) + if (!ct && !post_ct) return; key = skb_flow_dissector_target(flow_dissector, FLOW_DISSECTOR_KEY_CT, target_container); + if (!ct) { + key->ct_state = TCA_FLOWER_KEY_CT_FLAGS_TRACKED | + TCA_FLOWER_KEY_CT_FLAGS_INVALID; + return; + } + if (ctinfo < mapsize) key->ct_state = ctinfo_map[ctinfo]; #if IS_ENABLED(CONFIG_NF_CONNTRACK_ZONES) diff --git a/net/sched/act_ct.c b/net/sched/act_ct.c index 5e752a878a08..a117beaf063e 100644 --- a/net/sched/act_ct.c +++ b/net/sched/act_ct.c @@ -1012,6 +1012,7 @@ static int tcf_ct_act(struct sk_buff *skb, const struct tc_action *a, out: tcf_action_update_bstats(&c->common, skb); + qdisc_skb_cb(skb)->post_ct = true; return retval; drop: diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c index c5a0f2c2635e..68364d9cc96f 100644 --- a/net/sched/cls_flower.c +++ b/net/sched/cls_flower.c @@ -298,6 +298,7 @@ static int fl_classify(struct sk_buff *skb, const struct tcf_proto *tp, { struct cls_fl_head *head = rcu_dereference_bh(tp->root); struct fl_flow_key skb_mkey; + bool post_ct = qdisc_skb_cb(skb)->post_ct; struct fl_flow_key skb_key; struct fl_flow_mask *mask; struct cls_fl_filter *f; @@ -314,7 +315,8 @@ static int fl_classify(struct sk_buff *skb, const struct tcf_proto *tp, skb_flow_dissect_tunnel_info(skb, &mask->dissector, &skb_key); skb_flow_dissect_ct(skb, &mask->dissector, &skb_key, fl_ct_info_to_flower_map, - ARRAY_SIZE(fl_ct_info_to_flower_map)); + ARRAY_SIZE(fl_ct_info_to_flower_map), + post_ct); skb_flow_dissect(skb, &mask->dissector, &skb_key, 0); fl_set_masked_key(&skb_mkey, &skb_key, mask); From patchwork Tue Apr 6 17:52:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roi Dayan X-Patchwork-Id: 1462960 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) 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: 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=k8JyIeJh; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FFFYM5Qm9z9sRR; Wed, 7 Apr 2021 03:55:19 +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 1lTpv1-0002wn-39; Tue, 06 Apr 2021 17:55:15 +0000 Received: from mail-mw2nam12on2041.outbound.protection.outlook.com ([40.107.244.41] 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 1lTpus-0002oL-7u for kernel-team@lists.ubuntu.com; Tue, 06 Apr 2021 17:55:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aUl61NpyLVK+E5aXxMt9S7NlS31efuIqMlV5FEzRo5wcfvSHM+3drvY2cwDlOCGz/oX6W+8FaMCZyTVNJ6Ps3JopzNHCTSCY/FoE8ZA3IQr1e/senH9rChZzDt6BzQOBhZGsXDK5T5Sum4c5QZhCOgj1Eq8t8ztoqD/YTQgxSAQ10KUJLJSA9WHZqifocurz4uZ/kSLbtNw/M1Q3NC5MoYNwy1xbMj4DQo/vKZzBUFJ0sKY45ePplj8Si5EYRaDgOegCvKpVXKSgyHlbk9ZhxbNAdS+JGwUQlNwNzp7UmIGIcVIo8f/QD6vsK/bciJRm79nSKeeGfDpnJ5/RWXKGGA== 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=O/30INMq+QYi9NCtlNycTHc9AhLhNiDfxYvGSBhrGMk=; b=f5/3Aogf5TKcLLKx3zSrGAV+GMYsL5MAXZqo+nzsJ+WReYjR1xXA1oqgsixM1mELYdHI32G0Jwo8R+sHyX6XYSiesV+3EIm8gn1Hbq2EokTUz0DlUEzTLzUYfn92c1F6GAYqnZUudCMM6xznY3FruRGCWekRnukX3IHR1DJ7hQ3lzvyKCikYj/zrx8A4/xlmf4oFL7SbLG4ZrP+hFsiCqPYDe0fIgGBcj1Fn5ds3DGRGQPYU37RCMEWpoN59qxFQYxEPr2a6FxAZlx8J0BKVcdLUiGP7SE7+WVXm2KT6kaeXnHefkoQgzHPaYYcQYysTryqk5NPdN1MCFA3p2c3pWQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.32) smtp.rcpttodomain=lists.ubuntu.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=O/30INMq+QYi9NCtlNycTHc9AhLhNiDfxYvGSBhrGMk=; b=k8JyIeJhRn+8Dj9+9TYNAwMklItErgQEn2ZOJcKY8kBRWXkwUV4y+pc0cgcBVhgQqungm217EKW91XJyXQbufneIrq4NaePpRcXcUeBp1KlGkbc4RxTBvdPuRh72PnU1F9t6WuZSrkAoenOPtlRsxKgm7urjnI9AWiH/SrR7xtN+sTSisnhCIFtBi68eK6Gv9lqArF7C+olAtJyajvagGUlz0rqn+0tCCjEKWjxMtL7k+fDaMuLpVJ0a16Tgbx46urrjJH3F/PXdEIHVgUiCIBl+jSjvxani6Jy1SUCIDQpMDAxBQyK6EQmtHPPhcsL8t81GRVg64cDCNmeMjbqp2w== Received: from BN1PR14CA0025.namprd14.prod.outlook.com (2603:10b6:408:e3::30) by MN2PR12MB3742.namprd12.prod.outlook.com (2603:10b6:208:16a::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.27; Tue, 6 Apr 2021 17:55:03 +0000 Received: from BN8NAM11FT060.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e3:cafe::d0) by BN1PR14CA0025.outlook.office365.com (2603:10b6:408:e3::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.16 via Frontend Transport; Tue, 6 Apr 2021 17:55:03 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.32) smtp.mailfrom=nvidia.com; lists.ubuntu.com; dkim=none (message not signed) header.d=none;lists.ubuntu.com; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.32 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.32; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.32) by BN8NAM11FT060.mail.protection.outlook.com (10.13.177.211) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.3999.28 via Frontend Transport; Tue, 6 Apr 2021 17:55:02 +0000 Received: from HQMAIL101.nvidia.com (172.20.187.10) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 6 Apr 2021 10:54:59 -0700 Received: from dev-r-vrt-138.mtr.labs.mlnx (172.20.145.6) by mail.nvidia.com (172.20.187.10) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 6 Apr 2021 17:54:58 +0000 From: Roi Dayan To: Subject: [SRU][F:linux-bluefield][PATCH 6/9] net/sched: act_api: fix miss set post_ct for ovs after do conntrack in act_ct Date: Tue, 6 Apr 2021 20:52:06 +0300 Message-ID: <20210406175209.1714809-7-roid@nvidia.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210406175209.1714809-1-roid@nvidia.com> References: <20210406175209.1714809-1-roid@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 73af4f71-5cbc-4492-0a8a-08d8f9251ab0 X-MS-TrafficTypeDiagnostic: MN2PR12MB3742: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:972; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iXX5KpqRTPLArjvoVGTh1wK/+eA4236XPK3EbLITRiC8ZqXTzR4jcAxjHx89lf5dusxoxmN7FBv8nyHNhN/7Sbfq7fq7FWSNSnqdQM43PYQeQLxzNfYcFPPGSB71SvDZPxDxBDYi8kdJ9V4HD7MvGBmfyEO8pGBuNFEyf/yrOMVJXpY/FejstH3kfnkZ7idaAo4yDF9SLpWAe9YluRUlLpJOtcr3bN6rS0T/a6kUcrZ7qecVCVDpH8HnforKE9uxtPtVpveMAwwZ3sE5fBhfD78ci1cRB0SwpVcOPs6v2Rd31d/lSeH3Gc1BXwodreaJu/YTgmzLYIaMaw3oy5xi1bk7uU1tKs3hOWqYpQ0sWH7cNDUU5ZIalO5F9J1ngmncyuGvGSGmggRSzzT+JIYKZKGSDEcTJvix2c5Tv6btBG1Bt3+dQ86Dd+PPK0XaGFUKJGUT64oRrz4AmNaKfh/FKctE9YdHXd5nngGDfBjQqzMWQfUIG2+gEq1Zlb7KII1QL7X45L4da8/r5l1hEaElbv27IkW26483MnXrrl8NpV9AtquhKg60semLo4qmGqQzzgZEZl2U+LAd4yYWat1pjNh8WOF/bY4NEnuXh/SiLMGWWRFZG8dLvCfjtR5ZAI89vO/PZ/aWWalluaA3SYg+AOBNEqXlxm/p9TlDTEs2PjmmQj0M9gmHy+1GL1m4AsJgpMqXd/XaG0CYAfDvis84iCbI/+Q1EyPgXTx3eTehUE0= X-Forefront-Antispam-Report: CIP:216.228.112.32; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid01.nvidia.com; CAT:NONE; SFS:(4636009)(376002)(136003)(346002)(396003)(39860400002)(36840700001)(46966006)(70206006)(70586007)(107886003)(7636003)(36756003)(82310400003)(5660300002)(2906002)(26005)(83380400001)(316002)(186003)(6666004)(6916009)(336012)(54906003)(82740400003)(8676002)(966005)(2616005)(86362001)(4326008)(478600001)(426003)(1076003)(356005)(8936002)(36860700001)(47076005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Apr 2021 17:55:02.8036 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 73af4f71-5cbc-4492-0a8a-08d8f9251ab0 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.32]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT060.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB3742 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: Vladimir Sokolovsky , Daniel Jurgens Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: wenxu BugLink: https://bugs.launchpad.net/ubuntu/+source/linux-bluefield/+bug/1922682 When openvswitch conntrack offload with act_ct action. The first rule do conntrack in the act_ct in tc subsystem. And miss the next rule in the tc and fallback to the ovs datapath but miss set post_ct flag which will lead the ct_state_key with -trk flag. Fixes: 7baf2429a1a9 ("net/sched: cls_flower add CT_FLAGS_INVALID flag support") Signed-off-by: wenxu Reviewed-by: Marcelo Ricardo Leitner Signed-off-by: David S. Miller (backported from commit d29334c15d33a6a92d2043ca88f84cd5ad026c57) Signed-off-by: Roi Dayan --- include/linux/skbuff.h | 1 + net/openvswitch/conntrack.c | 8 +++++--- net/openvswitch/conntrack.h | 6 ++++-- net/openvswitch/flow.c | 4 +++- net/sched/cls_api.c | 1 + 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 66858fe38ffa..1222db317c68 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -283,6 +283,7 @@ struct nf_bridge_info { */ struct tc_skb_ext { __u32 chain; + bool post_ct; }; #endif diff --git a/net/openvswitch/conntrack.c b/net/openvswitch/conntrack.c index d06d7d58eaf2..5d61cdb72b1e 100644 --- a/net/openvswitch/conntrack.c +++ b/net/openvswitch/conntrack.c @@ -271,9 +271,11 @@ static void ovs_ct_update_key(const struct sk_buff *skb, /* This is called to initialize CT key fields possibly coming in from the local * stack. */ -void ovs_ct_fill_key(const struct sk_buff *skb, struct sw_flow_key *key) +void ovs_ct_fill_key(const struct sk_buff *skb, + struct sw_flow_key *key, + bool post_ct) { - ovs_ct_update_key(skb, NULL, key, false, false); + ovs_ct_update_key(skb, NULL, key, post_ct, false); } int ovs_ct_put_key(const struct sw_flow_key *swkey, @@ -1319,7 +1321,7 @@ int ovs_ct_clear(struct sk_buff *skb, struct sw_flow_key *key) if (skb_nfct(skb)) { nf_conntrack_put(skb_nfct(skb)); nf_ct_set(skb, NULL, IP_CT_UNTRACKED); - ovs_ct_fill_key(skb, key); + ovs_ct_fill_key(skb, key, false); } return 0; diff --git a/net/openvswitch/conntrack.h b/net/openvswitch/conntrack.h index 59dc32761b91..317e525c8a11 100644 --- a/net/openvswitch/conntrack.h +++ b/net/openvswitch/conntrack.h @@ -25,7 +25,8 @@ int ovs_ct_execute(struct net *, struct sk_buff *, struct sw_flow_key *, const struct ovs_conntrack_info *); int ovs_ct_clear(struct sk_buff *skb, struct sw_flow_key *key); -void ovs_ct_fill_key(const struct sk_buff *skb, struct sw_flow_key *key); +void ovs_ct_fill_key(const struct sk_buff *skb, struct sw_flow_key *key, + bool post_ct); int ovs_ct_put_key(const struct sw_flow_key *swkey, const struct sw_flow_key *output, struct sk_buff *skb); void ovs_ct_free_action(const struct nlattr *a); @@ -74,7 +75,8 @@ static inline int ovs_ct_clear(struct sk_buff *skb, } static inline void ovs_ct_fill_key(const struct sk_buff *skb, - struct sw_flow_key *key) + struct sw_flow_key *key, + bool post_ct) { key->ct_state = 0; key->ct_zone = 0; diff --git a/net/openvswitch/flow.c b/net/openvswitch/flow.c index 38147e6a20f5..84f3bf8792d8 100644 --- a/net/openvswitch/flow.c +++ b/net/openvswitch/flow.c @@ -845,6 +845,7 @@ int ovs_flow_key_extract(const struct ip_tunnel_info *tun_info, #if IS_ENABLED(CONFIG_NET_TC_SKB_EXT) struct tc_skb_ext *tc_ext; #endif + bool post_ct = false; int res, err; /* Extract metadata from packet. */ @@ -882,6 +883,7 @@ int ovs_flow_key_extract(const struct ip_tunnel_info *tun_info, 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; + post_ct = tc_ext ? tc_ext->post_ct : false; } else { key->recirc_id = 0; } @@ -891,7 +893,7 @@ int ovs_flow_key_extract(const struct ip_tunnel_info *tun_info, err = key_extract(skb, key); if (!err) - ovs_ct_fill_key(skb, key); /* Must be after key_extract(). */ + ovs_ct_fill_key(skb, key, post_ct); /* Must be after key_extract(). */ return err; } diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index 3e9abd0e786c..f2a2847fc492 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c @@ -1679,6 +1679,7 @@ int tcf_classify_ingress(struct sk_buff *skb, if (WARN_ON_ONCE(!ext)) return TC_ACT_SHOT; ext->chain = last_executed_chain; + ext->post_ct = qdisc_skb_cb(skb)->post_ct; } return ret; From patchwork Tue Apr 6 17:52:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roi Dayan X-Patchwork-Id: 1462959 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) 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: 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=gpvU3iHh; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FFFYL1Sk5z9sWQ; Wed, 7 Apr 2021 03:55:18 +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 1lTpv0-0002vm-8Z; Tue, 06 Apr 2021 17:55:14 +0000 Received: from mail-eopbgr680075.outbound.protection.outlook.com ([40.107.68.75] helo=NAM04-BN3-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 1lTpur-0002ny-J1 for kernel-team@lists.ubuntu.com; Tue, 06 Apr 2021 17:55:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JdQM3ZkH6B533DTc+dL5ywO/y5I7NnEOcayTYU/b+s02yTcRVVal7ZmnNnkGj47FZR6bUFC+iKZSoLLvv9VLjE+u+s1+Nt5v+6+AXxLNJ6Wa1EasxcrqhBW0xUpPeUljhfPzswDar/6c8eDIKp/bWi/VEFyXM3bbokMy90PQ5nZUkvtWHkHQ8lud3RsYHOza6WbqtoJNqlem9eE01w6dRVZFyBjXs8+in1ax+0jheq+hm0NSTc1Ga33YfXmbOMt7ZfSgJB0xZ46ueGGO+ScGEDwyvoWzeNhwz3asevVCcZVOOHwwZNMOlD3Y2g6dJ2K5RT+FwP5Mh0Z62LeooSn1sg== 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=PvAU0KFQv89rrolpadP0SMZweDDKC7H9dMlMFOKWB4c=; b=FBDNBXKDiZTd22DgPHO7LunblEEVBi7cm+QH7YAJo2CfoL0tvY2ypPgWZRoJNFR8SEQ2atYRTU1CvogSLZDfklJX6zrKqf87IwFusKpSc064suVAhf7GlqDL2p0I8eO7UfU38B4Hory5LOj/d+Hzdac2WoZe5c0yA0sp+4HSP2LucUV6f2eOlH2nrJRAeGJl9xJ7KVD0WxcCh6SXzE+bmdgIv7pymwEb7aYlWPp8lyptqxetyZ9lnPJY9/w1Q6iL99uTLaQdW3BWkhbULuohP1mEZGOkasOO2KfcSkYpUNnt+EtUUJ2Xwsjje5rO4h17qLMRDEJD6EyDWeC9+rjHiw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=lists.ubuntu.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=PvAU0KFQv89rrolpadP0SMZweDDKC7H9dMlMFOKWB4c=; b=gpvU3iHhJd7/rysnIjkzu/PemxQ4MHA5O3zOqnSW3CeqFf2mL5ddfv6OgqnEF7vFZEUOhpKBg1ZSrG6Nx4k8dMnhs6r8MHbGYbeXBTCqR1+Y09EM8g2fjvIp7nORnPBSBDqIRWXC+BP/QkEmcdM1BXVW+TWEX3VqBzXN+Rt5q65Cv/WKiWNrNG5ui4VjDVT17/yQpM948k7xkhGsCF6TK13neJVCkQU1+DF3HRVnl2FkJhKWfmjGLTWpNQHt7ud59dsY6SpXDvOGG4gflCCdDmfYhr+aM0KS53ua0CWLRNiSgep/iebFne/Qk3uYZoELt/PD8pIJaaLZj0ftdIkU8A== Received: from MWHPR10CA0066.namprd10.prod.outlook.com (2603:10b6:300:2c::28) by DM5PR12MB1307.namprd12.prod.outlook.com (2603:10b6:3:79::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.32; Tue, 6 Apr 2021 17:55:02 +0000 Received: from CO1NAM11FT039.eop-nam11.prod.protection.outlook.com (2603:10b6:300:2c:cafe::f6) by MWHPR10CA0066.outlook.office365.com (2603:10b6:300:2c::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.16 via Frontend Transport; Tue, 6 Apr 2021 17:55:01 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; lists.ubuntu.com; dkim=none (message not signed) header.d=none;lists.ubuntu.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 CO1NAM11FT039.mail.protection.outlook.com (10.13.174.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.3999.28 via Frontend Transport; Tue, 6 Apr 2021 17:55:01 +0000 Received: from HQMAIL101.nvidia.com (172.20.187.10) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 6 Apr 2021 17:55:01 +0000 Received: from dev-r-vrt-138.mtr.labs.mlnx (172.20.145.6) by mail.nvidia.com (172.20.187.10) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 6 Apr 2021 17:54:59 +0000 From: Roi Dayan To: Subject: [SRU][F:linux-bluefield][PATCH 7/9] net/sched: act_ct: clear post_ct if doing ct_clear Date: Tue, 6 Apr 2021 20:52:07 +0300 Message-ID: <20210406175209.1714809-8-roid@nvidia.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210406175209.1714809-1-roid@nvidia.com> References: <20210406175209.1714809-1-roid@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 51aa94ea-db7d-4ff5-cb6a-08d8f92519f7 X-MS-TrafficTypeDiagnostic: DM5PR12MB1307: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2089; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: C7Ix4p44liesqhdZZbCUx32bWu4p/gmcGjVwZL6FAmqUpzX+nhRVco+Ngs/iHa29MZ8/2QVFAC5kaicZj61Ch0Ft6neLOY5meMK71f+iTNmJZyiMUJxM3HThdyBnWdrk110RLOtL2nOxaxG/x4zhcYzrN/qXPATAPe8zUmRcTB18SUk+506XcRlDMLSleOJfNzdn9crvFFC9+zJNr+LAXkLnsW/LtHtwdfuJXIt5/2ZGcCKNR8wFum8qnqDnBPIKCpu2JUDw5s1jM4naoMKDtvZhZtw6Ypnt8j3nuttEy0AYWTf7TCYks3JuxySSfovDoSM/nT4f5T/y6kWuckvlJUWaYRMZG677uezJaeP1cFXozSWju97C4RXEGtAN90JbL0bD1ex+dHto2rAGq1+S4U8EfFQGPaoVoxqY9IeeivdvirWkMqM5foL0OR5cxB/LZGrR3dFuCCJ6T5iUq6LmameHg2w284uspm4OP3xczJhvcA9nAK3BV6RjQxhonfNXrEbPdPUSEeJMvU13wFkWyyic8ozCu+sNe7eJbJ8jBCI/x8D0XJ3mXo/vsBfSVptBsBhtiCWvuu0cPDiMBrgxIzwosYlfuhRc0PMAMkSwxHxj3fYYgyGv0ymrYzbDB3+oZRzq9VeRoYAjqT/xZ8UId35vpN9HGEnhRiUxZV7naUMbngBznqwUDoDBJ19egA5IFfpOF350KhNu2gi38C5huMFfu7bcDn/j0gfaC+Xu5O8= 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)(39860400002)(376002)(346002)(136003)(396003)(36840700001)(46966006)(82740400003)(7636003)(356005)(107886003)(8676002)(36860700001)(70206006)(4326008)(36756003)(6916009)(47076005)(2906002)(478600001)(8936002)(966005)(83380400001)(36906005)(54906003)(82310400003)(336012)(316002)(186003)(26005)(70586007)(5660300002)(6666004)(1076003)(426003)(2616005)(86362001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Apr 2021 17:55:01.6591 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 51aa94ea-db7d-4ff5-cb6a-08d8f92519f7 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: CO1NAM11FT039.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1307 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: Vladimir Sokolovsky , Daniel Jurgens Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Marcelo Ricardo Leitner BugLink: https://bugs.launchpad.net/ubuntu/+source/linux-bluefield/+bug/1922682 Invalid detection works with two distinct moments: act_ct tries to find a conntrack entry and set post_ct true, indicating that that was attempted. Then, when flow dissector tries to dissect CT info and no entry is there, it knows that it was tried and no entry was found, and synthesizes/sets key->ct_state = TCA_FLOWER_KEY_CT_FLAGS_TRACKED | TCA_FLOWER_KEY_CT_FLAGS_INVALID; mimicing what OVS does. OVS has this a bit more streamlined, as it recomputes the key after trying to find a conntrack entry for it. Issue here is, when we have 'tc action ct clear', it didn't clear post_ct, causing a subsequent match on 'ct_state -trk' to fail, due to the above. The fix, thus, is to clear it. Reproducer rules: tc filter add dev enp130s0f0np0_0 ingress prio 1 chain 0 \ protocol ip flower ip_proto tcp ct_state -trk \ action ct zone 1 pipe \ action goto chain 2 tc filter add dev enp130s0f0np0_0 ingress prio 1 chain 2 \ protocol ip flower \ action ct clear pipe \ action goto chain 4 tc filter add dev enp130s0f0np0_0 ingress prio 1 chain 4 \ protocol ip flower ct_state -trk \ action mirred egress redirect dev enp130s0f1np1_0 With the fix, the 3rd rule matches, like it does with OVS kernel datapath. Fixes: 7baf2429a1a9 ("net/sched: cls_flower add CT_FLAGS_INVALID flag support") Signed-off-by: Marcelo Ricardo Leitner Reviewed-by: wenxu Signed-off-by: David S. Miller (backported from commit 8ca1b090e5c9a71abeea1dda8757f4ec3811f06e) Signed-off-by: Roi Dayan --- net/sched/act_ct.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/net/sched/act_ct.c b/net/sched/act_ct.c index a117beaf063e..fe132943eac2 100644 --- a/net/sched/act_ct.c +++ b/net/sched/act_ct.c @@ -926,13 +926,14 @@ static int tcf_ct_act(struct sk_buff *skb, const struct tc_action *a, tmpl = p->tmpl; if (clear) { + qdisc_skb_cb(skb)->post_ct = false; ct = nf_ct_get(skb, &ctinfo); if (ct) { nf_conntrack_put(&ct->ct_general); nf_ct_set(skb, NULL, IP_CT_UNTRACKED); } - goto out; + goto out_clear; } family = tcf_ct_skb_nf_family(skb); @@ -1011,8 +1012,9 @@ static int tcf_ct_act(struct sk_buff *skb, const struct tc_action *a, skb_push_rcsum(skb, nh_ofs); out: - tcf_action_update_bstats(&c->common, skb); qdisc_skb_cb(skb)->post_ct = true; +out_clear: + tcf_action_update_bstats(&c->common, skb); return retval; drop: From patchwork Tue Apr 6 17:52:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roi Dayan X-Patchwork-Id: 1462958 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) 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: 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=aOEsfUN8; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FFFYK2Clwz9sW1; Wed, 7 Apr 2021 03:55:17 +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 1lTpux-0002tq-GT; Tue, 06 Apr 2021 17:55:11 +0000 Received: from mail-bn8nam11on2041.outbound.protection.outlook.com ([40.107.236.41] helo=NAM11-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 1lTpus-0002oh-4m for kernel-team@lists.ubuntu.com; Tue, 06 Apr 2021 17:55:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F2SjdwuOY278/FXveRPGIZon+xvHPquzhGbgbavqnkrzoVVbBZePvvVmbiZcrn+6sm4nmb8RW3RKhqJPQXbjMfM9po44YjXA68s6NOspAdi5dH/yRWU08OfEbNjRMMPHZKSAEuCIwjogis8U9nC3yvKLRqFmtYz1KfEEzmJbREcrBvgDETZtolO1meKsNnzBYp2Xt8Y4TmpLCQnhh8k21Dic1xoUlNT6GaqcKrd2tEo3jv1OaxzVjwrywBGFivRTPZAjdEZOsw/69dEM3FK0Mmc2rkpbn61/wcREvxt+0oL3zx1+8nyRJiGJlfFaGfebkZxUk+B2a75UcUAcHe0zgQ== 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=50BAAwKn4LYV13Y50A2ikb7IWw/s9bthcWcaxRfOkf8=; b=FHJ3pmPsExvyNajp3FyRI3igRpYuvXwupS1BOo+KYU1feQKkBHCC2q80ITqSesllMyJVoxcI+PbNM1iyx+5cHRjk0YmskEtlkRhZA7xa/PlkNP0Bi48DnkKzsDwXGNUS62BQ4MzTe3kiiANv+HC6CC1JFM0qMH2nP8vR8xKRqimTo+GjOUyqvijNdz2aQ1B+06AlW2wKF+T5QzXcLKTN833wqA/BwA9AEeTjFDKKOjYn87OhGQ5UzTShxtX7vM0yVCQ7grT4VZGdbzZo26CBQPGY1J+cql5aEVaK6dL4VgzTnNmRjjap1DmldBcQxjw59hkwJr+hAtLBrRsMddBQFw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.32) smtp.rcpttodomain=lists.ubuntu.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=50BAAwKn4LYV13Y50A2ikb7IWw/s9bthcWcaxRfOkf8=; b=aOEsfUN8O9i/ZEhk30oqzCbicSIPi0q6sQjCVNl0NoEBg5OID9UyrPzb/ZuFre6BIYsaAQbC5g6xtX11sqLOwXiWnvl6TrPB1XIFH+eFZfl6Dvz5VuA0csb5P+z6j9GHXCjgxs7671Z4jGzPCRKiOya6CjPEugrJ1Th3LtIBfq+HLR8ZZ7u8dUV5OAPoW+u6E+ucOR9lVTGvJGzjIQ1d1rQpRJAKwxkt7gsE/yAttwk6aa/v7XvbClf/7yDhQRHzS7hk7e2uEAKrCpq3mveM8KYX2+Hn8biBk2IwvtYdM/MGpfISpMkXSgsuoCjadNxC1j19eC4MyIUr3ykZR0p6rw== Received: from BN1PR14CA0001.namprd14.prod.outlook.com (2603:10b6:408:e3::6) by MWHPR12MB1565.namprd12.prod.outlook.com (2603:10b6:301:b::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.27; Tue, 6 Apr 2021 17:55:03 +0000 Received: from BN8NAM11FT060.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e3:cafe::43) by BN1PR14CA0001.outlook.office365.com (2603:10b6:408:e3::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.28 via Frontend Transport; Tue, 6 Apr 2021 17:55:03 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.32) smtp.mailfrom=nvidia.com; lists.ubuntu.com; dkim=none (message not signed) header.d=none;lists.ubuntu.com; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.32 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.32; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.32) by BN8NAM11FT060.mail.protection.outlook.com (10.13.177.211) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.3999.28 via Frontend Transport; Tue, 6 Apr 2021 17:55:03 +0000 Received: from HQMAIL101.nvidia.com (172.20.187.10) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 6 Apr 2021 10:55:02 -0700 Received: from dev-r-vrt-138.mtr.labs.mlnx (172.20.145.6) by mail.nvidia.com (172.20.187.10) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 6 Apr 2021 17:55:01 +0000 From: Roi Dayan To: Subject: [SRU][F:linux-bluefield][PATCH 8/9] net/sched: cls_flower: Add match on the ct_state reply flag Date: Tue, 6 Apr 2021 20:52:08 +0300 Message-ID: <20210406175209.1714809-9-roid@nvidia.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210406175209.1714809-1-roid@nvidia.com> References: <20210406175209.1714809-1-roid@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6857c685-d93c-4715-3d06-08d8f9251b14 X-MS-TrafficTypeDiagnostic: MWHPR12MB1565: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:497; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dXLMTVScUzTkV836dhlRfpI13GRtqMD3BQaB7RCqSEZgT86K188CAfrOQvwXSWy62My6k567VLV1P+HUzS1UZ5yGe/63FIBySFbcaG4tL++C7liUR58FcEttfhbI4eqWUVMtS7e5o4OrAkfJSvuDsiP5kamEGFSc/NlWToyRh79Rh/m0Ic9KYDMtWU0VEPEtYs3igDcMMGN83ly19mMJ+9BPZdtUAoD5KVj4AnVt96kPBXweJrP051J00hBWjDz7rdg8c1UVbTvWmnnr+vA2EO2QzgrrYIYGuLPBJSbcaTKUQNnqRXhFqQK8UqSRNa7EH4U1TV8Bc9/IWyMBMMibusLpLLJGjCBGye7a7nvwKWuv8EobF/QDkxLV5TmP3Sx1S70GMFjjn3DAlgecadF5+RB5DrZ2VYTd1kqaafhMMJ+QJb2Nl7ogiff9Dd+JkX57+4S3vKO088llJQ0BsuJMA1Gm5QLR8T27NV7R52hChllVzv2BBe/f9kVCjpynko5MMWFTFFXs6Bs+a3O3cquSiIta+qS1DLe3+HlGMG/h00g1Qd5nZkIvQxLSQRdn4OL3G4k+6ym6TchwLaNJwizan6SLKs5sMdRaiO79QoggI1NwBz+QxbUqKpE8azaOc4nfhWfPh4LCWmCQlImnIx/b/MgCJOKJo+zYMj5qGLaq86+niKlDf4AyyVfMdEjK4Xk7qhpNel2Zrxwv6rd4lFEiCB2Jf85Ah0n5f0qXCpjV/L4= X-Forefront-Antispam-Report: CIP:216.228.112.32; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid01.nvidia.com; CAT:NONE; SFS:(4636009)(346002)(396003)(376002)(39860400002)(136003)(46966006)(36840700001)(5660300002)(8676002)(4326008)(1076003)(186003)(7636003)(82740400003)(356005)(2616005)(26005)(36860700001)(107886003)(70206006)(8936002)(82310400003)(2906002)(316002)(47076005)(70586007)(54906003)(426003)(86362001)(966005)(478600001)(36756003)(6916009)(83380400001)(336012); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Apr 2021 17:55:03.4473 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6857c685-d93c-4715-3d06-08d8f9251b14 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.32]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT060.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1565 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: Vladimir Sokolovsky , Daniel Jurgens Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Paul Blakey BugLink: https://bugs.launchpad.net/ubuntu/+source/linux-bluefield/+bug/1922682 Add match on the ct_state reply flag. Example: $ tc filter add dev ens1f0_0 ingress prio 1 chain 1 proto ip flower \ ct_state +trk+est+rpl \ action mirred egress redirect dev ens1f0_1 $ tc filter add dev ens1f0_1 ingress prio 1 chain 1 proto ip flower \ ct_state +trk+est-rpl \ action mirred egress redirect dev ens1f0_0 Signed-off-by: Paul Blakey Reviewed-by: Jiri Pirko Signed-off-by: Jakub Kicinski (cherry picked from commit 8c85d18ce647ac2517a1a1bb01b02648e23700e6) Signed-off-by: Roi Dayan --- include/uapi/linux/pkt_cls.h | 1 + net/sched/cls_flower.c | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/uapi/linux/pkt_cls.h b/include/uapi/linux/pkt_cls.h index e82ca1c4edb9..b4b05688a3b6 100644 --- a/include/uapi/linux/pkt_cls.h +++ b/include/uapi/linux/pkt_cls.h @@ -564,6 +564,7 @@ enum { TCA_FLOWER_KEY_CT_FLAGS_RELATED = 1 << 2, /* Related to an established connection. */ TCA_FLOWER_KEY_CT_FLAGS_TRACKED = 1 << 3, /* Conntrack has occurred. */ TCA_FLOWER_KEY_CT_FLAGS_INVALID = 1 << 4, /* Conntrack is invalid. */ + TCA_FLOWER_KEY_CT_FLAGS_REPLY = 1 << 5, /* Packet is in the reply direction. */ }; enum { diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c index 68364d9cc96f..d4d891d60ae8 100644 --- a/net/sched/cls_flower.c +++ b/net/sched/cls_flower.c @@ -286,9 +286,11 @@ static u16 fl_ct_info_to_flower_map[] = { [IP_CT_RELATED] = TCA_FLOWER_KEY_CT_FLAGS_TRACKED | TCA_FLOWER_KEY_CT_FLAGS_RELATED, [IP_CT_ESTABLISHED_REPLY] = TCA_FLOWER_KEY_CT_FLAGS_TRACKED | - TCA_FLOWER_KEY_CT_FLAGS_ESTABLISHED, + TCA_FLOWER_KEY_CT_FLAGS_ESTABLISHED | + TCA_FLOWER_KEY_CT_FLAGS_REPLY, [IP_CT_RELATED_REPLY] = TCA_FLOWER_KEY_CT_FLAGS_TRACKED | - TCA_FLOWER_KEY_CT_FLAGS_RELATED, + TCA_FLOWER_KEY_CT_FLAGS_RELATED | + TCA_FLOWER_KEY_CT_FLAGS_REPLY, [IP_CT_NEW] = TCA_FLOWER_KEY_CT_FLAGS_TRACKED | TCA_FLOWER_KEY_CT_FLAGS_NEW, }; From patchwork Tue Apr 6 17:52:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roi Dayan X-Patchwork-Id: 1462961 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) 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: 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=ks2j8nN+; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FFFYQ2Y3Yz9sWQ; Wed, 7 Apr 2021 03:55:22 +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 1lTpv4-0002zt-6t; Tue, 06 Apr 2021 17:55:18 +0000 Received: from mail-dm6nam12on2045.outbound.protection.outlook.com ([40.107.243.45] 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 1lTpuu-0002qX-Oc for kernel-team@lists.ubuntu.com; Tue, 06 Apr 2021 17:55:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KfScaLW76aCni2TfosekMyoKfKZlUS8MQamZTtaBCVhvRbu4e+2ue14V2USk70OIjG1TsPolb51yOP6DVl/+0+PJy4+205erekkhdDMlFJ8/9/GNHBgrY0Y5cRzfI4eOrPd/vIcy134bgQZ+zpFnBmNAmZQXDgXaKQgEu79w1YmHEyxe4p+sr0nFqWbcU+7TGZLO7VjAaWKYikTkpz5qJtW81Qbs5HYyBlg0dwwylyBqZ8vKxJzLSszRC8U8QkAPkmo4RCn6ZTfRvKalsQUTttJAgGfGsGhRrx8OMhlGhiZU2M+G3YOWLfROF92QxHc7LYYIV8PwxcOlXsYS0NIs+w== 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=PdRKfw7UeFQBo32czXBvaRPCU2JIHhWRGjE4Ex65PME=; b=Z3ITHqG/PWOjkR4Ix3uwu+mltyPuly7fCUyoBJyoz+UxM8Q6wpT++5oMDT/VY8rgo811+UcqY6Rf5vZD6jm0TX9dVYeWBGjgbTPKT5JssPh7jU+lAbfNoFYi/A9VvK9IeGdSQ8N+QXORPZJ6FUeApHhK/LmjEF0TOp+MGnA2iRQtjuo+X/lQYPVQN7cpPZ2lyzyQSfXUvuFvXLEtt82qb79CkeLPTAoDpJ+UL9GwQZgGVcAQlZ+Ro3Smvi4yhD8w+WPSLXaStvzGd4pCabQIMGjPf192q8uHw11wFDFulqXgSUHt4xikYh3U0QUBcznM/DsspJ09L3wv2F2BCTygxg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.36) smtp.rcpttodomain=lists.ubuntu.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=PdRKfw7UeFQBo32czXBvaRPCU2JIHhWRGjE4Ex65PME=; b=ks2j8nN+hFBss0/4dbCXZjDLhMJEN4Gish4xCKJXdFR1kue6DnAK9MmI/1sy5PQPPFadSe0c6vWzEVcfHEse1aB1t7+GrU3Ete+edeVrmS2pz6H7vwD7P9IVpJkitZpv7NVqokhDco2q6wrJFsDq7XkHVkZDEVCXS7c6A5M2hFrehNAp/op6hquzN+V/08dGdxR2yQUbH5AYIXMHRutIIe/ar77+XJjQxbLpTTntroGZvnFdMd4srz9OAiv3NAmAFZeH5naPmZgYm6spIU4p46cO8uahGkSDneLDOcq6ZQCfNDv3t/yfsRpg3oLcDnLJRGwW9nz/YChxEAGv+8TPvQ== Received: from DM6PR18CA0018.namprd18.prod.outlook.com (2603:10b6:5:15b::31) by BN6PR12MB1876.namprd12.prod.outlook.com (2603:10b6:404:104::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.26; Tue, 6 Apr 2021 17:55:06 +0000 Received: from DM6NAM11FT048.eop-nam11.prod.protection.outlook.com (2603:10b6:5:15b:cafe::9d) by DM6PR18CA0018.outlook.office365.com (2603:10b6:5:15b::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.16 via Frontend Transport; Tue, 6 Apr 2021 17:55:05 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.36) smtp.mailfrom=nvidia.com; lists.ubuntu.com; dkim=none (message not signed) header.d=none;lists.ubuntu.com; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.36 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.36; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.36) by DM6NAM11FT048.mail.protection.outlook.com (10.13.173.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.3999.28 via Frontend Transport; Tue, 6 Apr 2021 17:55:05 +0000 Received: from HQMAIL101.nvidia.com (172.20.187.10) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 6 Apr 2021 17:55:04 +0000 Received: from dev-r-vrt-138.mtr.labs.mlnx (172.20.145.6) by mail.nvidia.com (172.20.187.10) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 6 Apr 2021 17:55:03 +0000 From: Roi Dayan To: Subject: [SRU][F:linux-bluefield][PATCH 9/9] net: flow_offload: Add original direction flag to ct_metadata Date: Tue, 6 Apr 2021 20:52:09 +0300 Message-ID: <20210406175209.1714809-10-roid@nvidia.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210406175209.1714809-1-roid@nvidia.com> References: <20210406175209.1714809-1-roid@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 471559f7-129e-44b7-a3a8-08d8f9251c56 X-MS-TrafficTypeDiagnostic: BN6PR12MB1876: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:513; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qifN7ShelaK3tLkWIbZgwcvA/8k2NpFR9QlN8bQ+z8Ym98dB1p72octBBzXklYlCwM5enPXHSE9UtEqZGcHMMkMeCLxB+F5VS2sQmcvvvzCsbq2Jb/raiUunSnsqtUivT9sKLnTJy4r4TTmhD+5naNvJXf+mD00BRAYw7EVCtoQcfdJ9Flole7pFzLqU5YQbp7CxsaomyWenCvOXquzeJpFkLGpWhIyIYGfWXmyUmdnbGs90zeU9FmkVsEjlulCjddRarW1AvW4ALVlqQBYE+A8hgyDR0Tcj8C915EAkl7KWR0+rpL0Dt4DLb6jspW9FgmU9UbagGXK9ghAxLCF3zb3jMZx7j5WBnEZvkAjuwuRxKb9uPXW5wO0x4GAEfowZ2Kf5+x6Gd0Rom3uUGuX3Ua/pGQSZU+P1pgyG+5wGmir1yHCtWr4/mnkOIhRxHxukjnWjIGMrjdqToGz7jr7jE40grNjw9RyxvghEuqWGoW1MGDhyweNX3OY1MHej00ZvH1A0UkB+DsfIvA6Lv2c832YrrR0WGXHONJefXY8aOr0FcQRS2ln0sHZykWws8gw5zEvaLqdZgyVeNYEPLuulKNjkxQCy2aDkrh2FNOpCasQjjQR0W44hQg938PchvA3SxMypL/uE4zMpAKJBzvkzYYx02cHi41FUtRcAuk1trs4XzN8TP8sVBLsVjbwMnMftH3cfzcjrwzC3fkOXq+0L/+r1xr1k1yrA7uJJV4TZCa4= X-Forefront-Antispam-Report: CIP:216.228.112.36; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid05.nvidia.com; CAT:NONE; SFS:(4636009)(39860400002)(376002)(396003)(346002)(136003)(36840700001)(46966006)(186003)(8936002)(966005)(2616005)(1076003)(2906002)(6916009)(82310400003)(8676002)(36860700001)(316002)(107886003)(54906003)(82740400003)(36906005)(478600001)(26005)(70206006)(336012)(426003)(86362001)(47076005)(4326008)(7636003)(356005)(36756003)(5660300002)(70586007); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Apr 2021 17:55:05.6382 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 471559f7-129e-44b7-a3a8-08d8f9251c56 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.36]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT048.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1876 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: Vladimir Sokolovsky , Daniel Jurgens Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Paul Blakey BugLink: https://bugs.launchpad.net/ubuntu/+source/linux-bluefield/+bug/1922682 Give offloading drivers the direction of the offloaded ct flow, this will be used for matches on direction (ct_state +/-rpl). Signed-off-by: Paul Blakey Reviewed-by: Jiri Pirko Signed-off-by: Jakub Kicinski (cherry picked from commit 941eff5aea5d4371fb8a496a66e29aa8fc7a0c23) Signed-off-by: Roi Dayan --- include/net/flow_offload.h | 1 + net/sched/act_ct.c | 1 + 2 files changed, 2 insertions(+) diff --git a/include/net/flow_offload.h b/include/net/flow_offload.h index fcc7a4e2a25d..4f442ab26689 100644 --- a/include/net/flow_offload.h +++ b/include/net/flow_offload.h @@ -211,6 +211,7 @@ struct flow_action_entry { unsigned long cookie; u32 mark; u32 labels[4]; + bool orig_dir; } ct_metadata; struct { /* FLOW_ACTION_MPLS_PUSH */ u32 label; diff --git a/net/sched/act_ct.c b/net/sched/act_ct.c index fe132943eac2..4627bb7bdfa7 100644 --- a/net/sched/act_ct.c +++ b/net/sched/act_ct.c @@ -186,6 +186,7 @@ static void tcf_ct_flow_table_add_action_meta(struct nf_conn *ct, IP_CT_ESTABLISHED_REPLY; /* aligns with the CT reference on the SKB nf_ct_set */ entry->ct_metadata.cookie = (unsigned long)ct | ctinfo; + entry->ct_metadata.orig_dir = dir == IP_CT_DIR_ORIGINAL; act_ct_labels = entry->ct_metadata.labels; ct_labels = nf_ct_labels_find(ct);