36
36
#include <net/checksum.h>
37
37
#include <net/ip6_checksum.h>
38
38
#include <net/pkt_sched.h>
39
+ #include <net/pkt_cls.h>
39
40
#include <linux/net_tstamp.h>
40
41
#include <linux/mii.h>
41
42
#include <linux/ethtool.h>
@@ -2513,6 +2514,69 @@ static int igb_offload_cbs(struct igb_adapter *adapter,
2513
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
2580
static int igb_setup_tc (struct net_device * dev , enum tc_setup_type type ,
2517
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
2585
switch (type ) {
2522
2586
case TC_SETUP_QDISC_CBS :
2523
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
2591
default :
2526
2592
return - EOPNOTSUPP ;
0 commit comments