From: Edward Cree <ecree@solarflare.com>
To: Jamal Hadi Salim <jhs@mojatatu.com>,
Jiri Pirko <jiri@resnulli.us>,
"Pablo Neira Ayuso" <pablo@netfilter.org>,
David Miller <davem@davemloft.net>
Cc: netdev <netdev@vger.kernel.org>,
Cong Wang <xiyou.wangcong@gmail.com>,
Andy Gospodarek <andy@greyhouse.net>,
Jakub Kicinski <jakub.kicinski@netronome.com>,
Michael Chan <michael.chan@broadcom.com>,
Vishal Kulkarni <vishal@chelsio.com>,
Or Gerlitz <gerlitz.or@gmail.com>
Subject: [RFC PATCH v4 net-next 3/4] net/sched: add action block binding to other classifiers
Date: Tue, 4 Jun 2019 18:34:30 +0100 [thread overview]
Message-ID: <a87c5277-e106-1b05-cd24-9da2133b7710@solarflare.com> (raw)
In-Reply-To: <a3f0a79a-7e2c-4cdc-8c97-dfebe959ab1f@solarflare.com>
cls_matchall, cls_u32, and cls_bpf all have offloads as well, so they also
need to bind actions to blocks for RTM_GETACTION stats collection.
Signed-off-by: Edward Cree <ecree@solarflare.com>
---
net/sched/cls_bpf.c | 10 +++++++++-
net/sched/cls_matchall.c | 7 +++++++
net/sched/cls_u32.c | 7 +++++++
3 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/net/sched/cls_bpf.c b/net/sched/cls_bpf.c
index 27365ed3fe0b..c99e53cbf83d 100644
--- a/net/sched/cls_bpf.c
+++ b/net/sched/cls_bpf.c
@@ -165,8 +165,11 @@ static int cls_bpf_offload_cmd(struct tcf_proto *tp, struct cls_bpf_prog *prog,
cls_bpf.name = obj->bpf_name;
cls_bpf.exts_integrated = obj->exts_integrated;
- if (oldprog)
+ if (oldprog) {
+ if (oldprog->in_hw_count)
+ tc_unbind_action_blocks(&oldprog->exts, block);
tcf_block_offload_dec(block, &oldprog->gen_flags);
+ }
err = tc_setup_cb_call(block, TC_SETUP_CLSBPF, &cls_bpf, skip_sw);
if (prog) {
@@ -175,6 +178,7 @@ static int cls_bpf_offload_cmd(struct tcf_proto *tp, struct cls_bpf_prog *prog,
return err;
} else if (err > 0) {
prog->in_hw_count = err;
+ tc_bind_action_blocks(&prog->exts, block);
tcf_block_offload_inc(block, &prog->gen_flags);
}
}
@@ -683,8 +687,12 @@ static int cls_bpf_reoffload(struct tcf_proto *tp, bool add, tc_setup_cb_t *cb,
continue;
}
+ if (add && !prog->in_hw_count)
+ tc_bind_action_blocks(&prog->exts, block);
tc_cls_offload_cnt_update(block, &prog->in_hw_count,
&prog->gen_flags, add);
+ if (!add && !prog->in_hw_count)
+ tc_unbind_action_blocks(&prog->exts, block);
}
return 0;
diff --git a/net/sched/cls_matchall.c b/net/sched/cls_matchall.c
index db42d97a2006..5cb4832d1b3b 100644
--- a/net/sched/cls_matchall.c
+++ b/net/sched/cls_matchall.c
@@ -79,6 +79,8 @@ static void mall_destroy_hw_filter(struct tcf_proto *tp,
cls_mall.cookie = cookie;
tc_setup_cb_call(block, TC_SETUP_CLSMATCHALL, &cls_mall, false);
+ if (head->in_hw_count)
+ tc_unbind_action_blocks(&head->exts, block);
tcf_block_offload_dec(block, &head->flags);
}
@@ -120,6 +122,7 @@ static int mall_replace_hw_filter(struct tcf_proto *tp,
return err;
} else if (err > 0) {
head->in_hw_count = err;
+ tc_bind_action_blocks(&head->exts, block);
tcf_block_offload_inc(block, &head->flags);
}
@@ -320,7 +323,11 @@ static int mall_reoffload(struct tcf_proto *tp, bool add, tc_setup_cb_t *cb,
return 0;
}
+ if (add && !head->in_hw_count)
+ tc_bind_action_blocks(&head->exts, block);
tc_cls_offload_cnt_update(block, &head->in_hw_count, &head->flags, add);
+ if (!add && !head->in_hw_count)
+ tc_unbind_action_blocks(&head->exts, block);
return 0;
}
diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c
index 4b8710a266cc..84f067d9b4a4 100644
--- a/net/sched/cls_u32.c
+++ b/net/sched/cls_u32.c
@@ -534,6 +534,8 @@ static void u32_remove_hw_knode(struct tcf_proto *tp, struct tc_u_knode *n,
cls_u32.knode.handle = n->handle;
tc_setup_cb_call(block, TC_SETUP_CLSU32, &cls_u32, false);
+ if (n->in_hw_count)
+ tc_unbind_action_blocks(&n->exts, block);
tcf_block_offload_dec(block, &n->flags);
}
@@ -569,6 +571,7 @@ static int u32_replace_hw_knode(struct tcf_proto *tp, struct tc_u_knode *n,
return err;
} else if (err > 0) {
n->in_hw_count = err;
+ tc_bind_action_blocks(&n->exts, block);
tcf_block_offload_inc(block, &n->flags);
}
@@ -1223,7 +1226,11 @@ static int u32_reoffload_knode(struct tcf_proto *tp, struct tc_u_knode *n,
return 0;
}
+ if (add && !n->in_hw_count)
+ tc_bind_action_blocks(&n->exts, block);
tc_cls_offload_cnt_update(block, &n->in_hw_count, &n->flags, add);
+ if (!add && !n->in_hw_count)
+ tc_unbind_action_blocks(&n->exts, block);
return 0;
}
next prev parent reply other threads:[~2019-06-04 17:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-04 17:32 [RFC PATCH v4 net-next 0/4] flow_offload: Re-add per-action statistics Edward Cree
2019-06-04 17:34 ` [RFC PATCH v4 net-next 1/4] flow_offload: add a cookie to flow_action_entry Edward Cree
2019-06-04 17:34 ` [RFC PATCH v4 net-next 2/4] net/sched: add callback to get stats on an action from clsflower offload Edward Cree
2019-06-04 17:34 ` Edward Cree [this message]
2019-06-04 17:34 ` [RFC PATCH v4 net-next 4/4] net/sched: call action stats offload in flower or mall dump Edward Cree
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=a87c5277-e106-1b05-cd24-9da2133b7710@solarflare.com \
--to=ecree@solarflare.com \
--cc=andy@greyhouse.net \
--cc=davem@davemloft.net \
--cc=gerlitz.or@gmail.com \
--cc=jakub.kicinski@netronome.com \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=michael.chan@broadcom.com \
--cc=netdev@vger.kernel.org \
--cc=pablo@netfilter.org \
--cc=vishal@chelsio.com \
--cc=xiyou.wangcong@gmail.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).