Lines Matching refs:txn
103 * time and the txn's timestamp), if so the transaction will be freed. along
368 insert_dhcpv4_pending_txn(mac_client_impl_t *mcip, dhcpv4_txn_t *txn)
373 if (avl_find(&mcip->mci_v4_pending_txn, txn, &where) != NULL)
380 avl_insert(&mcip->mci_v4_pending_txn, txn, where);
385 remove_dhcpv4_pending_txn(mac_client_impl_t *mcip, dhcpv4_txn_t *txn)
388 avl_remove(&mcip->mci_v4_pending_txn, txn);
405 * After a pending txn is removed from the pending table, it is inserted
411 insert_dhcpv4_completed_txn(mac_client_impl_t *mcip, dhcpv4_txn_t *txn)
416 if (avl_find(&mcip->mci_v4_completed_txn, txn, &where) != NULL)
425 avl_insert(&mcip->mci_v4_completed_txn, txn, where);
426 if (avl_find(&mcip->mci_v4_dyn_ip, txn, &where) != NULL) {
427 avl_remove(&mcip->mci_v4_completed_txn, txn);
430 avl_insert(&mcip->mci_v4_dyn_ip, txn, where);
435 remove_dhcpv4_completed_txn(mac_client_impl_t *mcip, dhcpv4_txn_t *txn)
440 if ((ctxn = avl_find(&mcip->mci_v4_dyn_ip, txn, NULL)) != NULL &&
441 ctxn == txn)
442 avl_remove(&mcip->mci_v4_dyn_ip, txn);
444 avl_remove(&mcip->mci_v4_completed_txn, txn);
453 dhcpv4_txn_t tmp_txn, *txn;
457 txn = avl_find(&mcip->mci_v4_dyn_ip, &tmp_txn, NULL);
459 return (txn != NULL);
468 dhcpv4_txn_t *txn;
470 if ((txn = kmem_zalloc(sizeof (*txn), KM_NOSLEEP)) == NULL)
473 txn->dt_xid = xid;
474 txn->dt_timestamp = gethrtime();
476 bcopy(cid, &txn->dt_cid, cid_len);
477 txn->dt_cid_len = cid_len;
478 txn->dt_ipaddr = ipaddr;
479 return (txn);
483 free_dhcpv4_txn(dhcpv4_txn_t *txn)
485 kmem_free(txn, sizeof (*txn));
495 dhcpv4_txn_t *txn;
498 while ((txn = avl_destroy_nodes(&mcip->mci_v4_dyn_ip,
501 * No freeing needed here because the same txn exists
506 while ((txn = avl_destroy_nodes(&mcip->mci_v4_completed_txn,
508 free_dhcpv4_txn(txn);
511 while ((txn = avl_destroy_nodes(&mcip->mci_v4_pending_txn,
513 free_dhcpv4_txn(txn);
523 dhcpv4_txn_t *txn, *ctxn, *next, *txn_list = NULL;
529 for (txn = avl_first(&mcip->mci_v4_pending_txn); txn != NULL;
530 txn = avl_walk(&mcip->mci_v4_pending_txn, txn, AVL_AFTER)) {
531 if (gethrtime() - txn->dt_timestamp > txn_cleanup_interval) {
534 dhcpv4_txn_t *, txn);
536 txn->dt_next = txn_list;
537 txn_list = txn;
545 for (txn = txn_list; txn != NULL; txn = next) {
546 avl_remove(&mcip->mci_v4_pending_txn, txn);
548 ctxn = find_dhcpv4_completed_txn(mcip, txn->dt_cid,
549 txn->dt_cid_len);
558 next = txn->dt_next;
559 txn->dt_next = NULL;
562 dhcpv4_txn_t *, txn);
563 free_dhcpv4_txn(txn);
575 dhcpv4_txn_t *txn, *ctxn;
615 /* flush any completed txn with this cid */
628 * If a pending txn already exists, we'll update its timestamp so
632 if ((txn = find_dhcpv4_pending_txn(mcip, dh4->xid)) != NULL) {
634 dhcpv4_txn_t *, txn);
635 txn->dt_timestamp = gethrtime();
646 if ((txn = create_dhcpv4_txn(dh4->xid, cid, cid_len, ipaddr)) == NULL)
649 if (insert_dhcpv4_pending_txn(mcip, txn) != 0) {
651 dhcpv4_txn_t *, txn);
652 free_dhcpv4_txn(txn);
658 dhcpv4_txn_t *, txn);
673 dhcpv4_txn_t *txn, *ctxn;
690 if ((txn = find_dhcpv4_pending_txn(mcip, dh4->xid)) == NULL) {
695 remove_dhcpv4_pending_txn(mcip, txn);
698 * We're about to move a txn from the pending table to the completed/
699 * dyn-ip tables. If there is an existing completed txn with the
700 * same cid as our txn, we need to remove and free it.
702 ctxn = find_dhcpv4_completed_txn(mcip, txn->dt_cid, txn->dt_cid_len);
711 dhcpv4_txn_t *, txn);
712 free_dhcpv4_txn(txn);
715 if (insert_dhcpv4_completed_txn(mcip, txn) != 0) {
717 dhcpv4_txn_t *, txn);
718 free_dhcpv4_txn(txn);
722 dhcpv4_txn_t *, txn);
1110 * Since cid belongs to a pending txn, it can't possibly be in
1175 remove_dhcpv6_pending_txn(mac_client_impl_t *mcip, dhcpv6_txn_t *txn)
1178 avl_remove(&mcip->mci_v6_pending_txn, txn);
1184 dhcpv6_txn_t *txn;
1186 if ((txn = kmem_zalloc(sizeof (dhcpv6_txn_t), KM_NOSLEEP)) == NULL)
1189 txn->dt_xid = xid;
1190 txn->dt_cid = cid;
1191 txn->dt_timestamp = gethrtime();
1192 return (txn);
1196 free_dhcpv6_txn(dhcpv6_txn_t *txn)
1198 if (txn->dt_cid != NULL)
1199 free_dhcpv6_cid(txn->dt_cid);
1200 kmem_free(txn, sizeof (dhcpv6_txn_t));
1204 insert_dhcpv6_pending_txn(mac_client_impl_t *mcip, dhcpv6_txn_t *txn)
1209 if (avl_find(&mcip->mci_v6_pending_txn, txn, &where) != NULL)
1216 avl_insert(&mcip->mci_v6_pending_txn, txn, where);
1228 dhcpv6_txn_t *txn;
1238 while ((txn = avl_destroy_nodes(&mcip->mci_v6_pending_txn,
1240 free_dhcpv6_txn(txn);
1262 dhcpv6_txn_t *txn, *next, *txn_list = NULL;
1268 for (txn = avl_first(&mcip->mci_v6_pending_txn); txn != NULL;
1269 txn = avl_walk(&mcip->mci_v6_pending_txn, txn, AVL_AFTER)) {
1270 if (gethrtime() - txn->dt_timestamp > txn_cleanup_interval) {
1273 dhcpv6_txn_t *, txn);
1275 txn->dt_next = txn_list;
1276 txn_list = txn;
1284 for (txn = txn_list; txn != NULL; txn = next) {
1285 avl_remove(&mcip->mci_v6_pending_txn, txn);
1286 release_dhcpv6_cid(mcip, txn->dt_cid);
1287 next = txn->dt_next;
1288 txn->dt_next = NULL;
1291 dhcpv6_txn_t *, txn);
1292 free_dhcpv6_txn(txn);
1304 dhcpv6_txn_t *txn;
1338 if ((txn = find_dhcpv6_pending_txn(mcip, xid)) != NULL) {
1340 dhcpv6_txn_t *, txn);
1341 txn->dt_timestamp = gethrtime();
1344 if ((txn = create_dhcpv6_txn(xid, cid)) == NULL)
1348 if (insert_dhcpv6_pending_txn(mcip, txn) != 0) {
1350 dhcpv6_txn_t *, txn);
1351 free_dhcpv6_txn(txn);
1357 dhcpv6_txn_t *, txn);
1374 dhcpv6_txn_t *txn;
1385 if ((txn = find_dhcpv6_pending_txn(mcip, xid)) == NULL) {
1390 remove_dhcpv6_pending_txn(mcip, txn);
1391 release_dhcpv6_cid(mcip, txn->dt_cid);
1396 dhcpv6_txn_t *, txn);
1399 if (get_dhcpv6_addrs(dh6, end, txn->dt_cid) != 0) {
1401 dhcpv6_txn_t *, txn);
1404 if (insert_dhcpv6_cid(mcip, txn->dt_cid) != 0) {
1406 dhcpv6_txn_t *, txn);
1410 dhcpv6_txn_t *, txn);
1412 txn->dt_cid = NULL;
1415 if (txn != NULL)
1416 free_dhcpv6_txn(txn);