Skip to content

Commit de9cbb8

Browse files
idoschdavem330
authored andcommitted
drop_monitor: Remove no longer used functions
The old probe functions that were invoked by drop monitor code are no longer called and can thus be removed. They were replaced by actual probe functions that are registered on the recently introduced 'devlink_trap_report' tracepoint. Signed-off-by: Ido Schimmel <[email protected]> Reviewed-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 8ee2267 commit de9cbb8

File tree

1 file changed

+0
-142
lines changed

1 file changed

+0
-142
lines changed

net/core/drop_monitor.c

Lines changed: 0 additions & 142 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,6 @@ struct net_dm_alert_ops {
122122
int work, int budget);
123123
void (*work_item_func)(struct work_struct *work);
124124
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);
127125
void (*hw_trap_probe)(void *ignore, const struct devlink *devlink,
128126
struct sk_buff *skb,
129127
const struct devlink_trap_metadata *metadata);
@@ -442,49 +440,6 @@ static void net_dm_hw_summary_work(struct work_struct *work)
442440
kfree(hw_entries);
443441
}
444442

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-
488443
static void
489444
net_dm_hw_trap_summary_probe(void *ignore, const struct devlink *devlink,
490445
struct sk_buff *skb,
@@ -534,7 +489,6 @@ static const struct net_dm_alert_ops net_dm_alert_summary_ops = {
534489
.napi_poll_probe = trace_napi_poll_hit,
535490
.work_item_func = send_dm_alert,
536491
.hw_work_item_func = net_dm_hw_summary_work,
537-
.hw_probe = net_dm_hw_summary_probe,
538492
.hw_trap_probe = net_dm_hw_trap_summary_probe,
539493
};
540494

@@ -866,54 +820,6 @@ static int net_dm_hw_packet_report_fill(struct sk_buff *msg,
866820
return -EMSGSIZE;
867821
}
868822

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-
917823
static struct net_dm_hw_metadata *
918824
net_dm_hw_metadata_copy(const struct devlink_trap_metadata *metadata)
919825
{
@@ -1027,53 +933,6 @@ static void net_dm_hw_packet_work(struct work_struct *work)
1027933
net_dm_hw_packet_report(skb);
1028934
}
1029935

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-
1077936
static void
1078937
net_dm_hw_trap_packet_probe(void *ignore, const struct devlink *devlink,
1079938
struct sk_buff *skb,
@@ -1127,7 +986,6 @@ static const struct net_dm_alert_ops net_dm_alert_packet_ops = {
1127986
.napi_poll_probe = net_dm_packet_trace_napi_poll_hit,
1128987
.work_item_func = net_dm_packet_work,
1129988
.hw_work_item_func = net_dm_hw_packet_work,
1130-
.hw_probe = net_dm_hw_packet_probe,
1131989
.hw_trap_probe = net_dm_hw_trap_packet_probe,
1132990
};
1133991

0 commit comments

Comments
 (0)