Deleted Added
full compact
ieee8023ad_lacp.c (169227) ieee8023ad_lacp.c (169327)
1/* $NetBSD: ieee8023ad_lacp.c,v 1.3 2005/12/11 12:24:54 christos Exp $ */
2
3/*-
4 * Copyright (c)2005 YAMAMOTO Takashi,
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 13 unchanged lines hidden (view full) ---

22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 */
28
29#include <sys/cdefs.h>
1/* $NetBSD: ieee8023ad_lacp.c,v 1.3 2005/12/11 12:24:54 christos Exp $ */
2
3/*-
4 * Copyright (c)2005 YAMAMOTO Takashi,
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 13 unchanged lines hidden (view full) ---

22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 */
28
29#include <sys/cdefs.h>
30__FBSDID("$FreeBSD: head/sys/net/ieee8023ad_lacp.c 169227 2007-05-03 08:56:20Z thompsa $");
30__FBSDID("$FreeBSD: head/sys/net/ieee8023ad_lacp.c 169327 2007-05-07 00:18:56Z thompsa $");
31
32#include <sys/param.h>
33#include <sys/callout.h>
34#include <sys/mbuf.h>
35#include <sys/systm.h>
36#include <sys/malloc.h>
37#include <sys/kernel.h> /* hz */
38#include <sys/socket.h> /* for net/if.h */

--- 409 unchanged lines hidden (view full) ---

448 M_DEVBUF, M_NOWAIT|M_ZERO);
449 if (lp == NULL)
450 return (ENOMEM);
451
452 lgp->lp_psc = (caddr_t)lp;
453 lp->lp_ifp = ifp;
454 lp->lp_lagg = lgp;
455 lp->lp_lsc = lsc;
31
32#include <sys/param.h>
33#include <sys/callout.h>
34#include <sys/mbuf.h>
35#include <sys/systm.h>
36#include <sys/malloc.h>
37#include <sys/kernel.h> /* hz */
38#include <sys/socket.h> /* for net/if.h */

--- 409 unchanged lines hidden (view full) ---

448 M_DEVBUF, M_NOWAIT|M_ZERO);
449 if (lp == NULL)
450 return (ENOMEM);
451
452 lgp->lp_psc = (caddr_t)lp;
453 lp->lp_ifp = ifp;
454 lp->lp_lagg = lgp;
455 lp->lp_lsc = lsc;
456 lp->lp_ifma = rifma;
456
457 LIST_INSERT_HEAD(&lsc->lsc_ports, lp, lp_next);
458
459 lacp_fill_actorinfo(lp, &lp->lp_actor);
460 lp->lp_state =
461 (active ? LACP_STATE_ACTIVITY : 0) |
462 (fast ? LACP_STATE_TIMEOUT : 0);
463 lp->lp_aggregator = NULL;
464 lacp_linkstate(lgp);
465 lacp_sm_rx_set_expired(lp);
466
467 return (0);
468}
469
470void
471lacp_port_destroy(struct lagg_port *lgp)
472{
473 struct lacp_port *lp = LACP_PORT(lgp);
457
458 LIST_INSERT_HEAD(&lsc->lsc_ports, lp, lp_next);
459
460 lacp_fill_actorinfo(lp, &lp->lp_actor);
461 lp->lp_state =
462 (active ? LACP_STATE_ACTIVITY : 0) |
463 (fast ? LACP_STATE_TIMEOUT : 0);
464 lp->lp_aggregator = NULL;
465 lacp_linkstate(lgp);
466 lacp_sm_rx_set_expired(lp);
467
468 return (0);
469}
470
471void
472lacp_port_destroy(struct lagg_port *lgp)
473{
474 struct lacp_port *lp = LACP_PORT(lgp);
474 struct ifnet *ifp = lgp->lp_ifp;
475 struct sockaddr_dl sdl;
476 int i, error;
475 int i;
477
478 LAGG_LOCK_ASSERT(lgp->lp_lagg);
479
480 for (i = 0; i < LACP_NTIMER; i++) {
481 LACP_TIMER_DISARM(lp, i);
482 }
483
484 lacp_disable_collecting(lp);
485 lacp_disable_distributing(lp);
486 lacp_unselect(lp);
487 lgp->lp_flags &= ~LAGG_PORT_DISABLED;
488
476
477 LAGG_LOCK_ASSERT(lgp->lp_lagg);
478
479 for (i = 0; i < LACP_NTIMER; i++) {
480 LACP_TIMER_DISARM(lp, i);
481 }
482
483 lacp_disable_collecting(lp);
484 lacp_disable_distributing(lp);
485 lacp_unselect(lp);
486 lgp->lp_flags &= ~LAGG_PORT_DISABLED;
487
489 bzero((char *)&sdl, sizeof(sdl));
490 sdl.sdl_len = sizeof(sdl);
491 sdl.sdl_family = AF_LINK;
492 sdl.sdl_index = ifp->if_index;
493 sdl.sdl_type = IFT_ETHER;
494 sdl.sdl_alen = ETHER_ADDR_LEN;
488 if_delmulti_ifma(lp->lp_ifma);
495
489
496 bcopy(&ethermulticastaddr_slowprotocols,
497 LLADDR(&sdl), ETHER_ADDR_LEN);
498 error = if_delmulti(ifp, (struct sockaddr *)&sdl);
499 if (error)
500 printf("%s: DELMULTI failed on %s\n", __func__, lgp->lp_ifname);
501
502 LIST_REMOVE(lp, lp_next);
503 free(lp, M_DEVBUF);
504}
505
506int
507lacp_port_isactive(struct lagg_port *lgp)
508{
509 struct lacp_port *lp = LACP_PORT(lgp);

--- 1267 unchanged lines hidden ---
490 LIST_REMOVE(lp, lp_next);
491 free(lp, M_DEVBUF);
492}
493
494int
495lacp_port_isactive(struct lagg_port *lgp)
496{
497 struct lacp_port *lp = LACP_PORT(lgp);

--- 1267 unchanged lines hidden ---