From: John Fastabend <john.fastabend@gmail.com>
To: jiri@resnulli.us, john.fastabend@gmail.com, daniel@iogearbox.net
Cc: netdev@vger.kernel.org, alexei.starovoitov@gmail.com,
davem@davemloft.net, jhs@mojatatu.com
Subject: [net-next PATCH 1/4] net: sched: consolidate offload decision in cls_u32
Date: Tue, 23 Feb 2016 11:02:33 -0800 [thread overview]
Message-ID: <20160223190233.5970.61226.stgit@john-Precision-Tower-5810> (raw)
The offload decision was originally very basic and tied to if the dev
implemented the appropriate ndo op hook. The next step is to allow
the user to more flexibly define if any paticular rule should be
offloaded or not. In order to have this logic in one function lift
the current check into a helper routine tc_should_offload().
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
---
net/sched/cls_u32.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c
index d54bc94..1f31929 100644
--- a/net/sched/cls_u32.c
+++ b/net/sched/cls_u32.c
@@ -425,6 +425,11 @@ static int u32_delete_key(struct tcf_proto *tp, struct tc_u_knode *key)
return 0;
}
+static bool u32_should_offload(struct net_device *dev)
+{
+ return dev->netdev_ops->ndo_setup_tc;
+}
+
static void u32_remove_hw_knode(struct tcf_proto *tp, u32 handle)
{
struct net_device *dev = tp->q->dev_queue->dev;
@@ -434,7 +439,7 @@ static void u32_remove_hw_knode(struct tcf_proto *tp, u32 handle)
offload.type = TC_SETUP_CLSU32;
offload.cls_u32 = &u32_offload;
- if (dev->netdev_ops->ndo_setup_tc) {
+ if (u32_should_offload(dev)) {
offload.cls_u32->command = TC_CLSU32_DELETE_KNODE;
offload.cls_u32->knode.handle = handle;
dev->netdev_ops->ndo_setup_tc(dev, tp->q->handle,
@@ -451,7 +456,7 @@ static void u32_replace_hw_hnode(struct tcf_proto *tp, struct tc_u_hnode *h)
offload.type = TC_SETUP_CLSU32;
offload.cls_u32 = &u32_offload;
- if (dev->netdev_ops->ndo_setup_tc) {
+ if (u32_should_offload(dev)) {
offload.cls_u32->command = TC_CLSU32_NEW_HNODE;
offload.cls_u32->hnode.divisor = h->divisor;
offload.cls_u32->hnode.handle = h->handle;
@@ -471,7 +476,7 @@ static void u32_clear_hw_hnode(struct tcf_proto *tp, struct tc_u_hnode *h)
offload.type = TC_SETUP_CLSU32;
offload.cls_u32 = &u32_offload;
- if (dev->netdev_ops->ndo_setup_tc) {
+ if (u32_should_offload(dev)) {
offload.cls_u32->command = TC_CLSU32_DELETE_HNODE;
offload.cls_u32->hnode.divisor = h->divisor;
offload.cls_u32->hnode.handle = h->handle;
@@ -491,7 +496,7 @@ static void u32_replace_hw_knode(struct tcf_proto *tp, struct tc_u_knode *n)
offload.type = TC_SETUP_CLSU32;
offload.cls_u32 = &u32_offload;
- if (dev->netdev_ops->ndo_setup_tc) {
+ if (u32_should_offload(dev)) {
offload.cls_u32->command = TC_CLSU32_REPLACE_KNODE;
offload.cls_u32->knode.handle = n->handle;
offload.cls_u32->knode.fshift = n->fshift;
next reply other threads:[~2016-02-23 19:02 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-23 19:02 John Fastabend [this message]
2016-02-23 19:02 ` [net-next PATCH 2/4] net: cls_u32: move TC offload feature bit into cls_u32 offload logic John Fastabend
2016-02-24 6:12 ` Simon Horman
2016-02-24 13:21 ` Jamal Hadi Salim
2016-02-23 19:03 ` [net-next PATCH 3/4] net: sched: cls_u32 add bit to specify software only rules John Fastabend
2016-02-23 22:29 ` Samudrala, Sridhar
2016-02-23 23:30 ` John Fastabend
2016-02-24 6:11 ` Simon Horman
2016-02-24 7:24 ` John Fastabend
2016-02-24 8:04 ` Amir Vadai"
2016-02-24 8:40 ` Jiri Pirko
2016-02-24 8:55 ` John Fastabend
2016-02-24 9:29 ` Jiri Benc
2016-02-25 4:09 ` John Fastabend
2016-02-25 13:19 ` Jamal Hadi Salim
2016-02-25 16:39 ` John Fastabend
2016-02-24 13:31 ` Jamal Hadi Salim
2016-02-25 4:04 ` John Fastabend
2016-02-25 12:56 ` Jamal Hadi Salim
2016-02-25 21:56 ` John Fastabend
2016-02-25 23:05 ` Jamal Hadi Salim
2016-02-25 23:08 ` John Fastabend
2016-02-23 19:03 ` [net-next PATCH 4/4] net: sched: create hardware only classifier filter John Fastabend
2016-02-24 8:47 ` Jiri Pirko
2016-02-25 13:14 ` Jamal Hadi Salim
2016-02-25 17:36 ` John Fastabend
2016-02-24 6:12 ` [net-next PATCH 1/4] net: sched: consolidate offload decision in cls_u32 Simon Horman
2016-02-24 8:49 ` Jiri Pirko
2016-02-24 13:20 ` Jamal Hadi Salim
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=20160223190233.5970.61226.stgit@john-Precision-Tower-5810 \
--to=john.fastabend@gmail.com \
--cc=alexei.starovoitov@gmail.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=netdev@vger.kernel.org \
/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