Date: Wed, 6 Dec 2006 23:19:42 GMT From: Paolo Pisati <piso@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 111230 for review Message-ID: <200612062319.kB6NJgsq031755@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=111230 Change 111230 by piso@piso_newluxor on 2006/12/06 23:19:06 To workaround a problem when an mbuf is bigger than MCLBYTES (and thus not handled by m_megapullup()), introduce & use m_jumbo16pullup() that uses 16k jumbo size cluster. This problem only showed up on traffic generated on a box with a nic tso enabled. Affected files ... .. //depot/projects/soc2005/libalias/sys/netinet/ip_fw2.c#30 edit .. //depot/projects/soc2005/libalias/sys/netinet/libalias/alias.c#24 edit .. //depot/projects/soc2005/libalias/sys/netinet/libalias/alias.h#8 edit Differences ... ==== //depot/projects/soc2005/libalias/sys/netinet/ip_fw2.c#30 (text+ko) ==== @@ -3469,8 +3469,10 @@ ((ipfw_insn_nat *)cmd)->nat = t; } - if ((mcl = m_megapullup(m, m->m_pkthdr.len)) == - NULL) + if (m->m_pkthdr.len > MJUM16BYTES) + printf("fat pkt: %d\n", m->m_pkthdr.len); + if ((mcl = m_jumbo16pullup(m, + m->m_pkthdr.len)) == NULL) goto badnat; ip = mtod(mcl, struct ip *); if (args->eh == NULL) { @@ -3534,10 +3536,10 @@ c = mtod(mcl, char *); if (oif == NULL) retval = LibAliasIn(t->lib, c, - MCLBYTES); + MJUM16BYTES); else retval = LibAliasOut(t->lib, c, - MCLBYTES); + MJUM16BYTES); if (retval != PKT_ALIAS_OK) { /* XXX - should i add some logging? */ m_free(mcl); ==== //depot/projects/soc2005/libalias/sys/netinet/libalias/alias.c#24 (text+ko) ==== @@ -1656,4 +1656,29 @@ m_freem(m); return (NULL); } + +struct mbuf * +m_jumbo16pullup(struct mbuf *m, int len) { + struct mbuf *mcl; + caddr_t cp; + + if (len > MJUM16BYTES) + goto bad; + + if ((mcl = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, + MJUM16BYTES)) == NULL) + goto bad; + + cp = mtod(mcl, caddr_t); + m_copydata(m, 0, len, cp); + m_move_pkthdr(mcl, m); + mcl->m_len = mcl->m_pkthdr.len; + m_freem(m); + + return (mcl); +bad: + m_freem(m); + return (NULL); +} + #endif ==== //depot/projects/soc2005/libalias/sys/netinet/libalias/alias.h#8 (text+ko) ==== @@ -191,6 +191,7 @@ /* Mbuf helper function. */ struct mbuf *m_megapullup(struct mbuf *, int); +struct mbuf *m_jumbo16pullup(struct mbuf *, int); /* * Mode flags and other constants.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200612062319.kB6NJgsq031755>