X-Git-Url: https://gerrit.fd.io/r/gitweb?p=deb_dpdk.git;a=blobdiff_plain;f=drivers%2Fcrypto%2Fdpaa2_sec%2Fmc%2Ffsl_dpseci.h;h=4acb595c636e13a0dd9fcc08fbd36f5656f18b13;hp=6cc14a661cacdb5f70ca9dda7cd4b6b1b76cdcd2;hb=055c52583a2794da8ba1e85a48cce3832372b12f;hpb=f239aed5e674965691846e8ce3f187dd47523689 diff --git a/drivers/crypto/dpaa2_sec/mc/fsl_dpseci.h b/drivers/crypto/dpaa2_sec/mc/fsl_dpseci.h index 6cc14a66..4acb595c 100644 --- a/drivers/crypto/dpaa2_sec/mc/fsl_dpseci.h +++ b/drivers/crypto/dpaa2_sec/mc/fsl_dpseci.h @@ -5,7 +5,7 @@ * BSD LICENSE * * Copyright 2013-2016 Freescale Semiconductor Inc. - * Copyright 2016 NXP. + * Copyright 2016-2017 NXP. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -37,7 +37,6 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ - #ifndef __FSL_DPSECI_H #define __FSL_DPSECI_H @@ -61,394 +60,89 @@ struct fsl_mc_io; */ #define DPSECI_ALL_QUEUES (uint8_t)(-1) -/** - * dpseci_open() - Open a control session for the specified object - * This function can be used to open a control session for an - * already created object; an object may have been declared in - * the DPL or by calling the dpseci_create() function. - * This function returns a unique authentication token, - * associated with the specific object ID and the specific MC - * portal; this token must be used in all subsequent commands for - * this specific object. - * - * @param mc_io Pointer to MC portal's I/O object - * @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_' - * @param dpseci_id DPSECI unique ID - * @param token Returned token; use in subsequent API calls - * - * @return: - * - Return '0' on Success. - * - Return Error code otherwise. - */ -int -dpseci_open(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - int dpseci_id, - uint16_t *token); +int dpseci_open(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + int dpseci_id, + uint16_t *token); + +int dpseci_close(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token); /** - * dpseci_close() - Close the control session of the object - * After this function is called, no further operations are - * allowed on the object without opening a new control session. - * - * @param mc_io Pointer to MC portal's I/O object - * @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_' - * @param token Token of DPSECI object - * - * @return: - * - Return '0' on Success. - * - Return Error code otherwise. + * Enable the Congestion Group support */ -int -dpseci_close(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t token); +#define DPSECI_OPT_HAS_CG 0x000020 /** * struct dpseci_cfg - Structure representing DPSECI configuration + * @options: Any combination of the following options: + * DPSECI_OPT_HAS_CG + * DPSECI_OPT_HAS_OPR + * DPSECI_OPT_OPR_SHARED + * @num_tx_queues: num of queues towards the SEC + * @num_rx_queues: num of queues back from the SEC + * @priorities: Priorities for the SEC hardware processing; + * each place in the array is the priority of the tx queue + * towards the SEC, + * valid priorities are configured with values 1-8; */ struct dpseci_cfg { - uint8_t num_tx_queues; /* num of queues towards the SEC */ - uint8_t num_rx_queues; /* num of queues back from the SEC */ + uint32_t options; + uint8_t num_tx_queues; + uint8_t num_rx_queues; uint8_t priorities[DPSECI_PRIO_NUM]; - /**< Priorities for the SEC hardware processing; - * each place in the array is the priority of the tx queue - * towards the SEC, - * valid priorities are configured with values 1-8; - */ }; -/** - * dpseci_create() - Create the DPSECI object - * Create the DPSECI object, allocate required resources and - * perform required initialization. - * - * The object can be created either by declaring it in the - * DPL file, or by calling this function. - * - * The function accepts an authentication token of a parent - * container that this object should be assigned to. The token - * can be '0' so the object will be assigned to the default container. - * The newly created object can be opened with the returned - * object id and using the container's associated tokens and MC portals. - * - * @param mc_io Pointer to MC portal's I/O object - * @param dprc_token Parent container token; '0' for default container - * @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_' - * @param cfg Configuration structure - * @param obj_id returned object id - * - * @return: - * - Return '0' on Success. - * - Return Error code otherwise. - */ -int -dpseci_create(struct fsl_mc_io *mc_io, - uint16_t dprc_token, - uint32_t cmd_flags, - const struct dpseci_cfg *cfg, - uint32_t *obj_id); - -/** - * dpseci_destroy() - Destroy the DPSECI object and release all its resources. - * The function accepts the authentication token of the parent container that - * created the object (not the one that currently owns the object). The object - * is searched within parent using the provided 'object_id'. - * All tokens to the object must be closed before calling destroy. - * - * @param mc_io Pointer to MC portal's I/O object - * @param dprc_token Parent container token; '0' for default container - * @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_' - * @param object_id The object id; it must be a valid id within the - * container that created this object; - * - * @return: - * - Return '0' on Success. - * - Return Error code otherwise. - */ -int -dpseci_destroy(struct fsl_mc_io *mc_io, - uint16_t dprc_token, - uint32_t cmd_flags, - uint32_t object_id); - -/** - * dpseci_enable() - Enable the DPSECI, allow sending and receiving frames. - * @param mc_io Pointer to MC portal's I/O object - * @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_' - * @param token Token of DPSECI object - * - * @return: - * - Return '0' on Success. - * - Return Error code otherwise. - */ -int -dpseci_enable(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t token); - -/** - * dpseci_disable() - Disable the DPSECI, stop sending and receiving frames. - * @param mc_io Pointer to MC portal's I/O object - * @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_' - * @param token Token of DPSECI object - * - * @return: - * - Return '0' on Success. - * - Return Error code otherwise. - */ -int -dpseci_disable(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t token); - -/** - * dpseci_is_enabled() - Check if the DPSECI is enabled. - * @param mc_io Pointer to MC portal's I/O object - * @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_' - * @param token Token of DPSECI object - * @param en Returns '1' if object is enabled; '0' otherwise - * - * @return: - * - Return '0' on Success. - * - Return Error code otherwise. - */ -int -dpseci_is_enabled(struct fsl_mc_io *mc_io, +int dpseci_create(struct fsl_mc_io *mc_io, + uint16_t dprc_token, uint32_t cmd_flags, - uint16_t token, - int *en); + const struct dpseci_cfg *cfg, + uint32_t *obj_id); -/** - * dpseci_reset() - Reset the DPSECI, returns the object to initial state. - * @param mc_io Pointer to MC portal's I/O object - * @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_' - * @param token Token of DPSECI object - * - * @return: - * - Return '0' on Success. - * - Return Error code otherwise. - */ -int -dpseci_reset(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t token); +int dpseci_destroy(struct fsl_mc_io *mc_io, + uint16_t dprc_token, + uint32_t cmd_flags, + uint32_t object_id); -/** - * struct dpseci_irq_cfg - IRQ configuration - */ -struct dpseci_irq_cfg { - uint64_t addr; - /* Address that must be written to signal a message-based interrupt */ - uint32_t val; - /* Value to write into irq_addr address */ - int irq_num; - /* A user defined number associated with this IRQ */ -}; +int dpseci_enable(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token); -/** - * dpseci_set_irq() - Set IRQ information for the DPSECI to trigger an interrupt - * @param mc_io Pointer to MC portal's I/O object - * @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_' - * @param token Token of DPSECI object - * @param irq_index Identifies the interrupt index to configure - * @param irq_cfg IRQ configuration - * - * @return: - * - Return '0' on Success. - * - Return Error code otherwise. - */ -int -dpseci_set_irq(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t token, - uint8_t irq_index, - struct dpseci_irq_cfg *irq_cfg); +int dpseci_disable(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token); -/** - * dpseci_get_irq() - Get IRQ information from the DPSECI - * - * @param mc_io Pointer to MC portal's I/O object - * @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_' - * @param token Token of DPSECI object - * @param irq_index The interrupt index to configure - * @param type Interrupt type: 0 represents message interrupt - * type (both irq_addr and irq_val are valid) - * @param irq_cfg IRQ attributes - * - * @return: - * - Return '0' on Success. - * - Return Error code otherwise. - */ -int -dpseci_get_irq(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t token, - uint8_t irq_index, - int *type, - struct dpseci_irq_cfg *irq_cfg); - -/** - * dpseci_set_irq_enable() - Set overall interrupt state. - * Allows GPP software to control when interrupts are generated. - * Each interrupt can have up to 32 causes. The enable/disable control's the - * overall interrupt state. if the interrupt is disabled no causes will cause - * an interrupt - * - * @param mc_io Pointer to MC portal's I/O object - * @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_' - * @param token Token of DPSECI object - * @param irq_index The interrupt index to configure - * @param en Interrupt state - enable = 1, disable = 0 - * - * @return: - * - Return '0' on Success. - * - Return Error code otherwise. - */ -int -dpseci_set_irq_enable(struct fsl_mc_io *mc_io, +int dpseci_is_enabled(struct fsl_mc_io *mc_io, uint32_t cmd_flags, uint16_t token, - uint8_t irq_index, - uint8_t en); + int *en); -/** - * dpseci_get_irq_enable() - Get overall interrupt state - * @param mc_io Pointer to MC portal's I/O object - * @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_' - * @param token Token of DPSECI object - * @param irq_index The interrupt index to configure - * @param en Returned Interrupt state - enable = 1, - * disable = 0 - * - * @return: - * - Return '0' on Success. - * - Return Error code otherwise. - */ -int -dpseci_get_irq_enable(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t token, - uint8_t irq_index, - uint8_t *en); - -/** - * dpseci_set_irq_mask() - Set interrupt mask. - * Every interrupt can have up to 32 causes and the interrupt model supports - * masking/unmasking each cause independently - * - * @param mc_io Pointer to MC portal's I/O object - * @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_' - * @param token Token of DPSECI object - * @param irq_index The interrupt index to configure - * @param mask event mask to trigger interrupt; - * each bit: - * 0 = ignore event - * 1 = consider event for asserting IRQ - * - * @return: - * - Return '0' on Success. - * - Return Error code otherwise. - */ -int -dpseci_set_irq_mask(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t token, - uint8_t irq_index, - uint32_t mask); - -/** - * dpseci_get_irq_mask() - Get interrupt mask. - * Every interrupt can have up to 32 causes and the interrupt model supports - * masking/unmasking each cause independently - * - * @param mc_io Pointer to MC portal's I/O object - * @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_' - * @param token Token of DPSECI object - * @param irq_index The interrupt index to configure - * @param mask Returned event mask to trigger interrupt - * - * @return: - * - Return '0' on Success. - * - Return Error code otherwise. - */ -int -dpseci_get_irq_mask(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t token, - uint8_t irq_index, - uint32_t *mask); - -/** - * dpseci_get_irq_status() - Get the current status of any pending interrupts - * @param mc_io Pointer to MC portal's I/O object - * @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_' - * @param token Token of DPSECI object - * @param irq_index The interrupt index to configure - * @param status Returned interrupts status - one bit per cause: - * 0 = no interrupt pending - * 1 = interrupt pending - * - * @return: - * - Return '0' on Success. - * - Return Error code otherwise. - */ -int -dpseci_get_irq_status(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t token, - uint8_t irq_index, - uint32_t *status); - -/** - * dpseci_clear_irq_status() - Clear a pending interrupt's status - * @param mc_io Pointer to MC portal's I/O object - * @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_' - * @param token Token of DPSECI object - * @param irq_index The interrupt index to configure - * @param status bits to clear (W1C) - one bit per cause: - * 0 = don't change - * 1 = clear status bit - * - * @return: - * - Return '0' on Success. - * - Return Error code otherwise. - */ -int -dpseci_clear_irq_status(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t token, - uint8_t irq_index, - uint32_t status); +int dpseci_reset(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token); /** * struct dpseci_attr - Structure representing DPSECI attributes - * @param id: DPSECI object ID - * @param num_tx_queues: number of queues towards the SEC - * @param num_rx_queues: number of queues back from the SEC + * @id: DPSECI object ID + * @num_tx_queues: number of queues towards the SEC + * @num_rx_queues: number of queues back from the SEC + * @options: Any combination of the following options: + * DPSECI_OPT_HAS_CG + * DPSECI_OPT_HAS_OPR + * DPSECI_OPT_OPR_SHARED */ struct dpseci_attr { - int id; /* DPSECI object ID */ - uint8_t num_tx_queues; /* number of queues towards the SEC */ - uint8_t num_rx_queues; /* number of queues back from the SEC */ + int id; + uint8_t num_tx_queues; + uint8_t num_rx_queues; + uint32_t options; }; -/** - * dpseci_get_attributes() - Retrieve DPSECI attributes. - * @param mc_io Pointer to MC portal's I/O object - * @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_' - * @param token Token of DPSECI object - * @param attr Returned object's attributes - * - * @return: - * - Return '0' on Success. - * - Return Error code otherwise. - */ -int -dpseci_get_attributes(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t token, - struct dpseci_attr *attr); +int dpseci_get_attributes(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + struct dpseci_attr *attr); /** * enum dpseci_dest - DPSECI destination types @@ -471,16 +165,16 @@ enum dpseci_dest { /** * struct dpseci_dest_cfg - Structure representing DPSECI destination parameters + * @dest_type: Destination type + * @dest_id: Either DPIO ID or DPCON ID, depending on the destination type + * @priority: Priority selection within the DPIO or DPCON channel; valid values + * are 0-1 or 0-7, depending on the number of priorities in that + * channel; not relevant for 'DPSECI_DEST_NONE' option */ struct dpseci_dest_cfg { - enum dpseci_dest dest_type; /* Destination type */ + enum dpseci_dest dest_type; int dest_id; - /* Either DPIO ID or DPCON ID, depending on the destination type */ uint8_t priority; - /* Priority selection within the DPIO or DPCON channel; valid values - * are 0-1 or 0-7, depending on the number of priorities in that - * channel; not relevant for 'DPSECI_DEST_NONE' option - */ }; /** @@ -504,243 +198,235 @@ struct dpseci_dest_cfg { /** * struct dpseci_rx_queue_cfg - DPSECI RX queue configuration + * @options: Flags representing the suggested modifications to the queue; + * Use any combination of 'DPSECI_QUEUE_OPT_' flags + * @order_preservation_en: order preservation configuration for the rx queue + * valid only if 'DPSECI_QUEUE_OPT_ORDER_PRESERVATION' is contained in 'options' + * @user_ctx: User context value provided in the frame descriptor of each + * dequeued frame; + * valid only if 'DPSECI_QUEUE_OPT_USER_CTX' is contained in 'options' + * @dest_cfg: Queue destination parameters; + * valid only if 'DPSECI_QUEUE_OPT_DEST' is contained in 'options' */ struct dpseci_rx_queue_cfg { uint32_t options; - /* Flags representing the suggested modifications to the queue; - * Use any combination of 'DPSECI_QUEUE_OPT_' flags - */ int order_preservation_en; - /* order preservation configuration for the rx queue - * valid only if 'DPSECI_QUEUE_OPT_ORDER_PRESERVATION' is contained in - * 'options' - */ uint64_t user_ctx; - /* User context value provided in the frame descriptor of each - * dequeued frame; - * valid only if 'DPSECI_QUEUE_OPT_USER_CTX' is contained in 'options' - */ struct dpseci_dest_cfg dest_cfg; - /* Queue destination parameters; - * valid only if 'DPSECI_QUEUE_OPT_DEST' is contained in 'options' - */ }; -/** - * dpseci_set_rx_queue() - Set Rx queue configuration - * @param mc_io Pointer to MC portal's I/O object - * @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_' - * @param token Token of DPSECI object - * @param queue Select the queue relative to number of - * priorities configured at DPSECI creation; use - * DPSECI_ALL_QUEUES to configure all Rx queues - * identically. - * @param cfg Rx queue configuration - * - * @return: - * - Return '0' on Success. - * - Return Error code otherwise. - */ -int -dpseci_set_rx_queue(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t token, - uint8_t queue, - const struct dpseci_rx_queue_cfg *cfg); +int dpseci_set_rx_queue(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint8_t queue, + const struct dpseci_rx_queue_cfg *cfg); /** * struct dpseci_rx_queue_attr - Structure representing attributes of Rx queues + * @user_ctx: User context value provided in the frame descriptor of each + * dequeued frame + * @order_preservation_en: Status of the order preservation configuration + * on the queue + * @dest_cfg: Queue destination configuration + * @fqid: Virtual FQID value to be used for dequeue operations */ struct dpseci_rx_queue_attr { uint64_t user_ctx; - /* User context value provided in the frame descriptor of - * each dequeued frame - */ int order_preservation_en; - /* Status of the order preservation configuration on the queue */ - struct dpseci_dest_cfg dest_cfg; - /* Queue destination configuration */ + struct dpseci_dest_cfg dest_cfg; uint32_t fqid; - /* Virtual FQID value to be used for dequeue operations */ }; -/** - * dpseci_get_rx_queue() - Retrieve Rx queue attributes. - * @param mc_io Pointer to MC portal's I/O object - * @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_' - * @param token Token of DPSECI object - * @param queue Select the queue relative to number of - * priorities configured at DPSECI creation - * @param attr Returned Rx queue attributes - * - * @return: - * - Return '0' on Success. - * - Return Error code otherwise. - */ -int -dpseci_get_rx_queue(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t token, - uint8_t queue, - struct dpseci_rx_queue_attr *attr); +int dpseci_get_rx_queue(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint8_t queue, + struct dpseci_rx_queue_attr *attr); /** * struct dpseci_tx_queue_attr - Structure representing attributes of Tx queues + * @fqid: Virtual FQID to be used for sending frames to SEC hardware + * @priority: SEC hardware processing priority for the queue */ struct dpseci_tx_queue_attr { uint32_t fqid; - /* Virtual FQID to be used for sending frames to SEC hardware */ uint8_t priority; - /* SEC hardware processing priority for the queue */ }; -/** - * dpseci_get_tx_queue() - Retrieve Tx queue attributes. - * @param mc_io Pointer to MC portal's I/O object - * @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_' - * @param token Token of DPSECI object - * @param queue Select the queue relative to number of - * priorities configured at DPSECI creation - * @param attr Returned Tx queue attributes - * - * @return: - * - Return '0' on Success. - * - Return Error code otherwise. - */ -int -dpseci_get_tx_queue(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t token, - uint8_t queue, - struct dpseci_tx_queue_attr *attr); +int dpseci_get_tx_queue(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint8_t queue, + struct dpseci_tx_queue_attr *attr); /** * struct dpseci_sec_attr - Structure representing attributes of the SEC - * hardware accelerator - */ + * hardware accelerator + * @ip_id: ID for SEC. + * @major_rev: Major revision number for SEC. + * @minor_rev: Minor revision number for SEC. + * @era: SEC Era. + * @deco_num: The number of copies of the DECO that are implemented + * in this version of SEC. + * @zuc_auth_acc_num: The number of copies of ZUCA that are implemented + * in this version of SEC. + * @zuc_enc_acc_num: The number of copies of ZUCE that are implemented + * in this version of SEC. + * @snow_f8_acc_num: The number of copies of the SNOW-f8 module that are + * implemented in this version of SEC. + * @snow_f9_acc_num: The number of copies of the SNOW-f9 module that are + * implemented in this version of SEC. + * @crc_acc_num: The number of copies of the CRC module that are + * implemented in this version of SEC. + * @pk_acc_num: The number of copies of the Public Key module that are + * implemented in this version of SEC. + * @kasumi_acc_num: The number of copies of the Kasumi module that are + * implemented in this version of SEC. + * @rng_acc_num: The number of copies of the Random Number Generator that + * are implemented in this version of SEC. + * @md_acc_num: The number of copies of the MDHA (Hashing module) that + * are implemented in this version of SEC. + * @arc4_acc_num: The number of copies of the ARC4 module that are + * implemented in this version of SEC. + * @des_acc_num: The number of copies of the DES module that are + * implemented in this version of SEC. + * @aes_acc_num: The number of copies of the AES module that are + * implemented in this version of SEC. + **/ struct dpseci_sec_attr { - uint16_t ip_id; /* ID for SEC */ - uint8_t major_rev; /* Major revision number for SEC */ - uint8_t minor_rev; /* Minor revision number for SEC */ - uint8_t era; /* SEC Era */ + uint16_t ip_id; + uint8_t major_rev; + uint8_t minor_rev; + uint8_t era; uint8_t deco_num; - /* The number of copies of the DECO that are implemented in - * this version of SEC - */ uint8_t zuc_auth_acc_num; - /* The number of copies of ZUCA that are implemented in this - * version of SEC - */ uint8_t zuc_enc_acc_num; - /* The number of copies of ZUCE that are implemented in this - * version of SEC - */ uint8_t snow_f8_acc_num; - /* The number of copies of the SNOW-f8 module that are - * implemented in this version of SEC - */ uint8_t snow_f9_acc_num; - /* The number of copies of the SNOW-f9 module that are - * implemented in this version of SEC - */ uint8_t crc_acc_num; - /* The number of copies of the CRC module that are implemented - * in this version of SEC - */ uint8_t pk_acc_num; - /* The number of copies of the Public Key module that are - * implemented in this version of SEC - */ uint8_t kasumi_acc_num; - /* The number of copies of the Kasumi module that are - * implemented in this version of SEC - */ uint8_t rng_acc_num; - /* The number of copies of the Random Number Generator that are - * implemented in this version of SEC - */ uint8_t md_acc_num; - /* The number of copies of the MDHA (Hashing module) that are - * implemented in this version of SEC - */ uint8_t arc4_acc_num; - /* The number of copies of the ARC4 module that are implemented - * in this version of SEC - */ uint8_t des_acc_num; - /* The number of copies of the DES module that are implemented - * in this version of SEC - */ uint8_t aes_acc_num; - /* The number of copies of the AES module that are implemented - * in this version of SEC - */ }; -/** - * dpseci_get_sec_attr() - Retrieve SEC accelerator attributes. - * @param mc_io Pointer to MC portal's I/O object - * @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_' - * @param token Token of DPSECI object - * @param attr Returned SEC attributes - * - * @return: - * - Return '0' on Success. - * - Return Error code otherwise. - */ -int -dpseci_get_sec_attr(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t token, - struct dpseci_sec_attr *attr); +int dpseci_get_sec_attr(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + struct dpseci_sec_attr *attr); /** * struct dpseci_sec_counters - Structure representing global SEC counters and * not per dpseci counters + * @dequeued_requests: Number of Requests Dequeued + * @ob_enc_requests: Number of Outbound Encrypt Requests + * @ib_dec_requests: Number of Inbound Decrypt Requests + * @ob_enc_bytes: Number of Outbound Bytes Encrypted + * @ob_prot_bytes: Number of Outbound Bytes Protected + * @ib_dec_bytes: Number of Inbound Bytes Decrypted + * @ib_valid_bytes: Number of Inbound Bytes Validated */ struct dpseci_sec_counters { - uint64_t dequeued_requests; /* Number of Requests Dequeued */ - uint64_t ob_enc_requests; /* Number of Outbound Encrypt Requests */ - uint64_t ib_dec_requests; /* Number of Inbound Decrypt Requests */ - uint64_t ob_enc_bytes; /* Number of Outbound Bytes Encrypted */ - uint64_t ob_prot_bytes; /* Number of Outbound Bytes Protected */ - uint64_t ib_dec_bytes; /* Number of Inbound Bytes Decrypted */ - uint64_t ib_valid_bytes; /* Number of Inbound Bytes Validated */ + uint64_t dequeued_requests; + uint64_t ob_enc_requests; + uint64_t ib_dec_requests; + uint64_t ob_enc_bytes; + uint64_t ob_prot_bytes; + uint64_t ib_dec_bytes; + uint64_t ib_valid_bytes; }; +int dpseci_get_sec_counters(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + struct dpseci_sec_counters *counters); + +int dpseci_get_api_version(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t *major_ver, + uint16_t *minor_ver); /** - * dpseci_get_sec_counters() - Retrieve SEC accelerator counters. - * @param mc_io Pointer to MC portal's I/O object - * @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_' - * @param token Token of DPSECI object - * @param counters Returned SEC counters - * - * @return: - * - Return '0' on Success. - * - Return Error code otherwise. + * enum dpseci_congestion_unit - DPSECI congestion units + * @DPSECI_CONGESTION_UNIT_BYTES: bytes units + * @DPSECI_CONGESTION_UNIT_FRAMES: frames units */ -int -dpseci_get_sec_counters(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t token, - struct dpseci_sec_counters *counters); +enum dpseci_congestion_unit { + DPSECI_CONGESTION_UNIT_BYTES = 0, + DPSECI_CONGESTION_UNIT_FRAMES +}; /** - * dpseci_get_api_version() - Get Data Path SEC Interface API version - * @param mc_io Pointer to MC portal's I/O object - * @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_' - * @param major_ver Major version of data path sec API - * @param minor_ver Minor version of data path sec API - * - * @return: - * - Return '0' on Success. - * - Return Error code otherwise. + * CSCN message is written to message_iova once entering a + * congestion state (see 'threshold_entry') + */ +#define DPSECI_CGN_MODE_WRITE_MEM_ON_ENTER 0x00000001 +/** + * CSCN message is written to message_iova once exiting a + * congestion state (see 'threshold_exit') + */ +#define DPSECI_CGN_MODE_WRITE_MEM_ON_EXIT 0x00000002 +/** + * CSCN write will attempt to allocate into a cache (coherent write); + * valid only if 'DPSECI_CGN_MODE_WRITE_MEM_' is selected */ -int -dpseci_get_api_version(struct fsl_mc_io *mc_io, - uint32_t cmd_flags, - uint16_t *major_ver, - uint16_t *minor_ver); +#define DPSECI_CGN_MODE_COHERENT_WRITE 0x00000004 +/** + * if 'dpseci_dest_cfg.dest_type != DPSECI_DEST_NONE' CSCN message is sent to + * DPIO/DPCON's WQ channel once entering a congestion state + * (see 'threshold_entry') + */ +#define DPSECI_CGN_MODE_NOTIFY_DEST_ON_ENTER 0x00000008 +/** + * if 'dpseci_dest_cfg.dest_type != DPSECI_DEST_NONE' CSCN message is sent to + * DPIO/DPCON's WQ channel once exiting a congestion state + * (see 'threshold_exit') + */ +#define DPSECI_CGN_MODE_NOTIFY_DEST_ON_EXIT 0x00000010 +/** + * if 'dpseci_dest_cfg.dest_type != DPSECI_DEST_NONE' when the CSCN is written + * to the sw-portal's DQRR, the DQRI interrupt is asserted immediately + * (if enabled) + */ +#define DPSECI_CGN_MODE_INTR_COALESCING_DISABLED 0x00000020 + +/** + * struct dpseci_congestion_notification_cfg - congestion notification + * configuration + * @units: units type + * @threshold_entry: above this threshold we enter a congestion state. + * set it to '0' to disable it + * @threshold_exit: below this threshold we exit the congestion state. + * @message_ctx: The context that will be part of the CSCN message + * @message_iova: I/O virtual address (must be in DMA-able memory), + * must be 16B aligned; + * @dest_cfg: CSCN can be send to either DPIO or DPCON WQ channel + * @notification_mode: Mask of available options; use 'DPSECI_CGN_MODE_' + * values + */ +struct dpseci_congestion_notification_cfg { + enum dpseci_congestion_unit units; + uint32_t threshold_entry; + uint32_t threshold_exit; + uint64_t message_ctx; + uint64_t message_iova; + struct dpseci_dest_cfg dest_cfg; + uint16_t notification_mode; +}; + +int dpseci_set_congestion_notification( + struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + const struct dpseci_congestion_notification_cfg *cfg); + +int dpseci_get_congestion_notification( + struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + struct dpseci_congestion_notification_cfg *cfg); #endif /* __FSL_DPSECI_H */