Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
Show First 20 Lines • Show All 188 Lines • ▼ Show 20 Lines | |||||
* Forward declarations | * Forward declarations | ||||
*/ | */ | ||||
static void hn_stop(hn_softc_t *sc); | static void hn_stop(hn_softc_t *sc); | ||||
static void hn_ifinit_locked(hn_softc_t *sc); | static void hn_ifinit_locked(hn_softc_t *sc); | ||||
static void hn_ifinit(void *xsc); | static void hn_ifinit(void *xsc); | ||||
static int hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data); | static int hn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data); | ||||
static int hn_start_locked(struct ifnet *ifp); | static int hn_start_locked(struct ifnet *ifp); | ||||
static void hn_start(struct ifnet *ifp); | static void hn_start(struct ifnet *ifp); | ||||
static int hn_ifmedia_upd(struct ifnet *ifp); | |||||
static void hn_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr); | |||||
#ifdef HN_LRO_HIWAT | #ifdef HN_LRO_HIWAT | ||||
static int hn_lro_hiwat_sysctl(SYSCTL_HANDLER_ARGS); | static int hn_lro_hiwat_sysctl(SYSCTL_HANDLER_ARGS); | ||||
#endif | #endif | ||||
static int hn_check_iplen(const struct mbuf *, int); | static int hn_check_iplen(const struct mbuf *, int); | ||||
static __inline void | static __inline void | ||||
hn_set_lro_hiwat(struct hn_softc *sc, int hiwat) | hn_set_lro_hiwat(struct hn_softc *sc, int hiwat) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | #endif | ||||
default: | default: | ||||
ret_val = TRANSPORT_TYPE_NOT_IP; | ret_val = TRANSPORT_TYPE_NOT_IP; | ||||
break; | break; | ||||
} | } | ||||
return (ret_val); | return (ret_val); | ||||
} | } | ||||
static int | |||||
hn_ifmedia_upd(struct ifnet *ifp __unused) | |||||
{ | |||||
return EOPNOTSUPP; | |||||
} | |||||
static void | |||||
hn_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr) | |||||
{ | |||||
struct hn_softc *sc = ifp->if_softc; | |||||
ifmr->ifm_status = IFM_AVALID; | |||||
ifmr->ifm_active = IFM_ETHER; | |||||
if (!sc->hn_carrier) { | |||||
ifmr->ifm_active |= IFM_NONE; | |||||
return; | |||||
} | |||||
ifmr->ifm_status |= IFM_ACTIVE; | |||||
/* NOTE: we could use KVP for this later. */ | |||||
ifmr->ifm_active |= IFM_10G_T | IFM_FDX; | |||||
} | |||||
/* | /* | ||||
* NetVsc driver initialization | * NetVsc driver initialization | ||||
* Note: Filter init is no longer required | * Note: Filter init is no longer required | ||||
*/ | */ | ||||
static int | static int | ||||
netvsc_drv_init(void) | netvsc_drv_init(void) | ||||
{ | { | ||||
return (0); | return (0); | ||||
▲ Show 20 Lines • Show All 94 Lines • ▼ Show 20 Lines | netvsc_attach(device_t dev) | ||||
ifp->if_start = hn_start; | ifp->if_start = hn_start; | ||||
ifp->if_init = hn_ifinit; | ifp->if_init = hn_ifinit; | ||||
/* needed by hv_rf_on_device_add() code */ | /* needed by hv_rf_on_device_add() code */ | ||||
ifp->if_mtu = ETHERMTU; | ifp->if_mtu = ETHERMTU; | ||||
IFQ_SET_MAXLEN(&ifp->if_snd, 512); | IFQ_SET_MAXLEN(&ifp->if_snd, 512); | ||||
ifp->if_snd.ifq_drv_maxlen = 511; | ifp->if_snd.ifq_drv_maxlen = 511; | ||||
IFQ_SET_READY(&ifp->if_snd); | IFQ_SET_READY(&ifp->if_snd); | ||||
ifmedia_init(&sc->hn_media, 0, hn_ifmedia_upd, hn_ifmedia_sts); | |||||
/* NOTE: we could use KVP for this later. */ | |||||
ifmedia_add(&sc->hn_media, IFM_ETHER | IFM_AUTO, 0, NULL); | |||||
ifmedia_set(&sc->hn_media, IFM_ETHER | IFM_AUTO); | |||||
/* XXX ifmedia_set really should do this for us */ | |||||
sc->hn_media.ifm_media = sc->hn_media.ifm_cur->ifm_media; | |||||
/* | /* | ||||
* Tell upper layers that we support full VLAN capability. | * Tell upper layers that we support full VLAN capability. | ||||
*/ | */ | ||||
ifp->if_hdrlen = sizeof(struct ether_vlan_header); | ifp->if_hdrlen = sizeof(struct ether_vlan_header); | ||||
ifp->if_capabilities |= | ifp->if_capabilities |= | ||||
IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU | IFCAP_HWCSUM | IFCAP_TSO | | IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU | IFCAP_HWCSUM | IFCAP_TSO | | ||||
IFCAP_LRO; | IFCAP_LRO; | ||||
ifp->if_capenable |= | ifp->if_capenable |= | ||||
▲ Show 20 Lines • Show All 95 Lines • ▼ Show 20 Lines | netvsc_detach(device_t dev) | ||||
/* | /* | ||||
* XXXKYS: Need to stop outgoing traffic and unregister | * XXXKYS: Need to stop outgoing traffic and unregister | ||||
* the netdevice. | * the netdevice. | ||||
*/ | */ | ||||
hv_rf_on_device_remove(hv_device, HV_RF_NV_DESTROY_CHANNEL); | hv_rf_on_device_remove(hv_device, HV_RF_NV_DESTROY_CHANNEL); | ||||
ifmedia_removeall(&sc->hn_media); | |||||
tcp_lro_free(&sc->hn_lro); | tcp_lro_free(&sc->hn_lro); | ||||
return (0); | return (0); | ||||
} | } | ||||
/* | /* | ||||
* Standard shutdown entry point | * Standard shutdown entry point | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 831 Lines • ▼ Show 20 Lines | #ifdef notyet | ||||
/* Fixme: Multicast mode? */ | /* Fixme: Multicast mode? */ | ||||
if (ifp->if_drv_flags & IFF_DRV_RUNNING) { | if (ifp->if_drv_flags & IFF_DRV_RUNNING) { | ||||
NV_LOCK(sc); | NV_LOCK(sc); | ||||
netvsc_setmulti(sc); | netvsc_setmulti(sc); | ||||
NV_UNLOCK(sc); | NV_UNLOCK(sc); | ||||
error = 0; | error = 0; | ||||
} | } | ||||
#endif | #endif | ||||
/* FALLTHROUGH */ | error = EINVAL; | ||||
break; | |||||
case SIOCSIFMEDIA: | case SIOCSIFMEDIA: | ||||
case SIOCGIFMEDIA: | case SIOCGIFMEDIA: | ||||
error = EINVAL; | error = ifmedia_ioctl(ifp, ifr, &sc->hn_media, cmd); | ||||
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 229 Lines • Show Last 20 Lines |