get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 70342,
    "url": "http://patches.dpdk.org/api/patches/70342/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200515184542.89318-6-ajit.khaparde@broadcom.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": "<20200515184542.89318-6-ajit.khaparde@broadcom.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200515184542.89318-6-ajit.khaparde@broadcom.com",
    "date": "2020-05-15T18:45:38",
    "name": "[v1,5/9] net/bnxt: fix to alloc link info struct",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "b7cef9a60a2a6be9bc9e0aa3425ce6c76fd8b994",
    "submitter": {
        "id": 501,
        "url": "http://patches.dpdk.org/api/people/501/?format=api",
        "name": "Ajit Khaparde",
        "email": "ajit.khaparde@broadcom.com"
    },
    "delegate": {
        "id": 1766,
        "url": "http://patches.dpdk.org/api/users/1766/?format=api",
        "username": "ajitkhaparde",
        "first_name": "Ajit",
        "last_name": "Khaparde",
        "email": "ajit.khaparde@broadcom.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20200515184542.89318-6-ajit.khaparde@broadcom.com/mbox/",
    "series": [
        {
            "id": 10105,
            "url": "http://patches.dpdk.org/api/series/10105/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=10105",
            "date": "2020-05-15T18:45:33",
            "name": "bug fixes for bnxt PMD",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/10105/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/70342/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/70342/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 7DB91A00C3;\n\tFri, 15 May 2020 20:46:41 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id A78401DB3A;\n\tFri, 15 May 2020 20:45:59 +0200 (CEST)",
            "from rnd-relay.smtp.broadcom.com (rnd-relay.smtp.broadcom.com\n [192.19.229.170]) by dpdk.org (Postfix) with ESMTP id 0EB241DAC0;\n Fri, 15 May 2020 20:45:52 +0200 (CEST)",
            "from mail-irv-17.broadcom.com (mail-irv-17.lvn.broadcom.net\n [10.75.242.48])\n by rnd-relay.smtp.broadcom.com (Postfix) with ESMTP id 7301391BEC;\n Fri, 15 May 2020 11:44:44 -0700 (PDT)",
            "from localhost.localdomain (unknown [10.230.185.215])\n by mail-irv-17.broadcom.com (Postfix) with ESMTP id 84B9C14008D;\n Fri, 15 May 2020 11:45:50 -0700 (PDT)"
        ],
        "DKIM-Filter": "OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com 7301391BEC",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com;\n s=dkimrelay; t=1589568284;\n bh=6PLKxsk2TUtkRv/7Jklqn4ck+RxhpHbGlhcZemwd/so=;\n h=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n b=d1nVfx2Je7RkAIoWywY1t3SSEHDsdZdE8e851UyEyKeQgFF/QLCmgAEvxMJ2Zv/TJ\n 18+o5kSNn5rPnuaDzJxoOtgxJCRWN9NkIi2XWeqWYyA4krDhJEj9w3OYKxwUE2Ehtz\n LQ60SALVGR7TkdbH//Oxbah7nmXShwBTMvwgjVCY=",
        "From": "Ajit Khaparde <ajit.khaparde@broadcom.com>",
        "To": "dev@dpdk.org",
        "Cc": "ferruh.yigit@intel.com, stable@dpdk.org,\n Kalesh AP <kalesh-anakkur.purayil@broadcom.com>,\n Somnath Kotur <somnath.kotur@broadcom.com>",
        "Date": "Fri, 15 May 2020 11:45:38 -0700",
        "Message-Id": "<20200515184542.89318-6-ajit.khaparde@broadcom.com>",
        "X-Mailer": "git-send-email 2.21.1 (Apple Git-122.3)",
        "In-Reply-To": "<20200515184542.89318-1-ajit.khaparde@broadcom.com>",
        "References": "<20200515184542.89318-1-ajit.khaparde@broadcom.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v1 5/9] net/bnxt: fix to alloc link info struct",
        "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": "Dynamically alloc link info structure.\n\nFixes: 1d0704f4d793 (\"net/bnxt: add device configure operation\")\nCc: stable@dpdk.org\n\nSigned-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>\nSigned-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>\nReviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>\n---\n drivers/net/bnxt/bnxt.h        |  2 +-\n drivers/net/bnxt/bnxt_ethdev.c | 65 ++++++++++++++++++++++------------\n drivers/net/bnxt/bnxt_hwrm.c   | 28 +++++++--------\n 3 files changed, 58 insertions(+), 37 deletions(-)",
    "diff": "diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h\nindex b71435495..b66f6ba25 100644\n--- a/drivers/net/bnxt/bnxt.h\n+++ b/drivers/net/bnxt/bnxt.h\n@@ -648,7 +648,7 @@ struct bnxt {\n \t/* default HWRM request timeout value */\n \tuint32_t\t\t\thwrm_cmd_timeout;\n \n-\tstruct bnxt_link_info\tlink_info;\n+\tstruct bnxt_link_info\t\t*link_info;\n \tstruct bnxt_cos_queue_info\t*rx_cos_queue;\n \tstruct bnxt_cos_queue_info\t*tx_cos_queue;\n \tuint8_t\t\t\ttx_cosq_id[BNXT_COS_QUEUE_COUNT];\ndiff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c\nindex 90fb7f635..7367c14d4 100644\n--- a/drivers/net/bnxt/bnxt_ethdev.c\n+++ b/drivers/net/bnxt/bnxt_ethdev.c\n@@ -191,6 +191,11 @@ static uint16_t  bnxt_rss_hash_tbl_size(const struct bnxt *bp)\n \treturn bnxt_rss_ctxts(bp) * BNXT_RSS_ENTRIES_PER_CTX_THOR;\n }\n \n+static void bnxt_free_link_info(struct bnxt *bp)\n+{\n+\trte_free(bp->link_info);\n+}\n+\n static void bnxt_free_leds_info(struct bnxt *bp)\n {\n \trte_free(bp->leds);\n@@ -233,6 +238,16 @@ static void bnxt_free_mem(struct bnxt *bp, bool reconfig)\n \tbp->grp_info = NULL;\n }\n \n+static int bnxt_alloc_link_info(struct bnxt *bp)\n+{\n+\tbp->link_info =\n+\t\trte_zmalloc(\"bnxt_link_info\", sizeof(struct bnxt_link_info), 0);\n+\tif (bp->link_info == NULL)\n+\t\treturn -ENOMEM;\n+\n+\treturn 0;\n+}\n+\n static int bnxt_alloc_leds_info(struct bnxt *bp)\n {\n \tbp->leds = rte_zmalloc(\"bnxt_leds\",\n@@ -709,7 +724,7 @@ static int bnxt_init_chip(struct bnxt *bp)\n \t\tgoto err_free;\n \t}\n \n-\tif (!bp->link_info.link_up) {\n+\tif (!bp->link_info->link_up) {\n \t\trc = bnxt_set_hwrm_link_config(bp, true);\n \t\tif (rc) {\n \t\t\tPMD_DRV_LOG(ERR,\n@@ -751,7 +766,7 @@ static int bnxt_shutdown_nic(struct bnxt *bp)\n \n static uint32_t bnxt_get_speed_capabilities(struct bnxt *bp)\n {\n-\tuint32_t link_speed = bp->link_info.support_speeds;\n+\tuint32_t link_speed = bp->link_info->support_speeds;\n \tuint32_t speed_capa = 0;\n \n \tif (link_speed & HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_100MB)\n@@ -777,7 +792,8 @@ static uint32_t bnxt_get_speed_capabilities(struct bnxt *bp)\n \tif (link_speed & HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_200GB)\n \t\tspeed_capa |= ETH_LINK_SPEED_200G;\n \n-\tif (bp->link_info.auto_mode == HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_MODE_NONE)\n+\tif (bp->link_info->auto_mode ==\n+\t    HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_MODE_NONE)\n \t\tspeed_capa |= ETH_LINK_SPEED_FIXED;\n \telse\n \t\tspeed_capa |= ETH_LINK_SPEED_AUTONEG;\n@@ -1210,7 +1226,7 @@ static int bnxt_dev_set_link_up_op(struct rte_eth_dev *eth_dev)\n \tstruct bnxt *bp = eth_dev->data->dev_private;\n \tint rc = 0;\n \n-\tif (!bp->link_info.link_up)\n+\tif (!bp->link_info->link_up)\n \t\trc = bnxt_set_hwrm_link_config(bp, true);\n \tif (!rc)\n \t\teth_dev->data->dev_link.link_status = 1;\n@@ -1225,7 +1241,7 @@ static int bnxt_dev_set_link_down_op(struct rte_eth_dev *eth_dev)\n \n \teth_dev->data->dev_link.link_status = 0;\n \tbnxt_set_hwrm_link_config(bp, false);\n-\tbp->link_info.link_up = 0;\n+\tbp->link_info->link_up = 0;\n \n \treturn 0;\n }\n@@ -1302,6 +1318,7 @@ static void bnxt_dev_close_op(struct rte_eth_dev *eth_dev)\n \n \tbnxt_free_leds_info(bp);\n \tbnxt_free_cos_queues(bp);\n+\tbnxt_free_link_info(bp);\n \n \teth_dev->dev_ops = NULL;\n \teth_dev->rx_pkt_burst = NULL;\n@@ -1867,9 +1884,9 @@ static int bnxt_flow_ctrl_get_op(struct rte_eth_dev *dev,\n \t\treturn rc;\n \n \tmemset(fc_conf, 0, sizeof(*fc_conf));\n-\tif (bp->link_info.auto_pause)\n+\tif (bp->link_info->auto_pause)\n \t\tfc_conf->autoneg = 1;\n-\tswitch (bp->link_info.pause) {\n+\tswitch (bp->link_info->pause) {\n \tcase 0:\n \t\tfc_conf->mode = RTE_FC_NONE;\n \t\tbreak;\n@@ -1904,40 +1921,40 @@ static int bnxt_flow_ctrl_set_op(struct rte_eth_dev *dev,\n \n \tswitch (fc_conf->mode) {\n \tcase RTE_FC_NONE:\n-\t\tbp->link_info.auto_pause = 0;\n-\t\tbp->link_info.force_pause = 0;\n+\t\tbp->link_info->auto_pause = 0;\n+\t\tbp->link_info->force_pause = 0;\n \t\tbreak;\n \tcase RTE_FC_RX_PAUSE:\n \t\tif (fc_conf->autoneg) {\n-\t\t\tbp->link_info.auto_pause =\n+\t\t\tbp->link_info->auto_pause =\n \t\t\t\t\tHWRM_PORT_PHY_CFG_INPUT_AUTO_PAUSE_RX;\n-\t\t\tbp->link_info.force_pause = 0;\n+\t\t\tbp->link_info->force_pause = 0;\n \t\t} else {\n-\t\t\tbp->link_info.auto_pause = 0;\n-\t\t\tbp->link_info.force_pause =\n+\t\t\tbp->link_info->auto_pause = 0;\n+\t\t\tbp->link_info->force_pause =\n \t\t\t\t\tHWRM_PORT_PHY_CFG_INPUT_FORCE_PAUSE_RX;\n \t\t}\n \t\tbreak;\n \tcase RTE_FC_TX_PAUSE:\n \t\tif (fc_conf->autoneg) {\n-\t\t\tbp->link_info.auto_pause =\n+\t\t\tbp->link_info->auto_pause =\n \t\t\t\t\tHWRM_PORT_PHY_CFG_INPUT_AUTO_PAUSE_TX;\n-\t\t\tbp->link_info.force_pause = 0;\n+\t\t\tbp->link_info->force_pause = 0;\n \t\t} else {\n-\t\t\tbp->link_info.auto_pause = 0;\n-\t\t\tbp->link_info.force_pause =\n+\t\t\tbp->link_info->auto_pause = 0;\n+\t\t\tbp->link_info->force_pause =\n \t\t\t\t\tHWRM_PORT_PHY_CFG_INPUT_FORCE_PAUSE_TX;\n \t\t}\n \t\tbreak;\n \tcase RTE_FC_FULL:\n \t\tif (fc_conf->autoneg) {\n-\t\t\tbp->link_info.auto_pause =\n+\t\t\tbp->link_info->auto_pause =\n \t\t\t\t\tHWRM_PORT_PHY_CFG_INPUT_AUTO_PAUSE_TX |\n \t\t\t\t\tHWRM_PORT_PHY_CFG_INPUT_AUTO_PAUSE_RX;\n-\t\t\tbp->link_info.force_pause = 0;\n+\t\t\tbp->link_info->force_pause = 0;\n \t\t} else {\n-\t\t\tbp->link_info.auto_pause = 0;\n-\t\t\tbp->link_info.force_pause =\n+\t\t\tbp->link_info->auto_pause = 0;\n+\t\t\tbp->link_info->force_pause =\n \t\t\t\t\tHWRM_PORT_PHY_CFG_INPUT_FORCE_PAUSE_TX |\n \t\t\t\t\tHWRM_PORT_PHY_CFG_INPUT_FORCE_PAUSE_RX;\n \t\t}\n@@ -4229,7 +4246,7 @@ static void bnxt_write_fw_reset_reg(struct bnxt *bp, uint32_t index)\n static void bnxt_dev_cleanup(struct bnxt *bp)\n {\n \tbnxt_set_hwrm_link_config(bp, false);\n-\tbp->link_info.link_up = 0;\n+\tbp->link_info->link_up = 0;\n \tif (bp->eth_dev->data->dev_started)\n \t\tbnxt_dev_stop_op(bp->eth_dev);\n \n@@ -5440,6 +5457,10 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)\n \t\treturn rc;\n \t}\n \n+\trc = bnxt_alloc_link_info(bp);\n+\tif (rc)\n+\t\tgoto error_free;\n+\n \trc = bnxt_alloc_hwrm_resources(bp);\n \tif (rc) {\n \t\tPMD_DRV_LOG(ERR,\ndiff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c\nindex 4022fafd1..2e93a847f 100644\n--- a/drivers/net/bnxt/bnxt_hwrm.c\n+++ b/drivers/net/bnxt/bnxt_hwrm.c\n@@ -1223,7 +1223,7 @@ static int bnxt_hwrm_port_phy_cfg(struct bnxt *bp, struct bnxt_link_info *conf)\n \n \tif (conf->link_up) {\n \t\t/* Setting Fixed Speed. But AutoNeg is ON, So disable it */\n-\t\tif (bp->link_info.auto_mode && conf->link_speed) {\n+\t\tif (bp->link_info->auto_mode && conf->link_speed) {\n \t\t\treq.auto_mode = HWRM_PORT_PHY_CFG_INPUT_AUTO_MODE_NONE;\n \t\t\tPMD_DRV_LOG(DEBUG, \"Disabling AutoNeg\\n\");\n \t\t}\n@@ -2821,8 +2821,8 @@ bnxt_parse_eth_link_speed_mask(struct bnxt *bp, uint32_t link_speed)\n \tuint16_t ret = 0;\n \n \tif (link_speed == ETH_LINK_SPEED_AUTONEG) {\n-\t\tif (bp->link_info.support_speeds)\n-\t\t\treturn bp->link_info.support_speeds;\n+\t\tif (bp->link_info->support_speeds)\n+\t\t\treturn bp->link_info->support_speeds;\n \t\tlink_speed = BNXT_SUPPORTED_SPEEDS;\n \t}\n \n@@ -2919,7 +2919,7 @@ static uint16_t bnxt_parse_hw_link_duplex(uint16_t hw_link_duplex)\n int bnxt_get_hwrm_link_config(struct bnxt *bp, struct rte_eth_link *link)\n {\n \tint rc = 0;\n-\tstruct bnxt_link_info *link_info = &bp->link_info;\n+\tstruct bnxt_link_info *link_info = bp->link_info;\n \n \trc = bnxt_hwrm_port_phy_qcfg(bp, link_info);\n \tif (rc) {\n@@ -2981,19 +2981,19 @@ int bnxt_set_hwrm_link_config(struct bnxt *bp, bool link_up)\n \t */\n \tif (autoneg == 1 &&\n \t    !(!BNXT_CHIP_THOR(bp) &&\n-\t      (bp->link_info.auto_link_speed ||\n-\t       bp->link_info.force_link_speed))) {\n+\t      (bp->link_info->auto_link_speed ||\n+\t       bp->link_info->force_link_speed))) {\n \t\tlink_req.phy_flags |=\n \t\t\t\tHWRM_PORT_PHY_CFG_INPUT_FLAGS_RESTART_AUTONEG;\n \t\tlink_req.auto_link_speed_mask =\n \t\t\tbnxt_parse_eth_link_speed_mask(bp,\n \t\t\t\t\t\t       dev_conf->link_speeds);\n \t} else {\n-\t\tif (bp->link_info.phy_type ==\n+\t\tif (bp->link_info->phy_type ==\n \t\t    HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASET ||\n-\t\t    bp->link_info.phy_type ==\n+\t\t    bp->link_info->phy_type ==\n \t\t    HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASETE ||\n-\t\t    bp->link_info.media_type ==\n+\t\t    bp->link_info->media_type ==\n \t\t    HWRM_PORT_PHY_QCFG_OUTPUT_MEDIA_TYPE_TP) {\n \t\t\tPMD_DRV_LOG(ERR, \"10GBase-T devices must autoneg\\n\");\n \t\t\treturn -EINVAL;\n@@ -3003,14 +3003,14 @@ int bnxt_set_hwrm_link_config(struct bnxt *bp, bool link_up)\n \t\t/* If user wants a particular speed try that first. */\n \t\tif (speed)\n \t\t\tlink_req.link_speed = speed;\n-\t\telse if (bp->link_info.force_link_speed)\n-\t\t\tlink_req.link_speed = bp->link_info.force_link_speed;\n+\t\telse if (bp->link_info->force_link_speed)\n+\t\t\tlink_req.link_speed = bp->link_info->force_link_speed;\n \t\telse\n-\t\t\tlink_req.link_speed = bp->link_info.auto_link_speed;\n+\t\t\tlink_req.link_speed = bp->link_info->auto_link_speed;\n \t}\n \tlink_req.duplex = bnxt_parse_eth_link_duplex(dev_conf->link_speeds);\n-\tlink_req.auto_pause = bp->link_info.auto_pause;\n-\tlink_req.force_pause = bp->link_info.force_pause;\n+\tlink_req.auto_pause = bp->link_info->auto_pause;\n+\tlink_req.force_pause = bp->link_info->force_pause;\n \n port_phy_cfg:\n \trc = bnxt_hwrm_port_phy_cfg(bp, &link_req);\n",
    "prefixes": [
        "v1",
        "5/9"
    ]
}