diff --git a/sys/net/if.c b/sys/net/if.c --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1692,19 +1692,6 @@ return (counter_u64_fetch(ifp->if_counters[cnt])); } -/* - * Increase an ifnet counter. Usually used for counters shared - * between the stack and a driver, but function supports them all. - */ -void -if_inc_counter(struct ifnet *ifp, ift_counter cnt, int64_t inc) -{ - - KASSERT(cnt < IFCOUNTERS, ("%s: invalid cnt %d", __func__, cnt)); - - counter_u64_add(ifp->if_counters[cnt], inc); -} - /* * Copy data from ifnet to userland API structure if_data. */ diff --git a/sys/net/if_var.h b/sys/net/if_var.h --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -724,7 +724,18 @@ void if_deregister_com_alloc(u_char type); void if_data_copy(struct ifnet *, struct if_data *); uint64_t if_get_counter_default(struct ifnet *, ift_counter); -void if_inc_counter(struct ifnet *, ift_counter, int64_t); + +/* + * Increase an ifnet counter. Usually used for counters shared + * between the stack and a driver, but function supports them all. + */ +static __inline void +if_inc_counter(struct ifnet *ifp, ift_counter cnt, int64_t inc) +{ + KASSERT(cnt < IFCOUNTERS, ("%s: invalid cnt %d", __func__, cnt)); + + counter_u64_add(ifp->if_counters[cnt], inc); +} #define IF_LLADDR(ifp) \ LLADDR((struct sockaddr_dl *)((ifp)->if_addr->ifa_addr))