Lines Matching full:cap

133 	struct cryptocap *cap;  member
215 static int crypto_invoke(struct cryptocap *cap, struct cryptop *crp, int hint);
272 cap_ref(struct cryptocap *cap) in cap_ref() argument
275 refcount_acquire(&cap->cc_refs); in cap_ref()
276 return (cap); in cap_ref()
280 cap_rele(struct cryptocap *cap) in cap_rele() argument
283 if (refcount_release(&cap->cc_refs) == 0) in cap_rele()
286 KASSERT(cap->cc_sessions == 0, in cap_rele()
289 free(cap, M_CRYPTO_DATA); in cap_rele()
471 return (crypto_session->cap->cc_hid); in crypto_ses2hid()
477 return (crypto_session->cap->cc_flags & 0xff000000); in crypto_ses2caps()
600 struct cryptocap *cap, *best; in crypto_select_driver() local
612 cap = crypto_drivers[hid]; in crypto_select_driver()
613 if (cap == NULL || in crypto_select_driver()
614 (cap->cc_flags & flags) == 0) in crypto_select_driver()
617 error = CRYPTODEV_PROBESESSION(cap->cc_dev, csp); in crypto_select_driver()
629 cap->cc_sessions < best->cc_sessions)) { in crypto_select_driver()
630 best = cap; in crypto_select_driver()
920 struct cryptocap *cap; in crypto_deletesession() local
922 cap = cses->cap; in crypto_deletesession()
927 cap->cc_sessions--; in crypto_deletesession()
928 if (cap->cc_sessions == 0 && cap->cc_flags & CRYPTOCAP_F_CLEANUP) in crypto_deletesession()
929 wakeup(cap); in crypto_deletesession()
931 cap_rele(cap); in crypto_deletesession()
946 struct cryptocap *cap; in crypto_newsession() local
959 cap = crypto_checkdriver(crid); in crypto_newsession()
960 if (cap != NULL && CRYPTODEV_PROBESESSION(cap->cc_dev, csp) > 0) in crypto_newsession()
961 cap = NULL; in crypto_newsession()
966 cap = crypto_select_driver(csp, crid); in crypto_newsession()
968 if (cap == NULL) { in crypto_newsession()
973 cap_ref(cap); in crypto_newsession()
974 cap->cc_sessions++; in crypto_newsession()
978 res = malloc(sizeof(*res) + cap->cc_session_size, M_CRYPTO_DATA, in crypto_newsession()
980 res->cap = cap; in crypto_newsession()
985 err = CRYPTODEV_NEWSESSION(cap->cc_dev, res, csp); in crypto_newsession()
1003 struct cryptocap *cap; in crypto_freesession() local
1008 cap = cses->cap; in crypto_freesession()
1011 CRYPTODEV_FREESESSION(cap->cc_dev, cses); in crypto_freesession()
1023 struct cryptocap *cap, **newdrv; in crypto_get_driverid() local
1032 cap = malloc(sizeof(*cap), M_CRYPTO_DATA, M_WAITOK | M_ZERO); in crypto_get_driverid()
1033 cap->cc_dev = dev; in crypto_get_driverid()
1034 cap->cc_session_size = sessionsize; in crypto_get_driverid()
1035 cap->cc_flags = flags; in crypto_get_driverid()
1036 refcount_init(&cap->cc_refs, 1); in crypto_get_driverid()
1053 cap_rele(cap); in crypto_get_driverid()
1071 cap->cc_hid = i; in crypto_get_driverid()
1072 crypto_drivers[i] = cap; in crypto_get_driverid()
1091 struct cryptocap *cap; in crypto_find_driver() local
1098 cap = crypto_drivers[i]; in crypto_find_driver()
1099 if (strncmp(match, device_get_nameunit(cap->cc_dev), len) == 0 || in crypto_find_driver()
1100 strncmp(match, device_get_name(cap->cc_dev), len) == 0) { in crypto_find_driver()
1116 struct cryptocap *cap; in crypto_find_device_byhid() local
1121 cap = crypto_checkdriver(hid); in crypto_find_device_byhid()
1122 if (cap != NULL) in crypto_find_device_byhid()
1123 dev = cap->cc_dev; in crypto_find_device_byhid()
1134 struct cryptocap *cap; in crypto_getcaps() local
1139 cap = crypto_checkdriver(hid); in crypto_getcaps()
1140 if (cap != NULL) in crypto_getcaps()
1141 flags = cap->cc_flags; in crypto_getcaps()
1156 struct cryptocap *cap; in crypto_unregister_all() local
1159 cap = crypto_checkdriver(driverid); in crypto_unregister_all()
1160 if (cap == NULL) { in crypto_unregister_all()
1165 cap->cc_flags |= CRYPTOCAP_F_CLEANUP; in crypto_unregister_all()
1172 while (cap->cc_sessions != 0) in crypto_unregister_all()
1173 mtx_sleep(cap, &crypto_drivers_mtx, 0, "cryunreg", 0); in crypto_unregister_all()
1175 cap_rele(cap); in crypto_unregister_all()
1187 struct cryptocap *cap; in crypto_unblock() local
1191 cap = crypto_checkdriver(driverid); in crypto_unblock()
1192 if (cap != NULL) { in crypto_unblock()
1194 cap->cc_qblocked = 0; in crypto_unblock()
1408 struct cryptocap *cap; in crypto_dispatch_one() local
1423 cap = crp->crp_session->cap; in crypto_dispatch_one()
1424 if (!atomic_load_int(&cap->cc_qblocked)) { in crypto_dispatch_one()
1425 result = crypto_invoke(cap, crp, hint); in crypto_dispatch_one()
1503 struct cryptocap *cap; in crypto_task_invoke() local
1508 cap = crp->crp_session->cap; in crypto_task_invoke()
1509 result = crypto_invoke(cap, crp, 0); in crypto_task_invoke()
1518 crypto_invoke(struct cryptocap *cap, struct cryptop *crp, int hint) in crypto_invoke() argument
1528 if (cap->cc_flags & CRYPTOCAP_F_CLEANUP) { in crypto_invoke()
1576 error = CRYPTODEV_PROCESS(cap->cc_dev, crp, hint); in crypto_invoke()
1762 struct cryptocap *cap; in crypto_dispatch_thread() local
1779 cap = crp->crp_session->cap; in crypto_dispatch_thread()
1784 KASSERT(cap != NULL, ("%s:%u Driver disappeared.", in crypto_dispatch_thread()
1786 if (cap->cc_flags & CRYPTOCAP_F_CLEANUP) { in crypto_dispatch_thread()
1792 if (!cap->cc_qblocked) { in crypto_dispatch_thread()
1802 if (submit->crp_session->cap == cap) in crypto_dispatch_thread()
1812 cap = submit->crp_session->cap; in crypto_dispatch_thread()
1813 KASSERT(cap != NULL, ("%s:%u Driver disappeared.", in crypto_dispatch_thread()
1816 result = crypto_invoke(cap, submit, hint); in crypto_dispatch_thread()
1828 cap->cc_qblocked = 1; in crypto_dispatch_thread()
1926 const struct cryptocap *cap = crypto_drivers[hid]; in db_show_drivers() local
1927 if (cap == NULL) in db_show_drivers()
1930 , device_get_nameunit(cap->cc_dev) in db_show_drivers()
1931 , cap->cc_sessions in db_show_drivers()
1932 , cap->cc_flags in db_show_drivers()
1933 , cap->cc_qblocked in db_show_drivers()
1951 , crp->crp_session->cap->cc_hid in DB_SHOW_COMMAND_FLAGS()
1956 , device_get_nameunit(crp->crp_session->cap->cc_dev) in DB_SHOW_COMMAND_FLAGS()
1967 , crp->crp_session->cap->cc_hid in DB_SHOW_COMMAND_FLAGS()