Date: Tue, 17 Apr 2007 06:03:05 GMT From: Scott Long <scottl@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 118290 for review Message-ID: <200704170603.l3H635t3005120@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=118290 Change 118290 by scottl@scottl-wv1u on 2007/04/17 06:02:55 IFC Affected files ... .. //depot/projects/scottl-camlock/src/sys/cam/cam_xpt.c#58 integrate .. //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_sg.c#8 integrate .. //depot/projects/scottl-camlock/src/sys/conf/NOTES#22 integrate .. //depot/projects/scottl-camlock/src/sys/conf/files#21 integrate .. //depot/projects/scottl-camlock/src/sys/dev/iicbus/icee.c#2 integrate .. //depot/projects/scottl-camlock/src/sys/kern/subr_rman.c#13 integrate .. //depot/projects/scottl-camlock/src/sys/modules/Makefile#21 integrate .. //depot/projects/scottl-camlock/src/sys/modules/if_lagg/Makefile#1 branch .. //depot/projects/scottl-camlock/src/sys/modules/if_trunk/Makefile#2 delete .. //depot/projects/scottl-camlock/src/sys/net/ieee8023ad_lacp.c#2 integrate .. //depot/projects/scottl-camlock/src/sys/net/ieee8023ad_lacp.h#2 integrate .. //depot/projects/scottl-camlock/src/sys/net/if.c#17 integrate .. //depot/projects/scottl-camlock/src/sys/net/if_ethersubr.c#14 integrate .. //depot/projects/scottl-camlock/src/sys/net/if_lagg.c#1 branch .. //depot/projects/scottl-camlock/src/sys/net/if_lagg.h#1 branch .. //depot/projects/scottl-camlock/src/sys/net/if_trunk.c#3 delete .. //depot/projects/scottl-camlock/src/sys/net/if_trunk.h#2 delete .. //depot/projects/scottl-camlock/src/sys/net/if_var.h#11 integrate .. //depot/projects/scottl-camlock/src/sys/sys/priv.h#5 integrate Differences ... ==== //depot/projects/scottl-camlock/src/sys/cam/cam_xpt.c#58 (text+ko) ==== @@ -28,7 +28,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/cam/cam_xpt.c,v 1.176 2007/04/15 08:49:09 scottl Exp $"); +__FBSDID("$FreeBSD: src/sys/cam/cam_xpt.c,v 1.177 2007/04/16 19:55:36 scottl Exp $"); #include <sys/param.h> #include <sys/bus.h> @@ -74,7 +74,8 @@ /* Object for defering XPT actions to a taskqueue */ struct xpt_task { struct task task; - void *data; + void *data1; + uintptr_t data2; }; /* @@ -2952,62 +2953,13 @@ static void xpt_action_sasync_cb(void *context, int pending) { - union ccb *start_ccb; + struct async_node *cur_entry; struct xpt_task *task; - struct ccb_setasync *csa; - struct async_node *cur_entry; - struct async_list *async_head; - u_int32_t added; - int s; + uint32_t added; task = (struct xpt_task *)context; - start_ccb = (union ccb *)task->data; - csa = &start_ccb->csa; - added = csa->event_enable; - async_head = &csa->ccb_h.path->device->asyncs; - - /* - * If there is already an entry for us, simply - * update it. - */ - s = splcam(); - mtx_lock(csa->ccb_h.path->bus->sim->mtx); - cur_entry = SLIST_FIRST(async_head); - while (cur_entry != NULL) { - if ((cur_entry->callback_arg == csa->callback_arg) - && (cur_entry->callback == csa->callback)) - break; - cur_entry = SLIST_NEXT(cur_entry, links); - } - - if (cur_entry != NULL) { - /* - * If the request has no flags set, - * remove the entry. - */ - added &= ~cur_entry->event_enable; - if (csa->event_enable == 0) { - SLIST_REMOVE(async_head, cur_entry, - async_node, links); - csa->ccb_h.path->device->refcount--; - free(cur_entry, M_CAMXPT); - } else { - cur_entry->event_enable = csa->event_enable; - } - } else { - cur_entry = malloc(sizeof(*cur_entry), M_CAMXPT, - M_NOWAIT); - if (cur_entry == NULL) { - splx(s); - goto out; - } - cur_entry->event_enable = csa->event_enable; - cur_entry->callback_arg = csa->callback_arg; - cur_entry->callback = csa->callback; - SLIST_INSERT_HEAD(async_head, cur_entry, links); - csa->ccb_h.path->device->refcount++; - } - mtx_unlock(csa->ccb_h.path->bus->sim->mtx); + cur_entry = (struct async_node *)task->data1; + added = task->data2; if ((added & AC_FOUND_DEVICE) != 0) { /* @@ -3023,11 +2975,7 @@ */ xpt_for_all_busses(xptsetasyncbusfunc, cur_entry); } - splx(s); -out: - xpt_free_path(start_ccb->ccb_h.path); - xpt_free_ccb(start_ccb); free(task, M_CAMXPT); } @@ -3433,42 +3381,75 @@ } case XPT_SASYNC_CB: { - union ccb *task_ccb; - struct xpt_task *task; + struct ccb_setasync *csa; + struct async_node *cur_entry; + struct async_list *async_head; + u_int32_t added; + + csa = &start_ccb->csa; + added = csa->event_enable; + async_head = &csa->ccb_h.path->device->asyncs; /* - * Need to decouple this operation via a taqskqueue so that - * the locking doesn't become a mess. Clone the ccb so that - * we own the memory and can free it later. + * If there is already an entry for us, simply + * update it. */ - task_ccb = malloc(sizeof(union ccb), M_CAMXPT, M_NOWAIT); - if (task_ccb == NULL) { - start_ccb->ccb_h.status = CAM_RESRC_UNAVAIL; - break; + cur_entry = SLIST_FIRST(async_head); + while (cur_entry != NULL) { + if ((cur_entry->callback_arg == csa->callback_arg) + && (cur_entry->callback == csa->callback)) + break; + cur_entry = SLIST_NEXT(cur_entry, links); } - bcopy(start_ccb, task_ccb, sizeof(union ccb)); - if (xpt_create_path(&task_ccb->ccb_h.path, NULL, - start_ccb->ccb_h.path_id, - start_ccb->ccb_h.target_id, - start_ccb->ccb_h.target_lun) != - CAM_REQ_CMP) { - start_ccb->ccb_h.status = CAM_RESRC_UNAVAIL; - xpt_free_ccb(task_ccb); - break; + + if (cur_entry != NULL) { + /* + * If the request has no flags set, + * remove the entry. + */ + added &= ~cur_entry->event_enable; + if (csa->event_enable == 0) { + SLIST_REMOVE(async_head, cur_entry, + async_node, links); + csa->ccb_h.path->device->refcount--; + free(cur_entry, M_CAMXPT); + } else { + cur_entry->event_enable = csa->event_enable; + } + } else { + cur_entry = malloc(sizeof(*cur_entry), M_CAMXPT, + M_NOWAIT); + if (cur_entry == NULL) { + csa->ccb_h.status = CAM_RESRC_UNAVAIL; + break; + } + cur_entry->event_enable = csa->event_enable; + cur_entry->callback_arg = csa->callback_arg; + cur_entry->callback = csa->callback; + SLIST_INSERT_HEAD(async_head, cur_entry, links); + csa->ccb_h.path->device->refcount++; } - task = malloc(sizeof(struct xpt_task), M_CAMXPT, M_NOWAIT); - if (task == NULL) { - start_ccb->ccb_h.status = CAM_RESRC_UNAVAIL; - xpt_free_path(task_ccb->ccb_h.path); - xpt_free_ccb(task_ccb); - break; + /* + * Need to decouple this operation via a taqskqueue so that + * the locking doesn't become a mess. + */ + if ((added & (AC_FOUND_DEVICE | AC_PATH_REGISTERED)) != 0) { + struct xpt_task *task; + + task = malloc(sizeof(struct xpt_task), M_CAMXPT, + M_NOWAIT); + if (task == NULL) { + csa->ccb_h.status = CAM_RESRC_UNAVAIL; + break; + } + + TASK_INIT(&task->task, 0, xpt_action_sasync_cb, task); + task->data1 = cur_entry; + task->data2 = added; + taskqueue_enqueue(taskqueue_thread, &task->task); } - TASK_INIT(&task->task, 0, xpt_action_sasync_cb, task); - task->data = task_ccb; - taskqueue_enqueue(taskqueue_thread, &task->task); - start_ccb->ccb_h.status = CAM_REQ_CMP; break; } ==== //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_sg.c#8 (text+ko) ==== @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/cam/scsi/scsi_sg.c,v 1.6 2007/04/16 19:40:13 scottl Exp $"); +__FBSDID("$FreeBSD: src/sys/cam/scsi/scsi_sg.c,v 1.7 2007/04/17 01:12:35 scottl Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -103,7 +103,6 @@ struct devstat *device_stats; TAILQ_HEAD(, sg_rdwr) rdwr_done; struct cdev *dev; - struct cdev *devalias; int sg_timeout; int sg_user_timeout; uint8_t pd_type; @@ -223,7 +222,6 @@ softc = (struct sg_softc *)periph->softc; devstat_remove_entry(softc->device_stats); - destroy_dev(softc->devalias); destroy_dev(softc->dev); if (bootverbose) { xpt_print(periph->path, "removing device entry\n"); @@ -323,8 +321,7 @@ softc->dev = make_dev(&sg_cdevsw, unit2minor(periph->unit_number), UID_ROOT, GID_OPERATOR, 0600, "%s%d", periph->periph_name, periph->unit_number); - softc->devalias = make_dev_alias(softc->dev, "sg%c", - 'a' + periph->unit_number); + (void)make_dev_alias(softc->dev, "sg%c", 'a' + periph->unit_number); cam_periph_lock(periph); softc->dev->si_drv1 = periph; ==== //depot/projects/scottl-camlock/src/sys/conf/NOTES#22 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/conf/NOTES,v 1.1421 2007/04/10 03:09:38 thompsa Exp $ +# $FreeBSD: src/sys/conf/NOTES,v 1.1422 2007/04/17 00:35:10 thompsa Exp $ # # NOTES -- Lines that can be cut/pasted into kernel and hints configs. # @@ -813,7 +813,7 @@ options PPP_BSDCOMP #PPP BSD-compress support options PPP_DEFLATE #PPP zlib/deflate/gzip support options PPP_FILTER #enable bpf filtering (needs bpf) -device trunk #Trunk aggregation interface +device lagg #Link aggregation interface device ef # Multiple ethernet frames support options ETHER_II # enable Ethernet_II frame ==== //depot/projects/scottl-camlock/src/sys/conf/files#21 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/conf/files,v 1.1195 2007/04/10 00:35:31 thompsa Exp $ +# $FreeBSD: src/sys/conf/files,v 1.1196 2007/04/17 00:35:10 thompsa Exp $ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and @@ -1527,7 +1527,7 @@ net/bpf_filter.c optional bpf | netgraph_bpf net/bridgestp.c optional if_bridge net/bsd_comp.c optional ppp_bsdcomp -net/ieee8023ad_lacp.c optional trunk +net/ieee8023ad_lacp.c optional lagg net/if.c standard net/if_arcsubr.c optional arcnet net/if_atmsubr.c optional atm @@ -1544,6 +1544,7 @@ net/if_gif.c optional gif net/if_gre.c optional gre net/if_iso88025subr.c optional token +net/if_lagg.c optional lagg net/if_loop.c optional loop net/if_media.c standard net/if_mib.c standard @@ -1554,7 +1555,6 @@ net/if_stf.c optional stf net/if_tun.c optional tun net/if_tap.c optional tap -net/if_trunk.c optional trunk net/if_vlan.c optional vlan net/netisr.c standard net/ppp_deflate.c optional ppp_deflate ==== //depot/projects/scottl-camlock/src/sys/dev/iicbus/icee.c#2 (text+ko) ==== @@ -23,7 +23,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/iicbus/icee.c,v 1.1 2007/03/23 23:10:35 imp Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/iicbus/icee.c,v 1.2 2007/04/17 05:48:35 imp Exp $"); /* * Generic IIC eeprom support, modeled after the AT24C family of products. */ @@ -59,10 +59,10 @@ int wr_sz; /* What's the write page size */ }; -#define ICEE_LOCK(_sc) mtx_lock_spin(&(_sc)->sc_mtx) -#define ICEE_UNLOCK(_sc) mtx_unlock_spin(&(_sc)->sc_mtx) +#define ICEE_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) +#define ICEE_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) #define ICEE_LOCK_INIT(_sc) \ - mtx_init(&_sc->sc_mtx, device_get_nameunit(_sc->sc_dev), "icee", MTX_SPIN) + mtx_init(&_sc->sc_mtx, device_get_nameunit(_sc->sc_dev), "icee", MTX_DEF) #define ICEE_LOCK_DESTROY(_sc) mtx_destroy(&_sc->sc_mtx); #define ICEE_ASSERT_LOCKED(_sc) mtx_assert(&_sc->sc_mtx, MA_OWNED); #define ICEE_ASSERT_UNLOCKED(_sc) mtx_assert(&_sc->sc_mtx, MA_NOTOWNED); ==== //depot/projects/scottl-camlock/src/sys/kern/subr_rman.c#13 (text+ko) ==== @@ -55,8 +55,10 @@ * permitted. */ +#include "opt_ddb.h" + #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/subr_rman.c,v 1.55 2007/02/23 22:53:56 scottl Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/subr_rman.c,v 1.56 2007/04/16 21:09:03 jhb Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -70,6 +72,10 @@ #include <sys/rman.h> #include <sys/sysctl.h> +#ifdef DDB +#include <ddb/ddb.h> +#endif + /* * We use a linked list rather than a bitmap because we need to be able to * represent potentially huge objects (like all of a processor's physical @@ -911,3 +917,47 @@ SYSCTL_NODE(_hw_bus, OID_AUTO, rman, CTLFLAG_RD, sysctl_rman, "kernel resource manager"); + +#ifdef DDB +static void +dump_rman(struct rman *rm) +{ + struct resource_i *r; + const char *devname; + + if (db_pager_quit) + return; + db_printf("rman: %s\n", rm->rm_descr); + db_printf(" 0x%lx-0x%lx (full range)\n", rm->rm_start, rm->rm_end); + TAILQ_FOREACH(r, &rm->rm_list, r_link) { + if (r->r_dev != NULL) { + devname = device_get_nameunit(r->r_dev); + if (devname == NULL) + devname = "nomatch"; + } else + devname = NULL; + db_printf(" 0x%lx-0x%lx ", r->r_start, r->r_end); + if (devname != NULL) + db_printf("(%s)\n", devname); + else + db_printf("----\n"); + if (db_pager_quit) + return; + } +} + +DB_SHOW_COMMAND(rman, db_show_rman) +{ + + if (have_addr) + dump_rman((struct rman *)addr); +} + +DB_SHOW_COMMAND(allrman, db_show_all_rman) +{ + struct rman *rm; + + TAILQ_FOREACH(rm, &rman_head, rm_link) + dump_rman(rm); +} +#endif ==== //depot/projects/scottl-camlock/src/sys/modules/Makefile#21 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/modules/Makefile,v 1.527 2007/04/10 00:41:31 thompsa Exp $ +# $FreeBSD: src/sys/modules/Makefile,v 1.528 2007/04/17 00:35:10 thompsa Exp $ .include <bsd.own.mk> @@ -108,12 +108,12 @@ if_faith \ if_gif \ if_gre \ + if_lagg \ ${_if_ndis} \ if_ppp \ if_sl \ if_stf \ if_tap \ - if_trunk \ if_tun \ if_vlan \ ${_iir} \ ==== //depot/projects/scottl-camlock/src/sys/net/ieee8023ad_lacp.c#2 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/net/ieee8023ad_lacp.c,v 1.1 2007/04/10 00:27:25 thompsa Exp $"); +__FBSDID("$FreeBSD: src/sys/net/ieee8023ad_lacp.c,v 1.2 2007/04/17 00:35:11 thompsa Exp $"); #include <sys/param.h> #include <sys/callout.h> @@ -45,7 +45,7 @@ #include <net/if_media.h> #include <net/if_types.h> -#include <net/if_trunk.h> +#include <net/if_lagg.h> #include <net/ieee8023ad_lacp.h> /* @@ -206,13 +206,13 @@ * lacp_input: process lacpdu */ int -lacp_input(struct trunk_port *tp, struct mbuf *m) +lacp_input(struct lagg_port *lgp, struct mbuf *m) { - struct lacp_port *lp = LACP_PORT(tp); + struct lacp_port *lp = LACP_PORT(lgp); struct lacpdu *du; int error = 0; - TRUNK_LOCK_ASSERT(tp->tp_trunk); + LAGG_LOCK_ASSERT(lgp->lp_lagg); if (__predict_false(lp->lp_flags & LACP_PORT_DETACHING)) { goto bad; @@ -284,12 +284,12 @@ static void lacp_fill_actorinfo(struct lacp_port *lp, struct lacp_peerinfo *info) { - struct trunk_port *tp = lp->lp_trunk; - struct trunk_softc *tr = tp->tp_trunk; + struct lagg_port *lgp = lp->lp_lagg; + struct lagg_softc *lgs = lgp->lp_lagg; info->lip_systemid.lsi_prio = htons(LACP_SYSTEM_PRIO); memcpy(&info->lip_systemid.lsi_mac, - IF_LLADDR(tr->tr_ifp), ETHER_ADDR_LEN); + IF_LLADDR(lgs->sc_ifp), ETHER_ADDR_LEN); info->lip_portid.lpi_prio = htons(LACP_PORT_PRIO); info->lip_portid.lpi_portno = htons(lp->lp_ifp->if_index); info->lip_state = lp->lp_state; @@ -298,12 +298,12 @@ static int lacp_xmit_lacpdu(struct lacp_port *lp) { - struct trunk_port *tp = lp->lp_trunk; + struct lagg_port *lgp = lp->lp_lagg; struct mbuf *m; struct lacpdu *du; int error; - TRUNK_LOCK_ASSERT(tp->tp_trunk); + LAGG_LOCK_ASSERT(lgp->lp_lagg); m = m_gethdr(M_DONTWAIT, MT_DATA); if (m == NULL) { @@ -316,7 +316,7 @@ memcpy(&du->ldu_eh.ether_dhost, ethermulticastaddr_slowprotocols, ETHER_ADDR_LEN); - memcpy(&du->ldu_eh.ether_shost, tp->tp_lladdr, ETHER_ADDR_LEN); + memcpy(&du->ldu_eh.ether_shost, lgp->lp_lladdr, ETHER_ADDR_LEN); du->ldu_eh.ether_type = htons(ETHERTYPE_SLOW); du->ldu_sph.sph_subtype = SLOWPROTOCOLS_SUBTYPE_LACP; @@ -345,22 +345,22 @@ * otherwise network congestion can break aggregation. */ - error = trunk_enqueue(lp->lp_ifp, m); + error = lagg_enqueue(lp->lp_ifp, m); return (error); } void -lacp_linkstate(struct trunk_port *tp) +lacp_linkstate(struct lagg_port *lgp) { - struct lacp_port *lp = LACP_PORT(tp); - struct ifnet *ifp = tp->tp_ifp; + struct lacp_port *lp = LACP_PORT(lgp); + struct ifnet *ifp = lgp->lp_ifp; struct ifmediareq ifmr; int error = 0; u_int media; uint8_t old_state; uint16_t old_key; - TRUNK_LOCK_ASSERT(tp->tp_trunk); + LAGG_LOCK_ASSERT(lgp->lp_lagg); bzero((char *)&ifmr, sizeof(ifmr)); error = (*ifp->if_ioctl)(ifp, SIOCGIFMEDIA, (caddr_t)&ifmr); @@ -407,12 +407,12 @@ } int -lacp_port_create(struct trunk_port *tp) +lacp_port_create(struct lagg_port *lgp) { - struct trunk_softc *tr = tp->tp_trunk; - struct lacp_softc *lsc = LACP_SOFTC(tr); + struct lagg_softc *lgs = lgp->lp_lagg; + struct lacp_softc *lsc = LACP_SOFTC(lgs); struct lacp_port *lp; - struct ifnet *ifp = tp->tp_ifp; + struct ifnet *ifp = lgp->lp_ifp; struct sockaddr_dl sdl; struct ifmultiaddr *rifma = NULL; int error; @@ -420,7 +420,7 @@ boolean_t active = TRUE; /* XXX should be configurable */ boolean_t fast = FALSE; /* XXX should be configurable */ - TRUNK_LOCK_ASSERT(tr); + LAGG_LOCK_ASSERT(lgs); bzero((char *)&sdl, sizeof(sdl)); sdl.sdl_len = sizeof(sdl); @@ -433,7 +433,7 @@ LLADDR(&sdl), ETHER_ADDR_LEN); error = if_addmulti(ifp, (struct sockaddr *)&sdl, &rifma); if (error) { - printf("%s: ADDMULTI failed on %s\n", __func__, tp->tp_ifname); + printf("%s: ADDMULTI failed on %s\n", __func__, lgp->lp_ifname); return (error); } @@ -442,9 +442,9 @@ if (lp == NULL) return (ENOMEM); - tp->tp_psc = (caddr_t)lp; + lgp->lp_psc = (caddr_t)lp; lp->lp_ifp = ifp; - lp->lp_trunk = tp; + lp->lp_lagg = lgp; lp->lp_lsc = lsc; LIST_INSERT_HEAD(&lsc->lsc_ports, lp, lp_next); @@ -454,21 +454,21 @@ (active ? LACP_STATE_ACTIVITY : 0) | (fast ? LACP_STATE_TIMEOUT : 0); lp->lp_aggregator = NULL; - lacp_linkstate(tp); + lacp_linkstate(lgp); lacp_sm_rx_set_expired(lp); return (0); } void -lacp_port_destroy(struct trunk_port *tp) +lacp_port_destroy(struct lagg_port *lgp) { - struct lacp_port *lp = LACP_PORT(tp); - struct ifnet *ifp = tp->tp_ifp; + struct lacp_port *lp = LACP_PORT(lgp); + struct ifnet *ifp = lgp->lp_ifp; struct sockaddr_dl sdl; int i, error; - TRUNK_LOCK_ASSERT(tp->tp_trunk); + LAGG_LOCK_ASSERT(lgp->lp_lagg); for (i = 0; i < LACP_NTIMER; i++) { LACP_TIMER_DISARM(lp, i); @@ -489,16 +489,16 @@ LLADDR(&sdl), ETHER_ADDR_LEN); error = if_delmulti(ifp, (struct sockaddr *)&sdl); if (error) - printf("%s: DELMULTI failed on %s\n", __func__, tp->tp_ifname); + printf("%s: DELMULTI failed on %s\n", __func__, lgp->lp_ifname); LIST_REMOVE(lp, lp_next); free(lp, M_DEVBUF); } int -lacp_port_isactive(struct trunk_port *tp) +lacp_port_isactive(struct lagg_port *lgp) { - struct lacp_port *lp = LACP_PORT(tp); + struct lacp_port *lp = LACP_PORT(lgp); struct lacp_softc *lsc = lp->lp_lsc; struct lacp_aggregator *la = lp->lp_aggregator; @@ -512,23 +512,23 @@ static void lacp_disable_collecting(struct lacp_port *lp) { - struct trunk_port *tp = lp->lp_trunk; + struct lagg_port *lgp = lp->lp_lagg; LACP_DPRINTF((lp, "collecting disabled\n")); lp->lp_state &= ~LACP_STATE_COLLECTING; - tp->tp_flags &= ~TRUNK_PORT_COLLECTING; + lgp->lp_flags &= ~LAGG_PORT_COLLECTING; } static void lacp_enable_collecting(struct lacp_port *lp) { - struct trunk_port *tp = lp->lp_trunk; + struct lagg_port *lgp = lp->lp_lagg; LACP_DPRINTF((lp, "collecting enabled\n")); lp->lp_state |= LACP_STATE_COLLECTING; - tp->tp_flags |= TRUNK_PORT_COLLECTING; + lgp->lp_flags |= LAGG_PORT_COLLECTING; } static void @@ -536,12 +536,12 @@ { struct lacp_aggregator *la = lp->lp_aggregator; struct lacp_softc *lsc = lp->lp_lsc; - struct trunk_port *tp = lp->lp_trunk; + struct lagg_port *lgp = lp->lp_lagg; #if defined(LACP_DEBUG) char buf[LACP_LAGIDSTR_MAX+1]; #endif /* defined(LACP_DEBUG) */ - TRUNK_LOCK_ASSERT(tp->tp_trunk); + LAGG_LOCK_ASSERT(lgp->lp_lagg); if (la == NULL || (lp->lp_state & LACP_STATE_DISTRIBUTING) == 0) { return; @@ -562,7 +562,7 @@ lacp_suppress_distributing(lsc, la); lp->lp_state &= ~LACP_STATE_DISTRIBUTING; - tp->tp_flags &= ~TRUNK_PORT_DISTRIBUTING; + lgp->lp_flags &= ~LAGG_PORT_DISTRIBUTING; if (lsc->lsc_active_aggregator == la) { lacp_select_active_aggregator(lsc); @@ -574,12 +574,12 @@ { struct lacp_aggregator *la = lp->lp_aggregator; struct lacp_softc *lsc = lp->lp_lsc; - struct trunk_port *tp = lp->lp_trunk; + struct lagg_port *lgp = lp->lp_lagg; #if defined(LACP_DEBUG) char buf[LACP_LAGIDSTR_MAX+1]; #endif /* defined(LACP_DEBUG) */ - TRUNK_LOCK_ASSERT(tp->tp_trunk); + LAGG_LOCK_ASSERT(lgp->lp_lagg); if ((lp->lp_state & LACP_STATE_DISTRIBUTING) != 0) { return; @@ -597,7 +597,7 @@ lacp_suppress_distributing(lsc, la); lp->lp_state |= LACP_STATE_DISTRIBUTING; - tp->tp_flags |= TRUNK_PORT_DISTRIBUTING; + lgp->lp_flags |= LAGG_PORT_DISTRIBUTING; if (lsc->lsc_active_aggregator != la) { lacp_select_active_aggregator(lsc); @@ -614,46 +614,46 @@ } int -lacp_attach(struct trunk_softc *tr) +lacp_attach(struct lagg_softc *lgs) { struct lacp_softc *lsc; - TRUNK_LOCK_ASSERT(tr); + LAGG_LOCK_ASSERT(lgs); lsc = malloc(sizeof(struct lacp_softc), M_DEVBUF, M_NOWAIT|M_ZERO); if (lsc == NULL) return (ENOMEM); - tr->tr_psc = (caddr_t)lsc; - lsc->lsc_trunk = tr; + lgs->sc_psc = (caddr_t)lsc; + lsc->lsc_lagg = lgs; lsc->lsc_hashkey = arc4random(); lsc->lsc_active_aggregator = NULL; TAILQ_INIT(&lsc->lsc_aggregators); LIST_INIT(&lsc->lsc_ports); - callout_init_mtx(&lsc->lsc_transit_callout, &tr->tr_mtx, 0); - callout_init_mtx(&lsc->lsc_callout, &tr->tr_mtx, 0); + callout_init_mtx(&lsc->lsc_transit_callout, &lgs->sc_mtx, 0); + callout_init_mtx(&lsc->lsc_callout, &lgs->sc_mtx, 0); - /* if the trunk is already up then do the same */ - if (tr->tr_ifp->if_drv_flags & IFF_DRV_RUNNING) - lacp_init(tr); + /* if the lagg is already up then do the same */ + if (lgs->sc_ifp->if_drv_flags & IFF_DRV_RUNNING) + lacp_init(lgs); return (0); } int -lacp_detach(struct trunk_softc *tr) +lacp_detach(struct lagg_softc *lgs) { - struct lacp_softc *lsc = LACP_SOFTC(tr); + struct lacp_softc *lsc = LACP_SOFTC(lgs); KASSERT(TAILQ_EMPTY(&lsc->lsc_aggregators), ("aggregators still active")); KASSERT(lsc->lsc_active_aggregator == NULL, ("aggregator still attached")); - tr->tr_psc = NULL; + lgs->sc_psc = NULL; callout_drain(&lsc->lsc_transit_callout); callout_drain(&lsc->lsc_callout); @@ -662,32 +662,32 @@ } void -lacp_init(struct trunk_softc *tr) +lacp_init(struct lagg_softc *lgs) { - struct lacp_softc *lsc = LACP_SOFTC(tr); + struct lacp_softc *lsc = LACP_SOFTC(lgs); callout_reset(&lsc->lsc_callout, hz, lacp_tick, lsc); } void -lacp_stop(struct trunk_softc *tr) +lacp_stop(struct lagg_softc *lgs) { - struct lacp_softc *lsc = LACP_SOFTC(tr); + struct lacp_softc *lsc = LACP_SOFTC(lgs); callout_stop(&lsc->lsc_transit_callout); callout_stop(&lsc->lsc_callout); } -struct trunk_port * -lacp_select_tx_port(struct trunk_softc *tr, struct mbuf *m) +struct lagg_port * +lacp_select_tx_port(struct lagg_softc *lgs, struct mbuf *m) { - struct lacp_softc *lsc = LACP_SOFTC(tr); + struct lacp_softc *lsc = LACP_SOFTC(lgs); struct lacp_aggregator *la; struct lacp_port *lp; uint32_t hash; int nports; - TRUNK_LOCK_ASSERT(tr); + LAGG_LOCK_ASSERT(lgs); if (__predict_false(lsc->lsc_suppress_distributing)) { LACP_DPRINTF((NULL, "%s: waiting transit\n", __func__)); @@ -703,7 +703,7 @@ nports = la->la_nports; KASSERT(nports > 0, ("no ports available")); - hash = trunk_hashmbuf(m, lsc->lsc_hashkey); + hash = lagg_hashmbuf(m, lsc->lsc_hashkey); hash %= nports; lp = TAILQ_FIRST(&la->la_ports); while (hash--) { @@ -713,7 +713,7 @@ KASSERT((lp->lp_state & LACP_STATE_DISTRIBUTING) != 0, ("aggregated port is not distributing")); - return (lp->lp_trunk); + return (lp->lp_lagg); } /* * lacp_suppress_distributing: drop transmit packets for a while @@ -780,7 +780,7 @@ /* * lacp_select_active_aggregator: select an aggregator to be used to transmit - * packets from trunk(4) interface. + * packets from lagg(4) interface. */ static void @@ -843,8 +843,8 @@ static uint16_t lacp_compose_key(struct lacp_port *lp) { - struct trunk_port *tp = lp->lp_trunk; - struct trunk_softc *tr = tp->tp_trunk; + struct lagg_port *lgp = lp->lp_lagg; + struct lagg_softc *lgs = lgp->lp_lagg; u_int media = lp->lp_media; uint16_t key; @@ -869,8 +869,8 @@ /* bit 0..4: IFM_SUBTYPE */ key = subtype; - /* bit 5..14: (some bits of) if_index of trunk device */ - key |= 0x7fe0 & ((tr->tr_ifp->if_index) << 5); + /* bit 5..14: (some bits of) if_index of lagg device */ + key |= 0x7fe0 & ((lgs->sc_ifp->if_index) << 5); /* bit 15: 0 */ } return (htons(key)); @@ -1529,13 +1529,13 @@ } int -lacp_marker_input(struct trunk_port *tp, struct mbuf *m) +lacp_marker_input(struct lagg_port *lgp, struct mbuf *m) { - struct lacp_port *lp = LACP_PORT(tp); + struct lacp_port *lp = LACP_PORT(lgp); struct markerdu *mdu; int error = 0; - TRUNK_LOCK_ASSERT(tp->tp_trunk); + LAGG_LOCK_ASSERT(lgp->lp_lagg); if (__predict_false(lp->lp_flags & LACP_PORT_DETACHING)) { goto bad; @@ -1582,8 +1582,8 @@ memcpy(&mdu->mdu_eh.ether_dhost, ðermulticastaddr_slowprotocols, ETHER_ADDR_LEN); memcpy(&mdu->mdu_eh.ether_shost, - tp->tp_lladdr, ETHER_ADDR_LEN); - error = trunk_enqueue(lp->lp_ifp, m); + lgp->lp_lladdr, ETHER_ADDR_LEN); + error = lagg_enqueue(lp->lp_ifp, m); break; case MARKER_TYPE_RESPONSE: ==== //depot/projects/scottl-camlock/src/sys/net/ieee8023ad_lacp.h#2 (text+ko) ==== @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/net/ieee8023ad_lacp.h,v 1.1 2007/04/10 00:27:25 thompsa Exp $ + * $FreeBSD: src/sys/net/ieee8023ad_lacp.h,v 1.2 2007/04/17 00:35:11 thompsa Exp $ */ /* @@ -177,7 +177,7 @@ TAILQ_ENTRY(lacp_port) lp_dist_q; LIST_ENTRY(lacp_port) lp_next; struct lacp_softc *lp_lsc; - struct trunk_port *lp_trunk; + struct lagg_port *lp_lagg; struct ifnet *lp_ifp; struct lacp_peerinfo lp_partner; struct lacp_peerinfo lp_actor; @@ -205,7 +205,7 @@ }; struct lacp_softc { - struct trunk_softc *lsc_trunk; + struct lagg_softc *lsc_lagg; struct lacp_aggregator *lsc_active_aggregator; TAILQ_HEAD(, lacp_aggregator) lsc_aggregators; boolean_t lsc_suppress_distributing; @@ -258,20 +258,20 @@ #define LACP_STATE_EQ(s1, s2, mask) \ ((((s1) ^ (s2)) & (mask)) == 0) -#define LACP_PORT(_tp) ((struct lacp_port *)(_tp)->tp_psc) -#define LACP_SOFTC(_tr) ((struct lacp_softc *)(_tr)->tr_psc) +#define LACP_PORT(_lp) ((struct lacp_port *)(_lp)->lp_psc) +#define LACP_SOFTC(_sc) ((struct lacp_softc *)(_sc)->sc_psc) -int lacp_input(struct trunk_port *, struct mbuf *); -int lacp_marker_input(struct trunk_port *, struct mbuf *); -struct trunk_port *lacp_select_tx_port(struct trunk_softc *, struct mbuf *); -int lacp_attach(struct trunk_softc *); -int lacp_detach(struct trunk_softc *); -void lacp_init(struct trunk_softc *); -void lacp_stop(struct trunk_softc *); -int lacp_port_create(struct trunk_port *); -void lacp_port_destroy(struct trunk_port *); -void lacp_linkstate(struct trunk_port *); -int lacp_port_isactive(struct trunk_port *); +int lacp_input(struct lagg_port *, struct mbuf *); +int lacp_marker_input(struct lagg_port *, struct mbuf *); +struct lagg_port *lacp_select_tx_port(struct lagg_softc *, struct mbuf *); +int lacp_attach(struct lagg_softc *); +int lacp_detach(struct lagg_softc *); +void lacp_init(struct lagg_softc *); +void lacp_stop(struct lagg_softc *); +int lacp_port_create(struct lagg_port *); +void lacp_port_destroy(struct lagg_port *); +void lacp_linkstate(struct lagg_port *); +int lacp_port_isactive(struct lagg_port *); /* following constants don't include terminating NUL */ #define LACP_MACSTR_MAX (2*6 + 5) ==== //depot/projects/scottl-camlock/src/sys/net/if.c#17 (text+ko) ==== @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * @(#)if.c 8.5 (Berkeley) 1/9/95 - * $FreeBSD: src/sys/net/if.c,v 1.270 2007/04/10 00:27:25 thompsa Exp $ + * $FreeBSD: src/sys/net/if.c,v 1.271 2007/04/17 00:35:11 thompsa Exp $ */ #include "opt_compat.h" @@ -96,7 +96,7 @@ void (*bstp_linkstate_p)(struct ifnet *ifp, int state); void (*ng_ether_link_state_p)(struct ifnet *ifp, int state); -void (*trunk_linkstate_p)(struct ifnet *ifp, int state); +void (*lagg_linkstate_p)(struct ifnet *ifp, int state); struct mbuf *(*tbr_dequeue_ptr)(struct ifaltq *, int) = NULL; @@ -1379,9 +1379,9 @@ KASSERT(bstp_linkstate_p != NULL,("if_bridge bstp not loaded!")); (*bstp_linkstate_p)(ifp, link_state); } - if (ifp->if_trunk) { - KASSERT(trunk_linkstate_p != NULL,("if_trunk not loaded!")); - (*trunk_linkstate_p)(ifp, link_state); + if (ifp->if_lagg) { + KASSERT(lagg_linkstate_p != NULL,("if_lagg not loaded!")); + (*lagg_linkstate_p)(ifp, link_state); } devctl_notify("IFNET", ifp->if_xname, ==== //depot/projects/scottl-camlock/src/sys/net/if_ethersubr.c#14 (text+ko) ==== @@ -27,7 +27,7 @@ >>> TRUNCATED FOR MAIL (1000 lines) <<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200704170603.l3H635t3005120>