Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/808121/?format=api
{ "id": 808121, "url": "http://patchwork.ozlabs.org/api/patches/808121/?format=api", "web_url": "http://patchwork.ozlabs.org/project/lede/patch/20170831082245.22255-1-kristian.evensen@gmail.com/", "project": { "id": 54, "url": "http://patchwork.ozlabs.org/api/projects/54/?format=api", "name": "LEDE development", "link_name": "lede", "list_id": "lede-dev.lists.infradead.org", "list_email": "lede-dev@lists.infradead.org", "web_url": "http://lede-project.org/", "scm_url": "", "webscm_url": "http://git.lede-project.org/", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20170831082245.22255-1-kristian.evensen@gmail.com>", "list_archive_url": null, "date": "2017-08-31T08:22:45", "name": "[LEDE-DEV] ramips: Improve stability of the mt7621 switch", "commit_ref": null, "pull_url": null, "state": "not-applicable", "archived": true, "hash": "1f3639b67325431ad480d9208aaed09296e5b902", "submitter": { "id": 34169, "url": "http://patchwork.ozlabs.org/api/people/34169/?format=api", "name": "Kristian Evensen", "email": "kristian.evensen@gmail.com" }, "delegate": { "id": 67494, "url": "http://patchwork.ozlabs.org/api/users/67494/?format=api", "username": "pepe2k", "first_name": "Piotr", "last_name": "Dymacz", "email": "pepe2k@gmail.com" }, "mbox": "http://patchwork.ozlabs.org/project/lede/patch/20170831082245.22255-1-kristian.evensen@gmail.com/mbox/", "series": [ { "id": 768, "url": "http://patchwork.ozlabs.org/api/series/768/?format=api", "web_url": "http://patchwork.ozlabs.org/project/lede/list/?series=768", "date": "2017-08-31T08:22:45", "name": "[LEDE-DEV] ramips: Improve stability of the mt7621 switch", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/768/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/808121/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/808121/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org", "Authentication-Results": [ "ozlabs.org; spf=none (mailfrom)\n\tsmtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133;\n\thelo=bombadil.infradead.org;\n\tenvelope-from=lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org;\n\treceiver=<UNKNOWN>)", "ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=lists.infradead.org\n\theader.i=@lists.infradead.org header.b=\"EQ4ahZdW\"; \n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"g4OifWCZ\"; dkim-atps=neutral" ], "Received": [ "from bombadil.infradead.org (bombadil.infradead.org\n\t[65.50.211.133])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xjb4C2N5hz9s3w\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 31 Aug 2017 18:23:39 +1000 (AEST)", "from localhost ([127.0.0.1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dnKkx-00079t-PQ; Thu, 31 Aug 2017 08:23:19 +0000", "from mail-lf0-x243.google.com ([2a00:1450:4010:c07::243])\n\tby bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dnKkt-000776-Jr\n\tfor lede-dev@lists.infradead.org; Thu, 31 Aug 2017 08:23:17 +0000", "by mail-lf0-x243.google.com with SMTP id h132so12209lfh.2\n\tfor <lede-dev@lists.infradead.org>;\n\tThu, 31 Aug 2017 01:22:54 -0700 (PDT)", "from localhost.localdomain ([193.213.155.210])\n\tby smtp.gmail.com with ESMTPSA id\n\tx4sm201238lfa.66.2017.08.31.01.22.51\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tThu, 31 Aug 2017 01:22:52 -0700 (PDT)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20170209; h=Sender:\n\tContent-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe:\n\tList-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Subject:Message-Id:\n\tDate:To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:\n\tResent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:\n\tList-Owner; bh=EKA9G1lGgKy5q7KnCM8A+78JGuXk8wu5Itk3WsmY9N4=;\n\tb=EQ4ahZdW5hwUT4\n\tVOR9gv9bIVwnbRNUIvdV0ddQhAbKY4UfFZaa7J1fHOo3E6wKmVfPGUn6wAct4InhTpuvKL7fgrAEt\n\tVvrx241eKymEFKuvli3xoFyF8sCtOZDePd0O12Q3cpY33ikn4CAWmTRP9VxA2Ux+8sb9D0HcUYwT9\n\t6JrdpMuaA20Wfq3Xls3VXnOBYB8Tu2CBcSox9ALaPFWQpd02KRUPVw6iEu4QmMQs0dU2mm2bcifYd\n\tIp2sdRtnr8ia4ivJQ4DcThG6DkavPwXGJkYOFMcFffm6jP5I5pXn0rCupIsmlQF47paGy5pSIJ4aU\n\tPkvg1GtgEka26UbHAlQA==;", "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=from:to:cc:subject:date:message-id;\n\tbh=1eVo5fRWj1w3YKUyLNvDxRA68tVuRAp9L+DYWfMCMG0=;\n\tb=g4OifWCZDnwAFrLbLxix69z+KnjajFJMf3Mvi7bt0kOwoXOhJgpyZ8T03rnZo0qlQC\n\tca/WV1NMSoLF1n2cBOydhE0PnHsH9D+cbw6H1kQdgWarl98gpgDS6q/Szqv1kJ31SSZd\n\tGmkTMK1+FF9U7jXTLXQkWeNRMeUyhb5WBnx0sLPR91ko803whv2N4A44s+xq7serMjmA\n\tXMSmQI0+Thdgy76SSBYN3d2+4dzhMVzPNbdSh3kwS6+6U2dBQ+n6E1iJk82w9i/Ehz3t\n\txxsT1u2/ZIWyxMyU2YneM8tlkavE8M/IsZTTDsDgSgrGfhbA1zrRWVeCXP05A6pnz7Wk\n\tjUUA==" ], "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id;\n\tbh=1eVo5fRWj1w3YKUyLNvDxRA68tVuRAp9L+DYWfMCMG0=;\n\tb=gUxgLRao24/LFGroGCbloq2Ri3ZZ3Y1Mf9gWQkV9oxNsRwYwTmibZbbYF4nu347k7h\n\tjV2/Dn2s17M3fbgdSRdMadQcRFIo/2BwhUdobriVzYU0XCiCViYkOvNCy7+se52GofJi\n\txaIgtBbIlNKYnE1epgDDbqSnmwtGqHXFsCZvNhTVrTVt1EHoaeC1lHY/K6s/HhEplqEA\n\trYHw8fXG9oGWN0pWIT2pF0s64q6OzSEka8WfYUwtU1so+KpX0slYqudVyAkRZoHHZAXj\n\tFRalHw/5eHjcrkuLJSEzbkHimINFaYx92YAHP0iJQ6REl3SiandiTyD02hs09khu7U3i\n\t+9Ew==", "X-Gm-Message-State": "AHYfb5gsrVMPe6n99lfl5TVa35IemsQqINhMjT71Vxi+S+UyQ2fhK3FR\n\testCPJprplfxcc1j", "X-Received": "by 10.46.7.81 with SMTP id i17mr1882889ljd.78.1504167772710;\n\tThu, 31 Aug 2017 01:22:52 -0700 (PDT)", "From": "Kristian Evensen <kristian.evensen@gmail.com>", "To": "lede-dev@lists.infradead.org", "Date": "Thu, 31 Aug 2017 10:22:45 +0200", "Message-Id": "<20170831082245.22255-1-kristian.evensen@gmail.com>", "X-Mailer": "git-send-email 2.11.0", "X-CRM114-Version": "20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ", "X-CRM114-CacheID": "sfid-20170831_012315_874143_F0791E93 ", "X-CRM114-Status": "GOOD ( 16.47 )", "X-Spam-Score": "-2.0 (--)", "X-Spam-Report": "SpamAssassin version 3.4.1 on bombadil.infradead.org summary:\n\tContent analysis details: (-2.0 points)\n\tpts rule name description\n\t---- ----------------------\n\t--------------------------------------------------\n\t-0.0 SPF_PASS SPF: sender matches SPF record\n\t0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\n\tprovider (kristian.evensen[at]gmail.com)\n\t-1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1%\n\t[score: 0.0000]\n\t-0.1 DKIM_VALID Message has at least one valid DKIM or DK signature\n\t0.1 DKIM_SIGNED Message has a DKIM or DK signature,\n\tnot necessarily valid\n\t-0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from\n\tauthor's domain", "Subject": "[LEDE-DEV] [PATCH] ramips: Improve stability of the mt7621 switch", "X-BeenThere": "lede-dev@lists.infradead.org", "X-Mailman-Version": "2.1.21", "Precedence": "list", "List-Id": "<lede-dev.lists.infradead.org>", "List-Unsubscribe": "<http://lists.infradead.org/mailman/options/lede-dev>,\n\t<mailto:lede-dev-request@lists.infradead.org?subject=unsubscribe>", "List-Archive": "<http://lists.infradead.org/pipermail/lede-dev/>", "List-Post": "<mailto:lede-dev@lists.infradead.org>", "List-Help": "<mailto:lede-dev-request@lists.infradead.org?subject=help>", "List-Subscribe": "<http://lists.infradead.org/mailman/listinfo/lede-dev>,\n\t<mailto:lede-dev-request@lists.infradead.org?subject=subscribe>", "Cc": "Kristian Evensen <kristian.evensen@gmail.com>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Sender": "\"Lede-dev\" <lede-dev-bounces@lists.infradead.org>", "Errors-To": "lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org" }, "content": "The switch on the mt7621 soc seems to sometimes struggle with Ethernet\npause frames. If a pause frame is received at the incorrect time, the\nswitch will for some reason hang and no data can be sent. Most of the\ntime, a router has to be rebooted before the switch will work again,\nwhile sometimes the switch recovers by itself. I am able to reliably\ntrigger this error on the ZBT WG2926 and 3526 by saturating the\nrouter/switch with small (<100B) packets, or by spamming the router with\npause frames while sending traffic. The error message looks something\nlike this (and will in most cases loop over and over):\n\n[10203960.260000] mtk_soc_eth 1e100000.ethernet eth0: transmit timed out\n[10203960.260000] mtk_soc_eth 1e100000.ethernet eth0: dma_cfg:80000065\n[10203960.270000] mtk_soc_eth 1e100000.ethernet eth0: tx_ring=0,\nbase=0ef10000, max=512, ctx=118, dtx=118, fdx=117, next=118\n[10203960.280000] mtk_soc_eth 1e100000.ethernet eth0: rx_ring=0,\nbase=0ef12000, max=512, calc=380, drx=381\n\nThis commit works around the issue by not advertising pause frame\nsupport during auto negotiation. However, I have found at least one\nswitch which sends pause frames anyway. In case a pause frame is sent\nand triggers the error, we reset all ports on the switch. This also\nmakes the switch work properly again.\n\nWithout this change, my routers would crash within 15 minutes when\ntesting. With the change, the same test has been running for three days\nwithout any problems. Disabling pause frames is maybe not ideal, but\nsince this error only happens when the router/switch is completely\nswamped, then users/protocols/applications should not notice a\ndifference. It might even be better to drop packets right away, than to\nbuffer them for a given time.\n\nSigned-off-by: Kristian Evensen <kristian.evensen@gmail.com>\n---\n .../drivers/net/ethernet/mtk/gsw_mt7621.c | 8 +++++++\n .../drivers/net/ethernet/mtk/mtk_eth_soc.c | 3 +++\n .../drivers/net/ethernet/mtk/mtk_eth_soc.h | 1 +\n .../drivers/net/ethernet/mtk/soc_mt7621.c | 26 ++++++++++++++++++++++\n 4 files changed, 38 insertions(+)", "diff": "diff --git a/target/linux/ramips/files-4.9/drivers/net/ethernet/mtk/gsw_mt7621.c b/target/linux/ramips/files-4.9/drivers/net/ethernet/mtk/gsw_mt7621.c\nindex 3adad48c88..9814dae8fa 100644\n--- a/target/linux/ramips/files-4.9/drivers/net/ethernet/mtk/gsw_mt7621.c\n+++ b/target/linux/ramips/files-4.9/drivers/net/ethernet/mtk/gsw_mt7621.c\n@@ -186,6 +186,14 @@ static void mt7621_hw_init(struct mt7620_gsw *gsw, struct device_node *np)\n \tmt7530_mdio_w32(gsw, 0x7a74, 0x44);\n \tmt7530_mdio_w32(gsw, 0x7a7c, 0x44);\n \n+\t/* Disable pause frame */\n+\tfor (i = 0; i <= 4; i++) {\n+\t\tval = _mt7620_mii_read(gsw, i, 0x04);\n+\t\tpr_info(\"Auto-negotiate register: %u %x\\n\", i, val);\n+\t\tval &= ~BIT(10);\n+\t\t_mt7620_mii_write(gsw, i, 0x04, val);\n+\t}\n+\n \t/* turn on all PHYs */\n \tfor (i = 0; i <= 4; i++) {\n \t\tval = _mt7620_mii_read(gsw, i, 0);\ndiff --git a/target/linux/ramips/files-4.9/drivers/net/ethernet/mtk/mtk_eth_soc.c b/target/linux/ramips/files-4.9/drivers/net/ethernet/mtk/mtk_eth_soc.c\nindex 5f4afade06..de5b97a996 100644\n--- a/target/linux/ramips/files-4.9/drivers/net/ethernet/mtk/mtk_eth_soc.c\n+++ b/target/linux/ramips/files-4.9/drivers/net/ethernet/mtk/mtk_eth_soc.c\n@@ -1426,6 +1426,9 @@ static void fe_reset_pending(struct fe_priv *priv)\n \t\tdev_close(dev);\n \t}\n \trtnl_unlock();\n+\n+\tif (priv->soc->reset_ports)\n+\t\tpriv->soc->reset_ports(priv);\n }\n \n static const struct fe_work_t fe_work[] = {\ndiff --git a/target/linux/ramips/files-4.9/drivers/net/ethernet/mtk/mtk_eth_soc.h b/target/linux/ramips/files-4.9/drivers/net/ethernet/mtk/mtk_eth_soc.h\nindex 05f550fa26..0539ce4761 100644\n--- a/target/linux/ramips/files-4.9/drivers/net/ethernet/mtk/mtk_eth_soc.h\n+++ b/target/linux/ramips/files-4.9/drivers/net/ethernet/mtk/mtk_eth_soc.h\n@@ -392,6 +392,7 @@ struct fe_soc_data {\n \t\t\t u16 val);\n \tint (*mdio_read)(struct mii_bus *bus, int phy_addr, int phy_reg);\n \tvoid (*mdio_adjust_link)(struct fe_priv *priv, int port);\n+\tvoid (*reset_ports)(struct fe_priv *priv);\n \n \tvoid *swpriv;\n \tu32 pdma_glo_cfg;\ndiff --git a/target/linux/ramips/files-4.9/drivers/net/ethernet/mtk/soc_mt7621.c b/target/linux/ramips/files-4.9/drivers/net/ethernet/mtk/soc_mt7621.c\nindex ce41b342e7..8f9dc35875 100644\n--- a/target/linux/ramips/files-4.9/drivers/net/ethernet/mtk/soc_mt7621.c\n+++ b/target/linux/ramips/files-4.9/drivers/net/ethernet/mtk/soc_mt7621.c\n@@ -16,6 +16,7 @@\n #include <linux/platform_device.h>\n #include <linux/if_vlan.h>\n #include <linux/of_net.h>\n+#include <linux/delay.h>\n \n #include <asm/mach-ralink/ralink_regs.h>\n \n@@ -157,6 +158,30 @@ static void mt7621_set_mac(struct fe_priv *priv, unsigned char *mac)\n \tspin_unlock_irqrestore(&priv->page_lock, flags);\n }\n \n+static void mt7621_reset_ports(struct fe_priv *priv)\n+{\n+\tstruct mt7620_gsw *gsw = priv->soc->swpriv;\n+\tu8 i;\n+\tu32 val;\n+\n+\t/* Disable all ports */\n+\tfor (i = 0; i <= 4; i++) {\n+\t\tval = _mt7620_mii_read(gsw, i, 0x0);\n+\t\tval |= BIT(11);\n+\t\t_mt7620_mii_write(gsw, i, 0x0, val);\n+\t}\n+\n+\t/* Allow ports a (short) time to settle */\n+\tudelay(1000);\n+\n+\t/* Enable ports */\n+\tfor (i = 0; i <= 4; i++) {\n+\t\tval = _mt7620_mii_read(gsw, i, 0);\n+\t\tval &= ~BIT(11);\n+\t\t_mt7620_mii_write(gsw, i, 0, val);\n+\t}\n+}\n+\n static struct fe_soc_data mt7621_data = {\n \t.init_data = mt7621_init_data,\n \t.reset_fe = mt7621_fe_reset,\n@@ -175,6 +200,7 @@ static struct fe_soc_data mt7621_data = {\n \t.mdio_read = mt7620_mdio_read,\n \t.mdio_write = mt7620_mdio_write,\n \t.mdio_adjust_link = mt7620_mdio_link_adjust,\n+\t.reset_ports = mt7621_reset_ports,\n };\n \n const struct of_device_id of_fe_match[] = {\n", "prefixes": [ "LEDE-DEV" ] }