From patchwork Sun Apr 11 11:45:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roi Dayan X-Patchwork-Id: 1464796 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=dXsC646i; 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 4FJ97G4Sblz9sVw; Sun, 11 Apr 2021 21:46: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 1lVYXe-0004XZ-W7; Sun, 11 Apr 2021 11:46:15 +0000 Received: from mail-eopbgr770057.outbound.protection.outlook.com ([40.107.77.57] helo=NAM02-SN1-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 1lVYXb-0004VC-Ty for kernel-team@lists.ubuntu.com; Sun, 11 Apr 2021 11:46:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UbDmIgdGUTBJGeE2bQOWAuivOgObyoIE0qmHcUdPi7/1+LHYVPJkLdQyaFfbgZxRSkAU4cbscRv2aV5u/RlGMVy7t5tmIDFF5exB66XpKL9LjlOtQSHyHLmKED5D0jruF2K6JXIeh/1VmpPXKsyXBuAH5wD56nNnshSSmJY+JhG1nXVCDUJ2BUHxc5IHuxU/SPI7D9wamhGjQAXEZ1XhUQ4g7VqemnRoQJBZolLmWnj2IjkELC6p/mCOlsoJFqBaVGFoqDTjrt5l8dUQZRNZczg2Ah3Up0sLoADHUSkX4g9e++MkBS0AsrKFSf5dN9aIC0gqyF43h9L79mYR3EaegA== 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=pClThcPAtPchZiG8sTjHb7gfZxRe4GdsL5UqrO40XYI=; b=DR5qZPjOtSQk/elps56714HJl2PjBhd8Qbozyz/xNV5ol8xAqrltgYUZJL/vGasFJIfqCBI58CNoysQOye+d9VI3uoSUBAXQ9bSpH70at51P6ua5d/OeIgSyu+AUcwYfYLepi9RYGQc5tqC9/t7HQyoyiagN+dLbbZjFvvzdxluRRv+rDavBtMrC+zHmfAKn090ug5iOpVVaRuuQlWkK2X3GaaFq6gXBsjt3jAuPWO1+DPbMtEAdayMXQ1F4O6rg0L1Hvxt9OMwqADkaEbRE1vryoaGmAKUVvB0EVQSbF650NbkEO4wFh2pbTBljrS6jHkmnGxlvHjGFsoQ75ZWgBQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=canonical.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=pClThcPAtPchZiG8sTjHb7gfZxRe4GdsL5UqrO40XYI=; b=dXsC646iYsKNf1y6ftK+iBEC6KDIqvKsvnmr62YShcW3v7iR6DGjAdmRv5ITsW82dO8IQ6/ublIuB0gmKpYLJzhMoThfnHQQgD0C9RyTgu1841qWyLFIBDD7nnlakiYhZsdjn1R0JbPtVuV72t4qfPXc4/4GmFTkkQNBziH5C095mV3QGc/OIzQBpeezBhG8lXjPPYe6TXZQw31JhTj97eR0jUmKCVtsHYBpgbnb+mP8NhQz2dzf+ttsm+Wkkrm9Rtw1Co8g7dJzJ78SLg0AhaiMbV9Fl4SwXLI6w4KwV5q0ZM1BILscpuiKPHJj4wCJlRNFv2nTfi8iVV1A85+iKg== Received: from MWHPR1601CA0011.namprd16.prod.outlook.com (2603:10b6:300:da::21) by DM4PR12MB5358.namprd12.prod.outlook.com (2603:10b6:5:39c::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.18; Sun, 11 Apr 2021 11:46:09 +0000 Received: from CO1NAM11FT009.eop-nam11.prod.protection.outlook.com (2603:10b6:300:da:cafe::3b) by MWHPR1601CA0011.outlook.office365.com (2603:10b6:300:da::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.16 via Frontend Transport; Sun, 11 Apr 2021 11:46:08 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; canonical.com; dkim=none (message not signed) header.d=none;canonical.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 CO1NAM11FT009.mail.protection.outlook.com (10.13.175.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4020.17 via Frontend Transport; Sun, 11 Apr 2021 11:46:08 +0000 Received: from HQMAIL111.nvidia.com (172.20.187.18) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sun, 11 Apr 2021 11:46:07 +0000 Received: from dev-r-vrt-138.mtr.labs.mlnx (172.20.145.6) by mail.nvidia.com (172.20.187.18) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Sun, 11 Apr 2021 11:46:06 +0000 From: Roi Dayan To: Subject: [SRU][F:linux-bluefield][PATCH 1/5] net/sched: cls_flower add CT_FLAGS_INVALID flag support Date: Sun, 11 Apr 2021 14:45:58 +0300 Message-ID: <20210411114602.2003649-2-roid@nvidia.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210411114602.2003649-1-roid@nvidia.com> References: <20210411114602.2003649-1-roid@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1f5ca383-6d80-4af9-8f08-08d8fcdf65a0 X-MS-TrafficTypeDiagnostic: DM4PR12MB5358: 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: ydRHBSrQ0ky/4yLgWebbbiA5BFo3Lys+M6M2gnyWg+46ln7oPfcXiePfD+NJD7Et6VGYb1qMVbA+BUNxiQXJpd669gvXunysqvZXQWnozV0RgTWEpbMUcQJKhwS1vZRdCue9zx+1LqgIrFGE3IZ5/Jgqx3veLtuj0yl1UraYbRs1mZKYh51EP+ZSKBwi30mRxSS98e1g9+yJGoOeNTl1h00+9q5u/Du1XHaOtSbU5/ZwKepARXA4nGdSBz29HJF1ArZ29uzkOGKzUjeSlC5Uz6LdEn5G22FhjHeOY0uXtwG6bYptITYh8eutvmcc/alj7HWyguUBECNoJba3l3SBLBEwNaGxiFEx8YaWWtuYLL+EKes8zzMS4BFf7IKHaaQW/s0+UJKv4gRTl7uNDZkYP3YGCXwdvUYaLx+XVs6Kt0jYZEqsLwBiB+8yZpAlqIIZsSynd6UjZLaXT5vSnw6sN1DojteW/zysBK1VqqKCrI9HvM2Eeurz5Poq9hl0oMN25njYOEeVGNqFDbwyFctYubX2y6BNpERMj5k+DjC/OGYxvP0ZZ0xF4+cuofhwxc0U3tzX5HQ9dKhDpUMZOJW/ckkgKfdvCvOVdkswH4szkTAg0Sjx8cPdveHgi9M+qQwsED9mA4TXcUfDVPGauGRaKqD7oRh/KpvSno8Ptfnhajj2KZRf2Hy/EwqEXpfpx6q1fUJISW5nGYzPxBtOmPuhES4UQLIBZ/eDOlgY3MPDCVg= 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)(396003)(136003)(376002)(346002)(36840700001)(46966006)(36860700001)(82310400003)(2906002)(8936002)(54906003)(6666004)(2616005)(426003)(26005)(478600001)(47076005)(8676002)(336012)(36756003)(5660300002)(86362001)(36906005)(70206006)(4326008)(316002)(186003)(83380400001)(6916009)(966005)(82740400003)(1076003)(356005)(7636003)(70586007); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Apr 2021 11:46:08.4743 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1f5ca383-6d80-4af9-8f08-08d8fcdf65a0 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: CO1NAM11FT009.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5358 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/bugs/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 Sun Apr 11 11:45:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roi Dayan X-Patchwork-Id: 1464797 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=lYtoBu/b; 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 4FJ97H3H2Pz9sW1; Sun, 11 Apr 2021 21:46: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 1lVYXg-0004YX-GK; Sun, 11 Apr 2021 11:46:16 +0000 Received: from mail-mw2nam12on2045.outbound.protection.outlook.com ([40.107.244.45] 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 1lVYXe-0004WM-71 for kernel-team@lists.ubuntu.com; Sun, 11 Apr 2021 11:46:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gFzufCuZd3Ep/MD3uXUtw17d2HUhl468Y6AmPtseQaCV5MJIATBLZlAEa5OLIXHVE2Vhatu7uUDD8He+a6P2lXvcz+/v2I4CWJYF/qPDsIq4j9lvM6N/xfakVWaBRxZsCsrISqWc+ejqOaRHpTdlkq+vDluVtpk8zK51y8T7PJXW9pZOin9Sc3NfiLOhbn4bvuwXnad2EyfwSbo4gFkMRJ6MbRrfCTZPVkyJymgH6PIEFhqqMFlgyyho/o+xVJWsiKfhW7tNz4qO5OjF0hS8o7xdGZiB0IODV44+IYdBvQjIHJ7RL3pP81npBeEx0z6cEFFdKcCW0OaIsj1QGHUpqg== 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=tMrqVOPuvLzGLtG0uy6HCy5DhaIw+fAoBt7Y83PdpFQ=; b=Gn59psLqQpq50B3UpMbQpeqjH3rKaNtxx9jWWMqbPlWrZEGbHff8X8i4ZdPunkbU/nYJjRsU13tOS9/UPPr7JbtChMG5Zpe1DPXXZp7xtzoesrDZ/By50L+rVm7AGwWoyY63wmlCOTZpkPzN8Gk3gDpeOPp4mnMnSPn0BzwRHn89c2dB7FVfYWSyCLrb+2m/7K7wYGE4Uj7ORAjPubf44h9wpMquKyOnRQZQXzGH5np5DtcDJUe6qOdf8WVn3Rcc0oyJJcpAGPdErZRm4Upjnp3lLvVTq2GSis1H5m1Htfat0gmdx4KC3osPlew1g30QHYdCdGdrKVh52oY8u6Y4wA== 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=tMrqVOPuvLzGLtG0uy6HCy5DhaIw+fAoBt7Y83PdpFQ=; b=lYtoBu/bsErEgHybvAi5cBDbVl69iWHFVqh08CCWLC9PUI+8LE8MViDJ0+DaN4G1TGSAo4whaM4GRBn1diYLaRIhF7L0q0fOYADvQiEInePP2K0mVQV1suTPZf348opF7HbouTZTkVlgPsA22V5rbnLLjUvLYSZz5EwaNxZKgoYq3V8hixwpw5qUhpvtIMRneKUkcwHvfQT/K5eA2To7HRUAy+95k0OxMhutz9vsHOejoKIjPC8z6CNOOoZaBlA/4DQbWTKwarZJ3OHT5bfpmCPMyOXwd/uOGgJvEgSbxIVDE/pki0hG+CT2c5hSjBcIcJFzNhNH/bmfkwzMpnQKdA== Received: from DM6PR02CA0112.namprd02.prod.outlook.com (2603:10b6:5:1b4::14) by BN6PR12MB1427.namprd12.prod.outlook.com (2603:10b6:404:20::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.18; Sun, 11 Apr 2021 11:46:11 +0000 Received: from DM6NAM11FT033.eop-nam11.prod.protection.outlook.com (2603:10b6:5:1b4:cafe::e3) by DM6PR02CA0112.outlook.office365.com (2603:10b6:5:1b4::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.16 via Frontend Transport; Sun, 11 Apr 2021 11:46:11 +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 DM6NAM11FT033.mail.protection.outlook.com (10.13.172.221) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4020.17 via Frontend Transport; Sun, 11 Apr 2021 11:46:10 +0000 Received: from HQMAIL105.nvidia.com (172.20.187.12) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sun, 11 Apr 2021 04:46:10 -0700 Received: from HQMAIL111.nvidia.com (172.20.187.18) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sun, 11 Apr 2021 11:46:09 +0000 Received: from dev-r-vrt-138.mtr.labs.mlnx (172.20.145.6) by mail.nvidia.com (172.20.187.18) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Sun, 11 Apr 2021 11:46:08 +0000 From: Roi Dayan To: Subject: [SRU][F:linux-bluefield][PATCH 2/5] net/sched: act_api: fix miss set post_ct for ovs after do conntrack in act_ct Date: Sun, 11 Apr 2021 14:45:59 +0300 Message-ID: <20210411114602.2003649-3-roid@nvidia.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210411114602.2003649-1-roid@nvidia.com> References: <20210411114602.2003649-1-roid@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c9418c1b-7202-49f6-a179-08d8fcdf6706 X-MS-TrafficTypeDiagnostic: BN6PR12MB1427: 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: RRQxcNwe1tsySC5Kow+isSusYhVRNWah49BRxJQYUs1wBThoKvK164wR1K8o6XYjigtWuT/IOlN3Gc/KnGDvt2llHk//gpoIr3ZFvo4iwgqC3wm2/ayqKKdgUdc8hWMPeZGykfOvKBLpnn74oD2F/Mt3l9RJZDnhgIxVCuROth0RpOyCqEEGrVAHYVHHFca0NCWoinn/aXmQF2qPXRtJG0oEgYLwPHHtOCcWo3AZrcEgnB4fP1KOQWHlKYB5WhsidR5Ux7/9GoT1IuRyzUuNNsQgCLdkQ/469+KYh/KIKQtdzexeOyCbDWdF8Fr2iMMxCYp7Yq2Y+d43L78RnZ//gw1p+zA59E3pDeJArL29FsnSpPpnkoUBkJPTwH+1QGCe2rvKZFGF7LMp46CnAspYbY3uPr29v8FFYGJib77gNmyMpajaRwYVwZE3ZaMuoWGSHly+iPGuAdOo3dGINPUjgkhp91sy1MXlO+udeQLMffUKFZuWVJKDqLuP1g68MA2QkFwIEyS2lUkp/1eMaCXkzLJE6XOdR0HRmemjqsrCimbtdc9qtXaS0UaNUreBdH/eDAlqDha4NhGCek61gCKGz1+Lf1JOwwTuvdhon5QPmg1mWSWHGxM6VydYautdpvjQfib/C0pyVgXpVuw2snKItNVb9GK+qfKWs/vKQ5RJb/MfWhnqr31KtJY612h0uo/XtYBQ2V4s6PQPLROGEIZwZcHGQ6EZWwQl1N42LM+ZPY4= 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)(39860400002)(376002)(136003)(346002)(396003)(36840700001)(46966006)(8936002)(6916009)(47076005)(6666004)(966005)(36860700001)(316002)(54906003)(82740400003)(2906002)(356005)(5660300002)(186003)(7636003)(86362001)(426003)(83380400001)(2616005)(478600001)(336012)(36756003)(70206006)(26005)(1076003)(8676002)(70586007)(4326008)(82310400003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Apr 2021 11:46:10.8180 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c9418c1b-7202-49f6-a179-08d8fcdf6706 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: DM6NAM11FT033.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1427 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/bugs/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 Sun Apr 11 11:46:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roi Dayan X-Patchwork-Id: 1464798 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=ROAcNw1f; 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 4FJ97N5Tc1z9sVw; Sun, 11 Apr 2021 21:46:24 +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 1lVYXl-0004bi-AY; Sun, 11 Apr 2021 11:46:21 +0000 Received: from mail-bn8nam12on2066.outbound.protection.outlook.com ([40.107.237.66] helo=NAM12-BN8-obe.outbound.protection.outlook.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1lVYXf-0004X0-7T for kernel-team@lists.ubuntu.com; Sun, 11 Apr 2021 11:46:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kdl6CokdXa/ET7JsyOC33C6Tz8CAapDCka1Npn2+8iHDUANdkx62LGtckvgMv8kI2c0J5wEjGRTWlMb0zsCB27ylum4s++GfoV32JxghVqdkl5RrJV/6vzwcS0C4p1Pq/yNY61IrnPe6t9VRC0xXUJIDc/HewQ1wCeaIASgReF+wouFqeRq9d7FXTFJ0Cd2/WsEj70D2emQZpfpJSOIUaVJJY1KDas/O34PFAXWJfI3gcUbnX08/xVh+4YpUrZMuXJUI+ctltjnQBlsgrrTNHRMH56ThQ6N+HKvZEW34T9Nost58zp8aXvLNjojy4dH5BH/pNOBw5+AUjNaZ+ECwbQ== 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=fJnojFCrf6Zy59G5pnI95DjxbxJ3+6KMGXS7/H6oZFo=; b=C/xV4G2mNpM4sroIMEsZcSRnuNS0euvuz4ec1HQYf162buly+BQpyE3eit/5hEKsdewiK4SvYsj07p0ZLFmR73YBX3saIPoYzNnf1iQ1z5YdDytxfgfJ0tNCQl63wvoRxtdCQ+WDbyQVR5cOGZbzCu7dYLRuLnrTzGIcMJIl8pJw/112mW9yX0yqcZq1MVswvLVHNUrz+lbFDNtROjS9p10q6tl8D31bsC/ZzYLpjRAF0Md1YdIyq4RgRn6/JU3Q0ot9C9jcd2IeVg2vW4MHWaZ/kUbSosTZieUCGBgYTuaLTbFiH3vYojIDF1E9RRxjjRqGkPMs3a/hFU77rR3vbA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=canonical.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=fJnojFCrf6Zy59G5pnI95DjxbxJ3+6KMGXS7/H6oZFo=; b=ROAcNw1f/cs765hwq/w4+H9QQdNnim3rB3BX1Tejzc4/g3h51pkWOZeYvNHnIkaQ6pXuXQmuySoae/bsekYJORQKvR2bCBg5b5DooM/IS5aULfyhALsjn3Vqo+bGemz+GaRaGdJ1PRGVssarG1l1637FJzHFCgKE+4BFLJxTjgA0ryCQVp809m/Omwt+t9UCrGdm4UT8U3mfnXQyhhxYm0cNMIMm52lFIju5HVSg3ifPotEaXiVRJgdEqE+w0HA/CmD9wZReZtgDzDmkNnNN4qNVUyKbd0+ZJ8i1N9YOm5WzSRB83ZrnI2I+pbDfbLncBjYjquLuCjJ1L38t95S4Aw== Received: from MWHPR03CA0020.namprd03.prod.outlook.com (2603:10b6:300:117::30) by DM6PR12MB4418.namprd12.prod.outlook.com (2603:10b6:5:28e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.21; Sun, 11 Apr 2021 11:46:12 +0000 Received: from CO1NAM11FT029.eop-nam11.prod.protection.outlook.com (2603:10b6:300:117:cafe::4d) by MWHPR03CA0020.outlook.office365.com (2603:10b6:300:117::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.21 via Frontend Transport; Sun, 11 Apr 2021 11:46:12 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; canonical.com; dkim=none (message not signed) header.d=none;canonical.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 CO1NAM11FT029.mail.protection.outlook.com (10.13.174.214) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4020.17 via Frontend Transport; Sun, 11 Apr 2021 11:46:12 +0000 Received: from HQMAIL111.nvidia.com (172.20.187.18) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sun, 11 Apr 2021 11:46:11 +0000 Received: from dev-r-vrt-138.mtr.labs.mlnx (172.20.145.6) by mail.nvidia.com (172.20.187.18) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Sun, 11 Apr 2021 11:46:10 +0000 From: Roi Dayan To: Subject: [SRU][F:linux-bluefield][PATCH 3/5] net/sched: act_ct: clear post_ct if doing ct_clear Date: Sun, 11 Apr 2021 14:46:00 +0300 Message-ID: <20210411114602.2003649-4-roid@nvidia.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210411114602.2003649-1-roid@nvidia.com> References: <20210411114602.2003649-1-roid@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bcb2930b-d013-4af9-707b-08d8fcdf67cc X-MS-TrafficTypeDiagnostic: DM6PR12MB4418: 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: 7sYn652zYgy1BiHLtzugTk535zRwCfnCDsVmyqY3n7D6uyZnOcUaXrUyuihssHyQGKZutLTZ1YXaUsMxZ9ElpFnilM86RYp9B6uWilw0FM3RG5RfM6yxCkmyIIlHZKciB9daETUKHgIwY3E108Bo0R9DsPofSZjS3FN2HEJBLFPS2Q0IFzfhFQA1uECXubH5Eo1+0s/GwKMJvPv6Jf6YLhSq6g1ta7lI9bHxwavxFbq8oddRbiR8i98ZC065FRQ/XTVvcXiCqxkJ6503mWPJjTUMx8ekI14UEhoSla1gE3OMvuCjfHajdAGcFIZjhxECbKbM0AgHTqAGip+Y/t7sOPp0wSyN+X2iGTbspKXhIz1WN2JZ/MCrX2tXSPnf6T+8ASUptGDpBHH47MC40s+OSqAB16OMlcBEXEw2UrZDkVoughsWKiEpCEYD8ACLrTJLc9RrjFeXbICbgKFgje29OjFLEBn5tfNZAzdkkhKYId2vbChi0XX40jehobEJ3iq6FfPVvcMYRF3+MAz9CNYsWQTBCNIp2eU4cU4WcQIaekAv9nfi3mFLYkgxeBreIXNStfNwTotdDuFNLSA97HsHrRjHXURDzaC2tuTfIQlwtlFNPGC6LIEkPfVzFD8s6wvZDVv1CpG0YnwCRjb30n1e7dR6LEs27FJyWI22fR6N8Nq2fSwFGWPLzN8FWXrgrUOA3uNfhLCyrC4yN41PVIVGTf/7yijcfr3xbs2V7keHqdU= 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)(376002)(346002)(396003)(39860400002)(136003)(46966006)(36840700001)(47076005)(54906003)(1076003)(5660300002)(83380400001)(2616005)(4326008)(36756003)(26005)(356005)(7636003)(336012)(186003)(86362001)(36906005)(6916009)(426003)(966005)(36860700001)(70586007)(316002)(8676002)(82310400003)(82740400003)(70206006)(2906002)(8936002)(478600001)(6666004); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Apr 2021 11:46:12.1193 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bcb2930b-d013-4af9-707b-08d8fcdf67cc 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: CO1NAM11FT029.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4418 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/bugs/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 Sun Apr 11 11:46: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: 1464800 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=V5jMMktW; 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 4FJ97S3ncTz9sVw; Sun, 11 Apr 2021 21:46:28 +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 1lVYXp-0004f4-B4; Sun, 11 Apr 2021 11:46:25 +0000 Received: from mail-mw2nam10on2065.outbound.protection.outlook.com ([40.107.94.65] helo=NAM10-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 1lVYXi-0004ZH-Qv for kernel-team@lists.ubuntu.com; Sun, 11 Apr 2021 11:46:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GGe/mZOh6yEYFA+4+gR1WeWEx/71Pk6QtCQjWjrnfeQU5kqSyPnpP6QaYPrGzuVWJ/7mWroZ+4KpC9MShEaF42f+mmdBljfryreY8Amomz4tQ3eIry824l0HIc1IGeevN7oDqcz3BQGcgYE30pV32yfM4GY3GhgOjxI0zKcRGMmC5U47ssTNDhwx2LBcZWdO9NKfy8jt2K54Lk2Px6p6pztth5akyiLKdVF52UseRwmbZlqbZdUm9XdxZrHQJty/wtoMmucCeYDxKr9oCTsg3DIgEj45W6MOqHDCyBmOurfx13fTQzDt8X5D/rQeuFdnoFV1lzvyt0OUwWsEsP57TQ== 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=Eg15EuCXwkM0MAGp0ljAHaPAMbC8ilkO+Zkzu8omupQ=; b=g3HT8RFRag7iAFmR820ssstbCseLaHz/Z5jBMe2LnkpnuwGeyLpr/ZogEkigndGVKtjVEX6uyhvr+PrnYgIS0/Lew8hnUYpTWR3uMjNZEHHHrkMqbZeqHpPPCU1Dvs1veab09uMXwzHgH/Tt1fcD7i2dBi+yetdMKKBQ2stHMbOYH76pdh7yZoiSC4I+vfLYzPz+f7ghL/v8KtdWVk4uPRuNflICgapd4IgqGIjxO7Ffv1FFCeWs9mhzKVBuC7JGk5jwpK38MpYtsEZmON1MlhpHNSm8e8Z/cVO9UiIZbDh2n6naJFLHUIqQ0dLpkvYiO4NFEvpAqx5AwWlyhKOn+A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.36) smtp.rcpttodomain=canonical.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=Eg15EuCXwkM0MAGp0ljAHaPAMbC8ilkO+Zkzu8omupQ=; b=V5jMMktW8LpNiZvrws0bTc/8oSZ5yTRvvCQ3ba/3cBvGxzff0q0Zhy1XOVSo+MPFgXfRg2ClCwDL+IjpXatGWYNDPa9QBrpJAEQgTqFNX99neONrS5i3G19ikxkYDM2ZlHeSQ4AWo3IXBot7+UAlppRMgQyo8HJPvq19Y3B90FsMtqJYmGLlfRWKWhFMsrYxVAz4zrVwgogduSn0f2txOds6XgRa3f7b7YCBu85N6FzNZDhhrgGI8qc825FqUY+OKm6zufU1Q/dgv7i/n3hJurQ6vxm+8jikCII6tOUSmPQIktrqdMpHwF0NvazWkH3tNAHSYW5tG1q5aWMyFaF0+Q== Received: from DM6PR01CA0006.prod.exchangelabs.com (2603:10b6:5:296::11) by MWHPR12MB1264.namprd12.prod.outlook.com (2603:10b6:300:d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.16; Sun, 11 Apr 2021 11:46:14 +0000 Received: from DM6NAM11FT017.eop-nam11.prod.protection.outlook.com (2603:10b6:5:296:cafe::10) by DM6PR01CA0006.outlook.office365.com (2603:10b6:5:296::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.16 via Frontend Transport; Sun, 11 Apr 2021 11:46:14 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.36) smtp.mailfrom=nvidia.com; canonical.com; dkim=none (message not signed) header.d=none;canonical.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 DM6NAM11FT017.mail.protection.outlook.com (10.13.172.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4020.17 via Frontend Transport; Sun, 11 Apr 2021 11:46:13 +0000 Received: from HQMAIL111.nvidia.com (172.20.187.18) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sun, 11 Apr 2021 11:46:13 +0000 Received: from dev-r-vrt-138.mtr.labs.mlnx (172.20.145.6) by mail.nvidia.com (172.20.187.18) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Sun, 11 Apr 2021 11:46:12 +0000 From: Roi Dayan To: Subject: [SRU][F:linux-bluefield][PATCH 4/5] net/sched: cls_flower: Add match on the ct_state reply flag Date: Sun, 11 Apr 2021 14:46:01 +0300 Message-ID: <20210411114602.2003649-5-roid@nvidia.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210411114602.2003649-1-roid@nvidia.com> References: <20210411114602.2003649-1-roid@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 307c6925-4cb1-43cd-8524-08d8fcdf68e9 X-MS-TrafficTypeDiagnostic: MWHPR12MB1264: 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: yLOY1vDWJcBDVmBehKuTt9XASrrnrGszLi5LB+gopMbxOf1HsNXVmD3u/mfsvZFSlEoGfFXGsK1dNrLYDP1/0M22HfRmOUbkppuwvJGZaLjRe8Y2D7cQPyDy7foOiSoXr96fqMfUeWQONNgliW++MYJa9SGuBPobr3jgcEheB69uRRYQBGv4zDDZNuUcHiHkPXWXHR5OmIyV/JVmHXtqM3qlSBruxmIZBpAKSsjvZie7X3TILdzhUuAJCPdzgh4scHHS78Vu+SBzerogMj9L6XKXgkMQtSdUEjaaakw2gc2zPsz/IqLUDx4rQk2swjJABHOtc+Zow16ErKUl3/RiXOT1mdCyFX0mf5ny+FqXX+D/61tRL8rtZe2LDpAcbqypuZTAcYcyy4PEKd0yfDa8ZYK4q1qe3HZXDyljSpIM9HaA+YKJy7tlWfhOj7Y5Cfot1f1zLn+xh4etdO4SIwjvCRs+bIgUnTX9P0uOBNtZ2U+pVnhzf/d3fKz9hBDaS2FcES/45crWAzuIqeVZfbzIpEgmXEhdzZHds8Vd76HRfabwWX9GnC8MYs6QEucdq0keyBM+xF+1WTKPBVeuxfMs4xJf7qFC+97eAtFfoYp1Q86XBO9SBUvZnCVZpC+3cvz99HEsDZb07ihjeAQXwFRzyY+rK4aaHzQv7NNh+yVa01D+C3U7qSQHsulWlKMa+6aJa/3FiwU/APKk5FSO0pTTt3ZNedlPJsuyMy5x+oZxTFE= 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)(346002)(396003)(376002)(136003)(36840700001)(46966006)(6666004)(86362001)(54906003)(2616005)(5660300002)(36756003)(70586007)(36860700001)(36906005)(478600001)(316002)(966005)(82310400003)(7636003)(426003)(6916009)(82740400003)(336012)(2906002)(83380400001)(1076003)(70206006)(47076005)(8676002)(356005)(8936002)(4326008)(26005)(186003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Apr 2021 11:46:13.9876 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 307c6925-4cb1-43cd-8524-08d8fcdf68e9 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: DM6NAM11FT017.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1264 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/bugs/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 Sun Apr 11 11:46: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: 1464799 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=M39SMaqG; 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 4FJ97Q1gXxz9sVt; Sun, 11 Apr 2021 21:46:26 +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 1lVYXm-0004co-MG; Sun, 11 Apr 2021 11:46:22 +0000 Received: from mail-dm6nam10on2042.outbound.protection.outlook.com ([40.107.93.42] helo=NAM10-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 1lVYXi-0004ZG-HH for kernel-team@lists.ubuntu.com; Sun, 11 Apr 2021 11:46:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j+9Cqtz9tJ+pSYbQBgHQXTH0oKXs1wr2yPHsnJmRmbjJ7coyV7QiZdfjK+r5R16DjAgB0D0m8xmkTzi3o6JsOm+VKfAhFluylNfsfu73M5rc2UFjH/rwmadkixRLekcqiB3eVOVCJBu412jwLm5ISbomTF4cj//c6djaMWdLb6Mz3r6zudpm3Gu8fM5OQRTcDyiDCCR9JI8oP+7HoNwlrjLSe67KqnE0HCXz4Lk9mHZcYCL7JF+isaq6eBcJGVkIji0Cxg9Rm4aSxrVsHHWyvW80kNow52YDzM+C7/9+ZSLC/n32vqDa7TEPVzsjxE90NTdJKeNfmyAfZeOW3BmweQ== 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=l2Er6HV7/nGF3IkmOWcFLzS3dGeCMdpFdWurLKhUm8o=; b=l/jFWLPemGSQJjvBHuNpSALM6EqW3NsQzkTjIeesDSfENEibsrLjmhZQN5x4qJNjHI+gI1EYxQ+yIy5joHM/3zc+t5NJsY8xCLIO6xH882qrCwjAzgbU6pzMAIx+ob0a2yBBGCAc8ARktGuRBoLBq/YjX7ieKErsT0qOIu5ihqZhEoTxpyRMaQ2NYc40TpXuwdOETVA0smyvl6BOOq99evN2+vbUDLPHqjFN3wC+d5dvYe6jaX3CevJ92wLNMUHIaF7LSKHp10XYzEDzHNp0u/wW8405cS/FZkgM7sd3r7OVaF6DSt3F/nJkGku5McbBGHzWCCJ/0rzHMxv13/Wg/Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=canonical.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=l2Er6HV7/nGF3IkmOWcFLzS3dGeCMdpFdWurLKhUm8o=; b=M39SMaqGoekXIxw/GaQvMraUBi7CdGRD0CNpJKNGDBguW7sCj4uUzjzbzhEBWypu68yX8R2VxkUKL4L8LxFd8GXB4vaixt5jl9Iw4NI7rrXBBg8j2ym5RKfZH+W+Pnqk/V/y5ZGieBkLdXZ37PXZpw0Q0IA73m5pZjpuLAy7K6EAFKGvHfD1bR2UT1D5ICJMCh//J34eN3R2FQCBEAaFzrqnNp4J9Sfo8Lp5U+cagZGjfIBneFo83JFAaif0D6vUlX4eHeaSde4LEQZhD87lpiMfZyuqNU+6anMAb78cu4lx0FTQ/GEAJNnzpszubAzI6QpqjbZ1WJTZlzO6qtE8Jw== Received: from MW4PR02CA0027.namprd02.prod.outlook.com (2603:10b6:303:80::29) by DM5PR12MB1787.namprd12.prod.outlook.com (2603:10b6:3:113::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.18; Sun, 11 Apr 2021 11:46:16 +0000 Received: from CO1NAM11FT035.eop-nam11.prod.protection.outlook.com (2603:10b6:303:80:cafe::66) by MW4PR02CA0027.outlook.office365.com (2603:10b6:303:80::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.22 via Frontend Transport; Sun, 11 Apr 2021 11:46:16 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; canonical.com; dkim=none (message not signed) header.d=none;canonical.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 CO1NAM11FT035.mail.protection.outlook.com (10.13.175.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4020.17 via Frontend Transport; Sun, 11 Apr 2021 11:46:15 +0000 Received: from HQMAIL111.nvidia.com (172.20.187.18) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sun, 11 Apr 2021 11:46:15 +0000 Received: from dev-r-vrt-138.mtr.labs.mlnx (172.20.145.6) by mail.nvidia.com (172.20.187.18) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Sun, 11 Apr 2021 11:46:14 +0000 From: Roi Dayan To: Subject: [SRU][F:linux-bluefield][PATCH 5/5] net: flow_offload: Add original direction flag to ct_metadata Date: Sun, 11 Apr 2021 14:46:02 +0300 Message-ID: <20210411114602.2003649-6-roid@nvidia.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210411114602.2003649-1-roid@nvidia.com> References: <20210411114602.2003649-1-roid@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f7346831-3fc9-4b43-b320-08d8fcdf69fa X-MS-TrafficTypeDiagnostic: DM5PR12MB1787: 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: 15Nwyt3EludzTb65jLhuknznlnAbrLFLFFhmBhE1+X9yV/ggl4rgoPAggL4Ye7Y9HcX/5+C+Ve5DrXmKZlftqcnnVc9XBzIfjepLjedZr/Xq1nB5cmhguBTYJ1wEhXCGIyLRE1nVRf5vOwl31C6TUaW17h13J2kZ2/gwFjHP4QuJR07h2PLRTg3VxtGDmW7zTUrdgAUrppo60lLK9U8dkPV7CN8qNSDuLMssiOdVu1azWeDxVz2EZg6pvyULkJtElSe0eCFmttSXb+S4M8/Xiy0xmfNPWhAG8BHsVjziGUIkxrJNdVRS400+8IulzkNYKGB+AJp0nelxWX0qx+v+zQTGPdklTT32VVuCijR+PI28T9FH7ZcRn06dpdbtKcjec2qa8P1PbN3YWZvjdqA1TnPXryKSzZ4fV/Ttr5JHkfIYf1arwhj9ecYlPGOqJ2imvw3V7zocskF5VVPG9pPDVlyXuREvypz+5zqC1Ta8zU5fVG1Zy7PS5W8iS7gEQT+BvKmHRW1c+cS/h1ZcqnJ93uckFCzEVRNvSlUTjKstfQktrWIFoE9wEr5dvGlwuZMn/dDeoiOlI1BZ66qApZPB47O9bPERMypKF1SJFBr5awKKCgPmch1iPQwrQMTgdu5/Pas0kBM19ACelO6oQDZQwmCnyJekVdmOBtT1hK1v1n6HoTZDT/ygEc3MqKojtPbNAVT9BK6jei6NIQyQTdeKOjsc1cNn+uL49vQ3WJ4xy5c= 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)(136003)(346002)(396003)(376002)(36840700001)(46966006)(36756003)(70206006)(26005)(70586007)(6666004)(36906005)(36860700001)(336012)(7636003)(5660300002)(82740400003)(316002)(966005)(6916009)(82310400003)(8676002)(8936002)(86362001)(1076003)(2616005)(2906002)(4326008)(47076005)(54906003)(478600001)(356005)(426003)(186003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Apr 2021 11:46:15.7889 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f7346831-3fc9-4b43-b320-08d8fcdf69fa 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: CO1NAM11FT035.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1787 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/bugs/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);