get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 816813,
    "url": "http://patchwork.ozlabs.org/api/patches/816813/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/1505992913-107256-11-git-send-email-linyunsheng@huawei.com/",
    "project": {
        "id": 7,
        "url": "http://patchwork.ozlabs.org/api/projects/7/?format=api",
        "name": "Linux network development",
        "link_name": "netdev",
        "list_id": "netdev.vger.kernel.org",
        "list_email": "netdev@vger.kernel.org",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<1505992913-107256-11-git-send-email-linyunsheng@huawei.com>",
    "list_archive_url": null,
    "date": "2017-09-21T11:21:53",
    "name": "[net-next,10/10] net: hns3: Add mqprio support when interacting with network stack",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "21f234de2c025a99d788ee765469eb9d66b99118",
    "submitter": {
        "id": 71804,
        "url": "http://patchwork.ozlabs.org/api/people/71804/?format=api",
        "name": "Yunsheng Lin",
        "email": "linyunsheng@huawei.com"
    },
    "delegate": {
        "id": 34,
        "url": "http://patchwork.ozlabs.org/api/users/34/?format=api",
        "username": "davem",
        "first_name": "David",
        "last_name": "Miller",
        "email": "davem@davemloft.net"
    },
    "mbox": "http://patchwork.ozlabs.org/project/netdev/patch/1505992913-107256-11-git-send-email-linyunsheng@huawei.com/mbox/",
    "series": [
        {
            "id": 4360,
            "url": "http://patchwork.ozlabs.org/api/series/4360/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=4360",
            "date": "2017-09-21T11:21:52",
            "name": "Add support for DCB feature in hns3 driver",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/4360/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/816813/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/816813/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<netdev-owner@vger.kernel.org>",
        "X-Original-To": "patchwork-incoming@ozlabs.org",
        "Delivered-To": "patchwork-incoming@ozlabs.org",
        "Authentication-Results": "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)",
        "Received": [
            "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xyZ3j362bz9t3m\n\tfor <patchwork-incoming@ozlabs.org>;\n\tThu, 21 Sep 2017 21:23:13 +1000 (AEST)",
            "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751883AbdIULW1 (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tThu, 21 Sep 2017 07:22:27 -0400",
            "from szxga04-in.huawei.com ([45.249.212.190]:6958 \"EHLO\n\tszxga04-in.huawei.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751798AbdIULWW (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Thu, 21 Sep 2017 07:22:22 -0400",
            "from 172.30.72.60 (EHLO DGGEMS408-HUB.china.huawei.com)\n\t([172.30.72.60])\n\tby dggrg04-dlp.huawei.com (MOS 4.4.6-GA FastPath queued)\n\twith ESMTP id DHR44641; Thu, 21 Sep 2017 19:22:20 +0800 (CST)",
            "from localhost.localdomain (10.67.212.75) by\n\tDGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP\n\tServer id 14.3.301.0; Thu, 21 Sep 2017 19:22:11 +0800"
        ],
        "From": "Yunsheng Lin <linyunsheng@huawei.com>",
        "To": "<davem@davemloft.net>",
        "CC": "<huangdaode@hisilicon.com>, <xuwei5@hisilicon.com>,\n\t<liguozhu@hisilicon.com>, <Yisen.Zhuang@huawei.com>,\n\t<gabriele.paoloni@huawei.com>, <john.garry@huawei.com>,\n\t<linuxarm@huawei.com>, <yisen.zhuang@huawei.com>,\n\t<salil.mehta@huawei.com>, <lipeng321@huawei.com>,\n\t<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>",
        "Subject": "[PATCH net-next 10/10] net: hns3: Add mqprio support when\n\tinteracting with network stack",
        "Date": "Thu, 21 Sep 2017 19:21:53 +0800",
        "Message-ID": "<1505992913-107256-11-git-send-email-linyunsheng@huawei.com>",
        "X-Mailer": "git-send-email 1.9.1",
        "In-Reply-To": "<1505992913-107256-1-git-send-email-linyunsheng@huawei.com>",
        "References": "<1505992913-107256-1-git-send-email-linyunsheng@huawei.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-Originating-IP": "[10.67.212.75]",
        "X-CFilter-Loop": "Reflected",
        "X-Mirapoint-Virus-RAPID-Raw": "score=unknown(0),\n\trefid=str=0001.0A090204.59C3A0EC.0314, ss=1, re=0.000, recu=0.000,\n\treip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0,\n\tso=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32",
        "X-Mirapoint-Loop-Id": "67c0ef9586265ad0c8ccad75182cd412",
        "Sender": "netdev-owner@vger.kernel.org",
        "Precedence": "bulk",
        "List-ID": "<netdev.vger.kernel.org>",
        "X-Mailing-List": "netdev@vger.kernel.org"
    },
    "content": "When using tc qdisc to configure DCB parameter, dcb_ops->setup_tc\nis used to tell hclge_dcb module to do the setup.\nWhen using lldptool to configure DCB parameter, hclge_dcb module\ncall the client_ops->setup_tc to tell network stack which queue\nand priority is using for specific tc.\n\nSigned-off-by: Yunsheng Lin <linyunsheng@huawei.com>\n---\n .../net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c | 135 +++++++++++++++++----\n 1 file changed, 111 insertions(+), 24 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c\nindex 11dab26..31fcda4 100644\n--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c\n+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c\n@@ -196,6 +196,32 @@ static void hns3_vector_gl_rl_init(struct hns3_enet_tqp_vector *tqp_vector)\n \ttqp_vector->tx_group.flow_level = HNS3_FLOW_LOW;\n }\n \n+static int hns3_nic_set_real_num_queue(struct net_device *netdev)\n+{\n+\tstruct hns3_nic_priv *priv = netdev_priv(netdev);\n+\tstruct hnae3_handle *h = priv->ae_handle;\n+\tstruct hnae3_knic_private_info *kinfo = &h->kinfo;\n+\tunsigned int queue_size = kinfo->rss_size * kinfo->num_tc;\n+\tint ret;\n+\n+\tret = netif_set_real_num_tx_queues(netdev, queue_size);\n+\tif (ret) {\n+\t\tnetdev_err(netdev,\n+\t\t\t   \"netif_set_real_num_tx_queues fail, ret=%d!\\n\",\n+\t\t\t   ret);\n+\t\treturn ret;\n+\t}\n+\n+\tret = netif_set_real_num_rx_queues(netdev, queue_size);\n+\tif (ret) {\n+\t\tnetdev_err(netdev,\n+\t\t\t   \"netif_set_real_num_rx_queues fail, ret=%d!\\n\", ret);\n+\t\treturn ret;\n+\t}\n+\n+\treturn 0;\n+}\n+\n static int hns3_nic_net_up(struct net_device *netdev)\n {\n \tstruct hns3_nic_priv *priv = netdev_priv(netdev);\n@@ -232,26 +258,13 @@ static int hns3_nic_net_up(struct net_device *netdev)\n \n static int hns3_nic_net_open(struct net_device *netdev)\n {\n-\tstruct hns3_nic_priv *priv = netdev_priv(netdev);\n-\tstruct hnae3_handle *h = priv->ae_handle;\n \tint ret;\n \n \tnetif_carrier_off(netdev);\n \n-\tret = netif_set_real_num_tx_queues(netdev, h->kinfo.num_tqps);\n-\tif (ret) {\n-\t\tnetdev_err(netdev,\n-\t\t\t   \"netif_set_real_num_tx_queues fail, ret=%d!\\n\",\n-\t\t\t   ret);\n-\t\treturn ret;\n-\t}\n-\n-\tret = netif_set_real_num_rx_queues(netdev, h->kinfo.num_tqps);\n-\tif (ret) {\n-\t\tnetdev_err(netdev,\n-\t\t\t   \"netif_set_real_num_rx_queues fail, ret=%d!\\n\", ret);\n+\tret = hns3_nic_set_real_num_queue(netdev);\n+\tif (ret)\n \t\treturn ret;\n-\t}\n \n \tret = hns3_nic_net_up(netdev);\n \tif (ret) {\n@@ -1193,32 +1206,40 @@ static void hns3_nic_udp_tunnel_del(struct net_device *netdev,\n \t}\n }\n \n-static int hns3_setup_tc(struct net_device *netdev, u8 tc)\n+static int hns3_setup_tc(struct net_device *netdev, u8 tc, u8 *prio_tc)\n {\n \tstruct hns3_nic_priv *priv = netdev_priv(netdev);\n \tstruct hnae3_handle *h = priv->ae_handle;\n \tstruct hnae3_knic_private_info *kinfo = &h->kinfo;\n+\tbool if_running = netif_running(netdev);\n \tunsigned int i;\n \tint ret;\n \n \tif (tc > HNAE3_MAX_TC)\n \t\treturn -EINVAL;\n \n-\tif (kinfo->num_tc == tc)\n-\t\treturn 0;\n-\n \tif (!netdev)\n \t\treturn -EINVAL;\n \n-\tif (!tc) {\n+\tif (if_running) {\n+\t\t(void)hns3_nic_net_stop(netdev);\n+\t\tmsleep(100);\n+\t}\n+\n+\tret = (kinfo->dcb_ops && kinfo->dcb_ops->setup_tc) ?\n+\t\tkinfo->dcb_ops->setup_tc(h, tc, prio_tc) : -EOPNOTSUPP;\n+\tif (ret)\n+\t\tgoto err_out;\n+\n+\tif (tc <= 1) {\n \t\tnetdev_reset_tc(netdev);\n-\t\treturn 0;\n+\t\tgoto out;\n \t}\n \n \t/* Set num_tc for netdev */\n \tret = netdev_set_num_tc(netdev, tc);\n \tif (ret)\n-\t\treturn ret;\n+\t\tgoto err_out;\n \n \t/* Set per TC queues for the VSI */\n \tfor (i = 0; i < HNAE3_MAX_TC; i++) {\n@@ -1229,7 +1250,14 @@ static int hns3_setup_tc(struct net_device *netdev, u8 tc)\n \t\t\t\t\t    kinfo->tc_info[i].tqp_offset);\n \t}\n \n-\treturn 0;\n+out:\n+\tret = hns3_nic_set_real_num_queue(netdev);\n+\n+err_out:\n+\tif (if_running)\n+\t\t(void)hns3_nic_net_open(netdev);\n+\n+\treturn ret;\n }\n \n static int hns3_nic_setup_tc(struct net_device *dev, enum tc_setup_type type,\n@@ -1240,7 +1268,7 @@ static int hns3_nic_setup_tc(struct net_device *dev, enum tc_setup_type type,\n \tif (type != TC_SETUP_MQPRIO)\n \t\treturn -EOPNOTSUPP;\n \n-\treturn hns3_setup_tc(dev, mqprio->num_tc);\n+\treturn hns3_setup_tc(dev, mqprio->num_tc, mqprio->prio_tc_map);\n }\n \n static int hns3_vlan_rx_add_vid(struct net_device *netdev,\n@@ -2848,10 +2876,69 @@ static void hns3_link_status_change(struct hnae3_handle *handle, bool linkup)\n \t}\n }\n \n+static int hns3_client_setup_tc(struct hnae3_handle *handle, u8 tc)\n+{\n+\tstruct hnae3_knic_private_info *kinfo = &handle->kinfo;\n+\tstruct net_device *ndev = kinfo->netdev;\n+\tbool if_running = netif_running(ndev);\n+\tint ret;\n+\tu8 i;\n+\n+\tif (tc > HNAE3_MAX_TC)\n+\t\treturn -EINVAL;\n+\n+\tif (!ndev)\n+\t\treturn -ENODEV;\n+\n+\tret = netdev_set_num_tc(ndev, tc);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tif (if_running) {\n+\t\t(void)hns3_nic_net_stop(ndev);\n+\t\tmsleep(100);\n+\t}\n+\n+\tret = (kinfo->dcb_ops && kinfo->dcb_ops->map_update) ?\n+\t\tkinfo->dcb_ops->map_update(handle) : -EOPNOTSUPP;\n+\tif (ret)\n+\t\tgoto err_out;\n+\n+\tif (tc <= 1) {\n+\t\tnetdev_reset_tc(ndev);\n+\t\tgoto out;\n+\t}\n+\n+\tfor (i = 0; i < HNAE3_MAX_TC; i++) {\n+\t\tstruct hnae3_tc_info *tc_info = &kinfo->tc_info[i];\n+\n+\t\tif (tc_info->enable)\n+\t\t\tnetdev_set_tc_queue(ndev,\n+\t\t\t\t\t    tc_info->tc,\n+\t\t\t\t\t    tc_info->tqp_count,\n+\t\t\t\t\t    tc_info->tqp_offset);\n+\t}\n+\n+\tfor (i = 0; i < HNAE3_MAX_USER_PRIO; i++) {\n+\t\tnetdev_set_prio_tc_map(ndev, i,\n+\t\t\t\t       kinfo->prio_tc[i]);\n+\t}\n+\n+out:\n+\tret = hns3_nic_set_real_num_queue(ndev);\n+\n+err_out:\n+\tif (if_running)\n+\t\t(void)hns3_nic_net_open(ndev);\n+\n+\treturn ret;\n+}\n+\n const struct hnae3_client_ops client_ops = {\n \t.init_instance = hns3_client_init,\n \t.uninit_instance = hns3_client_uninit,\n \t.link_status_change = hns3_link_status_change,\n+\t.setup_tc = hns3_client_setup_tc,\n };\n \n /* hns3_init_module - Driver registration routine\n",
    "prefixes": [
        "net-next",
        "10/10"
    ]
}