4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 /*
27 * IEEE 802.3ad Link Aggregation - Link Aggregation MAC ports.
28 *
29 * Implements the functions needed to manage the MAC ports that are
30 * part of Link Aggregation groups.
31 */
32
33 #include <sys/types.h>
34 #include <sys/sysmacros.h>
35 #include <sys/conf.h>
36 #include <sys/cmn_err.h>
37 #include <sys/id_space.h>
38 #include <sys/list.h>
39 #include <sys/ksynch.h>
40 #include <sys/kmem.h>
41 #include <sys/stream.h>
42 #include <sys/modctl.h>
43 #include <sys/ddi.h>
511
512 aggr_grp_multicst_port(port, B_FALSE);
513
514 /* update the port state */
515 port->lp_started = B_FALSE;
516 }
517
518 int
519 aggr_port_promisc(aggr_port_t *port, boolean_t on)
520 {
521 int rc;
522
523 ASSERT(MAC_PERIM_HELD(port->lp_mh));
524
525 if (on == port->lp_promisc_on)
526 /* already in desired promiscous mode */
527 return (0);
528
529 if (on) {
530 mac_rx_clear(port->lp_mch);
531 rc = mac_promisc_add(port->lp_mch, MAC_CLIENT_PROMISC_ALL,
532 aggr_recv_cb, port, &port->lp_mphp,
533 MAC_PROMISC_FLAGS_NO_TX_LOOP);
534 if (rc != 0) {
535 mac_rx_set(port->lp_mch, aggr_recv_cb, port);
536 return (rc);
537 }
538 } else {
539 mac_promisc_remove(port->lp_mphp);
540 port->lp_mphp = NULL;
541 mac_rx_set(port->lp_mch, aggr_recv_cb, port);
542 }
543
544 port->lp_promisc_on = on;
545
546 return (0);
547 }
548
549 /*
550 * Set the MAC address of a port.
551 */
552 int
|
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 * Copyright 2012 OmniTI Computer Consulting, Inc All rights reserved.
25 */
26
27 /*
28 * IEEE 802.3ad Link Aggregation - Link Aggregation MAC ports.
29 *
30 * Implements the functions needed to manage the MAC ports that are
31 * part of Link Aggregation groups.
32 */
33
34 #include <sys/types.h>
35 #include <sys/sysmacros.h>
36 #include <sys/conf.h>
37 #include <sys/cmn_err.h>
38 #include <sys/id_space.h>
39 #include <sys/list.h>
40 #include <sys/ksynch.h>
41 #include <sys/kmem.h>
42 #include <sys/stream.h>
43 #include <sys/modctl.h>
44 #include <sys/ddi.h>
512
513 aggr_grp_multicst_port(port, B_FALSE);
514
515 /* update the port state */
516 port->lp_started = B_FALSE;
517 }
518
519 int
520 aggr_port_promisc(aggr_port_t *port, boolean_t on)
521 {
522 int rc;
523
524 ASSERT(MAC_PERIM_HELD(port->lp_mh));
525
526 if (on == port->lp_promisc_on)
527 /* already in desired promiscous mode */
528 return (0);
529
530 if (on) {
531 mac_rx_clear(port->lp_mch);
532 /* We use the promisc callback because without hardware
533 * rings, we deliver through flows that will cause duplicate
534 * delivery of packets when we've flipped into this mode
535 * to compensate for the lack of hardware MAC matching
536 */
537 rc = mac_promisc_add(port->lp_mch, MAC_CLIENT_PROMISC_ALL,
538 aggr_recv_promisc_cb, port, &port->lp_mphp,
539 MAC_PROMISC_FLAGS_NO_TX_LOOP);
540 if (rc != 0) {
541 mac_rx_set(port->lp_mch, aggr_recv_cb, port);
542 return (rc);
543 }
544 } else {
545 mac_promisc_remove(port->lp_mphp);
546 port->lp_mphp = NULL;
547 mac_rx_set(port->lp_mch, aggr_recv_cb, port);
548 }
549
550 port->lp_promisc_on = on;
551
552 return (0);
553 }
554
555 /*
556 * Set the MAC address of a port.
557 */
558 int
|