summaryrefslogtreecommitdiff
path: root/drivers/s390/crypto/zcrypt_api.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390/crypto/zcrypt_api.h')
-rw-r--r--drivers/s390/crypto/zcrypt_api.h84
1 files changed, 64 insertions, 20 deletions
diff --git a/drivers/s390/crypto/zcrypt_api.h b/drivers/s390/crypto/zcrypt_api.h
index 3d0d1e25d751..4fb892b99f41 100644
--- a/drivers/s390/crypto/zcrypt_api.h
+++ b/drivers/s390/crypto/zcrypt_api.h
@@ -88,7 +88,7 @@ struct ica_z90_status {
* Identifier for Crypto Request Performance Index
*/
enum crypto_ops {
- MEX_1K = 0,
+ MEX_1K,
MEX_2K,
MEX_4K,
CRT_1K,
@@ -99,43 +99,56 @@ enum crypto_ops {
NUM_OPS
};
-struct zcrypt_device;
+struct zcrypt_queue;
struct zcrypt_ops {
- long (*rsa_modexpo)(struct zcrypt_device *, struct ica_rsa_modexpo *);
- long (*rsa_modexpo_crt)(struct zcrypt_device *,
+ long (*rsa_modexpo)(struct zcrypt_queue *, struct ica_rsa_modexpo *);
+ long (*rsa_modexpo_crt)(struct zcrypt_queue *,
struct ica_rsa_modexpo_crt *);
- long (*send_cprb)(struct zcrypt_device *, struct ica_xcRB *,
+ long (*send_cprb)(struct zcrypt_queue *, struct ica_xcRB *,
struct ap_message *);
- long (*send_ep11_cprb)(struct zcrypt_device *, struct ep11_urb *,
+ long (*send_ep11_cprb)(struct zcrypt_queue *, struct ep11_urb *,
struct ap_message *);
- long (*rng)(struct zcrypt_device *, char *, struct ap_message *);
+ long (*rng)(struct zcrypt_queue *, char *, struct ap_message *);
struct list_head list; /* zcrypt ops list. */
struct module *owner;
int variant;
char name[128];
};
-struct zcrypt_device {
+struct zcrypt_card {
struct list_head list; /* Device list. */
- spinlock_t lock; /* Per device lock. */
+ struct list_head zqueues; /* List of zcrypt queues */
struct kref refcount; /* device refcounting */
- struct ap_device *ap_dev; /* The "real" ap device. */
- struct zcrypt_ops *ops; /* Crypto operations. */
+ struct ap_card *card; /* The "real" ap card device. */
int online; /* User online/offline */
int user_space_type; /* User space device id. */
char *type_string; /* User space device name. */
int min_mod_size; /* Min number of bits. */
int max_mod_size; /* Max number of bits. */
- int short_crt; /* Card has crt length restriction. */
+ int max_exp_bit_length;
int speed_rating[NUM_OPS]; /* Speed idx of crypto ops. */
- int load; /* Utilization of the crypto device */
+ atomic_t load; /* Utilization of the crypto device */
+
+ int request_count; /* # current requests. */
+
+ debug_info_t *dbf_area; /* debugging */
+};
+
+struct zcrypt_queue {
+ struct list_head list; /* Device list. */
+ struct kref refcount; /* device refcounting */
+ struct zcrypt_card *zcard;
+ struct zcrypt_ops *ops; /* Crypto operations. */
+ struct ap_queue *queue; /* The "real" ap queue device. */
+ int online; /* User online/offline */
+
+ atomic_t load; /* Utilization of the crypto device */
int request_count; /* # current requests. */
struct ap_message reply; /* Per-device reply structure. */
- int max_exp_bit_length;
debug_info_t *dbf_area; /* debugging */
};
@@ -143,12 +156,43 @@ struct zcrypt_device {
/* transport layer rescanning */
extern atomic_t zcrypt_rescan_req;
-struct zcrypt_device *zcrypt_device_alloc(size_t);
-void zcrypt_device_free(struct zcrypt_device *);
-void zcrypt_device_get(struct zcrypt_device *);
-int zcrypt_device_put(struct zcrypt_device *);
-int zcrypt_device_register(struct zcrypt_device *);
-void zcrypt_device_unregister(struct zcrypt_device *);
+extern spinlock_t zcrypt_list_lock;
+extern int zcrypt_device_count;
+extern struct list_head zcrypt_card_list;
+
+extern debug_info_t *zcrypt_dbf_common;
+extern debug_info_t *zcrypt_dbf_devices;
+extern debug_info_t *zcrypt_dbf_cards;
+
+#define for_each_zcrypt_card(_zc) \
+ list_for_each_entry(_zc, &zcrypt_card_list, list)
+
+#define for_each_zcrypt_queue(_zq, _zc) \
+ list_for_each_entry(_zq, &(_zc)->zqueues, list)
+
+struct zcrypt_card *zcrypt_card_alloc(void);
+void zcrypt_card_free(struct zcrypt_card *);
+void zcrypt_card_get(struct zcrypt_card *);
+int zcrypt_card_put(struct zcrypt_card *);
+int zcrypt_card_register(struct zcrypt_card *);
+void zcrypt_card_unregister(struct zcrypt_card *);
+struct zcrypt_card *zcrypt_card_get_best(unsigned int *,
+ unsigned int, unsigned int);
+void zcrypt_card_put_best(struct zcrypt_card *, unsigned int);
+
+struct zcrypt_queue *zcrypt_queue_alloc(size_t);
+void zcrypt_queue_free(struct zcrypt_queue *);
+void zcrypt_queue_get(struct zcrypt_queue *);
+int zcrypt_queue_put(struct zcrypt_queue *);
+int zcrypt_queue_register(struct zcrypt_queue *);
+void zcrypt_queue_unregister(struct zcrypt_queue *);
+void zcrypt_queue_force_online(struct zcrypt_queue *, int);
+struct zcrypt_queue *zcrypt_queue_get_best(unsigned int, unsigned int);
+void zcrypt_queue_put_best(struct zcrypt_queue *, unsigned int);
+
+int zcrypt_rng_device_add(void);
+void zcrypt_rng_device_remove(void);
+
void zcrypt_msgtype_register(struct zcrypt_ops *);
void zcrypt_msgtype_unregister(struct zcrypt_ops *);
struct zcrypt_ops *zcrypt_msgtype(unsigned char *, int);