462 ndp = ipst->ips_ndp4;
463 else
464 ndp = ipst->ips_ndp6;
465
466 /* Serialize deletes */
467 mutex_enter(&ncec->ncec_lock);
468 if (NCE_ISCONDEMNED(ncec)) {
469 /* Some other thread is doing the delete */
470 mutex_exit(&ncec->ncec_lock);
471 return;
472 }
473 /*
474 * Caller has a refhold. Also 1 ref for being in the list. Thus
475 * refcnt has to be >= 2
476 */
477 ASSERT(ncec->ncec_refcnt >= 2);
478 ncec->ncec_flags |= NCE_F_CONDEMNED;
479 mutex_exit(&ncec->ncec_lock);
480
481 /* Count how many condemned ires for kmem_cache callback */
482 atomic_add_32(&ipst->ips_num_nce_condemned, 1);
483 nce_fastpath_list_delete(ncec->ncec_ill, ncec, NULL);
484
485 /* Complete any waiting callbacks */
486 ncec_cb_dispatch(ncec);
487
488 /*
489 * Cancel any running timer. Timeout can't be restarted
490 * since CONDEMNED is set. Can't hold ncec_lock across untimeout.
491 * Passing invalid timeout id is fine.
492 */
493 if (ncec->ncec_timeout_id != 0) {
494 (void) untimeout(ncec->ncec_timeout_id);
495 ncec->ncec_timeout_id = 0;
496 }
497
498 mutex_enter(&ndp->ndp_g_lock);
499 if (ncec->ncec_ptpn == NULL) {
500 /*
501 * The last ndp walker has already removed this ncec from
502 * the list after we marked the ncec CONDEMNED and before
|
462 ndp = ipst->ips_ndp4;
463 else
464 ndp = ipst->ips_ndp6;
465
466 /* Serialize deletes */
467 mutex_enter(&ncec->ncec_lock);
468 if (NCE_ISCONDEMNED(ncec)) {
469 /* Some other thread is doing the delete */
470 mutex_exit(&ncec->ncec_lock);
471 return;
472 }
473 /*
474 * Caller has a refhold. Also 1 ref for being in the list. Thus
475 * refcnt has to be >= 2
476 */
477 ASSERT(ncec->ncec_refcnt >= 2);
478 ncec->ncec_flags |= NCE_F_CONDEMNED;
479 mutex_exit(&ncec->ncec_lock);
480
481 /* Count how many condemned ires for kmem_cache callback */
482 atomic_inc_32(&ipst->ips_num_nce_condemned);
483 nce_fastpath_list_delete(ncec->ncec_ill, ncec, NULL);
484
485 /* Complete any waiting callbacks */
486 ncec_cb_dispatch(ncec);
487
488 /*
489 * Cancel any running timer. Timeout can't be restarted
490 * since CONDEMNED is set. Can't hold ncec_lock across untimeout.
491 * Passing invalid timeout id is fine.
492 */
493 if (ncec->ncec_timeout_id != 0) {
494 (void) untimeout(ncec->ncec_timeout_id);
495 ncec->ncec_timeout_id = 0;
496 }
497
498 mutex_enter(&ndp->ndp_g_lock);
499 if (ncec->ncec_ptpn == NULL) {
500 /*
501 * The last ndp walker has already removed this ncec from
502 * the list after we marked the ncec CONDEMNED and before
|