From owner-svn-src-all@FreeBSD.ORG Thu Mar 13 03:42:30 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 905E27D9; Thu, 13 Mar 2014 03:42:30 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7AB71BFF; Thu, 13 Mar 2014 03:42:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s2D3gUEQ063634; Thu, 13 Mar 2014 03:42:30 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s2D3gP0K063605; Thu, 13 Mar 2014 03:42:25 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201403130342.s2D3gP0K063605@svn.freebsd.org> From: Gleb Smirnoff Date: Thu, 13 Mar 2014 03:42:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r263102 - in head: sys/compat/linprocfs sys/dev/bxe sys/dev/ixgbe sys/dev/mxge sys/dev/oce sys/dev/qlxgb sys/dev/qlxgbe sys/dev/qlxge sys/dev/sbni sys/dev/virtio/network sys/dev/vmware/... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Mar 2014 03:42:30 -0000 Author: glebius Date: Thu Mar 13 03:42:24 2014 New Revision: 263102 URL: http://svnweb.freebsd.org/changeset/base/263102 Log: 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. Modified: head/sys/compat/linprocfs/linprocfs.c head/sys/dev/bxe/bxe.c head/sys/dev/ixgbe/ixgbe.c head/sys/dev/mxge/if_mxge.c head/sys/dev/mxge/if_mxge_var.h head/sys/dev/oce/oce_if.c head/sys/dev/qlxgb/qla_os.c head/sys/dev/qlxgbe/ql_os.c head/sys/dev/qlxge/qls_os.c head/sys/dev/sbni/if_sbni.c head/sys/dev/virtio/network/if_vtnet.c head/sys/dev/vmware/vmxnet3/if_vmx.c head/sys/dev/vxge/vxge.c head/sys/mips/rmi/dev/nlge/if_nlge.c head/sys/net/if.h head/sys/net/if_bridge.c head/sys/net/if_epair.c head/sys/net/if_var.h head/sys/net/rtsock.c head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c head/sys/ofed/drivers/net/mlx4/en_netdev.c head/sys/ofed/include/rdma/ib_addr.h head/sys/sys/param.h head/tools/tools/ifinfo/ifinfo.c head/usr.bin/netstat/if.c Modified: head/sys/compat/linprocfs/linprocfs.c ============================================================================== --- head/sys/compat/linprocfs/linprocfs.c Thu Mar 13 03:42:00 2014 (r263101) +++ head/sys/compat/linprocfs/linprocfs.c Thu Mar 13 03:42:24 2014 (r263102) @@ -1131,31 +1131,32 @@ linprocfs_donetdev(PFS_FILL_ARGS) TAILQ_FOREACH(ifp, &V_ifnet, if_link) { linux_ifname(ifp, ifname, sizeof ifname); sbuf_printf(sb, "%6.6s: ", ifname); - sbuf_printf(sb, "%7lu %7lu %4lu %4lu %4lu %5lu %10lu %9lu ", - ifp->if_ibytes, /* rx_bytes */ - ifp->if_ipackets, /* rx_packets */ - ifp->if_ierrors, /* rx_errors */ - ifp->if_iqdrops, /* rx_dropped + - * rx_missed_errors */ - 0UL, /* rx_fifo_errors */ - 0UL, /* rx_length_errors + - * rx_over_errors + - * rx_crc_errors + - * rx_frame_errors */ - 0UL, /* rx_compressed */ - ifp->if_imcasts); /* multicast, XXX-BZ rx only? */ - sbuf_printf(sb, "%8lu %7lu %4lu %4lu %4lu %5lu %7lu %10lu\n", - ifp->if_obytes, /* tx_bytes */ - ifp->if_opackets, /* tx_packets */ - ifp->if_oerrors, /* tx_errors */ - 0UL, /* tx_dropped */ - 0UL, /* tx_fifo_errors */ - ifp->if_collisions, /* collisions */ - 0UL, /* tx_carrier_errors + - * tx_aborted_errors + - * tx_window_errors + - * tx_heartbeat_errors */ - 0UL); /* tx_compressed */ + sbuf_printf(sb, "%7ju %7ju %4ju %4ju %4lu %5lu %10lu %9ju ", + (uintmax_t )ifp->if_ibytes, /* rx_bytes */ + (uintmax_t )ifp->if_ipackets, /* rx_packets */ + (uintmax_t )ifp->if_ierrors, /* rx_errors */ + (uintmax_t )ifp->if_iqdrops, /* rx_dropped + + * rx_missed_errors */ + 0UL, /* rx_fifo_errors */ + 0UL, /* rx_length_errors + + * rx_over_errors + + * rx_crc_errors + + * rx_frame_errors */ + 0UL, /* rx_compressed */ + (uintmax_t )ifp->if_imcasts); /* multicast, + * XXX-BZ rx only? */ + sbuf_printf(sb, "%8ju %7ju %4ju %4lu %4lu %5ju %7lu %10lu\n", + (uintmax_t )ifp->if_obytes, /* tx_bytes */ + (uintmax_t )ifp->if_opackets, /* tx_packets */ + (uintmax_t )ifp->if_oerrors, /* tx_errors */ + 0UL, /* tx_dropped */ + 0UL, /* tx_fifo_errors */ + (uintmax_t )ifp->if_collisions, /* collisions */ + 0UL, /* tx_carrier_errors + + * tx_aborted_errors + + * tx_window_errors + + * tx_heartbeat_errors*/ + 0UL); /* tx_compressed */ } IFNET_RUNLOCK(); CURVNET_RESTORE(); Modified: head/sys/dev/bxe/bxe.c ============================================================================== --- head/sys/dev/bxe/bxe.c Thu Mar 13 03:42:00 2014 (r263101) +++ head/sys/dev/bxe/bxe.c Thu Mar 13 03:42:24 2014 (r263102) @@ -13321,11 +13321,7 @@ bxe_init_ifnet(struct bxe_softc *sc) #endif ifp->if_capenable = ifp->if_capabilities; ifp->if_capenable &= ~IFCAP_WOL_MAGIC; /* XXX not yet... */ -#if __FreeBSD_version < 1000025 - ifp->if_baudrate = 1000000000; -#else - if_initbaudrate(ifp, IF_Gbps(10)); -#endif + ifp->if_baudrate = IF_Gbps(10); ifp->if_snd.ifq_drv_maxlen = sc->tx_ring_size; IFQ_SET_MAXLEN(&ifp->if_snd, ifp->if_snd.ifq_drv_maxlen); Modified: head/sys/dev/ixgbe/ixgbe.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe.c Thu Mar 13 03:42:00 2014 (r263101) +++ head/sys/dev/ixgbe/ixgbe.c Thu Mar 13 03:42:24 2014 (r263102) @@ -2628,11 +2628,7 @@ ixgbe_setup_interface(device_t dev, stru return (-1); } if_initname(ifp, device_get_name(dev), device_get_unit(dev)); -#if __FreeBSD_version < 1000025 - ifp->if_baudrate = 1000000000; -#else - if_initbaudrate(ifp, IF_Gbps(10)); -#endif + ifp->if_baudrate = IF_Gbps(10); ifp->if_init = ixgbe_init; ifp->if_softc = adapter; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; Modified: head/sys/dev/mxge/if_mxge.c ============================================================================== --- head/sys/dev/mxge/if_mxge.c Thu Mar 13 03:42:00 2014 (r263101) +++ head/sys/dev/mxge/if_mxge.c Thu Mar 13 03:42:24 2014 (r263102) @@ -3140,12 +3140,10 @@ mxge_intr(void *arg) sc->link_state = stats->link_up; if (sc->link_state) { if_link_state_change(sc->ifp, LINK_STATE_UP); - if_initbaudrate(sc->ifp, IF_Gbps(10)); if (mxge_verbose) device_printf(sc->dev, "link up\n"); } else { if_link_state_change(sc->ifp, LINK_STATE_DOWN); - sc->ifp->if_baudrate = 0; if (mxge_verbose) device_printf(sc->dev, "link down\n"); } @@ -4887,7 +4885,7 @@ mxge_attach(device_t dev) goto abort_with_rings; } - if_initbaudrate(ifp, IF_Gbps(10)); + ifp->if_baudrate = IF_Gbps(10); ifp->if_capabilities = IFCAP_RXCSUM | IFCAP_TXCSUM | IFCAP_TSO4 | IFCAP_VLAN_MTU | IFCAP_LINKSTATE | IFCAP_TXCSUM_IPV6 | IFCAP_RXCSUM_IPV6; Modified: head/sys/dev/mxge/if_mxge_var.h ============================================================================== --- head/sys/dev/mxge/if_mxge_var.h Thu Mar 13 03:42:00 2014 (r263101) +++ head/sys/dev/mxge/if_mxge_var.h Thu Mar 13 03:42:24 2014 (r263102) @@ -57,12 +57,8 @@ $FreeBSD$ #define IF_Kbps(x) ((uintmax_t)(x) * 1000) /* kilobits/sec. */ #define IF_Mbps(x) (IF_Kbps((x) * 1000)) /* megabits/sec. */ #define IF_Gbps(x) (IF_Mbps((x) * 1000)) /* gigabits/sec. */ -static __inline void -if_initbaudrate(struct ifnet *ifp, uintmax_t baud) -{ - ifp->if_baudrate = baud; -} #endif + #ifndef VLAN_CAPABILITIES #define VLAN_CAPABILITIES(ifp) #define mxge_vlans_active(sc) (sc)->ifp->if_nvlans Modified: head/sys/dev/oce/oce_if.c ============================================================================== --- head/sys/dev/oce/oce_if.c Thu Mar 13 03:42:00 2014 (r263101) +++ head/sys/dev/oce/oce_if.c Thu Mar 13 03:42:24 2014 (r263102) @@ -1721,7 +1721,7 @@ oce_attach_ifp(POCE_SOFTC sc) #endif sc->ifp->if_capenable = sc->ifp->if_capabilities; - if_initbaudrate(sc->ifp, IF_Gbps(10)); + sc->ifp->if_baudrate = IF_Gbps(10); #if __FreeBSD_version >= 1000000 sc->ifp->if_hw_tsomax = OCE_MAX_TSO_SIZE; Modified: head/sys/dev/qlxgb/qla_os.c ============================================================================== --- head/sys/dev/qlxgb/qla_os.c Thu Mar 13 03:42:00 2014 (r263101) +++ head/sys/dev/qlxgb/qla_os.c Thu Mar 13 03:42:24 2014 (r263102) @@ -669,7 +669,7 @@ qla_init_ifnet(device_t dev, qla_host_t if_initname(ifp, device_get_name(dev), device_get_unit(dev)); - if_initbaudrate(ifp, IF_Gbps(10)); + ifp->if_baudrate = IF_Gbps(10); ifp->if_init = qla_init; ifp->if_softc = ha; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; Modified: head/sys/dev/qlxgbe/ql_os.c ============================================================================== --- head/sys/dev/qlxgbe/ql_os.c Thu Mar 13 03:42:00 2014 (r263101) +++ head/sys/dev/qlxgbe/ql_os.c Thu Mar 13 03:42:24 2014 (r263102) @@ -748,14 +748,8 @@ qla_init_ifnet(device_t dev, qla_host_t if_initname(ifp, device_get_name(dev), device_get_unit(dev)); -#if __FreeBSD_version >= 1000000 - if_initbaudrate(ifp, IF_Gbps(10)); + ifp->if_baudrate = IF_Gbps(10); ifp->if_capabilities = IFCAP_LINKSTATE; -#else - ifp->if_mtu = ETHERMTU; - ifp->if_baudrate = (1 * 1000 * 1000 *1000); - -#endif /* #if __FreeBSD_version >= 1000000 */ ifp->if_init = qla_init; ifp->if_softc = ha; Modified: head/sys/dev/qlxge/qls_os.c ============================================================================== --- head/sys/dev/qlxge/qls_os.c Thu Mar 13 03:42:00 2014 (r263101) +++ head/sys/dev/qlxge/qls_os.c Thu Mar 13 03:42:24 2014 (r263102) @@ -736,13 +736,7 @@ qls_init_ifnet(device_t dev, qla_host_t panic("%s: cannot if_alloc()\n", device_get_nameunit(dev)); if_initname(ifp, device_get_name(dev), device_get_unit(dev)); - -#if __FreeBSD_version >= 1000000 - if_initbaudrate(ifp, IF_Gbps(10)); -#else - ifp->if_baudrate = 1 * 1000 * 1000 * 1000; -#endif /* #if (__FreeBSD_version > 1000000) */ - + ifp->if_baudrate = IF_Gbps(10); ifp->if_init = qls_init; ifp->if_softc = ha; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; Modified: head/sys/dev/sbni/if_sbni.c ============================================================================== --- head/sys/dev/sbni/if_sbni.c Thu Mar 13 03:42:00 2014 (r263101) +++ head/sys/dev/sbni/if_sbni.c Thu Mar 13 03:42:24 2014 (r263102) @@ -250,7 +250,7 @@ sbni_attach(struct sbni_softc *sc, int u ether_ifattach(ifp, sc->enaddr); /* device attach does transition from UNCONFIGURED to IDLE state */ - if_printf(ifp, "speed %ld, rxl ", ifp->if_baudrate); + if_printf(ifp, "speed %ju, rxl ", (uintmax_t)ifp->if_baudrate); if (sc->delta_rxl) printf("auto\n"); else Modified: head/sys/dev/virtio/network/if_vtnet.c ============================================================================== --- head/sys/dev/virtio/network/if_vtnet.c Thu Mar 13 03:42:00 2014 (r263101) +++ head/sys/dev/virtio/network/if_vtnet.c Thu Mar 13 03:42:24 2014 (r263102) @@ -913,7 +913,7 @@ vtnet_setup_interface(struct vtnet_softc } if_initname(ifp, device_get_name(dev), device_get_unit(dev)); - if_initbaudrate(ifp, IF_Gbps(10)); /* Approx. */ + ifp->if_baudrate = IF_Gbps(10); /* Approx. */ ifp->if_softc = sc; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_init = vtnet_init; Modified: head/sys/dev/vmware/vmxnet3/if_vmx.c ============================================================================== --- head/sys/dev/vmware/vmxnet3/if_vmx.c Thu Mar 13 03:42:00 2014 (r263101) +++ head/sys/dev/vmware/vmxnet3/if_vmx.c Thu Mar 13 03:42:24 2014 (r263102) @@ -1471,11 +1471,7 @@ vmxnet3_setup_interface(struct vmxnet3_s } if_initname(ifp, device_get_name(dev), device_get_unit(dev)); -#if __FreeBSD_version < 1000025 - ifp->if_baudrate = 1000000000; -#else - if_initbaudrate(ifp, IF_Gbps(10)); -#endif + ifp->if_baudrate = IF_Gbps(10); ifp->if_softc = sc; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_init = vmxnet3_init; Modified: head/sys/dev/vxge/vxge.c ============================================================================== --- head/sys/dev/vxge/vxge.c Thu Mar 13 03:42:00 2014 (r263101) +++ head/sys/dev/vxge/vxge.c Thu Mar 13 03:42:24 2014 (r263102) @@ -322,7 +322,7 @@ vxge_init_locked(vxge_dev_t *vdev) status = vxge_hal_device_mtu_check(vpath_handle, ifp->if_mtu); if (status != VXGE_HAL_OK) { device_printf(vdev->ndev, - "invalid mtu size %ld specified\n", ifp->if_mtu); + "invalid mtu size %u specified\n", ifp->if_mtu); goto _exit1; } @@ -2908,7 +2908,7 @@ vxge_change_mtu(vxge_dev_t *vdev, unsign goto _exit0; (vdev->ifp)->if_mtu = new_mtu; - device_printf(vdev->ndev, "MTU changed to %ld\n", (vdev->ifp)->if_mtu); + device_printf(vdev->ndev, "MTU changed to %u\n", (vdev->ifp)->if_mtu); if (vdev->is_initialized) { if_down(vdev->ifp); @@ -3241,7 +3241,7 @@ vxge_device_hw_info_print(vxge_dev_t *vd snprintf(vdev->config.nic_attr[VXGE_PRINT_MTU_SIZE], sizeof(vdev->config.nic_attr[VXGE_PRINT_MTU_SIZE]), - "%lu", vdev->ifp->if_mtu); + "%u", vdev->ifp->if_mtu); snprintf(vdev->config.nic_attr[VXGE_PRINT_LRO_MODE], sizeof(vdev->config.nic_attr[VXGE_PRINT_LRO_MODE]), Modified: head/sys/mips/rmi/dev/nlge/if_nlge.c ============================================================================== --- head/sys/mips/rmi/dev/nlge/if_nlge.c Thu Mar 13 03:42:00 2014 (r263101) +++ head/sys/mips/rmi/dev/nlge/if_nlge.c Thu Mar 13 03:42:24 2014 (r263102) @@ -697,7 +697,7 @@ nlge_msgring_handler(int bucket, int siz printf("ERROR: Tx fb error (%d) on port %d\n", tx_error, port); } - atomic_incr_long((tx_error) ? &ifp->if_oerrors: &ifp->if_opackets); + tx_error ? ifp->if_oerrors++ : ifp->if_opackets++; } else if (ctrl == CTRL_SNGL || ctrl == CTRL_START) { /* Rx Packet */ @@ -776,7 +776,7 @@ fail: NLGE_UNLOCK(sc); } m_freem(m); - atomic_incr_long(&ifp->if_iqdrops); + ifp->if_iqdrops++; } return (error); } @@ -825,7 +825,7 @@ nlge_rx(struct nlge_softc *sc, vm_paddr_ m->m_pkthdr.len = m->m_len = len; m->m_pkthdr.rcvif = ifp; - atomic_incr_long(&ifp->if_ipackets); + ifp->if_ipackets++; (*ifp->if_input)(ifp, m); } Modified: head/sys/net/if.h ============================================================================== --- head/sys/net/if.h Thu Mar 13 03:42:00 2014 (r263101) +++ head/sys/net/if.h Thu Mar 13 03:42:24 2014 (r263102) @@ -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 }; /*- Modified: head/sys/net/if_bridge.c ============================================================================== --- head/sys/net/if_bridge.c Thu Mar 13 03:42:00 2014 (r263101) +++ head/sys/net/if_bridge.c Thu Mar 13 03:42:24 2014 (r263102) @@ -817,7 +817,7 @@ bridge_ioctl(struct ifnet *ifp, u_long c BRIDGE_LOCK(sc); LIST_FOREACH(bif, &sc->sc_iflist, bif_next) { if (bif->bif_ifp->if_mtu != ifr->ifr_mtu) { - log(LOG_NOTICE, "%s: invalid MTU: %lu(%s)" + log(LOG_NOTICE, "%s: invalid MTU: %u(%s)" " != %d\n", sc->sc_ifp->if_xname, bif->bif_ifp->if_mtu, bif->bif_ifp->if_xname, ifr->ifr_mtu); @@ -1107,7 +1107,7 @@ bridge_ioctl_add(struct bridge_softc *sc if (LIST_EMPTY(&sc->sc_iflist)) sc->sc_ifp->if_mtu = ifs->if_mtu; else if (sc->sc_ifp->if_mtu != ifs->if_mtu) { - if_printf(sc->sc_ifp, "invalid MTU: %lu(%s) != %lu\n", + if_printf(sc->sc_ifp, "invalid MTU: %u(%s) != %u\n", ifs->if_mtu, ifs->if_xname, sc->sc_ifp->if_mtu); return (EINVAL); } Modified: head/sys/net/if_epair.c ============================================================================== --- head/sys/net/if_epair.c Thu Mar 13 03:42:00 2014 (r263101) +++ head/sys/net/if_epair.c Thu Mar 13 03:42:24 2014 (r263102) @@ -824,7 +824,7 @@ epair_clone_create(struct if_clone *ifc, sca->if_qflush = ifp->if_qflush; ifp->if_qflush = epair_qflush; ifp->if_transmit = epair_transmit; - if_initbaudrate(ifp, IF_Gbps(10)); /* arbitrary maximum */ + ifp->if_baudrate = IF_Gbps(10); /* arbitrary maximum */ /* Swap the name and finish initialization of interface b. */ *dp = 'b'; @@ -850,7 +850,7 @@ epair_clone_create(struct if_clone *ifc, scb->if_qflush = ifp->if_qflush; ifp->if_qflush = epair_qflush; ifp->if_transmit = epair_transmit; - if_initbaudrate(ifp, IF_Gbps(10)); /* arbitrary maximum */ + ifp->if_baudrate = IF_Gbps(10); /* arbitrary maximum */ /* * Restore name to a as the ifp for this will go into the Modified: head/sys/net/if_var.h ============================================================================== --- head/sys/net/if_var.h Thu Mar 13 03:42:00 2014 (r263101) +++ head/sys/net/if_var.h Thu Mar 13 03:42:24 2014 (r263102) @@ -215,7 +215,6 @@ struct ifnet { #define if_metric if_data.ifi_metric #define if_link_state if_data.ifi_link_state #define if_baudrate if_data.ifi_baudrate -#define if_baudrate_pf if_data.ifi_baudrate_pf #define if_hwassist if_data.ifi_hwassist #define if_ipackets if_data.ifi_ipackets #define if_ierrors if_data.ifi_ierrors @@ -326,18 +325,6 @@ EVENTHANDLER_DECLARE(group_change_event, #define IF_AFDATA_WLOCK_ASSERT(ifp) rw_assert(&(ifp)->if_afdata_lock, RA_WLOCKED) #define IF_AFDATA_UNLOCK_ASSERT(ifp) rw_assert(&(ifp)->if_afdata_lock, RA_UNLOCKED) -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; -} - /* * 72 was chosen below because it is the size of a TCP/IP * header (40) + the minimum mss (32). Modified: head/sys/net/rtsock.c ============================================================================== --- head/sys/net/rtsock.c Thu Mar 13 03:42:00 2014 (r263101) +++ head/sys/net/rtsock.c Thu Mar 13 03:42:24 2014 (r263102) @@ -73,34 +73,6 @@ #include #include -struct if_data32 { - uint8_t ifi_type; - uint8_t ifi_physical; - uint8_t ifi_addrlen; - uint8_t ifi_hdrlen; - uint8_t ifi_link_state; - uint8_t ifi_vhid; - uint8_t ifi_baudrate_pf; - uint8_t ifi_datalen; - uint32_t ifi_mtu; - uint32_t ifi_metric; - uint32_t ifi_baudrate; - uint32_t ifi_ipackets; - uint32_t ifi_ierrors; - uint32_t ifi_opackets; - uint32_t ifi_oerrors; - uint32_t ifi_collisions; - uint32_t ifi_ibytes; - uint32_t ifi_obytes; - uint32_t ifi_imcasts; - uint32_t ifi_omcasts; - uint32_t ifi_iqdrops; - uint32_t ifi_noproto; - uint32_t ifi_hwassist; - int32_t ifi_epoch; - struct timeval32 ifi_lastchange; -}; - struct if_msghdr32 { uint16_t ifm_msglen; uint8_t ifm_version; @@ -108,7 +80,7 @@ struct if_msghdr32 { int32_t ifm_addrs; int32_t ifm_flags; uint16_t ifm_index; - struct if_data32 ifm_data; + struct if_data ifm_data; }; struct if_msghdrl32 { @@ -121,7 +93,7 @@ struct if_msghdrl32 { uint16_t _ifm_spare1; uint16_t ifm_len; uint16_t ifm_data_off; - struct if_data32 ifm_data; + struct if_data ifm_data; }; struct ifa_msghdrl32 { @@ -135,7 +107,7 @@ struct ifa_msghdrl32 { uint16_t ifam_len; uint16_t ifam_data_off; int32_t ifam_metric; - struct if_data32 ifam_data; + struct if_data ifam_data; }; #endif /* COMPAT_FREEBSD32 */ @@ -1598,79 +1570,44 @@ sysctl_dumpentry(struct radix_node *rn, return (error); } -#ifdef COMPAT_FREEBSD32 -static void -copy_ifdata32(struct if_data *src, struct if_data32 *dst) -{ - - bzero(dst, sizeof(*dst)); - CP(*src, *dst, ifi_type); - CP(*src, *dst, ifi_physical); - CP(*src, *dst, ifi_addrlen); - CP(*src, *dst, ifi_hdrlen); - CP(*src, *dst, ifi_link_state); - CP(*src, *dst, ifi_vhid); - CP(*src, *dst, ifi_baudrate_pf); - dst->ifi_datalen = sizeof(struct if_data32); - CP(*src, *dst, ifi_mtu); - CP(*src, *dst, ifi_metric); - CP(*src, *dst, ifi_baudrate); - CP(*src, *dst, ifi_ipackets); - CP(*src, *dst, ifi_ierrors); - CP(*src, *dst, ifi_opackets); - CP(*src, *dst, ifi_oerrors); - CP(*src, *dst, ifi_collisions); - CP(*src, *dst, ifi_ibytes); - CP(*src, *dst, ifi_obytes); - CP(*src, *dst, ifi_imcasts); - CP(*src, *dst, ifi_omcasts); - CP(*src, *dst, ifi_iqdrops); - CP(*src, *dst, ifi_noproto); - CP(*src, *dst, ifi_hwassist); - CP(*src, *dst, ifi_epoch); - TV_CP(*src, *dst, ifi_lastchange); -} -#endif - static int sysctl_iflist_ifml(struct ifnet *ifp, struct rt_addrinfo *info, struct walkarg *w, int len) { struct if_msghdrl *ifm; + struct if_data *ifd; + + ifm = (struct if_msghdrl *)w->w_tmem; #ifdef COMPAT_FREEBSD32 if (w->w_req->flags & SCTL_MASK32) { struct if_msghdrl32 *ifm32; - ifm32 = (struct if_msghdrl32 *)w->w_tmem; + ifm32 = (struct if_msghdrl32 *)ifm; ifm32->ifm_addrs = info->rti_addrs; ifm32->ifm_flags = ifp->if_flags | ifp->if_drv_flags; ifm32->ifm_index = ifp->if_index; ifm32->_ifm_spare1 = 0; ifm32->ifm_len = sizeof(*ifm32); ifm32->ifm_data_off = offsetof(struct if_msghdrl32, ifm_data); - - copy_ifdata32(&ifp->if_data, &ifm32->ifm_data); - /* Fixup if_data carp(4) vhid. */ - if (carp_get_vhid_p != NULL) - ifm32->ifm_data.ifi_vhid = - (*carp_get_vhid_p)(ifp->if_addr); - - return (SYSCTL_OUT(w->w_req, (caddr_t)ifm32, len)); - } + ifd = &ifm32->ifm_data; + } else #endif - ifm = (struct if_msghdrl *)w->w_tmem; - ifm->ifm_addrs = info->rti_addrs; - ifm->ifm_flags = ifp->if_flags | ifp->if_drv_flags; - ifm->ifm_index = ifp->if_index; - ifm->_ifm_spare1 = 0; - ifm->ifm_len = sizeof(*ifm); - ifm->ifm_data_off = offsetof(struct if_msghdrl, ifm_data); + { + ifm->ifm_addrs = info->rti_addrs; + ifm->ifm_flags = ifp->if_flags | ifp->if_drv_flags; + ifm->ifm_index = ifp->if_index; + ifm->_ifm_spare1 = 0; + ifm->ifm_len = sizeof(*ifm); + ifm->ifm_data_off = offsetof(struct if_msghdrl, ifm_data); + ifd = &ifm->ifm_data; + } + + *ifd = ifp->if_data; - ifm->ifm_data = ifp->if_data; /* Fixup if_data carp(4) vhid. */ if (carp_get_vhid_p != NULL) - ifm->ifm_data.ifi_vhid = (*carp_get_vhid_p)(ifp->if_addr); + ifd->ifi_vhid = (*carp_get_vhid_p)(ifp->if_addr); return (SYSCTL_OUT(w->w_req, (caddr_t)ifm, len)); } @@ -1680,34 +1617,32 @@ sysctl_iflist_ifm(struct ifnet *ifp, str struct walkarg *w, int len) { struct if_msghdr *ifm; + struct if_data *ifd; + + ifm = (struct if_msghdr *)w->w_tmem; #ifdef COMPAT_FREEBSD32 if (w->w_req->flags & SCTL_MASK32) { struct if_msghdr32 *ifm32; - ifm32 = (struct if_msghdr32 *)w->w_tmem; + ifm32 = (struct if_msghdr32 *)ifm; ifm32->ifm_addrs = info->rti_addrs; ifm32->ifm_flags = ifp->if_flags | ifp->if_drv_flags; ifm32->ifm_index = ifp->if_index; - - copy_ifdata32(&ifp->if_data, &ifm32->ifm_data); - /* Fixup if_data carp(4) vhid. */ - if (carp_get_vhid_p != NULL) - ifm32->ifm_data.ifi_vhid = - (*carp_get_vhid_p)(ifp->if_addr); - - return (SYSCTL_OUT(w->w_req, (caddr_t)ifm32, len)); - } + ifd = &ifm32->ifm_data; + } else #endif - ifm = (struct if_msghdr *)w->w_tmem; - ifm->ifm_addrs = info->rti_addrs; - ifm->ifm_flags = ifp->if_flags | ifp->if_drv_flags; - ifm->ifm_index = ifp->if_index; + { + ifm->ifm_addrs = info->rti_addrs; + ifm->ifm_flags = ifp->if_flags | ifp->if_drv_flags; + ifm->ifm_index = ifp->if_index; + ifd = &ifm->ifm_data; + } - ifm->ifm_data = ifp->if_data; + *ifd = ifp->if_data; /* Fixup if_data carp(4) vhid. */ if (carp_get_vhid_p != NULL) - ifm->ifm_data.ifi_vhid = (*carp_get_vhid_p)(ifp->if_addr); + ifd->ifi_vhid = (*carp_get_vhid_p)(ifp->if_addr); return (SYSCTL_OUT(w->w_req, (caddr_t)ifm, len)); } @@ -1717,12 +1652,15 @@ sysctl_iflist_ifaml(struct ifaddr *ifa, struct walkarg *w, int len) { struct ifa_msghdrl *ifam; + struct if_data *ifd; + + ifam = (struct ifa_msghdrl *)w->w_tmem; #ifdef COMPAT_FREEBSD32 if (w->w_req->flags & SCTL_MASK32) { struct ifa_msghdrl32 *ifam32; - ifam32 = (struct ifa_msghdrl32 *)w->w_tmem; + ifam32 = (struct ifa_msghdrl32 *)ifam; ifam32->ifam_addrs = info->rti_addrs; ifam32->ifam_flags = ifa->ifa_flags; ifam32->ifam_index = ifa->ifa_ifp->if_index; @@ -1731,45 +1669,30 @@ sysctl_iflist_ifaml(struct ifaddr *ifa, ifam32->ifam_data_off = offsetof(struct ifa_msghdrl32, ifam_data); ifam32->ifam_metric = ifa->ifa_metric; - - bzero(&ifam32->ifam_data, sizeof(ifam32->ifam_data)); - ifam32->ifam_data.ifi_datalen = sizeof(struct if_data32); - ifam32->ifam_data.ifi_ipackets = - counter_u64_fetch(ifa->ifa_ipackets); - ifam32->ifam_data.ifi_opackets = - counter_u64_fetch(ifa->ifa_opackets); - ifam32->ifam_data.ifi_ibytes = - counter_u64_fetch(ifa->ifa_ibytes); - ifam32->ifam_data.ifi_obytes = - counter_u64_fetch(ifa->ifa_obytes); - - /* Fixup if_data carp(4) vhid. */ - if (carp_get_vhid_p != NULL) - ifam32->ifam_data.ifi_vhid = (*carp_get_vhid_p)(ifa); - - return (SYSCTL_OUT(w->w_req, (caddr_t)ifam32, len)); - } + ifd = &ifam32->ifam_data; + } else #endif - - ifam = (struct ifa_msghdrl *)w->w_tmem; - ifam->ifam_addrs = info->rti_addrs; - ifam->ifam_flags = ifa->ifa_flags; - ifam->ifam_index = ifa->ifa_ifp->if_index; - ifam->_ifam_spare1 = 0; - ifam->ifam_len = sizeof(*ifam); - ifam->ifam_data_off = offsetof(struct ifa_msghdrl, ifam_data); - ifam->ifam_metric = ifa->ifa_metric; - - bzero(&ifam->ifam_data, sizeof(ifam->ifam_data)); - ifam->ifam_data.ifi_datalen = sizeof(struct if_data); - ifam->ifam_data.ifi_ipackets = counter_u64_fetch(ifa->ifa_ipackets); - ifam->ifam_data.ifi_opackets = counter_u64_fetch(ifa->ifa_opackets); - ifam->ifam_data.ifi_ibytes = counter_u64_fetch(ifa->ifa_ibytes); - ifam->ifam_data.ifi_obytes = counter_u64_fetch(ifa->ifa_obytes); + { + ifam->ifam_addrs = info->rti_addrs; + ifam->ifam_flags = ifa->ifa_flags; + ifam->ifam_index = ifa->ifa_ifp->if_index; + ifam->_ifam_spare1 = 0; + ifam->ifam_len = sizeof(*ifam); + ifam->ifam_data_off = offsetof(struct ifa_msghdrl, ifam_data); + ifam->ifam_metric = ifa->ifa_metric; + ifd = &ifam->ifam_data; + } + + bzero(ifd, sizeof(*ifd)); + ifd->ifi_datalen = sizeof(struct if_data); + ifd->ifi_ipackets = counter_u64_fetch(ifa->ifa_ipackets); + ifd->ifi_opackets = counter_u64_fetch(ifa->ifa_opackets); + ifd->ifi_ibytes = counter_u64_fetch(ifa->ifa_ibytes); + ifd->ifi_obytes = counter_u64_fetch(ifa->ifa_obytes); /* Fixup if_data carp(4) vhid. */ if (carp_get_vhid_p != NULL) - ifam->ifam_data.ifi_vhid = (*carp_get_vhid_p)(ifa); + ifd->ifi_vhid = (*carp_get_vhid_p)(ifa); return (SYSCTL_OUT(w->w_req, w->w_tmem, len)); } Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c ============================================================================== --- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Thu Mar 13 03:42:00 2014 (r263101) +++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Thu Mar 13 03:42:24 2014 (r263102) @@ -876,7 +876,7 @@ ipoib_intf_alloc(const char *name) dev->if_output = ipoib_output; dev->if_input = ipoib_input; dev->if_resolvemulti = ipoib_resolvemulti; - if_initbaudrate(dev, IF_Gbps(10)); + dev->if_baudrate = IF_Gbps(10); dev->if_broadcastaddr = priv->broadcastaddr; dev->if_snd.ifq_maxlen = ipoib_sendq_size * 2; sdl = (struct sockaddr_dl *)dev->if_addr->ifa_addr; Modified: head/sys/ofed/drivers/net/mlx4/en_netdev.c ============================================================================== --- head/sys/ofed/drivers/net/mlx4/en_netdev.c Thu Mar 13 03:42:00 2014 (r263101) +++ head/sys/ofed/drivers/net/mlx4/en_netdev.c Thu Mar 13 03:42:24 2014 (r263102) @@ -328,7 +328,7 @@ static void mlx4_en_set_default_moderati */ priv->rx_frames = MLX4_EN_RX_COAL_TARGET / priv->dev->if_mtu + 1; priv->rx_usecs = MLX4_EN_RX_COAL_TIME; - en_dbg(INTR, priv, "Default coalesing params for mtu:%ld - " + en_dbg(INTR, priv, "Default coalesing params for mtu:%u - " "rx_frames:%d rx_usecs:%d\n", priv->dev->if_mtu, priv->rx_frames, priv->rx_usecs); @@ -972,7 +972,7 @@ static int mlx4_en_change_mtu(struct net struct mlx4_en_dev *mdev = priv->mdev; int err = 0; - en_dbg(DRV, priv, "Change MTU called - current:%ld new:%d\n", + en_dbg(DRV, priv, "Change MTU called - current:%u new:%d\n", dev->if_mtu, new_mtu); if ((new_mtu < MLX4_EN_MIN_MTU) || (new_mtu > priv->max_mtu)) { Modified: head/sys/ofed/include/rdma/ib_addr.h ============================================================================== --- head/sys/ofed/include/rdma/ib_addr.h Thu Mar 13 03:42:00 2014 (r263101) +++ head/sys/ofed/include/rdma/ib_addr.h Thu Mar 13 03:42:24 2014 (r263102) @@ -247,19 +247,13 @@ static inline int iboe_get_rate(struct n #else static inline int iboe_get_rate(struct net_device *dev) { - uintmax_t baudrate; - int exp; - - baudrate = dev->if_baudrate; - for (exp = dev->if_baudrate_pf; exp > 0; exp--) - baudrate *= 10; - if (baudrate >= IF_Gbps(40)) + if (dev->if_baudrate >= IF_Gbps(40)) return IB_RATE_40_GBPS; - else if (baudrate >= IF_Gbps(30)) + else if (dev->if_baudrate >= IF_Gbps(30)) return IB_RATE_30_GBPS; - else if (baudrate >= IF_Gbps(20)) + else if (dev->if_baudrate >= IF_Gbps(20)) return IB_RATE_20_GBPS; - else if (baudrate >= IF_Gbps(10)) + else if (dev->if_baudrate >= IF_Gbps(10)) return IB_RATE_10_GBPS; else return IB_RATE_PORT_CURRENT; Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Thu Mar 13 03:42:00 2014 (r263101) +++ head/sys/sys/param.h Thu Mar 13 03:42:24 2014 (r263102) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1100010 /* Master, propagated to newvers */ +#define __FreeBSD_version 1100011 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, Modified: head/tools/tools/ifinfo/ifinfo.c ============================================================================== --- head/tools/tools/ifinfo/ifinfo.c Thu Mar 13 03:42:00 2014 (r263101) +++ head/tools/tools/ifinfo/ifinfo.c Thu Mar 13 03:42:24 2014 (r263102) @@ -171,8 +171,6 @@ printit(const struct ifmibdata *ifmd, co printf("\theader length: %d\n", ifmd->ifmd_data.ifi_hdrlen); printf("\tlink state: %u\n", ifmd->ifmd_data.ifi_link_state); printf("\tvhid: %u\n", ifmd->ifmd_data.ifi_vhid); - printf("\tbaudrate power factor: %u\n", - ifmd->ifmd_data.ifi_baudrate_pf); printf("\tdatalen: %u\n", ifmd->ifmd_data.ifi_datalen); printf("\tmtu: %lu\n", ifmd->ifmd_data.ifi_mtu); printf("\tmetric: %lu\n", ifmd->ifmd_data.ifi_metric); Modified: head/usr.bin/netstat/if.c ============================================================================== --- head/usr.bin/netstat/if.c Thu Mar 13 03:42:00 2014 (r263101) +++ head/usr.bin/netstat/if.c Thu Mar 13 03:42:24 2014 (r263102) @@ -438,9 +438,11 @@ intpr(int interval, void (*pfunc)(char * printf("%*s %-17.17s", Wflag ? 27 : 25, "", fmt); if (ifma->ifma_addr->sa_family == AF_LINK) { - printf(" %8lu", IFA_STAT(imcasts)); + printf(" %8ju", + (uintmax_t )IFA_STAT(imcasts)); printf("%*s", bflag ? 17 : 6, ""); - printf(" %8lu", IFA_STAT(omcasts)); + printf(" %8ju", + (uintmax_t )IFA_STAT(omcasts)); } putchar('\n'); }