Created
June 14, 2012 20:28
-
-
Save postwait/2932748 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| commit 8862e0b4640a2a363c8c6d0f529179c5d7463c07 | |
| Author: Theo Schlossnagle <[email protected]> | |
| Date: Wed Jun 13 19:25:32 2012 +0000 | |
| 2869 duplicate packets with vnics over aggrs | |
| diff --git a/usr/src/uts/common/io/aggr/aggr_port.c b/usr/src/uts/common/io/aggr/aggr_port.c | |
| index 00545d2..9c36f61 100644 | |
| --- a/usr/src/uts/common/io/aggr/aggr_port.c | |
| +++ b/usr/src/uts/common/io/aggr/aggr_port.c | |
| @@ -21,6 +21,7 @@ | |
| /* | |
| * Copyright 2010 Sun Microsystems, Inc. All rights reserved. | |
| * Use is subject to license terms. | |
| + * Copyright 2012 OmniTI Computer Consulting, Inc All rights reserved. | |
| */ | |
| /* | |
| @@ -528,8 +529,13 @@ aggr_port_promisc(aggr_port_t *port, boolean_t on) | |
| if (on) { | |
| mac_rx_clear(port->lp_mch); | |
| + /* We use the promisc callback because without hardware | |
| + * rings, we deliver through flows that will cuase duplicate | |
| + * delivery of packets when we've flipped into this mode | |
| + * to compensate for the lack of hardware MAC matching | |
| + */ | |
| rc = mac_promisc_add(port->lp_mch, MAC_CLIENT_PROMISC_ALL, | |
| - aggr_recv_cb, port, &port->lp_mphp, | |
| + aggr_recv_promisc_cb, port, &port->lp_mphp, | |
| MAC_PROMISC_FLAGS_NO_TX_LOOP); | |
| if (rc != 0) { | |
| mac_rx_set(port->lp_mch, aggr_recv_cb, port); | |
| diff --git a/usr/src/uts/common/io/aggr/aggr_recv.c b/usr/src/uts/common/io/aggr/aggr_recv.c | |
| index 2bdb787..0dfe234 100644 | |
| --- a/usr/src/uts/common/io/aggr/aggr_recv.c | |
| +++ b/usr/src/uts/common/io/aggr/aggr_recv.c | |
| @@ -21,6 +21,7 @@ | |
| /* | |
| * Copyright 2008 Sun Microsystems, Inc. All rights reserved. | |
| * Use is subject to license terms. | |
| + * Copyright 2012 OmniTI Computer Consulting, Inc All rights reserved. | |
| */ | |
| /* | |
| @@ -68,16 +69,27 @@ aggr_recv_lacp(aggr_port_t *port, mac_resource_handle_t mrh, mblk_t *mp) | |
| /* | |
| * Callback function invoked by MAC service module when packets are | |
| - * made available by a MAC port. | |
| + * made available by a MAC port, both in promisc_on mode and not. | |
| */ | |
| /* ARGSUSED */ | |
| -void | |
| -aggr_recv_cb(void *arg, mac_resource_handle_t mrh, mblk_t *mp, | |
| - boolean_t loopback) | |
| +static void | |
| +aggr_recv_path_cb(void *arg, mac_resource_handle_t mrh, mblk_t *mp, | |
| + boolean_t loopback, boolean_t promisc_path) | |
| { | |
| aggr_port_t *port = (aggr_port_t *)arg; | |
| aggr_grp_t *grp = port->lp_grp; | |
| + /* In the case where lp_promisc_on has been turned on to | |
| + * compensate for insufficient hardware MAC matching and | |
| + * hardware rings are not in use we will fall back to | |
| + * using flows for delivery which can result in duplicates | |
| + * pushed up the stack. Only respect the chosen path. | |
| + */ | |
| + if (port->lp_promisc_on != promisc_path) { | |
| + freemsgchain(mp); | |
| + return; | |
| + } | |
| + | |
| if (grp->lg_lacp_mode == AGGR_LACP_OFF) { | |
| aggr_mac_rx(grp->lg_mh, mrh, mp); | |
| } else { | |
| @@ -161,3 +173,19 @@ aggr_recv_cb(void *arg, mac_resource_handle_t mrh, mblk_t *mp, | |
| } | |
| } | |
| } | |
| + | |
| +/* ARGSUSED */ | |
| +void | |
| +aggr_recv_cb(void *arg, mac_resource_handle_t mrh, mblk_t *mp, | |
| + boolean_t loopback) | |
| +{ | |
| + aggr_recv_path_cb(arg, mrh, mp, loopback, B_FALSE); | |
| +} | |
| + | |
| +/* ARGSUSED */ | |
| +void | |
| +aggr_recv_promisc_cb(void *arg, mac_resource_handle_t mrh, mblk_t *mp, | |
| + boolean_t loopback) | |
| +{ | |
| + aggr_recv_path_cb(arg, mrh, mp, loopback, B_TRUE); | |
| +} | |
| diff --git a/usr/src/uts/common/sys/aggr_impl.h b/usr/src/uts/common/sys/aggr_impl.h | |
| index 8363d23..e0cfd6f 100644 | |
| --- a/usr/src/uts/common/sys/aggr_impl.h | |
| +++ b/usr/src/uts/common/sys/aggr_impl.h | |
| @@ -21,6 +21,7 @@ | |
| /* | |
| * Copyright 2010 Sun Microsystems, Inc. All rights reserved. | |
| * Use is subject to license terms. | |
| + * Copyright 2012 OmniTI Computer Consulting, Inc All rights reserved. | |
| */ | |
| #ifndef _SYS_AGGR_IMPL_H | |
| @@ -307,6 +308,8 @@ extern boolean_t aggr_port_notify_link(aggr_grp_t *, aggr_port_t *); | |
| extern void aggr_port_init_callbacks(aggr_port_t *); | |
| extern void aggr_recv_cb(void *, mac_resource_handle_t, mblk_t *, boolean_t); | |
| +extern void aggr_recv_promisc_cb(void *, mac_resource_handle_t, mblk_t *, | |
| + boolean_t); | |
| extern void aggr_tx_ring_update(void *, uintptr_t); | |
| extern void aggr_tx_notify_thread(void *); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment