netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next-2.6 v9 01/20] pch_can: Add flow control processing
@ 2010-12-13  6:24 Tomoya MORINAGA
       [not found] ` <1292221467-8039-1-git-send-email-tomoya-linux-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org>
  0 siblings, 1 reply; 43+ messages in thread
From: Tomoya MORINAGA @ 2010-12-13  6:24 UTC (permalink / raw)
  To: wg-5Yr1BZd7O62+XT7JhA+gdA, w.sang-bIcnvbaLZ9MEGnE8C9+IrQ,
	chripell-VaTbYqLCNhc, 21cnbao-Re5JQEeQqe8AvxtiuMwx3w,
	sameo-VuQAYsv1563Yd54FQh9/CA,
	socketcan-core-0fE9KPoRgkgATYTw5x5z8w,
	netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TZUIDd8j+nm9g
  Cc: andrew.chih.howe.khor-ral2JQCrhuEAvxtiuMwx3w,
	qi.wang-ral2JQCrhuEAvxtiuMwx3w,
	margie.foster-ral2JQCrhuEAvxtiuMwx3w,
	yong.y.wang-ral2JQCrhuEAvxtiuMwx3w,
	kok.howg.ewe-ral2JQCrhuEAvxtiuMwx3w,
	joel.clark-ral2JQCrhuEAvxtiuMwx3w

Currently, there is no flow control processing.
Thus, Add flow control processing as
when there is no empty of tx buffer,
netif_stop_queue is called.
When there is empty buffer, netif_wake_queue is called.

Signed-off-by: Tomoya MORINAGA <tomoya-linux-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org>
---
 drivers/net/can/pch_can.c |   31 ++++++++++++-------------------
 1 files changed, 12 insertions(+), 19 deletions(-)

diff --git a/drivers/net/can/pch_can.c b/drivers/net/can/pch_can.c
index a9b6a65..f0f1404 100644
--- a/drivers/net/can/pch_can.c
+++ b/drivers/net/can/pch_can.c
@@ -102,6 +102,10 @@
 
 #define PCH_FIFO_THRESH		16
 
+/* TxRqst2 show status of MsgObjNo.17~32 */
+#define PCH_TREQ2_TX_MASK	(((1 << PCH_TX_OBJ_NUM) - 1) <<\
+							(PCH_RX_OBJ_END - 16))
+
 enum pch_ifreg {
 	PCH_RX_IFREG,
 	PCH_TX_IFREG,
@@ -871,6 +875,8 @@ MSG_OBJ:
 			dlc = 8;
 		stats->tx_bytes += dlc;
 		stats->tx_packets++;
+		if (int_stat == PCH_TX_OBJ_END)
+			netif_wake_queue(ndev);
 	}
 
 	int_stat = pch_can_int_pending(priv);
@@ -1009,18 +1015,6 @@ static int pch_close(struct net_device *ndev)
 	return 0;
 }
 
-static int pch_get_msg_obj_sts(struct net_device *ndev, u32 obj_id)
-{
-	u32 buffer_status = 0;
-	struct pch_can_priv *priv = netdev_priv(ndev);
-
-	/* Getting the message object status. */
-	buffer_status = (u32) pch_can_get_buffer_status(priv);
-
-	return buffer_status & obj_id;
-}
-
-
 static netdev_tx_t pch_xmit(struct sk_buff *skb, struct net_device *ndev)
 {
 	int i, j;
@@ -1031,17 +1025,16 @@ static netdev_tx_t pch_xmit(struct sk_buff *skb, struct net_device *ndev)
 	if (can_dropped_invalid_skb(ndev, skb))
 		return NETDEV_TX_OK;
 
-	if (priv->tx_obj == PCH_TX_OBJ_END) { /* Point tail Obj */
-		while (pch_get_msg_obj_sts(ndev, (((1 << PCH_TX_OBJ_NUM)-1) <<
-					   PCH_RX_OBJ_NUM)))
-			udelay(500);
+	if (priv->tx_obj == PCH_TX_OBJ_END) {
+		if (ioread32(&priv->regs->treq2) & PCH_TREQ2_TX_MASK)
+			netif_stop_queue(ndev);
 
-		priv->tx_obj = PCH_TX_OBJ_START; /* Point head of Tx Obj ID */
-		tx_buffer_avail = priv->tx_obj; /* Point Tail of Tx Obj */
+		tx_buffer_avail = priv->tx_obj;
+		priv->tx_obj = PCH_TX_OBJ_START;
 	} else {
 		tx_buffer_avail = priv->tx_obj;
+		priv->tx_obj++;
 	}
-	priv->tx_obj++;
 
 	/* Reading the Msg Obj from the Msg RAM to the Interface register. */
 	iowrite32(PCH_CMASK_RX_TX_GET, &priv->regs->ifregs[1].cmask);
-- 
1.6.0.6

^ permalink raw reply related	[flat|nested] 43+ messages in thread

end of thread, other threads:[~2010-12-14  3:45 UTC | newest]

Thread overview: 43+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-13  6:24 [PATCH net-next-2.6 v9 01/20] pch_can: Add flow control processing Tomoya MORINAGA
     [not found] ` <1292221467-8039-1-git-send-email-tomoya-linux-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org>
2010-12-13  6:24   ` [PATCH net-next-2.6 v9 02/20] pch_can: Divide poll function Tomoya MORINAGA
     [not found]     ` <1292221467-8039-2-git-send-email-tomoya-linux-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org>
2010-12-13  6:24       ` [PATCH net-next-2.6 v9 03/20] pch_can: Fix endianness issue Tomoya MORINAGA
     [not found]         ` <1292221467-8039-3-git-send-email-tomoya-linux-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org>
2010-12-13  6:24           ` [PATCH net-next-2.6 v9 04/20] pch_can: Improve rx processing Tomoya MORINAGA
     [not found]             ` <1292221467-8039-4-git-send-email-tomoya-linux-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org>
2010-12-13  6:24               ` [PATCH net-next-2.6 v9 05/20] pch_can: Fix warnings Tomoya MORINAGA
     [not found]                 ` <1292221467-8039-5-git-send-email-tomoya-linux-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org>
2010-12-13  6:24                   ` [PATCH net-next-2.6 v9 06/20] pch_can: Rename function/macro name Tomoya MORINAGA
     [not found]                     ` <1292221467-8039-6-git-send-email-tomoya-linux-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org>
2010-12-13  6:24                       ` [PATCH net-next-2.6 v9 07/20] pch_can: Change functions type Tomoya MORINAGA
     [not found]                         ` <1292221467-8039-7-git-send-email-tomoya-linux-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org>
2010-12-13  6:24                           ` [PATCH net-next-2.6 v9 08/20] pch_can: Reduce register access Tomoya MORINAGA
2010-12-13  6:24                             ` [PATCH net-next-2.6 v9 09/20] pch_can: Change Copyright and module description Tomoya MORINAGA
2010-12-13  6:24                               ` [PATCH net-next-2.6 v9 10/20] pch_can: Replace netdev_dbg instead of dev_dbg partly Tomoya MORINAGA
     [not found]                                 ` <1292221467-8039-10-git-send-email-tomoya-linux-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org>
2010-12-13  6:24                                   ` [PATCH net-next-2.6 v9 11/20] pch_can: Fix coding rule violation Tomoya MORINAGA
     [not found]                                     ` <1292221467-8039-11-git-send-email-tomoya-linux-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org>
2010-12-13  6:24                                       ` [PATCH net-next-2.6 v9 12/20] pch_can: Delete unnecessary/redundant code Tomoya MORINAGA
     [not found]                                         ` <1292221467-8039-12-git-send-email-tomoya-linux-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org>
2010-12-13  6:24                                           ` [PATCH net-next-2.6 v9 13/20] pch_can: Fix bit timing calculation issue Tomoya MORINAGA
2010-12-13  6:24                                             ` [PATCH net-next-2.6 v9 14/20] pch_can: Fix miss-setting status issue Tomoya MORINAGA
2010-12-13  6:24                                               ` [PATCH net-next-2.6 v9 15/20] pch_can: Comment optimization Tomoya MORINAGA
     [not found]                                                 ` <1292221467-8039-15-git-send-email-tomoya-linux-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org>
2010-12-13  6:24                                                   ` [PATCH net-next-2.6 v9 16/20] pch_can: Move MSI processing to probe/remove processing Tomoya MORINAGA
     [not found]                                                     ` <1292221467-8039-16-git-send-email-tomoya-linux-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org>
2010-12-13  6:24                                                       ` [PATCH net-next-2.6 v9 17/20] pch_can: Fix incorrect return processing Tomoya MORINAGA
2010-12-13  6:24                                                         ` [PATCH net-next-2.6 v9 18/20] pch_can: Optimize "if" condition in rx/tx processing Tomoya MORINAGA
2010-12-13  6:24                                                           ` [PATCH net-next-2.6 v9 19/20] pch_can: Add setting TEC/REC statistics processing Tomoya MORINAGA
2010-12-13  6:24                                                             ` [PATCH net-next-2.6 v9 20/20] pch_can: Replace netif_rx to netif_receive_skb Tomoya MORINAGA
     [not found]                                                               ` <1292221467-8039-20-git-send-email-tomoya-linux-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org>
2010-12-13 20:28                                                                 ` David Miller
2010-12-13 21:51                                                                   ` Oliver Hartkopp
2010-12-14  3:45                                                                     ` David Miller
2010-12-14  2:16                                                                   ` Tomoya MORINAGA
     [not found]                                                             ` <1292221467-8039-19-git-send-email-tomoya-linux-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org>
2010-12-13 20:28                                                               ` [PATCH net-next-2.6 v9 19/20] pch_can: Add setting TEC/REC statistics processing David Miller
     [not found]                                                           ` <1292221467-8039-18-git-send-email-tomoya-linux-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org>
2010-12-13 20:28                                                             ` [PATCH net-next-2.6 v9 18/20] pch_can: Optimize "if" condition in rx/tx processing David Miller
     [not found]                                                         ` <1292221467-8039-17-git-send-email-tomoya-linux-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org>
2010-12-13 20:28                                                           ` [PATCH net-next-2.6 v9 17/20] pch_can: Fix incorrect return processing David Miller
2010-12-13 20:27                                                       ` [PATCH net-next-2.6 v9 16/20] pch_can: Move MSI processing to probe/remove processing David Miller
2010-12-13 20:27                                                   ` [PATCH net-next-2.6 v9 15/20] pch_can: Comment optimization David Miller
     [not found]                                               ` <1292221467-8039-14-git-send-email-tomoya-linux-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org>
2010-12-13 20:27                                                 ` [PATCH net-next-2.6 v9 14/20] pch_can: Fix miss-setting status issue David Miller
     [not found]                                             ` <1292221467-8039-13-git-send-email-tomoya-linux-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org>
2010-12-13 20:27                                               ` [PATCH net-next-2.6 v9 13/20] pch_can: Fix bit timing calculation issue David Miller
2010-12-13 20:27                                           ` [PATCH net-next-2.6 v9 12/20] pch_can: Delete unnecessary/redundant code David Miller
2010-12-13 20:27                                       ` [PATCH net-next-2.6 v9 11/20] pch_can: Fix coding rule violation David Miller
2010-12-13 20:27                                   ` [PATCH net-next-2.6 v9 10/20] pch_can: Replace netdev_dbg instead of dev_dbg partly David Miller
     [not found]                               ` <1292221467-8039-9-git-send-email-tomoya-linux-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org>
2010-12-13 20:27                                 ` [PATCH net-next-2.6 v9 09/20] pch_can: Change Copyright and module description David Miller
     [not found]                             ` <1292221467-8039-8-git-send-email-tomoya-linux-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org>
2010-12-13 20:27                               ` [PATCH net-next-2.6 v9 08/20] pch_can: Reduce register access David Miller
2010-12-13 20:26                           ` [PATCH net-next-2.6 v9 07/20] pch_can: Change functions type David Miller
2010-12-13 20:26                       ` [PATCH net-next-2.6 v9 06/20] pch_can: Rename function/macro name David Miller
2010-12-13 20:26                   ` [PATCH net-next-2.6 v9 05/20] pch_can: Fix warnings David Miller
2010-12-13 20:26               ` [PATCH net-next-2.6 v9 04/20] pch_can: Improve rx processing David Miller
2010-12-13 20:26           ` [PATCH net-next-2.6 v9 03/20] pch_can: Fix endianness issue David Miller
2010-12-13 20:26       ` [PATCH net-next-2.6 v9 02/20] pch_can: Divide poll function David Miller
2010-12-13 20:26   ` [PATCH net-next-2.6 v9 01/20] pch_can: Add flow control processing David Miller

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).