summaryrefslogtreecommitdiffstats
path: root/sys/net/if_var.h
diff options
context:
space:
mode:
authorae <ae@FreeBSD.org>2014-12-23 09:39:40 +0000
committerae <ae@FreeBSD.org>2014-12-23 09:39:40 +0000
commit57be9990bda3e6f3bc0fd4d3b67627241f0b0d75 (patch)
treef61fde71da0a16c799c8519afe2d77707c541b0f /sys/net/if_var.h
parent5b60997187898949d337bb4868b3f0c51b59154b (diff)
downloadFreeBSD-src-57be9990bda3e6f3bc0fd4d3b67627241f0b0d75.zip
FreeBSD-src-57be9990bda3e6f3bc0fd4d3b67627241f0b0d75.tar.gz
Add if_inc_counter() and if_get_counter_default() functions that do
access to ifnet counters for code compatibility with FreeBSD 11. This is direct commit to stable/10. Discussed with: glebius@, arch@
Diffstat (limited to 'sys/net/if_var.h')
-rw-r--r--sys/net/if_var.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/sys/net/if_var.h b/sys/net/if_var.h
index e6ed31b..58391a1 100644
--- a/sys/net/if_var.h
+++ b/sys/net/if_var.h
@@ -104,6 +104,22 @@ VNET_DECLARE(struct pfil_head, link_pfil_hook); /* packet filter hooks */
#define V_link_pfil_hook VNET(link_pfil_hook)
#endif /* _KERNEL */
+typedef enum {
+ IFCOUNTER_IPACKETS = 0,
+ IFCOUNTER_IERRORS,
+ IFCOUNTER_OPACKETS,
+ IFCOUNTER_OERRORS,
+ IFCOUNTER_COLLISIONS,
+ IFCOUNTER_IBYTES,
+ IFCOUNTER_OBYTES,
+ IFCOUNTER_IMCASTS,
+ IFCOUNTER_OMCASTS,
+ IFCOUNTER_IQDROPS,
+ IFCOUNTER_OQDROPS,
+ IFCOUNTER_NOPROTO,
+ IFCOUNTERS /* Array size. */
+} ift_counter;
+
/*
* Structure defining a queue for a network interface.
*/
@@ -981,6 +997,8 @@ typedef void *if_com_alloc_t(u_char type, struct ifnet *ifp);
typedef void if_com_free_t(void *com, u_char type);
void if_register_com_alloc(u_char type, if_com_alloc_t *a, if_com_free_t *f);
void if_deregister_com_alloc(u_char type);
+uint64_t if_get_counter_default(struct ifnet *, ift_counter);
+void if_inc_counter(struct ifnet *, ift_counter, int64_t);
#define IF_LLADDR(ifp) \
LLADDR((struct sockaddr_dl *)((ifp)->if_addr->ifa_addr))
OpenPOWER on IntegriCloud