diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c --- a/sys/dev/virtio/network/if_vtnet.c +++ b/sys/dev/virtio/network/if_vtnet.c @@ -113,7 +113,7 @@ static int vtnet_alloc_virtqueues(struct vtnet_softc *); static int vtnet_alloc_interface(struct vtnet_softc *); static int vtnet_setup_interface(struct vtnet_softc *); -static int vtnet_ioctl_mtu(struct vtnet_softc *, int); +static int vtnet_ioctl_mtu(struct vtnet_softc *, u_int); static int vtnet_ioctl_ifflags(struct vtnet_softc *); static int vtnet_ioctl_multi(struct vtnet_softc *); static int vtnet_ioctl_ifcap(struct vtnet_softc *, struct ifreq *); @@ -206,9 +206,9 @@ static int vtnet_ctrl_mac_cmd(struct vtnet_softc *, uint8_t *); static int vtnet_ctrl_guest_offloads(struct vtnet_softc *, uint64_t); static int vtnet_ctrl_mq_cmd(struct vtnet_softc *, uint16_t); -static int vtnet_ctrl_rx_cmd(struct vtnet_softc *, uint8_t, int); -static int vtnet_set_promisc(struct vtnet_softc *, int); -static int vtnet_set_allmulti(struct vtnet_softc *, int); +static int vtnet_ctrl_rx_cmd(struct vtnet_softc *, uint8_t, bool); +static int vtnet_set_promisc(struct vtnet_softc *, bool); +static int vtnet_set_allmulti(struct vtnet_softc *, bool); static void vtnet_rx_filter(struct vtnet_softc *); static void vtnet_rx_filter_mac(struct vtnet_softc *); static int vtnet_exec_vlan_filter(struct vtnet_softc *, int, uint16_t); @@ -373,7 +373,7 @@ VIRTIO_SIMPLE_PNPINFO(vtnet, VIRTIO_ID_NETWORK, "VirtIO Networking Adapter"); static int -vtnet_modevent(module_t mod, int type, void *unused) +vtnet_modevent(module_t mod __unused, int type, void *unused __unused) { int error = 0; static int loaded = 0; @@ -1247,7 +1247,7 @@ } static int -vtnet_ioctl_mtu(struct vtnet_softc *sc, int mtu) +vtnet_ioctl_mtu(struct vtnet_softc *sc, u_int mtu) { struct ifnet *ifp; int clustersz; @@ -1808,7 +1808,7 @@ static int vtnet_rxq_csum_data_valid(struct vtnet_rxq *rxq, struct mbuf *m, - uint16_t etype, int hoff, struct virtio_net_hdr *hdr) + uint16_t etype, int hoff, struct virtio_net_hdr *hdr __unused) { struct vtnet_softc *sc; int protocol; @@ -1928,7 +1928,7 @@ while (--nbufs > 0) { struct mbuf *m; - int len; + uint32_t len; m = virtqueue_dequeue(vq, &len); if (m == NULL) { @@ -2058,7 +2058,7 @@ while (count-- > 0) { struct mbuf *m; - int len, nbufs, adjsz; + uint32_t len, nbufs, adjsz; m = virtqueue_dequeue(vq, &len); if (m == NULL) @@ -2158,7 +2158,7 @@ { struct vtnet_softc *sc; struct ifnet *ifp; - int more; + u_int more; #ifdef DEV_NETMAP int nmirq; #endif /* DEV_NETMAP */ @@ -2232,7 +2232,7 @@ } static void -vtnet_rxq_tq_intr(void *xrxq, int pending) +vtnet_rxq_tq_intr(void *xrxq, int pending __unused) { struct vtnet_rxq *rxq; @@ -2749,7 +2749,7 @@ } static void -vtnet_txq_tq_deferred(void *xtxq, int pending) +vtnet_txq_tq_deferred(void *xtxq, int pending __unused) { struct vtnet_softc *sc; struct vtnet_txq *txq; @@ -2784,7 +2784,7 @@ } static void -vtnet_txq_tq_intr(void *xtxq, int pending) +vtnet_txq_tq_intr(void *xtxq, int pending __unused) { struct vtnet_softc *sc; struct vtnet_txq *txq; @@ -3619,7 +3619,7 @@ } static int -vtnet_ctrl_rx_cmd(struct vtnet_softc *sc, uint8_t cmd, int on) +vtnet_ctrl_rx_cmd(struct vtnet_softc *sc, uint8_t cmd, bool on) { struct sglist_seg segs[3]; struct sglist sg; @@ -3637,7 +3637,7 @@ s.hdr.class = VIRTIO_NET_CTRL_RX; s.hdr.cmd = cmd; - s.onoff = !!on; + s.onoff = on; s.ack = VIRTIO_NET_ERR; sglist_init(&sg, nitems(segs), segs); @@ -3653,13 +3653,13 @@ } static int -vtnet_set_promisc(struct vtnet_softc *sc, int on) +vtnet_set_promisc(struct vtnet_softc *sc, bool on) { return (vtnet_ctrl_rx_cmd(sc, VIRTIO_NET_CTRL_RX_PROMISC, on)); } static int -vtnet_set_allmulti(struct vtnet_softc *sc, int on) +vtnet_set_allmulti(struct vtnet_softc *sc, bool on) { return (vtnet_ctrl_rx_cmd(sc, VIRTIO_NET_CTRL_RX_ALLMULTI, on)); } @@ -3781,9 +3781,9 @@ if_printf(ifp, "error setting host MAC filter table\n"); out: - if (promisc != 0 && vtnet_set_promisc(sc, 1) != 0) + if (promisc != 0 && vtnet_set_promisc(sc, true) != 0) if_printf(ifp, "cannot enable promiscuous mode\n"); - if (allmulti != 0 && vtnet_set_allmulti(sc, 1) != 0) + if (allmulti != 0 && vtnet_set_allmulti(sc, true) != 0) if_printf(ifp, "cannot enable all-multicast mode\n"); } @@ -3912,7 +3912,7 @@ /* BMV: Ignore duplex. */ speed = virtio_read_dev_config_4(sc->vtnet_dev, offsetof(struct virtio_net_config, speed)); - if (speed != -1) + if (speed != UINT32_MAX) ifp->if_baudrate = IF_Mbps(speed); } @@ -3952,7 +3952,7 @@ } static int -vtnet_ifmedia_upd(struct ifnet *ifp) +vtnet_ifmedia_upd(struct ifnet *ifp __unused) { return (EOPNOTSUPP); } diff --git a/sys/dev/virtio/network/if_vtnetvar.h b/sys/dev/virtio/network/if_vtnetvar.h --- a/sys/dev/virtio/network/if_vtnetvar.h +++ b/sys/dev/virtio/network/if_vtnetvar.h @@ -161,7 +161,7 @@ #define VTNET_FLAG_FIXUP_NEEDS_CSUM 0x2000 #define VTNET_FLAG_SW_LRO 0x4000 - int vtnet_hdr_size; + u_int vtnet_hdr_size; int vtnet_rx_nmbufs; int vtnet_rx_clustersz; int vtnet_rx_nsegs; @@ -172,7 +172,7 @@ int vtnet_max_vq_pairs; int vtnet_tx_nsegs; int vtnet_if_flags; - int vtnet_max_mtu; + u_int vtnet_max_mtu; int vtnet_lro_entry_count; int vtnet_lro_mbufq_depth; @@ -189,7 +189,7 @@ struct mtx vtnet_mtx; char vtnet_mtx_name[16]; - char vtnet_hwaddr[ETHER_ADDR_LEN]; + uint8_t vtnet_hwaddr[ETHER_ADDR_LEN]; }; static bool