All of lore.kernel.org
 help / color / mirror / Atom feed
From: Or Gerlitz <ogerlitz@mellanox.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: Jamal Hadi Salim <jhs@mojatatu.com>,
	Roi Dayan <roid@mellanox.com>,
	netdev@vger.kernel.org, Or Gerlitz <ogerlitz@mellanox.com>
Subject: [PATCH net-next V4 7/7] net/sched: cls_bpf: Reflect HW offload status
Date: Thu, 16 Feb 2017 10:31:16 +0200	[thread overview]
Message-ID: <1487233876-28576-8-git-send-email-ogerlitz@mellanox.com> (raw)
In-Reply-To: <1487233876-28576-1-git-send-email-ogerlitz@mellanox.com>

BPF classifier support for the "in hw" offloading flags.

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Reviewed-by: Amir Vadai <amir@vadai.me>
Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com>
---
 net/sched/cls_bpf.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/net/sched/cls_bpf.c b/net/sched/cls_bpf.c
index d9c9701..80f6884 100644
--- a/net/sched/cls_bpf.c
+++ b/net/sched/cls_bpf.c
@@ -148,6 +148,7 @@ static int cls_bpf_offload_cmd(struct tcf_proto *tp, struct cls_bpf_prog *prog,
 	struct net_device *dev = tp->q->dev_queue->dev;
 	struct tc_cls_bpf_offload bpf_offload = {};
 	struct tc_to_netdev offload;
+	int err;
 
 	offload.type = TC_SETUP_CLSBPF;
 	offload.cls_bpf = &bpf_offload;
@@ -159,8 +160,13 @@ static int cls_bpf_offload_cmd(struct tcf_proto *tp, struct cls_bpf_prog *prog,
 	bpf_offload.exts_integrated = prog->exts_integrated;
 	bpf_offload.gen_flags = prog->gen_flags;
 
-	return dev->netdev_ops->ndo_setup_tc(dev, tp->q->handle,
-					     tp->protocol, &offload);
+	err = dev->netdev_ops->ndo_setup_tc(dev, tp->q->handle,
+					    tp->protocol, &offload);
+
+	if (!err && (cmd == TC_CLSBPF_ADD || cmd == TC_CLSBPF_REPLACE))
+		prog->gen_flags |= TCA_CLS_FLAGS_IN_HW;
+
+	return err;
 }
 
 static int cls_bpf_offload(struct tcf_proto *tp, struct cls_bpf_prog *prog,
@@ -511,6 +517,9 @@ static int cls_bpf_change(struct net *net, struct sk_buff *in_skb,
 		return ret;
 	}
 
+	if (!tc_in_hw(prog->gen_flags))
+		prog->gen_flags |= TCA_CLS_FLAGS_NOT_IN_HW;
+
 	if (oldprog) {
 		list_replace_rcu(&oldprog->link, &prog->link);
 		tcf_unbind_filter(tp, &oldprog->res);
-- 
2.5.5

  parent reply	other threads:[~2017-02-16  8:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-16  8:31 [PATCH net-next V4 0/7] net/sched: Reflect HW offload status in classifiers Or Gerlitz
2017-02-16  8:31 ` [PATCH net-next V4 1/7] net/sched: cls_flower: Properly handle classifier flags dumping Or Gerlitz
2017-02-16  8:31 ` [PATCH net-next V4 2/7] net/sched: cls_matchall: Dump the classifier flags Or Gerlitz
2017-02-16  8:31 ` [PATCH net-next V4 3/7] net/sched: Reflect HW offload status Or Gerlitz
2017-02-16  8:31 ` [PATCH net-next V4 4/7] net/sched: cls_flower: " Or Gerlitz
2017-02-16  8:31 ` [PATCH net-next V4 5/7] net/sched: cls_matchall: Reflect HW offloading status Or Gerlitz
2017-02-16  8:31 ` [PATCH net-next V4 6/7] net/sched: cls_u32: Reflect HW offload status Or Gerlitz
2017-02-16  8:31 ` Or Gerlitz [this message]
2017-02-17 17:08 ` [PATCH net-next V4 0/7] net/sched: Reflect HW offload status in classifiers David Miller

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=1487233876-28576-8-git-send-email-ogerlitz@mellanox.com \
    --to=ogerlitz@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=jhs@mojatatu.com \
    --cc=netdev@vger.kernel.org \
    --cc=roid@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.