Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/hyperv/netvsc/if_hn.c
Show First 20 Lines • Show All 2,123 Lines • ▼ Show 20 Lines | |||||
hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, | hn_rxpkt(struct hn_rx_ring *rxr, const void *data, int dlen, | ||||
const struct hn_rxinfo *info) | const struct hn_rxinfo *info) | ||||
{ | { | ||||
struct ifnet *ifp = rxr->hn_ifp; | struct ifnet *ifp = rxr->hn_ifp; | ||||
struct mbuf *m_new; | struct mbuf *m_new; | ||||
int size, do_lro = 0, do_csum = 1; | int size, do_lro = 0, do_csum = 1; | ||||
int hash_type; | int hash_type; | ||||
if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) | if (dlen <= MHLEN) { | ||||
return (0); | |||||
/* | |||||
* Bail out if packet contains more data than configured MTU. | |||||
*/ | |||||
if (dlen > (ifp->if_mtu + ETHER_HDR_LEN)) { | |||||
return (0); | |||||
} else if (dlen <= MHLEN) { | |||||
m_new = m_gethdr(M_NOWAIT, MT_DATA); | m_new = m_gethdr(M_NOWAIT, MT_DATA); | ||||
if (m_new == NULL) { | if (m_new == NULL) { | ||||
if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1); | if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1); | ||||
return (0); | return (0); | ||||
} | } | ||||
memcpy(mtod(m_new, void *), data, dlen); | memcpy(mtod(m_new, void *), data, dlen); | ||||
m_new->m_pkthdr.len = m_new->m_len = dlen; | m_new->m_pkthdr.len = m_new->m_len = dlen; | ||||
rxr->hn_small_pkts++; | rxr->hn_small_pkts++; | ||||
▲ Show 20 Lines • Show All 3,428 Lines • Show Last 20 Lines |