aggr_port.c revision 1f8aaf0dbb5709114b4d2925d6b4ce5f931819ed
/*
* 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 2007 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.
*/
}
{
}
void
{
/* add the port's receive callback */
(void *)port);
/* set port's resource_add callback */
}
int
{
int err;
uint_t i;
const mac_info_t *mip;
char driver[MAXNAMELEN];
return (EINVAL);
return (err);
return (EINVAL);
}
if (!mac_active_set(mh)) {
return (EBUSY);
}
port->lp_closing = 0;
/* get the port's original MAC address */
/* set port's transmit information */
/* 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++) {
}
for (i = 0; i < ETHER_NSTAT; i++) {
port->lp_ether_stat[i] =
}
/* 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.
*/
{
if (dolock) {
} else {
}
/* 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 */
}
if (dolock) {
}
return (link_state_changed);
}
/*
* Invoked upon receiving a MAC_NOTE_UNICST for one of the constituent
* ports of a group.
*/
static void
{
/*
* If it is called when setting the MAC address to the
* aggregation group MAC address, do nothing.
*/
goto done;
}
/* save the new port MAC address */
if (grp->lg_closing)
goto done;
/*
* If this port was used to determine the MAC address of
* the group, update the MAC address of the constituent
* ports.
*/
if (mac_addr_changed) {
}
done:
}
/*
* 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:
if (mac_addr_changed)
if (link_state_changed)
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;
return (rc);
}
/*
*/
int
{
}
{
}