Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/netmap/if_ptnet.c
| Show First 20 Lines • Show All 1,458 Lines • ▼ Show 20 Lines | while (count < budget) { | ||||
| if (have_vnet_hdr) { | if (have_vnet_hdr) { | ||||
| struct virtio_net_hdr *vh = | struct virtio_net_hdr *vh = | ||||
| (struct virtio_net_hdr *)nmbuf; | (struct virtio_net_hdr *)nmbuf; | ||||
| /* For performance, we could replace this memset() with | /* For performance, we could replace this memset() with | ||||
| * two 8-bytes-wide writes. */ | * two 8-bytes-wide writes. */ | ||||
| memset(nmbuf, 0, PTNET_HDR_SIZE); | memset(nmbuf, 0, PTNET_HDR_SIZE); | ||||
| if (mhead->m_pkthdr.csum_flags & PTNET_ALL_OFFLOAD) { | if (mhead->m_pkthdr.csum_flags & PTNET_ALL_OFFLOAD) { | ||||
| mhead = virtio_net_tx_offload(ifp, mhead, false, | /* | ||||
| vh); | * Translate the CSUM_* flags in the mbuf to the | ||||
| * corresponding flags in the VirtIO header. | |||||
| * | |||||
| * Always indicate that ECN has not been | |||||
| * negotiated and VirtIO modern mode is not | |||||
| * used because bhyve does not do this. | |||||
| */ | |||||
| virtio_net_tx_offload(ifp, &mhead, vh, false, | |||||
| false); | |||||
| if (unlikely(!mhead)) { | if (unlikely(!mhead)) { | ||||
| /* Packet dropped because errors | /* Packet dropped because errors | ||||
| * occurred while preparing the vnet | * occurred while preparing the vnet | ||||
| * header. Let's go ahead with the next | * header. Let's go ahead with the next | ||||
| * packet. */ | * packet. */ | ||||
| pq->stats.errors ++; | pq->stats.errors ++; | ||||
| drbr_advance(ifp, pq->bufring); | drbr_advance(ifp, pq->bufring); | ||||
| continue; | continue; | ||||
| ▲ Show 20 Lines • Show All 360 Lines • ▼ Show 20 Lines | if (if_getcapenable(ifp) & IFCAP_VLAN_HWTAGGING) { | ||||
| * With the 802.1Q header removed, update the | * With the 802.1Q header removed, update the | ||||
| * checksum starting location accordingly. | * checksum starting location accordingly. | ||||
| */ | */ | ||||
| if (vh->flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) | if (vh->flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) | ||||
| vh->csum_start -= ETHER_VLAN_ENCAP_LEN; | vh->csum_start -= ETHER_VLAN_ENCAP_LEN; | ||||
| } | } | ||||
| } | } | ||||
| if (unlikely(have_vnet_hdr && virtio_net_rx_csum(mhead, vh))) { | /* | ||||
| * Translate the VirtIO header flags to the corresponding | |||||
| * CSUM_* flags in the mbuf. | |||||
| */ | |||||
| if (unlikely(have_vnet_hdr && | |||||
| ((vh->flags & (VIRTIO_NET_HDR_F_NEEDS_CSUM | | |||||
| VIRTIO_NET_HDR_F_DATA_VALID)) != 0) && | |||||
| (virtio_net_rx_csum(mhead, vh) != 0))) { | |||||
| m_freem(mhead); | m_freem(mhead); | ||||
| nm_prlim(1, "Csum offload error: dropping"); | nm_prlim(1, "Csum offload error: dropping"); | ||||
| pq->stats.iqdrops ++; | pq->stats.iqdrops ++; | ||||
| deliver = 0; | deliver = 0; | ||||
| } | } | ||||
| skip: | skip: | ||||
| count ++; | count ++; | ||||
| ▲ Show 20 Lines • Show All 126 Lines • Show Last 20 Lines | |||||