get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/53898/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 53898,
    "url": "http://patches.dpdk.org/api/patches/53898/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1559211639-17442-3-git-send-email-matan@mellanox.com/",
    "project": {
        "id": 1,
        "url": "http://patches.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": "<1559211639-17442-3-git-send-email-matan@mellanox.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1559211639-17442-3-git-send-email-matan@mellanox.com",
    "date": "2019-05-30T10:20:32",
    "name": "[v1,2/9] net/mlx5: add log file procedure for debug data",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "3dd1b8d06c83cb9c4dd247a78eb192d005e08562",
    "submitter": {
        "id": 796,
        "url": "http://patches.dpdk.org/api/people/796/?format=api",
        "name": "Matan Azrad",
        "email": "matan@mellanox.com"
    },
    "delegate": {
        "id": 6624,
        "url": "http://patches.dpdk.org/api/users/6624/?format=api",
        "username": "shahafs",
        "first_name": "Shahaf",
        "last_name": "Shuler",
        "email": "shahafs@mellanox.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1559211639-17442-3-git-send-email-matan@mellanox.com/mbox/",
    "series": [
        {
            "id": 4823,
            "url": "http://patches.dpdk.org/api/series/4823/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=4823",
            "date": "2019-05-30T10:20:30",
            "name": "mlx5: Handle data-path completions with error",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/4823/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/53898/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/53898/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id B039D1B99C;\n\tThu, 30 May 2019 12:20:53 +0200 (CEST)",
            "from git-send-mailer.rdmz.labs.mlnx (unknown [37.142.13.130])\n\tby dpdk.org (Postfix) with ESMTP id DA2DF1B94D;\n\tThu, 30 May 2019 12:20:44 +0200 (CEST)"
        ],
        "From": "Matan Azrad <matan@mellanox.com>",
        "To": "Shahaf Shuler <shahafs@mellanox.com>, Yongseok Koh <yskoh@mellanox.com>",
        "Cc": "dev@dpdk.org,\n\tstable@dpdk.org",
        "Date": "Thu, 30 May 2019 10:20:32 +0000",
        "Message-Id": "<1559211639-17442-3-git-send-email-matan@mellanox.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": "<1559211639-17442-1-git-send-email-matan@mellanox.com>",
        "References": "<1559211639-17442-1-git-send-email-matan@mellanox.com>",
        "Subject": "[dpdk-dev] [PATCH v1 2/9] net/mlx5: add log file procedure for\n\tdebug data",
        "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\t<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\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Add a global function in the PMD which dumps debug information to\nspecific file.\n\nThe data can be printed in hexadecimal format or as regular string.\n\nThe number of debug files per PMD entity should be limited by a new PMD\nprobe parameter called max_dump_files_num.\n\nThe files will be created in the /var/log directory or in the current\ndirectory.\n\nCc: stable@dpdk.org\n\nSigned-off-by: Matan Azrad <matan@mellanox.com>\n---\n doc/guides/nics/mlx5.rst     |  7 +++++++\n drivers/net/mlx5/mlx5.c      |  8 ++++++++\n drivers/net/mlx5/mlx5.h      |  1 +\n drivers/net/mlx5/mlx5_rxtx.c | 44 ++++++++++++++++++++++++++++++++++++++++++++\n drivers/net/mlx5/mlx5_rxtx.h |  2 ++\n 5 files changed, 62 insertions(+)",
    "diff": "diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst\nindex 325e9f6..aa89bd9 100644\n--- a/doc/guides/nics/mlx5.rst\n+++ b/doc/guides/nics/mlx5.rst\n@@ -507,6 +507,13 @@ Run-time configuration\n \n     representor=[0-2]\n \n+- ``max_dump_files_num`` parameter [int]\n+\n+  The maximum number of files per PMD entity that may be created for debug information.\n+  The files will be created in /var/log directory or in current directory.\n+\n+  set to 128 by default.\n+\n Firmware configuration\n ~~~~~~~~~~~~~~~~~~~~~~\n \ndiff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c\nindex 9f5ec97..ebb49c8 100644\n--- a/drivers/net/mlx5/mlx5.c\n+++ b/drivers/net/mlx5/mlx5.c\n@@ -116,6 +116,9 @@\n /* Select port representors to instantiate. */\n #define MLX5_REPRESENTOR \"representor\"\n \n+/* Device parameter to configure the maximum number of dump files per queue. */\n+#define MLX5_MAX_DUMP_FILES_NUM \"max_dump_files_num\"\n+\n #ifndef HAVE_IBV_MLX5_MOD_MPW\n #define MLX5DV_CONTEXT_FLAGS_MPW_ALLOWED (1 << 2)\n #define MLX5DV_CONTEXT_FLAGS_ENHANCED_MPW (1 << 3)\n@@ -926,6 +929,8 @@ struct mlx5_dev_spawn_data {\n \t\tconfig->dv_flow_en = !!tmp;\n \t} else if (strcmp(MLX5_MR_EXT_MEMSEG_EN, key) == 0) {\n \t\tconfig->mr_ext_memseg_en = !!tmp;\n+\t} else if (strcmp(MLX5_MAX_DUMP_FILES_NUM, key) == 0) {\n+\t\tconfig->max_dump_files_num = tmp;\n \t} else {\n \t\tDRV_LOG(WARNING, \"%s: unknown parameter\", key);\n \t\trte_errno = EINVAL;\n@@ -970,6 +975,7 @@ struct mlx5_dev_spawn_data {\n \t\tMLX5_DV_FLOW_EN,\n \t\tMLX5_MR_EXT_MEMSEG_EN,\n \t\tMLX5_REPRESENTOR,\n+\t\tMLX5_MAX_DUMP_FILES_NUM,\n \t\tNULL,\n \t};\n \tstruct rte_kvargs *kvlist;\n@@ -1433,6 +1439,8 @@ struct mlx5_dev_spawn_data {\n \t\tDRV_LOG(WARNING, \"Multi-Packet RQ isn't supported\");\n \t\tconfig.mprq.enabled = 0;\n \t}\n+\tif (config.max_dump_files_num == 0)\n+\t\tconfig.max_dump_files_num = 128;\n \teth_dev = rte_eth_dev_allocate(name);\n \tif (eth_dev == NULL) {\n \t\tDRV_LOG(ERR, \"can not allocate rte ethdev\");\ndiff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h\nindex 3eaaafd..4c339d0 100644\n--- a/drivers/net/mlx5/mlx5.h\n+++ b/drivers/net/mlx5/mlx5.h\n@@ -204,6 +204,7 @@ struct mlx5_dev_config {\n \tunsigned int flow_prio; /* Number of flow priorities. */\n \tunsigned int tso_max_payload_sz; /* Maximum TCP payload for TSO. */\n \tunsigned int ind_table_max_size; /* Maximum indirection table size. */\n+\tunsigned int max_dump_files_num; /* Maximum dump files per queue. */\n \tint txq_inline; /* Maximum packet size for inlining. */\n \tint txqs_inline; /* Queue number threshold for inlining. */\n \tint txqs_vec; /* Queue number threshold for vectorized Tx. */\ndiff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c\nindex 3da3f62..2c8d066 100644\n--- a/drivers/net/mlx5/mlx5_rxtx.c\n+++ b/drivers/net/mlx5/mlx5_rxtx.c\n@@ -524,6 +524,50 @@\n \treturn rx_queue_count(rxq);\n }\n \n+#define MLX5_SYSTEM_LOG_DIR \"/var/log\"\n+/**\n+ * Dump debug information to log file.\n+ *\n+ * @param fname\n+ *   The file name.\n+ * @param hex_title\n+ *   If not NULL this string is printed as a header to the output\n+ *   and the output will be in hexadecimal view.\n+ * @param buf\n+ *   This is the buffer address to print out.\n+ * @param len\n+ *   The number of bytes to dump out.\n+ */\n+void\n+mlx5_dump_debug_information(const char *fname, const char *hex_title,\n+\t\t\t    const void *buf, unsigned int hex_len)\n+{\n+\tFILE *fd;\n+\n+\tMKSTR(path, \"%s/%s\", MLX5_SYSTEM_LOG_DIR, fname);\n+\tfd = fopen(path, \"a+\");\n+\tif (!fd) {\n+\t\tDRV_LOG(WARNING, \"cannot open %s for debug dump\\n\",\n+\t\t\tpath);\n+\t\tMKSTR(path2, \"./%s\", fname);\n+\t\tfd = fopen(path2, \"a+\");\n+\t\tif (!fd) {\n+\t\t\tDRV_LOG(ERR, \"cannot open %s for debug dump\\n\",\n+\t\t\t\tpath2);\n+\t\t\treturn;\n+\t\t}\n+\t\tDRV_LOG(INFO, \"New debug dump in file %s\\n\", path2);\n+\t} else {\n+\t\tDRV_LOG(INFO, \"New debug dump in file %s\\n\", path);\n+\t}\n+\tif (hex_title)\n+\t\trte_hexdump(fd, hex_title, buf, hex_len);\n+\telse\n+\t\tfprintf(fd, \"%s\", (const char *)buf);\n+\tfprintf(fd, \"\\n\\n\\n\");\n+\tfclose(fd);\n+}\n+\n /**\n  * DPDK callback for TX.\n  *\ndiff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h\nindex 7bacdba..35e53fc 100644\n--- a/drivers/net/mlx5/mlx5_rxtx.h\n+++ b/drivers/net/mlx5/mlx5_rxtx.h\n@@ -356,6 +356,8 @@ uint16_t removed_rx_burst(void *dpdk_rxq, struct rte_mbuf **pkts,\n int mlx5_rx_descriptor_status(void *rx_queue, uint16_t offset);\n int mlx5_tx_descriptor_status(void *tx_queue, uint16_t offset);\n uint32_t mlx5_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id);\n+void mlx5_dump_debug_information(const char *path, const char *title,\n+\t\t\t\t const void *buf, unsigned int len);\n \n /* Vectorized version of mlx5_rxtx.c */\n int mlx5_check_raw_vec_tx_support(struct rte_eth_dev *dev);\n",
    "prefixes": [
        "v1",
        "2/9"
    ]
}