[Midnightbsd-cvs] src [12134] trunk/sys/dev/e1000: - Or in the DMA coalescing Rx threshold so the other bits set in E1000_DMACR
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Tue Jan 15 19:29:15 EST 2019
Revision: 12134
http://svnweb.midnightbsd.org/src/?rev=12134
Author: laffer1
Date: 2019-01-15 19:29:15 -0500 (Tue, 15 Jan 2019)
Log Message:
-----------
- Or in the DMA coalescing Rx threshold so the other bits set in E1000_DMACR
remain intact as intended in igb_init_dmac(). [1]
- Fix igb corrupting checksums with BPF and VLAN
Modified Paths:
--------------
trunk/sys/dev/e1000/if_em.c
trunk/sys/dev/e1000/if_igb.c
trunk/sys/dev/e1000/if_lem.h
Modified: trunk/sys/dev/e1000/if_em.c
===================================================================
--- trunk/sys/dev/e1000/if_em.c 2019-01-16 00:27:25 UTC (rev 12133)
+++ trunk/sys/dev/e1000/if_em.c 2019-01-16 00:29:15 UTC (rev 12134)
@@ -1436,10 +1436,15 @@
*/
if (adapter->hw.mac.max_frame_size <= 2048)
adapter->rx_mbuf_sz = MCLBYTES;
+#ifndef CONTIGMALLOC_WORKS
+ else
+ adapter->rx_mbuf_sz = MJUMPAGESIZE;
+#else
else if (adapter->hw.mac.max_frame_size <= 4096)
adapter->rx_mbuf_sz = MJUMPAGESIZE;
else
adapter->rx_mbuf_sz = MJUM9BYTES;
+#endif
/* Prepare receive descriptors and buffers */
if (em_setup_receive_structures(adapter)) {
Modified: trunk/sys/dev/e1000/if_igb.c
===================================================================
--- trunk/sys/dev/e1000/if_igb.c 2019-01-16 00:27:25 UTC (rev 12133)
+++ trunk/sys/dev/e1000/if_igb.c 2019-01-16 00:29:15 UTC (rev 12134)
@@ -1310,10 +1310,15 @@
*/
if (adapter->max_frame_size <= 2048)
adapter->rx_mbuf_sz = MCLBYTES;
+#ifndef CONTIGMALLOC_WORKS
+ else
+ adapter->rx_mbuf_sz = MJUMPAGESIZE;
+#else
else if (adapter->max_frame_size <= 4096)
adapter->rx_mbuf_sz = MJUMPAGESIZE;
else
adapter->rx_mbuf_sz = MJUM9BYTES;
+#endif
/* Prepare receive descriptors and buffers */
if (igb_setup_receive_structures(adapter)) {
@@ -2858,7 +2863,7 @@
dmac = pba - 10;
reg = E1000_READ_REG(hw, E1000_DMACR);
reg &= ~E1000_DMACR_DMACTHR_MASK;
- reg = ((dmac << E1000_DMACR_DMACTHR_SHIFT)
+ reg |= ((dmac << E1000_DMACR_DMACTHR_SHIFT)
& E1000_DMACR_DMACTHR_MASK);
/* transition to L0x or L1 if available..*/
@@ -3808,7 +3813,6 @@
int ehdrlen, ip_hlen = 0;
u16 etype;
u8 ipproto = 0;
- int offload = TRUE;
int ctxd = txr->next_avail_desc;
u16 vtag = 0;
@@ -3816,9 +3820,6 @@
if (mp->m_pkthdr.csum_flags & CSUM_TSO)
return (igb_tso_setup(txr, mp, cmd_type_len, olinfo_status));
- if ((mp->m_pkthdr.csum_flags & CSUM_OFFLOAD) == 0)
- offload = FALSE;
-
/* Indicate the whole packet as payload when not doing TSO */
*olinfo_status |= mp->m_pkthdr.len << E1000_ADVTXD_PAYLEN_SHIFT;
@@ -3833,8 +3834,9 @@
if (mp->m_flags & M_VLANTAG) {
vtag = htole16(mp->m_pkthdr.ether_vtag);
vlan_macip_lens |= (vtag << E1000_ADVTXD_VLAN_SHIFT);
- } else if (offload == FALSE) /* ... no offload to do */
+ } else if ((mp->m_pkthdr.csum_flags & CSUM_OFFLOAD) == 0) {
return (0);
+ }
/*
* Determine where frame payload starts.
@@ -3868,7 +3870,6 @@
type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_IPV6;
break;
default:
- offload = FALSE;
break;
}
@@ -3878,39 +3879,41 @@
switch (ipproto) {
case IPPROTO_TCP:
#if __FreeBSD_version >= 1000000
- if (mp->m_pkthdr.csum_flags & (CSUM_IP_TCP | CSUM_IP6_TCP))
+ if (mp->m_pkthdr.csum_flags & (CSUM_IP_TCP | CSUM_IP6_TCP)) {
#else
- if (mp->m_pkthdr.csum_flags & CSUM_TCP)
+ if (mp->m_pkthdr.csum_flags & CSUM_TCP) {
#endif
type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_L4T_TCP;
+ *olinfo_status |= E1000_TXD_POPTS_TXSM << 8;
+ }
break;
case IPPROTO_UDP:
#if __FreeBSD_version >= 1000000
- if (mp->m_pkthdr.csum_flags & (CSUM_IP_UDP | CSUM_IP6_UDP))
+ if (mp->m_pkthdr.csum_flags & (CSUM_IP_UDP | CSUM_IP6_UDP)) {
#else
- if (mp->m_pkthdr.csum_flags & CSUM_UDP)
+ if (mp->m_pkthdr.csum_flags & CSUM_UDP) {
#endif
type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_L4T_UDP;
+ *olinfo_status |= E1000_TXD_POPTS_TXSM << 8;
+ }
break;
#if __FreeBSD_version >= 800000
case IPPROTO_SCTP:
#if __FreeBSD_version >= 1000000
- if (mp->m_pkthdr.csum_flags & (CSUM_IP_SCTP | CSUM_IP6_SCTP))
+ if (mp->m_pkthdr.csum_flags & (CSUM_IP_SCTP | CSUM_IP6_SCTP)) {
#else
- if (mp->m_pkthdr.csum_flags & CSUM_SCTP)
+ if (mp->m_pkthdr.csum_flags & CSUM_SCTP) {
#endif
type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_L4T_SCTP;
+ *olinfo_status |= E1000_TXD_POPTS_TXSM << 8;
+ }
break;
#endif
default:
- offload = FALSE;
break;
}
- if (offload) /* For the TX descriptor setup */
- *olinfo_status |= E1000_TXD_POPTS_TXSM << 8;
-
/* 82575 needs the queue index added */
if (adapter->hw.mac.type == e1000_82575)
mss_l4len_idx = txr->me << 4;
Modified: trunk/sys/dev/e1000/if_lem.h
===================================================================
--- trunk/sys/dev/e1000/if_lem.h 2019-01-16 00:27:25 UTC (rev 12133)
+++ trunk/sys/dev/e1000/if_lem.h 2019-01-16 00:29:15 UTC (rev 12134)
@@ -242,7 +242,7 @@
#define EM_MSIX_MASK 0x01F00000 /* For 82574 use */
#define ETH_ZLEN 60
#define ETH_ADDR_LEN 6
-#define CSUM_OFFLOAD 7 /* Offload bits in mbuf flag */
+#define CSUM_OFFLOAD (CSUM_IP | CSUM_IP_UDP | CSUM_IP_TCP) /* Offload bits in mbuf flag */
/*
* 82574 has a nonstandard address for EIAC
More information about the Midnightbsd-cvs
mailing list