netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
To: Tomoya MORINAGA <tomoya-linux-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org>
Cc: andrew.chih.howe.khor-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	qi.wang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	margie.foster-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	yong.y.wang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	socketcan-core-0fE9KPoRgkgATYTw5x5z8w@public.gmane.org,
	kok.howg.ewe-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	joel.clark-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	Wolfgang Grandegger <wg-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
Subject: Re: [PATCH net-next-2.6 v8 01/20] CAN : Add flow control processing.
Date: Sun, 12 Dec 2010 16:26:06 +0100	[thread overview]
Message-ID: <4D04E98E.5090800@pengutronix.de> (raw)
In-Reply-To: <4CFE13E4.2020707-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org>


[-- Attachment #1.1: Type: text/plain, Size: 3115 bytes --]

On 12/07/2010 12:00 PM, Tomoya MORINAGA wrote:
> 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.

See comment inline.

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

David asked you in his previous review to implement a pure software
solution without relying on the hardware because it tends to be racy.

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

cheers, Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

[-- Attachment #2: Type: text/plain, Size: 188 bytes --]

_______________________________________________
Socketcan-core mailing list
Socketcan-core-0fE9KPoRgkgATYTw5x5z8w@public.gmane.org
https://lists.berlios.de/mailman/listinfo/socketcan-core

      parent reply	other threads:[~2010-12-12 15:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-07 11:00 [PATCH net-next-2.6 v8 01/20] CAN : Add flow control processing Tomoya MORINAGA
     [not found] ` <4CFE13E4.2020707-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org>
2010-12-10 19:17   ` David Miller
2010-12-12 15:26   ` Marc Kleine-Budde [this message]

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=4D04E98E.5090800@pengutronix.de \
    --to=mkl-bicnvbalz9megne8c9+irq@public.gmane.org \
    --cc=andrew.chih.howe.khor-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=joel.clark-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=kok.howg.ewe-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=margie.foster-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=qi.wang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=socketcan-core-0fE9KPoRgkgATYTw5x5z8w@public.gmane.org \
    --cc=tomoya-linux-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org \
    --cc=wg-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org \
    --cc=yong.y.wang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    /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).