svn commit: r247152 - head/sys/dev/mxge

Andrew Gallatin gallatin at FreeBSD.org
Fri Feb 22 16:46:29 UTC 2013


Author: gallatin
Date: Fri Feb 22 16:46:28 2013
New Revision: 247152
URL: http://svnweb.freebsd.org/changeset/base/247152

Log:
  Try harder to make mxge safe for all combinations of INET and INET6
  
  - Re-fix build by restoring local removed in r247151, but protected
    by #if defined(INET) || defined(INET6) so that the compile
    succeeds in the !(INET||INET6) case.
  
  - Protect call to in_pseudo() with an #ifdef INET, to allow
    a kernel to link with mxge when INET is not compiled in.
  
  - Also remove an errant (improperly commented) obsolete debugging printf
  
  Thanks to Glebius for pointing out the !(INET||INET6) build issue.
  
  Sponsored by: Myricom
  
  MFC After: 7 days

Modified:
  head/sys/dev/mxge/if_mxge.c

Modified: head/sys/dev/mxge/if_mxge.c
==============================================================================
--- head/sys/dev/mxge/if_mxge.c	Fri Feb 22 12:41:24 2013	(r247151)
+++ head/sys/dev/mxge/if_mxge.c	Fri Feb 22 16:46:28 2013	(r247152)
@@ -1887,11 +1887,13 @@ mxge_encap_tso(struct mxge_slice_state *
 			    IPPROTO_TCP, 0);
 #endif
 		} else {
+#ifdef INET
 			m->m_pkthdr.csum_flags |= CSUM_TCP;
 			sum = in_pseudo(pi->ip->ip_src.s_addr,
 			    pi->ip->ip_dst.s_addr,
 			    htons(IPPROTO_TCP + (m->m_pkthdr.len -
 				    cksum_offset)));
+#endif
 		}
 		m_copyback(m, offsetof(struct tcphdr, th_sum) +
 		    cksum_offset, sizeof(sum), (caddr_t)&sum);
@@ -2538,8 +2540,6 @@ mxge_rx_csum6(void *p, struct mbuf *m, u
 	csum = (csum >> 16) + (csum & 0xFFFF);
 	c = in6_cksum_pseudo(ip6, m->m_pkthdr.len - cksum_offset, nxt,
 			     csum);
-
-//	printf("%d %d %x %x %x %x %x\n", m->m_pkthdr.len, cksum_offset, c, csum, ocsum, partial, d);
 	c ^= 0xffff;
 	return (c);
 }
@@ -2560,6 +2560,9 @@ mxge_rx_csum(struct mbuf *m, int csum)
 #ifdef INET
 	struct ip *ip;
 #endif
+#if defined(INET) || defined(INET6)
+	int cap = m->m_pkthdr.rcvif->if_capenable;
+#endif
 	uint16_t c, etype;
 
 


More information about the svn-src-head mailing list