X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fbnxt%2Ftf_ulp%2Fulp_utils.h;h=c054a77a90ecf8a3702b8e6af7e5e30a61874b61;hb=6c7cbc8077dd25abd6baf264cd598252ecd9fb3b;hp=13d9e88b193e4cf14c66e7b6f31d0e0347476174;hpb=8ce17d56a1f148af979c8da3e91b723b6cc19774;p=dpdk.git diff --git a/drivers/net/bnxt/tf_ulp/ulp_utils.h b/drivers/net/bnxt/tf_ulp/ulp_utils.h index 13d9e88b19..c054a77a90 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_utils.h +++ b/drivers/net/bnxt/tf_ulp/ulp_utils.h @@ -9,6 +9,9 @@ #include "bnxt.h" #include "ulp_template_db_enum.h" +#define ULP_BUFFER_ALIGN_8_BYTE 8 +#define ULP_BUFFER_ALIGN_16_BYTE 16 + /* * Macros for bitmap sets and gets * These macros can be used if the val are power of 2. @@ -228,6 +231,23 @@ uint8_t * ulp_blob_data_get(struct ulp_blob *blob, uint16_t *datalen); +/* + * Extract data from the binary blob using given offset. + * + * blob [in] The blob that data is extracted from. The blob must + * be initialized prior to pulling data. + * + * data [in] A pointer to put the data. + * data_size [in] size of the data buffer in bytes. + *offset [in] - Offset in the blob to extract the data in bits format. + * len [in] The number of bits to be pulled from the blob. + * + * Output: zero on success, -1 on failure + */ +int32_t +ulp_blob_pull(struct ulp_blob *blob, uint8_t *data, uint32_t data_size, + uint16_t offset, uint16_t len); + /* * Adds pad to an initialized blob at the current offset * @@ -236,9 +256,9 @@ ulp_blob_data_get(struct ulp_blob *blob, * * datalen [in] The number of bits of pad to add * - * returns the number of pad bits added, zero on failure + * returns the number of pad bits added, -1 on failure */ -uint32_t +int32_t ulp_blob_pad_push(struct ulp_blob *blob, uint32_t datalen); @@ -263,6 +283,18 @@ ulp_blob_encap_swap_idx_set(struct ulp_blob *blob); void ulp_blob_perform_encap_swap(struct ulp_blob *blob); +/* + * Perform the blob buffer reversal byte wise. + * This api makes the first byte the last and + * vice-versa. + * + * blob [in] The blob's data to be used for swap. + * + * returns void. + */ +void +ulp_blob_perform_byte_reverse(struct ulp_blob *blob); + /* * Read data from the operand * @@ -286,11 +318,13 @@ ulp_operand_read(uint8_t *operand, * dst [out] The destination buffer * src [in] The source buffer dst * size[in] size of the buffer. + * align[in] The alignment is either 8 or 16. */ void ulp_encap_buffer_copy(uint8_t *dst, const uint8_t *src, - uint16_t size); + uint16_t size, + uint16_t align); /* * Check the buffer is empty