netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Noam Camus <noamc@ezchip.com>
To: <linux-kernel@vger.kernel.org>, <netdev@vger.kernel.org>
Cc: <davem@davemloft.net>, <Alexey.Brodkin@synopsys.com>,
	<vgupta@synopsys.com>, <talz@ezchip.com>,
	Noam Camus <noamc@ezchip.com>
Subject: [v1 1/6] NET: nps_enet: replace use of cause register
Date: Mon, 17 Aug 2015 08:58:34 +0300	[thread overview]
Message-ID: <1439791119-26892-2-git-send-email-noamc@ezchip.com> (raw)
In-Reply-To: <1439791119-26892-1-git-send-email-noamc@ezchip.com>

From: Noam Camus <noamc@ezchip.com>

When interrupt is received we read directly from control
register for RX/TX instead of reading cause register
since this register fails to indicate TX done when
TX interrupt is "edge mode".

Signed-off-by: Noam Camus <noamc@ezchip.com>
---
 drivers/net/ethernet/ezchip/nps_enet.c |    9 +++++----
 drivers/net/ethernet/ezchip/nps_enet.h |   20 --------------------
 2 files changed, 5 insertions(+), 24 deletions(-)

diff --git a/drivers/net/ethernet/ezchip/nps_enet.c b/drivers/net/ethernet/ezchip/nps_enet.c
index 24a85b2..0e652b4 100644
--- a/drivers/net/ethernet/ezchip/nps_enet.c
+++ b/drivers/net/ethernet/ezchip/nps_enet.c
@@ -211,12 +211,13 @@ static irqreturn_t nps_enet_irq_handler(s32 irq, void *dev_instance)
 {
 	struct net_device *ndev = dev_instance;
 	struct nps_enet_priv *priv = netdev_priv(ndev);
-	struct nps_enet_buf_int_cause buf_int_cause;
+	struct nps_enet_rx_ctl rx_ctrl;
+	struct nps_enet_tx_ctl tx_ctrl;
 
-	buf_int_cause.value =
-			nps_enet_reg_get(priv, NPS_ENET_REG_BUF_INT_CAUSE);
+	rx_ctrl.value = nps_enet_reg_get(priv, NPS_ENET_REG_RX_CTL);
+	tx_ctrl.value = nps_enet_reg_get(priv, NPS_ENET_REG_TX_CTL);
 
-	if (buf_int_cause.tx_done || buf_int_cause.rx_rdy)
+	if ((!tx_ctrl.ct && priv->tx_packet_sent) || rx_ctrl.cr)
 		if (likely(napi_schedule_prep(&priv->napi))) {
 			nps_enet_reg_set(priv, NPS_ENET_REG_BUF_INT_ENABLE, 0);
 			__napi_schedule(&priv->napi);
diff --git a/drivers/net/ethernet/ezchip/nps_enet.h b/drivers/net/ethernet/ezchip/nps_enet.h
index fc45c9d..6703674 100644
--- a/drivers/net/ethernet/ezchip/nps_enet.h
+++ b/drivers/net/ethernet/ezchip/nps_enet.h
@@ -36,7 +36,6 @@
 #define NPS_ENET_REG_RX_CTL		0x810
 #define NPS_ENET_REG_RX_BUF		0x818
 #define NPS_ENET_REG_BUF_INT_ENABLE	0x8C0
-#define NPS_ENET_REG_BUF_INT_CAUSE	0x8C4
 #define NPS_ENET_REG_GE_MAC_CFG_0	0x1000
 #define NPS_ENET_REG_GE_MAC_CFG_1	0x1004
 #define NPS_ENET_REG_GE_MAC_CFG_2	0x1008
@@ -108,25 +107,6 @@ struct nps_enet_buf_int_enable {
 	};
 };
 
-/* Interrupt cause for data buffer events register */
-struct nps_enet_buf_int_cause {
-	union {
-		/* tx_done: Interrupt in the case when current frame was
-		 *          read from TX buffer.
-		 * rx_rdy:  Interrupt in the case when new frame is ready
-		 *          in RX buffer.
-		 */
-		struct {
-			u32
-			__reserved:30,
-			tx_done:1,
-			rx_rdy:1;
-		};
-
-		u32 value;
-	};
-};
-
 /* Gbps Eth MAC Configuration 0 register */
 struct nps_enet_ge_mac_cfg_0 {
 	union {
-- 
1.7.1

  reply	other threads:[~2015-08-17  5:58 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-17  5:58 [v1 0/6] *** nps_enet fixups *** Noam Camus
2015-08-17  5:58 ` Noam Camus [this message]
2015-08-17  5:58   ` [v1 2/6] NET: nps_enet: reduce processing latency Noam Camus
2015-08-17  5:58     ` [v1 3/6] NET: nps_enet: TX done race condition Noam Camus
2015-08-17  5:58       ` [v1 4/6] NET: nps_enet: drop control frames Noam Camus
2015-08-17  5:58         ` [v1 5/6] NET: nps_enet: TX done acknowledge Noam Camus
2015-08-17  5:58           ` [v1 6/6] NET: nps_enet: minor namespace cleanup Noam Camus
2015-08-17 17:36 ` [v1 0/6] *** nps_enet fixups *** David Miller
2015-08-18  5:04   ` Noam Camus
2015-08-18  5:26     ` David Miller
2015-08-20  5:00   ` [v2 0/5] " Noam Camus
2015-08-20  5:00     ` [v2 1/5] NET: nps_enet: replace use of cause register Noam Camus
2015-08-20  5:00       ` [v2 2/5] NET: nps_enet: TX done race condition Noam Camus
2015-08-20  5:00         ` [v2 3/5] NET: nps_enet: drop control frames Noam Camus
2015-08-20  5:00           ` [v2 4/5] NET: nps_enet: TX done acknowledge Noam Camus
2015-08-20  5:00             ` [v2 5/5] NET: nps_enet: minor namespace cleanup Noam Camus
2015-08-23 23:09     ` [v2 0/5] *** nps_enet fixups *** David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1439791119-26892-2-git-send-email-noamc@ezchip.com \
    --to=noamc@ezchip.com \
    --cc=Alexey.Brodkin@synopsys.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=talz@ezchip.com \
    --cc=vgupta@synopsys.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).