From patchwork Tue Dec 14 17:24:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Blakey X-Patchwork-Id: 12676493 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 450F1C433FE for ; Tue, 14 Dec 2021 17:24:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236426AbhLNRYz (ORCPT ); Tue, 14 Dec 2021 12:24:55 -0500 Received: from mail-bn8nam08on2069.outbound.protection.outlook.com ([40.107.100.69]:40032 "EHLO NAM04-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S236424AbhLNRYy (ORCPT ); Tue, 14 Dec 2021 12:24:54 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ey4/52GpipTCgm8NVHTRz19r0gMEyZW6HsJ2Z00X4Gix20FKfgCf1XfpWkmIwhyT8ka9iGe2Q2tdBecN5Oj68MJWNmJ0L5mkIAqmnmPZhept+d2kLXuxEspPOKy82TDSn2CtSrDtp1mg2x/yiniWQsOR+KBvLhY1RNkDg0yQOGCDvLZdvToDYMfbY2vKqel5OD+M52cd7dkprMRwWCIdml1MW/6fThQKfGKRBp5lh3mNTlnnsQofI24M70wy8hQ8HYjm1cBW6we7chKmdVN3swRwwBBNmrOxNk+raBchF+urARlyKrt2yJk60V71BWqZVt82zlYBOrMyueQP0Ja9Ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=79JM/MbrmODiFRgErMjsuA+5wfvYPFNkA4dhLysjHNk=; b=aPPtgkcsalExv40S85WdnwYR8y3YBTctqrBZIX8hJNS7PuCtmexUMKAD+RMOFDM0QEBsDBvdH5jAByaa7Xbd0i0arupCUR8AKAbhKW0UAKxDTsyssf+bdrPf0eo8qyCnuuHYp9ZzXdQxRRcr1TN2QboZ59xZaEaXMjs4UuMUjgXaYPRar6J0VbD2dA2wl3dIFICsoUsSTD8rcYae71TXXBq8hX/jC6GRE6Cbzvx1OW3RxKojxua23ygynErmXsxbhmxUdd6gBVboe9MHwcSxviErE7nV89K3JS2kuv9lbxVtYkr1dOzKqkdsaWd4XNTXH+9VtAB36R7kJ2sVB6LBDg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 203.18.50.13) smtp.rcpttodomain=ovn.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine 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=79JM/MbrmODiFRgErMjsuA+5wfvYPFNkA4dhLysjHNk=; b=CkSitJYauhcZLk1rhYpgNVqoBkXrCfEO5+os8UMTcCsaAfsyfYTaXnrPjbp7UeO7cdJNASFGSjUyBXMmg1rrIPsf3JQOjBc7GurxIh9clN217swmrz+L/pOI5u4xERP0PRjPQkK+z/Y5kzRTvOS3iWyloPepL3JMk9/w4T3/SADQu9rgdEI9KN1nGaBdDBpnaUBVb2U1UaTrney7mYAzIGVOH71PrQiJoKkFiDwC0nkZE9W6Mui4twgUMfBE56QpYP3rYlKd04gCc7zy0ONVElOaPTtoXUTryxJhPT8E5W++t/ccXTSI8ztos83JOr82VOXoW1KyIutkdVaEwvPssA== Received: from MW4PR03CA0291.namprd03.prod.outlook.com (2603:10b6:303:b5::26) by CH0PR12MB5041.namprd12.prod.outlook.com (2603:10b6:610:e0::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14; Tue, 14 Dec 2021 17:24:52 +0000 Received: from CO1NAM11FT046.eop-nam11.prod.protection.outlook.com (2603:10b6:303:b5:cafe::57) by MW4PR03CA0291.outlook.office365.com (2603:10b6:303:b5::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.15 via Frontend Transport; Tue, 14 Dec 2021 17:24:52 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 203.18.50.13) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 203.18.50.13 as permitted sender) receiver=protection.outlook.com; client-ip=203.18.50.13; helo=mail.nvidia.com; Received: from mail.nvidia.com (203.18.50.13) by CO1NAM11FT046.mail.protection.outlook.com (10.13.174.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4778.13 via Frontend Transport; Tue, 14 Dec 2021 17:24:51 +0000 Received: from HQMAIL111.nvidia.com (172.20.187.18) by HKMAIL102.nvidia.com (10.18.16.11) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 14 Dec 2021 17:24: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.18; Tue, 14 Dec 2021 17:24:49 +0000 Received: from reg-r-vrt-019-180.mtr.labs.mlnx (172.20.187.6) by mail.nvidia.com (172.20.187.10) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Tue, 14 Dec 2021 17:24:45 +0000 From: Paul Blakey To: Paul Blakey , , , Saeed Mahameed , Cong Wang , Jamal Hadi Salim , "Pravin B Shelar" , , Jiri Pirko , wenxu , Jakub Kicinski , Marcelo Ricardo Leitner CC: Oz Shlomo , Vlad Buslov , Roi Dayan Subject: [PATCH net v3 1/3] net/sched: Extend qdisc control block with tc control block Date: Tue, 14 Dec 2021 19:24:33 +0200 Message-ID: <20211214172435.24207-2-paulb@nvidia.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20211214172435.24207-1-paulb@nvidia.com> References: <20211214172435.24207-1-paulb@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2070498b-a80e-41f6-a5a0-08d9bf26a35f X-MS-TrafficTypeDiagnostic: CH0PR12MB5041:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qSY4yMgH6TjZdxVSzgA0eim5r3LJIfM40s2EndtAlLC54z7jqCR4bOSEdvaZqsNhr2HgSjl3V8LjhRtkVNBQhbRP5HbHUfXJli4ITk8xzEoaiIIN23xEJkRiS/knuyDK14SgkNAmbZkQAyZ9l209abMzjYofvF0mbBvOH8r7Z65mYSiOjiDxckJOTTlZBq2MMetKfzYRZcPYt8EKjESNE6qqgS67MrmTN5/WfCqN793NgU0Bg0+c9vorXNZUVjDu7PUzxsgAH6Z9t8eD4spjOY/dksIknZXC9BiIv2SHYn96CizdjhxMKLXatNOclSn9gibZldmudxYXo6n6N6SMvzApBywuIkCZbpTgwKLgHO1aJwry9wYvSYS6GCPuaiWV29xXBFsICAycBe7sWcMgu/WFWFKRi4/B/e9cAXdm7XNfQugK/xwCc2JeiBTGYjG+ShP0xXTpImJ8zSCIjZHi/6KKShjFExgz483PUduY+DrymY+0wTuegqYDe/uhniSwQs2qbNoaYapO5MaodOZ/sWW+ubiliqhqihC/jNJpKTL9GLNGeBb0AZXiVX1bFlH+CLV5RPGOIc14kV84PTn1ZKmI2e6VZipFL+FId1qOBPbrgf0joKYrmoTqN7Y6u7yPNplHquB29qvyFKdlEv49LtlCJtuJS7Db5k8WUvrpKWA6d3U5WNQm5BKMZIzN3GJl6uradiF3urAoL69imJYiYNNKs12pxVWrNDayF2b8TodAHuFIDnMBMNB5upKVliQyzIRc37fCLwCAPL1ZXavRQGLgazKs8CDrvhQUpasoIAA2i3gq6QN2oLE/nlAlLDgh X-Forefront-Antispam-Report: CIP:203.18.50.13;CTRY:HK;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:hkhybrid02.nvidia.com;CAT:NONE;SFS:(4636009)(46966006)(36840700001)(40470700001)(5660300002)(2616005)(426003)(7636003)(107886003)(86362001)(2906002)(1076003)(356005)(336012)(26005)(83380400001)(4326008)(47076005)(921005)(36860700001)(186003)(36756003)(8676002)(6666004)(82310400004)(70206006)(70586007)(110136005)(316002)(508600001)(40460700001)(8936002)(34020700004)(54906003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Dec 2021 17:24:51.6815 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2070498b-a80e-41f6-a5a0-08d9bf26a35f X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[203.18.50.13];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT046.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB5041 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org BPF layer extends the qdisc control block via struct bpf_skb_data_end and because of that there is no more room to add variables to the qdisc layer control block without going over the skb->cb size. Extend the qdisc control block with a tc control block, and move all tc related variables to there as a pre-step for extending the tc control block with additional members. Signed-off-by: Paul Blakey --- include/net/pkt_sched.h | 15 +++++++++++++++ include/net/sch_generic.h | 2 -- net/core/dev.c | 8 ++++---- net/sched/act_ct.c | 14 +++++++------- net/sched/cls_api.c | 6 ++++-- net/sched/cls_flower.c | 3 ++- net/sched/sch_frag.c | 3 ++- 7 files changed, 34 insertions(+), 17 deletions(-) diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h index bf79f3a890af..05f18e81f3e8 100644 --- a/include/net/pkt_sched.h +++ b/include/net/pkt_sched.h @@ -193,4 +193,19 @@ static inline void skb_txtime_consumed(struct sk_buff *skb) skb->tstamp = ktime_set(0, 0); } +struct tc_skb_cb { + struct qdisc_skb_cb qdisc_cb; + + u16 mru; + bool post_ct; +}; + +static inline struct tc_skb_cb *tc_skb_cb(const struct sk_buff *skb) +{ + struct tc_skb_cb *cb = (struct tc_skb_cb *)skb->cb; + + BUILD_BUG_ON(sizeof(*cb) > sizeof_field(struct sk_buff, cb)); + return cb; +} + #endif diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index 22179b2fda72..c70e6d2b2fdd 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h @@ -447,8 +447,6 @@ struct qdisc_skb_cb { }; #define QDISC_CB_PRIV_LEN 20 unsigned char data[QDISC_CB_PRIV_LEN]; - u16 mru; - bool post_ct; }; typedef void tcf_chain_head_change_t(struct tcf_proto *tp_head, void *priv); diff --git a/net/core/dev.c b/net/core/dev.c index 2a352e668d10..c4708e2487fb 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -3941,8 +3941,8 @@ 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)->mru = 0; - qdisc_skb_cb(skb)->post_ct = false; + tc_skb_cb(skb)->mru = 0; + tc_skb_cb(skb)->post_ct = false; mini_qdisc_bstats_cpu_update(miniq, skb); switch (tcf_classify(skb, miniq->block, miniq->filter_list, &cl_res, false)) { @@ -5103,8 +5103,8 @@ 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)->mru = 0; - qdisc_skb_cb(skb)->post_ct = false; + tc_skb_cb(skb)->mru = 0; + tc_skb_cb(skb)->post_ct = false; skb->tc_at_ingress = 1; mini_qdisc_bstats_cpu_update(miniq, skb); diff --git a/net/sched/act_ct.c b/net/sched/act_ct.c index 90866ae45573..98e248b9c0b1 100644 --- a/net/sched/act_ct.c +++ b/net/sched/act_ct.c @@ -690,10 +690,10 @@ static int tcf_ct_handle_fragments(struct net *net, struct sk_buff *skb, u8 family, u16 zone, bool *defrag) { enum ip_conntrack_info ctinfo; - struct qdisc_skb_cb cb; struct nf_conn *ct; int err = 0; bool frag; + u16 mru; /* Previously seen (loopback)? Ignore. */ ct = nf_ct_get(skb, &ctinfo); @@ -708,7 +708,7 @@ static int tcf_ct_handle_fragments(struct net *net, struct sk_buff *skb, return err; skb_get(skb); - cb = *qdisc_skb_cb(skb); + mru = tc_skb_cb(skb)->mru; if (family == NFPROTO_IPV4) { enum ip_defrag_users user = IP_DEFRAG_CONNTRACK_IN + zone; @@ -722,7 +722,7 @@ static int tcf_ct_handle_fragments(struct net *net, struct sk_buff *skb, if (!err) { *defrag = true; - cb.mru = IPCB(skb)->frag_max_size; + mru = IPCB(skb)->frag_max_size; } } else { /* NFPROTO_IPV6 */ #if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6) @@ -735,7 +735,7 @@ static int tcf_ct_handle_fragments(struct net *net, struct sk_buff *skb, if (!err) { *defrag = true; - cb.mru = IP6CB(skb)->frag_max_size; + mru = IP6CB(skb)->frag_max_size; } #else err = -EOPNOTSUPP; @@ -744,7 +744,7 @@ static int tcf_ct_handle_fragments(struct net *net, struct sk_buff *skb, } if (err != -EINPROGRESS) - *qdisc_skb_cb(skb) = cb; + tc_skb_cb(skb)->mru = mru; skb_clear_hash(skb); skb->ignore_df = 1; return err; @@ -963,7 +963,7 @@ static int tcf_ct_act(struct sk_buff *skb, const struct tc_action *a, tcf_action_update_bstats(&c->common, skb); if (clear) { - qdisc_skb_cb(skb)->post_ct = false; + tc_skb_cb(skb)->post_ct = false; ct = nf_ct_get(skb, &ctinfo); if (ct) { nf_conntrack_put(&ct->ct_general); @@ -1048,7 +1048,7 @@ static int tcf_ct_act(struct sk_buff *skb, const struct tc_action *a, out_push: skb_push_rcsum(skb, nh_ofs); - qdisc_skb_cb(skb)->post_ct = true; + tc_skb_cb(skb)->post_ct = true; out_clear: if (defrag) qdisc_skb_cb(skb)->pkt_len = skb->len; diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index 2ef8f5a6205a..a5050999d607 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c @@ -1617,12 +1617,14 @@ int tcf_classify(struct sk_buff *skb, /* If we missed on some chain */ if (ret == TC_ACT_UNSPEC && last_executed_chain) { + struct tc_skb_cb *cb = tc_skb_cb(skb); + ext = tc_skb_ext_alloc(skb); if (WARN_ON_ONCE(!ext)) return TC_ACT_SHOT; ext->chain = last_executed_chain; - ext->mru = qdisc_skb_cb(skb)->mru; - ext->post_ct = qdisc_skb_cb(skb)->post_ct; + ext->mru = cb->mru; + ext->post_ct = cb->post_ct; } return ret; diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c index aab13ba11767..9782b93db1b3 100644 --- a/net/sched/cls_flower.c +++ b/net/sched/cls_flower.c @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -309,7 +310,7 @@ static int fl_classify(struct sk_buff *skb, const struct tcf_proto *tp, struct tcf_result *res) { struct cls_fl_head *head = rcu_dereference_bh(tp->root); - bool post_ct = qdisc_skb_cb(skb)->post_ct; + bool post_ct = tc_skb_cb(skb)->post_ct; struct fl_flow_key skb_key; struct fl_flow_mask *mask; struct cls_fl_filter *f; diff --git a/net/sched/sch_frag.c b/net/sched/sch_frag.c index 8c06381391d6..5ded4c8672a6 100644 --- a/net/sched/sch_frag.c +++ b/net/sched/sch_frag.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB #include #include +#include #include #include #include @@ -137,7 +138,7 @@ static int sch_fragment(struct net *net, struct sk_buff *skb, int sch_frag_xmit_hook(struct sk_buff *skb, int (*xmit)(struct sk_buff *skb)) { - u16 mru = qdisc_skb_cb(skb)->mru; + u16 mru = tc_skb_cb(skb)->mru; int err; if (mru && skb->len > mru + skb->dev->hard_header_len) From patchwork Tue Dec 14 17:24:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Blakey X-Patchwork-Id: 12676497 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83D29C433FE for ; Tue, 14 Dec 2021 17:25:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236437AbhLNRZD (ORCPT ); Tue, 14 Dec 2021 12:25:03 -0500 Received: from mail-dm6nam10on2071.outbound.protection.outlook.com ([40.107.93.71]:6145 "EHLO NAM10-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231625AbhLNRZC (ORCPT ); Tue, 14 Dec 2021 12:25:02 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Qrk9EshXiDUREiShsXRPkyvfMNNLyqEi8nQ424Pmo2fZpqYf4l/ZQacHpGxY2XkIaXAYcbuxl6L64idU+sM3+8SRkD6YROg1X+060tFRqVJc2DsG6ea/GPC+EoY25Dw2XhmuHyng3wgRcNf0hXdImmq3qeC+34iAT7mrRkphdYgpDajlvh7MoyHoQZ5bbgJrShipdcfU9CLBqdeU9qziWWUMzh2iujTo1AWMWH105s8irXqM+vXMSQ8/RF3X3d2iCDnscfV0VQS4xzEQxlgko5+qVIonCAdaW+O9XsSfmsXlAMFbG0MWyOj5ZiU/peCks+B9Y9VdAbx1TWBQq88cNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=VdH2gDBNBnZSkAIRTtdbBVAtafQMO3dtKO1ZiKtHByc=; b=n3sRnbtfzsSBKgI6MhUWhcMSWs5+mBzSiy/5vlt68UiXKtFaIG3Ffb6lU+7AMzkeJbRGPH4OSTArDN33qrxLPO547B4NYzcmwtYi2XO0oBcdm3LJkf7iDoRd/2/YIrHYPpY+OIb3BrYOzZ3WpVvHVUz+aZj0qlL8H/Z2ChqQHpj991s/xocVxD21SOMDdDVvdk9iyKV8ZSLzqcwOtBg5mYYRoiQmiprggZVq5/07QyiCK81QHR+oTdKjl3qNgXQtJHByygensPtcVVX9ZppoCdZQ2WQjAJDp+vWzY9hTmq62E0rDr5QUNyA+NPaC8mAIa1iOQkgbvv4OqXsBs5qAvQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 203.18.50.13) smtp.rcpttodomain=ovn.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine 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=VdH2gDBNBnZSkAIRTtdbBVAtafQMO3dtKO1ZiKtHByc=; b=McwFiyYNrBRM564DBr3QO/qZtlGikjsr2hkCc+MrdvoZ6TVLFJWIgl69QFVu20KRxcSto9OZarVKB0S3oy8qcsDLCBpC/uNhlnWvt2eOBYCrfd46S74mGReKropHrrYD6wThGVyt8S2yi0X0X04NMDWbr31yJ2iDSOXxVzOUDlGOh4px7m831sdygAhCbT3yW5N1/e0BUHkXM+MeQ2q8tdompU3u32ICLj8jbWPSdOVmxFZDloQi45NvhqJLynOcoYg3JFcj3HdbIJjPcK9kainbiEAn9aDBuNl6Oq82RVikMrOEm23X+T+AT8yU3a0Z24YWg7CflduTHFk0xRuC3Q== Received: from MW4PR04CA0218.namprd04.prod.outlook.com (2603:10b6:303:87::13) by CH2PR12MB3944.namprd12.prod.outlook.com (2603:10b6:610:21::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.18; Tue, 14 Dec 2021 17:24:58 +0000 Received: from CO1NAM11FT043.eop-nam11.prod.protection.outlook.com (2603:10b6:303:87:cafe::5) by MW4PR04CA0218.outlook.office365.com (2603:10b6:303:87::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17 via Frontend Transport; Tue, 14 Dec 2021 17:24:58 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 203.18.50.13) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 203.18.50.13 as permitted sender) receiver=protection.outlook.com; client-ip=203.18.50.13; helo=mail.nvidia.com; Received: from mail.nvidia.com (203.18.50.13) by CO1NAM11FT043.mail.protection.outlook.com (10.13.174.193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4778.13 via Frontend Transport; Tue, 14 Dec 2021 17:24:57 +0000 Received: from HQMAIL105.nvidia.com (172.20.187.12) by HKMAIL102.nvidia.com (10.18.16.11) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 14 Dec 2021 17:24:54 +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.18; Tue, 14 Dec 2021 17:24:52 +0000 Received: from reg-r-vrt-019-180.mtr.labs.mlnx (172.20.187.6) by mail.nvidia.com (172.20.187.10) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Tue, 14 Dec 2021 17:24:49 +0000 From: Paul Blakey To: Paul Blakey , , , Saeed Mahameed , Cong Wang , Jamal Hadi Salim , "Pravin B Shelar" , , Jiri Pirko , wenxu , Jakub Kicinski , Marcelo Ricardo Leitner CC: Oz Shlomo , Vlad Buslov , Roi Dayan Subject: [PATCH net v3 2/3] net/sched: flow_dissector: Fix matching on zone id for invalid conns Date: Tue, 14 Dec 2021 19:24:34 +0200 Message-ID: <20211214172435.24207-3-paulb@nvidia.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20211214172435.24207-1-paulb@nvidia.com> References: <20211214172435.24207-1-paulb@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cc0719c4-359c-43df-f1c2-08d9bf26a709 X-MS-TrafficTypeDiagnostic: CH2PR12MB3944:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4502; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /ibyFth4m79ddihjJxt+vKLGTVXTKgNOh2wwMuuUF5LLSRGvgsEYIY7Ablj3HMjG4Imsms49ekr2RU58bAwywDTrSNxvax3sLYYsNs1xqL6OjXwnS5SoxSuvDyAmDTZuDGSTumI7zCmnYb+ENQvqNwAz99DIsggAKjtGdQpcoXrLks5oN2ZTIBOMzHkabw9bYqUbH034Nmztnlq+JHmF91LRG4jjQeSvw3KRHLHltk84wK3tVrj77PmPVdQXmT2e8cv3LnIqc+mMC3NbznVYV5nG8QZHqjyw42QZUFB4zGDgJ+muITXdGtb/VWe32Q2QvMFXpY3tNOt1teJGA0DZRC4bUlPgWvMAOoqaz43kbOGgorX3xIYLPd+AAoA0NyEN9RuxZuiZ7GHQx2qP4GBq5FGX0BV150je8EFrVuDKuL5/cGMS7so1L9voPeix5GZMvS5u4q26vZ8NRsl7l3sLHygxPyY2zCzmvq7sZ0DMIp0X271GD9v/HMJV8xhFhKviuEUIjFXymrghZ0YsykR/9lSVTBqVRwkJK/QHYEFoBJpZc3y8JKjBaW8b6UhBq3ogN06anYz1sL4A7SrSoQLs5Gl7jRs08lh8NkuhbanqSzKnsQ9C/2VvWXoJr88kGSqZXmBQ8dOUdH8w13wZIYZY/DWzhLIzro2HGz4bdu1C307akiKGKV18BuGSlTyn6Q8CgvcTVXmpMpGqXI6NPLfpj2xwndHmV3fsmedoh8bGm08atBE5AAw6BwZX4W+5MSqu7H3UFiqz3GtF7wYypZs4x9yjpiwel9ODxS8b6l7JilPXXrSHqdvgd/VdrNrbnw6/ X-Forefront-Antispam-Report: CIP:203.18.50.13;CTRY:HK;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:hkhybrid02.nvidia.com;CAT:NONE;SFS:(4636009)(36840700001)(46966006)(40470700001)(107886003)(2616005)(36860700001)(186003)(26005)(36756003)(1076003)(70586007)(70206006)(7636003)(316002)(82310400004)(6666004)(40460700001)(86362001)(34020700004)(4326008)(2906002)(8936002)(47076005)(336012)(83380400001)(426003)(54906003)(5660300002)(110136005)(508600001)(921005)(8676002)(356005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Dec 2021 17:24:57.7995 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cc0719c4-359c-43df-f1c2-08d9bf26a709 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[203.18.50.13];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT043.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB3944 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org If ct rejects a flow, it removes the conntrack info from the skb. act_ct sets the post_ct variable so the dissector will see this case as an +tracked +invalid state, but the zone id is lost with the conntrack info. To restore the zone id on such cases, set the last executed zone, via the tc control block, when passing ct, and read it back in the dissector if there is no ct info on the skb (invalid connection). Fixes: 7baf2429a1a9 ("net/sched: cls_flower add CT_FLAGS_INVALID flag support") Signed-off-by: Paul Blakey --- include/linux/skbuff.h | 2 +- include/net/pkt_sched.h | 1 + net/core/flow_dissector.c | 3 ++- net/sched/act_ct.c | 1 + net/sched/cls_flower.c | 3 ++- 5 files changed, 7 insertions(+), 3 deletions(-) diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index c8cb7e697d47..2ecf8cfd2223 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -1380,7 +1380,7 @@ skb_flow_dissect_ct(const struct sk_buff *skb, struct flow_dissector *flow_dissector, void *target_container, u16 *ctinfo_map, size_t mapsize, - bool post_ct); + bool post_ct, u16 zone); void skb_flow_dissect_tunnel_info(const struct sk_buff *skb, struct flow_dissector *flow_dissector, diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h index 05f18e81f3e8..9e71691c491b 100644 --- a/include/net/pkt_sched.h +++ b/include/net/pkt_sched.h @@ -198,6 +198,7 @@ struct tc_skb_cb { u16 mru; bool post_ct; + u16 zone; /* Only valid if post_ct = true */ }; static inline struct tc_skb_cb *tc_skb_cb(const struct sk_buff *skb) diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c index 3255f57f5131..1b094c481f1d 100644 --- a/net/core/flow_dissector.c +++ b/net/core/flow_dissector.c @@ -238,7 +238,7 @@ void skb_flow_dissect_ct(const struct sk_buff *skb, struct flow_dissector *flow_dissector, void *target_container, u16 *ctinfo_map, - size_t mapsize, bool post_ct) + size_t mapsize, bool post_ct, u16 zone) { #if IS_ENABLED(CONFIG_NF_CONNTRACK) struct flow_dissector_key_ct *key; @@ -260,6 +260,7 @@ skb_flow_dissect_ct(const struct sk_buff *skb, if (!ct) { key->ct_state = TCA_FLOWER_KEY_CT_FLAGS_TRACKED | TCA_FLOWER_KEY_CT_FLAGS_INVALID; + key->ct_zone = zone; return; } diff --git a/net/sched/act_ct.c b/net/sched/act_ct.c index 98e248b9c0b1..ab3591408419 100644 --- a/net/sched/act_ct.c +++ b/net/sched/act_ct.c @@ -1049,6 +1049,7 @@ static int tcf_ct_act(struct sk_buff *skb, const struct tc_action *a, skb_push_rcsum(skb, nh_ofs); tc_skb_cb(skb)->post_ct = true; + tc_skb_cb(skb)->zone = p->zone; out_clear: if (defrag) qdisc_skb_cb(skb)->pkt_len = skb->len; diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c index 9782b93db1b3..ef54ed395874 100644 --- a/net/sched/cls_flower.c +++ b/net/sched/cls_flower.c @@ -311,6 +311,7 @@ static int fl_classify(struct sk_buff *skb, const struct tcf_proto *tp, { struct cls_fl_head *head = rcu_dereference_bh(tp->root); bool post_ct = tc_skb_cb(skb)->post_ct; + u16 zone = tc_skb_cb(skb)->zone; struct fl_flow_key skb_key; struct fl_flow_mask *mask; struct cls_fl_filter *f; @@ -328,7 +329,7 @@ static int fl_classify(struct sk_buff *skb, const struct tcf_proto *tp, skb_flow_dissect_ct(skb, &mask->dissector, &skb_key, fl_ct_info_to_flower_map, ARRAY_SIZE(fl_ct_info_to_flower_map), - post_ct); + post_ct, zone); skb_flow_dissect_hash(skb, &mask->dissector, &skb_key); skb_flow_dissect(skb, &mask->dissector, &skb_key, FLOW_DISSECTOR_F_STOP_BEFORE_ENCAP); From patchwork Tue Dec 14 17:24:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Blakey X-Patchwork-Id: 12676495 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 102E7C433EF for ; Tue, 14 Dec 2021 17:25:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236442AbhLNRZD (ORCPT ); Tue, 14 Dec 2021 12:25:03 -0500 Received: from mail-bn8nam11on2067.outbound.protection.outlook.com ([40.107.236.67]:36704 "EHLO NAM11-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S236437AbhLNRZB (ORCPT ); Tue, 14 Dec 2021 12:25:01 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fyE94LdfHIdgBlKAs1IVytcPtuyUmtVVu74k3jgRus5GQ4iSeqoGQHS1QIyTQeeWHqheZwqtTFUbKDb8h7bkNM/fdVVj4FPmEImKJ63odOP42FM8O1NVG/RSAi/HI2392bj/xZJVmfofL6JzZyTLKsLCH+4CWxhG9vQOGgUFVoA7NevGJTDkeearIdAlSVsDrmZWt4ZR4WlSgbfhpng1gysSqrsvEJUSSOA227mijW47wPgtAS33SlrT0z78TG19bQeHAbT5zQaj++XiCZRPxkA/AkqBIHLO6CqwQ8ZrXPjytQpZG0k+SBXgKJN1AZbdptdJFjya2b7MCSh0cQ0WBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=cGF+evTINXhfq54d8JVwPiilEbT5zDXXyh3ELFq6uTc=; b=Z66FyVY3zmMWu16Vioki2NjVXcroV69pTY2NQNj7SWax8WAa6yLKYZT3Xv02RqU/3dQ5R2AAQIOl/QuodkJVRC1k+nPp9+LkVMbTlsNikqQEIjuOzPXxGZ8sR4HSWLMaFED+WfQVzUBWuSlbtPqVHXztBnZyjJF1eMkip608UAjPQZlQyxPBOmQ4xpo/A7sWHPK7UOoylNBmBNKa0FVOanqZqDv5BKxxmOXEfhnlbRsy1FSurCCr5TpV183jrQsx++P7JDG2TXMDsbhOSID8wf7ccP6mi9Y/GkfYqeqZ86xttPZn/6EUrj9ncR3hRBFQC8mKeJ5dlqVSXuzGE3J13A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 203.18.50.13) smtp.rcpttodomain=ovn.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine 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=cGF+evTINXhfq54d8JVwPiilEbT5zDXXyh3ELFq6uTc=; b=jusejzC4PWljR5f3pIT3dR8s53DvLwg6OYv7XJb9WQx6BCoNonjmKtKbQkyNgGrTb3bun6ZRyRyfc8l1WGzLLSEjVJvkf845yZNnKJqklvb37n3ofD/x42NdXPaonWH0SBLmcpTvqxdO01cOEWchDVGbNcANX4vQmRezwjU/S2n93IaDerthPeg7NI4f2eJf5XSRcKfFVJpw6nZEwgQSj3Pw1WrjX6snjKuPpeewBVqWKp3rJYnqf0E5AJODxJLLW8Aq8pnXydS5tFWnftw7mKPl1aKNgDmWOu89dJ9BqDhe467Vbm+sEd2VTjihz0UZ16/oOtgPQkUPpAaMDP9++g== Received: from MW4PR04CA0221.namprd04.prod.outlook.com (2603:10b6:303:87::16) by DM4PR12MB5120.namprd12.prod.outlook.com (2603:10b6:5:393::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.13; Tue, 14 Dec 2021 17:24:59 +0000 Received: from CO1NAM11FT043.eop-nam11.prod.protection.outlook.com (2603:10b6:303:87:cafe::21) by MW4PR04CA0221.outlook.office365.com (2603:10b6:303:87::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14 via Frontend Transport; Tue, 14 Dec 2021 17:24:59 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 203.18.50.13) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 203.18.50.13 as permitted sender) receiver=protection.outlook.com; client-ip=203.18.50.13; helo=mail.nvidia.com; Received: from mail.nvidia.com (203.18.50.13) by CO1NAM11FT043.mail.protection.outlook.com (10.13.174.193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4778.13 via Frontend Transport; Tue, 14 Dec 2021 17:24:59 +0000 Received: from HQMAIL107.nvidia.com (172.20.187.13) by HKMAIL102.nvidia.com (10.18.16.11) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 14 Dec 2021 17:24:58 +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.18; Tue, 14 Dec 2021 17:24:56 +0000 Received: from reg-r-vrt-019-180.mtr.labs.mlnx (172.20.187.6) by mail.nvidia.com (172.20.187.10) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Tue, 14 Dec 2021 17:24:53 +0000 From: Paul Blakey To: Paul Blakey , , , Saeed Mahameed , Cong Wang , Jamal Hadi Salim , "Pravin B Shelar" , , Jiri Pirko , wenxu , Jakub Kicinski , Marcelo Ricardo Leitner CC: Oz Shlomo , Vlad Buslov , Roi Dayan Subject: [PATCH net v3 3/3] net: openvswitch: Fix matching zone id for invalid conns arriving from tc Date: Tue, 14 Dec 2021 19:24:35 +0200 Message-ID: <20211214172435.24207-4-paulb@nvidia.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20211214172435.24207-1-paulb@nvidia.com> References: <20211214172435.24207-1-paulb@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: df39aa5a-43c8-4e70-1cde-08d9bf26a7fd X-MS-TrafficTypeDiagnostic: DM4PR12MB5120:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cIPuuq+047UqjEEAeufGHRpIG0e6O65HqN3f0AzDLJxVVBjLkmSwFI1A9FZBj9ZlOOO74brRKsgyN+fttnFrCOElUyLpqSq2Dx1KuR5Qmh/Wj+H597ki1xtM9KoLPsXNUTgnJ8el76OxZ3qWKeivdvXYOrYCJfe6zjI9NuiwefbQUQ1TG7Dog0ipOdsXoPnpxVYuljiSerOSf533jZ7g5iF+copUQZANAJKMX24HnHZ1DH37X+B7LqyC3CGba6S53IGRrkoQzzrKVuUfvS1A/fy4WCpzyGzKDxQq+R9Zw2WBZhuXw9SRU8s/8ehnMH5LWJlfkLDra9j5AxOkKEzBit8kNxYkB+olQoe+YTQdcXCXfAFvBTTmqPtXaa5kve9OBmPwZSoDT1tNc5vjnMoGCAynBHrvq/LhX9PXLg8Fn2rPmU3g5FZnhQSmTz5CnXP1LrIV9RgVfcgev1he0PQ6Jz02J3ejkFJvzdMdy7JasZcAN0b1oPTqEWeQFwUNj6gpoBwe8rJi1doZhHTnuSQwtYLx2RxMrSENvWiOwrwgvkdbXaB8GieN3MuxrFyJxXiE5PLDRSDru8lea0bOsQxP6uA4OPdzUKNe32LA8bbJWGwkmP01XVU3YusbFxBNWwReJumyniw6XkxKR8KB20jVfRAYRgNKtvo3K3R57vl3QC7L+GlZoMK23CfFlpih9GZtfagWUVCvYZM4rbQutpXtdx6gDqmibeGTisyNFbqgeZncj+Z7+Ywsx2102yNl8VDoWR/LtZ5UkoyunpzvJGxkRUSlEwVGeg0O6onAv2gdzoHizmDUKURuAOsdvt2+Z1e5 X-Forefront-Antispam-Report: CIP:203.18.50.13;CTRY:HK;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:hkhybrid02.nvidia.com;CAT:NONE;SFS:(4636009)(46966006)(36840700001)(40470700001)(70586007)(26005)(186003)(70206006)(7636003)(36756003)(34020700004)(508600001)(336012)(8936002)(86362001)(47076005)(6666004)(356005)(921005)(1076003)(2616005)(426003)(5660300002)(83380400001)(107886003)(82310400004)(8676002)(2906002)(36860700001)(4326008)(316002)(40460700001)(54906003)(110136005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Dec 2021 17:24:59.3931 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: df39aa5a-43c8-4e70-1cde-08d9bf26a7fd X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[203.18.50.13];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT043.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5120 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Zone id is not restored if we passed ct and ct rejected the connection, as there is no ct info on the skb. Save the zone from tc skb cb to tc skb extension and pass it on to ovs, use that info to restore the zone id for invalid connections. Fixes: d29334c15d33 ("net/sched: act_api: fix miss set post_ct for ovs after do conntrack in act_ct") Signed-off-by: Paul Blakey --- include/linux/skbuff.h | 1 + net/openvswitch/flow.c | 8 +++++++- net/sched/cls_api.c | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 2ecf8cfd2223..4507d77d6941 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -286,6 +286,7 @@ struct nf_bridge_info { struct tc_skb_ext { __u32 chain; __u16 mru; + __u16 zone; bool post_ct; }; #endif diff --git a/net/openvswitch/flow.c b/net/openvswitch/flow.c index 9713035b89e3..6d262d9aa10e 100644 --- a/net/openvswitch/flow.c +++ b/net/openvswitch/flow.c @@ -34,6 +34,7 @@ #include #include #include +#include #include "conntrack.h" #include "datapath.h" @@ -860,6 +861,7 @@ int ovs_flow_key_extract(const struct ip_tunnel_info *tun_info, #endif bool post_ct = false; int res, err; + u16 zone = 0; /* Extract metadata from packet. */ if (tun_info) { @@ -898,6 +900,7 @@ int ovs_flow_key_extract(const struct ip_tunnel_info *tun_info, key->recirc_id = tc_ext ? tc_ext->chain : 0; OVS_CB(skb)->mru = tc_ext ? tc_ext->mru : 0; post_ct = tc_ext ? tc_ext->post_ct : false; + zone = post_ct ? tc_ext->zone : 0; } else { key->recirc_id = 0; } @@ -906,8 +909,11 @@ int ovs_flow_key_extract(const struct ip_tunnel_info *tun_info, #endif err = key_extract(skb, key); - if (!err) + if (!err) { ovs_ct_fill_key(skb, key, post_ct); /* Must be after key_extract(). */ + if (post_ct && !skb_get_nfct(skb)) + key->ct_zone = zone; + } return err; } diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index a5050999d607..bede2bd47065 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c @@ -1625,6 +1625,7 @@ int tcf_classify(struct sk_buff *skb, ext->chain = last_executed_chain; ext->mru = cb->mru; ext->post_ct = cb->post_ct; + ext->zone = cb->zone; } return ret;