diff options
author | arybchik <arybchik@FreeBSD.org> | 2015-05-21 09:09:51 +0000 |
---|---|---|
committer | arybchik <arybchik@FreeBSD.org> | 2015-05-21 09:09:51 +0000 |
commit | d7d6b9f862b4f9b9567df5a9c518c9c1d4ef2041 (patch) | |
tree | e5232a1932ef2d3123c8068c94756711b06be8c0 /sys | |
parent | 8b552766ba273e850b41640d907f930900681328 (diff) | |
download | FreeBSD-src-d7d6b9f862b4f9b9567df5a9c518c9c1d4ef2041.zip FreeBSD-src-d7d6b9f862b4f9b9567df5a9c518c9c1d4ef2041.tar.gz |
MFC: r282996
sfxge: support Rx checksum offloads disabling
We can't disable it in HW, but we can ignore result.
Discard Rx descriptor checksum flags if Rx checksum offload is off.
Sponsored by: Solarflare Communications, Inc.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/sfxge/sfxge.c | 3 | ||||
-rw-r--r-- | sys/dev/sfxge/sfxge_rx.c | 41 |
2 files changed, 30 insertions, 14 deletions
diff --git a/sys/dev/sfxge/sfxge.c b/sys/dev/sfxge/sfxge.c index ac128f2..97353ee2 100644 --- a/sys/dev/sfxge/sfxge.c +++ b/sys/dev/sfxge/sfxge.c @@ -64,8 +64,7 @@ __FBSDID("$FreeBSD$"); IFCAP_JUMBO_MTU | IFCAP_LRO | \ IFCAP_VLAN_HWTSO | IFCAP_LINKSTATE) #define SFXGE_CAP_ENABLE SFXGE_CAP -#define SFXGE_CAP_FIXED (IFCAP_VLAN_MTU | IFCAP_RXCSUM | IFCAP_VLAN_HWCSUM | \ - IFCAP_RXCSUM_IPV6 | \ +#define SFXGE_CAP_FIXED (IFCAP_VLAN_MTU | IFCAP_VLAN_HWCSUM | \ IFCAP_JUMBO_MTU | IFCAP_LINKSTATE) MALLOC_DEFINE(M_SFXGE, "sfxge", "Solarflare 10GigE driver"); diff --git a/sys/dev/sfxge/sfxge_rx.c b/sys/dev/sfxge/sfxge_rx.c index 673de43..1637db9 100644 --- a/sys/dev/sfxge/sfxge_rx.c +++ b/sys/dev/sfxge/sfxge_rx.c @@ -788,7 +788,8 @@ void sfxge_rx_qcomplete(struct sfxge_rxq *rxq, boolean_t eop) { struct sfxge_softc *sc = rxq->sc; - int lro_enabled = sc->ifnet->if_capenable & IFCAP_LRO; + int if_capenable = sc->ifnet->if_capenable; + int lro_enabled = if_capenable & IFCAP_LRO; unsigned int index; struct sfxge_evq *evq; unsigned int completed; @@ -818,21 +819,37 @@ sfxge_rx_qcomplete(struct sfxge_rxq *rxq, boolean_t eop) prefetch_read_many(mtod(m, caddr_t)); - /* Check for loopback packets */ - if (!(rx_desc->flags & EFX_PKT_IPV4) && - !(rx_desc->flags & EFX_PKT_IPV6)) { - struct ether_header *etherhp; + switch (rx_desc->flags & (EFX_PKT_IPV4 | EFX_PKT_IPV6)) { + case EFX_PKT_IPV4: + if (~if_capenable & IFCAP_RXCSUM) + rx_desc->flags &= + ~(EFX_CKSUM_IPV4 | EFX_CKSUM_TCPUDP); + break; + case EFX_PKT_IPV6: + if (~if_capenable & IFCAP_RXCSUM_IPV6) + rx_desc->flags &= ~EFX_CKSUM_TCPUDP; + break; + case 0: + /* Check for loopback packets */ + { + struct ether_header *etherhp; - /*LINTED*/ - etherhp = mtod(m, struct ether_header *); + /*LINTED*/ + etherhp = mtod(m, struct ether_header *); - if (etherhp->ether_type == - htons(SFXGE_ETHERTYPE_LOOPBACK)) { - EFSYS_PROBE(loopback); + if (etherhp->ether_type == + htons(SFXGE_ETHERTYPE_LOOPBACK)) { + EFSYS_PROBE(loopback); - rxq->loopback++; - goto discard; + rxq->loopback++; + goto discard; + } } + break; + default: + KASSERT(B_FALSE, + ("Rx descriptor with both IPv4 and IPv6 flags")); + goto discard; } /* Pass packet up the stack or into LRO (pipelined) */ |