Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/virtio/network/if_vtnet.c
Show First 20 Lines • Show All 195 Lines • ▼ Show 20 Lines | |||||
static void vtnet_free_ctrl_vq(struct vtnet_softc *); | static void vtnet_free_ctrl_vq(struct vtnet_softc *); | ||||
static void vtnet_exec_ctrl_cmd(struct vtnet_softc *, void *, | static void vtnet_exec_ctrl_cmd(struct vtnet_softc *, void *, | ||||
struct sglist *, int, int); | struct sglist *, int, int); | ||||
static int vtnet_ctrl_mac_cmd(struct vtnet_softc *, uint8_t *); | static int vtnet_ctrl_mac_cmd(struct vtnet_softc *, uint8_t *); | ||||
static int vtnet_ctrl_mq_cmd(struct vtnet_softc *, uint16_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_ctrl_rx_cmd(struct vtnet_softc *, uint8_t, int); | ||||
static int vtnet_set_promisc(struct vtnet_softc *, int); | static int vtnet_set_promisc(struct vtnet_softc *, int); | ||||
static int vtnet_set_allmulti(struct vtnet_softc *, int); | static int vtnet_set_allmulti(struct vtnet_softc *, int); | ||||
static void vtnet_attach_disable_promisc(struct vtnet_softc *); | |||||
static void vtnet_rx_filter(struct vtnet_softc *); | static void vtnet_rx_filter(struct vtnet_softc *); | ||||
static void vtnet_rx_filter_mac(struct vtnet_softc *); | static void vtnet_rx_filter_mac(struct vtnet_softc *); | ||||
static int vtnet_exec_vlan_filter(struct vtnet_softc *, int, uint16_t); | static int vtnet_exec_vlan_filter(struct vtnet_softc *, int, uint16_t); | ||||
static void vtnet_rx_filter_vlan(struct vtnet_softc *); | static void vtnet_rx_filter_vlan(struct vtnet_softc *); | ||||
static void vtnet_update_vlan_filter(struct vtnet_softc *, int, uint16_t); | static void vtnet_update_vlan_filter(struct vtnet_softc *, int, uint16_t); | ||||
static void vtnet_register_vlan(void *, struct ifnet *, uint16_t); | static void vtnet_register_vlan(void *, struct ifnet *, uint16_t); | ||||
static void vtnet_unregister_vlan(void *, struct ifnet *, uint16_t); | static void vtnet_unregister_vlan(void *, struct ifnet *, uint16_t); | ||||
▲ Show 20 Lines • Show All 352 Lines • ▼ Show 20 Lines | vtnet_shutdown(device_t dev) | ||||
*/ | */ | ||||
return (vtnet_suspend(dev)); | return (vtnet_suspend(dev)); | ||||
} | } | ||||
static int | static int | ||||
vtnet_attach_completed(device_t dev) | vtnet_attach_completed(device_t dev) | ||||
{ | { | ||||
vtnet_attach_disable_promisc(device_get_softc(dev)); | |||||
return (0); | return (0); | ||||
} | } | ||||
static int | static int | ||||
vtnet_config_change(device_t dev) | vtnet_config_change(device_t dev) | ||||
{ | { | ||||
struct vtnet_softc *sc; | struct vtnet_softc *sc; | ||||
▲ Show 20 Lines • Show All 2,761 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
return (vtnet_ctrl_rx_cmd(sc, VIRTIO_NET_CTRL_RX_PROMISC, on)); | return (vtnet_ctrl_rx_cmd(sc, VIRTIO_NET_CTRL_RX_PROMISC, on)); | ||||
} | } | ||||
static int | static int | ||||
vtnet_set_allmulti(struct vtnet_softc *sc, int on) | vtnet_set_allmulti(struct vtnet_softc *sc, int on) | ||||
{ | { | ||||
return (vtnet_ctrl_rx_cmd(sc, VIRTIO_NET_CTRL_RX_ALLMULTI, on)); | return (vtnet_ctrl_rx_cmd(sc, VIRTIO_NET_CTRL_RX_ALLMULTI, on)); | ||||
} | |||||
/* | |||||
* The device defaults to promiscuous mode for backwards compatibility. | |||||
* Turn it off at attach time if possible. | |||||
*/ | |||||
static void | |||||
vtnet_attach_disable_promisc(struct vtnet_softc *sc) | |||||
{ | |||||
struct ifnet *ifp; | |||||
ifp = sc->vtnet_ifp; | |||||
VTNET_CORE_LOCK(sc); | |||||
if ((sc->vtnet_flags & VTNET_FLAG_CTRL_RX) == 0) { | |||||
ifp->if_flags |= IFF_PROMISC; | |||||
} else if (vtnet_set_promisc(sc, 0) != 0) { | |||||
ifp->if_flags |= IFF_PROMISC; | |||||
device_printf(sc->vtnet_dev, | |||||
"cannot disable default promiscuous mode\n"); | |||||
} | |||||
VTNET_CORE_UNLOCK(sc); | |||||
} | } | ||||
static void | static void | ||||
vtnet_rx_filter(struct vtnet_softc *sc) | vtnet_rx_filter(struct vtnet_softc *sc) | ||||
{ | { | ||||
device_t dev; | device_t dev; | ||||
struct ifnet *ifp; | struct ifnet *ifp; | ||||
▲ Show 20 Lines • Show All 760 Lines • Show Last 20 Lines |