Skip to content

Commit f8f3d34

Browse files
vcgomesJeff Kirsher
authored andcommitted
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 <[email protected]> Tested-by: Aaron Brown <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent b4a38d4 commit f8f3d34

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

drivers/net/ethernet/intel/igb/igb_main.c

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include <net/checksum.h>
3737
#include <net/ip6_checksum.h>
3838
#include <net/pkt_sched.h>
39+
#include <net/pkt_cls.h>
3940
#include <linux/net_tstamp.h>
4041
#include <linux/mii.h>
4142
#include <linux/ethtool.h>
@@ -2513,6 +2514,69 @@ static int igb_offload_cbs(struct igb_adapter *adapter,
25132514
return 0;
25142515
}
25152516

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+
25162580
static int igb_setup_tc(struct net_device *dev, enum tc_setup_type type,
25172581
void *type_data)
25182582
{
@@ -2521,6 +2585,8 @@ static int igb_setup_tc(struct net_device *dev, enum tc_setup_type type,
25212585
switch (type) {
25222586
case TC_SETUP_QDISC_CBS:
25232587
return igb_offload_cbs(adapter, type_data);
2588+
case TC_SETUP_BLOCK:
2589+
return igb_setup_tc_block(adapter, type_data);
25242590

25252591
default:
25262592
return -EOPNOTSUPP;

0 commit comments

Comments
 (0)