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=-8.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED, USER_AGENT_MUTT 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 664EDC169C4 for ; Tue, 29 Jan 2019 18:12:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2EEC520857 for ; Tue, 29 Jan 2019 18:12:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728616AbfA2SM2 (ORCPT ); Tue, 29 Jan 2019 13:12:28 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60212 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726314AbfA2SM1 (ORCPT ); Tue, 29 Jan 2019 13:12:27 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1499CDD9C9; Tue, 29 Jan 2019 18:12:27 +0000 (UTC) Received: from localhost.localdomain (ovpn-116-32.gru2.redhat.com [10.97.116.32]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 38FDD6E71C; Tue, 29 Jan 2019 18:12:23 +0000 (UTC) Received: by localhost.localdomain (Postfix, from userid 1000) id 70188180B7C; Tue, 29 Jan 2019 16:12:21 -0200 (-02) Date: Tue, 29 Jan 2019 16:12:21 -0200 From: Marcelo Leitner To: Paul Blakey Cc: 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 Message-ID: <20190129181221.GY10660@localhost.localdomain> References: <1548748926-23822-2-git-send-email-paulb@mellanox.com> <1548748926-23822-7-git-send-email-paulb@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1548748926-23822-7-git-send-email-paulb@mellanox.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 29 Jan 2019 18:12:27 +0000 (UTC) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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; > }; > > #define to_ct(a) ((struct tcf_ct *)a) > diff --git a/include/uapi/linux/tc_act/tc_ct.h b/include/uapi/linux/tc_act/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; > }; 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. > > 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 struct tc_action *a, > u_int8_t family; > bool cached; > > + 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 = skb_network_offset(skb); > skb_pull_rcsum(skb, nh_ofs); > @@ -243,6 +248,15 @@ static int tcf_ct_act(struct sk_buff *skb, const struct tc_action *a, > skb_postpush_rcsum(skb, skb->data, nh_ofs); > > spin_unlock(&ca->tcf_lock); > + > + if (ca->set_recirc) { > + u32 recirc = ca->set_recirc; > + uint32_t *recircp = skb_ext_add(skb, SKB_EXT_TC_RECIRC_ID); > + > + if (recircp) > + *recircp = recirc; > + } > + > return ca->tcf_action; > > drop: > @@ -305,6 +319,8 @@ static int tcf_ct_init(struct net *net, struct nlattr *nla, > ci->net = net; > ci->commit = parm->commit; > ci->zone = parm->zone; > + ci->set_recirc = parm->set_recirc; > + ci->del_recirc = 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, struct tc_action *a, > opt.mark_mask = 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 = ci->set_recirc; > + opt.del_recirc = ci->del_recirc; > > if (nla_put(skb, TCA_CT_PARMS, sizeof(opt), &opt)) > goto nla_put_failure; > -- > 1.8.3.1 >