FreeBSD Bugzilla – Attachment 183084 Details for
Bug 218894
Network dropouts on em(4) due to jumbo cluster failures
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
a patch for jumbo frame and others
if_em.c-11-stable-JUMBO.diff (text/plain), 7.35 KB, created by
Kaho Toshikazu
on 2017-05-31 05:29:40 UTC
(
hide
)
Description:
a patch for jumbo frame and others
Filename:
MIME Type:
Creator:
Kaho Toshikazu
Created:
2017-05-31 05:29:40 UTC
Size:
7.35 KB
patch
obsolete
>Index: sys/dev/e1000/e1000_82571.c >=================================================================== >--- sys/dev/e1000/e1000_82571.c (revision 319272) >+++ sys/dev/e1000/e1000_82571.c (working copy) >@@ -1239,7 +1239,8 @@ > case e1000_82574: > case e1000_82583: > reg_data = E1000_READ_REG(hw, E1000_GCR); >- reg_data |= E1000_GCR_L1_ACT_WITHOUT_L0S_RX; >+ reg_data |= (E1000_GCR_L1_ACT_WITHOUT_L0S_RX | >+ E1000_GCR_DISABLE_TIMEOUT_MECHANISM); > E1000_WRITE_REG(hw, E1000_GCR, reg_data); > break; > default: >Index: sys/dev/e1000/e1000_82571.h >=================================================================== >--- sys/dev/e1000/e1000_82571.h (revision 319272) >+++ sys/dev/e1000/e1000_82571.h (working copy) >@@ -42,6 +42,7 @@ > (ID_LED_DEF1_DEF2)) > > #define E1000_GCR_L1_ACT_WITHOUT_L0S_RX 0x08000000 >+#define E1000_GCR_DISABLE_TIMEOUT_MECHANISM 0x80000000 > #define AN_RETRY_COUNT 5 /* Autoneg Retry Count value */ > > /* Intr Throttling - RW */ >Index: sys/dev/e1000/e1000_mac.c >=================================================================== >--- sys/dev/e1000/e1000_mac.c (revision 319272) >+++ sys/dev/e1000/e1000_mac.c (working copy) >@@ -1259,7 +1259,8 @@ > * ability to transmit pause frames is not enabled, then these > * registers will be set to 0. > */ >- if (hw->fc.current_mode & e1000_fc_tx_pause) { >+ if (hw->fc.current_mode == e1000_fc_tx_pause || >+ hw->fc.current_mode == e1000_fc_full) { > /* We need to set up the Receive Threshold high and low water > * marks as well as (optionally) enabling the transmission of > * XON frames. >Index: sys/dev/e1000/if_em.c >=================================================================== >--- sys/dev/e1000/if_em.c (revision 319272) >+++ sys/dev/e1000/if_em.c (working copy) >@@ -1421,12 +1421,14 @@ > ** Figure out the desired mbuf > ** pool for doing jumbos > */ >- if (adapter->hw.mac.max_frame_size <= 2048) >+ if (adapter->hw.mac.max_frame_size <= MCLBYTES) > adapter->rx_mbuf_sz = MCLBYTES; >- else if (adapter->hw.mac.max_frame_size <= 4096) >+ else if (adapter->hw.mac.max_frame_size <= MJUMPAGESIZE) > adapter->rx_mbuf_sz = MJUMPAGESIZE; >- else >+ else if (adapter->hw.mac.max_frame_size <= MJUM9BYTES) > adapter->rx_mbuf_sz = MJUM9BYTES; >+ else >+ adapter->rx_mbuf_sz = MJUM16BYTES; > > /* Prepare receive descriptors and buffers */ > if (em_setup_receive_structures(adapter)) { >@@ -3051,12 +3053,9 @@ > case e1000_80003es2lan: > pba = E1000_PBA_32K; /* 32K for Rx, 16K for Tx */ > break; >- case e1000_82573: /* 82573: Total Packet Buffer is 32K */ >- pba = E1000_PBA_12K; /* 12K for Rx, 20K for Tx */ >- break; > case e1000_82574: > case e1000_82583: >- pba = E1000_PBA_20K; /* 20K for Rx, 20K for Tx */ >+ pba = E1000_PBA_26K; /* 26K for Rx, 14K for Tx */ > break; > case e1000_ich8lan: > pba = E1000_PBA_8K; >@@ -3069,11 +3068,32 @@ > else > pba = E1000_PBA_10K; > break; >+ case e1000_82573: /* Total Packet Buffer is 32K */ > case e1000_pchlan: > case e1000_pch2lan: > case e1000_pch_lpt: > case e1000_pch_spt: >- pba = E1000_PBA_26K; >+ /* >+ * Total size (PBS) is 32K. >+ * Small Rx buffer size causes Receiver Overrun Error. >+ * For good Tx performance, Tx buffer should be more than >+ * double size of a frame. >+ * 26K for Rx, 6K for Tx at ETHERMTU frame size. >+ * 18K for Rx, 14K for Tx at 9K Jumbo frame size. >+ */ >+ { >+ u32 pbs=32, min_tx, good_tx; >+ min_tx = if_getmtu(ifp)+ sizeof(struct e1000_tx_desc); >+ good_tx = max(roundup2((min_tx<<1), 2048)>>10, 6); >+ min_tx = max(roundup2(min_tx, 2048)>>10, 6); >+ pba = pbs - good_tx; >+ if(pba < good_tx) { >+ pba = good_tx; >+ } >+ if( (pbs-pba) < min_tx) { >+ pba = pbs - min_tx; >+ } >+ } > break; > default: > if (adapter->hw.mac.max_frame_size > 8192) >@@ -3098,9 +3118,12 @@ > * - The pause time is fairly large at 1000 x 512ns = 512 usec. > */ > rx_buffer_size = ((E1000_READ_REG(hw, E1000_PBA) & 0xffff) << 10 ); >- hw->fc.high_water = rx_buffer_size - >- roundup2(adapter->hw.mac.max_frame_size, 1024); >- hw->fc.low_water = hw->fc.high_water - 1500; >+ /* remain 20% or 2 full sized frames. */ >+ hw->fc.high_water = >+ max(((rx_buffer_size * 8) / 10), >+ (rx_buffer_size - 2 * adapter->hw.mac.max_frame_size)) >+ & 0xFFF0; >+ hw->fc.low_water = hw->fc.high_water - 1024; /* 1k */ > > if (adapter->fc) /* locally set flow control value? */ > hw->fc.requested_mode = adapter->fc; >@@ -3132,23 +3155,13 @@ > case e1000_pch2lan: > case e1000_pch_lpt: > case e1000_pch_spt: >- hw->fc.high_water = 0x5C20; >- hw->fc.low_water = 0x5048; > hw->fc.pause_time = 0x0650; > hw->fc.refresh_time = 0x0400; >- /* Jumbos need adjusted PBA */ >- if (if_getmtu(ifp) > ETHERMTU) >- E1000_WRITE_REG(hw, E1000_PBA, 12); >- else >- E1000_WRITE_REG(hw, E1000_PBA, 26); > break; > case e1000_ich9lan: > case e1000_ich10lan: >- if (if_getmtu(ifp) > ETHERMTU) { >- hw->fc.high_water = 0x2800; > hw->fc.low_water = hw->fc.high_water - 8; > break; >- } > /* else fall thru */ > default: > if (hw->mac.type == e1000_80003es2lan) >@@ -3684,8 +3697,13 @@ > txr->busy = EM_TX_IDLE; > txdctl = 0; /* clear txdctl */ > txdctl |= 0x1f; /* PTHRESH */ >- txdctl |= 1 << 8; /* HTHRESH */ >- txdctl |= 1 << 16;/* WTHRESH */ >+ if (adapter->hw.mac.type == e1000_82574) { >+ txdctl |= 4 << 8; /* HTHRESH */ >+ txdctl |= 4 << 16;/* WTHRESH */ >+ } else { >+ txdctl |= 1 << 8; /* HTHRESH */ >+ txdctl |= 1 << 16;/* WTHRESH */ >+ } > txdctl |= 1 << 22; /* Reserved bit 22 must always be 1 */ > txdctl |= E1000_TXDCTL_GRAN; > txdctl |= 1 << 25; /* LWTHRESH */ >@@ -4717,15 +4735,13 @@ > u32 rxdctl = E1000_READ_REG(hw, E1000_RXDCTL(0)); > E1000_WRITE_REG(hw, E1000_RXDCTL(0), rxdctl | 3); > } else if (adapter->hw.mac.type == e1000_82574) { >- for (int i = 0; i < adapter->num_queues; i++) { >- u32 rxdctl = E1000_READ_REG(hw, E1000_RXDCTL(i)); >+ u32 rxdctl = 0; > > rxdctl |= 0x20; /* PTHRESH */ >- rxdctl |= 4 << 8; /* HTHRESH */ >- rxdctl |= 4 << 16;/* WTHRESH */ >+ rxdctl |= 1 << 8; /* HTHRESH */ >+ rxdctl |= 1 << 16;/* WTHRESH */ > rxdctl |= 1 << 24; /* Switch to granularity */ >- E1000_WRITE_REG(hw, E1000_RXDCTL(i), rxdctl); >- } >+ E1000_WRITE_REG(hw, E1000_RXDCTL(0), rxdctl); > } > > if (adapter->hw.mac.type >= e1000_pch2lan) { >@@ -4738,13 +4754,21 @@ > /* Make sure VLAN Filters are off */ > rctl &= ~E1000_RCTL_VFE; > >- if (adapter->rx_mbuf_sz == MCLBYTES) >+ /* Clear BSIZE bits 17:16, BSEX bit 25 and FLXBUF bits 30:27 */ >+ rctl &= ~0x7A030000; >+ if (adapter->hw.mac.max_frame_size <= 2048) > rctl |= E1000_RCTL_SZ_2048; >- else if (adapter->rx_mbuf_sz == MJUMPAGESIZE) >+ else if (adapter->hw.mac.max_frame_size <= 4096) > rctl |= E1000_RCTL_SZ_4096 | E1000_RCTL_BSEX; >- else if (adapter->rx_mbuf_sz > MJUMPAGESIZE) >+ else if (adapter->hw.mac.max_frame_size <= 8192) > rctl |= E1000_RCTL_SZ_8192 | E1000_RCTL_BSEX; >+ else >+ rctl |= E1000_RCTL_SZ_16384 | E1000_RCTL_BSEX; > >+ /* Use FLXBUF instead of BSIZE */ >+ if (adapter->hw.mac.max_frame_size > 2048) >+ rctl |= roundup2(adapter->hw.mac.max_frame_size, 1024)<<(27-10); >+ > /* ensure we clear use DTYPE of 00 here */ > rctl &= ~0x00000C00; > /* Write out the settings */ >@@ -5093,7 +5117,7 @@ > */ > for (int i = 0; i < EM_VFTA_SIZE; i++) > if (adapter->shadow_vfta[i] != 0) >- E1000_WRITE_REG_ARRAY(hw, E1000_VFTA, >+ e1000_write_vfta(hw, > i, adapter->shadow_vfta[i]); > > reg = E1000_READ_REG(hw, E1000_CTRL);
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 Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 218894
: 183084