Author: sephe
Date: Thu Jan 14 03:16:29 2016
New Revision: 293875
URL: https://svnweb.freebsd.org/changeset/base/293875

Log:
  hyperv: set receive buffer size according to NVSP protocol version
  
  If the NVSP protocol version is not greater than NVSP_PROTOCOL_VERSION_2,
  then the recv buffer size is 15MB, otherwise the buffer size is 16MB.
  
  Submitted by:         Hongjiang Zhang <honzhan microsoft com>
  Reviewed by:          royger, Dexuan Cui <decui microsoft com>, adrian
  Approved by:          adrian (mentor)
  Sponsored by:         Microsoft OSTC
  Differential Revision:        https://reviews.freebsd.org/D4814

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

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.c
==============================================================================
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.c     Thu Jan 14 03:11:35 2016        
(r293874)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c     Thu Jan 14 03:16:29 2016        
(r293875)
@@ -642,6 +642,12 @@ hv_nv_connect_to_vsp(struct hv_device *d
        /* sema_wait(&NetVscChannel->channel_init_sema); */
 
        /* Post the big receive buffer to NetVSP */
+       if (net_dev->nvsp_version <= NVSP_PROTOCOL_VERSION_2)
+               net_dev->rx_buf_size = NETVSC_RECEIVE_BUFFER_SIZE_LEGACY;
+       else
+               net_dev->rx_buf_size = NETVSC_RECEIVE_BUFFER_SIZE;
+       net_dev->send_buf_size = NETVSC_SEND_BUFFER_SIZE;
+
        ret = hv_nv_init_rx_buffer_with_net_vsp(device);
        if (ret == 0)
                ret = hv_nv_init_send_buffer_with_net_vsp(device);
@@ -676,9 +682,6 @@ hv_nv_on_device_add(struct hv_device *de
                goto cleanup;
 
        /* Initialize the NetVSC channel extension */
-       net_dev->rx_buf_size = NETVSC_RECEIVE_BUFFER_SIZE;
-
-       net_dev->send_buf_size = NETVSC_SEND_BUFFER_SIZE;
 
        sema_init(&net_dev->channel_init_sema, 0, "netdev_sema");
 

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h
==============================================================================
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.h     Thu Jan 14 03:11:35 2016        
(r293874)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h     Thu Jan 14 03:16:29 2016        
(r293875)
@@ -857,7 +857,7 @@ typedef struct nvsp_msg_ {
 #define NETVSC_SEND_BUFFER_SIZE                        (1024*1024*15)   /* 15M 
*/
 #define NETVSC_SEND_BUFFER_ID                  0xface
 
-
+#define NETVSC_RECEIVE_BUFFER_SIZE_LEGACY      (1024*1024*15) /* 15MB */
 #define NETVSC_RECEIVE_BUFFER_SIZE             (1024*1024*16) /* 16MB */
 
 #define NETVSC_RECEIVE_BUFFER_ID               0xcafe
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to