lkml.org 
[lkml]   [2010]   [Sep]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 03/10] RapidIO: Use stored ingress port number instead of register read
Hi Alex,

Bounine, Alexandre wrote:
> struct rio_dev {
> struct list_head global_list;
> struct list_head net_list;
> .....
> ..... rest of rio_dev
> .....
> struct rio_switch switch[0];
> }

It makes sense to let rio_dev structures point to the switch they are
attached to. That can be useful in various situations, but is not
possible with this setup.

If a rio_dev is a switch then rdev->rswitch->rdev == rdev holds.

> This will remove extra memory allocation, remove overlapping structure
> members and clean code sections like one shown below:
>
> u8 hopcount = 0xff;
> u16 destid = rdev->destid;
>
> if (rdev->rswitch) {
> destid = rdev->rswitch->destid;
> hopcount = rdev->rswitch->hopcount;
> }

Note that it is possible for rdev->destid to differ from
rdev->rswitch->destid even if rswitch->rdev == rdev (for non-hosts i.e.
agents). rswitch->destid is the destid by which we discovered the switch
(and can reach it) but rdev->destid is the actual id given to the switch.

Micha


\
 
 \ /
  Last update: 2010-09-20 22:43    [W:0.100 / U:0.536 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site