From patchwork Wed Mar 6 04:08:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 1052106 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="D55S5UWt"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="YLcBlnCA"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44DgHt1C56z9sBF for ; Wed, 6 Mar 2019 15:09:11 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:Subject:Message-Id:Date:To: From:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=8sClHQNcHX7bZlAaQzfXbZzoUffpovlDfLQzCaAk9no=; b=D55S5UWtf77Bh1 T8kdbr/Anw4Lx7299YC4Lb1FPD/m4OyaN6ymXGEiVQqU/lWxdIZDreJ0lxx+whScribUD78Pg44eG MADKnyrf0jW84Jn7ZwWx4qThMf0prrFinKIBBee7Q2lLtt/Se5eHkGjFtsLE+Rr5RC+m0aeq6Yuek dy+j4RBY0J31xIKb2MYbi0c0nXGwTYro6T1c2PJ7pam5CyO7bALIaGHxkIu5KYM3qYODz0U4LE994 uftBdBAILEFHLfC/OasTagy4RPXOGAoN7lUjJBz1Atq9R+t7F7RVwEPHxYMuTjHO/1yJJb4rFrSln sRFSOd06vBX0iXnsAFpw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h1NrR-0003L6-BR; Wed, 06 Mar 2019 04:08:53 +0000 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h1NrO-0003Kg-SA for openwrt-devel@lists.openwrt.org; Wed, 06 Mar 2019 04:08:52 +0000 Received: by mail-pg1-x541.google.com with SMTP id q206so7250454pgq.4 for ; Tue, 05 Mar 2019 20:08:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=XQVkYG4LOi5RtWwCKQqrSnXZWqONCoJdZ1WL3aj6pWs=; b=YLcBlnCAg0lY47ME55+BlcvJ2Kc/PUItKo71gzE1wbRKdArpU691NyKYsHWAR2b09q yBcUxORcq9Dr1q4RRUazGLHHSe4M/ZSR97vQYE44Cc6w3Z1atVckUh5kTtp0hArQI64F FF8CC+eKtMcbPV9r5TZfeqD5W+BMdb5389ddxbxUcu0cQXwojBWjN2+GWb4NDAGI7+vX 2007Z/JPHAzuJREXgHiz1rRvDl4Cnel25NRe4TvAAaDvEJIDPCLu9qZisGLg1+4EBb4w h9Udjcj7Wc8lwZ+O4mc+Dx/441nlOkcksXHvYThW+tCH1JVb9pAES4EAhFi7/+kRl9jO uhhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=XQVkYG4LOi5RtWwCKQqrSnXZWqONCoJdZ1WL3aj6pWs=; b=bFON70OHpziHfR9Bu3bnw95D7dmVhSyK3xegFRQDxMdKtQJD1yHJTjO2gB+KBqM6Jb Jz+HHZeJ8s/wuHjRoTicFTkN3HdjMhsVZSDF7qYtta1+4nkM3jMQ/37nJ2QUymjYAuMT VUD05nX60oixamKtW5IMEEwvlxM1uQv1xz3dmNFAN0TY31BRmFENTLCubHJ5qI1ZNfrj ZrESawxxd/HYWRSIhSeOAMGwlfHOU/7OOMqqr/SVy/KoRHeo5hSpkQfOROVUUNWu9Z2w Ap/8UwG+6D3SBTVBkRtrMacHRwoHqVInJG3VDNqUqae7sKemFRfpUtEgV1dDp55OYrV9 peEw== X-Gm-Message-State: APjAAAUmhaPs0Oo4M/V4s54v9fMiE/OF9fhv/N7FhY/kkwrWJWbnFQTe hn0g0IdTEG4TJuAarCotsi5bRikv X-Google-Smtp-Source: APXvYqx4xJHvqq2snB5ETbfxVTNVAXN9u/bL47MKQBX/pv/yaOO6KvL8MhWHNU6vbyYRZ9YO6zI2Fw== X-Received: by 2002:a63:470a:: with SMTP id u10mr4549946pga.17.1551845328651; Tue, 05 Mar 2019 20:08:48 -0800 (PST) Received: from mangix-pc.lan (76-14-108-220.rk.wavecable.com. [76.14.108.220]) by smtp.gmail.com with ESMTPSA id p2sm966926pfi.95.2019.03.05.20.08.47 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Mar 2019 20:08:47 -0800 (PST) From: Rosen Penev To: openwrt-devel@lists.openwrt.org Date: Tue, 5 Mar 2019 20:08:46 -0800 Message-Id: <20190306040846.21746-1-rosenp@gmail.com> X-Mailer: git-send-email 2.17.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190305_200850_936091_4DC95A5A X-CRM114-Status: GOOD ( 11.03 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:541 listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (rosenp[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain Subject: [OpenWrt-Devel] [PATCH] ramips: ethernet: fix to interrupt handling X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org From: NeilBrown The current code acknowledged interrupts *after* polling. This is the wrong way around, and could cause an interrupt to be missed. This is not likely to be fatal as another packet, and so another interrupt, should come along soon. But maybe it is causing problems, so let's fix it anyway. Signed-off-by: NeilBrown Signed-off-by: Rosen Penev --- .../drivers/net/ethernet/mediatek/mtk_eth_soc.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_eth_soc.c index e0bc0ab818..2e0c8f94ca 100644 --- a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_eth_soc.c @@ -876,6 +876,8 @@ static int fe_poll_rx(struct napi_struct *napi, int budget, struct fe_rx_dma *rxd, trxd; int done = 0, pad; + fe_reg_w32(rx_intr, FE_REG_FE_INT_STATUS); + if (netdev->features & NETIF_F_RXCSUM) checksum_bit = soc->checksum_bit; else @@ -963,9 +965,6 @@ release_desc: done++; } - if (done < budget) - fe_reg_w32(rx_intr, FE_REG_FE_INT_STATUS); - return done; } @@ -981,6 +980,8 @@ static int fe_poll_tx(struct fe_priv *priv, int budget, u32 tx_intr, u32 idx, hwidx; struct fe_tx_ring *ring = &priv->tx_ring; + fe_reg_w32(tx_intr, FE_REG_FE_INT_STATUS); + idx = ring->tx_free_idx; hwidx = fe_reg_r32(FE_REG_TX_DTX_IDX0); @@ -1004,9 +1005,7 @@ static int fe_poll_tx(struct fe_priv *priv, int budget, u32 tx_intr, if (idx == hwidx) { /* read hw index again make sure no new tx packet */ hwidx = fe_reg_r32(FE_REG_TX_DTX_IDX0); - if (idx == hwidx) - fe_reg_w32(tx_intr, FE_REG_FE_INT_STATUS); - else + if (idx != hwidx) *tx_again = 1; } else { *tx_again = 1;