Show a patch.

GET /api/patches/231/
Content-Type: application/json
Vary: Accept

    "id": 231,
    "url": "",
    "web_url": "",
    "project": {
        "id": 1,
        "url": "",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "",
        "list_email": "",
        "web_url": "",
        "scm_url": "git://",
        "webscm_url": ""
    "msgid": "<>",
    "date": "2014-08-26T14:09:15",
    "name": "[dpdk-dev,05/11] i40e: clean log messages",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "c9a3a52e96f2840416aae91eb8781ecbe00984de",
    "submitter": {
        "id": 3,
        "url": "",
        "name": "David Marchand",
        "email": ""
    "delegate": null,
    "mbox": "",
    "series": [],
    "comments": "",
    "check": "pending",
    "checks": "",
    "tags": {},
    "headers": {
        "List-Subscribe": "<>,\n\t<>",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\; s=20130820;\n\th=x-gm-message-state:from:to:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=+NQHr0+waa5rpY9gMGDEU5IqMW+RMsCRceBmgTGqXjM=;\n\tb=CUUW4wLFGjv+4uno4rrayctpDPnMEMq95ZctIbMEKjF6DOKpIa57rm7yUie/uqVKEo\n\t55D6mr9cZKXs52LlDj592WUBD1jEI5Nw/A0R1FVgC2AkZn9zvg1fXUrR0LS/WqcJdo/T\n\tjfkhfHs7xFIS9+9lZYP5SffQ/XDIo0GQc1r7gJjJlaJWtUDmkMLAboemdjYoI6oX3Cea\n\teLA9LAJgfPQbdGeUurmPfGmlCYtCB5OlQRH4AKIysHeRw+aaKADzFaohCH/sXhomDwFq\n\t33Y/eXj9SFpusN0kt7FRnCVa/E6xcCRn1mW/06ObKlwWGML7WVtUfIVF2s7yYnTRfBJK\n\tjGGA==",
        "In-Reply-To": "<>",
        "List-Help": "<>",
        "X-BeenThere": "",
        "References": "<>",
        "X-Mailer": "git-send-email",
        "X-Gm-Message-State": "ALoCoQmerYR4CLlg+SjbKz+amEu860VmoM5/Ah+VHNzQrj/aWuALeeccq35w5FW+ufY5JqASyqHc",
        "List-Archive": "<>",
        "To": "",
        "Date": "Tue, 26 Aug 2014 16:09:15 +0200",
        "Received": [
            "from (\n\t[]) by (Postfix) with ESMTP id 78F8D682E\n\tfor <>; Tue, 26 Aug 2014 16:05:36 +0200 (CEST)",
            "by with SMTP id n3so4230093wiv.1\n\tfor <>; Tue, 26 Aug 2014 07:09:36 -0700 (PDT)",
            "from (\n\t[]) by with ESMTPSA id\n\tcy9sm12543569wib.18.2014. for <>\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tTue, 26 Aug 2014 07:09:35 -0700 (PDT)"
        "From": "David Marchand <>",
        "Precedence": "list",
        "Message-Id": "<>",
        "List-Id": "patches and discussions about DPDK <>",
        "Subject": "[dpdk-dev] [PATCH 05/11] i40e: clean log messages",
        "X-List-Received-Date": "Tue, 26 Aug 2014 14:05:36 -0000",
        "List-Unsubscribe": "<>,\n\t<>",
        "Return-Path": "<>",
        "List-Post": "<>",
        "X-Received": "by with SMTP id\n\tbn10mr16408541wjc.81.1409062176522; \n\tTue, 26 Aug 2014 07:09:36 -0700 (PDT)",
        "X-Mailman-Version": "2.1.15"
    "content": "Clean log messages:\n- remove superfluous \\n in log macros and add some \\n where needed,\n- remove leading \\n in some messages,\n- split multi lines messages,\n- replace some PMD_INIT_LOG(DEBUG, \"some_func\\n\") with PMD_INIT_FUNC_TRACE().\n\nSigned-off-by: David Marchand <>\n---\n lib/librte_pmd_i40e/i40e/i40e_osdep.h |    2 +-\n lib/librte_pmd_i40e/i40e_ethdev.c     |   43 +++++++++++++++++----------------\n lib/librte_pmd_i40e/i40e_ethdev_vf.c  |    4 +--\n lib/librte_pmd_i40e/i40e_logs.h       |   12 ++++-----\n lib/librte_pmd_i40e/i40e_pf.c         |    4 +--\n lib/librte_pmd_i40e/i40e_rxtx.c       |    6 ++---\n 6 files changed, 36 insertions(+), 35 deletions(-)",
    "diff": "diff --git a/lib/librte_pmd_i40e/i40e/i40e_osdep.h b/lib/librte_pmd_i40e/i40e/i40e_osdep.h\nindex 0ed4b65..5f1c98f 100644\n--- a/lib/librte_pmd_i40e/i40e/i40e_osdep.h\n+++ b/lib/librte_pmd_i40e/i40e/i40e_osdep.h\n@@ -112,7 +112,7 @@ typedef enum i40e_status_code i40e_status;\n #define i40e_debug(h, m, s, ...)                                \\\n do {                                                            \\\n \tif (((m) & (h)->debug_mask))                            \\\n-\t\tPMD_DRV_LOG(DEBUG, \"i40e %02x.%x \" s,           \\\n+\t\tPMD_DRV_LOG(DEBUG, \"i40e %02x.%x\\n\" s,          \\\n \t\t\t(h)->bus.device, (h)->bus.func,         \\\n \t\t\t\t\t##__VA_ARGS__);         \\\n } while (0)\ndiff --git a/lib/librte_pmd_i40e/i40e_ethdev.c b/lib/librte_pmd_i40e/i40e_ethdev.c\nindex 4e65ca4..d6104ed 100644\n--- a/lib/librte_pmd_i40e/i40e_ethdev.c\n+++ b/lib/librte_pmd_i40e/i40e_ethdev.c\n@@ -388,14 +388,15 @@ eth_i40e_dev_init(__rte_unused struct eth_driver *eth_drv,\n \t/* Reset here to make sure all is clean for each PF */\n \tret = i40e_pf_reset(hw);\n \tif (ret) {\n-\t\tPMD_INIT_LOG(ERR, \"Failed to reset pf: %d\", ret);\n+\t\tPMD_INIT_LOG(ERR, \"Failed to reset pf: %d\\n\", ret);\n \t\treturn ret;\n \t}\n \n \t/* Initialize the shared code (base driver) */\n \tret = i40e_init_shared_code(hw);\n \tif (ret) {\n-\t\tPMD_INIT_LOG(ERR, \"Failed to init shared code (base driver): %d\", ret);\n+\t\tPMD_INIT_LOG(ERR, \"Failed to init shared code (base driver):\"\n+\t\t\t     \"%d\\n\", ret);\n \t\treturn ret;\n \t}\n \n@@ -403,7 +404,7 @@ eth_i40e_dev_init(__rte_unused struct eth_driver *eth_drv,\n \ti40e_init_adminq_parameter(hw);\n \tret = i40e_init_adminq(hw);\n \tif (ret != I40E_SUCCESS) {\n-\t\tPMD_INIT_LOG(ERR, \"Failed to init adminq: %d\", ret);\n+\t\tPMD_INIT_LOG(ERR, \"Failed to init adminq: %d\\n\", ret);\n \t\treturn -EIO;\n \t}\n \tPMD_INIT_LOG(INFO, \"FW %d.%d API %d.%d NVM \"\n@@ -425,14 +426,14 @@ eth_i40e_dev_init(__rte_unused struct eth_driver *eth_drv,\n \t/* Get hw capabilities */\n \tret = i40e_get_cap(hw);\n \tif (ret != I40E_SUCCESS) {\n-\t\tPMD_INIT_LOG(ERR, \"Failed to get capabilities: %d\", ret);\n+\t\tPMD_INIT_LOG(ERR, \"Failed to get capabilities: %d\\n\", ret);\n \t\tgoto err_get_capabilities;\n \t}\n \n \t/* Initialize parameters for PF */\n \tret = i40e_pf_parameter_init(dev);\n \tif (ret != 0) {\n-\t\tPMD_INIT_LOG(ERR, \"Failed to do parameter init: %d\", ret);\n+\t\tPMD_INIT_LOG(ERR, \"Failed to do parameter init: %d\\n\", ret);\n \t\tgoto err_parameter_init;\n \t}\n \n@@ -453,21 +454,21 @@ eth_i40e_dev_init(__rte_unused struct eth_driver *eth_drv,\n \tret = i40e_init_lan_hmc(hw, hw->func_caps.num_tx_qp,\n \t\t\t\thw->func_caps.num_rx_qp, 0, 0);\n \tif (ret != I40E_SUCCESS) {\n-\t\tPMD_INIT_LOG(ERR, \"Failed to init lan hmc: %d\", ret);\n+\t\tPMD_INIT_LOG(ERR, \"Failed to init lan hmc: %d\\n\", ret);\n \t\tgoto err_init_lan_hmc;\n \t}\n \n \t/* Configure lan hmc */\n \tret = i40e_configure_lan_hmc(hw, I40E_HMC_MODEL_DIRECT_ONLY);\n \tif (ret != I40E_SUCCESS) {\n-\t\tPMD_INIT_LOG(ERR, \"Failed to configure lan hmc: %d\", ret);\n+\t\tPMD_INIT_LOG(ERR, \"Failed to configure lan hmc: %d\\n\", ret);\n \t\tgoto err_configure_lan_hmc;\n \t}\n \n \t/* Get and check the mac address */\n \ti40e_get_mac_addr(hw, hw->mac.addr);\n \tif (i40e_validate_mac_addr(hw->mac.addr) != I40E_SUCCESS) {\n-\t\tPMD_INIT_LOG(ERR, \"mac address is not valid\");\n+\t\tPMD_INIT_LOG(ERR, \"mac address is not valid\\n\");\n \t\tret = -EIO;\n \t\tgoto err_get_mac_addr;\n \t}\n@@ -482,7 +483,7 @@ eth_i40e_dev_init(__rte_unused struct eth_driver *eth_drv,\n \t/* PF setup, which includes VSI setup */\n \tret = i40e_pf_setup(pf);\n \tif (ret) {\n-\t\tPMD_INIT_LOG(ERR, \"Failed to setup pf switch: %d\", ret);\n+\t\tPMD_INIT_LOG(ERR, \"Failed to setup pf switch: %d\\n\", ret);\n \t\tgoto err_setup_pf_switch;\n \t}\n \n@@ -499,8 +500,8 @@ eth_i40e_dev_init(__rte_unused struct eth_driver *eth_drv,\n \t/* Should be after VSI initialized */\n \tdev->data->mac_addrs = rte_zmalloc(\"i40e\", len, 0);\n \tif (!dev->data->mac_addrs) {\n-\t\tPMD_INIT_LOG(ERR, \"Failed to allocated memory \"\n-\t\t\t\t\t\"for storing mac address\");\n+\t\tPMD_INIT_LOG(ERR, \"Failed to allocated memory for storing \"\n+\t\t\t     \"mac address\\n\");\n \t\tgoto err_get_mac_addr;\n \t}\n \tether_addr_copy((struct ether_addr *)hw->mac.perm_addr,\n@@ -723,9 +724,9 @@ i40e_phy_conf_link(struct i40e_hw *hw, uint8_t abilities, uint8_t force_speed)\n \tphy_conf.eeer = phy_ab.eeer_val;\n \tphy_conf.low_power_ctrl = phy_ab.d3_lpan;\n \n-\tPMD_DRV_LOG(DEBUG, \"\\n\\tCurrent: abilities %x, link_speed %x\\n\"\n-\t\t    \"\\tConfig:  abilities %x, link_speed %x\",\n-\t\t    phy_ab.abilities, phy_ab.link_speed,\n+\tPMD_DRV_LOG(DEBUG, \"\\tCurrent: abilities %x, link_speed %x\\n\"\n+\t\t    phy_ab.abilities, phy_ab.link_speed);\n+\tPMD_DRV_LOG(DEBUG, \"\\tConfig:  abilities %x, link_speed %x\\n\",\n \t\t    phy_conf.abilities, phy_conf.link_speed);\n \n \tstatus = i40e_aq_set_phy_config(hw, &phy_conf, NULL);\n@@ -2521,7 +2522,7 @@ i40e_vsi_dump_bw_config(struct i40e_vsi *vsi)\n \t\t\t\t\tets_sla_config.share_credits[i]);\n \t\tPMD_DRV_LOG(INFO, \"\\tVSI TC%u:credits %u\\n\", i,\n \t\t\trte_le_to_cpu_16(ets_sla_config.credits[i]));\n-\t\tPMD_DRV_LOG(INFO, \"\\tVSI TC%u: max credits: %u\", i,\n+\t\tPMD_DRV_LOG(INFO, \"\\tVSI TC%u: max credits: %u\\n\", i,\n \t\t\trte_le_to_cpu_16(ets_sla_config.credits[i / 4]) >>\n \t\t\t\t\t\t\t\t(i * 4));\n \t}\n@@ -2589,7 +2590,7 @@ i40e_vsi_setup(struct i40e_pf *pf,\n \t}\n \tret = i40e_res_pool_alloc(&pf->qp_pool, vsi->nb_qps);\n \tif (ret < 0) {\n-\t\tPMD_DRV_LOG(ERR, \"VSI %d allocate queue failed %d\",\n+\t\tPMD_DRV_LOG(ERR, \"VSI %d allocate queue failed %d\\n\",\n \t\t\t\tvsi->seid, ret);\n \t\tgoto fail_mem;\n \t}\n@@ -2599,7 +2600,7 @@ i40e_vsi_setup(struct i40e_pf *pf,\n \tif (type != I40E_VSI_SRIOV) {\n \t\tret = i40e_res_pool_alloc(&pf->msix_pool, 1);\n \t\tif (ret < 0) {\n-\t\t\tPMD_DRV_LOG(ERR, \"VSI %d get heap failed %d\", vsi->seid, ret);\n+\t\t\tPMD_DRV_LOG(ERR, \"VSI %d get heap failed %d\\n\", vsi->seid, ret);\n \t\t\tgoto fail_queue_alloc;\n \t\t}\n \t\tvsi->msix_intr = ret;\n@@ -2909,14 +2910,14 @@ i40e_pf_setup(struct i40e_pf *pf)\n \n \tret = i40e_pf_get_switch_config(pf);\n \tif (ret != I40E_SUCCESS) {\n-\t\tPMD_DRV_LOG(ERR, \"Could not get switch config, err %d\", ret);\n+\t\tPMD_DRV_LOG(ERR, \"Could not get switch config, err %d\\n\", ret);\n \t\treturn ret;\n \t}\n \n \t/* VSI setup */\n \tvsi = i40e_vsi_setup(pf, I40E_VSI_MAIN, NULL, 0);\n \tif (!vsi) {\n-\t\tPMD_DRV_LOG(ERR, \"Setup of main vsi failed\");\n+\t\tPMD_DRV_LOG(ERR, \"Setup of main vsi failed\\n\");\n \t\treturn I40E_ERR_NOT_READY;\n \t}\n \tpf->main_vsi = vsi;\n@@ -2931,8 +2932,8 @@ i40e_pf_setup(struct i40e_pf *pf)\n \tsettings.enable_macvlan = TRUE;\n \tret = i40e_set_filter_control(hw, &settings);\n \tif (ret)\n-\t\tPMD_INIT_LOG(WARNING, \"setup_pf_filter_control failed: %d\",\n-\t\t\t\t\t\t\t\tret);\n+\t\tPMD_INIT_LOG(WARNING, \"setup_pf_filter_control failed: %d\\n\",\n+\t\t\t     ret);\n \n \t/* Update flow control according to the auto negotiation */\n \ti40e_update_flow_control(hw);\ndiff --git a/lib/librte_pmd_i40e/i40e_ethdev_vf.c b/lib/librte_pmd_i40e/i40e_ethdev_vf.c\nindex d8552ad..7672aa8 100644\n--- a/lib/librte_pmd_i40e/i40e_ethdev_vf.c\n+++ b/lib/librte_pmd_i40e/i40e_ethdev_vf.c\n@@ -1101,7 +1101,7 @@ i40evf_dev_init(__rte_unused struct eth_driver *eth_drv,\n \t\t\t\t\tETHER_ADDR_LEN, 0);\n \tif (eth_dev->data->mac_addrs == NULL) {\n \t\tPMD_INIT_LOG(ERR, \"Failed to allocate %d bytes needed to \"\n-\t\t\t\t\"store MAC addresses\", ETHER_ADDR_LEN);\n+\t\t\t\t\"store MAC addresses\\n\", ETHER_ADDR_LEN);\n \t\treturn -ENOMEM;\n \t}\n \tether_addr_copy((struct ether_addr *)hw->mac.addr,\n@@ -1384,7 +1384,7 @@ i40evf_dev_start(struct rte_eth_dev *dev)\n \tstruct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);\n \tstruct ether_addr mac_addr;\n \n-\tPMD_DRV_LOG(DEBUG, \"i40evf_dev_start\");\n+\tPMD_INIT_FUNC_TRACE();\n \n \tvf->max_pkt_len = dev->data->dev_conf.rxmode.max_rx_pkt_len;\n \tif (dev->data->dev_conf.rxmode.jumbo_frame == 1) {\ndiff --git a/lib/librte_pmd_i40e/i40e_logs.h b/lib/librte_pmd_i40e/i40e_logs.h\nindex f991dd2..b78e2a1 100644\n--- a/lib/librte_pmd_i40e/i40e_logs.h\n+++ b/lib/librte_pmd_i40e/i40e_logs.h\n@@ -36,8 +36,8 @@\n \n #ifdef RTE_LIBRTE_I40E_DEBUG_INIT\n #define PMD_INIT_LOG(level, fmt, args...) \\\n-\tRTE_LOG(level, PMD, \"%s(): \" fmt \"\\n\", __func__, ## args)\n-#define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, \" >>\")\n+\tRTE_LOG(level, PMD, \"%s(): \" fmt, __func__, ## args)\n+#define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, \" >>\\n\")\n #else\n #define PMD_INIT_LOG(level, fmt, args...) do { } while(0)\n #define PMD_INIT_FUNC_TRACE() do { } while(0)\n@@ -45,28 +45,28 @@\n \n #ifdef RTE_LIBRTE_I40E_DEBUG_RX\n #define PMD_RX_LOG(level, fmt, args...) \\\n-\tRTE_LOG(level, PMD, \"%s(): \" fmt \"\\n\", __func__, ## args)\n+\tRTE_LOG(level, PMD, \"%s(): \" fmt, __func__, ## args)\n #else\n #define PMD_RX_LOG(level, fmt, args...) do { } while(0)\n #endif\n \n #ifdef RTE_LIBRTE_I40E_DEBUG_TX\n #define PMD_TX_LOG(level, fmt, args...) \\\n-\tRTE_LOG(level, PMD, \"%s(): \" fmt \"\\n\", __func__, ## args)\n+\tRTE_LOG(level, PMD, \"%s(): \" fmt, __func__, ## args)\n #else\n #define PMD_TX_LOG(level, fmt, args...) do { } while(0)\n #endif\n \n #ifdef RTE_LIBRTE_I40E_DEBUG_TX_FREE\n #define PMD_TX_FREE_LOG(level, fmt, args...) \\\n-\tRTE_LOG(level, PMD, \"%s(): \" fmt \"\\n\", __func__, ## args)\n+\tRTE_LOG(level, PMD, \"%s(): \" fmt, __func__, ## args)\n #else\n #define PMD_TX_FREE_LOG(level, fmt, args...) do { } while(0)\n #endif\n \n #ifdef RTE_LIBRTE_I40E_DEBUG_DRIVER\n #define PMD_DRV_LOG(level, fmt, args...) \\\n-\tRTE_LOG(level, PMD, \"%s(): \" fmt \"\\n\", __func__, ## args)\n+\tRTE_LOG(level, PMD, \"%s(): \" fmt, __func__, ## args)\n #else\n #define PMD_DRV_LOG(level, fmt, args...) do { } while(0)\n #endif\ndiff --git a/lib/librte_pmd_i40e/i40e_pf.c b/lib/librte_pmd_i40e/i40e_pf.c\nindex e8b154d..0a726d6 100644\n--- a/lib/librte_pmd_i40e/i40e_pf.c\n+++ b/lib/librte_pmd_i40e/i40e_pf.c\n@@ -439,7 +439,7 @@ i40e_pf_host_process_cmd_config_vsi_queues(struct i40e_pf_vf *vf,\n \t\t/* Apply VF RX queue setting to HMC */\n \t\tif (i40e_pf_host_hmc_config_rxq(hw, vf, &qpair[i].rxq)\n \t\t\t!= I40E_SUCCESS) {\n-\t\t\tPMD_DRV_LOG(ERR, \"Configure RX queue HMC failed\");\n+\t\t\tPMD_DRV_LOG(ERR, \"Configure RX queue HMC failed\\n\");\n \t\t\tret = I40E_ERR_PARAM;\n \t\t\tgoto send_msg;\n \t\t}\n@@ -447,7 +447,7 @@ i40e_pf_host_process_cmd_config_vsi_queues(struct i40e_pf_vf *vf,\n \t\t/* Apply VF TX queue setting to HMC */\n \t\tif (i40e_pf_host_hmc_config_txq(hw, vf, &qpair[i].txq)\n \t\t\t!= I40E_SUCCESS) {\n-\t\t\tPMD_DRV_LOG(ERR, \"Configure TX queue HMC failed\");\n+\t\t\tPMD_DRV_LOG(ERR, \"Configure TX queue HMC failed\\n\");\n \t\t\tret = I40E_ERR_PARAM;\n \t\t\tgoto send_msg;\n \t\t}\ndiff --git a/lib/librte_pmd_i40e/i40e_rxtx.c b/lib/librte_pmd_i40e/i40e_rxtx.c\nindex f153844..d592ad6 100644\n--- a/lib/librte_pmd_i40e/i40e_rxtx.c\n+++ b/lib/librte_pmd_i40e/i40e_rxtx.c\n@@ -507,7 +507,7 @@ i40e_xmit_cleanup(struct i40e_tx_queue *txq)\n \tif (!(txd[desc_to_clean_to].cmd_type_offset_bsz &\n \t\trte_cpu_to_le_64(I40E_TX_DESC_DTYPE_DESC_DONE))) {\n \t\tPMD_TX_FREE_LOG(DEBUG, \"TX descriptor %4u is not done \"\n-\t\t\t\"(port=%d queue=%d)\", desc_to_clean_to,\n+\t\t\t\t\"(port=%d queue=%d)\\n\", desc_to_clean_to,\n \t\t\t\ttxq->port_id, txq->queue_id);\n \t\treturn -1;\n \t}\n@@ -1219,7 +1219,7 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)\n \t\tif (txq->nb_tx_used >= txq->tx_rs_thresh) {\n \t\t\tPMD_TX_FREE_LOG(DEBUG,\n \t\t\t\t\t\"Setting RS bit on TXD id=\"\n-\t\t\t\t\t\"%4u (port=%d queue=%d)\",\n+\t\t\t\t\t\"%4u (port=%d queue=%d)\\n\",\n \t\t\t\t\ttx_last, txq->port_id, txq->queue_id);\n \n \t\t\ttd_cmd |= I40E_TX_DESC_CMD_RS;\n@@ -1236,7 +1236,7 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)\n end_of_tx:\n \trte_wmb();\n \n-\tPMD_TX_LOG(DEBUG, \"port_id=%u queue_id=%u tx_tail=%u nb_tx=%u\",\n+\tPMD_TX_LOG(DEBUG, \"port_id=%u queue_id=%u tx_tail=%u nb_tx=%u\\n\",\n \t\t   (unsigned) txq->port_id, (unsigned) txq->queue_id,\n \t\t   (unsigned) tx_id, (unsigned) nb_tx);\n \n",
    "prefixes": [