aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJohn Fastabend <john.fastabend@gmail.com>2016-02-26 10:53:49 -0500
committerDavid S. Miller <davem@davemloft.net>2016-03-01 16:05:39 -0500
commit6843e7a2abe7cac10c19702ffec90018df6f040d (patch)
tree6ce0e74043e12f755c5bba0174d2f2c5e7cb5544 /net
parentd2e42a1756501ce3466e538da742f9a67c233d47 (diff)
net: sched: consolidate offload decision in cls_u32
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> Acked-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/sched/cls_u32.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c
index d54bc942ea87..24e888b9b728 100644
--- a/net/sched/cls_u32.c
+++ b/net/sched/cls_u32.c
@@ -434,7 +434,7 @@ static void u32_remove_hw_knode(struct tcf_proto *tp, u32 handle)
434 offload.type = TC_SETUP_CLSU32; 434 offload.type = TC_SETUP_CLSU32;
435 offload.cls_u32 = &u32_offload; 435 offload.cls_u32 = &u32_offload;
436 436
437 if (dev->netdev_ops->ndo_setup_tc) { 437 if (tc_should_offload(dev)) {
438 offload.cls_u32->command = TC_CLSU32_DELETE_KNODE; 438 offload.cls_u32->command = TC_CLSU32_DELETE_KNODE;
439 offload.cls_u32->knode.handle = handle; 439 offload.cls_u32->knode.handle = handle;
440 dev->netdev_ops->ndo_setup_tc(dev, tp->q->handle, 440 dev->netdev_ops->ndo_setup_tc(dev, tp->q->handle,
@@ -451,7 +451,7 @@ static void u32_replace_hw_hnode(struct tcf_proto *tp, struct tc_u_hnode *h)
451 offload.type = TC_SETUP_CLSU32; 451 offload.type = TC_SETUP_CLSU32;
452 offload.cls_u32 = &u32_offload; 452 offload.cls_u32 = &u32_offload;
453 453
454 if (dev->netdev_ops->ndo_setup_tc) { 454 if (tc_should_offload(dev)) {
455 offload.cls_u32->command = TC_CLSU32_NEW_HNODE; 455 offload.cls_u32->command = TC_CLSU32_NEW_HNODE;
456 offload.cls_u32->hnode.divisor = h->divisor; 456 offload.cls_u32->hnode.divisor = h->divisor;
457 offload.cls_u32->hnode.handle = h->handle; 457 offload.cls_u32->hnode.handle = h->handle;
@@ -471,7 +471,7 @@ static void u32_clear_hw_hnode(struct tcf_proto *tp, struct tc_u_hnode *h)
471 offload.type = TC_SETUP_CLSU32; 471 offload.type = TC_SETUP_CLSU32;
472 offload.cls_u32 = &u32_offload; 472 offload.cls_u32 = &u32_offload;
473 473
474 if (dev->netdev_ops->ndo_setup_tc) { 474 if (tc_should_offload(dev)) {
475 offload.cls_u32->command = TC_CLSU32_DELETE_HNODE; 475 offload.cls_u32->command = TC_CLSU32_DELETE_HNODE;
476 offload.cls_u32->hnode.divisor = h->divisor; 476 offload.cls_u32->hnode.divisor = h->divisor;
477 offload.cls_u32->hnode.handle = h->handle; 477 offload.cls_u32->hnode.handle = h->handle;
@@ -491,7 +491,7 @@ static void u32_replace_hw_knode(struct tcf_proto *tp, struct tc_u_knode *n)
491 offload.type = TC_SETUP_CLSU32; 491 offload.type = TC_SETUP_CLSU32;
492 offload.cls_u32 = &u32_offload; 492 offload.cls_u32 = &u32_offload;
493 493
494 if (dev->netdev_ops->ndo_setup_tc) { 494 if (tc_should_offload(dev)) {
495 offload.cls_u32->command = TC_CLSU32_REPLACE_KNODE; 495 offload.cls_u32->command = TC_CLSU32_REPLACE_KNODE;
496 offload.cls_u32->knode.handle = n->handle; 496 offload.cls_u32->knode.handle = n->handle;
497 offload.cls_u32->knode.fshift = n->fshift; 497 offload.cls_u32->knode.fshift = n->fshift;