Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/hyperv/netvsc/if_hn.c
Show First 20 Lines • Show All 1,260 Lines • ▼ Show 20 Lines | hn_xpnt_vf_input(struct ifnet *vf_ifp, struct mbuf *m) | ||||
* XXX racy, if hn(4) ever detached. | * XXX racy, if hn(4) ever detached. | ||||
*/ | */ | ||||
rm_rlock(&hn_vfmap_lock, &pt); | rm_rlock(&hn_vfmap_lock, &pt); | ||||
if (vf_ifp->if_index < hn_vfmap_size) | if (vf_ifp->if_index < hn_vfmap_size) | ||||
hn_ifp = hn_vfmap[vf_ifp->if_index]; | hn_ifp = hn_vfmap[vf_ifp->if_index]; | ||||
rm_runlock(&hn_vfmap_lock, &pt); | rm_runlock(&hn_vfmap_lock, &pt); | ||||
if (hn_ifp != NULL) { | if (hn_ifp != NULL) { | ||||
for (mn = m; mn != NULL; mn = mn->m_nextpkt) { | |||||
/* | /* | ||||
* Fix up rcvif and go through hn(4)'s if_input and | * Allow tapping on the VF. | ||||
* increase ipackets. | |||||
*/ | */ | ||||
for (mn = m; mn != NULL; mn = mn->m_nextpkt) { | |||||
/* Allow tapping on the VF. */ | |||||
ETHER_BPF_MTAP(vf_ifp, mn); | ETHER_BPF_MTAP(vf_ifp, mn); | ||||
/* | |||||
* Update VF stats. | |||||
*/ | |||||
if ((vf_ifp->if_capenable & IFCAP_HWSTATS) == 0) { | |||||
if_inc_counter(vf_ifp, IFCOUNTER_IBYTES, | |||||
mn->m_pkthdr.len); | |||||
} | |||||
/* | |||||
* XXX IFCOUNTER_IMCAST | |||||
* This stat updating is kinda invasive, since it | |||||
* requires two checks on the mbuf: the length check | |||||
* and the ethernet header check. As of this write, | |||||
* all multicast packets go directly to hn(4), which | |||||
* makes imcast stat updating in the VF a try in vian. | |||||
*/ | |||||
/* | |||||
* Fix up rcvif and increase hn(4)'s ipackets. | |||||
*/ | |||||
mn->m_pkthdr.rcvif = hn_ifp; | mn->m_pkthdr.rcvif = hn_ifp; | ||||
if_inc_counter(hn_ifp, IFCOUNTER_IPACKETS, 1); | if_inc_counter(hn_ifp, IFCOUNTER_IPACKETS, 1); | ||||
} | } | ||||
/* | |||||
* Go through hn(4)'s if_input. | |||||
*/ | |||||
hn_ifp->if_input(hn_ifp, m); | hn_ifp->if_input(hn_ifp, m); | ||||
} else { | } else { | ||||
/* | /* | ||||
* In the middle of the transition; free this | * In the middle of the transition; free this | ||||
* mbuf chain. | * mbuf chain. | ||||
*/ | */ | ||||
while (m != NULL) { | while (m != NULL) { | ||||
mn = m->m_nextpkt; | mn = m->m_nextpkt; | ||||
▲ Show 20 Lines • Show All 5,612 Lines • Show Last 20 Lines |