ieee8023ad_lacp.c (169328) | ieee8023ad_lacp.c (169569) |
---|---|
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 169328 2007-05-07 00:28:55Z thompsa $"); | 30__FBSDID("$FreeBSD: head/sys/net/ieee8023ad_lacp.c 169569 2007-05-15 07:41:46Z 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 */ 39#include <sys/sockio.h> 40#include <machine/stdarg.h> | 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 */ 39#include <sys/sockio.h> 40#include <machine/stdarg.h> |
41#include <sys/lock.h> 42#include <sys/rwlock.h> 43#include <sys/taskqueue.h> |
|
41 42#include <net/if.h> 43#include <net/if_dl.h> 44#include <net/ethernet.h> 45#include <net/if_media.h> 46#include <net/if_types.h> 47 48#include <net/if_lagg.h> --- 57 unchanged lines hidden (view full) --- 106 struct lacp_port *); 107static void lacp_aggregator_addref(struct lacp_softc *, 108 struct lacp_aggregator *); 109static void lacp_aggregator_delref(struct lacp_softc *, 110 struct lacp_aggregator *); 111 112/* receive machine */ 113 | 44 45#include <net/if.h> 46#include <net/if_dl.h> 47#include <net/ethernet.h> 48#include <net/if_media.h> 49#include <net/if_types.h> 50 51#include <net/if_lagg.h> --- 57 unchanged lines hidden (view full) --- 109 struct lacp_port *); 110static void lacp_aggregator_addref(struct lacp_softc *, 111 struct lacp_aggregator *); 112static void lacp_aggregator_delref(struct lacp_softc *, 113 struct lacp_aggregator *); 114 115/* receive machine */ 116 |
117static void lacp_dequeue(void *, int); 118static int lacp_pdu_input(struct lagg_port *, struct mbuf *); 119static int lacp_marker_input(struct lagg_port *, struct mbuf *); |
|
114static void lacp_sm_rx(struct lacp_port *, const struct lacpdu *); 115static void lacp_sm_rx_timer(struct lacp_port *); 116static void lacp_sm_rx_set_expired(struct lacp_port *); 117static void lacp_sm_rx_update_ntt(struct lacp_port *, 118 const struct lacpdu *); 119static void lacp_sm_rx_record_pdu(struct lacp_port *, 120 const struct lacpdu *); 121static void lacp_sm_rx_update_selected(struct lacp_port *, --- 75 unchanged lines hidden (view full) --- 197}; 198 199static const lacp_timer_func_t lacp_timer_funcs[LACP_NTIMER] = { 200 [LACP_TIMER_CURRENT_WHILE] = lacp_sm_rx_timer, 201 [LACP_TIMER_PERIODIC] = lacp_sm_ptx_timer, 202 [LACP_TIMER_WAIT_WHILE] = lacp_sm_mux_timer, 203}; 204 | 120static void lacp_sm_rx(struct lacp_port *, const struct lacpdu *); 121static void lacp_sm_rx_timer(struct lacp_port *); 122static void lacp_sm_rx_set_expired(struct lacp_port *); 123static void lacp_sm_rx_update_ntt(struct lacp_port *, 124 const struct lacpdu *); 125static void lacp_sm_rx_record_pdu(struct lacp_port *, 126 const struct lacpdu *); 127static void lacp_sm_rx_update_selected(struct lacp_port *, --- 75 unchanged lines hidden (view full) --- 203}; 204 205static const lacp_timer_func_t lacp_timer_funcs[LACP_NTIMER] = { 206 [LACP_TIMER_CURRENT_WHILE] = lacp_sm_rx_timer, 207 [LACP_TIMER_PERIODIC] = lacp_sm_ptx_timer, 208 [LACP_TIMER_WAIT_WHILE] = lacp_sm_mux_timer, 209}; 210 |
211void 212lacp_input(struct lagg_port *lgp, struct mbuf *m) 213{ 214 struct lagg_softc *lgs = lgp->lp_lagg; 215 struct lacp_softc *lsc = LACP_SOFTC(lgs); 216 uint8_t subtype; 217 218 if (m->m_pkthdr.len < sizeof(struct ether_header) + sizeof(subtype)) { 219 m_freem(m); 220 return; 221 } 222 223 m_copydata(m, sizeof(struct ether_header), sizeof(subtype), &subtype); 224 switch (subtype) { 225 case SLOWPROTOCOLS_SUBTYPE_LACP: 226 IF_HANDOFF(&lsc->lsc_queue, m, NULL); 227 taskqueue_enqueue(taskqueue_swi, &lsc->lsc_qtask); 228 break; 229 230 case SLOWPROTOCOLS_SUBTYPE_MARKER: 231 lacp_marker_input(lgp, m); 232 break; 233 234 default: 235 /* Unknown LACP packet type */ 236 m_freem(m); 237 break; 238 } 239} 240 241static void 242lacp_dequeue(void *arg, int pending) 243{ 244 struct lacp_softc *lsc = (struct lacp_softc *)arg; 245 struct lagg_softc *sc = lsc->lsc_lagg; 246 struct lagg_port *lgp; 247 struct mbuf *m; 248 249 LAGG_WLOCK(sc); 250 for (;;) { 251 IF_DEQUEUE(&lsc->lsc_queue, m); 252 if (m == NULL) 253 break; 254 lgp = m->m_pkthdr.rcvif->if_lagg; 255 lacp_pdu_input(lgp, m); 256 } 257 LAGG_WUNLOCK(sc); 258} 259 |
|
205/* | 260/* |
206 * lacp_input: process lacpdu | 261 * lacp_pdu_input: process lacpdu |
207 */ | 262 */ |
208int 209lacp_input(struct lagg_port *lgp, struct mbuf *m) | 263static int 264lacp_pdu_input(struct lagg_port *lgp, struct mbuf *m) |
210{ 211 struct lacp_port *lp = LACP_PORT(lgp); 212 struct lacpdu *du; 213 int error = 0; 214 | 265{ 266 struct lacp_port *lp = LACP_PORT(lgp); 267 struct lacpdu *du; 268 int error = 0; 269 |
215 LAGG_LOCK_ASSERT(lgp->lp_lagg); | 270 LAGG_WLOCK_ASSERT(lgp->lp_lagg); |
216 217 if (__predict_false(lp->lp_flags & LACP_PORT_DETACHING)) { 218 goto bad; 219 } 220 221 if (m->m_pkthdr.len != sizeof(*du)) { 222 goto bad; 223 } --- 74 unchanged lines hidden (view full) --- 298static int 299lacp_xmit_lacpdu(struct lacp_port *lp) 300{ 301 struct lagg_port *lgp = lp->lp_lagg; 302 struct mbuf *m; 303 struct lacpdu *du; 304 int error; 305 | 271 272 if (__predict_false(lp->lp_flags & LACP_PORT_DETACHING)) { 273 goto bad; 274 } 275 276 if (m->m_pkthdr.len != sizeof(*du)) { 277 goto bad; 278 } --- 74 unchanged lines hidden (view full) --- 353static int 354lacp_xmit_lacpdu(struct lacp_port *lp) 355{ 356 struct lagg_port *lgp = lp->lp_lagg; 357 struct mbuf *m; 358 struct lacpdu *du; 359 int error; 360 |
306 LAGG_LOCK_ASSERT(lgp->lp_lagg); | 361 LAGG_WLOCK_ASSERT(lgp->lp_lagg); |
307 308 m = m_gethdr(M_DONTWAIT, MT_DATA); 309 if (m == NULL) { 310 return (ENOMEM); 311 } 312 m->m_len = m->m_pkthdr.len = sizeof(*du); 313 314 du = mtod(m, struct lacpdu *); --- 40 unchanged lines hidden (view full) --- 355 struct lacp_port *lp = LACP_PORT(lgp); 356 struct ifnet *ifp = lgp->lp_ifp; 357 struct ifmediareq ifmr; 358 int error = 0; 359 u_int media; 360 uint8_t old_state; 361 uint16_t old_key; 362 | 362 363 m = m_gethdr(M_DONTWAIT, MT_DATA); 364 if (m == NULL) { 365 return (ENOMEM); 366 } 367 m->m_len = m->m_pkthdr.len = sizeof(*du); 368 369 du = mtod(m, struct lacpdu *); --- 40 unchanged lines hidden (view full) --- 410 struct lacp_port *lp = LACP_PORT(lgp); 411 struct ifnet *ifp = lgp->lp_ifp; 412 struct ifmediareq ifmr; 413 int error = 0; 414 u_int media; 415 uint8_t old_state; 416 uint16_t old_key; 417 |
363 LAGG_LOCK_ASSERT(lgp->lp_lagg); | 418 LAGG_WLOCK_ASSERT(lgp->lp_lagg); |
364 365 bzero((char *)&ifmr, sizeof(ifmr)); 366 error = (*ifp->if_ioctl)(ifp, SIOCGIFMEDIA, (caddr_t)&ifmr); 367 if (error != 0) 368 return; 369 370 media = ifmr.ifm_active; 371 LACP_DPRINTF((lp, "media changed 0x%x -> 0x%x, ether = %d, fdx = %d, " --- 20 unchanged lines hidden (view full) --- 392 lp->lp_selected = LACP_UNSELECTED; 393 } 394} 395 396static void 397lacp_tick(void *arg) 398{ 399 struct lacp_softc *lsc = arg; | 419 420 bzero((char *)&ifmr, sizeof(ifmr)); 421 error = (*ifp->if_ioctl)(ifp, SIOCGIFMEDIA, (caddr_t)&ifmr); 422 if (error != 0) 423 return; 424 425 media = ifmr.ifm_active; 426 LACP_DPRINTF((lp, "media changed 0x%x -> 0x%x, ether = %d, fdx = %d, " --- 20 unchanged lines hidden (view full) --- 447 lp->lp_selected = LACP_UNSELECTED; 448 } 449} 450 451static void 452lacp_tick(void *arg) 453{ 454 struct lacp_softc *lsc = arg; |
455 struct lagg_softc *sc = lsc->lsc_lagg; |
|
400 struct lacp_port *lp; 401 | 456 struct lacp_port *lp; 457 |
458 LAGG_WLOCK(sc); |
|
402 LIST_FOREACH(lp, &lsc->lsc_ports, lp_next) { 403 if ((lp->lp_state & LACP_STATE_AGGREGATION) == 0) 404 continue; 405 406 lacp_run_timers(lp); 407 408 lacp_select(lp); 409 lacp_sm_mux(lp); 410 lacp_sm_tx(lp); 411 lacp_sm_ptx_tx_schedule(lp); 412 } | 459 LIST_FOREACH(lp, &lsc->lsc_ports, lp_next) { 460 if ((lp->lp_state & LACP_STATE_AGGREGATION) == 0) 461 continue; 462 463 lacp_run_timers(lp); 464 465 lacp_select(lp); 466 lacp_sm_mux(lp); 467 lacp_sm_tx(lp); 468 lacp_sm_ptx_tx_schedule(lp); 469 } |
470 LAGG_WUNLOCK(sc); |
|
413 callout_reset(&lsc->lsc_callout, hz, lacp_tick, lsc); 414} 415 416int 417lacp_port_create(struct lagg_port *lgp) 418{ 419 struct lagg_softc *lgs = lgp->lp_lagg; 420 struct lacp_softc *lsc = LACP_SOFTC(lgs); 421 struct lacp_port *lp; 422 struct ifnet *ifp = lgp->lp_ifp; 423 struct sockaddr_dl sdl; 424 struct ifmultiaddr *rifma = NULL; 425 int error; 426 427 boolean_t active = TRUE; /* XXX should be configurable */ 428 boolean_t fast = FALSE; /* XXX should be configurable */ 429 | 471 callout_reset(&lsc->lsc_callout, hz, lacp_tick, lsc); 472} 473 474int 475lacp_port_create(struct lagg_port *lgp) 476{ 477 struct lagg_softc *lgs = lgp->lp_lagg; 478 struct lacp_softc *lsc = LACP_SOFTC(lgs); 479 struct lacp_port *lp; 480 struct ifnet *ifp = lgp->lp_ifp; 481 struct sockaddr_dl sdl; 482 struct ifmultiaddr *rifma = NULL; 483 int error; 484 485 boolean_t active = TRUE; /* XXX should be configurable */ 486 boolean_t fast = FALSE; /* XXX should be configurable */ 487 |
430 LAGG_LOCK_ASSERT(lgs); | 488 LAGG_WLOCK_ASSERT(lgs); |
431 432 bzero((char *)&sdl, sizeof(sdl)); 433 sdl.sdl_len = sizeof(sdl); 434 sdl.sdl_family = AF_LINK; 435 sdl.sdl_index = ifp->if_index; 436 sdl.sdl_type = IFT_ETHER; 437 sdl.sdl_alen = ETHER_ADDR_LEN; 438 --- 30 unchanged lines hidden (view full) --- 469} 470 471void 472lacp_port_destroy(struct lagg_port *lgp) 473{ 474 struct lacp_port *lp = LACP_PORT(lgp); 475 int i; 476 | 489 490 bzero((char *)&sdl, sizeof(sdl)); 491 sdl.sdl_len = sizeof(sdl); 492 sdl.sdl_family = AF_LINK; 493 sdl.sdl_index = ifp->if_index; 494 sdl.sdl_type = IFT_ETHER; 495 sdl.sdl_alen = ETHER_ADDR_LEN; 496 --- 30 unchanged lines hidden (view full) --- 527} 528 529void 530lacp_port_destroy(struct lagg_port *lgp) 531{ 532 struct lacp_port *lp = LACP_PORT(lgp); 533 int i; 534 |
477 LAGG_LOCK_ASSERT(lgp->lp_lagg); | 535 LAGG_WLOCK_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); --- 48 unchanged lines hidden (view full) --- 534{ 535 struct lacp_aggregator *la = lp->lp_aggregator; 536 struct lacp_softc *lsc = lp->lp_lsc; 537 struct lagg_port *lgp = lp->lp_lagg; 538#if defined(LACP_DEBUG) 539 char buf[LACP_LAGIDSTR_MAX+1]; 540#endif /* defined(LACP_DEBUG) */ 541 | 536 537 for (i = 0; i < LACP_NTIMER; i++) { 538 LACP_TIMER_DISARM(lp, i); 539 } 540 541 lacp_disable_collecting(lp); 542 lacp_disable_distributing(lp); 543 lacp_unselect(lp); --- 48 unchanged lines hidden (view full) --- 592{ 593 struct lacp_aggregator *la = lp->lp_aggregator; 594 struct lacp_softc *lsc = lp->lp_lsc; 595 struct lagg_port *lgp = lp->lp_lagg; 596#if defined(LACP_DEBUG) 597 char buf[LACP_LAGIDSTR_MAX+1]; 598#endif /* defined(LACP_DEBUG) */ 599 |
542 LAGG_LOCK_ASSERT(lgp->lp_lagg); | 600 LAGG_WLOCK_ASSERT(lgp->lp_lagg); |
543 544 if (la == NULL || (lp->lp_state & LACP_STATE_DISTRIBUTING) == 0) { 545 return; 546 } 547 548 KASSERT(!TAILQ_EMPTY(&la->la_ports), ("no aggregator ports")); 549 KASSERT(la->la_nports > 0, ("nports invalid (%d)", la->la_nports)); 550 KASSERT(la->la_refcnt >= la->la_nports, ("aggregator refcnt invalid")); --- 21 unchanged lines hidden (view full) --- 572{ 573 struct lacp_aggregator *la = lp->lp_aggregator; 574 struct lacp_softc *lsc = lp->lp_lsc; 575 struct lagg_port *lgp = lp->lp_lagg; 576#if defined(LACP_DEBUG) 577 char buf[LACP_LAGIDSTR_MAX+1]; 578#endif /* defined(LACP_DEBUG) */ 579 | 601 602 if (la == NULL || (lp->lp_state & LACP_STATE_DISTRIBUTING) == 0) { 603 return; 604 } 605 606 KASSERT(!TAILQ_EMPTY(&la->la_ports), ("no aggregator ports")); 607 KASSERT(la->la_nports > 0, ("nports invalid (%d)", la->la_nports)); 608 KASSERT(la->la_refcnt >= la->la_nports, ("aggregator refcnt invalid")); --- 21 unchanged lines hidden (view full) --- 630{ 631 struct lacp_aggregator *la = lp->lp_aggregator; 632 struct lacp_softc *lsc = lp->lp_lsc; 633 struct lagg_port *lgp = lp->lp_lagg; 634#if defined(LACP_DEBUG) 635 char buf[LACP_LAGIDSTR_MAX+1]; 636#endif /* defined(LACP_DEBUG) */ 637 |
580 LAGG_LOCK_ASSERT(lgp->lp_lagg); | 638 LAGG_WLOCK_ASSERT(lgp->lp_lagg); |
581 582 if ((lp->lp_state & LACP_STATE_DISTRIBUTING) != 0) { 583 return; 584 } 585 586 LACP_DPRINTF((lp, "enable distributing on aggregator %s, " 587 "nports %d -> %d\n", 588 lacp_format_lagid_aggregator(la, buf, sizeof(buf)), --- 22 unchanged lines hidden (view full) --- 611 lsc->lsc_suppress_distributing = FALSE; 612} 613 614int 615lacp_attach(struct lagg_softc *lgs) 616{ 617 struct lacp_softc *lsc; 618 | 639 640 if ((lp->lp_state & LACP_STATE_DISTRIBUTING) != 0) { 641 return; 642 } 643 644 LACP_DPRINTF((lp, "enable distributing on aggregator %s, " 645 "nports %d -> %d\n", 646 lacp_format_lagid_aggregator(la, buf, sizeof(buf)), --- 22 unchanged lines hidden (view full) --- 669 lsc->lsc_suppress_distributing = FALSE; 670} 671 672int 673lacp_attach(struct lagg_softc *lgs) 674{ 675 struct lacp_softc *lsc; 676 |
619 LAGG_LOCK_ASSERT(lgs); | 677 LAGG_WLOCK_ASSERT(lgs); |
620 621 lsc = malloc(sizeof(struct lacp_softc), 622 M_DEVBUF, M_NOWAIT|M_ZERO); 623 if (lsc == NULL) 624 return (ENOMEM); 625 626 lgs->sc_psc = (caddr_t)lsc; 627 lsc->lsc_lagg = lgs; 628 629 lsc->lsc_hashkey = arc4random(); 630 lsc->lsc_active_aggregator = NULL; 631 TAILQ_INIT(&lsc->lsc_aggregators); 632 LIST_INIT(&lsc->lsc_ports); 633 | 678 679 lsc = malloc(sizeof(struct lacp_softc), 680 M_DEVBUF, M_NOWAIT|M_ZERO); 681 if (lsc == NULL) 682 return (ENOMEM); 683 684 lgs->sc_psc = (caddr_t)lsc; 685 lsc->lsc_lagg = lgs; 686 687 lsc->lsc_hashkey = arc4random(); 688 lsc->lsc_active_aggregator = NULL; 689 TAILQ_INIT(&lsc->lsc_aggregators); 690 LIST_INIT(&lsc->lsc_ports); 691 |
634 callout_init_mtx(&lsc->lsc_transit_callout, &lgs->sc_mtx, 0); 635 callout_init_mtx(&lsc->lsc_callout, &lgs->sc_mtx, 0); | 692 TASK_INIT(&lsc->lsc_qtask, 0, lacp_dequeue, lsc); 693 mtx_init(&lsc->lsc_queue.ifq_mtx, "lacp queue", NULL, MTX_DEF); 694 lsc->lsc_queue.ifq_maxlen = ifqmaxlen; |
636 | 695 |
696 callout_init(&lsc->lsc_transit_callout, CALLOUT_MPSAFE); 697 callout_init(&lsc->lsc_callout, CALLOUT_MPSAFE); 698 |
|
637 /* if the lagg is already up then do the same */ 638 if (lgs->sc_ifp->if_drv_flags & IFF_DRV_RUNNING) 639 lacp_init(lgs); 640 641 return (0); 642} 643 644int --- 4 unchanged lines hidden (view full) --- 649 KASSERT(TAILQ_EMPTY(&lsc->lsc_aggregators), 650 ("aggregators still active")); 651 KASSERT(lsc->lsc_active_aggregator == NULL, 652 ("aggregator still attached")); 653 654 lgs->sc_psc = NULL; 655 callout_drain(&lsc->lsc_transit_callout); 656 callout_drain(&lsc->lsc_callout); | 699 /* if the lagg is already up then do the same */ 700 if (lgs->sc_ifp->if_drv_flags & IFF_DRV_RUNNING) 701 lacp_init(lgs); 702 703 return (0); 704} 705 706int --- 4 unchanged lines hidden (view full) --- 711 KASSERT(TAILQ_EMPTY(&lsc->lsc_aggregators), 712 ("aggregators still active")); 713 KASSERT(lsc->lsc_active_aggregator == NULL, 714 ("aggregator still attached")); 715 716 lgs->sc_psc = NULL; 717 callout_drain(&lsc->lsc_transit_callout); 718 callout_drain(&lsc->lsc_callout); |
719 taskqueue_drain(taskqueue_swi, &lsc->lsc_qtask); 720 IF_DRAIN(&lsc->lsc_queue); 721 mtx_destroy(&lsc->lsc_queue.ifq_mtx); |
|
657 658 free(lsc, M_DEVBUF); 659 return (0); 660} 661 662void 663lacp_init(struct lagg_softc *lgs) 664{ --- 15 unchanged lines hidden (view full) --- 680lacp_select_tx_port(struct lagg_softc *lgs, struct mbuf *m) 681{ 682 struct lacp_softc *lsc = LACP_SOFTC(lgs); 683 struct lacp_aggregator *la; 684 struct lacp_port *lp; 685 uint32_t hash; 686 int nports; 687 | 722 723 free(lsc, M_DEVBUF); 724 return (0); 725} 726 727void 728lacp_init(struct lagg_softc *lgs) 729{ --- 15 unchanged lines hidden (view full) --- 745lacp_select_tx_port(struct lagg_softc *lgs, struct mbuf *m) 746{ 747 struct lacp_softc *lsc = LACP_SOFTC(lgs); 748 struct lacp_aggregator *la; 749 struct lacp_port *lp; 750 uint32_t hash; 751 int nports; 752 |
688 LAGG_LOCK_ASSERT(lgs); | 753 LAGG_WLOCK_ASSERT(lgs); |
689 690 if (__predict_false(lsc->lsc_suppress_distributing)) { 691 LACP_DPRINTF((NULL, "%s: waiting transit\n", __func__)); 692 return (NULL); 693 } 694 695 la = lsc->lsc_active_aggregator; 696 if (__predict_false(la == NULL)) { --- 836 unchanged lines hidden (view full) --- 1533 1534int 1535lacp_marker_input(struct lagg_port *lgp, struct mbuf *m) 1536{ 1537 struct lacp_port *lp = LACP_PORT(lgp); 1538 struct markerdu *mdu; 1539 int error = 0; 1540 | 754 755 if (__predict_false(lsc->lsc_suppress_distributing)) { 756 LACP_DPRINTF((NULL, "%s: waiting transit\n", __func__)); 757 return (NULL); 758 } 759 760 la = lsc->lsc_active_aggregator; 761 if (__predict_false(la == NULL)) { --- 836 unchanged lines hidden (view full) --- 1598 1599int 1600lacp_marker_input(struct lagg_port *lgp, struct mbuf *m) 1601{ 1602 struct lacp_port *lp = LACP_PORT(lgp); 1603 struct markerdu *mdu; 1604 int error = 0; 1605 |
1541 LAGG_LOCK_ASSERT(lgp->lp_lagg); | 1606 LAGG_RLOCK_ASSERT(lgp->lp_lagg); |
1542 1543 if (__predict_false(lp->lp_flags & LACP_PORT_DETACHING)) { 1544 goto bad; 1545 } 1546 1547 if (m->m_pkthdr.len != sizeof(*mdu)) { 1548 goto bad; 1549 } --- 217 unchanged lines hidden --- | 1607 1608 if (__predict_false(lp->lp_flags & LACP_PORT_DETACHING)) { 1609 goto bad; 1610 } 1611 1612 if (m->m_pkthdr.len != sizeof(*mdu)) { 1613 goto bad; 1614 } --- 217 unchanged lines hidden --- |