Author: sephe
Date: Thu Sep  8 06:42:30 2016
New Revision: 305581
URL: https://svnweb.freebsd.org/changeset/base/305581

Log:
  hyperv/hn: Pass MTU around.
  
  MFC after:    1 week
  Sponsored by: Microsoft
  Differential Revision:        https://reviews.freebsd.org/D7808

Modified:
  head/sys/dev/hyperv/netvsc/hv_net_vsc.c
  head/sys/dev/hyperv/netvsc/hv_net_vsc.h
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
  head/sys/dev/hyperv/netvsc/hv_rndis_filter.c
  head/sys/dev/hyperv/netvsc/hv_rndis_filter.h

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c
==============================================================================
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.c     Thu Sep  8 06:23:08 2016        
(r305580)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c     Thu Sep  8 06:42:30 2016        
(r305581)
@@ -61,7 +61,7 @@ static int  hv_nv_init_send_buffer_with_
 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 @@ hn_nvs_init(struct hn_softc *sc)
  * 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 @@ hv_nv_connect_to_vsp(struct hn_softc *sc
         * 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 @@ hv_nv_disconnect_from_vsp(struct hn_soft
  * 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));
 }
 
 /*

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h
==============================================================================
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.h     Thu Sep  8 06:23:08 2016        
(r305580)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h     Thu Sep  8 06:42:30 2016        
(r305581)
@@ -261,7 +261,7 @@ extern int hv_promisc_mode;
 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);

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==============================================================================
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Thu Sep  8 06:23:08 
2016        (r305580)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Thu Sep  8 06:42:30 
2016        (r305581)
@@ -528,7 +528,6 @@ netvsc_attach(device_t dev)
        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 @@ netvsc_attach(device_t dev)
        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_ioctl(struct ifnet *ifp, u_long cmd, 
                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;

Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c
==============================================================================
--- head/sys/dev/hyperv/netvsc/hv_rndis_filter.c        Thu Sep  8 06:23:08 
2016        (r305580)
+++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.c        Thu Sep  8 06:42:30 
2016        (r305581)
@@ -1012,7 +1012,7 @@ hv_rf_halt_device(struct hn_softc *sc)
  */
 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_device_add(struct hn_softc *sc,
         * (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);
 

Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.h
==============================================================================
--- head/sys/dev/hyperv/netvsc/hv_rndis_filter.h        Thu Sep  8 06:23:08 
2016        (r305580)
+++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.h        Thu Sep  8 06:42:30 
2016        (r305581)
@@ -43,7 +43,8 @@ struct hn_rx_ring;
 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);
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to