Lines Matching full:cap

133 	struct cryptocap *cap;  member
215 static int crypto_invoke(struct cryptocap *cap, struct cryptop *crp, int hint);
279 cap_ref(struct cryptocap *cap) in cap_ref() argument
282 refcount_acquire(&cap->cc_refs); in cap_ref()
283 return (cap); in cap_ref()
287 cap_rele(struct cryptocap *cap) in cap_rele() argument
290 if (refcount_release(&cap->cc_refs) == 0) in cap_rele()
293 KASSERT(cap->cc_sessions == 0, in cap_rele()
296 free(cap, M_CRYPTO_DATA); in cap_rele()
478 return (crypto_session->cap->cc_hid); in crypto_ses2hid()
484 return (crypto_session->cap->cc_flags & 0xff000000); in crypto_ses2caps()
607 struct cryptocap *cap, *best; in crypto_select_driver() local
619 cap = crypto_drivers[hid]; in crypto_select_driver()
620 if (cap == NULL || in crypto_select_driver()
621 (cap->cc_flags & flags) == 0) in crypto_select_driver()
624 error = CRYPTODEV_PROBESESSION(cap->cc_dev, csp); in crypto_select_driver()
636 cap->cc_sessions < best->cc_sessions)) { in crypto_select_driver()
637 best = cap; in crypto_select_driver()
927 struct cryptocap *cap; in crypto_deletesession() local
929 cap = cses->cap; in crypto_deletesession()
934 cap->cc_sessions--; in crypto_deletesession()
935 if (cap->cc_sessions == 0 && cap->cc_flags & CRYPTOCAP_F_CLEANUP) in crypto_deletesession()
936 wakeup(cap); in crypto_deletesession()
938 cap_rele(cap); in crypto_deletesession()
953 struct cryptocap *cap; in crypto_newsession() local
966 cap = crypto_checkdriver(crid); in crypto_newsession()
967 if (cap != NULL && CRYPTODEV_PROBESESSION(cap->cc_dev, csp) > 0) in crypto_newsession()
968 cap = NULL; in crypto_newsession()
973 cap = crypto_select_driver(csp, crid); in crypto_newsession()
975 if (cap == NULL) { in crypto_newsession()
980 cap_ref(cap); in crypto_newsession()
981 cap->cc_sessions++; in crypto_newsession()
985 res = malloc(sizeof(*res) + cap->cc_session_size, M_CRYPTO_DATA, in crypto_newsession()
987 res->cap = cap; in crypto_newsession()
992 err = CRYPTODEV_NEWSESSION(cap->cc_dev, res, csp); in crypto_newsession()
1010 struct cryptocap *cap; in crypto_freesession() local
1015 cap = cses->cap; in crypto_freesession()
1018 CRYPTODEV_FREESESSION(cap->cc_dev, cses); in crypto_freesession()
1030 struct cryptocap *cap, **newdrv; in crypto_get_driverid() local
1039 cap = malloc(sizeof(*cap), M_CRYPTO_DATA, M_WAITOK | M_ZERO); in crypto_get_driverid()
1040 cap->cc_dev = dev; in crypto_get_driverid()
1041 cap->cc_session_size = sessionsize; in crypto_get_driverid()
1042 cap->cc_flags = flags; in crypto_get_driverid()
1043 refcount_init(&cap->cc_refs, 1); in crypto_get_driverid()
1060 cap_rele(cap); in crypto_get_driverid()
1078 cap->cc_hid = i; in crypto_get_driverid()
1079 crypto_drivers[i] = cap; in crypto_get_driverid()
1098 struct cryptocap *cap; in crypto_find_driver() local
1105 cap = crypto_drivers[i]; in crypto_find_driver()
1106 if (strncmp(match, device_get_nameunit(cap->cc_dev), len) == 0 || in crypto_find_driver()
1107 strncmp(match, device_get_name(cap->cc_dev), len) == 0) { in crypto_find_driver()
1123 struct cryptocap *cap; in crypto_find_device_byhid() local
1128 cap = crypto_checkdriver(hid); in crypto_find_device_byhid()
1129 if (cap != NULL) in crypto_find_device_byhid()
1130 dev = cap->cc_dev; in crypto_find_device_byhid()
1141 struct cryptocap *cap; in crypto_getcaps() local
1146 cap = crypto_checkdriver(hid); in crypto_getcaps()
1147 if (cap != NULL) in crypto_getcaps()
1148 flags = cap->cc_flags; in crypto_getcaps()
1163 struct cryptocap *cap; in crypto_unregister_all() local
1166 cap = crypto_checkdriver(driverid); in crypto_unregister_all()
1167 if (cap == NULL) { in crypto_unregister_all()
1172 cap->cc_flags |= CRYPTOCAP_F_CLEANUP; in crypto_unregister_all()
1179 while (cap->cc_sessions != 0) in crypto_unregister_all()
1180 mtx_sleep(cap, &crypto_drivers_mtx, 0, "cryunreg", 0); in crypto_unregister_all()
1182 cap_rele(cap); in crypto_unregister_all()
1194 struct cryptocap *cap; in crypto_unblock() local
1198 cap = crypto_checkdriver(driverid); in crypto_unblock()
1199 if (cap != NULL) { in crypto_unblock()
1201 cap->cc_qblocked = 0; in crypto_unblock()
1415 struct cryptocap *cap; in crypto_dispatch_one() local
1430 cap = crp->crp_session->cap; in crypto_dispatch_one()
1431 if (!atomic_load_int(&cap->cc_qblocked)) { in crypto_dispatch_one()
1432 result = crypto_invoke(cap, crp, hint); in crypto_dispatch_one()
1510 struct cryptocap *cap; in crypto_task_invoke() local
1515 cap = crp->crp_session->cap; in crypto_task_invoke()
1516 result = crypto_invoke(cap, crp, 0); in crypto_task_invoke()
1525 crypto_invoke(struct cryptocap *cap, struct cryptop *crp, int hint) in crypto_invoke() argument
1535 if (cap->cc_flags & CRYPTOCAP_F_CLEANUP) { in crypto_invoke()
1583 error = CRYPTODEV_PROCESS(cap->cc_dev, crp, hint); in crypto_invoke()
1769 struct cryptocap *cap; in crypto_dispatch_thread() local
1786 cap = crp->crp_session->cap; in crypto_dispatch_thread()
1791 KASSERT(cap != NULL, ("%s:%u Driver disappeared.", in crypto_dispatch_thread()
1793 if (cap->cc_flags & CRYPTOCAP_F_CLEANUP) { in crypto_dispatch_thread()
1799 if (!cap->cc_qblocked) { in crypto_dispatch_thread()
1809 if (submit->crp_session->cap == cap) in crypto_dispatch_thread()
1819 cap = submit->crp_session->cap; in crypto_dispatch_thread()
1820 KASSERT(cap != NULL, ("%s:%u Driver disappeared.", in crypto_dispatch_thread()
1823 result = crypto_invoke(cap, submit, hint); in crypto_dispatch_thread()
1835 cap->cc_qblocked = 1; in crypto_dispatch_thread()
1933 const struct cryptocap *cap = crypto_drivers[hid]; in db_show_drivers() local
1934 if (cap == NULL) in db_show_drivers()
1937 , device_get_nameunit(cap->cc_dev) in db_show_drivers()
1938 , cap->cc_sessions in db_show_drivers()
1939 , cap->cc_flags in db_show_drivers()
1940 , cap->cc_qblocked in db_show_drivers()
1958 , crp->crp_session->cap->cc_hid in DB_SHOW_COMMAND_FLAGS()
1963 , device_get_nameunit(crp->crp_session->cap->cc_dev) in DB_SHOW_COMMAND_FLAGS()
1974 , crp->crp_session->cap->cc_hid in DB_SHOW_COMMAND_FLAGS()