Page MenuHomeFreeBSD

D4853.diff
No OneTemporary

D4853.diff

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
@@ -1011,6 +1011,7 @@
u_long hn_csum_tcp;
u_long hn_csum_trusted;
u_long hn_lro_tried;
+ u_long hn_small_pkts;
} hn_softc_t;
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
@@ -469,6 +469,8 @@
SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "csum_trusted",
CTLFLAG_RW, &sc->hn_csum_trusted,
"# of TCP segements that we trust host's csum verification");
+ SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "small_pkts",
+ CTLFLAG_RW, &sc->hn_small_pkts, "# of small packets received");
if (unit == 0) {
struct sysctl_ctx_list *dc_ctx;
@@ -1022,35 +1024,38 @@
*/
if (packet->tot_data_buf_len > (ifp->if_mtu + ETHER_HDR_LEN)) {
return (0);
- }
-
- /*
- * Get an mbuf with a cluster. For packets 2K or less,
- * get a standard 2K cluster. For anything larger, get a
- * 4K cluster. Any buffers larger than 4K can cause problems
- * if looped around to the Hyper-V TX channel, so avoid them.
- */
- size = MCLBYTES;
-
- if (packet->tot_data_buf_len > MCLBYTES) {
- /* 4096 */
- size = MJUMPAGESIZE;
- }
+ } else if (packet->tot_data_buf_len <= MHLEN) {
+ m_new = m_gethdr(M_NOWAIT, MT_DATA);
+ if (m_new == NULL)
+ return (0);
+ memcpy(mtod(m_new, void *), packet->data,
+ packet->tot_data_buf_len);
+ m_new->m_pkthdr.len = m_new->m_len = packet->tot_data_buf_len;
+ sc->hn_small_pkts++;
+ } else {
+ /*
+ * Get an mbuf with a cluster. For packets 2K or less,
+ * get a standard 2K cluster. For anything larger, get a
+ * 4K cluster. Any buffers larger than 4K can cause problems
+ * if looped around to the Hyper-V TX channel, so avoid them.
+ */
+ size = MCLBYTES;
+ if (packet->tot_data_buf_len > MCLBYTES) {
+ /* 4096 */
+ size = MJUMPAGESIZE;
+ }
- m_new = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, size);
+ m_new = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, size);
+ if (m_new == NULL) {
+ device_printf(dev, "alloc mbuf failed.\n");
+ return (0);
+ }
- if (m_new == NULL) {
- device_printf(dev, "alloc mbuf failed.\n");
- return (0);
+ hv_m_append(m_new, packet->tot_data_buf_len, packet->data);
}
-
- hv_m_append(m_new, packet->tot_data_buf_len,
- packet->data);
-
m_new->m_pkthdr.rcvif = ifp;
/* receive side checksum offload */
- m_new->m_pkthdr.csum_flags = 0;
if (NULL != csum_info) {
/* IP csum offload */
if (csum_info->receive.ip_csum_succeeded) {

File Metadata

Mime Type
text/plain
Expires
Fri, Oct 2, 5:17 PM (2 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
40091507
Default Alt Text
D4853.diff (2 KB)

Event Timeline