Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drop_monitor: Initialize hardware per-CPU data

Like software drops, hardware drops also need the same type of per-CPU
data. Therefore, initialize it during module initialization and
de-initialize it during module exit.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Ido Schimmel and committed by
David S. Miller
cac1174f 9b63f57d

+23 -2
+23 -2
net/core/drop_monitor.c
··· 76 76 static struct genl_family net_drop_monitor_family; 77 77 78 78 static DEFINE_PER_CPU(struct per_cpu_dm_data, dm_cpu_data); 79 + static DEFINE_PER_CPU(struct per_cpu_dm_data, dm_hw_cpu_data); 79 80 80 81 static int dm_hit_limit = 64; 81 82 static int dm_delay = 1; ··· 967 966 __net_dm_cpu_data_fini(data); 968 967 } 969 968 969 + static void net_dm_hw_cpu_data_init(int cpu) 970 + { 971 + struct per_cpu_dm_data *hw_data; 972 + 973 + hw_data = &per_cpu(dm_hw_cpu_data, cpu); 974 + __net_dm_cpu_data_init(hw_data); 975 + } 976 + 977 + static void net_dm_hw_cpu_data_fini(int cpu) 978 + { 979 + struct per_cpu_dm_data *hw_data; 980 + 981 + hw_data = &per_cpu(dm_hw_cpu_data, cpu); 982 + __net_dm_cpu_data_fini(hw_data); 983 + } 984 + 970 985 static int __init init_net_drop_monitor(void) 971 986 { 972 987 int cpu, rc; ··· 1009 992 1010 993 rc = 0; 1011 994 1012 - for_each_possible_cpu(cpu) 995 + for_each_possible_cpu(cpu) { 1013 996 net_dm_cpu_data_init(cpu); 997 + net_dm_hw_cpu_data_init(cpu); 998 + } 1014 999 1015 1000 goto out; 1016 1001 ··· 1033 1014 * we are guarnateed not to have any current users when we get here 1034 1015 */ 1035 1016 1036 - for_each_possible_cpu(cpu) 1017 + for_each_possible_cpu(cpu) { 1018 + net_dm_hw_cpu_data_fini(cpu); 1037 1019 net_dm_cpu_data_fini(cpu); 1020 + } 1038 1021 1039 1022 BUG_ON(genl_unregister_family(&net_drop_monitor_family)); 1040 1023 }