Lines Matching defs:grp

45 #define	IPMP_GRP_TO_IPST(grp)		PHYINT_TO_IPST((grp)->gr_phyint)
127 ipmp_grp_t *grp;
133 if ((grp = kmem_zalloc(sizeof (ipmp_grp_t), KM_NOSLEEP)) == NULL)
136 (void) strlcpy(grp->gr_name, grname, sizeof (grp->gr_name));
137 (void) strlcpy(grp->gr_ifname, grname, sizeof (grp->gr_ifname));
143 grp->gr_phyint = phyi;
148 if (ipmp_grp_create_kstats(grp) != 0) {
149 kmem_free(grp, sizeof (ipmp_grp_t));
157 ipmp_grp_destroy_kstats(grp);
158 kmem_free(grp, sizeof (ipmp_grp_t));
161 ipmp_grp_insert(grp, mh);
163 return (grp);
167 * Create IPMP kstat structures for `grp'. Return an errno upon failure.
170 ipmp_grp_create_kstats(ipmp_grp_t *grp)
173 netstackid_t id = IPMP_GRP_TO_IPST(grp)->ips_netstack->netstack_stackid;
175 ksp = kstat_create_netstack("ipmp", 0, grp->gr_ifname, "net",
181 ksp->ks_private = grp;
185 grp->gr_ksp = ksp;
197 ipmp_grp_t *grp = ksp->ks_private;
198 ip_stack_t *ipst = IPMP_GRP_TO_IPST(grp);
199 ipsq_t *ipsq, *grp_ipsq = grp->gr_phyint->phyint_ipsq;
211 kn[i].value.ui32 = grp->gr_kstats0[i];
214 kn[i].value.ui64 = grp->gr_kstats0[i];
253 (grp->gr_phyint->phyint_flags & PHYI_RUNNING) != 0;
260 * Destroy IPMP kstat structures for `grp'.
263 ipmp_grp_destroy_kstats(ipmp_grp_t *grp)
265 netstackid_t id = IPMP_GRP_TO_IPST(grp)->ips_netstack->netstack_stackid;
267 kstat_delete_netstack(grp->gr_ksp, id);
268 bzero(grp->gr_kstats0, sizeof (grp->gr_kstats0));
269 grp->gr_ksp = NULL;
279 ipmp_grp_t *grp;
284 (mod_hash_val_t *)&grp) == 0)
285 return (grp);
291 * Place information about group `grp' into `lifgr'.
294 ipmp_grp_info(const ipmp_grp_t *grp, lifgroupinfo_t *lifgr)
297 ip_stack_t *ipst = IPMP_GRP_TO_IPST(grp);
301 lifgr->gi_v4 = (grp->gr_v4 != NULL);
302 lifgr->gi_v6 = (grp->gr_v6 != NULL);
303 lifgr->gi_nv4 = grp->gr_nv4 + grp->gr_pendv4;
304 lifgr->gi_nv6 = grp->gr_nv6 + grp->gr_pendv6;
305 lifgr->gi_mactype = grp->gr_nif > 0 ? grp->gr_mactype : SUNW_DL_IPMP;
306 (void) strlcpy(lifgr->gi_grifname, grp->gr_ifname, LIFNAMSIZ);
311 if (grp->gr_v4 != NULL && (ill = grp->gr_v4->ig_cast_ill) != NULL) {
316 if (grp->gr_v6 != NULL && (ill = grp->gr_v6->ig_cast_ill) != NULL)
321 * Insert `grp' into the hash using the reserved hash entry `mh'.
322 * Caller must ensure `grp' is not yet in the hash.
325 ipmp_grp_insert(ipmp_grp_t *grp, mod_hash_hndl_t mh)
328 ip_stack_t *ipst = IPMP_GRP_TO_IPST(grp);
333 * Since grp->gr_name will exist at least as long as `grp' is in the
337 (mod_hash_key_t)grp->gr_name, (mod_hash_val_t)grp, mh);
343 grp->gr_name, err);
348 * Remove `grp' from the hash. Caller must ensure `grp' is in it.
351 ipmp_grp_remove(ipmp_grp_t *grp)
355 mod_hash_key_t key = (mod_hash_key_t)grp->gr_name;
356 ip_stack_t *ipst = IPMP_GRP_TO_IPST(grp);
361 if (err != 0 || val != grp) {
363 grp->gr_name, err);
368 * Attempt to rename `grp' to new name `grname'. Return an errno if the new
372 ipmp_grp_rename(ipmp_grp_t *grp, const char *grname)
375 ip_stack_t *ipst = IPMP_GRP_TO_IPST(grp);
383 (mod_hash_val_t *)&grp) != MH_ERR_NOTFOUND)
393 ipmp_grp_remove(grp);
394 (void) strlcpy(grp->gr_name, grname, sizeof (grp->gr_name));
395 ipmp_grp_insert(grp, mh);
401 * Destroy `grp' and remove it from the hash. Caller must ensure `grp' is in
405 ipmp_grp_destroy(ipmp_grp_t *grp)
407 ip_stack_t *ipst = IPMP_GRP_TO_IPST(grp);
415 if (grp->gr_nif != 0)
416 panic("cannot destroy IPMP group \"%s\": in use", grp->gr_name);
418 ipmp_grp_remove(grp);
419 ipmp_grp_destroy_kstats(grp);
421 ASSERT(grp->gr_v4 == NULL);
422 ASSERT(grp->gr_v6 == NULL);
423 ASSERT(grp->gr_nv4 == 0);
424 ASSERT(grp->gr_nv6 == 0);
425 ASSERT(grp->gr_nactif == 0);
426 ASSERT(grp->gr_linkdownmp == NULL);
427 grp->gr_phyint = NULL;
429 kmem_free(grp, sizeof (ipmp_grp_t));
433 * Check whether `ill' is suitable for inclusion into `grp', and return an
439 ipmp_grp_vet_ill(ipmp_grp_t *grp, ill_t *ill)
441 ip_stack_t *ipst = IPMP_GRP_TO_IPST(grp);
499 if (grp->gr_nif > 0 && grp->gr_mactype != ill->ill_mactype)
506 * Check whether `phyi' is suitable for inclusion into `grp', and return an
511 ipmp_grp_vet_phyint(ipmp_grp_t *grp, phyint_t *phyi)
514 ip_stack_t *ipst = IPMP_GRP_TO_IPST(grp);
523 if (phyi->phyint_illv4 != NULL && grp->gr_v4 == NULL ||
524 phyi->phyint_illv6 != NULL && grp->gr_v6 == NULL)
528 err = ipmp_grp_vet_ill(grp, phyi->phyint_illv4);
530 err = ipmp_grp_vet_ill(grp, phyi->phyint_illv6);
1055 * Link illgrp `illg' to IPMP group `grp'. To simplify the caller, silently
1059 ipmp_illgrp_link_grp(ipmp_illgrp_t *illg, ipmp_grp_t *grp)
1066 ASSERT(grp->gr_v6 == NULL || grp->gr_v6 == illg);
1067 grp->gr_v6 = illg;
1069 ASSERT(grp->gr_v4 == NULL || grp->gr_v4 == illg);
1070 grp->gr_v4 = illg;
1081 ipmp_grp_t *grp = illg->ig_ipmp_ill->ill_phyint->phyint_grp;
1087 if (grp->gr_nv6 + grp->gr_pendv6 != 0)
1089 grp->gr_v6 = NULL;
1091 if (grp->gr_nv4 + grp->gr_pendv4 != 0)
1093 grp->gr_v4 = NULL;
1427 ipmp_grp_t *grp = ill->ill_phyint->phyint_grp;
1439 if (grp->gr_nactif == 0) {
1498 if (grp->gr_nactif++ == 0) {
1499 ASSERT(grp->gr_linkdownmp == NULL);
1500 grp->gr_linkdownmp = linkdownmp;
1519 ipmp_grp_t *grp = ill->ill_phyint->phyint_grp;
1594 if (--grp->gr_nactif == 0) {
1596 mp = grp->gr_linkdownmp;
1597 grp->gr_linkdownmp = NULL;
1888 ipmp_grp_t *grp;
1893 if ((grp = ill->ill_phyint->phyint_grp) != NULL)
1894 ifindex = grp->gr_phyint->phyint_ifindex;
1900 * Place phyint `phyi' into IPMP group `grp'.
1903 ipmp_phyint_join_grp(phyint_t *phyi, ipmp_grp_t *grp)
1907 ipsq_t *grp_ipsq = grp->gr_phyint->phyint_ipsq;
1934 phyi->phyint_grp = grp;
1935 if (++grp->gr_nif == 1)
1936 grp->gr_mactype = ill->ill_mactype;
1938 ASSERT(grp->gr_mactype == ill->ill_mactype);