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,
Masayuki Ohtake
<masa-korg-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org>,
Samuel Ortiz <sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
margie.foster-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
LKML <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
socketcan-core-0fE9KPoRgkgATYTw5x5z8w@public.gmane.org,
yong.y.wang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
kok.howg.ewe-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
Wolfgang Grandegger <wg-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>,
joel.clark-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
"David S. Miller" <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>,
Christian Pellegrin <chripell-VaTbYqLCNhc@public.gmane.org>,
qi.wang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Subject: Re: [PATCH net-next-2.6 v2] can: Topcliff: PCH_CAN driver: Fix build warnings
Date: Tue, 09 Nov 2010 13:59:32 +0100 [thread overview]
Message-ID: <4CD945B4.4060408@pengutronix.de> (raw)
In-Reply-To: <00fe01cb8009$62e11410$66f8800a-a06+6cuVnkTSQfdrb5gaxUEOCMrvLtNR@public.gmane.org>
[-- Attachment #1.1: Type: text/plain, Size: 3570 bytes --]
On 11/09/2010 01:26 PM, Tomoya MORINAGA wrote:
>>>> Can you please explain me your locking sheme? If I understand the
>>>> documenation correctly the two message interfaces can be used mutual.
>>>> And you use one for rx the other one for tx.
>>>
>>> I show our locking scheme.
>>> When CPU accesses MessageRAM via IF1, CPU protect until read-modify-write
>>> so that IF2 access not occurred, vice versa.
>>
>> Why is that needed?
>
> For MessageRAM data consistency.
As far as I understand the datasheet the access to IF1 and IF2 is
completely independent. Why do you lock here?
[...]
>>>> Please use just "debug" level not warning here. Consider to use
>>>> netdev_dbg() instead. IMHO the __func__ can be dropped and the
>>>> "official" name for the error is "Error Warning".
>>>
>>> I want to know the reason.
>>> Why is it not dev_warn but netdev_dbg ?
>>
>> If you use warning level it would end up on the console or and in the
>> syslog. It's quite complicated (for programs) to get information from
>> there. This is why we send CAN error frames. They hold the same
>> information but int a binary form, thus it's easier to process.
>
> I understand the reason.
> BTW, Why do you say not dev_dbg but netdev_dbg ?
Sorry - netdev_dbg() is easier to use, its first argument is the
netdevice, while dev_dbg needs a device and that's deeply hidden in the
netdevice.
[...]
>>>>> +static netdev_tx_t pch_xmit(struct sk_buff *skb, struct net_device *ndev)
>>>>> +{
>>>>> + unsigned long flags;
>>>>> + struct pch_can_priv *priv = netdev_priv(ndev);
>>>>> + struct can_frame *cf = (struct can_frame *)skb->data;
>>>>> + int tx_buffer_avail = 0;
>>>>
>>>> What I'm totally missing is the TX flow controll. Your driver has to
>>>> ensure that the package leave the controller in the order that come
>>>> into the xmit function. Further you have to stop your xmit queue if
>>>> you're out of tx objects and reenable if you have a object free.
>>>>
>>>> Use netif_stop_queue() and netif_wake_queue() for this.
>>>
>>> In this code, I think "out of tx objects" cannot be occurred.
>>
>> It's not a matter of code it's the hardware. You cannot put more than a
>> certain number of CAN frames into the hardware. If you have a CAN bus at
>> a certain speed, you can only send a certain number of CAN frames in a
>> second. So you cannot push more than this amount of frames/s into the
>> hardware.
>>
>>> Nevertheless, are netif_stop_queue() and netif_wake_queue() is necessary ?
>>
>> Yes.
>
> I can' understand your issue.
> Please can you hear my opinion?
>
> Please see the head of pch_xmit.
>
>>> + if (priv->tx_obj == (PCH_OBJ_NUM + 1)) { /* Point tail Obj + 1 */
>>> + while (ioread32(&priv->regs->treq2) & 0xfc00)
>>> + udelay(1);
>
> When points tail of Tx message object,
> this driver waits until completion of all tx messaeg objects.
Looping busy it not an option here.
> Thus, application/driver ought not to be able to put Tx object exceed the number of tx message object.
> Thus I think these code(netif_stop_queue/netif_wake_queue) are completely redundant.
Nope - please remove the waiting completely and convert your flow
control to netif_stop_queue/netif_wake_queue.
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
next prev parent reply other threads:[~2010-11-09 12:59 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <005301cb7ffa$5b63cd90$66f8800a@maildom.okisemi.com>
2010-11-09 12:26 ` [PATCH net-next-2.6 v2] can: Topcliff: PCH_CAN driver: Fix build warnings Tomoya MORINAGA
[not found] ` <00fe01cb8009$62e11410$66f8800a-a06+6cuVnkTSQfdrb5gaxUEOCMrvLtNR@public.gmane.org>
2010-11-09 12:59 ` Marc Kleine-Budde [this message]
2010-11-11 9:56 ` Tomoya MORINAGA
[not found] ` <002501cb8186$b56a6280$66f8800a-a06+6cuVnkTSQfdrb5gaxUEOCMrvLtNR@public.gmane.org>
2010-11-11 10:04 ` Marc Kleine-Budde
[not found] <4CCAA3D4.8070408@dsn.okisemi.com>
[not found] ` <4CCAA3D4.8070408-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org>
2010-10-29 12:57 ` Marc Kleine-Budde
[not found] ` <4CCAC4CD.7000503-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2010-10-29 16:23 ` Marc Kleine-Budde
[not found] ` <4CCAF517.2000409-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2010-10-29 19:32 ` Wolfgang Grandegger
2010-11-01 11:05 ` Marc Kleine-Budde
[not found] ` <4CCE9F0B.1000901-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2010-11-03 16:15 ` Wolfgang Grandegger
2010-11-12 11:10 ` Tomoya MORINAGA
[not found] ` <004a01cb825a$3a8bd060$66f8800a-a06+6cuVnkTSQfdrb5gaxUEOCMrvLtNR@public.gmane.org>
2010-11-12 11:45 ` Wolfgang Grandegger
2010-11-15 7:39 ` Tomoya MORINAGA
2010-11-15 8:39 ` Tomoya MORINAGA
2010-11-02 10:27 ` Tomoya MORINAGA
[not found] ` <001701cb7a78$99e1fe20$66f8800a-a06+6cuVnkTSQfdrb5gaxUEOCMrvLtNR@public.gmane.org>
2010-11-02 11:03 ` Marc Kleine-Budde
2010-11-15 8:41 ` Tomoya MORINAGA
2010-10-29 16:46 ` Oliver Hartkopp
[not found] ` <4CCAFA68.2030903-fJ+pQTUTwRTk1uMJSBkQmQ@public.gmane.org>
2010-10-29 17:58 ` Marc Kleine-Budde
2010-11-09 12:26 ` Tomoya MORINAGA
[not found] ` <00fd01cb8009$5efc5fd0$66f8800a-a06+6cuVnkTSQfdrb5gaxUEOCMrvLtNR@public.gmane.org>
2010-11-09 14:47 ` Marc Kleine-Budde
2010-11-01 7:15 ` Tomoya MORINAGA
2010-10-29 10:37 Tomoya
[not found] <4CC61B1B.3090602@dsn.okisemi.com>
[not found] ` <4CC61B1B.3090602-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org>
2010-10-26 17:52 ` David Miller
[not found] ` <20101026.105206.15244527.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2010-10-26 17:55 ` David Miller
[not found] ` <20101026.105545.200376685.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2010-10-26 18:27 ` Wolfgang Grandegger
[not found] ` <4CC71DA4.3020600-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
2010-10-26 18:52 ` Marc Kleine-Budde
2010-10-27 0:50 ` Tomoya MORINAGA
-- strict thread matches above, loose matches on Subject: below --
2010-10-26 0:04 Tomoya
2010-10-25 2:32 Tomoya
[not found] ` <4CC4EC38.2040208-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org>
2010-10-25 19:14 ` 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=4CD945B4.4060408@pengutronix.de \
--to=mkl-bicnvbalz9megne8c9+irq@public.gmane.org \
--cc=andrew.chih.howe.khor-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=chripell-VaTbYqLCNhc@public.gmane.org \
--cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@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=masa-korg-ECg8zkTtlr0C6LszWs/t0g@public.gmane.org \
--cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=qi.wang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=sameo-VuQAYsv1563Yd54FQh9/CA@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).