Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/virtio/network/if_vtnet.c
Show First 20 Lines • Show All 1,021 Lines • ▼ Show 20 Lines | #endif | ||||
ifmedia_init(&sc->vtnet_media, 0, vtnet_ifmedia_upd, vtnet_ifmedia_sts); | ifmedia_init(&sc->vtnet_media, 0, vtnet_ifmedia_upd, vtnet_ifmedia_sts); | ||||
ifmedia_add(&sc->vtnet_media, IFM_ETHER | IFM_AUTO, 0, NULL); | ifmedia_add(&sc->vtnet_media, IFM_ETHER | IFM_AUTO, 0, NULL); | ||||
ifmedia_set(&sc->vtnet_media, IFM_ETHER | IFM_AUTO); | ifmedia_set(&sc->vtnet_media, IFM_ETHER | IFM_AUTO); | ||||
vtnet_get_macaddr(sc); | vtnet_get_macaddr(sc); | ||||
ether_ifattach(ifp, sc->vtnet_hwaddr); | ether_ifattach(ifp, sc->vtnet_hwaddr); | ||||
if (virtio_with_feature(dev, VIRTIO_NET_F_STATUS)) | |||||
ifp->if_capabilities |= IFCAP_LINKSTATE; | |||||
/* Tell the upper layer(s) we support long frames. */ | /* Tell the upper layer(s) we support long frames. */ | ||||
ifp->if_hdrlen = sizeof(struct ether_vlan_header); | ifp->if_hdrlen = sizeof(struct ether_vlan_header); | ||||
ifp->if_capabilities |= IFCAP_JUMBO_MTU | IFCAP_VLAN_MTU; | |||||
if (virtio_with_feature(dev, VIRTIO_NET_F_STATUS)) | |||||
ifp->if_capabilities |= IFCAP_LINKSTATE; | |||||
if (virtio_with_feature(dev, VIRTIO_NET_F_CSUM)) { | if (virtio_with_feature(dev, VIRTIO_NET_F_CSUM)) { | ||||
int gso; | int gso; | ||||
ifp->if_capabilities |= IFCAP_TXCSUM | IFCAP_TXCSUM_IPV6; | ifp->if_capabilities |= IFCAP_TXCSUM | IFCAP_TXCSUM_IPV6; | ||||
gso = virtio_with_feature(dev, VIRTIO_NET_F_GSO); | gso = virtio_with_feature(dev, VIRTIO_NET_F_GSO); | ||||
if (gso || virtio_with_feature(dev, VIRTIO_NET_F_HOST_TSO4)) | if (gso || virtio_with_feature(dev, VIRTIO_NET_F_HOST_TSO4)) | ||||
ifp->if_capabilities |= IFCAP_TSO4; | ifp->if_capabilities |= IFCAP_TSO4; | ||||
Show All 24 Lines | if (ifp->if_capabilities & IFCAP_HWCSUM) { | ||||
* VirtIO does not support VLAN tagging, but we can fake | * VirtIO does not support VLAN tagging, but we can fake | ||||
* it by inserting and removing the 802.1Q header during | * it by inserting and removing the 802.1Q header during | ||||
* transmit and receive. We are then able to do checksum | * transmit and receive. We are then able to do checksum | ||||
* offloading of VLAN frames. | * offloading of VLAN frames. | ||||
*/ | */ | ||||
ifp->if_capabilities |= | ifp->if_capabilities |= | ||||
IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_HWCSUM; | IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_HWCSUM; | ||||
} | } | ||||
if (sc->vtnet_max_mtu >= ETHERMTU_JUMBO) | |||||
ifp->if_capabilities |= IFCAP_JUMBO_MTU; | |||||
ifp->if_capabilities |= IFCAP_VLAN_MTU; | |||||
ifp->if_capenable = ifp->if_capabilities; | ifp->if_capenable = ifp->if_capabilities; | ||||
/* | /* | ||||
* Capabilities after here are not enabled by default. | * Capabilities after here are not enabled by default. | ||||
*/ | */ | ||||
if (sc->vtnet_flags & VTNET_FLAG_VLAN_FILTER) { | if (sc->vtnet_flags & VTNET_FLAG_VLAN_FILTER) { | ||||
ifp->if_capabilities |= IFCAP_VLAN_HWFILTER; | ifp->if_capabilities |= IFCAP_VLAN_HWFILTER; | ||||
▲ Show 20 Lines • Show All 3,043 Lines • Show Last 20 Lines |