Lines Matching refs:hwsdev
25 struct nsim_dev_hwstats_netdev *hwsdev; in nsim_dev_hwstats_traffic_bump() local
32 list_for_each_entry(hwsdev, hwsdev_list, list) { in nsim_dev_hwstats_traffic_bump()
33 if (hwsdev->enabled) { in nsim_dev_hwstats_traffic_bump()
34 hwsdev->stats.rx_packets += 1; in nsim_dev_hwstats_traffic_bump()
35 hwsdev->stats.tx_packets += 2; in nsim_dev_hwstats_traffic_bump()
36 hwsdev->stats.rx_bytes += 100; in nsim_dev_hwstats_traffic_bump()
37 hwsdev->stats.tx_bytes += 300; in nsim_dev_hwstats_traffic_bump()
59 struct nsim_dev_hwstats_netdev *hwsdev; in nsim_dev_hwslist_find_hwsdev() local
61 list_for_each_entry(hwsdev, hwsdev_list, list) { in nsim_dev_hwslist_find_hwsdev()
62 if (hwsdev->netdev->ifindex == ifindex) in nsim_dev_hwslist_find_hwsdev()
63 return hwsdev; in nsim_dev_hwslist_find_hwsdev()
69 static int nsim_dev_hwsdev_enable(struct nsim_dev_hwstats_netdev *hwsdev, in nsim_dev_hwsdev_enable() argument
72 if (hwsdev->fail_enable) { in nsim_dev_hwsdev_enable()
73 hwsdev->fail_enable = false; in nsim_dev_hwsdev_enable()
78 hwsdev->enabled = true; in nsim_dev_hwsdev_enable()
82 static void nsim_dev_hwsdev_disable(struct nsim_dev_hwstats_netdev *hwsdev) in nsim_dev_hwsdev_disable() argument
84 hwsdev->enabled = false; in nsim_dev_hwsdev_disable()
85 memset(&hwsdev->stats, 0, sizeof(hwsdev->stats)); in nsim_dev_hwsdev_disable()
89 nsim_dev_hwsdev_report_delta(struct nsim_dev_hwstats_netdev *hwsdev, in nsim_dev_hwsdev_report_delta() argument
92 netdev_offload_xstats_report_delta(info->report_delta, &hwsdev->stats); in nsim_dev_hwsdev_report_delta()
93 memset(&hwsdev->stats, 0, sizeof(hwsdev->stats)); in nsim_dev_hwsdev_report_delta()
98 nsim_dev_hwsdev_report_used(struct nsim_dev_hwstats_netdev *hwsdev, in nsim_dev_hwsdev_report_used() argument
101 if (hwsdev->enabled) in nsim_dev_hwsdev_report_used()
110 struct nsim_dev_hwstats_netdev *hwsdev; in nsim_dev_hwstats_event_off_xstats() local
121 hwsdev = nsim_dev_hwslist_find_hwsdev(hwsdev_list, dev->ifindex); in nsim_dev_hwstats_event_off_xstats()
122 if (!hwsdev) in nsim_dev_hwstats_event_off_xstats()
127 err = nsim_dev_hwsdev_enable(hwsdev, info->info.extack); in nsim_dev_hwstats_event_off_xstats()
130 nsim_dev_hwsdev_disable(hwsdev); in nsim_dev_hwstats_event_off_xstats()
133 nsim_dev_hwsdev_report_used(hwsdev, info); in nsim_dev_hwstats_event_off_xstats()
136 err = nsim_dev_hwsdev_report_delta(hwsdev, info); in nsim_dev_hwstats_event_off_xstats()
145 static void nsim_dev_hwsdev_fini(struct nsim_dev_hwstats_netdev *hwsdev) in nsim_dev_hwsdev_fini() argument
147 dev_put(hwsdev->netdev); in nsim_dev_hwsdev_fini()
148 kfree(hwsdev); in nsim_dev_hwsdev_fini()
156 struct nsim_dev_hwstats_netdev *hwsdev; in __nsim_dev_hwstats_event_unregister() local
163 hwsdev = nsim_dev_hwslist_find_hwsdev(hwsdev_list, dev->ifindex); in __nsim_dev_hwstats_event_unregister()
164 if (!hwsdev) in __nsim_dev_hwstats_event_unregister()
167 list_del(&hwsdev->list); in __nsim_dev_hwstats_event_unregister()
168 nsim_dev_hwsdev_fini(hwsdev); in __nsim_dev_hwstats_event_unregister()
220 struct nsim_dev_hwstats_netdev *hwsdev; in nsim_dev_hwstats_enable_ifindex() local
232 hwsdev = nsim_dev_hwslist_find_hwsdev(hwsdev_list, ifindex); in nsim_dev_hwstats_enable_ifindex()
233 if (hwsdev) in nsim_dev_hwstats_enable_ifindex()
242 hwsdev = kzalloc(sizeof(*hwsdev), GFP_KERNEL); in nsim_dev_hwstats_enable_ifindex()
243 if (!hwsdev) { in nsim_dev_hwstats_enable_ifindex()
248 hwsdev->netdev = netdev; in nsim_dev_hwstats_enable_ifindex()
249 list_add_tail(&hwsdev->list, hwsdev_list); in nsim_dev_hwstats_enable_ifindex()
253 nsim_dev_hwsdev_enable(hwsdev, NULL); in nsim_dev_hwstats_enable_ifindex()
276 struct nsim_dev_hwstats_netdev *hwsdev; in nsim_dev_hwstats_disable_ifindex() local
281 hwsdev = nsim_dev_hwslist_find_hwsdev(hwsdev_list, ifindex); in nsim_dev_hwstats_disable_ifindex()
282 if (hwsdev) in nsim_dev_hwstats_disable_ifindex()
283 list_del(&hwsdev->list); in nsim_dev_hwstats_disable_ifindex()
286 if (!hwsdev) { in nsim_dev_hwstats_disable_ifindex()
291 if (netdev_offload_xstats_enabled(hwsdev->netdev, type)) { in nsim_dev_hwstats_disable_ifindex()
292 netdev_offload_xstats_push_delta(hwsdev->netdev, type, in nsim_dev_hwstats_disable_ifindex()
293 &hwsdev->stats); in nsim_dev_hwstats_disable_ifindex()
294 rtnl_offload_xstats_notify(hwsdev->netdev); in nsim_dev_hwstats_disable_ifindex()
296 nsim_dev_hwsdev_fini(hwsdev); in nsim_dev_hwstats_disable_ifindex()
309 struct nsim_dev_hwstats_netdev *hwsdev; in nsim_dev_hwstats_fail_ifindex() local
314 hwsdev = nsim_dev_hwslist_find_hwsdev(hwsdev_list, ifindex); in nsim_dev_hwstats_fail_ifindex()
315 if (!hwsdev) { in nsim_dev_hwstats_fail_ifindex()
320 hwsdev->fail_enable = true; in nsim_dev_hwstats_fail_ifindex()
461 struct nsim_dev_hwstats_netdev *hwsdev, *tmp; in nsim_dev_hwsdev_list_wipe() local
469 list_for_each_entry_safe(hwsdev, tmp, hwsdev_list, list) { in nsim_dev_hwsdev_list_wipe()
470 list_del(&hwsdev->list); in nsim_dev_hwsdev_list_wipe()
471 nsim_dev_hwsdev_fini(hwsdev); in nsim_dev_hwsdev_list_wipe()