Skip to content

Commit

Permalink
Make TCP LRO work properly with VIMAGE kernels rather than just panic…
Browse files Browse the repository at this point in the history
…ing.

There's no VIMAGE context set there yet as this is before if_ethersubr.c.

MFC after:	3 days
X-MFC with:	r235981
  • Loading branch information
Bjoern A. Zeeb authored and Bjoern A. Zeeb committed Jun 1, 2012
1 parent 581b2e7 commit 5fa2656
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions sys/netinet/tcp_lro.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -370,31 +371,41 @@ 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)
return (error);
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)
return (error);
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:
Expand Down

0 comments on commit 5fa2656

Please sign in to comment.