get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 91257,
    "url": "https://patches.dpdk.org/api/patches/91257/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1618321639-57642-4-git-send-email-humin29@huawei.com/",
    "project": {
        "id": 1,
        "url": "https://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": "<1618321639-57642-4-git-send-email-humin29@huawei.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1618321639-57642-4-git-send-email-humin29@huawei.com",
    "date": "2021-04-13T13:47:13",
    "name": "[3/9] net/hns3: fix flow control mode",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "931a4acc3d65ca9ccea4a81d4776a4aa5ffcc1f5",
    "submitter": {
        "id": 1944,
        "url": "https://patches.dpdk.org/api/people/1944/?format=api",
        "name": "humin (Q)",
        "email": "humin29@huawei.com"
    },
    "delegate": {
        "id": 319,
        "url": "https://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1618321639-57642-4-git-send-email-humin29@huawei.com/mbox/",
    "series": [
        {
            "id": 16336,
            "url": "https://patches.dpdk.org/api/series/16336/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=16336",
            "date": "2021-04-13T13:47:11",
            "name": "support speed capability and autoneg report",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/16336/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/91257/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/91257/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 mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 8DD5DA0524;\n\tTue, 13 Apr 2021 15:47:52 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 0CF7F160FEE;\n\tTue, 13 Apr 2021 15:47:16 +0200 (CEST)",
            "from szxga06-in.huawei.com (szxga06-in.huawei.com [45.249.212.32])\n by mails.dpdk.org (Postfix) with ESMTP id E91CC160FC3\n for <dev@dpdk.org>; Tue, 13 Apr 2021 15:47:07 +0200 (CEST)",
            "from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.59])\n by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4FKRgY3JNPzlXpb\n for <dev@dpdk.org>; Tue, 13 Apr 2021 21:45:13 +0800 (CST)",
            "from localhost.localdomain (10.69.192.56) by\n DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id\n 14.3.498.0; Tue, 13 Apr 2021 21:47:00 +0800"
        ],
        "From": "\"Min Hu (Connor)\" <humin29@huawei.com>",
        "To": "<dev@dpdk.org>",
        "CC": "<ferruh.yigit@intel.com>",
        "Date": "Tue, 13 Apr 2021 21:47:13 +0800",
        "Message-ID": "<1618321639-57642-4-git-send-email-humin29@huawei.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "In-Reply-To": "<1618321639-57642-1-git-send-email-humin29@huawei.com>",
        "References": "<1618321639-57642-1-git-send-email-humin29@huawei.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-Originating-IP": "[10.69.192.56]",
        "X-CFilter-Loop": "Reflected",
        "Subject": "[dpdk-dev] [PATCH 3/9] net/hns3: fix flow control mode",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "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: Huisong Li <lihuisong@huawei.com>\n\nCurrently, hns3 driver doesn't support to flow control auto-negotiation.\nThe FC mode requested by user is the same as the current FC mode. It is\nnot necessary to maintain the current FC mode. We only report the current\nFC mode based on actual flow control mode in hns3_flow_ctrl_get().\n\nThis patch removes this redundant field. In addition, \"requested_mode\" in\nhns3_hw struct indicates the FC mode requested by user, and the name is\nunreasonable. It needs to be modified to \"requested_fc_mode\".\n\nFixes: 62e3ccc2b94c (\"net/hns3: support flow control\")\nCc: stable@dpdk.org\n\nSigned-off-by: Huisong Li <lihuisong@huawei.com>\nSigned-off-by: Min Hu (Connor) <humin29@huawei.com>\n---\n drivers/net/hns3/hns3_dcb.c    | 23 ++++++++---------------\n drivers/net/hns3/hns3_ethdev.c | 28 ++++++++++------------------\n drivers/net/hns3/hns3_ethdev.h |  3 +--\n 3 files changed, 19 insertions(+), 35 deletions(-)",
    "diff": "diff --git a/drivers/net/hns3/hns3_dcb.c b/drivers/net/hns3/hns3_dcb.c\nindex 096afe8..30e59e8 100644\n--- a/drivers/net/hns3/hns3_dcb.c\n+++ b/drivers/net/hns3/hns3_dcb.c\n@@ -1238,7 +1238,7 @@ hns3_qs_bp_cfg(struct hns3_hw *hw, uint8_t tc, uint8_t grp_id, uint32_t bit_map)\n static void\n hns3_get_rx_tx_en_status(struct hns3_hw *hw, bool *tx_en, bool *rx_en)\n {\n-\tswitch (hw->current_mode) {\n+\tswitch (hw->requested_fc_mode) {\n \tcase HNS3_FC_NONE:\n \t\t*tx_en = false;\n \t\t*rx_en = false;\n@@ -1415,7 +1415,7 @@ hns3_dcb_cfg_validate(struct hns3_adapter *hns, uint8_t *tc, bool *changed)\n \t * We ensure that dcb information can be reconfigured\n \t * after the hns3_priority_flow_ctrl_set function called.\n \t */\n-\tif (hw->current_mode != HNS3_FC_FULL)\n+\tif (hw->requested_fc_mode != HNS3_FC_FULL)\n \t\t*changed = true;\n \tpfc_en = RTE_LEN2MASK((uint8_t)dcb_rx_conf->nb_tcs, uint8_t);\n \tif (hw->dcb_info.pfc_en != pfc_en)\n@@ -1529,7 +1529,7 @@ hns3_dcb_hw_configure(struct hns3_adapter *hns)\n \tstruct hns3_pf *pf = &hns->pf;\n \tstruct hns3_hw *hw = &hns->hw;\n \tenum hns3_fc_status fc_status = hw->current_fc_status;\n-\tenum hns3_fc_mode current_mode = hw->current_mode;\n+\tenum hns3_fc_mode requested_fc_mode = hw->requested_fc_mode;\n \tuint8_t hw_pfc_map = hw->dcb_info.hw_pfc_map;\n \tint ret, status;\n \n@@ -1559,7 +1559,7 @@ hns3_dcb_hw_configure(struct hns3_adapter *hns)\n \t\t\treturn ret;\n \n \t\thw->current_fc_status = HNS3_FC_STATUS_PFC;\n-\t\thw->current_mode = HNS3_FC_FULL;\n+\t\thw->requested_fc_mode = HNS3_FC_FULL;\n \t\tret = hns3_dcb_pause_setup_hw(hw);\n \t\tif (ret) {\n \t\t\thns3_err(hw, \"setup pfc failed! ret = %d\", ret);\n@@ -1580,7 +1580,7 @@ hns3_dcb_hw_configure(struct hns3_adapter *hns)\n \treturn 0;\n \n pfc_setup_fail:\n-\thw->current_mode = current_mode;\n+\thw->requested_fc_mode = requested_fc_mode;\n \thw->current_fc_status = fc_status;\n \thw->dcb_info.hw_pfc_map = hw_pfc_map;\n \tstatus = hns3_buffer_alloc(hw);\n@@ -1659,8 +1659,7 @@ hns3_dcb_init(struct hns3_hw *hw)\n \t * will be changed.\n \t */\n \tif (hw->adapter_state == HNS3_NIC_UNINITIALIZED) {\n-\t\thw->requested_mode = HNS3_FC_NONE;\n-\t\thw->current_mode = hw->requested_mode;\n+\t\thw->requested_fc_mode = HNS3_FC_NONE;\n \t\tpf->pause_time = HNS3_DEFAULT_PAUSE_TRANS_TIME;\n \t\thw->current_fc_status = HNS3_FC_STATUS_NONE;\n \n@@ -1761,7 +1760,6 @@ hns3_dcb_pfc_enable(struct rte_eth_dev *dev, struct rte_eth_pfc_conf *pfc_conf)\n \tstruct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);\n \tstruct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private);\n \tenum hns3_fc_status fc_status = hw->current_fc_status;\n-\tenum hns3_fc_mode current_mode = hw->current_mode;\n \tuint8_t hw_pfc_map = hw->dcb_info.hw_pfc_map;\n \tuint8_t pfc_en = hw->dcb_info.pfc_en;\n \tuint8_t priority = pfc_conf->priority;\n@@ -1769,7 +1767,6 @@ hns3_dcb_pfc_enable(struct rte_eth_dev *dev, struct rte_eth_pfc_conf *pfc_conf)\n \tint ret, status;\n \n \tpf->pause_time = pfc_conf->fc.pause_time;\n-\thw->current_mode = hw->requested_mode;\n \thw->current_fc_status = HNS3_FC_STATUS_PFC;\n \thw->dcb_info.pfc_en |= BIT(priority);\n \thw->dcb_info.hw_pfc_map =\n@@ -1780,7 +1777,7 @@ hns3_dcb_pfc_enable(struct rte_eth_dev *dev, struct rte_eth_pfc_conf *pfc_conf)\n \n \t/*\n \t * The flow control mode of all UPs will be changed based on\n-\t * current_mode coming from user.\n+\t * requested_fc_mode coming from user.\n \t */\n \tret = hns3_dcb_pause_setup_hw(hw);\n \tif (ret) {\n@@ -1791,7 +1788,6 @@ hns3_dcb_pfc_enable(struct rte_eth_dev *dev, struct rte_eth_pfc_conf *pfc_conf)\n \treturn 0;\n \n pfc_setup_fail:\n-\thw->current_mode = current_mode;\n \thw->current_fc_status = fc_status;\n \tpf->pause_time = pause_time;\n \thw->dcb_info.pfc_en = pfc_en;\n@@ -1815,18 +1811,16 @@ hns3_fc_enable(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)\n \tstruct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);\n \tstruct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private);\n \tenum hns3_fc_status fc_status = hw->current_fc_status;\n-\tenum hns3_fc_mode current_mode = hw->current_mode;\n \tuint16_t pause_time = pf->pause_time;\n \tint ret;\n \n \tpf->pause_time = fc_conf->pause_time;\n-\thw->current_mode = hw->requested_mode;\n \n \t/*\n \t * In fact, current_fc_status is HNS3_FC_STATUS_NONE when mode\n \t * of flow control is configured to be HNS3_FC_NONE.\n \t */\n-\tif (hw->current_mode == HNS3_FC_NONE)\n+\tif (hw->requested_fc_mode == HNS3_FC_NONE)\n \t\thw->current_fc_status = HNS3_FC_STATUS_NONE;\n \telse\n \t\thw->current_fc_status = HNS3_FC_STATUS_MAC_PAUSE;\n@@ -1840,7 +1834,6 @@ hns3_fc_enable(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)\n \treturn 0;\n \n setup_fc_fail:\n-\thw->current_mode = current_mode;\n \thw->current_fc_status = fc_status;\n \tpf->pause_time = pause_time;\n \ndiff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c\nindex d7766e1..62a23b8 100644\n--- a/drivers/net/hns3/hns3_ethdev.c\n+++ b/drivers/net/hns3/hns3_ethdev.c\n@@ -5496,8 +5496,11 @@ hns3_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)\n \n \tfc_conf->pause_time = pf->pause_time;\n \n-\t/* return fc current mode */\n-\tswitch (hw->current_mode) {\n+\t/*\n+\t * If fc auto-negotiation is not supported, the configured fc mode\n+\t * from user is the current fc mode.\n+\t */\n+\tswitch (hw->requested_fc_mode) {\n \tcase HNS3_FC_FULL:\n \t\tfc_conf->mode = RTE_FC_FULL;\n \t\tbreak;\n@@ -5521,19 +5524,19 @@ hns3_get_fc_mode(struct hns3_hw *hw, enum rte_eth_fc_mode mode)\n {\n \tswitch (mode) {\n \tcase RTE_FC_NONE:\n-\t\thw->requested_mode = HNS3_FC_NONE;\n+\t\thw->requested_fc_mode = HNS3_FC_NONE;\n \t\tbreak;\n \tcase RTE_FC_RX_PAUSE:\n-\t\thw->requested_mode = HNS3_FC_RX_PAUSE;\n+\t\thw->requested_fc_mode = HNS3_FC_RX_PAUSE;\n \t\tbreak;\n \tcase RTE_FC_TX_PAUSE:\n-\t\thw->requested_mode = HNS3_FC_TX_PAUSE;\n+\t\thw->requested_fc_mode = HNS3_FC_TX_PAUSE;\n \t\tbreak;\n \tcase RTE_FC_FULL:\n-\t\thw->requested_mode = HNS3_FC_FULL;\n+\t\thw->requested_fc_mode = HNS3_FC_FULL;\n \t\tbreak;\n \tdefault:\n-\t\thw->requested_mode = HNS3_FC_NONE;\n+\t\thw->requested_fc_mode = HNS3_FC_NONE;\n \t\thns3_warn(hw, \"fc_mode(%u) exceeds member scope and is \"\n \t\t\t  \"configured to RTE_FC_NONE\", mode);\n \t\tbreak;\n@@ -5544,7 +5547,6 @@ static int\n hns3_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)\n {\n \tstruct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);\n-\tstruct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private);\n \tint ret;\n \n \tif (fc_conf->high_water || fc_conf->low_water ||\n@@ -5579,9 +5581,6 @@ hns3_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)\n \t}\n \n \thns3_get_fc_mode(hw, fc_conf->mode);\n-\tif (hw->requested_mode == hw->current_mode &&\n-\t    pf->pause_time == fc_conf->pause_time)\n-\t\treturn 0;\n \n \trte_spinlock_lock(&hw->lock);\n \tret = hns3_fc_enable(dev, fc_conf);\n@@ -5595,8 +5594,6 @@ hns3_priority_flow_ctrl_set(struct rte_eth_dev *dev,\n \t\t\t    struct rte_eth_pfc_conf *pfc_conf)\n {\n \tstruct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);\n-\tstruct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private);\n-\tuint8_t priority;\n \tint ret;\n \n \tif (!hns3_dev_dcb_supported(hw)) {\n@@ -5631,12 +5628,7 @@ hns3_priority_flow_ctrl_set(struct rte_eth_dev *dev,\n \t\treturn -EOPNOTSUPP;\n \t}\n \n-\tpriority = pfc_conf->priority;\n \thns3_get_fc_mode(hw, pfc_conf->fc.mode);\n-\tif (hw->dcb_info.pfc_en & BIT(priority) &&\n-\t    hw->requested_mode == hw->current_mode &&\n-\t    pfc_conf->fc.pause_time == pf->pause_time)\n-\t\treturn 0;\n \n \trte_spinlock_lock(&hw->lock);\n \tret = hns3_dcb_pfc_enable(dev, pfc_conf);\ndiff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h\nindex cbeadc0..553caa3 100644\n--- a/drivers/net/hns3/hns3_ethdev.h\n+++ b/drivers/net/hns3/hns3_ethdev.h\n@@ -470,8 +470,7 @@ struct hns3_hw {\n \n \tuint8_t num_tc;             /* Total number of enabled TCs */\n \tuint8_t hw_tc_map;\n-\tenum hns3_fc_mode current_mode;\n-\tenum hns3_fc_mode requested_mode;\n+\tenum hns3_fc_mode requested_fc_mode; /* FC mode requested by user */\n \tstruct hns3_dcb_info dcb_info;\n \tenum hns3_fc_status current_fc_status; /* current flow control status */\n \tstruct hns3_tc_queue_info tc_queue[HNS3_MAX_TC_NUM];\n",
    "prefixes": [
        "3/9"
    ]
}