netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Blakey <paulb@mellanox.com>
To: Guy Shattah <sguy@mellanox.com>,
	Marcelo Leitner <mleitner@redhat.com>,
	Aaron Conole <aconole@redhat.com>,
	John Hurley <john.hurley@netronome.com>,
	Simon Horman <simon.horman@netronome.com>,
	Justin Pettit <jpettit@ovn.org>,
	Gregory Rose <gvrose8192@gmail.com>,
	Eelco Chaudron <echaudro@redhat.com>,
	Flavio Leitner <fbl@redhat.com>,
	Florian Westphal <fwestpha@redhat.com>,
	Jiri Pirko <jiri@resnulli.us>, Rashid Khan <rkhan@redhat.com>,
	Sushil Kulkarni <sukulkar@redhat.com>,
	Andy Gospodarek <andrew.gospodarek@broadcom.com>,
	Roi Dayan <roid@mellanox.com>,
	Yossi Kuperman <yossiku@mellanox.com>,
	Or Gerlitz <ogerlitz@mellanox.com>,
	Rony Efraim <ronye@mellanox.com>,
	"davem@davemloft.net" <davem@davemloft.net>,
	netdev@vger.kernel.org
Cc: Paul Blakey <paulb@mellanox.com>
Subject: [RFC PATCH net-next 6/6 v2] net/sched: act_ct: Add tc recirc id set/del support
Date: Tue, 29 Jan 2019 10:02:06 +0200	[thread overview]
Message-ID: <1548748926-23822-7-git-send-email-paulb@mellanox.com> (raw)
In-Reply-To: <1548748926-23822-2-git-send-email-paulb@mellanox.com>

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 <paulb@mellanox.com>
---
 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;
 };
 
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


  parent reply	other threads:[~2019-01-29  8:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-29  8:02 [RFC PATCH net-next 1/6 v2] net/sched: Introduce act_ct Paul Blakey
2019-01-29  8:02 ` [RFC PATCH net-next 2/6 v2] net/sched: cls_flower: add match on ct info Paul Blakey
2019-01-29  8:02 ` [RFC PATCH net-next 3/6 v2] net/sched: cls_flower: Add ematch support Paul Blakey
2019-01-29 18:08   ` Marcelo Leitner
2019-01-30  8:40     ` Paul Blakey
2019-01-29  8:02 ` [RFC PATCH net-next 4/6 v2] net: Add new tc recirc id skb extension Paul Blakey
2019-01-29  8:02 ` [RFC PATCH net-next 5/6 v2] net/sched: em_meta: add match on " Paul Blakey
2019-01-29  8:02 ` Paul Blakey [this message]
2019-01-29 18:12   ` [RFC PATCH net-next 6/6 v2] net/sched: act_ct: Add tc recirc id set/del support Marcelo Leitner
2019-01-30  8:20     ` Paul Blakey
2019-02-01 13:23 ` [RFC PATCH net-next 1/6 v2] net/sched: Introduce act_ct Marcelo Leitner
2019-02-03  8:26   ` Paul Blakey
2019-02-04 12:48     ` Simon Horman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1548748926-23822-7-git-send-email-paulb@mellanox.com \
    --to=paulb@mellanox.com \
    --cc=aconole@redhat.com \
    --cc=andrew.gospodarek@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=echaudro@redhat.com \
    --cc=fbl@redhat.com \
    --cc=fwestpha@redhat.com \
    --cc=gvrose8192@gmail.com \
    --cc=jiri@resnulli.us \
    --cc=john.hurley@netronome.com \
    --cc=jpettit@ovn.org \
    --cc=mleitner@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=ogerlitz@mellanox.com \
    --cc=rkhan@redhat.com \
    --cc=roid@mellanox.com \
    --cc=ronye@mellanox.com \
    --cc=sguy@mellanox.com \
    --cc=simon.horman@netronome.com \
    --cc=sukulkar@redhat.com \
    --cc=yossiku@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).