get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 42033,
    "url": "http://patchwork.dpdk.org/api/patches/42033/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/1530508681-50504-1-git-send-email-xiaoyun.li@intel.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": "<1530508681-50504-1-git-send-email-xiaoyun.li@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1530508681-50504-1-git-send-email-xiaoyun.li@intel.com",
    "date": "2018-07-02T05:18:01",
    "name": "net/i40e: fix link speed issue",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "ed472549ba04e5fb1730be285e1fe808bdf6f825",
    "submitter": {
        "id": 798,
        "url": "http://patchwork.dpdk.org/api/people/798/?format=api",
        "name": "Li, Xiaoyun",
        "email": "xiaoyun.li@intel.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/1530508681-50504-1-git-send-email-xiaoyun.li@intel.com/mbox/",
    "series": [
        {
            "id": 343,
            "url": "http://patchwork.dpdk.org/api/series/343/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=343",
            "date": "2018-07-02T05:18:01",
            "name": "net/i40e: fix link speed issue",
            "version": 1,
            "mbox": "http://patchwork.dpdk.org/series/343/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/42033/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/42033/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 AD78E1C0B;\n\tMon,  2 Jul 2018 07:30:54 +0200 (CEST)",
            "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n\tby dpdk.org (Postfix) with ESMTP id D9C6C23A;\n\tMon,  2 Jul 2018 07:30:51 +0200 (CEST)",
            "from fmsmga001.fm.intel.com ([10.253.24.23])\n\tby orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t01 Jul 2018 22:30:49 -0700",
            "from dpdk-lixiaoyun.sh.intel.com ([10.67.110.193])\n\tby fmsmga001.fm.intel.com with ESMTP; 01 Jul 2018 22:30:49 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.51,298,1526367600\"; d=\"scan'208\";a=\"68888877\"",
        "From": "Xiaoyun Li <xiaoyun.li@intel.com>",
        "To": "beilei.xing@intel.com",
        "Cc": "dev@dpdk.org,\n\tXiaoyun Li <xiaoyun.li@intel.com>,\n\tstable@dpdk.org",
        "Date": "Mon,  2 Jul 2018 13:18:01 +0800",
        "Message-Id": "<1530508681-50504-1-git-send-email-xiaoyun.li@intel.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "Subject": "[dpdk-dev] [PATCH] net/i40e: fix link speed issue",
        "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": "When link needs to go up, I40E_AQ_PHY_AN_ENABLED is always be set in DPDK.\nSo all speeds are always set. This causes speed config never works.\n\nThis patch fixes this issue and only allows to set available speeds. If\nlink needs to go up and speed setting is not supported, it will print\nwarning and set default available speeds. And when link needs to go down,\nlink speed field should be set to non-zero to avoid link down issue when\nbinding back to kernel driver.\n\nFixes: ca7e599d4506 (\"net/i40e: fix link management\")\nFixes: 1bb8f661168d (\"net/i40e: fix link down and negotiation\")\nCc: stable@dpdk.org\n\nSigned-off-by: Xiaoyun Li <xiaoyun.li@intel.com>\n---\n drivers/net/i40e/i40e_ethdev.c | 58 ++++++++++++++++++++++++++----------------\n 1 file changed, 36 insertions(+), 22 deletions(-)",
    "diff": "diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c\nindex 13c5d32..272a975 100644\n--- a/drivers/net/i40e/i40e_ethdev.c\n+++ b/drivers/net/i40e/i40e_ethdev.c\n@@ -2026,27 +2026,38 @@ i40e_phy_conf_link(struct i40e_hw *hw,\n \tstruct i40e_aq_get_phy_abilities_resp phy_ab;\n \tstruct i40e_aq_set_phy_config phy_conf;\n \tenum i40e_aq_phy_type cnt;\n+\tuint8_t avail_speed;\n \tuint32_t phy_type_mask = 0;\n \n \tconst uint8_t mask = I40E_AQ_PHY_FLAG_PAUSE_TX |\n \t\t\tI40E_AQ_PHY_FLAG_PAUSE_RX |\n \t\t\tI40E_AQ_PHY_FLAG_PAUSE_RX |\n \t\t\tI40E_AQ_PHY_FLAG_LOW_POWER;\n-\tconst uint8_t advt = I40E_LINK_SPEED_40GB |\n-\t\t\tI40E_LINK_SPEED_25GB |\n-\t\t\tI40E_LINK_SPEED_10GB |\n-\t\t\tI40E_LINK_SPEED_1GB |\n-\t\t\tI40E_LINK_SPEED_100MB;\n \tint ret = -ENOTSUP;\n \n+\t/* To get phy capabilities of available speeds. */\n+\tstatus = i40e_aq_get_phy_capabilities(hw, false, true, &phy_ab,\n+\t\t\t\t\t      NULL);\n+\tif (status) {\n+\t\tPMD_DRV_LOG(ERR, \"Failed to get PHY capabilities: %d\\n\",\n+\t\t\t\tstatus);\n+\t\treturn ret;\n+\t}\n+\tavail_speed = phy_ab.link_speed;\n \n+\t/* To get the current phy config. */\n \tstatus = i40e_aq_get_phy_capabilities(hw, false, false, &phy_ab,\n \t\t\t\t\t      NULL);\n-\tif (status)\n+\tif (status) {\n+\t\tPMD_DRV_LOG(ERR, \"Failed to get the current PHY config: %d\\n\",\n+\t\t\t\tstatus);\n \t\treturn ret;\n+\t}\n \n-\t/* If link already up, no need to set up again */\n-\tif (is_up && phy_ab.phy_type != 0)\n+\t/* If link needs to go up and its speed values are OK, no need\n+\t * to set up again.\n+\t */\n+\tif (is_up && phy_ab.phy_type != 0 && phy_ab.link_speed != 0)\n \t\treturn I40E_SUCCESS;\n \n \tmemset(&phy_conf, 0, sizeof(phy_conf));\n@@ -2055,15 +2066,17 @@ i40e_phy_conf_link(struct i40e_hw *hw,\n \tabilities &= ~mask;\n \tabilities |= phy_ab.abilities & mask;\n \n-\t/* update ablities and speed */\n-\tif (abilities & I40E_AQ_PHY_AN_ENABLED)\n-\t\tphy_conf.link_speed = advt;\n-\telse\n-\t\tphy_conf.link_speed = is_up ? force_speed : phy_ab.link_speed;\n-\n \tphy_conf.abilities = abilities;\n \n-\n+\t/* If link needs to go up, but the force speed is not supported,\n+\t * Warn users and config the default available speeds.\n+\t */\n+\tif (is_up && !(force_speed & avail_speed)) {\n+\t\tPMD_DRV_LOG(WARNING, \"Invalid speed setting, set to default!\\n\");\n+\t\tphy_conf.link_speed = avail_speed;\n+\t} else {\n+\t\tphy_conf.link_speed = is_up ? force_speed : avail_speed;\n+\t}\n \n \t/* To enable link, phy_type mask needs to include each type */\n \tfor (cnt = I40E_PHY_TYPE_SGMII; cnt < I40E_PHY_TYPE_MAX; cnt++)\n@@ -2099,6 +2112,14 @@ i40e_apply_link_speed(struct rte_eth_dev *dev)\n \tstruct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);\n \tstruct rte_eth_conf *conf = &dev->data->dev_conf;\n \n+\tif (conf->link_speeds == ETH_LINK_SPEED_AUTONEG) {\n+\t\tconf->link_speeds = ETH_LINK_SPEED_40G |\n+\t\t\t\t    ETH_LINK_SPEED_25G |\n+\t\t\t\t    ETH_LINK_SPEED_20G |\n+\t\t\t\t    ETH_LINK_SPEED_10G |\n+\t\t\t\t    ETH_LINK_SPEED_1G |\n+\t\t\t\t    ETH_LINK_SPEED_100M;\n+\t}\n \tspeed = i40e_parse_link_speeds(conf->link_speeds);\n \tabilities |= I40E_AQ_PHY_ENABLE_ATOMIC_LINK;\n \tif (!(conf->link_speeds & ETH_LINK_SPEED_FIXED))\n@@ -2220,13 +2241,6 @@ i40e_dev_start(struct rte_eth_dev *dev)\n \t}\n \n \t/* Apply link configure */\n-\tif (dev->data->dev_conf.link_speeds & ~(ETH_LINK_SPEED_100M |\n-\t\t\t\tETH_LINK_SPEED_1G | ETH_LINK_SPEED_10G |\n-\t\t\t\tETH_LINK_SPEED_20G | ETH_LINK_SPEED_25G |\n-\t\t\t\tETH_LINK_SPEED_40G)) {\n-\t\tPMD_DRV_LOG(ERR, \"Invalid link setting\");\n-\t\tgoto err_up;\n-\t}\n \tret = i40e_apply_link_speed(dev);\n \tif (I40E_SUCCESS != ret) {\n \t\tPMD_DRV_LOG(ERR, \"Fail to apply link setting\");\n",
    "prefixes": []
}