diff options
author | Jakub Kicinski <jakub.kicinski@netronome.com> | 2016-06-06 11:16:48 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-06-07 19:27:14 -0400 |
commit | d47a0f387fe907bdb0430a398850c1cb80eb7def (patch) | |
tree | 83500f19d807c4ae4eb94650c86e7bdef22b8dc7 /net | |
parent | 1a0f7d2984f3864e64a43714b4a0999b5a27cff5 (diff) |
net: cls_u32: be more strict about skip-sw flag
Return an error if user requested skip-sw and the underlaying
hardware cannot handle tc offloads (or offloads are disabled).
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.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c index b17e090f2fe1..fe05449537a3 100644 --- a/net/sched/cls_u32.c +++ b/net/sched/cls_u32.c | |||
@@ -457,20 +457,21 @@ static int u32_replace_hw_hnode(struct tcf_proto *tp, | |||
457 | struct tc_to_netdev offload; | 457 | struct tc_to_netdev offload; |
458 | int err; | 458 | int err; |
459 | 459 | ||
460 | if (!tc_should_offload(dev, flags)) | ||
461 | return tc_skip_sw(flags) ? -EINVAL : 0; | ||
462 | |||
460 | offload.type = TC_SETUP_CLSU32; | 463 | offload.type = TC_SETUP_CLSU32; |
461 | offload.cls_u32 = &u32_offload; | 464 | offload.cls_u32 = &u32_offload; |
462 | 465 | ||
463 | if (tc_should_offload(dev, flags)) { | 466 | offload.cls_u32->command = TC_CLSU32_NEW_HNODE; |
464 | offload.cls_u32->command = TC_CLSU32_NEW_HNODE; | 467 | offload.cls_u32->hnode.divisor = h->divisor; |
465 | offload.cls_u32->hnode.divisor = h->divisor; | 468 | offload.cls_u32->hnode.handle = h->handle; |
466 | offload.cls_u32->hnode.handle = h->handle; | 469 | offload.cls_u32->hnode.prio = h->prio; |
467 | offload.cls_u32->hnode.prio = h->prio; | ||
468 | 470 | ||
469 | err = dev->netdev_ops->ndo_setup_tc(dev, tp->q->handle, | 471 | err = dev->netdev_ops->ndo_setup_tc(dev, tp->q->handle, |
470 | tp->protocol, &offload); | 472 | tp->protocol, &offload); |
471 | if (tc_skip_sw(flags)) | 473 | if (tc_skip_sw(flags)) |
472 | return err; | 474 | return err; |
473 | } | ||
474 | 475 | ||
475 | return 0; | 476 | return 0; |
476 | } | 477 | } |