Project Home
Project Home
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - driver with multiple interfaces (move from io-net environment to io-pkt with shim): (14 Items)
   
driver with multiple interfaces (move from io-net environment to io-pkt with shim)  
Hi,

I have implemented a BCM switch driver using io-net. When try to port the driver to work with io-pkt-v4, only one 
interface is configured. Would appreciate very much extending help on this.

Details are in the following.

Regards,
Sherry



After driver is activated multiple instances of interfaces is configured.

io-net -d bcm5691 mac=001faaffeedd -p tcpip
If use io-net I got the following
ifconfig
en4: flags=802<BROADCAST,SIMPLEX> mtu 1500
        address: 00:1f:aa:ff:ee:dd
en4-1: flags=802<BROADCAST,SIMPLEX> mtu 1500
        address: 00:1f:aa:ff:ee:f0
.....
en4-11: flags=802<BROADCAST,SIMPLEX> mtu 1500
        address: 00:1f:aa:ff:ee:fb
en4-12: flags=802<BROADCAST,SIMPLEX> mtu 1500
        address: 00:1f:aa:ff:ee:fc


io-pkt-vr4 -d bcm5691 mac=001faaffeedd -p tcpip prefix=/alt
If use the io-pkt,
ifconfig
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 33192
        inet 127.0.0.1 netmask 0xff000000
en0: flags=802<BROADCAST,SIMPLEX> mtu 1500
        address: 00:1f:aa:ff:ee:dd


The bcm driver I implement send one
io_net_msg_dl_advert_t  message with _IO_NET_MSG_DL_ADVERT type
for each interface.

Re: driver with multiple interfaces (move from io-net environment to io-pkt with shim)  
On Thu, Jul 24, 2008 at 01:25:58PM -0400, Sherry Chen wrote:
> Hi,
> 
> I have implemented a BCM switch driver using io-net. When try to port the driver to work with io-pkt-v4, only one 
interface is configured. Would appreciate very much extending help on this.
> 
> Details are in the following.
> 
> Regards,
> Sherry
> 

You should call dev_attach() for each interface.
dev_attach() takes a struct cfattach as one of its args
which it uses to allocate a per instance structure of size
(struct cfattach *)->ca_devsize which it then passes to the
(struct cfattach *)->ca_attach() callout.

So in short make sure struct cfattach is set up correctly
and call dev_attach() for each instance.

-seanb
Re: driver with multiple interfaces (move from io-net environment to io-pkt with shim)  
dev_attach? 
I am using io-net. Do I need to link to io-pkt library for this? Appreciate an example.
Re: driver with multiple interfaces (move from io-net environment to io-pkt with shim)  
On Thu, Jul 24, 2008 at 04:28:37PM -0400, Sherry Chen wrote:
> dev_attach? 
> I am using io-net. Do I need to link to io-pkt library for this? Appreciate an example.

In your original message you said you were trying to port an io-net
driver to io-pkt.  See any of the sys/dev/* or sys/dev_qnx/* drivers
in the networking reopsitory for examples.

Or am I missing something?

-seanb
RE: driver with multiple interfaces (move from io-net environment to io-pkt with shim)  
I'm a little confused as well. Just to re-cap what I think the situation
is...

You currently have an io-net driver.  This driver works with io-net and
all interfaces are created as expected.

You want to use this driver with io-pkt and the shim. (This means that
you aren't modifying the driver and want it to work as is with io-pkt
+shim).  When you start the driver under io-pkt only one interface
appears.

Is that correct?

The interfaces that are being reported by the io-net driver
en4: flags=802<BROADCAST,SIMPLEX> mtu 1500
        address: 00:1f:aa:ff:ee:dd
en4-1: flags=802<BROADCAST,SIMPLEX> mtu 1500
        address: 00:1f:aa:ff:ee:f0
.....
en4-11: flags=802<BROADCAST,SIMPLEX> mtu 1500
        address: 00:1f:aa:ff:ee:fb
en4-12: flags=802<BROADCAST,SIMPLEX> mtu 1500
        address: 00:1f:aa:ff:ee:fc

are very strange.  This doesn't seem to be a standard implementation
(I'd expect to see en4, en5, en6, etc.)  Why is this?


The other thing is that I see that you have the "prefix=/alt" tcpip
option,
Just to confirm, are you running ifconfig against the prefix as well
+
SOCK=/alt ifconfig?




	Robert.

-----Original Message-----
From: Sherry Chen [mailto:schen@taseon.com] 
Sent: Thursday, July 24, 2008 4:29 PM
To: drivers-networking
Subject: Re: driver with multiple interfaces (move from io-net
environment to io-pkt with shim)

dev_attach? 
I am using io-net. Do I need to link to io-pkt library for this?
Appreciate an example.

_______________________________________________
Networking Drivers
http://community.qnx.com/sf/go/post11015
Re: RE: driver with multiple interfaces (move from io-net environment to io-pkt with shim)  
Sorry that I stated my problem wrong. You are right, I used io-pkt+shim.
I created the en4-1... en4-12 interface names and passed the name when I send the advertise message for each interface.
export SOCK env variable when I invoke ifconfig.
I tried SOCK=/alt just now. The result is the same.

Sherry


> I'm a little confused as well. Just to re-cap what I think the situation
> is...
> 
> You currently have an io-net driver.  This driver works with io-net and
> all interfaces are created as expected.
> 
> You want to use this driver with io-pkt and the shim. (This means that
> you aren't modifying the driver and want it to work as is with io-pkt
> +shim).  When you start the driver under io-pkt only one interface
> appears.
> 
> Is that correct?
> 
> The interfaces that are being reported by the io-net driver
> en4: flags=802<BROADCAST,SIMPLEX> mtu 1500
>         address: 00:1f:aa:ff:ee:dd
> en4-1: flags=802<BROADCAST,SIMPLEX> mtu 1500
>         address: 00:1f:aa:ff:ee:f0
> .....
> en4-11: flags=802<BROADCAST,SIMPLEX> mtu 1500
>         address: 00:1f:aa:ff:ee:fb
> en4-12: flags=802<BROADCAST,SIMPLEX> mtu 1500
>         address: 00:1f:aa:ff:ee:fc
> 
> are very strange.  This doesn't seem to be a standard implementation
> (I'd expect to see en4, en5, en6, etc.)  Why is this?
> 
> 
> The other thing is that I see that you have the "prefix=/alt" tcpip
> option,
> Just to confirm, are you running ifconfig against the prefix as well
> +
> SOCK=/alt ifconfig?
> 
> 
> 
> 
> 	Robert.
> 
> -----Original Message-----
> From: Sherry Chen [mailto:schen@taseon.com] 
> Sent: Thursday, July 24, 2008 4:29 PM
> To: drivers-networking
> Subject: Re: driver with multiple interfaces (move from io-net
> environment to io-pkt with shim)
> 
> dev_attach? 
> I am using io-net. Do I need to link to io-pkt library for this?
> Appreciate an example.
> 
> _______________________________________________
> Networking Drivers
> http://community.qnx.com/sf/go/post11015


Re: RE: driver with multiple interfaces (move from io-net environment to io-pkt with shim)  
On Thu, Jul 24, 2008 at 04:46:07PM -0400, Sherry Chen wrote:
> Sorry that I stated my problem wrong. You are right, I used io-pkt+shim.
> I created the en4-1... en4-12 interface names and passed the name when I send the advertise message for each interface
.
> export SOCK env variable when I invoke ifconfig.
> I tried SOCK=/alt just now. The result is the same.

There's a check in the shim's (io_net_self_t *)->reg() callout
that the registrant's (io_net_registrant_t *)->top_type is
"en".  If you check the return code from the reg callout you'll
probably see that it's failing.  The shim only supports ethernet
("en") devices so that's probably your mininal porting effort.

-seanb
Re: RE: driver with multiple interfaces (move from io-net environment to io-pkt with shim)  
> On Thu, Jul 24, 2008 at 04:46:07PM -0400, Sherry Chen wrote:
> > Sorry that I stated my problem wrong. You are right, I used io-pkt+shim.
> > I created the en4-1... en4-12 interface names and passed the name when I 
> send the advertise message for each interface.
> > export SOCK env variable when I invoke ifconfig.
> > I tried SOCK=/alt just now. The result is the same.
> 
> There's a check in the shim's (io_net_self_t *)->reg() callout
> that the registrant's (io_net_registrant_t *)->top_type is
> "en".  If you check the return code from the reg callout you'll
> probably see that it's failing.  The shim only supports ethernet
> ("en") devices so that's probably your mininal porting effort.
> 
> -seanb

I checked my code that top_type is "en". I have trouble using the debugger, the code break in code in my devn_bcm5681.so
 but not devnp-shim.so.

I traced the code with io-pkt-v4 to the point when devnp-shim is loaded. 
(i.e. nw_dl.c 	hdl = nw_dlopen(IONET_SHIM_NAME,
			  RTLD_WORLD | RTLD_GROUP);
However, the code will not step into shim area.
(i.e.	nw_dl.c	ret = (*dentry->drvr_init)(hdl, iopkt, string);
)

I have trouble using the debugger  with sharedlibrary for long time. The debugger sometime will break for me and 
sometime will not. 

Do not know how to reset the debugger to start scratch.




RE: RE: driver with multiple interfaces (move from io-net environment to io-pkt with shim)  
From: Sherry Chen [mailto:schen@taseon.com] 

> I used io-pkt+shim. 

Looking at the source to the shim, you should
call the ion->reg() function for EACH of your
interfaces.  Are you calling it just once?

--
aboyd
Re: RE: RE: driver with multiple interfaces (move from io-net environment to io-pkt with shim)  
> 
> From: Sherry Chen [mailto:schen@taseon.com] 
> 
> > I used io-pkt+shim. 
> 
> Looking at the source to the shim, you should
> call the ion->reg() function for EACH of your
> interfaces.  Are you calling it just once?
> 
> --
> aboyd


I called ion->reg only once for the BCM5691 device, And I invoke ion->tx_up for every port on the BCM5691 device (i.e. 
13 times).

bcm5690->ion->tx_up(bcm5690->reghdl, npkt, 0, 0, bcm5690->cell, bcm5690->endpoint, i)

where npkt sends  io_net_msg_dl_advert_t *ap message.


Do I need to call ion->reg for each port for io-pkt?

Sherry
RE: RE: RE: driver with multiple interfaces (move from io-net environment to io-pkt with shim)  
From: Sherry Chen [mailto:community-noreply@qnx.com] 

> I called ion->reg only once for the BCM5691 device

I don't think that's going to work with io-pkt

> Do I need to call ion->reg for each port for io-pkt?

Yup!

--
aboyd
Re: RE: RE: RE: driver with multiple interfaces (move from io-net environment to io-pkt with shim)  
> From: Sherry Chen [mailto:community-noreply@qnx.com] 
> 
> > I called ion->reg only once for the BCM5691 device
> 
> I don't think that's going to work with io-pkt
> 
> > Do I need to call ion->reg for each port for io-pkt?
> 
> Yup!
> 
> --
> aboyd


Thanks very much, I shall give it a try.

Sherry
Re: RE: driver with multiple interfaces (move from io-net environment to io-pkt with shim)  
ll
Re: driver with multiple interfaces (move from io-net environment to io-pkt with shim)  
> dev_attach? 
> I am using io-net. Do I need to link to io-pkt library for this? Appreciate an
>  example.


Sorry, my question was not clear. I try to use io-pkt through shim. Is there a way to make it work?