Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/hyperv/netvsc/if_hn.c
Show First 20 Lines • Show All 3,310 Lines • ▼ Show 20 Lines | |||||
static int | static int | ||||
hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) | hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) | ||||
{ | { | ||||
struct hn_softc *sc = ifp->if_softc; | struct hn_softc *sc = ifp->if_softc; | ||||
struct ifreq *ifr = (struct ifreq *)data, ifr_vf; | struct ifreq *ifr = (struct ifreq *)data, ifr_vf; | ||||
struct ifnet *vf_ifp; | struct ifnet *vf_ifp; | ||||
int mask, error = 0; | int mask, error = 0; | ||||
struct ifrsskey *ifrk; | |||||
struct ifrsshash *ifrh; | |||||
switch (cmd) { | switch (cmd) { | ||||
case SIOCSIFMTU: | case SIOCSIFMTU: | ||||
if (ifr->ifr_mtu > HN_MTU_MAX) { | if (ifr->ifr_mtu > HN_MTU_MAX) { | ||||
error = EINVAL; | error = EINVAL; | ||||
break; | break; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 239 Lines • ▼ Show 20 Lines | if (hn_xpnt_vf_isready(sc)) { | ||||
/* Restore the ifr_name. */ | /* Restore the ifr_name. */ | ||||
strlcpy(ifr->ifr_name, ifp->if_xname, | strlcpy(ifr->ifr_name, ifp->if_xname, | ||||
sizeof(ifr->ifr_name)); | sizeof(ifr->ifr_name)); | ||||
HN_UNLOCK(sc); | HN_UNLOCK(sc); | ||||
break; | break; | ||||
} | } | ||||
HN_UNLOCK(sc); | HN_UNLOCK(sc); | ||||
error = ifmedia_ioctl(ifp, ifr, &sc->hn_media, cmd); | error = ifmedia_ioctl(ifp, ifr, &sc->hn_media, cmd); | ||||
break; | |||||
case SIOCGIFRSSHASH: | |||||
ifrh = (struct ifrsshash *)data; | |||||
HN_LOCK(sc); | |||||
if (sc->hn_rx_ring_inuse == 1) { | |||||
HN_UNLOCK(sc); | |||||
ifrh->ifrh_func = RSS_FUNC_NONE; | |||||
ifrh->ifrh_types = 0; | |||||
break; | |||||
} | |||||
if (sc->hn_rss_hash & NDIS_HASH_FUNCTION_TOEPLITZ) | |||||
ifrh->ifrh_func = RSS_FUNC_TOEPLITZ; | |||||
else | |||||
ifrh->ifrh_func = RSS_FUNC_PRIVATE; | |||||
ifrh->ifrh_types = 0; | |||||
if (sc->hn_rss_hash & NDIS_HASH_IPV4) | |||||
ifrh->ifrh_types |= RSS_TYPE_IPV4; | |||||
if (sc->hn_rss_hash & NDIS_HASH_TCP_IPV4) | |||||
ifrh->ifrh_types |= RSS_TYPE_TCP_IPV4; | |||||
if (sc->hn_rss_hash & NDIS_HASH_IPV6) | |||||
ifrh->ifrh_types |= RSS_TYPE_IPV6; | |||||
if (sc->hn_rss_hash & NDIS_HASH_IPV6_EX) | |||||
ifrh->ifrh_types |= RSS_TYPE_IPV6_EX; | |||||
if (sc->hn_rss_hash & NDIS_HASH_TCP_IPV6) | |||||
ifrh->ifrh_types |= RSS_TYPE_TCP_IPV6; | |||||
if (sc->hn_rss_hash & NDIS_HASH_TCP_IPV6_EX) | |||||
ifrh->ifrh_types |= RSS_TYPE_TCP_IPV6_EX; | |||||
HN_UNLOCK(sc); | |||||
break; | |||||
case SIOCGIFRSSKEY: | |||||
ifrk = (struct ifrsskey *)data; | |||||
HN_LOCK(sc); | |||||
if (sc->hn_rx_ring_inuse == 1) { | |||||
HN_UNLOCK(sc); | |||||
ifrk->ifrk_func = RSS_FUNC_NONE; | |||||
ifrk->ifrk_keylen = 0; | |||||
break; | |||||
} | |||||
if (sc->hn_rss_hash & NDIS_HASH_FUNCTION_TOEPLITZ) | |||||
ifrk->ifrk_func = RSS_FUNC_TOEPLITZ; | |||||
else | |||||
ifrk->ifrk_func = RSS_FUNC_PRIVATE; | |||||
ifrk->ifrk_keylen = NDIS_HASH_KEYSIZE_TOEPLITZ; | |||||
memcpy(ifrk->ifrk_key, sc->hn_rss.rss_key, | |||||
NDIS_HASH_KEYSIZE_TOEPLITZ); | |||||
HN_UNLOCK(sc); | |||||
break; | break; | ||||
default: | default: | ||||
error = ether_ioctl(ifp, cmd, data); | error = ether_ioctl(ifp, cmd, data); | ||||
break; | break; | ||||
} | } | ||||
return (error); | return (error); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 3,426 Lines • Show Last 20 Lines |