aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorAndrew Rybchenko <arybchik@FreeBSD.org>2015-05-18 06:04:20 +0000
committerAndrew Rybchenko <arybchik@FreeBSD.org>2015-05-18 06:04:20 +0000
commit921f3bd2df78c5a33ee4a6cbf7cbb8d46da5799b (patch)
treecfed6948f2f6525be375ab6590798b9b66bba8f9 /sys
parent4cefd52431a242c17dac3f7d9b22a20ad1569456 (diff)
downloadsrc-921f3bd2df78c5a33ee4a6cbf7cbb8d46da5799b.tar.gz
src-921f3bd2df78c5a33ee4a6cbf7cbb8d46da5799b.zip
Notes
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/sfxge/sfxge.c39
1 files changed, 34 insertions, 5 deletions
diff --git a/sys/dev/sfxge/sfxge.c b/sys/dev/sfxge/sfxge.c
index ff2e728986be..12a121003480 100644
--- a/sys/dev/sfxge/sfxge.c
+++ b/sys/dev/sfxge/sfxge.c
@@ -60,8 +60,9 @@ __FBSDID("$FreeBSD$");
#include "sfxge_version.h"
#define SFXGE_CAP (IFCAP_VLAN_MTU | IFCAP_VLAN_HWCSUM | \
- IFCAP_RXCSUM | IFCAP_TXCSUM | IFCAP_TSO | \
+ IFCAP_RXCSUM | IFCAP_TXCSUM | \
IFCAP_RXCSUM_IPV6 | IFCAP_TXCSUM_IPV6 | \
+ IFCAP_TSO4 | IFCAP_TSO6 | \
IFCAP_JUMBO_MTU | IFCAP_LRO | \
IFCAP_VLAN_HWTSO | IFCAP_LINKSTATE | IFCAP_HWSTATS)
#define SFXGE_CAP_ENABLE SFXGE_CAP
@@ -283,14 +284,42 @@ sfxge_if_ioctl(struct ifnet *ifp, unsigned long command, caddr_t data)
break;
}
- if (reqcap & IFCAP_TXCSUM)
+ /* Check request before any changes */
+ if ((capchg_mask & IFCAP_TSO4) &&
+ (reqcap & (IFCAP_TSO4 | IFCAP_TXCSUM)) == IFCAP_TSO4) {
+ error = EAGAIN;
+ SFXGE_ADAPTER_UNLOCK(sc);
+ if_printf(ifp, "enable txcsum before tso4\n");
+ break;
+ }
+ if ((capchg_mask & IFCAP_TSO6) &&
+ (reqcap & (IFCAP_TSO6 | IFCAP_TXCSUM_IPV6)) == IFCAP_TSO6) {
+ error = EAGAIN;
+ SFXGE_ADAPTER_UNLOCK(sc);
+ if_printf(ifp, "enable txcsum6 before tso6\n");
+ break;
+ }
+
+ if (reqcap & IFCAP_TXCSUM) {
ifp->if_hwassist |= (CSUM_IP | CSUM_TCP | CSUM_UDP);
- else
+ } else {
ifp->if_hwassist &= ~(CSUM_IP | CSUM_TCP | CSUM_UDP);
- if (reqcap & IFCAP_TXCSUM_IPV6)
+ if (reqcap & IFCAP_TSO4) {
+ reqcap &= ~IFCAP_TSO4;
+ if_printf(ifp,
+ "tso4 disabled due to -txcsum\n");
+ }
+ }
+ if (reqcap & IFCAP_TXCSUM_IPV6) {
ifp->if_hwassist |= (CSUM_TCP_IPV6 | CSUM_UDP_IPV6);
- else
+ } else {
ifp->if_hwassist &= ~(CSUM_TCP_IPV6 | CSUM_UDP_IPV6);
+ if (reqcap & IFCAP_TSO6) {
+ reqcap &= ~IFCAP_TSO6;
+ if_printf(ifp,
+ "tso6 disabled due to -txcsum6\n");
+ }
+ }
/*
* The kernel takes both IFCAP_TSOx and CSUM_TSO into