summaryrefslogtreecommitdiffstats
path: root/sys/net/if_var.h
diff options
context:
space:
mode:
authoremax <emax@FreeBSD.org>2012-10-17 19:24:13 +0000
committeremax <emax@FreeBSD.org>2012-10-17 19:24:13 +0000
commit0dfb309a1fc65341261b94a9852bbd1ee0b58577 (patch)
treeebc70c440495b0fefbd43703ccfe77fdbe9da04d /sys/net/if_var.h
parent75529c7de349aa818057d25224fe9148f1c33e92 (diff)
downloadFreeBSD-src-0dfb309a1fc65341261b94a9852bbd1ee0b58577.zip
FreeBSD-src-0dfb309a1fc65341261b94a9852bbd1ee0b58577.tar.gz
provide helper if_initbaudrate() to set if_baudrate_pf and if_baudrate_pf.
again, use ixgbe(4) as an example of how to use new helper function. Reviewed by: jhb MFC after: 1 week
Diffstat (limited to 'sys/net/if_var.h')
-rw-r--r--sys/net/if_var.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/sys/net/if_var.h b/sys/net/if_var.h
index d695ef4..6d1097e 100644
--- a/sys/net/if_var.h
+++ b/sys/net/if_var.h
@@ -591,6 +591,18 @@ do { \
} while (0)
#ifdef _KERNEL
+static __inline void
+if_initbaudrate(struct ifnet *ifp, uintmax_t baud)
+{
+
+ ifp->if_baudrate_pf = 0;
+ while (baud > (u_long)(~0UL)) {
+ baud /= 10;
+ ifp->if_baudrate_pf++;
+ }
+ ifp->if_baudrate = baud;
+}
+
static __inline int
drbr_enqueue(struct ifnet *ifp, struct buf_ring *br, struct mbuf *m)
{
OpenPOWER on IntegriCloud