Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/73866/?format=api
http://patchwork.dpdk.org/api/patches/73866/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20200713061600.19456-6-somnath.kotur@broadcom.com/", "project": { "id": 1, "url": "http://patchwork.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<20200713061600.19456-6-somnath.kotur@broadcom.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20200713061600.19456-6-somnath.kotur@broadcom.com", "date": "2020-07-13T06:15:55", "name": "[05/10] net/bnxt: add support to extract data from the ulp blob", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "cec7acd56f6b24ee54be7e8832c52675de604b0c", "submitter": { "id": 908, "url": "http://patchwork.dpdk.org/api/people/908/?format=api", "name": "Somnath Kotur", "email": "somnath.kotur@broadcom.com" }, "delegate": { "id": 1766, "url": "http://patchwork.dpdk.org/api/users/1766/?format=api", "username": "ajitkhaparde", "first_name": "Ajit", "last_name": "Khaparde", "email": "ajit.khaparde@broadcom.com" }, "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20200713061600.19456-6-somnath.kotur@broadcom.com/mbox/", "series": [ { "id": 10976, "url": "http://patchwork.dpdk.org/api/series/10976/?format=api", "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=10976", "date": "2020-07-13T06:15:50", "name": "bnxt patches", "version": 1, "mbox": "http://patchwork.dpdk.org/series/10976/mbox/" } ], "comments": "http://patchwork.dpdk.org/api/patches/73866/comments/", "check": "warning", "checks": "http://patchwork.dpdk.org/api/patches/73866/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@inbox.dpdk.org", "Delivered-To": "patchwork@inbox.dpdk.org", "Received": [ "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id DF6E2A0540;\n\tMon, 13 Jul 2020 08:22:13 +0200 (CEST)", "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id E9FCF1D156;\n\tMon, 13 Jul 2020 08:21:19 +0200 (CEST)", "from relay.smtp.broadcom.com (unknown [192.19.211.62])\n by dpdk.org (Postfix) with ESMTP id 187381C0B5\n for <dev@dpdk.org>; Mon, 13 Jul 2020 08:21:11 +0200 (CEST)", "from dhcp-10-123-153-55.dhcp.broadcom.net\n (dhcp-10-123-153-55.dhcp.broadcom.net [10.123.153.55])\n by relay.smtp.broadcom.com (Postfix) with ESMTP id 4EF1A29C661;\n Sun, 12 Jul 2020 23:21:10 -0700 (PDT)" ], "DKIM-Filter": "OpenDKIM Filter v2.10.3 relay.smtp.broadcom.com 4EF1A29C661", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com;\n s=dkimrelay; t=1594621270;\n bh=oEdmNiV4KByMSqRQmgkdHeO2hxO4nvqY7LT+M/6QuXk=;\n h=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n b=o3uKmTOfu6w9+2OkNxOX6fXehjFqJZ1katuF5nNZjYXThErxqYwOJIWC1xvHTIEJU\n mDBbytfV9rH9gotEGWda9VxcSQA728S6pUjyCQx155z91IcetGuGQ0DyAfo5r6Nogn\n iuJZFmIYWKZ/BOCs+CJMZl+JrfkMLNrUIWGRNu9Q=", "From": "Somnath Kotur <somnath.kotur@broadcom.com>", "To": "dev@dpdk.org", "Cc": "ferruh.yigit@intel.com", "Date": "Mon, 13 Jul 2020 11:45:55 +0530", "Message-Id": "<20200713061600.19456-6-somnath.kotur@broadcom.com>", "X-Mailer": "git-send-email 2.10.1.613.g2cc2e70", "In-Reply-To": "<20200713061600.19456-1-somnath.kotur@broadcom.com>", "References": "<20200713061600.19456-1-somnath.kotur@broadcom.com>", "Subject": "[dpdk-dev] [PATCH 05/10] net/bnxt: add support to extract data from\n\tthe ulp blob", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://mails.dpdk.org/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "From: Kishore Padmanabha <kishore.padmanabha@broadcom.com>\n\nExtended the ulp blob to extract data from the blob for a given\noffset and length. The support is added only for little endian\nformat.\n\nSigned-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>\nReviewed-by: Randy Schacher <stuart.schacher@broadcom.com>\nSigned-off-by: Somnath Kotur <somnath.kotur@broadcom.com>\n---\n drivers/net/bnxt/tf_ulp/ulp_utils.c | 76 +++++++++++++++++++++++++++++++++++++\n drivers/net/bnxt/tf_ulp/ulp_utils.h | 17 +++++++++\n 2 files changed, 93 insertions(+)", "diff": "diff --git a/drivers/net/bnxt/tf_ulp/ulp_utils.c b/drivers/net/bnxt/tf_ulp/ulp_utils.c\nindex 3afaac6..2b556b8 100644\n--- a/drivers/net/bnxt/tf_ulp/ulp_utils.c\n+++ b/drivers/net/bnxt/tf_ulp/ulp_utils.c\n@@ -418,6 +418,82 @@ ulp_blob_pad_push(struct ulp_blob *blob,\n \treturn datalen;\n }\n \n+/* Get data from src and put into dst using little-endian format */\n+static void\n+ulp_bs_get_lsb(uint8_t *src, uint16_t bitpos, uint8_t bitlen, uint8_t *dst)\n+{\n+\tuint8_t bitoffs = bitpos % ULP_BLOB_BYTE;\n+\tuint16_t index = ULP_BITS_2_BYTE_NR(bitpos);\n+\tuint8_t mask, partial, shift;\n+\n+\tshift = bitoffs;\n+\tpartial = ULP_BLOB_BYTE - bitoffs;\n+\tif (bitoffs + bitlen <= ULP_BLOB_BYTE) {\n+\t\tmask = ((1 << bitlen) - 1) << shift;\n+\t\t*dst = (src[index] & mask) >> shift;\n+\t} else {\n+\t\tmask = ((1 << partial) - 1) << shift;\n+\t\t*dst = (src[index] & mask) >> shift;\n+\t\tindex++;\n+\t\tpartial = bitlen - partial;\n+\t\tmask = ((1 << partial) - 1);\n+\t\t*dst |= (src[index] & mask) << (ULP_BLOB_BYTE - bitoffs);\n+\t}\n+}\n+\n+/* Assuming that src is in litte-Endian Format */\n+static void\n+ulp_bs_pull_lsb(uint8_t *src, uint8_t *dst, uint32_t size,\n+\t\tuint32_t offset, uint32_t len)\n+{\n+\tuint32_t idx;\n+\tuint32_t cnt = ULP_BITS_2_BYTE_NR(len);\n+\n+\t/* iterate bytewise to get data */\n+\tfor (idx = 0; idx < cnt; idx++) {\n+\t\tulp_bs_get_lsb(src, offset, ULP_BLOB_BYTE,\n+\t\t\t &dst[size - 1 - idx]);\n+\t\toffset += ULP_BLOB_BYTE;\n+\t\tlen -= ULP_BLOB_BYTE;\n+\t}\n+\n+\t/* Extract the last reminder data that is not 8 byte boundary */\n+\tif (len)\n+\t\tulp_bs_get_lsb(src, offset, len, &dst[size - 1 - idx]);\n+}\n+\n+/*\n+ * Extract data from the binary blob using given offset.\n+ *\n+ * blob [in] The blob that data is extracted from. The blob must\n+ * be initialized prior to pulling data.\n+ *\n+ * data [in] A pointer to put the data.\n+ * data_size [in] size of the data buffer in bytes.\n+ *offset [in] - Offset in the blob to extract the data in bits format.\n+ * len [in] The number of bits to be pulled from the blob.\n+ *\n+ * Output: zero on success, -1 on failure\n+ */\n+int32_t\n+ulp_blob_pull(struct ulp_blob *blob, uint8_t *data, uint32_t data_size,\n+\t uint16_t offset, uint16_t len)\n+{\n+\t/* validate the arguments */\n+\tif (!blob || (offset + len) > blob->bitlen ||\n+\t ULP_BYTE_2_BITS(data_size) < len) {\n+\t\tBNXT_TF_DBG(ERR, \"invalid argument\\n\");\n+\t\treturn -1; /* failure */\n+\t}\n+\n+\tif (blob->byte_order == BNXT_ULP_BYTE_ORDER_BE) {\n+\t\tBNXT_TF_DBG(ERR, \"Big endian pull not implemented\\n\");\n+\t\treturn -1; /* failure */\n+\t}\n+\tulp_bs_pull_lsb(blob->data, data, data_size, offset, len);\n+\treturn 0;\n+}\n+\n /*\n * Get the data portion of the binary blob.\n *\ndiff --git a/drivers/net/bnxt/tf_ulp/ulp_utils.h b/drivers/net/bnxt/tf_ulp/ulp_utils.h\nindex 97c7750..22dfb17 100644\n--- a/drivers/net/bnxt/tf_ulp/ulp_utils.h\n+++ b/drivers/net/bnxt/tf_ulp/ulp_utils.h\n@@ -229,6 +229,23 @@ ulp_blob_data_get(struct ulp_blob *blob,\n \t\t uint16_t *datalen);\n \n /*\n+ * Extract data from the binary blob using given offset.\n+ *\n+ * blob [in] The blob that data is extracted from. The blob must\n+ * be initialized prior to pulling data.\n+ *\n+ * data [in] A pointer to put the data.\n+ * data_size [in] size of the data buffer in bytes.\n+ *offset [in] - Offset in the blob to extract the data in bits format.\n+ * len [in] The number of bits to be pulled from the blob.\n+ *\n+ * Output: zero on success, -1 on failure\n+ */\n+int32_t\n+ulp_blob_pull(struct ulp_blob *blob, uint8_t *data, uint32_t data_size,\n+\t uint16_t offset, uint16_t len);\n+\n+/*\n * Adds pad to an initialized blob at the current offset\n *\n * blob [in] The blob that data is added to. The blob must\n", "prefixes": [ "05/10" ] }{ "id": 73866, "url": "