aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJakub Kicinski <jakub.kicinski@netronome.com>2016-06-08 15:11:04 -0400
committerDavid S. Miller <davem@davemloft.net>2016-06-09 00:43:14 -0400
commit201c44bd8ffa899f07b7b322a73e19baf0ada1e5 (patch)
tree15c55d1d1865928446c70e7d4754a4fd01310fc7 /net
parent6eef3801e719e4ea9c15c01b1d77706f47331166 (diff)
net: cls_u32: be more strict about skip-sw flag for knodes
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> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/sched/cls_u32.c37
1 files 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,
508 offload.type = TC_SETUP_CLSU32; 508 offload.type = TC_SETUP_CLSU32;
509 offload.cls_u32 = &u32_offload; 509 offload.cls_u32 = &u32_offload;
510 510
511 if (tc_should_offload(dev, tp, flags)) { 511 if (!tc_should_offload(dev, tp, flags))
512 offload.cls_u32->command = TC_CLSU32_REPLACE_KNODE; 512 return tc_skip_sw(flags) ? -EINVAL : 0;
513 offload.cls_u32->knode.handle = n->handle; 513
514 offload.cls_u32->knode.fshift = n->fshift; 514 offload.cls_u32->command = TC_CLSU32_REPLACE_KNODE;
515 offload.cls_u32->knode.handle = n->handle;
516 offload.cls_u32->knode.fshift = n->fshift;
515#ifdef CONFIG_CLS_U32_MARK 517#ifdef CONFIG_CLS_U32_MARK
516 offload.cls_u32->knode.val = n->val; 518 offload.cls_u32->knode.val = n->val;
517 offload.cls_u32->knode.mask = n->mask; 519 offload.cls_u32->knode.mask = n->mask;
518#else 520#else
519 offload.cls_u32->knode.val = 0; 521 offload.cls_u32->knode.val = 0;
520 offload.cls_u32->knode.mask = 0; 522 offload.cls_u32->knode.mask = 0;
521#endif 523#endif
522 offload.cls_u32->knode.sel = &n->sel; 524 offload.cls_u32->knode.sel = &n->sel;
523 offload.cls_u32->knode.exts = &n->exts; 525 offload.cls_u32->knode.exts = &n->exts;
524 if (n->ht_down) 526 if (n->ht_down)
525 offload.cls_u32->knode.link_handle = n->ht_down->handle; 527 offload.cls_u32->knode.link_handle = n->ht_down->handle;
526 528
527 err = dev->netdev_ops->ndo_setup_tc(dev, tp->q->handle, 529 err = dev->netdev_ops->ndo_setup_tc(dev, tp->q->handle,
528 tp->protocol, &offload); 530 tp->protocol, &offload);
529 if (tc_skip_sw(flags)) 531 if (tc_skip_sw(flags))
530 return err; 532 return err;
531 }
532 533
533 return 0; 534 return 0;
534} 535}