summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbz <bz@FreeBSD.org>2012-06-01 11:42:50 +0000
committerbz <bz@FreeBSD.org>2012-06-01 11:42:50 +0000
commit93f33aca235863c198489ffb08994a6ca86e897e (patch)
treeceeef93e7069e28fc8151a8cbceff35bfbd33551
parent8e77e366f62cd5e13d4f09087f8967e02277b5a5 (diff)
downloadFreeBSD-src-93f33aca235863c198489ffb08994a6ca86e897e.zip
FreeBSD-src-93f33aca235863c198489ffb08994a6ca86e897e.tar.gz
Make TCP LRO work properly with VIMAGE kernels rather than just panicing.
There's no VIMAGE context set there yet as this is before if_ethersubr.c. MFC after: 3 days X-MFC with: r235981
-rw-r--r--sys/netinet/tcp_lro.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/sys/netinet/tcp_lro.c b/sys/netinet/tcp_lro.c
index 3a5878d..3718e4d 100644
--- a/sys/netinet/tcp_lro.c
+++ b/sys/netinet/tcp_lro.c
@@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$");
#include <net/if.h>
#include <net/if_var.h>
#include <net/ethernet.h>
+#include <net/vnet.h>
#include <netinet/in_systm.h>
#include <netinet/in.h>
@@ -370,10 +371,14 @@ tcp_lro_rx(struct lro_ctrl *lc, struct mbuf *m, uint32_t csum)
switch (eh_type) {
#ifdef INET6
case ETHERTYPE_IPV6:
+ {
+ CURVNET_SET(lc->ifp->if_vnet);
if (V_ip6_forwarding != 0) {
/* XXX-BZ stats but changing lro_ctrl is a problem. */
+ CURVNET_RESTORE();
return (TCP_LRO_CANNOT);
}
+ CURVNET_RESTORE();
l3hdr = ip6 = (struct ip6_hdr *)(eh + 1);
error = tcp_lro_rx_ipv6(lc, m, ip6, &th);
if (error != 0)
@@ -381,13 +386,18 @@ tcp_lro_rx(struct lro_ctrl *lc, struct mbuf *m, uint32_t csum)
tcp_data_len = ntohs(ip6->ip6_plen);
ip_len = sizeof(*ip6) + tcp_data_len;
break;
+ }
#endif
#ifdef INET
case ETHERTYPE_IP:
+ {
+ CURVNET_SET(lc->ifp->if_vnet);
if (V_ipforwarding != 0) {
/* XXX-BZ stats but changing lro_ctrl is a problem. */
+ CURVNET_RESTORE();
return (TCP_LRO_CANNOT);
}
+ CURVNET_RESTORE();
l3hdr = ip4 = (struct ip *)(eh + 1);
error = tcp_lro_rx_ipv4(lc, m, ip4, &th);
if (error != 0)
@@ -395,6 +405,7 @@ tcp_lro_rx(struct lro_ctrl *lc, struct mbuf *m, uint32_t csum)
ip_len = ntohs(ip4->ip_len);
tcp_data_len = ip_len - sizeof(*ip4);
break;
+ }
#endif
/* XXX-BZ what happens in case of VLAN(s)? */
default:
OpenPOWER on IntegriCloud