/* $NetBSD: bridgestp.c,v 1.5 2003/11/28 08:56:48 keihan Exp $ */
/*
- * Copyright (c) 2009-2010 Apple Inc. All rights reserved.
+ * Copyright (c) 2009-2012 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
#include <kern/thread.h>
-static lck_mtx_t *bstp_task_mtx = NULL;
+decl_lck_mtx_data(static, bstp_task_mtx_data);
+static lck_mtx_t *bstp_task_mtx = &bstp_task_mtx_data;
static lck_grp_t *bstp_task_grp = NULL;
static lck_attr_t *bstp_task_attr = NULL;
static thread_t bstp_task_thread;
#define INFO_SAME 0
#define INFO_WORSE -1
-const uint8_t bstp_etheraddr[] = { 0x01, 0x80, 0xc2, 0x00, 0x00, 0x00 };
-
LIST_HEAD(, bstp_state) bstp_list;
-static lck_mtx_t *bstp_list_mtx;
+decl_lck_mtx_data(static, bstp_list_mtx_data);
+static lck_mtx_t *bstp_list_mtx = &bstp_list_mtx_data;
static lck_grp_t *bstp_lock_grp = NULL;
static lck_attr_t *bstp_lock_attr = NULL;
eh = mtod(m, struct ether_header *);
- memcpy(eh->ether_shost, ifnet_lladdr(ifp), ETHER_ADDR_LEN);
+ memcpy(eh->ether_shost, IF_LLADDR(ifp), ETHER_ADDR_LEN);
memcpy(eh->ether_dhost, bstp_etheraddr, ETHER_ADDR_LEN);
eh->ether_type = htons(sizeof(bpdu));
bpdu->cbu_ctl = LLC_UI;
bpdu->cbu_protoid = htons(BSTP_PROTO_ID);
- memcpy(eh->ether_shost, ifnet_lladdr(ifp), ETHER_ADDR_LEN);
+ memcpy(eh->ether_shost, IF_LLADDR(ifp), ETHER_ADDR_LEN);
memcpy(eh->ether_dhost, bstp_etheraddr, ETHER_ADDR_LEN);
switch (bpdu->cbu_bpdutype) {
if (ifp->if_type != IFT_ETHER)
continue;
- if (bstp_addr_cmp(ifnet_lladdr(ifp), llzero) == 0)
+ if (bstp_addr_cmp(IF_LLADDR(ifp), llzero) == 0)
continue;
if (mif == NULL) {
mif = ifp;
continue;
}
- if (bstp_addr_cmp(ifnet_lladdr(ifp), ifnet_lladdr(mif)) < 0) {
+ if (bstp_addr_cmp(IF_LLADDR(ifp), IF_LLADDR(mif)) < 0) {
mif = ifp;
continue;
}
return;
}
- e_addr = ifnet_lladdr(mif);
+ e_addr = IF_LLADDR(mif);
bs->bs_bridge_pv.pv_dbridge_id =
(((uint64_t)bs->bs_bridge_priority) << 48) |
(((uint64_t)e_addr[0]) << 40) |
#if BRIDGE_DEBUG
lck_attr_setdebug(bstp_lock_attr);
#endif
- bstp_list_mtx = lck_mtx_alloc_init(bstp_lock_grp, bstp_lock_attr);
+ lck_mtx_init(bstp_list_mtx, bstp_lock_grp, bstp_lock_attr);
lck_grp_attr_free(lck_grp_attr);
LIST_INIT(&bstp_list);
#if BRIDGE_DEBUG
lck_attr_setdebug(bstp_task_attr);
#endif
- bstp_task_mtx = lck_mtx_alloc_init(bstp_lock_grp, bstp_lock_attr);
+ lck_mtx_init(bstp_task_mtx, bstp_lock_grp, bstp_lock_attr);
lck_grp_attr_free(lck_grp_attr);
error = kernel_thread_start((thread_continue_t)bstp_task_thread_func, NULL, &bstp_task_thread);