devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Andreas Larsson <andreas@gaisler.com>
Cc: linux-can@vger.kernel.org, software@gaisler.com,
	Wolfgang Grandegger <wg@grandegger.com>,
	devicetree-discuss@lists.ozlabs.org
Subject: Re: [PATCH v8] can: grcan: Add device driver for GRCAN and GRHCAN cores
Date: Wed, 14 Nov 2012 16:12:27 +0100	[thread overview]
Message-ID: <50A3B4DB.40502@pengutronix.de> (raw)
In-Reply-To: <50A3B3AD.5080507@gaisler.com>

[-- Attachment #1: Type: text/plain, Size: 2484 bytes --]

On 11/14/2012 04:07 PM, Andreas Larsson wrote:
> On 2012-11-14 12:22, Marc Kleine-Budde wrote:
>> On 11/14/2012 12:02 PM, Andreas Larsson wrote:
>>> On 2012-11-14 09:43, Marc Kleine-Budde wrote:
>>>> Handle incoming events (rx or tx-complete) until:
>>>> a) number of handled events == budget
>>>> or
>>>> b) no more events pending.
>>>>
>>>>      while (work_done < budget && interrupts_pending()) {
>>>>          work_done += handle_rx(budget - work_done);
>>>>          work_done += handle_tx(budget - work_done);
>>>>      }
>>>
>>> That could starve handle_tx completely though under high rx pressure,
>>> but I can prevent that by making sure that half of the budget is held
>>> back in the first call to handle_rx.
>>
>> What about making the budget big enough to handle both rx and tx in one
>> napi call. Have a look at the marvell driver [1] for inspiration.
> 
> Even if I set the budget to something large, unless I limit the rx side
> in some way it could go on multiple rounds around the circular buffer
> until it have used all the budget. So in some way or another,
> grcan_receive must be hindered from using all the budget.
> 
> Sorry, but I am not sure what aspect of the marvell driver poll handling
> you want me to mimic. Without having analyzed exactly how the queueing
> works yet, it seems to make sure that every function that is called from
> the poll function gets ample opportunity to do work by not letting one
> function hogging all the budget. If you want me to mimic it in the
> aspect of doing work in series of 16 or something like that, sure, no
> problem. If it is something else you want to point to, please let me
> know what.
> 
> 
> The simplest way to make sure that both tx and rx gets to run is to take
> inspiration from the ethoc driver [1] and just let the tx side get just
> as much budget as the rx side and be done with it. With the echo frames
> for can, the budget should be halved for each I guess to make sure no
> more frames are delivered than the budget, but apart from that I don't
> see the problem with such a simple approach.

Good point, if there already is an implementation, do it that way.

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 #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 259 bytes --]

  reply	other threads:[~2012-11-14 15:12 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <5076999F.6070302@pengutronix.de>
2012-10-23  9:57 ` [PATCH v2] can: grcan: Add device driver for GRCAN and GRHCAN cores Andreas Larsson
2012-10-23 16:26   ` Wolfgang Grandegger
2012-10-24 13:31     ` Andreas Larsson
2012-10-30  9:06       ` [PATCH v3] " Andreas Larsson
2012-10-30 10:07         ` Wolfgang Grandegger
2012-10-30 16:24           ` Andreas Larsson
2012-10-31 12:51             ` Wolfgang Grandegger
2012-10-31 16:33               ` Andreas Larsson
2012-10-31 16:39                 ` [PATCH v4] " Andreas Larsson
2012-10-31 20:21                 ` [PATCH v3] " Wolfgang Grandegger
2012-11-01 16:08                   ` Andreas Larsson
2012-11-02 14:23                     ` [PATCH v5] " Andreas Larsson
2012-11-05  9:28                     ` [PATCH v3] " Wolfgang Grandegger
2012-11-07  7:32                       ` Andreas Larsson
2012-11-07 11:15                         ` Wolfgang Grandegger
2012-11-07 12:55                           ` Andreas Larsson
2012-11-07 15:20                             ` [PATCH v6] " Andreas Larsson
2012-11-08  8:29                               ` Wolfgang Grandegger
2012-11-08  9:27                                 ` Marc Kleine-Budde
2012-11-08 10:37                                   ` Andreas Larsson
     [not found]                                   ` <509B7B1E.5040509-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2012-11-08 13:10                                     ` [PATCH v7] " Andreas Larsson
2012-11-09  0:01                                       ` Marc Kleine-Budde
2012-11-12 14:57                                         ` [PATCH v8] " Andreas Larsson
2012-11-13 21:15                                           ` Marc Kleine-Budde
2012-11-14  7:50                                             ` Andreas Larsson
2012-11-14  8:43                                               ` Marc Kleine-Budde
2012-11-14 11:02                                                 ` Andreas Larsson
2012-11-14 11:22                                                   ` Marc Kleine-Budde
2012-11-14 15:07                                                     ` Andreas Larsson
2012-11-14 15:12                                                       ` Marc Kleine-Budde [this message]
2012-11-15  7:47                                                         ` [PATCH v9] " Andreas Larsson
2012-11-15 20:32                                                           ` Marc Kleine-Budde
2012-11-16  6:17                                                             ` Andreas Larsson
2012-11-08 10:33                                 ` [PATCH v6] " Andreas Larsson
2012-10-30  9:29       ` [PATCH v2] " Wolfgang Grandegger

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=50A3B4DB.40502@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=andreas@gaisler.com \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=linux-can@vger.kernel.org \
    --cc=software@gaisler.com \
    --cc=wg@grandegger.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).