@@ -122,8 +122,6 @@ struct net_dm_alert_ops {
122
122
int work , int budget );
123
123
void (* work_item_func )(struct work_struct * work );
124
124
void (* hw_work_item_func )(struct work_struct * work );
125
- void (* hw_probe )(struct sk_buff * skb ,
126
- const struct net_dm_hw_metadata * hw_metadata );
127
125
void (* hw_trap_probe )(void * ignore , const struct devlink * devlink ,
128
126
struct sk_buff * skb ,
129
127
const struct devlink_trap_metadata * metadata );
@@ -442,49 +440,6 @@ static void net_dm_hw_summary_work(struct work_struct *work)
442
440
kfree (hw_entries );
443
441
}
444
442
445
- static void
446
- net_dm_hw_summary_probe (struct sk_buff * skb ,
447
- const struct net_dm_hw_metadata * hw_metadata )
448
- {
449
- struct net_dm_hw_entries * hw_entries ;
450
- struct net_dm_hw_entry * hw_entry ;
451
- struct per_cpu_dm_data * hw_data ;
452
- unsigned long flags ;
453
- int i ;
454
-
455
- hw_data = this_cpu_ptr (& dm_hw_cpu_data );
456
- spin_lock_irqsave (& hw_data -> lock , flags );
457
- hw_entries = hw_data -> hw_entries ;
458
-
459
- if (!hw_entries )
460
- goto out ;
461
-
462
- for (i = 0 ; i < hw_entries -> num_entries ; i ++ ) {
463
- hw_entry = & hw_entries -> entries [i ];
464
- if (!strncmp (hw_entry -> trap_name , hw_metadata -> trap_name ,
465
- NET_DM_MAX_HW_TRAP_NAME_LEN - 1 )) {
466
- hw_entry -> count ++ ;
467
- goto out ;
468
- }
469
- }
470
- if (WARN_ON_ONCE (hw_entries -> num_entries == dm_hit_limit ))
471
- goto out ;
472
-
473
- hw_entry = & hw_entries -> entries [hw_entries -> num_entries ];
474
- strlcpy (hw_entry -> trap_name , hw_metadata -> trap_name ,
475
- NET_DM_MAX_HW_TRAP_NAME_LEN - 1 );
476
- hw_entry -> count = 1 ;
477
- hw_entries -> num_entries ++ ;
478
-
479
- if (!timer_pending (& hw_data -> send_timer )) {
480
- hw_data -> send_timer .expires = jiffies + dm_delay * HZ ;
481
- add_timer (& hw_data -> send_timer );
482
- }
483
-
484
- out :
485
- spin_unlock_irqrestore (& hw_data -> lock , flags );
486
- }
487
-
488
443
static void
489
444
net_dm_hw_trap_summary_probe (void * ignore , const struct devlink * devlink ,
490
445
struct sk_buff * skb ,
@@ -534,7 +489,6 @@ static const struct net_dm_alert_ops net_dm_alert_summary_ops = {
534
489
.napi_poll_probe = trace_napi_poll_hit ,
535
490
.work_item_func = send_dm_alert ,
536
491
.hw_work_item_func = net_dm_hw_summary_work ,
537
- .hw_probe = net_dm_hw_summary_probe ,
538
492
.hw_trap_probe = net_dm_hw_trap_summary_probe ,
539
493
};
540
494
@@ -866,54 +820,6 @@ static int net_dm_hw_packet_report_fill(struct sk_buff *msg,
866
820
return - EMSGSIZE ;
867
821
}
868
822
869
- static struct net_dm_hw_metadata *
870
- net_dm_hw_metadata_clone (const struct net_dm_hw_metadata * hw_metadata )
871
- {
872
- const struct flow_action_cookie * fa_cookie ;
873
- struct net_dm_hw_metadata * n_hw_metadata ;
874
- const char * trap_group_name ;
875
- const char * trap_name ;
876
-
877
- n_hw_metadata = kzalloc (sizeof (* hw_metadata ), GFP_ATOMIC );
878
- if (!n_hw_metadata )
879
- return NULL ;
880
-
881
- trap_group_name = kstrdup (hw_metadata -> trap_group_name , GFP_ATOMIC );
882
- if (!trap_group_name )
883
- goto free_hw_metadata ;
884
- n_hw_metadata -> trap_group_name = trap_group_name ;
885
-
886
- trap_name = kstrdup (hw_metadata -> trap_name , GFP_ATOMIC );
887
- if (!trap_name )
888
- goto free_trap_group ;
889
- n_hw_metadata -> trap_name = trap_name ;
890
-
891
- if (hw_metadata -> fa_cookie ) {
892
- size_t cookie_size = sizeof (* fa_cookie ) +
893
- hw_metadata -> fa_cookie -> cookie_len ;
894
-
895
- fa_cookie = kmemdup (hw_metadata -> fa_cookie , cookie_size ,
896
- GFP_ATOMIC );
897
- if (!fa_cookie )
898
- goto free_trap_name ;
899
- n_hw_metadata -> fa_cookie = fa_cookie ;
900
- }
901
-
902
- n_hw_metadata -> input_dev = hw_metadata -> input_dev ;
903
- if (n_hw_metadata -> input_dev )
904
- dev_hold (n_hw_metadata -> input_dev );
905
-
906
- return n_hw_metadata ;
907
-
908
- free_trap_name :
909
- kfree (trap_name );
910
- free_trap_group :
911
- kfree (trap_group_name );
912
- free_hw_metadata :
913
- kfree (n_hw_metadata );
914
- return NULL ;
915
- }
916
-
917
823
static struct net_dm_hw_metadata *
918
824
net_dm_hw_metadata_copy (const struct devlink_trap_metadata * metadata )
919
825
{
@@ -1027,53 +933,6 @@ static void net_dm_hw_packet_work(struct work_struct *work)
1027
933
net_dm_hw_packet_report (skb );
1028
934
}
1029
935
1030
- static void
1031
- net_dm_hw_packet_probe (struct sk_buff * skb ,
1032
- const struct net_dm_hw_metadata * hw_metadata )
1033
- {
1034
- struct net_dm_hw_metadata * n_hw_metadata ;
1035
- ktime_t tstamp = ktime_get_real ();
1036
- struct per_cpu_dm_data * hw_data ;
1037
- struct sk_buff * nskb ;
1038
- unsigned long flags ;
1039
-
1040
- if (!skb_mac_header_was_set (skb ))
1041
- return ;
1042
-
1043
- nskb = skb_clone (skb , GFP_ATOMIC );
1044
- if (!nskb )
1045
- return ;
1046
-
1047
- n_hw_metadata = net_dm_hw_metadata_clone (hw_metadata );
1048
- if (!n_hw_metadata )
1049
- goto free ;
1050
-
1051
- NET_DM_SKB_CB (nskb )-> hw_metadata = n_hw_metadata ;
1052
- nskb -> tstamp = tstamp ;
1053
-
1054
- hw_data = this_cpu_ptr (& dm_hw_cpu_data );
1055
-
1056
- spin_lock_irqsave (& hw_data -> drop_queue .lock , flags );
1057
- if (skb_queue_len (& hw_data -> drop_queue ) < net_dm_queue_len )
1058
- __skb_queue_tail (& hw_data -> drop_queue , nskb );
1059
- else
1060
- goto unlock_free ;
1061
- spin_unlock_irqrestore (& hw_data -> drop_queue .lock , flags );
1062
-
1063
- schedule_work (& hw_data -> dm_alert_work );
1064
-
1065
- return ;
1066
-
1067
- unlock_free :
1068
- spin_unlock_irqrestore (& hw_data -> drop_queue .lock , flags );
1069
- u64_stats_update_begin (& hw_data -> stats .syncp );
1070
- hw_data -> stats .dropped ++ ;
1071
- u64_stats_update_end (& hw_data -> stats .syncp );
1072
- net_dm_hw_metadata_free (n_hw_metadata );
1073
- free :
1074
- consume_skb (nskb );
1075
- }
1076
-
1077
936
static void
1078
937
net_dm_hw_trap_packet_probe (void * ignore , const struct devlink * devlink ,
1079
938
struct sk_buff * skb ,
@@ -1127,7 +986,6 @@ static const struct net_dm_alert_ops net_dm_alert_packet_ops = {
1127
986
.napi_poll_probe = net_dm_packet_trace_napi_poll_hit ,
1128
987
.work_item_func = net_dm_packet_work ,
1129
988
.hw_work_item_func = net_dm_hw_packet_work ,
1130
- .hw_probe = net_dm_hw_packet_probe ,
1131
989
.hw_trap_probe = net_dm_hw_trap_packet_probe ,
1132
990
};
1133
991
0 commit comments