All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paarvai Naai <opensource3141@gmail.com>
To: tom_usenet@optusnet.com.au
Cc: linux-can@vger.kernel.org
Subject: Re: Fwd: Querying current tx_queue usage of a SocketCAN interface
Date: Mon, 30 Mar 2015 17:26:24 -0700	[thread overview]
Message-ID: <CAE+ymrvvqL_o3ZTWdq96kQmMe6c3OzqM+SQN3qPpyH1dLMjmrw@mail.gmail.com> (raw)
In-Reply-To: <5519E5A9.7080104@optusnet.com.au>

Hi Tom,

Right, my understanding is that if there is only one client for the
SocketCAN interface, a simple wrapping of the SocketCAN tx_queue with
a qdisc might(?) work.  Need to understand the complexities of qdisc
first though.

If there are multiple clients, there is idneed the priority inversion
problem you mention.  Even if one has a single process designated to
read/write to the interface, managing priority is not fool proof.  A
low priority message could get submitted to the underlying SocketCAN
interface and be unable to go out onto the bus because of other
third-party nodes on the bus sending higher priority traffic at high
frequency.  This would block further messages from going out on the
SocketCAN interfaces, even though they have higher priority, no?

Paarvai


> The whitepaper is "promising". All you have to do is to implement it in your
> drivers to gain the functionality. I don't expect anyone else will any time
> soon.
>
> Otherwise, this looks "promising", but I can't get it to show anything other
> than zero:
>
>   # cat /sys/class/net/can0/queues/tx-0/byte_queue_limits/inflight
>   0
>
> Maybe I need to configure something else in the kernel or make some other
> configuration change to use it. I don't need this, but as you do I'd suggest
> you look at it.
>
> The code that allows access to "inflight" is in:
>
>     drivers/net/core/net-sysfs.c
>
> The definition of "inflight" in that file is:
>
> static ssize_t bql_show_inflight(struct netdev_queue *queue,
>                  struct netdev_queue_attribute *attr,
>                  char *buf)
> {
>     struct dql *dql = &queue->dql;
>
>     return sprintf(buf, "%u\n", dql->num_queued - dql->num_completed);
> }
>
> If you dig around enough through the linux source code you may be able to
> get the queueing to work and be able to use that sysfs variable. The code is
> in /lib/dynamic_queue_limits.c. It seems to be used by
> include/linux/netdevice.h.
>
> That still isn't going to solve your real problem, which (I'm assuming) is
> to try and get multiple senders through the CAN interface to "play nice"
> with each other in an attempt to establish normal ID-based transmission
> priority. That's what the whitepaper is all about.
>
> If you can read the queue depth I'm guessing all of your programs will have
> to queue internally and "promise" not to fill the queue if a higher priority
> ID message (from another thread/process) might need the slot. That's quite a
> change to the interface. If you're going to do that I'd suggest instead that
> you designate one process (or thread as appropriate) that is the only one
> allowed to open the CAN driver for transmission. It implements multiple
> internal priority queues. Have it provide a socket interface for the other
> programs that wish to send and have them all transmit via that process.
>
> Tom
>

  parent reply	other threads:[~2015-03-31  0:26 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAE+ymru296P+LjkT7_ONVc2OGMP9mtXW46Nq5aSnm1etauj9Aw@mail.gmail.com>
2015-03-28 20:26 ` Fwd: Querying current tx_queue usage of a SocketCAN interface Paarvai Naai
2015-03-29 22:42   ` Tom Evans
2015-03-30 21:55     ` Paarvai Naai
     [not found]       ` <5519E5A9.7080104@optusnet.com.au>
2015-03-31  0:26         ` Paarvai Naai [this message]
2015-03-31  3:09           ` Tom Evans
2015-04-01 20:33             ` Paarvai Naai
2015-04-01 20:57               ` Dan Egnor
2015-04-02  2:20                 ` Tom Evans
2015-04-02  2:33                   ` Daniel Egnor
2015-04-01 23:21               ` Tom Evans
2015-04-02  0:33                 ` Dan Egnor
2015-04-02  2:20                   ` Tom Evans
2015-04-02  6:28                     ` Flexcan (was: Re: Fwd: Querying current tx_queue usage of a SocketCAN interface) Marc Kleine-Budde
2015-04-02 11:35                       ` Tom Evans
2015-04-02 12:07                         ` Flexcan Marc Kleine-Budde
2015-04-04  3:32                         ` Flexcan (was: Re: Fwd: Querying current tx_queue usage of a SocketCAN interface) Tom Evans
2015-04-09  8:06                           ` Flexcan Tom Evans
2015-04-10  6:35                             ` Flexcan (was: Re: Fwd: Querying current tx_queue usage of a SocketCAN interface) Tom Evans
2015-04-02 18:23                     ` Fwd: Querying current tx_queue usage of a SocketCAN interface Paarvai Naai
2015-04-02  6:46                   ` Marc Kleine-Budde
2015-04-02 18:28                     ` Paarvai Naai
2015-04-03  1:35                       ` Tom Evans
2015-04-03  6:45                         ` Paarvai Naai
2015-04-03 11:08                           ` Marc Kleine-Budde
2015-04-03 15:24                             ` Paarvai Naai
2015-04-03 20:28                               ` Marc Kleine-Budde
2015-04-03 20:53                                 ` Paarvai Naai
2015-04-04  8:49                                   ` Marc Kleine-Budde
2015-04-06 17:54                                     ` Paarvai Naai

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=CAE+ymrvvqL_o3ZTWdq96kQmMe6c3OzqM+SQN3qPpyH1dLMjmrw@mail.gmail.com \
    --to=opensource3141@gmail.com \
    --cc=linux-can@vger.kernel.org \
    --cc=tom_usenet@optusnet.com.au \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.