Lines Matching defs:bfp
412 bridge_fwd_t *bfp, match;
422 if ((bfp = avl_find(&bip->bi_fwd, &match, &where)) == NULL)
423 bfp = avl_nearest(&bip->bi_fwd, where, AVL_AFTER);
425 bfp = AVL_NEXT(&bip->bi_fwd, bfp);
426 if (bfp == NULL) {
429 bcopy(bfp->bf_dest, blf->blf_dest, ETHERADDRL);
430 blf->blf_trill_nick = bfp->bf_trill_nick;
432 drv_hztousec(ddi_get_lbolt() - bfp->bf_lastheard) / 1000;
434 (bfp->bf_flags & BFF_LOCALADDR) != 0;
435 blf->blf_linkid = bfp->bf_links[0]->bl_linkid;
897 bridge_fwd_t *bfp;
899 bfp = kmem_zalloc(sizeof (*bfp) + (nlinks * sizeof (bridge_link_t *)),
901 if (bfp != NULL) {
902 bcopy(addr, bfp->bf_dest, ETHERADDRL);
903 bfp->bf_lastheard = ddi_get_lbolt();
904 bfp->bf_maxlinks = nlinks;
905 bfp->bf_links = (bridge_link_t **)(bfp + 1);
906 bfp->bf_trill_nick = nick;
908 return (bfp);
914 bridge_fwd_t *bfp, *vbfp;
920 if ((bfp = avl_find(&bip->bi_fwd, &match, NULL)) != NULL) {
921 if (bfp->bf_vlanid != vlanid && bfp->bf_vcnt > 0) {
926 bfp = vbfp;
928 atomic_inc_uint(&bfp->bf_refs);
931 return (bfp);
935 fwd_free(bridge_fwd_t *bfp)
938 bridge_inst_t *bip = bfp->bf_links[0]->bl_inst;
941 for (i = 0; i < bfp->bf_nlinks; i++)
942 link_unref(bfp->bf_links[i]);
943 kmem_free(bfp,
944 sizeof (*bfp) + bfp->bf_maxlinks * sizeof (bridge_link_t *));
948 fwd_unref(bridge_fwd_t *bfp)
950 if (atomic_dec_uint_nv(&bfp->bf_refs) == 0) {
951 ASSERT(!(bfp->bf_flags & BFF_INTREE));
952 fwd_free(bfp);
957 fwd_delete(bridge_fwd_t *bfp)
962 if (bfp->bf_flags & BFF_INTREE) {
963 ASSERT(bfp->bf_nlinks > 0);
964 bip = bfp->bf_links[0]->bl_inst;
967 if (bfp->bf_flags & BFF_INTREE) {
968 avl_remove(&bip->bi_fwd, bfp);
969 bfp->bf_flags &= ~BFF_INTREE;
970 if (bfp->bf_flags & BFF_VLANLOCAL) {
971 bfp->bf_flags &= ~BFF_VLANLOCAL;
972 bfpzero = avl_find(&bip->bi_fwd, bfp, NULL);
977 fwd_unref(bfp); /* no longer in avl tree */
985 fwd_insert(bridge_inst_t *bip, bridge_fwd_t *bfp)
993 avl_find(&bip->bi_fwd, bfp, &idx) == NULL) {
994 avl_insert(&bip->bi_fwd, bfp, idx);
995 bfp->bf_flags |= BFF_INTREE;
996 atomic_inc_uint(&bfp->bf_refs); /* avl entry */
1010 bridge_fwd_t *bfp, *bfnew;
1026 if ((bfp = avl_find(&bip->bi_fwd, &match, NULL)) != NULL) {
1032 for (i = 0; i < bfp->bf_nlinks; i++) {
1033 if (bfp->bf_links[i] == blp) {
1040 bfp->bf_nlinks--;
1041 for (; i < bfp->bf_nlinks; i++)
1042 bfp->bf_links[i] = bfp->bf_links[i + 1];
1048 if (bfp->bf_nlinks == 0) {
1049 avl_remove(&bip->bi_fwd, bfp);
1050 bfp->bf_flags &= ~BFF_INTREE;
1052 bfp = NULL;
1056 if (bfp != NULL)
1057 fwd_unref(bfp); /* no longer in avl tree */
1066 bfp = NULL;
1073 if ((bfp = avl_find(&bip->bi_fwd, &match, &idx)) == NULL) {
1077 } else if (bfp->bf_nlinks < bfp->bf_maxlinks) {
1079 bfnew = bfp;
1081 bfnew = fwd_alloc(newaddr, bfp->bf_nlinks + 1,
1085 avl_remove(&bip->bi_fwd, bfp);
1086 bfp->bf_flags &= ~BFF_INTREE;
1087 bfnew->bf_nlinks = bfp->bf_nlinks;
1088 bcopy(bfp->bf_links, bfnew->bf_links,
1089 bfp->bf_nlinks * sizeof (bfp));
1102 if (bfnew != bfp) {
1117 if (bfnew != NULL && bfp != NULL && bfnew != bfp)
1118 fwd_unref(bfp);
1147 bridge_fwd_t *bfp, *bfnext;
1180 while ((bfp = bfnext) != NULL) {
1181 bfnext = AVL_NEXT(&bip->bi_fwd, bfp);
1182 for (i = 0; i < bfp->bf_nlinks; i++) {
1183 if (bfp->bf_links[i] == blp)
1186 if (i >= bfp->bf_nlinks)
1188 if (bfp->bf_nlinks > 1) {
1191 bfp->bf_nlinks--;
1192 for (; i < bfp->bf_nlinks; i++)
1193 bfp->bf_links[i] = bfp->bf_links[i + 1];
1195 ASSERT(bfp->bf_flags & BFF_INTREE);
1196 avl_remove(&bip->bi_fwd, bfp);
1197 bfp->bf_flags &= ~BFF_INTREE;
1198 avl_add(&fwd_scavenge, bfp);
1203 while ((bfp = bfnext) != NULL) {
1204 bfnext = AVL_NEXT(&fwd_scavenge, bfp);
1205 avl_remove(&fwd_scavenge, bfp);
1206 fwd_unref(bfp);
1226 bridge_fwd_t *bfp;
1255 while ((bfp = avl_first(&bip->bi_fwd)) != NULL) {
1256 atomic_inc_uint(&bfp->bf_refs);
1258 fwd_delete(bfp);
1259 fwd_unref(bfp);
1404 bridge_fwd_t *bfp, *bfnext;
1432 while ((bfp = bfnext) != NULL) {
1433 bfnext = AVL_NEXT(&bip->bi_fwd, bfp);
1434 if (!(bfp->bf_flags & BFF_LOCALADDR) &&
1435 (ddi_get_lbolt() - bfp->bf_lastheard) > age_limit) {
1436 ASSERT(bfp->bf_flags & BFF_INTREE);
1437 avl_remove(&bip->bi_fwd, bfp);
1438 bfp->bf_flags &= ~BFF_INTREE;
1439 avl_add(&fwd_scavenge, bfp);
1452 while ((bfp = bfnext) != NULL) {
1453 bfnext = AVL_NEXT(&fwd_scavenge, bfp);
1454 avl_remove(&fwd_scavenge, bfp);
1456 fwd_unref(bfp); /* drop tree reference */
1573 bridge_fwd_t *bfp, *bfpnew;
1586 if ((bfp = fwd_find(bip, saddr, vlanid)) != NULL) {
1594 if (bfp->bf_flags & BFF_LOCALADDR) {
1595 fwd_unref(bfp);
1604 if (bfp->bf_trill_nick == ingress_nick) {
1605 for (i = 0; i < bfp->bf_nlinks; i++) {
1606 if (bfp->bf_links[i] == blp) {
1607 bfp->bf_lastheard = ddi_get_lbolt();
1608 fwd_unref(bfp);
1625 if (bfp != NULL) {
1626 if (bfp->bf_vcnt == 0)
1627 fwd_delete(bfp);
1628 fwd_unref(bfp);
1636 if (bfp != NULL)
1637 fwd_unref(bfp);
1642 if (bfp != NULL) {
1649 if (bfp->bf_vlanid == vlanid) {
1651 bfpnew->bf_vcnt = bfp->bf_vcnt;
1657 fwd_delete(bfp);
1661 bfp->bf_vcnt++;
1664 fwd_unref(bfp);
1867 bridge_fwd_t *bfp;
1887 if ((bfp = fwd_find(bip, daddr, vlanid)) != NULL) {
1894 if (bfp->bf_trill_nick != RBRIDGE_NICKNAME_NONE) {
1914 fwd_unref(bfp);
1918 bfp->bf_trill_nick);
1929 fwd_delete(bfp);
1931 fwd_unref(bfp);
1936 for (i = 0; i < bfp->bf_nlinks; i++) {
1937 blpsend = bfp->bf_links[i];
1944 while (i < bfp->bf_nlinks) {
1945 blpsend = bfp->bf_links[i];
1946 for (i++; i < bfp->bf_nlinks; i++) {
1947 blpnext = bfp->bf_links[i];
1953 if (i == bfp->bf_nlinks && !selfseen) {
1976 if (bfp->bf_flags & BFF_LOCALADDR) {
1991 if (mp != NULL && is_xmit && (bfp->bf_flags & BFF_LOCALADDR)) {
1995 fwd_unref(bfp);
2641 bridge_fwd_t *bfp, *bfnext;
2651 while ((bfp = bfnext) != NULL) {
2652 bfnext = AVL_NEXT(&bip->bi_fwd, bfp);
2653 if (bfp->bf_flags & BFF_LOCALADDR)
2657 if (bfp->bf_trill_nick == RBRIDGE_NICKNAME_NONE)
2660 if (bfp->bf_trill_nick != RBRIDGE_NICKNAME_NONE)
2662 for (i = 0; i < bfp->bf_nlinks; i++) {
2663 if (bfp->bf_links[i] == blp)
2666 if (i >= bfp->bf_nlinks)
2669 ASSERT(bfp->bf_flags & BFF_INTREE);
2670 avl_remove(&bip->bi_fwd, bfp);
2671 bfp->bf_flags &= ~BFF_INTREE;
2672 avl_add(&fwd_scavenge, bfp);
2676 while ((bfp = bfnext) != NULL) {
2677 bfnext = AVL_NEXT(&fwd_scavenge, bfp);
2678 avl_remove(&fwd_scavenge, bfp);
2679 fwd_unref(bfp);
3227 bridge_fwd_t *bfp, *bfnext;
3256 while ((bfp = bfnext) != NULL) {
3257 bfnext = AVL_NEXT(&bip->bi_fwd, bfp);
3258 if (bfp->bf_flags & BFF_LOCALADDR)
3261 for (i = 0; i < bfp->bf_maxlinks; i++) {
3262 if (bfp->bf_links[i] == blp)
3270 if ((i < bfp->bf_maxlinks) == bff->bff_exclude)
3273 ASSERT(bfp->bf_flags & BFF_INTREE);
3274 avl_remove(&bip->bi_fwd, bfp);
3275 bfp->bf_flags &= ~BFF_INTREE;
3276 avl_add(&fwd_scavenge, bfp);
3280 while ((bfp = bfnext) != NULL) {
3281 bfnext = AVL_NEXT(&fwd_scavenge, bfp);
3282 avl_remove(&fwd_scavenge, bfp);
3283 fwd_unref(bfp); /* drop tree reference */