From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8565FC282D5 for ; Wed, 30 Jan 2019 08:20:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 480B42087F for ; Wed, 30 Jan 2019 08:20:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=Mellanox.com header.i=@Mellanox.com header.b="K/nc4hrX" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728371AbfA3IUE (ORCPT ); Wed, 30 Jan 2019 03:20:04 -0500 Received: from mail-eopbgr30043.outbound.protection.outlook.com ([40.107.3.43]:63740 "EHLO EUR03-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725834AbfA3IUE (ORCPT ); Wed, 30 Jan 2019 03:20:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=H8dk/NcMmz4SqOKCQ8LeRsmSwVsNjbRb5ZMpedYLkbs=; b=K/nc4hrXaMnPT0PjwGoSDEH5IRMSdUq1GpyVMxi4Cwc06cOI/VRoLoiuUmw9LkkO2JUIVug/JEsau5K+m1t4XcCD7yeg6kr00LvL9tLNP3KGCccbonbCs6BainfPjVhiXvj1XLHzQ0fGCx6YHYkzDiwhagq1R9cpk8lK6OslssY= Received: from AM4PR05MB3411.eurprd05.prod.outlook.com (10.171.187.140) by AM4PR05MB3188.eurprd05.prod.outlook.com (10.171.186.29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1537.27; Wed, 30 Jan 2019 08:20:00 +0000 Received: from AM4PR05MB3411.eurprd05.prod.outlook.com ([fe80::c8bd:b03c:4950:3966]) by AM4PR05MB3411.eurprd05.prod.outlook.com ([fe80::c8bd:b03c:4950:3966%7]) with mapi id 15.20.1558.025; Wed, 30 Jan 2019 08:20:00 +0000 From: Paul Blakey To: Marcelo Leitner CC: Paul Blakey , Guy Shattah , Aaron Conole , John Hurley , Simon Horman , Justin Pettit , Gregory Rose , Eelco Chaudron , Flavio Leitner , Florian Westphal , Jiri Pirko , Rashid Khan , Sushil Kulkarni , Andy Gospodarek , Roi Dayan , Yossi Kuperman , Or Gerlitz , Rony Efraim , "davem@davemloft.net" , "netdev@vger.kernel.org" Subject: Re: [RFC PATCH net-next 6/6 v2] net/sched: act_ct: Add tc recirc id set/del support Thread-Topic: [RFC PATCH net-next 6/6 v2] net/sched: act_ct: Add tc recirc id set/del support Thread-Index: AQHUt6kt3cJJcRvqVEeyDEeOXu4o/KXGjQiAgADsh4A= Date: Wed, 30 Jan 2019 08:20:00 +0000 Message-ID: References: <1548748926-23822-2-git-send-email-paulb@mellanox.com> <1548748926-23822-7-git-send-email-paulb@mellanox.com> <20190129181221.GY10660@localhost.localdomain> In-Reply-To: <20190129181221.GY10660@localhost.localdomain> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM5PR0201CA0023.eurprd02.prod.outlook.com (2603:10a6:203:3d::33) To AM4PR05MB3411.eurprd05.prod.outlook.com (2603:10a6:205:6::12) authentication-results: spf=none (sender IP is ) smtp.mailfrom=paulb@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [193.47.165.251] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;AM4PR05MB3188;6:hbM+cPREj8moEyno3U4yTwHtlWC7Ya52D8btE8EYu8qSD6nJ0jpTI6+HROLa3XxnBmxtbga8IfF7b9k3yT+d/37Q1qoB7QQNjyPU2+pgVXOfrfLS41gCJutSexf19T6YQR71U/i3ovwSZO+QSOFEVMlCtXm/ntywWVcCRa7R9MNugXXwbIhRU8dLt9TGjTxk4VvIoqiSID9DAJsZ8CtaIXHgp3Vc3mGtRk29B8NVQtfF7AyLm+Jjyz4jU3FZZticGHFYVvZCUz/lGTmcV74yCL7MmRJxWwtV4R3P39D16BVfUxux1Nh9F7d/SsueUm+NeSYLjMcve7XZDOiFzyrsZMUnpv+ep451XBjNqHBjWLXNO95rCNMT/sUIxj1TWde5Q6QHwqqPzRmZLtcwyLWvgqo7QQ3LSl3EM2EoVWhOsgLfTEDnnlqlEdHJ9E8Ohj+7gFJjXhJDw4op2xRLHbh87A==;5:0Jva8E5kRZNu9+nqw+Ar39XX7uMSCIegtWc6juD+jIxTU/mNSQIbrl+kFZtMFNwMlDrACqWlrKlmN142YvIuUAspv5GrVeDVyrsHpVl7qWqif1I6fnoTsFFS1fwuYbItNxcQvPXVJ53a+a2FIWbgp0t3/xsFFz8JRPaxEPoq2tdEG6tBpEG7O/UyC6Q7/ZEo3OFS+YEtooZMeyz3XDcArA==;7:feHzmudRxfDqH3qKcfMsYB+VzCuJJ3oIihdAsqvi6mWWxIOUA5Wx7wVjFuY+EJeb6we2eGv9OKjwBs0YBEKDsd5AZrysjsaPtIUXW0RYomzHt56XlST1I6QfPb56xBe2fa9R4L8TC4JkvRIFWKR7vg== x-ms-office365-filtering-correlation-id: 55583808-33be-42ac-1b9b-08d6868bba1d x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(4618075)(2017052603328)(7153060)(7193020);SRVR:AM4PR05MB3188; x-ms-traffictypediagnostic: AM4PR05MB3188: x-microsoft-antispam-prvs: x-forefront-prvs: 0933E9FD8D x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(396003)(366004)(39860400002)(136003)(346002)(376002)(199004)(189003)(4326008)(8676002)(54906003)(486006)(7416002)(99286004)(52116002)(68736007)(446003)(71200400001)(7736002)(316002)(2906002)(305945005)(31696002)(256004)(11346002)(71190400001)(14444005)(76176011)(217873002)(8936002)(476003)(53936002)(6512007)(2616005)(36756003)(478600001)(102836004)(26005)(106356001)(97736004)(66066001)(86362001)(14454004)(31686004)(25786009)(6506007)(53546011)(3846002)(105586002)(6246003)(6486002)(186003)(6916009)(229853002)(39060400002)(81156014)(81166006)(6116002)(6436002)(386003);DIR:OUT;SFP:1101;SCL:1;SRVR:AM4PR05MB3188;H:AM4PR05MB3411.eurprd05.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 6b54BY52wo4/W1mXKhNptYRGaQaIdiV0LT0KuOxFa8x447Vaf4hB16xhsOoI6z899AeeF/5t3I6MGAdf9g2uv/w0RtRlLfwvRj+shxvntCZh2Jvoo4oawWX8J4VSoCAaPTMwZ/h+9E+ReAPc7FotNA2L8ApuSChHlIgF+jNAWtlWllSQZMIiwapSLHu76mTTFNjHpDcwG1eWRPGynrL0tHtTQg+ToScDDrmX656ZDuhCnyQNCWiMFm160DHbEFCkVEwEhnXeGUxYqA5lD3TvIyY6Dszk8pMJMmwCvo/VSbi2uQATJB2X3+C3EXv2zpDf8SVMhEjhVwSD0i3tVOsWa9s06CjE8coU1Io9u+TkrlAPzLdm/VWPJYOBvtsuAxTsP70P+YKmNKW70VWGFaA4DHDVbMMBa4Bv2bBGxPD2h1Y= Content-Type: text/plain; charset="windows-1255" Content-ID: <31578F9B23901A45A39BC43A4BF5AB72@eurprd05.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 55583808-33be-42ac-1b9b-08d6868bba1d X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Jan 2019 08:19:58.3708 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR05MB3188 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 29/01/2019 20:12, Marcelo Leitner wrote: > On Tue, Jan 29, 2019 at 10:02:06AM +0200, Paul Blakey wrote: >> Set or clears (free) the skb tc recirc id extension. >> If used with OVS, OVS can clear this recirc id after it reads it. >> >> Signed-off-by: Paul Blakey >> --- >> include/net/tc_act/tc_ct.h | 2 ++ >> include/uapi/linux/tc_act/tc_ct.h | 2 ++ >> net/sched/act_ct.c | 18 ++++++++++++++++++ >> 3 files changed, 22 insertions(+) >> >> diff --git a/include/net/tc_act/tc_ct.h b/include/net/tc_act/tc_ct.h >> index 4a16375..6ea19d8 100644 >> --- a/include/net/tc_act/tc_ct.h >> +++ b/include/net/tc_act/tc_ct.h >> @@ -16,6 +16,8 @@ struct tcf_ct { >> u32 mark_mask; >> u16 zone; >> bool commit; >> + uint32_t set_recirc; >> + bool del_recirc; >> }; >> =20 >> #define to_ct(a) ((struct tcf_ct *)a) >> diff --git a/include/uapi/linux/tc_act/tc_ct.h b/include/uapi/linux/tc_a= ct/tc_ct.h >> index 6dbd771..2279a9b 100644 >> --- a/include/uapi/linux/tc_act/tc_ct.h >> +++ b/include/uapi/linux/tc_act/tc_ct.h >> @@ -14,6 +14,8 @@ struct tc_ct { >> __u32 labels_mask[4]; >> __u32 mark; >> __u32 mark_mask; >> + uint32_t set_recirc; >> + bool del_recirc; >> bool commit; >> }; >=20 > Have you considered adding a specific action for this? Asking because > setting recirc_id can be useful outside of ct context too: decap, set > recirc_id, reclassify. >=20 Yes I did, I didn't know if it was overkill, till a use case such as you suggested arises beside CT. One thing I'm not sure of is, who will delete the recirc id, it seems it's freed only via skb_ext_put(skb) at skb_release_head_state() But I might be missing a del from skb_scrub_packet like nf_reset does. >> =20 >> diff --git a/net/sched/act_ct.c b/net/sched/act_ct.c >> index 61155cc..7822385 100644 >> --- a/net/sched/act_ct.c >> +++ b/net/sched/act_ct.c >> @@ -117,6 +117,11 @@ static int tcf_ct_act(struct sk_buff *skb, const st= ruct tc_action *a, >> u_int8_t family; >> bool cached; >> =20 >> + if (ca->del_recirc) { >> + skb_ext_del(skb, SKB_EXT_TC_RECIRC_ID); >> + return ca->tcf_action; >> + } >> + >> /* The conntrack module expects to be working at L3. */ >> nh_ofs =3D skb_network_offset(skb); >> skb_pull_rcsum(skb, nh_ofs); >> @@ -243,6 +248,15 @@ static int tcf_ct_act(struct sk_buff *skb, const st= ruct tc_action *a, >> skb_postpush_rcsum(skb, skb->data, nh_ofs); >> =20 >> spin_unlock(&ca->tcf_lock); >> + >> + if (ca->set_recirc) { >> + u32 recirc =3D ca->set_recirc; >> + uint32_t *recircp =3D skb_ext_add(skb, SKB_EXT_TC_RECIRC_ID); >> + >> + if (recircp) >> + *recircp =3D recirc; >> + } >> + >> return ca->tcf_action; >> =20 >> drop: >> @@ -305,6 +319,8 @@ static int tcf_ct_init(struct net *net, struct nlatt= r *nla, >> ci->net =3D net; >> ci->commit =3D parm->commit; >> ci->zone =3D parm->zone; >> + ci->set_recirc =3D parm->set_recirc; >> + ci->del_recirc =3D parm->del_recirc; >> #if !IS_ENABLED(CONFIG_NF_CONNTRACK_MARK) >> if (parm->mark_mask) { >> NL_SET_ERR_MSG_MOD(extack, "Mark not supported by kernel config"); >> @@ -378,6 +394,8 @@ static inline int tcf_ct_dump(struct sk_buff *skb, s= truct tc_action *a, >> opt.mark_mask =3D ci->mark_mask, >> memcpy(opt.labels, ci->labels, sizeof(opt.labels)); >> memcpy(opt.labels_mask, ci->labels_mask, sizeof(opt.labels_mask)); >> + opt.set_recirc =3D ci->set_recirc; >> + opt.del_recirc =3D ci->del_recirc; >> =20 >> if (nla_put(skb, TCA_CT_PARMS, sizeof(opt), &opt)) >> goto nla_put_failure; >> --=20 >> 1.8.3.1 >>