Date: Mon, 11 Jan 2016 02:13:07 +0100 From: Michael Tuexen <tuexen@freebsd.org> To: Eric Joyner <erj@freebsd.org>, Sean Bruno <sbruno@freebsd.org> Cc: freebsd-transport@freebsd.org Subject: Patch for igb driver to support Message-ID: <546AAC80-FC4B-4280-BA5A-78E9A6131117@freebsd.org>
next in thread | raw e-mail | index | archive | help
--Apple-Mail=_FAF7D5DC-010B-4F9E-8E25-EFEDC758CDC5
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=us-ascii
Hi Eric, hi Sean,
in ig_igb.c the support for checksum offloading for SCTP, TCP and UDP over
IPv6 is missing. The attached patch fixes it.
The code is #ifdef'ed similar to the code in ixgbe/if_ix.c.
Comments? OK to commit?
Best regards
Michael
--Apple-Mail=_FAF7D5DC-010B-4F9E-8E25-EFEDC758CDC5
Content-Disposition: attachment;
filename=if_igb.patch
Content-Type: application/octet-stream;
name="if_igb.patch"
Content-Transfer-Encoding: 7bit
Index: if_igb.c
===================================================================
--- if_igb.c (revision 293608)
+++ if_igb.c (working copy)
@@ -1184,10 +1184,27 @@
}
}
#endif
+#if __FreeBSD_version >= 1000000
+ /* HW cannot turn these on/off separately */
+ if (mask & (IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6)) {
+ ifp->if_capenable ^= IFCAP_RXCSUM;
+ ifp->if_capenable ^= IFCAP_RXCSUM_IPV6;
+ reinit = 1;
+ }
+ if (mask & IFCAP_TXCSUM) {
+ ifp->if_capenable ^= IFCAP_TXCSUM;
+ reinit = 1;
+ }
+ if (mask & IFCAP_TXCSUM_IPV6) {
+ ifp->if_capenable ^= IFCAP_TXCSUM_IPV6;
+ reinit = 1;
+ }
+#else
if (mask & IFCAP_HWCSUM) {
ifp->if_capenable ^= IFCAP_HWCSUM;
reinit = 1;
}
+#endif
if (mask & IFCAP_TSO4) {
ifp->if_capenable ^= IFCAP_TSO4;
reinit = 1;
@@ -1274,6 +1291,14 @@
#endif
}
+#if __FreeBSD_version >= 1000000
+ if (ifp->if_capenable & IFCAP_TXCSUM_IPV6) {
+ ifp->if_hwassist |= (CSUM_TCP_IPV6 | CSUM_UDP_IPV6);
+ if ((adapter->hw.mac.type == e1000_82576) ||
+ (adapter->hw.mac.type == e1000_82580))
+ ifp->if_hwassist |= CSUM_SCTP_IPV6;
+ }
+#endif
if (ifp->if_capenable & IFCAP_TSO)
ifp->if_hwassist |= CSUM_TSO;
@@ -3151,6 +3176,9 @@
ifp->if_capabilities = ifp->if_capenable = 0;
ifp->if_capabilities = IFCAP_HWCSUM | IFCAP_VLAN_HWCSUM;
+#if __FreeBSD_version >= 1000000
+ ifp->if_capabilities |= IFCAP_HWCSUM_IPV6;
+#endif
ifp->if_capabilities |= IFCAP_TSO;
ifp->if_capabilities |= IFCAP_JUMBO_MTU;
ifp->if_capenable = ifp->if_capabilities;
@@ -3924,17 +3952,29 @@
switch (ipproto) {
case IPPROTO_TCP:
+#if __FreeBSD_version >= 1000000
+ if (mp->m_pkthdr.csum_flags & (CSUM_TCP | CSUM_TCP_IPV6))
+#else
if (mp->m_pkthdr.csum_flags & CSUM_TCP)
+#endif
type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_L4T_TCP;
break;
case IPPROTO_UDP:
+#if __FreeBSD_version >= 1000000
+ if (mp->m_pkthdr.csum_flags & (CSUM_UDP | CSUM_UDP_IPV6))
+#else
if (mp->m_pkthdr.csum_flags & CSUM_UDP)
+#endif
type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_L4T_UDP;
break;
#if __FreeBSD_version >= 800000
case IPPROTO_SCTP:
+#if __FreeBSD_version >= 1000000
+ if (mp->m_pkthdr.csum_flags & (CSUM_SCTP | CSUM_SCTP_IPV6))
+#else
if (mp->m_pkthdr.csum_flags & CSUM_SCTP)
+#endif
type_tucmd_mlhl |= E1000_ADVTXD_TUCMD_L4T_SCTP;
break;
#endif
Index: if_igb.h
===================================================================
--- if_igb.h (revision 293608)
+++ if_igb.h (working copy)
@@ -291,7 +291,11 @@
#define ETH_ADDR_LEN 6
/* Offload bits in mbuf flag */
-#if __FreeBSD_version >= 800000
+#if __FreeBSD_version >= 1000000
+#define CSUM_OFFLOAD_IPV4 (CSUM_IP|CSUM_TCP|CSUM_UDP|CSUM_SCTP)
+#define CSUM_OFFLOAD_IPV6 (CSUM_TCP_IPV6|CSUM_UDP_IPV6|CSUM_SCTP_IPV6)
+#define CSUM_OFFLOAD (CSUM_OFFLOAD_IPV4|CSUM_OFFLOAD_IPV6)
+#elif __FreeBSD_version >= 800000
#define CSUM_OFFLOAD (CSUM_IP|CSUM_TCP|CSUM_UDP|CSUM_SCTP)
#else
#define CSUM_OFFLOAD (CSUM_IP|CSUM_TCP|CSUM_UDP)
--Apple-Mail=_FAF7D5DC-010B-4F9E-8E25-EFEDC758CDC5--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?546AAC80-FC4B-4280-BA5A-78E9A6131117>
