/* * netsniff-ng - the packet sniffing beast * Copyright 2009, 2010 Daniel Borkmann. * Copyright 2010 Marek Polacek. * Subject to the GPL, version 2. */ #include #include "iosched.h" #include "die.h" #define IOPRIO_CLASS_SHIFT 13 enum { ioprio_class_none, ioprio_class_rt, ioprio_class_be, ioprio_class_idle, }; enum { ioprio_who_process = 1, ioprio_who_pgrp, ioprio_who_user, }; static const char *const to_prio[] = { "none", "realtime", "best-effort", "idle", }; static inline int ioprio_set(int which, int who, int ioprio) { return syscall(SYS_ioprio_set, which, who, ioprio); } static inline int ioprio_get(int which, int who) { return syscall(SYS_ioprio_get, which, who); } static void ioprio_setpid(pid_t pid, int ioprio, int ioclass) { int ret = ioprio_set(ioprio_who_process, pid, ioprio | ioclass << IOPRIO_CLASS_SHIFT); if (ret < 0) panic("Failed to set io prio for pid: %s\n", strerror(errno)); } void ioprio_print(void) { int ioprio = ioprio_get(ioprio_who_process, getpid()); if (ioprio < 0) panic("Failed to fetch io prio for pid!\n"); else { int ioclass = ioprio >> IOPRIO_CLASS_SHIFT; if (ioclass != ioprio_class_idle) { ioprio &= 0xff; printf("%s: prio %d\n", to_prio[ioclass], ioprio); } else printf("%s\n", to_prio[ioclass]); } } void set_ioprio_rt(void) { ioprio_setpid(getpid(), 4, ioprio_class_rt); } void set_ioprio_be(void) { ioprio_setpid(getpid(), 4, ioprio_class_be); } e>
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2017-02-08 11:24:23 +0100
committerTobias Klauser <tklauser@distanz.ch>2017-02-15 10:34:18 +0100
commit93b636cae5dd2006a252b11606c3080f60462b90 (patch)
treea45b67b1e615e9233125556dd92cf6cd26c76116
parentb1f2f1469cf9fa730396a220804bd5f792b30074 (diff)
net: i40evf: Use net_device_stats from struct net_device
Instead of using a private copy of struct net_device_stats in struct i40evf_adapter, use stats from struct net_device. Also remove the now unnecessary .ndo_get_stats function. Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Cc: intel-wired-lan@lists.osuosl.org Signed-off-by: Tobias Klauser <tklauser@distanz.ch>