aggr_port.c revision 490ed22dc41163e0f75a734a3e4e7241ab108b8a
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* IEEE 802.3ad Link Aggregation - Link Aggregation MAC ports.
*
* Implements the functions needed to manage the MAC ports that are
* part of Link Aggregation groups.
*/
#include <sys/sysmacros.h>
#include <sys/aggr_impl.h>
static kmem_cache_t *aggr_port_cache;
static void aggr_port_notify_cb(void *, mac_notify_type_t);
/*ARGSUSED*/
static int
{
return (0);
}
/*ARGSUSED*/
static void
{
}
void
aggr_port_init(void)
{
sizeof (aggr_port_t), 0, aggr_port_constructor,
}
void
aggr_port_fini(void)
{
/*
* This function is called only after all groups have been
* freed. This ensures that there are no remaining allocated
* ports when this function is invoked.
*/
}
{
}
int
{
int err;
uint_t i;
return (err);
if (!mac_active_set(mh)) {
return (EBUSY);
}
port->lp_closing = 0;
/* get the port's original MAC address */
/* add the port's receive callback */
/* set port's transmit information */
/* set port's ring add and ring remove callbacks */
/* initialize state */
port->lp_ifspeed = 0;
/*
* Save the current statistics of the port. They will be used
* later by aggr_m_stats() when aggregating the stastics of
* the consistituent ports.
*/
for (i = 0; i < MAC_NSTAT; i++) {
/* avoid non-counter stats */
if (i == MAC_STAT_IFSPEED || i == MAC_STAT_LINK_DUPLEX)
continue;
}
/* LACP related state */
return (0);
}
void
{
/*
* Restore the port MAC address. Note it is called after the
* port's notification callback being removed. This prevent
* port's MAC_NOTE_UNICST notify callback function being called.
*/
}
void
{
}
/*
* Invoked upon receiving a MAC_NOTE_LINK notification for
* one of the consistuent ports.
*/
static boolean_t
{
/* link state change? */
if (link_state == LINK_STATE_UP)
else
}
/* link duplex change? */
if (link_duplex == LINK_DUPLEX_FULL)
else
}
/* link speed changes? */
else
}
if (do_attach) {
/* attempt to attach the port to the aggregation */
} else if (do_detach) {
/* detach the port from the aggregation */
}
return (grp_link_changed);
}
/*
* Invoked upon receiving a MAC_NOTE_UNICST for one of the constituent
* ports of a group.
*/
static boolean_t
{
/*
* If it is called when setting the MAC address to the
* aggregation group MAC address, do nothing.
*/
if (port->lp_set_grpmac)
return (B_FALSE);
/* save the new port MAC address */
if (grp->lg_closing) {
return (B_FALSE);
}
/*
* If this port was used to determine the MAC address of
* the group, update the MAC address of the constituent
* ports.
*/
if (grp_mac_changed)
return (grp_mac_changed);
}
/*
* Notification callback invoked by the MAC service module for
* a particular MAC port.
*/
static void
{
/*
* Do nothing if the aggregation or the port is in the deletion
* process. Note that this is necessary to avoid deadlock.
*/
return;
switch (type) {
case MAC_NOTE_TX:
break;
case MAC_NOTE_LINK:
break;
case MAC_NOTE_UNICST:
break;
case MAC_NOTE_PROMISC:
break;
default:
break;
}
}
int
{
int rc;
if (port->lp_started)
return (0);
return (rc);
/* update the port state */
return (rc);
}
void
{
if (!port->lp_started)
return;
/* update the port state */
}
int
{
int rc;
/* already in desired promiscous mode */
return (0);
if (rc == 0)
return (rc);
}
/*
* Set the MAC address of a port.
*/
int
{
int rc;
/*
* set lp_set_grpmac to indicate it is going to set the MAC
* address to the aggregation MAC address.
*/
return (rc);
}
/*
*/
int
{
}
{
return (0);
}