netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/2] incremental cls_u32 hardware offload fixes
@ 2016-06-08 19:11 Jakub Kicinski
  2016-06-08 19:11 ` [PATCH net 1/2] net: cls_u32: catch all hardware offload errors Jakub Kicinski
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jakub Kicinski @ 2016-06-08 19:11 UTC (permalink / raw)
  To: netdev; +Cc: john.r.fastabend, sridhar.samudrala, Jakub Kicinski

These are incremental changes from v1 of cls_u32 fixes.
First patch is reposted in its entirety, patch 2 is an
incremental change from patch 2 of the original series.

Jakub Kicinski (2):
  net: cls_u32: catch all hardware offload errors
  net: cls_u32: be more strict about skip-sw flag (knode part)

 net/sched/cls_u32.c | 45 ++++++++++++++++++++++++++-------------------
 1 file changed, 26 insertions(+), 19 deletions(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH net 1/2] net: cls_u32: catch all hardware offload errors
  2016-06-08 19:11 [PATCH net 0/2] incremental cls_u32 hardware offload fixes Jakub Kicinski
@ 2016-06-08 19:11 ` Jakub Kicinski
  2016-06-08 19:11 ` [PATCH net 2/2] net: cls_u32: be more strict about skip-sw flag for knodes Jakub Kicinski
  2016-06-09  4:43 ` [PATCH net 0/2] incremental cls_u32 hardware offload fixes David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Jakub Kicinski @ 2016-06-08 19:11 UTC (permalink / raw)
  To: netdev; +Cc: john.r.fastabend, sridhar.samudrala, Jakub Kicinski

Errors reported by u32_replace_hw_hnode() were not propagated.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Acked-by: Sridhar Samudrala <sridhar.samudrala@intel.com>
---
 net/sched/cls_u32.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c
index 27b99fd774d7..54ab32a8ff4c 100644
--- a/net/sched/cls_u32.c
+++ b/net/sched/cls_u32.c
@@ -922,11 +922,17 @@ static int u32_change(struct net *net, struct sk_buff *in_skb,
 		ht->divisor = divisor;
 		ht->handle = handle;
 		ht->prio = tp->prio;
+
+		err = u32_replace_hw_hnode(tp, ht, flags);
+		if (err) {
+			kfree(ht);
+			return err;
+		}
+
 		RCU_INIT_POINTER(ht->next, tp_c->hlist);
 		rcu_assign_pointer(tp_c->hlist, ht);
 		*arg = (unsigned long)ht;
 
-		u32_replace_hw_hnode(tp, ht, flags);
 		return 0;
 	}
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH net 2/2] net: cls_u32: be more strict about skip-sw flag for knodes
  2016-06-08 19:11 [PATCH net 0/2] incremental cls_u32 hardware offload fixes Jakub Kicinski
  2016-06-08 19:11 ` [PATCH net 1/2] net: cls_u32: catch all hardware offload errors Jakub Kicinski
@ 2016-06-08 19:11 ` Jakub Kicinski
  2016-06-09  4:43 ` [PATCH net 0/2] incremental cls_u32 hardware offload fixes David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Jakub Kicinski @ 2016-06-08 19:11 UTC (permalink / raw)
  To: netdev; +Cc: john.r.fastabend, sridhar.samudrala, Jakub Kicinski

Return an error if user requested skip-sw and the underlaying
hardware cannot handle tc offloads (or offloads are disabled).
This patch fixes the knode handling.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
---
 net/sched/cls_u32.c | 37 +++++++++++++++++++------------------
 1 file changed, 19 insertions(+), 18 deletions(-)

diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c
index 54ab32a8ff4c..ffe593efe930 100644
--- a/net/sched/cls_u32.c
+++ b/net/sched/cls_u32.c
@@ -508,27 +508,28 @@ static int u32_replace_hw_knode(struct tcf_proto *tp,
 	offload.type = TC_SETUP_CLSU32;
 	offload.cls_u32 = &u32_offload;
 
-	if (tc_should_offload(dev, tp, flags)) {
-		offload.cls_u32->command = TC_CLSU32_REPLACE_KNODE;
-		offload.cls_u32->knode.handle = n->handle;
-		offload.cls_u32->knode.fshift = n->fshift;
+	if (!tc_should_offload(dev, tp, flags))
+		return tc_skip_sw(flags) ? -EINVAL : 0;
+
+	offload.cls_u32->command = TC_CLSU32_REPLACE_KNODE;
+	offload.cls_u32->knode.handle = n->handle;
+	offload.cls_u32->knode.fshift = n->fshift;
 #ifdef CONFIG_CLS_U32_MARK
-		offload.cls_u32->knode.val = n->val;
-		offload.cls_u32->knode.mask = n->mask;
+	offload.cls_u32->knode.val = n->val;
+	offload.cls_u32->knode.mask = n->mask;
 #else
-		offload.cls_u32->knode.val = 0;
-		offload.cls_u32->knode.mask = 0;
+	offload.cls_u32->knode.val = 0;
+	offload.cls_u32->knode.mask = 0;
 #endif
-		offload.cls_u32->knode.sel = &n->sel;
-		offload.cls_u32->knode.exts = &n->exts;
-		if (n->ht_down)
-			offload.cls_u32->knode.link_handle = n->ht_down->handle;
-
-		err = dev->netdev_ops->ndo_setup_tc(dev, tp->q->handle,
-						    tp->protocol, &offload);
-		if (tc_skip_sw(flags))
-			return err;
-	}
+	offload.cls_u32->knode.sel = &n->sel;
+	offload.cls_u32->knode.exts = &n->exts;
+	if (n->ht_down)
+		offload.cls_u32->knode.link_handle = n->ht_down->handle;
+
+	err = dev->netdev_ops->ndo_setup_tc(dev, tp->q->handle,
+					    tp->protocol, &offload);
+	if (tc_skip_sw(flags))
+		return err;
 
 	return 0;
 }
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net 0/2] incremental cls_u32 hardware offload fixes
  2016-06-08 19:11 [PATCH net 0/2] incremental cls_u32 hardware offload fixes Jakub Kicinski
  2016-06-08 19:11 ` [PATCH net 1/2] net: cls_u32: catch all hardware offload errors Jakub Kicinski
  2016-06-08 19:11 ` [PATCH net 2/2] net: cls_u32: be more strict about skip-sw flag for knodes Jakub Kicinski
@ 2016-06-09  4:43 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2016-06-09  4:43 UTC (permalink / raw)
  To: jakub.kicinski; +Cc: netdev, john.r.fastabend, sridhar.samudrala

From: Jakub Kicinski <jakub.kicinski@netronome.com>
Date: Wed,  8 Jun 2016 20:11:02 +0100

> These are incremental changes from v1 of cls_u32 fixes.
> First patch is reposted in its entirety, patch 2 is an
> incremental change from patch 2 of the original series.

Series applied, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-06-09  4:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-08 19:11 [PATCH net 0/2] incremental cls_u32 hardware offload fixes Jakub Kicinski
2016-06-08 19:11 ` [PATCH net 1/2] net: cls_u32: catch all hardware offload errors Jakub Kicinski
2016-06-08 19:11 ` [PATCH net 2/2] net: cls_u32: be more strict about skip-sw flag for knodes Jakub Kicinski
2016-06-09  4:43 ` [PATCH net 0/2] incremental cls_u32 hardware offload fixes David Miller

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).