diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2007-10-22 17:02:04 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2007-10-22 17:02:04 +0000 |
commit | 5c1defb4b1eb67ea1ef35e70c302ed6fa0039067 (patch) | |
tree | 91f9d84433763b4db4ff3113ad69b2ff1209bf45 | |
parent | e595ddc0825a110e6d1910f262566e120c608723 (diff) |
use the input mbuf for the first active port instead of copying it in
the broadcast start routing.
ok pyr@
-rw-r--r-- | sys/net/if_trunk.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/sys/net/if_trunk.c b/sys/net/if_trunk.c index 0afac165f80..8b2e017dfc5 100644 --- a/sys/net/if_trunk.c +++ b/sys/net/if_trunk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_trunk.c,v 1.37 2007/10/22 14:48:52 pyr Exp $ */ +/* $OpenBSD: if_trunk.c,v 1.38 2007/10/22 17:02:03 reyk Exp $ */ /* * Copyright (c) 2005, 2006, 2007 Reyk Floeter <reyk@openbsd.org> @@ -1467,26 +1467,27 @@ trunk_bcast_start(struct trunk_softc *tr, struct mbuf *m) int errors = 0; int ret; struct trunk_port *tp; - struct mbuf *newbuf; + struct mbuf *n; SLIST_FOREACH(tp, &tr->tr_ports, tp_entries) { if (TRUNK_PORTACTIVE(tp)) { - /* - * copy the mbuf everytime. - */ - newbuf = m_copym(m, 0, M_COPYALL, M_DONTWAIT); - if (newbuf == NULL) { - m_free(m); - return (ENOBUFS); - } + if (active_ports) { + n = m_copym(m, 0, M_COPYALL, M_DONTWAIT); + if (n == NULL) { + m_free(m); + return (ENOBUFS); + } + } else + n = m; active_ports++; - if ((ret = trunk_enqueue(tp->tp_if, newbuf))) + if ((ret = trunk_enqueue(tp->tp_if, n))) errors++; } } - m_free(m); - if (active_ports == 0) + if (active_ports == 0) { + m_free(m); return (ENOENT); + } if (errors == active_ports) return (ret); return (0); |