sepherosa_gmail.com created this revision.
sepherosa_gmail.com added reviewers: network, adrian, delphij, royger, 
decui_microsoft.com, honzhan_microsoft.com, howard0su_gmail.com.
sepherosa_gmail.com added a subscriber: freebsd-net-list.

REVISION SUMMARY
  hn(4) only has one RX ring, so default 8 LRO entries are too small.

REVISION DETAIL
  https://reviews.freebsd.org/D5166

AFFECTED FILES
  sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c

CHANGE DETAILS
  diff --git a/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c 
b/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
  --- a/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
  +++ b/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
  @@ -132,6 +132,8 @@
   /* YYY should get it from the underlying channel */
   #define HN_TX_DESC_CNT                       512
   
  +#define HN_LROENT_CNT_DEF            128
  +
   #define HN_RNDIS_MSG_LEN             \
       (sizeof(rndis_msg) +             \
        RNDIS_VLAN_PPI_SIZE +           \
  @@ -232,6 +234,13 @@
   static int hn_direct_tx_size = HN_DIRECT_TX_SIZE_DEF;
   TUNABLE_INT("dev.hn.direct_tx_size", &hn_direct_tx_size);
   
  +#if defined(INET) || defined(INET6)
  +#if __FreeBSD_version >= 1100095
  +static int hn_lro_entry_count = HN_LROENT_CNT_DEF;
  +TUNABLE_INT("dev.hn.lro_entry_count", &hn_lro_entry_count);
  +#endif
  +#endif
  +
   /*
    * Forward declarations
    */
  @@ -335,6 +344,11 @@
   #if __FreeBSD_version >= 1100045
        int tso_maxlen;
   #endif
  +#if defined(INET) || defined(INET6)
  +#if __FreeBSD_version >= 1100095
  +     int lroent_cnt;
  +#endif
  +#endif
   
        sc = device_get_softc(dev);
        if (sc == NULL) {
  @@ -417,9 +431,17 @@
        }
   
   #if defined(INET) || defined(INET6)
  +#if __FreeBSD_version >= 1100095
  +     lroent_cnt = hn_lro_entry_count;
  +     if (lroent_cnt < TCP_LRO_ENTRIES)
  +             lroent_cnt = TCP_LRO_ENTRIES;
  +     tcp_lro_init_args(&sc->hn_lro, ifp, lroent_cnt, 0);
  +     device_printf(dev, "LRO: entry count %d\n", lroent_cnt);
  +#else
        tcp_lro_init(&sc->hn_lro);
        /* Driver private LRO settings */
        sc->hn_lro.ifp = ifp;
  +#endif
   #ifdef HN_LRO_HIWAT
        sc->hn_lro.lro_hiwat = sc->hn_lro_hiwat;
   #endif
  @@ -547,6 +569,12 @@
                SYSCTL_ADD_INT(dc_ctx, dc_child, OID_AUTO, "direct_tx_size",
                    CTLFLAG_RD, &hn_direct_tx_size, 0,
                    "Size of the packet for direct transmission");
  +#if defined(INET) || defined(INET6)
  +#if __FreeBSD_version >= 1100095
  +             SYSCTL_ADD_INT(dc_ctx, dc_child, OID_AUTO, "lro_entry_count",
  +                 CTLFLAG_RD, &hn_lro_entry_count, 0, "LRO entry count");
  +#endif
  +#endif
        }
   
        return (0);

EMAIL PREFERENCES
  https://reviews.freebsd.org/settings/panel/emailpreferences/

To: sepherosa_gmail.com, network, adrian, delphij, royger, decui_microsoft.com, 
honzhan_microsoft.com, howard0su_gmail.com
Cc: freebsd-net-list
diff --git a/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c b/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
--- a/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
+++ b/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
@@ -132,6 +132,8 @@
 /* YYY should get it from the underlying channel */
 #define HN_TX_DESC_CNT			512
 
+#define HN_LROENT_CNT_DEF		128
+
 #define HN_RNDIS_MSG_LEN		\
     (sizeof(rndis_msg) +		\
      RNDIS_VLAN_PPI_SIZE +		\
@@ -232,6 +234,13 @@
 static int hn_direct_tx_size = HN_DIRECT_TX_SIZE_DEF;
 TUNABLE_INT("dev.hn.direct_tx_size", &hn_direct_tx_size);
 
+#if defined(INET) || defined(INET6)
+#if __FreeBSD_version >= 1100095
+static int hn_lro_entry_count = HN_LROENT_CNT_DEF;
+TUNABLE_INT("dev.hn.lro_entry_count", &hn_lro_entry_count);
+#endif
+#endif
+
 /*
  * Forward declarations
  */
@@ -335,6 +344,11 @@
 #if __FreeBSD_version >= 1100045
 	int tso_maxlen;
 #endif
+#if defined(INET) || defined(INET6)
+#if __FreeBSD_version >= 1100095
+	int lroent_cnt;
+#endif
+#endif
 
 	sc = device_get_softc(dev);
 	if (sc == NULL) {
@@ -417,9 +431,17 @@
 	}
 
 #if defined(INET) || defined(INET6)
+#if __FreeBSD_version >= 1100095
+	lroent_cnt = hn_lro_entry_count;
+	if (lroent_cnt < TCP_LRO_ENTRIES)
+		lroent_cnt = TCP_LRO_ENTRIES;
+	tcp_lro_init_args(&sc->hn_lro, ifp, lroent_cnt, 0);
+	device_printf(dev, "LRO: entry count %d\n", lroent_cnt);
+#else
 	tcp_lro_init(&sc->hn_lro);
 	/* Driver private LRO settings */
 	sc->hn_lro.ifp = ifp;
+#endif
 #ifdef HN_LRO_HIWAT
 	sc->hn_lro.lro_hiwat = sc->hn_lro_hiwat;
 #endif
@@ -547,6 +569,12 @@
 		SYSCTL_ADD_INT(dc_ctx, dc_child, OID_AUTO, "direct_tx_size",
 		    CTLFLAG_RD, &hn_direct_tx_size, 0,
 		    "Size of the packet for direct transmission");
+#if defined(INET) || defined(INET6)
+#if __FreeBSD_version >= 1100095
+		SYSCTL_ADD_INT(dc_ctx, dc_child, OID_AUTO, "lro_entry_count",
+		    CTLFLAG_RD, &hn_lro_entry_count, 0, "LRO entry count");
+#endif
+#endif
 	}
 
 	return (0);

_______________________________________________
freebsd-net@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to "freebsd-net-unsubscr...@freebsd.org"

Reply via email to