FreeBSD Bugzilla – Attachment 160662 Details for
Bug 200221
em0 watchdog timeout under load
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
svn di svn://svn0.eu.freebsd.org/base/stable/10/sys/dev/e1000 sys/dev/e1000
10-stable-287407-to-e1000-diff.txt (text/plain), 9.64 KB, created by
Anthony Williams
on 2015-09-02 19:14:11 UTC
(
hide
)
Description:
svn di svn://svn0.eu.freebsd.org/base/stable/10/sys/dev/e1000 sys/dev/e1000
Filename:
MIME Type:
Creator:
Anthony Williams
Created:
2015-09-02 19:14:11 UTC
Size:
9.64 KB
patch
obsolete
>Index: sys/dev/e1000/if_em.c >=================================================================== >--- sys/dev/e1000/if_em.c (svn://svn0.eu.freebsd.org/base/stable/10/sys/dev/e1000) (revision 287407) >+++ sys/dev/e1000/if_em.c (.../sys/dev/e1000) (working copy) >@@ -359,6 +359,8 @@ > #define CSUM_TSO 0 > #endif > >+#define TSO_WORKAROUND 4 >+ > static SYSCTL_NODE(_hw, OID_AUTO, em, CTLFLAG_RD, 0, "EM driver parameters"); > > static int em_tx_int_delay_dflt = EM_TICKS_TO_USECS(EM_TIDV); >@@ -1879,14 +1881,15 @@ > struct ether_header *eh; > struct ip *ip = NULL; > struct tcphdr *tp = NULL; >- u32 txd_upper, txd_lower, txd_used, txd_saved; >+ u32 txd_upper = 0, txd_lower = 0; > int ip_off, poff; > int nsegs, i, j, first, last = 0; >- int error, do_tso, tso_desc = 0, remap = 1; >+ int error; >+ bool do_tso, tso_desc, remap = TRUE; > > m_head = *m_headp; >- txd_upper = txd_lower = txd_used = txd_saved = 0; >- do_tso = ((m_head->m_pkthdr.csum_flags & CSUM_TSO) != 0); >+ do_tso = (m_head->m_pkthdr.csum_flags & CSUM_TSO); >+ tso_desc = FALSE; > ip_off = poff = 0; > > /* >@@ -1922,32 +1925,42 @@ > * for IPv6 yet. > */ > ip_off = sizeof(struct ether_header); >- m_head = m_pullup(m_head, ip_off); >- if (m_head == NULL) { >- *m_headp = NULL; >- return (ENOBUFS); >+ if (m_head->m_len < ip_off) { >+ m_head = m_pullup(m_head, ip_off); >+ if (m_head == NULL) { >+ *m_headp = NULL; >+ return (ENOBUFS); >+ } > } > eh = mtod(m_head, struct ether_header *); > if (eh->ether_type == htons(ETHERTYPE_VLAN)) { > ip_off = sizeof(struct ether_vlan_header); >- m_head = m_pullup(m_head, ip_off); >+ if (m_head->m_len < ip_off) { >+ m_head = m_pullup(m_head, ip_off); >+ if (m_head == NULL) { >+ *m_headp = NULL; >+ return (ENOBUFS); >+ } >+ } >+ } >+ if (m_head->m_len < ip_off + sizeof(struct ip)) { >+ m_head = m_pullup(m_head, ip_off + sizeof(struct ip)); > if (m_head == NULL) { > *m_headp = NULL; > return (ENOBUFS); > } > } >- m_head = m_pullup(m_head, ip_off + sizeof(struct ip)); >- if (m_head == NULL) { >- *m_headp = NULL; >- return (ENOBUFS); >- } > ip = (struct ip *)(mtod(m_head, char *) + ip_off); > poff = ip_off + (ip->ip_hl << 2); >- if (do_tso) { >- m_head = m_pullup(m_head, poff + sizeof(struct tcphdr)); >- if (m_head == NULL) { >- *m_headp = NULL; >- return (ENOBUFS); >+ >+ if (do_tso || (m_head->m_pkthdr.csum_flags & CSUM_TCP)) { >+ if (m_head->m_len < poff + sizeof(struct tcphdr)) { >+ m_head = m_pullup(m_head, poff + >+ sizeof(struct tcphdr)); >+ if (m_head == NULL) { >+ *m_headp = NULL; >+ return (ENOBUFS); >+ } > } > tp = (struct tcphdr *)(mtod(m_head, char *) + poff); > /* >@@ -1954,42 +1967,40 @@ > * TSO workaround: > * pull 4 more bytes of data into it. > */ >- m_head = m_pullup(m_head, poff + (tp->th_off << 2) + 4); >- if (m_head == NULL) { >- *m_headp = NULL; >- return (ENOBUFS); >+ if (m_head->m_len < poff + (tp->th_off << 2)) { >+ m_head = m_pullup(m_head, poff + >+ (tp->th_off << 2) + >+ TSO_WORKAROUND); >+ if (m_head == NULL) { >+ *m_headp = NULL; >+ return (ENOBUFS); >+ } > } > ip = (struct ip *)(mtod(m_head, char *) + ip_off); >- ip->ip_len = 0; >- ip->ip_sum = 0; >- /* >- * The pseudo TCP checksum does not include TCP payload >- * length so driver should recompute the checksum here >- * what hardware expect to see. This is adherence of >- * Microsoft's Large Send specification. >- */ > tp = (struct tcphdr *)(mtod(m_head, char *) + poff); >- tp->th_sum = in_pseudo(ip->ip_src.s_addr, >- ip->ip_dst.s_addr, htons(IPPROTO_TCP)); >- } else if (m_head->m_pkthdr.csum_flags & CSUM_TCP) { >- m_head = m_pullup(m_head, poff + sizeof(struct tcphdr)); >- if (m_head == NULL) { >- *m_headp = NULL; >- return (ENOBUFS); >+ if (do_tso) { >+ ip->ip_len = htons(m_head->m_pkthdr.tso_segsz + >+ (ip->ip_hl << 2) + >+ (tp->th_off << 2)); >+ ip->ip_sum = 0; >+ /* >+ * The pseudo TCP checksum does not include TCP >+ * payload length so driver should recompute >+ * the checksum here what hardware expect to >+ * see. This is adherence of Microsoft's Large >+ * Send specification. >+ */ >+ tp->th_sum = in_pseudo(ip->ip_src.s_addr, >+ ip->ip_dst.s_addr, htons(IPPROTO_TCP)); > } >- tp = (struct tcphdr *)(mtod(m_head, char *) + poff); >- m_head = m_pullup(m_head, poff + (tp->th_off << 2)); >- if (m_head == NULL) { >- *m_headp = NULL; >- return (ENOBUFS); >- } >- ip = (struct ip *)(mtod(m_head, char *) + ip_off); >- tp = (struct tcphdr *)(mtod(m_head, char *) + poff); > } else if (m_head->m_pkthdr.csum_flags & CSUM_UDP) { >- m_head = m_pullup(m_head, poff + sizeof(struct udphdr)); >- if (m_head == NULL) { >- *m_headp = NULL; >- return (ENOBUFS); >+ if (m_head->m_len < poff + sizeof(struct udphdr)) { >+ m_head = m_pullup(m_head, poff + >+ sizeof(struct udphdr)); >+ if (m_head == NULL) { >+ *m_headp = NULL; >+ return (ENOBUFS); >+ } > } > ip = (struct ip *)(mtod(m_head, char *) + ip_off); > } >@@ -2035,7 +2046,7 @@ > *m_headp = m; > > /* Try it again, but only once */ >- remap = 0; >+ remap = FALSE; > goto retry; > } else if (error == ENOMEM) { > adapter->no_tx_dma_setup++; >@@ -2053,13 +2064,13 @@ > * it follows a TSO burst, then we need to add a > * sentinel descriptor to prevent premature writeback. > */ >- if ((do_tso == 0) && (txr->tx_tso == TRUE)) { >+ if ((!do_tso) && (txr->tx_tso == TRUE)) { > if (nsegs == 1) > tso_desc = TRUE; > txr->tx_tso = FALSE; > } > >- if (nsegs > (txr->tx_avail - 2)) { >+ if (nsegs > (txr->tx_avail - EM_MAX_SCATTER)) { > txr->no_desc_avail++; > bus_dmamap_unload(txr->txtag, map); > return (ENOBUFS); >@@ -2100,23 +2111,23 @@ > ** If this is the last descriptor, we want to > ** split it so we have a small final sentinel > */ >- if (tso_desc && (j == (nsegs -1)) && (seg_len > 8)) { >- seg_len -= 4; >+ if (tso_desc && (j == (nsegs - 1)) && (seg_len > 8)) { >+ seg_len -= TSO_WORKAROUND; > ctxd->buffer_addr = htole64(seg_addr); > ctxd->lower.data = htole32( >- adapter->txd_cmd | txd_lower | seg_len); >- ctxd->upper.data = >- htole32(txd_upper); >+ adapter->txd_cmd | txd_lower | seg_len); >+ ctxd->upper.data = htole32(txd_upper); > if (++i == adapter->num_tx_desc) > i = 0; >+ > /* Now make the sentinel */ >- ++txd_used; /* using an extra txd */ >+ txr->tx_avail--; > ctxd = &txr->tx_base[i]; > tx_buffer = &txr->tx_buffers[i]; > ctxd->buffer_addr = > htole64(seg_addr + seg_len); > ctxd->lower.data = htole32( >- adapter->txd_cmd | txd_lower | 4); >+ adapter->txd_cmd | txd_lower | TSO_WORKAROUND); > ctxd->upper.data = > htole32(txd_upper); > last = i; >@@ -2126,8 +2137,7 @@ > ctxd->buffer_addr = htole64(seg_addr); > ctxd->lower.data = htole32( > adapter->txd_cmd | txd_lower | seg_len); >- ctxd->upper.data = >- htole32(txd_upper); >+ ctxd->upper.data = htole32(txd_upper); > last = i; > if (++i == adapter->num_tx_desc) > i = 0; >@@ -2138,8 +2148,6 @@ > > txr->next_avail_desc = i; > txr->tx_avail -= nsegs; >- if (tso_desc) /* TSO used an extra for sentinel */ >- txr->tx_avail -= txd_used; > > tx_buffer->m_head = m_head; > /* >@@ -3078,6 +3086,9 @@ > ifp->if_softc = adapter; > ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; > ifp->if_ioctl = em_ioctl; >+ ifp->if_hw_tsomax = EM_TSO_SIZE; >+ ifp->if_hw_tsomaxsegcount = EM_MAX_SCATTER; >+ ifp->if_hw_tsomaxsegsize = EM_TSO_SEG_SIZE; > #ifdef EM_MULTIQUEUE > /* Multiqueue stack interface */ > ifp->if_transmit = em_mq_start; >@@ -4933,8 +4944,8 @@ > u32 ims_mask = IMS_ENABLE_MASK; > > if (hw->mac.type == e1000_82574) { >- E1000_WRITE_REG(hw, EM_EIAC, EM_MSIX_MASK); >- ims_mask |= EM_MSIX_MASK; >+ E1000_WRITE_REG(hw, EM_EIAC, adapter->ims); >+ ims_mask |= adapter->ims; > } > E1000_WRITE_REG(hw, E1000_IMS, ims_mask); > } >Index: sys/dev/e1000/if_em.h >=================================================================== >--- sys/dev/e1000/if_em.h (svn://svn0.eu.freebsd.org/base/stable/10/sys/dev/e1000) (revision 287407) >+++ sys/dev/e1000/if_em.h (.../sys/dev/e1000) (working copy) >@@ -266,7 +266,7 @@ > #define HW_DEBUGOUT1(S, A) if (DEBUG_HW) printf(S "\n", A) > #define HW_DEBUGOUT2(S, A, B) if (DEBUG_HW) printf(S "\n", A, B) > >-#define EM_MAX_SCATTER 32 >+#define EM_MAX_SCATTER 64 > #define EM_VFTA_SIZE 128 > #define EM_TSO_SIZE (65535 + sizeof(struct ether_vlan_header)) > #define EM_TSO_SEG_SIZE 4096 /* Max dma segment size */ >Index: sys/dev/e1000 >=================================================================== >--- sys/dev/e1000 (svn://svn0.eu.freebsd.org/base/stable/10/sys/dev/e1000) (revision 287407) >+++ sys/dev/e1000 (.../sys/dev/e1000) (working copy) > >Property changes on: sys/dev/e1000 >___________________________________________________________________ >Added: svn:mergeinfo > Merged /head/sys/dev/e1000:r256695,256715,257036,257302,258582,259117-259118,259417,266177,266225,266248,266267,266494,266857,267636,269023,269054,270234,270780-270783,270836,271145,271351,271410-271411,271424,271467-271468,271545,271610,271628,271663,271747,271759,271761,271909,271924,271946,271965,272072,272086,272130,272173,272198,272217,272224,272263,272270,272296,272305,272308,272323-272324,272326,272347,272349,272358,272385,272393,272398,272404,272408,272414,272416,272422,272469,272474,272479-272480,272503,272505,272523,272537,272567,272569,272574,272579,272595,272668,272706,272713,272750-272751,272762,272830,272833,272841,272885,272907,273060,273093,273096,273143-273144,273146,273158,273168,273178,273204,273218-273219,273235,273356,273402,273577,273653,273666,273704,273834,273985,274095,274205,274218,274228,274376 > Merged /stable/10/sys/dev/e1000:r272460-287407
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 200221
:
156796
|
156797
| 160662