summaryrefslogtreecommitdiffstats
path: root/sys/net/if.h
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2014-03-13 03:42:24 +0000
committerglebius <glebius@FreeBSD.org>2014-03-13 03:42:24 +0000
commitb38edcd355dfe9c2ac4080b8837687b0dba7dd41 (patch)
tree23c54b335bf31cd906e8cf3bad37e838d9a80c2d /sys/net/if.h
parent2720ac2544ae02bf5f480a96cc1f9ba096803879 (diff)
downloadFreeBSD-src-b38edcd355dfe9c2ac4080b8837687b0dba7dd41.zip
FreeBSD-src-b38edcd355dfe9c2ac4080b8837687b0dba7dd41.tar.gz
Since 32-bit if_baudrate isn't enough to describe a baud rate of a 10 Gbit
interface, in the r241616 a crutch was provided. It didn't work well, and finally we decided that it is time to break ABI and simply make if_baudrate a 64-bit value. Meanwhile, the entire struct if_data was reviewed. o Remove the if_baudrate_pf crutch. o Make all fields of struct if_data fixed machine independent size. The notion of data (packet counters, etc) are by no means MD. And it is a bug that on amd64 we've got a 64-bit counters, while on i386 32-bit, which at modern speeds overflow within a second. This also removes quite a lot of COMPAT_FREEBSD32 code. o Give 16 bit for the ifi_datalen field. This field was provided to make future changes to if_data less ABI breaking. Unfortunately the 8 bit size of it had effectively limited sizeof if_data to 256 bytes. o Give 32 bits to ifi_mtu and ifi_metric. o Give 64 bits to the rest of fields, since they are counters. __FreeBSD_version bumped. Discussed with: emax Sponsored by: Netflix Sponsored by: Nginx, Inc.
Diffstat (limited to 'sys/net/if.h')
-rw-r--r--sys/net/if.h63
1 files changed, 38 insertions, 25 deletions
diff --git a/sys/net/if.h b/sys/net/if.h
index ec49ad4..1910cbd 100644
--- a/sys/net/if.h
+++ b/sys/net/if.h
@@ -74,32 +74,45 @@ struct if_clonereq {
*/
struct if_data {
/* generic interface information */
- u_char ifi_type; /* ethernet, tokenring, etc */
- u_char ifi_physical; /* e.g., AUI, Thinnet, 10base-T, etc */
- u_char ifi_addrlen; /* media address length */
- u_char ifi_hdrlen; /* media header length */
- u_char ifi_link_state; /* current link state */
- u_char ifi_vhid; /* carp vhid */
- u_char ifi_baudrate_pf; /* baudrate power factor */
- u_char ifi_datalen; /* length of this data struct */
- u_long ifi_mtu; /* maximum transmission unit */
- u_long ifi_metric; /* routing metric (external only) */
- u_long ifi_baudrate; /* linespeed */
+ uint8_t ifi_type; /* ethernet, tokenring, etc */
+ uint8_t ifi_physical; /* e.g., AUI, Thinnet, 10base-T, etc */
+ uint8_t ifi_addrlen; /* media address length */
+ uint8_t ifi_hdrlen; /* media header length */
+ uint8_t ifi_link_state; /* current link state */
+ uint8_t ifi_vhid; /* carp vhid */
+ uint16_t ifi_datalen; /* length of this data struct */
+ uint32_t ifi_mtu; /* maximum transmission unit */
+ uint32_t ifi_metric; /* routing metric (external only) */
+ uint64_t ifi_baudrate; /* linespeed */
/* volatile statistics */
- u_long ifi_ipackets; /* packets received on interface */
- u_long ifi_ierrors; /* input errors on interface */
- u_long ifi_opackets; /* packets sent on interface */
- u_long ifi_oerrors; /* output errors on interface */
- u_long ifi_collisions; /* collisions on csma interfaces */
- u_long ifi_ibytes; /* total number of octets received */
- u_long ifi_obytes; /* total number of octets sent */
- u_long ifi_imcasts; /* packets received via multicast */
- u_long ifi_omcasts; /* packets sent via multicast */
- u_long ifi_iqdrops; /* dropped on input, this interface */
- u_long ifi_noproto; /* destined for unsupported protocol */
- uint64_t ifi_hwassist; /* HW offload capabilities, see IFCAP */
- time_t ifi_epoch; /* uptime at attach or stat reset */
- struct timeval ifi_lastchange; /* time of last administrative change */
+ uint64_t ifi_ipackets; /* packets received on interface */
+ uint64_t ifi_ierrors; /* input errors on interface */
+ uint64_t ifi_opackets; /* packets sent on interface */
+ uint64_t ifi_oerrors; /* output errors on interface */
+ uint64_t ifi_collisions; /* collisions on csma interfaces */
+ uint64_t ifi_ibytes; /* total number of octets received */
+ uint64_t ifi_obytes; /* total number of octets sent */
+ uint64_t ifi_imcasts; /* packets received via multicast */
+ uint64_t ifi_omcasts; /* packets sent via multicast */
+ uint64_t ifi_iqdrops; /* dropped on input */
+ uint64_t ifi_oqdrops; /* dropped on output */
+ uint64_t ifi_noproto; /* destined for unsupported protocol */
+ uint64_t ifi_hwassist; /* HW offload capabilities, see IFCAP */
+
+ /* Unions are here to make sizes MI. */
+ union { /* uptime at attach or stat reset */
+ time_t tt;
+ uint64_t ph;
+ } __ifi_epoch;
+#define ifi_epoch __ifi_epoch.tt
+ union { /* time of last administrative change */
+ struct timeval tv;
+ struct {
+ uint64_t ph1;
+ uint64_t ph2;
+ } ph;
+ } __ifi_lastchange;
+#define ifi_lastchange __ifi_lastchange.tv
};
/*-
OpenPOWER on IntegriCloud