X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fcryptodev%2Fcryptodev_pmd.h;h=3dcc3cb7edf714e7c889f38cc95beb223f6e4908;hb=76f1481bd15a87762841804fb7828aff26c617d8;hp=89bf2af399e23ed951a4e154fbbf9550cc165538;hpb=92cb130919d7a72892b5be784728cfc0f876f1dc;p=dpdk.git diff --git a/lib/cryptodev/cryptodev_pmd.h b/lib/cryptodev/cryptodev_pmd.h index 89bf2af399..3dcc3cb7ed 100644 --- a/lib/cryptodev/cryptodev_pmd.h +++ b/lib/cryptodev/cryptodev_pmd.h @@ -5,6 +5,10 @@ #ifndef _CRYPTODEV_PMD_H_ #define _CRYPTODEV_PMD_H_ +#ifdef __cplusplus +extern "C" { +#endif + /** @file * RTE Crypto PMD APIs * @@ -15,11 +19,7 @@ #include -#include -#include #include -#include -#include #include #include @@ -159,7 +159,7 @@ rte_cryptodev_pmd_get_named_dev(const char *name); /** * Definitions of all functions exported by a driver through the - * the generic structure of type *crypto_dev_ops* supplied in the + * generic structure of type *crypto_dev_ops* supplied in the * *rte_cryptodev* structure associated with a device. */ @@ -319,7 +319,6 @@ typedef int (*cryptodev_sym_configure_session_t)(struct rte_cryptodev *dev, * @param dev Crypto device pointer * @param xform Single or chain of crypto xforms * @param session Pointer to cryptodev's private session structure - * @param mp Mempool where the private session is allocated * * @return * - Returns 0 if private session structure have been created successfully. @@ -329,8 +328,7 @@ typedef int (*cryptodev_sym_configure_session_t)(struct rte_cryptodev *dev, */ typedef int (*cryptodev_asym_configure_session_t)(struct rte_cryptodev *dev, struct rte_crypto_asym_xform *xform, - struct rte_cryptodev_asym_session *session, - struct rte_mempool *mp); + struct rte_cryptodev_asym_session *session); /** * Free driver private session data. * @@ -340,12 +338,12 @@ typedef int (*cryptodev_asym_configure_session_t)(struct rte_cryptodev *dev, typedef void (*cryptodev_sym_free_session_t)(struct rte_cryptodev *dev, struct rte_cryptodev_sym_session *sess); /** - * Free asymmetric session private data. + * Clear asymmetric session private data. * * @param dev Crypto device pointer * @param sess Cryptodev session structure */ -typedef void (*cryptodev_asym_free_session_t)(struct rte_cryptodev *dev, +typedef void (*cryptodev_asym_clear_session_t)(struct rte_cryptodev *dev, struct rte_cryptodev_asym_session *sess); /** * Perform actual crypto processing (encrypt/digest or auth/decrypt) @@ -400,6 +398,25 @@ typedef int (*cryptodev_sym_configure_raw_dp_ctx_t)( enum rte_crypto_op_sess_type sess_type, union rte_cryptodev_session_ctx session_ctx, uint8_t is_update); +/** + * Typedef that the driver provided to set event crypto meta data. + * + * @param dev Crypto device pointer. + * @param sess Crypto or security session. + * @param op_type Operation type. + * @param sess_type Session type. + * @param ev_mdata Pointer to the event crypto meta data + * (aka *union rte_event_crypto_metadata*) + * @return + * - On success return 0. + * - On failure return negative integer. + */ +typedef int (*cryptodev_session_event_mdata_set_t)( + struct rte_cryptodev *dev, void *sess, + enum rte_crypto_op_type op_type, + enum rte_crypto_op_sess_type sess_type, + void *ev_mdata); + /** Crypto device operations function pointer table */ struct rte_cryptodev_ops { cryptodev_configure_t dev_configure; /**< Configure device. */ @@ -429,7 +446,7 @@ struct rte_cryptodev_ops { /**< Configure asymmetric Crypto session. */ cryptodev_sym_free_session_t sym_session_clear; /**< Clear a Crypto sessions private data. */ - cryptodev_asym_free_session_t asym_session_clear; + cryptodev_asym_clear_session_t asym_session_clear; /**< Clear a Crypto sessions private data. */ union { cryptodev_sym_cpu_crypto_process_t sym_cpu_process; @@ -444,6 +461,8 @@ struct rte_cryptodev_ops { /**< Initialize raw data path context data. */ }; }; + cryptodev_session_event_mdata_set_t session_ev_mdata_set; + /**< Set a Crypto or Security session even meta data. */ }; @@ -483,7 +502,7 @@ rte_cryptodev_pmd_release_device(struct rte_cryptodev *cryptodev); * PMD assist function to parse initialisation arguments for crypto driver * when creating a new crypto PMD device instance. * - * PMD driver should set default values for that PMD before calling function, + * PMD should set default values for that PMD before calling function, * these default values will be over-written with successfully parsed values * from args string. * @@ -605,6 +624,19 @@ void cryptodev_fp_ops_set(struct rte_crypto_fp_ops *fp_ops, const struct rte_cryptodev *dev); +/** + * Get session event meta data (aka *union rte_event_crypto_metadata*) + * + * @param op pointer to *rte_crypto_op* structure. + * + * @return + * - On success, pointer to event crypto metadata + * - On failure, NULL. + */ +__rte_internal +void * +rte_cryptodev_session_event_mdata_get(struct rte_crypto_op *op); + static inline void * get_sym_session_private_data(const struct rte_cryptodev_sym_session *sess, uint8_t driver_id) { @@ -627,17 +659,25 @@ set_sym_session_private_data(struct rte_cryptodev_sym_session *sess, sess->sess_data[driver_id].data = private_data; } -static inline void * -get_asym_session_private_data(const struct rte_cryptodev_asym_session *sess, - uint8_t driver_id) { - return sess->sess_private_data[driver_id]; -} +/** + * @internal + * Cryptodev asymmetric crypto session. + */ +RTE_STD_C11 struct rte_cryptodev_asym_session { + uint8_t driver_id; + /**< Session driver ID. */ + uint16_t max_priv_data_sz; + /**< Size of private data used when creating mempool */ + uint16_t user_data_sz; + /**< Session user data will be placed after sess_data */ + uint8_t padding[3]; + void *event_mdata; + /**< Event metadata (aka *union rte_event_crypto_metadata*) */ + uint8_t sess_private_data[]; +}; -static inline void -set_asym_session_private_data(struct rte_cryptodev_asym_session *sess, - uint8_t driver_id, void *private_data) -{ - sess->sess_private_data[driver_id] = private_data; +#ifdef __cplusplus } +#endif #endif /* _CRYPTODEV_PMD_H_ */