Index: head/sys/dev/hyperv/netvsc/hv_net_vsc.h =================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.h +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h @@ -261,7 +261,7 @@ struct hn_send_ctx; void netvsc_linkstatus_callback(struct hn_softc *sc, uint32_t status); -int hv_nv_on_device_add(struct hn_softc *sc); +int hv_nv_on_device_add(struct hn_softc *sc, int mtu); int hv_nv_on_device_remove(struct hn_softc *sc); int hv_nv_on_send(struct vmbus_channel *chan, uint32_t rndis_mtype, struct hn_send_ctx *sndc, struct vmbus_gpa *gpa, int gpa_cnt); Index: head/sys/dev/hyperv/netvsc/hv_net_vsc.c =================================================================== --- head/sys/dev/hyperv/netvsc/hv_net_vsc.c +++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c @@ -61,7 +61,7 @@ static int hv_nv_init_rx_buffer_with_net_vsp(struct hn_softc *); static int hv_nv_destroy_send_buffer(struct hn_softc *sc); static int hv_nv_destroy_rx_buffer(struct hn_softc *sc); -static int hv_nv_connect_to_vsp(struct hn_softc *sc); +static int hv_nv_connect_to_vsp(struct hn_softc *sc, int mtu); static void hn_nvs_sent_none(struct hn_send_ctx *sndc, struct hn_softc *, struct vmbus_channel *chan, const void *, int); @@ -526,10 +526,9 @@ * Net VSC connect to VSP */ static int -hv_nv_connect_to_vsp(struct hn_softc *sc) +hv_nv_connect_to_vsp(struct hn_softc *sc, int mtu) { int ret = 0; - struct ifnet *ifp = sc->hn_ifp; struct hn_nvs_ndis_init ndis; ret = hn_nvs_init(sc); @@ -541,7 +540,7 @@ * This needs to be right after the NVSP init message per Haiyang */ if (sc->hn_nvs_ver >= HN_NVS_VERSION_2) - ret = hv_nv_send_ndis_config(sc, ifp->if_mtu); + ret = hv_nv_send_ndis_config(sc, mtu); /* * Initialize NDIS. @@ -583,13 +582,13 @@ * Callback when the device belonging to this driver is added */ int -hv_nv_on_device_add(struct hn_softc *sc) +hv_nv_on_device_add(struct hn_softc *sc, int mtu) { /* * Connect with the NetVsp */ - return (hv_nv_connect_to_vsp(sc)); + return (hv_nv_connect_to_vsp(sc, mtu)); } /* Index: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c =================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c @@ -528,7 +528,6 @@ ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = hn_ioctl; ifp->if_init = hn_ifinit; - /* needed by hv_rf_on_device_add() code */ ifp->if_mtu = ETHERMTU; if (hn_use_if_start) { int qdepth = hn_get_txswq_depth(&sc->hn_tx_ring[0]); @@ -565,7 +564,7 @@ if (sc->hn_xact == NULL) goto failed; - error = hv_rf_on_device_add(sc, &device_info, &ring_cnt); + error = hv_rf_on_device_add(sc, &device_info, &ring_cnt, ETHERMTU); if (error) goto failed; KASSERT(ring_cnt > 0 && ring_cnt <= sc->hn_rx_ring_inuse, @@ -1584,7 +1583,8 @@ hn_chan_attach(sc, sc->hn_prichan); /* XXX check error */ ring_cnt = sc->hn_rx_ring_inuse; - error = hv_rf_on_device_add(sc, &device_info, &ring_cnt); + error = hv_rf_on_device_add(sc, &device_info, &ring_cnt, + ifr->ifr_mtu); if (error) { NV_LOCK(sc); sc->temp_unusable = FALSE; Index: head/sys/dev/hyperv/netvsc/hv_rndis_filter.h =================================================================== --- head/sys/dev/hyperv/netvsc/hv_rndis_filter.h +++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.h @@ -43,7 +43,8 @@ void hv_rf_on_receive(struct hn_softc *sc, struct hn_rx_ring *rxr, const void *data, int dlen); void hv_rf_channel_rollup(struct hn_rx_ring *rxr, struct hn_tx_ring *txr); -int hv_rf_on_device_add(struct hn_softc *sc, void *additl_info, int *nchan); +int hv_rf_on_device_add(struct hn_softc *sc, void *additl_info, int *nchan, + int mtu); int hv_rf_on_device_remove(struct hn_softc *sc); int hv_rf_on_open(struct hn_softc *sc); int hv_rf_on_close(struct hn_softc *sc); Index: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c =================================================================== --- head/sys/dev/hyperv/netvsc/hv_rndis_filter.c +++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.c @@ -1012,7 +1012,7 @@ */ int hv_rf_on_device_add(struct hn_softc *sc, void *additl_info, - int *nchan0) + int *nchan0, int mtu) { int ret; netvsc_device_info *dev_info = (netvsc_device_info *)additl_info; @@ -1031,7 +1031,7 @@ * (hv_rf_on_receive()) before this call is completed. * Note: Earlier code used a function pointer here. */ - ret = hv_nv_on_device_add(sc); + ret = hv_nv_on_device_add(sc, mtu); if (ret != 0) return (ret);