diff options
author | Vinicius Costa Gomes <vinicius.gomes@intel.com> | 2018-04-10 13:49:58 -0400 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2018-04-25 14:03:05 -0400 |
commit | f8f3d34e5470c48a10c27c4f6f65e149e10d04ec (patch) | |
tree | 269b005c3317d38de580395d99d73240142c0949 | |
parent | b4a38d4276e1c3ca46141d6424a8da86bc5b74b0 (diff) |
igb: Add the skeletons for tc-flower offloading
This adds basic functions needed to implement offloading for filters
created by tc-flower.
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
-rw-r--r-- | drivers/net/ethernet/intel/igb/igb_main.c | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index 9a5c2dc3cf5a..26b0f0efc97e 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <net/checksum.h> | 36 | #include <net/checksum.h> |
37 | #include <net/ip6_checksum.h> | 37 | #include <net/ip6_checksum.h> |
38 | #include <net/pkt_sched.h> | 38 | #include <net/pkt_sched.h> |
39 | #include <net/pkt_cls.h> | ||
39 | #include <linux/net_tstamp.h> | 40 | #include <linux/net_tstamp.h> |
40 | #include <linux/mii.h> | 41 | #include <linux/mii.h> |
41 | #include <linux/ethtool.h> | 42 | #include <linux/ethtool.h> |
@@ -2513,6 +2514,69 @@ static int igb_offload_cbs(struct igb_adapter *adapter, | |||
2513 | return 0; | 2514 | return 0; |
2514 | } | 2515 | } |
2515 | 2516 | ||
2517 | static int igb_configure_clsflower(struct igb_adapter *adapter, | ||
2518 | struct tc_cls_flower_offload *cls_flower) | ||
2519 | { | ||
2520 | return -EOPNOTSUPP; | ||
2521 | } | ||
2522 | |||
2523 | static int igb_delete_clsflower(struct igb_adapter *adapter, | ||
2524 | struct tc_cls_flower_offload *cls_flower) | ||
2525 | { | ||
2526 | return -EOPNOTSUPP; | ||
2527 | } | ||
2528 | |||
2529 | static int igb_setup_tc_cls_flower(struct igb_adapter *adapter, | ||
2530 | struct tc_cls_flower_offload *cls_flower) | ||
2531 | { | ||
2532 | switch (cls_flower->command) { | ||
2533 | case TC_CLSFLOWER_REPLACE: | ||
2534 | return igb_configure_clsflower(adapter, cls_flower); | ||
2535 | case TC_CLSFLOWER_DESTROY: | ||
2536 | return igb_delete_clsflower(adapter, cls_flower); | ||
2537 | case TC_CLSFLOWER_STATS: | ||
2538 | return -EOPNOTSUPP; | ||
2539 | default: | ||
2540 | return -EINVAL; | ||
2541 | } | ||
2542 | } | ||
2543 | |||
2544 | static int igb_setup_tc_block_cb(enum tc_setup_type type, void *type_data, | ||
2545 | void *cb_priv) | ||
2546 | { | ||
2547 | struct igb_adapter *adapter = cb_priv; | ||
2548 | |||
2549 | if (!tc_cls_can_offload_and_chain0(adapter->netdev, type_data)) | ||
2550 | return -EOPNOTSUPP; | ||
2551 | |||
2552 | switch (type) { | ||
2553 | case TC_SETUP_CLSFLOWER: | ||
2554 | return igb_setup_tc_cls_flower(adapter, type_data); | ||
2555 | |||
2556 | default: | ||
2557 | return -EOPNOTSUPP; | ||
2558 | } | ||
2559 | } | ||
2560 | |||
2561 | static int igb_setup_tc_block(struct igb_adapter *adapter, | ||
2562 | struct tc_block_offload *f) | ||
2563 | { | ||
2564 | if (f->binder_type != TCF_BLOCK_BINDER_TYPE_CLSACT_INGRESS) | ||
2565 | return -EOPNOTSUPP; | ||
2566 | |||
2567 | switch (f->command) { | ||
2568 | case TC_BLOCK_BIND: | ||
2569 | return tcf_block_cb_register(f->block, igb_setup_tc_block_cb, | ||
2570 | adapter, adapter); | ||
2571 | case TC_BLOCK_UNBIND: | ||
2572 | tcf_block_cb_unregister(f->block, igb_setup_tc_block_cb, | ||
2573 | adapter); | ||
2574 | return 0; | ||
2575 | default: | ||
2576 | return -EOPNOTSUPP; | ||
2577 | } | ||
2578 | } | ||
2579 | |||
2516 | static int igb_setup_tc(struct net_device *dev, enum tc_setup_type type, | 2580 | static int igb_setup_tc(struct net_device *dev, enum tc_setup_type type, |
2517 | void *type_data) | 2581 | void *type_data) |
2518 | { | 2582 | { |
@@ -2521,6 +2585,8 @@ static int igb_setup_tc(struct net_device *dev, enum tc_setup_type type, | |||
2521 | switch (type) { | 2585 | switch (type) { |
2522 | case TC_SETUP_QDISC_CBS: | 2586 | case TC_SETUP_QDISC_CBS: |
2523 | return igb_offload_cbs(adapter, type_data); | 2587 | return igb_offload_cbs(adapter, type_data); |
2588 | case TC_SETUP_BLOCK: | ||
2589 | return igb_setup_tc_block(adapter, type_data); | ||
2524 | 2590 | ||
2525 | default: | 2591 | default: |
2526 | return -EOPNOTSUPP; | 2592 | return -EOPNOTSUPP; |