Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/832962/?format=api
{ "id": 832962, "url": "http://patchwork.ozlabs.org/api/1.2/patches/832962/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/1509547642-51110-7-git-send-email-lipeng321@huawei.com/", "project": { "id": 7, "url": "http://patchwork.ozlabs.org/api/1.2/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": "<1509547642-51110-7-git-send-email-lipeng321@huawei.com>", "list_archive_url": null, "date": "2017-11-01T14:47:19", "name": "[net-next,6/9] net: hns3: Add timeout process in hns3_enet", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": true, "hash": "f09ef6bf0ebcb34b1365fd87fa3c20b4e483a345", "submitter": { "id": 71468, "url": "http://patchwork.ozlabs.org/api/1.2/people/71468/?format=api", "name": "lipeng (Y)", "email": "lipeng321@huawei.com" }, "delegate": { "id": 34, "url": "http://patchwork.ozlabs.org/api/1.2/users/34/?format=api", "username": "davem", "first_name": "David", "last_name": "Miller", "email": "davem@davemloft.net" }, "mbox": "http://patchwork.ozlabs.org/project/netdev/patch/1509547642-51110-7-git-send-email-lipeng321@huawei.com/mbox/", "series": [ { "id": 11334, "url": "http://patchwork.ozlabs.org/api/1.2/series/11334/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=11334", "date": "2017-11-01T14:47:14", "name": "net: hns3: add support for reset", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/11334/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/832962/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/832962/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 3yRr6h52Ltz9sPs\n\tfor <patchwork-incoming@ozlabs.org>;\n\tThu, 2 Nov 2017 01:23:24 +1100 (AEDT)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S933149AbdKAOWv (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tWed, 1 Nov 2017 10:22:51 -0400", "from szxga06-in.huawei.com ([45.249.212.32]:38427 \"EHLO huawei.com\"\n\trhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP\n\tid S1754674AbdKAOVM (ORCPT <rfc822;netdev@vger.kernel.org>);\n\tWed, 1 Nov 2017 10:21:12 -0400", "from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.59])\n\tby Forcepoint Email with ESMTP id D09833B06BBB2;\n\tWed, 1 Nov 2017 22:20:58 +0800 (CST)", "from linux-ioko.site (10.71.200.31) by\n\tDGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP\n\tServer id 14.3.361.1; Wed, 1 Nov 2017 22:19:51 +0800" ], "From": "Lipeng <lipeng321@huawei.com>", "To": "<davem@davemloft.net>", "CC": "<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,\n\t<linuxarm@huawei.com>, <yisen.zhuang@huawei.com>,\n\t<salil.mehta@huawei.com>, <lipeng321@huawei.com>", "Subject": "[PATCH net-next 6/9] net: hns3: Add timeout process in hns3_enet", "Date": "Wed, 1 Nov 2017 22:47:19 +0800", "Message-ID": "<1509547642-51110-7-git-send-email-lipeng321@huawei.com>", "X-Mailer": "git-send-email 1.9.1", "In-Reply-To": "<1509547642-51110-1-git-send-email-lipeng321@huawei.com>", "References": "<1509547642-51110-1-git-send-email-lipeng321@huawei.com>", "MIME-Version": "1.0", "Content-Type": "text/plain", "X-Originating-IP": "[10.71.200.31]", "X-CFilter-Loop": "Reflected", "Sender": "netdev-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<netdev.vger.kernel.org>", "X-Mailing-List": "netdev@vger.kernel.org" }, "content": "This patch add timeout handler in hns3_enet.c to handle\nTX side timeout event, when TX timeout event occur, it will triger\nNIC driver into reset process.\n\nSigned-off-by: qumingguang <qumingguang@huawei.com>\nSigned-off-by: Lipeng <lipeng321@huawei.com>\n---\n .../net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c | 86 ++++++++++++++++++++++\n .../net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.h | 2 +\n 2 files changed, 88 insertions(+)", "diff": "diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c\nindex c6c5b2a..aed6611 100644\n--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c\n+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.c\n@@ -258,6 +258,7 @@ 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 \tint ret;\n \n \tnetif_carrier_off(netdev);\n@@ -273,6 +274,7 @@ static int hns3_nic_net_open(struct net_device *netdev)\n \t\treturn ret;\n \t}\n \n+\tpriv->last_reset_time = jiffies;\n \treturn 0;\n }\n \n@@ -1322,10 +1324,91 @@ static int hns3_nic_change_mtu(struct net_device *netdev, int new_mtu)\n \treturn ret;\n }\n \n+static bool hns3_get_tx_timeo_queue_info(struct net_device *ndev)\n+{\n+\tstruct hns3_nic_priv *priv = netdev_priv(ndev);\n+\tstruct hns3_enet_ring *tx_ring = NULL;\n+\tint timeout_queue = 0;\n+\tint hw_head, hw_tail;\n+\tint i;\n+\n+\t/* Find the stopped queue the same way the stack does */\n+\tfor (i = 0; i < ndev->real_num_tx_queues; i++) {\n+\t\tstruct netdev_queue *q;\n+\t\tunsigned long trans_start;\n+\n+\t\tq = netdev_get_tx_queue(ndev, i);\n+\t\ttrans_start = q->trans_start;\n+\t\tif (netif_xmit_stopped(q) &&\n+\t\t time_after(jiffies,\n+\t\t\t (trans_start + ndev->watchdog_timeo))) {\n+\t\t\ttimeout_queue = i;\n+\t\t\tbreak;\n+\t\t}\n+\t}\n+\n+\tif (i == ndev->num_tx_queues) {\n+\t\tnetdev_info(ndev,\n+\t\t\t \"no netdev TX timeout queue found, timeout count: %llu\\n\",\n+\t\t\t priv->tx_timeout_count);\n+\t\treturn false;\n+\t}\n+\n+\ttx_ring = priv->ring_data[timeout_queue].ring;\n+\n+\thw_head = readl_relaxed(tx_ring->tqp->io_base +\n+\t\t\t\tHNS3_RING_RX_RING_HEAD_REG);\n+\thw_tail = readl_relaxed(tx_ring->tqp->io_base +\n+\t\t\t\tHNS3_RING_RX_RING_TAIL_REG);\n+\tnetdev_info(ndev,\n+\t\t \"tx_timeout count: %llu, queue id: %d, SW_NTU: 0x%x, SW_NTC: 0x%x, HW_HEAD: 0x%x, HW_TAIL: 0x%x, INT: 0x%x\\n\",\n+\t\t priv->tx_timeout_count,\n+\t\t timeout_queue,\n+\t\t tx_ring->next_to_use,\n+\t\t tx_ring->next_to_clean,\n+\t\t hw_head,\n+\t\t hw_tail,\n+\t\t readl(tx_ring->tqp_vector->mask_addr));\n+\n+\treturn true;\n+}\n+\n+static void hns3_nic_net_timeout(struct net_device *ndev)\n+{\n+\tstruct hns3_nic_priv *priv = netdev_priv(ndev);\n+\tunsigned long last_reset_time = priv->last_reset_time;\n+\tstruct hnae3_handle *h = priv->ae_handle;\n+\n+\tif (!hns3_get_tx_timeo_queue_info(ndev))\n+\t\treturn;\n+\n+\tpriv->tx_timeout_count++;\n+\n+\t/* This timeout is far away enough from last timeout,\n+\t * if timeout again,set the reset type to PF reset\n+\t */\n+\tif (time_after(jiffies, (last_reset_time + 20 * HZ)))\n+\t\tpriv->reset_level = HNAE3_FUNC_RESET;\n+\n+\t/* Don't do any new action before the next timeout */\n+\telse if (time_before(jiffies, (last_reset_time + ndev->watchdog_timeo)))\n+\t\treturn;\n+\n+\tpriv->last_reset_time = jiffies;\n+\n+\tif (h->ae_algo->ops->reset_event)\n+\t\th->ae_algo->ops->reset_event(h, priv->reset_level, 0);\n+\n+\tpriv->reset_level++;\n+\tif (priv->reset_level > HNAE3_GLOBAL_RESET)\n+\t\tpriv->reset_level = HNAE3_GLOBAL_RESET;\n+}\n+\n static const struct net_device_ops hns3_nic_netdev_ops = {\n \t.ndo_open\t\t= hns3_nic_net_open,\n \t.ndo_stop\t\t= hns3_nic_net_stop,\n \t.ndo_start_xmit\t\t= hns3_nic_net_xmit,\n+\t.ndo_tx_timeout\t\t= hns3_nic_net_timeout,\n \t.ndo_set_mac_address\t= hns3_nic_net_set_mac_address,\n \t.ndo_change_mtu\t\t= hns3_nic_change_mtu,\n \t.ndo_set_features\t= hns3_nic_set_features,\n@@ -2763,6 +2846,9 @@ static int hns3_client_init(struct hnae3_handle *handle)\n \tpriv->dev = &pdev->dev;\n \tpriv->netdev = netdev;\n \tpriv->ae_handle = handle;\n+\tpriv->last_reset_time = jiffies;\n+\tpriv->reset_level = HNAE3_FUNC_RESET;\n+\tpriv->tx_timeout_count = 0;\n \n \thandle->kinfo.netdev = netdev;\n \thandle->priv = (void *)priv;\ndiff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.h\nindex 58dc30b..8a9de75 100644\n--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.h\n+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hns3_enet.h\n@@ -518,6 +518,8 @@ struct hns3_nic_priv {\n \t/* The most recently read link state */\n \tint link;\n \tu64 tx_timeout_count;\n+\tenum hnae3_reset_type reset_level;\n+\tunsigned long last_reset_time;\n \n \tunsigned long state;\n \n", "prefixes": [ "net-next", "6/9" ] }