|
IO-PKT send a packet on startup.
|
02/15/2010 6:15 AM
post47301
|
IO-PKT send a packet on startup.
Hey
When I starting io-pkt-v4-hc with my mpc85xx driver.
I see i nicinfo that one packet has been send.
The package is a ARP packet. Is it possible to disable the driver or stack so it's not sending this frame?
I had attached the slogger log.
|
|
|
|
Re: IO-PKT send a packet on startup.
|
02/16/2010 8:57 AM
post47364
|
Re: IO-PKT send a packet on startup.
On 15/02/10 06:15 AM, Lasse Skov wrote:
> Hey
>
> When I starting io-pkt-v4-hc with my mpc85xx driver.
> I see i nicinfo that one packet has been send.
>
> The package is a ARP packet. Is it possible to disable the driver or stack so it's not sending this frame?
>
What ARP packet is being sent? Is it a gratuitous ARP?
/P
|
|
|
|
RE: IO-PKT send a packet on startup.
|
02/16/2010 9:43 AM
post47379
|
RE: IO-PKT send a packet on startup.
> Is it a gratuitous ARP?
Almost certainly. I think he wants to turn off
the initial gratuitous ARP when the TCP/IP stack
starts. I'm not sure that's configurable from
the command line.
--
aboyd
|
|
|
|
Re: IO-PKT send a packet on startup.
|
02/16/2010 10:24 AM
post47393
|
Re: IO-PKT send a packet on startup.
>> Is it a gratuitous ARP?
>>
> Almost certainly. I think he wants to turn off
> the initial gratuitous ARP when the TCP/IP stack
> starts.
There's a gratuitous ARP when the IP address is configured on an interface.
> I'm not sure that's configurable from
> the command line.
>
It is not configurable AFAIK.
/P
|
|
|
|
Re: IO-PKT send a packet on startup.
|
02/16/2010 10:46 AM
post47402
|
Re: IO-PKT send a packet on startup.
Hmmmm... okay..
Could i disable this in the io-pkt stack on my own?
And if where?
/LSkov
|
|
|
|
Re: IO-PKT send a packet on startup.
|
02/16/2010 10:49 AM
post47404
|
Re: IO-PKT send a packet on startup.
On 16/02/10 10:46 AM, Lasse Skov wrote:
> Hmmmm... okay..
>
> Could i disable this in the io-pkt stack on my own?
> And if where?
>
You should probably look at sys/netinet/if_arp.c arp_ifinit().
At your own risk of course :-)
/P
|
|
|
|
Re: IO-PKT send a packet on startup.
|
02/16/2010 11:42 AM
post47419
|
Re: IO-PKT send a packet on startup.
Thanks...
I see that this arp packet only sendt if the IPAddress is not zero.
So I tried to set the ip to null and now the tsec controller is not send any packages out.
This is good enough for testing my hardware.
If I download hole the core networking and from the foundry, and try to build it i also got a error.
Is there some special things I need to do before i try to build it on my XP machine?
/LSkov
|
|
|
|
Re: IO-PKT send a packet on startup.
|
02/16/2010 12:03 PM
post47423
|
Re: IO-PKT send a packet on startup.
On 16/02/10 11:42 AM, Lasse Skov wrote:
> Thanks...
>
> I see that this arp packet only sendt if the IPAddress is not zero.
>
> So I tried to set the ip to null and now the tsec controller is not send any packages out.
> This is good enough for testing my hardware.
>
Ok, great. Yes, as I wrote before "There's a gratuitous ARP when the IP
address is configured on an interface." so if you assign NULL then it
won't be sent.
> If I download hole the core networking and from the foundry, and try to build it i also got a error.
> Is there some special things I need to do before i try to build it on my XP machine?
>
Have a look at the builds forum for the latest and greatest on that.
Lycka till! ;-)
/P
|
|
|
|
Re: RE: IO-PKT send a packet on startup.
|
02/16/2010 10:42 AM
post47400
|
Re: RE: IO-PKT send a packet on startup.
Are you aware of whether it is possible to disable it somehow?
Another thing is that I can see that some data has been send on both controllers.
This is monitored in nicinfo.
But if I set a computer on the tsec0 controller and monitor the data with a tcpdump I cant monitor anything.
How can this be possible?
Anyone have an idea why this package does not come out through the PHY, and into the contorller?
/LSkov
|
|
|
|
Re: IO-PKT send a packet on startup.
|
02/16/2010 10:46 AM
post47401
|
Re: IO-PKT send a packet on startup.
On 16/02/10 10:42 AM, Lasse Skov wrote:
> Are you aware of whether it is possible to disable it somehow?
>
Not without code changes in the stack.
Or, perhaps some clever default pf rules might work. Just an idea, I
haven't tried it. And maybe pf is not feasible for your situation anyways.
/P
|
|
|
|
RE: RE: IO-PKT send a packet on startup.
|
02/16/2010 10:46 AM
post47403
|
RE: RE: IO-PKT send a packet on startup.
> whether it is possible to disable it somehow?
The source to the stack is on the foundry, so if you
want something different than standard ARP, you can
modify it to do whatever you want.
> why this package does not come out through the PHY
Possibly the link auto-negotiation had not yet completed?
We have seen this before - with DHCP and another driver.
--
aboyd
|
|
|
|
Re: RE: RE: IO-PKT send a packet on startup.
|
02/16/2010 1:24 PM
post47438
|
Re: RE: RE: IO-PKT send a packet on startup.
I am seeing this on a driver I am currently trying to do, it seems it is related to auto-negotiation not completed. One
thing I am clear is that if the auto-negotiation is not complete, the interface should be in LINK_DOWN state, why the
stack is still sending packets down?
|
|
|
|
RE: RE: RE: IO-PKT send a packet on startup.
|
02/16/2010 1:34 PM
post47441
|
RE: RE: RE: IO-PKT send a packet on startup.
What I was referring to is when the hardware reports
that the link is up - fooling the software - but it
really isn't ... transmissions immediately after the
link up are lost, but if you wait a couple more seconds
after the auto-negotiation has supposedly completed,
then the packets tx works successfully.
--
aboyd
|
|
|
|
Re: RE: RE: RE: IO-PKT send a packet on startup.
|
02/16/2010 3:44 PM
post47452
|
Re: RE: RE: RE: IO-PKT send a packet on startup.
It's not the hardware reporting the link up,
after I do a 'dhcp.client'
The driver's ioctl call is called, which is a SIOCSIFADDR, and goes to
ether_ioctl call, since the driver is not handerling it. By looking at the ether_ioctl call implementation,
case SIOCSIFADDR:
1684 ifp->if_flags |= IFF_UP;
Then it call the if_init
default:
1713 if ((ifp->if_flags & IFF_RUNNING) == 0)
1714 error = (*ifp->if_init)(ifp);
1715 break;
This is where it flip the IFF_UP bit? Is this expected? At that time of course the Link is not UP. Do I need to do
something extra to explicitly clear the IFF_UP bit in the init call? I've checked few drivers, don't seem to see this
being cleared in init call. Am I miss something?
|
|
|
|
RE: RE: RE: RE: IO-PKT send a packet on startup.
|
02/16/2010 3:56 PM
post47456
|
RE: RE: RE: RE: IO-PKT send a packet on startup.
If you look at the end of any devnp driver _init()
function, you will see it set the IFF_RUNNING flag,
which is how it communicates to the stack that it's
up.
However, given that the PHY has just been reset in
the phy init function just above, that almost certainly
restarts the auto-negotiation which is going to take
2 or 3 seconds to complete.
If you look at the ep93xx driver (which I wrote not
too long ago) I tried to address this in the _start
transmit packet function:
http://svn.ott.qnx.com/view/product/trunk/lib/io-pkt/sys/dev_qnx/ep93xx/
transmit.c?revision=234104&view=markup
If the IFF_RUNNING flag wasn't set, or the NIC_FLAG_LINK_DOWN
bit was set in the (legacy) cfg->flags, no transmission of
packets was attempted - the packet was left queued.
--
aboyd
|
|
|
|
Re: RE: RE: RE: IO-PKT send a packet on startup.
|
02/16/2010 4:00 PM
post47458
|
Re: RE: RE: RE: IO-PKT send a packet on startup.
There isn't a clear concensus as to whether
or not IFF_RUNNING means the link is up
or not.
-seanb
On Tue, Feb 16, 2010 at 03:56:06PM -0500, Andrew Boyd wrote:
>
> If you look at the end of any devnp driver _init()
> function, you will see it set the IFF_RUNNING flag,
> which is how it communicates to the stack that it's
> up.
>
> However, given that the PHY has just been reset in
> the phy init function just above, that almost certainly
> restarts the auto-negotiation which is going to take
> 2 or 3 seconds to complete.
>
> If you look at the ep93xx driver (which I wrote not
> too long ago) I tried to address this in the _start
> transmit packet function:
>
> http://svn.ott.qnx.com/view/product/trunk/lib/io-pkt/sys/dev_qnx/ep93xx/
> transmit.c?revision=234104&view=markup
>
> If the IFF_RUNNING flag wasn't set, or the NIC_FLAG_LINK_DOWN
> bit was set in the (legacy) cfg->flags, no transmission of
> packets was attempted - the packet was left queued.
>
> --
> aboyd
>
>
>
>
> _______________________________________________
>
> Networking Drivers
> http://community.qnx.com/sf/go/post47456
>
|
|
|
|
RE: RE: RE: RE: IO-PKT send a packet on startup.
|
02/16/2010 4:08 PM
post47460
|
RE: RE: RE: RE: IO-PKT send a packet on startup.
> whether or not IFF_RUNNING means the link is up or not.
The if_up utility can get that information with the "-l"
option. Note that all of the devnp (io-pkt) drivers
have bsd_media.c support for link media via ifconfig -v
which uses the driver ioctl to get/set link state.
--
aboyd
|
|
|
|
Re: IO-PKT send a packet on startup.
|
02/17/2010 12:59 PM
post47548
|
Re: IO-PKT send a packet on startup.
>> whether or not IFF_RUNNING means the link is up or not.
>>
> The if_up utility can get that information with the "-l"
> option. Note that all of the devnp (io-pkt) drivers
> have bsd_media.c support for link media via ifconfig -v
> which uses the driver ioctl to get/set link state.
>
>
That can help a script to launch the DHCP client only after link is up.
But it doesn't help stack internals (like DAD, see my other email) and
it doesn't help at all if if_up uses routing sockets to implement '-l'
(because routing socket link state may bounce several times, se y other
email).
/P
|
|
|
|
RE: IO-PKT send a packet on startup.
|
02/17/2010 1:20 PM
post47560
|
RE: IO-PKT send a packet on startup.
> > The if_up utility can get that information
> > with the "-l" option.
>
> launch the DHCP client only after link is up.
I might mention that the shim supports the
SIOCGIFMEDIA ioctl, hence "ifup -l en0"
should work even with io-net drivers, in
addition to the native devnp io-pkt drivers.
--
aboyd
|
|
|
|
Re: IO-PKT send a packet on startup.
|
02/17/2010 2:28 PM
post47581
|
Re: IO-PKT send a packet on startup.
>>> The if_up utility can get that information
>>> with the "-l" option.
>>>
>> launch the DHCP client only after link is up.
>>
> I might mention that the shim supports the
> SIOCGIFMEDIA ioctl, hence "ifup -l en0"
> should work even with io-net drivers, in
> addition to the native devnp io-pkt drivers.
>
AFAIK that state flip/flops together with if_link_state_change().
/P
|
|
|
|
RE: IO-PKT send a packet on startup.
|
02/17/2010 2:37 PM
post47582
|
RE: IO-PKT send a packet on startup.
|
|
|
|
Re: IO-PKT send a packet on startup.
|
02/17/2010 3:00 PM
post47583
|
Re: IO-PKT send a packet on startup.
I am an electrical engineer after all :-)
This isn't what we're talking about here though. We're talking about
auto-negotiation (a protocol) coming to a concluding state and the link
layer informing the stack about it being done (not prematurely doing it
at each state it transitions through along the way).
/P
|
|
|
|
RE: IO-PKT send a packet on startup.
|
02/18/2010 4:31 AM
post47626
|
RE: IO-PKT send a packet on startup.
Hi Guys,
I just cudnt stop myself jumping in :-)
AFAIK, only completing autoneg wouldn't be sufficient in this case.
MAC settings needs to be adjusted according to PHY autonegotiation
results, otherwise MAC and PHY would work in mismatch scenario.
In MPC85XX family (should be the case with others as well), this is
beautifully handled by _speeduplex() functions (One 'd' is missing
here), which are invoked by MDIO library after completing autoneg or
link speed changes.
I think the safest would be to enable transmission of packets from stack
only after this function has been called for the first time.
BR,
Akash Goswami
-----Original Message-----
From: Patrik Lahti [mailto:community-noreply@qnx.com]
Sent: Thursday, February 18, 2010 1:30 AM
To: drivers-networking
Subject: Re: IO-PKT send a packet on startup.
I am an electrical engineer after all :-)
This isn't what we're talking about here though. We're talking about
auto-negotiation (a protocol) coming to a concluding state and the link
layer informing the stack about it being done (not prematurely doing it
at each state it transitions through along the way).
/P
_______________________________________________
Networking Drivers
http://community.qnx.com/sf/go/post47583
|
|
|
|
RE: IO-PKT send a packet on startup.
|
02/18/2010 9:10 AM
post47652
|
RE: IO-PKT send a packet on startup.
> enable transmission of packets from stack only after
> this (MDI callback) function has been called for the
> first time
If you look at some nicinfo output with the driver
verbose, quite often you will see the link go up,
then down again, then up again.
Your solution would enable tx after the first link
up, which unfortunately would allow tx while the
link was down.
You probably would want to enable tx after the
last link up.
PS This binary up/down behaviour is not to be
referred to as "bouncing" :)
--
aboyd
|
|
|
|
Re: IO-PKT send a packet on startup.
|
02/18/2010 10:30 AM
post47668
|
Re: IO-PKT send a packet on startup.
On 18/02/10 04:31 AM, Akash Goswami wrote:
> Hi Guys,
>
> I just cudnt stop myself jumping in :-)
>
Thanks for jumping in :-)
> AFAIK, only completing autoneg wouldn't be sufficient in this case.
> settings needs to be adjusted according to PHY autonegotiation
> results,
Just so we're on the same page with terminology. I would include all
that as part the definition of autoneg being "concluded". I.e. the link
is operational - ready - everything has been set up for stack to start
using it.
/P
|
|
|
|
Re: IO-PKT send a packet on startup.
|
02/17/2010 12:57 PM
post47547
|
Re: IO-PKT send a packet on startup.
On 16/02/10 03:56 PM, Andrew Boyd wrote:
> If you look at the end of any devnp driver _init()
> function, you will see it set the IFF_RUNNING flag,
> which is how it communicates to the stack that it's
> up.
>
What Sean said. "There isn't a clear concensus as to whether or not
IFF_RUNNING means the link is up or not."
Herein lies the problem IMHO. The stack uses IFF_RUNNING & IFF_UP to
determine that the link is operational. Otherwise it'll return ENETDOWN.
And the stack and the apps are designed to handle that error code (at
least where I've looked). Once, that test passes, the packet is enqueued
and there's no error code coming back (there can't be because it's a
queue and transmission is asynchronous from that point forward).
There is also the if_link_state_change() mechanism (which is currently
used to trigger routing sockets). Unfortunately it flip-flops
LINK_STATE_UP/DOWN during the autonegotiation, and there isn't just ONE
final "I'm done now" from the driver. Also, this mechanism would be
asynchronous to the packet transmission. So there is nothing in the
stack that is hooked into it and utilizing it requires more work.
The stack really needs to know when an interface is ready to function
(has completed all initialization including autonegotiation). Because,
although IP/Ethernet is unreliable by nature, as things start up stack
(and some apps like DHCP) that needs to start their work as soon as the
link is ready (and has normal drop probabilities).
I.e. this should really be synchronized better. What can we do to make
it so?
The best option IMHO is for driver to set IFF_RUNNING only once link has
been stabilized as completely operational. Then the stack and apps would
"just work" because they're designed to handle ENETDOWN. It also follows
the intention of the NetBSD stack which we're following with the stack.
The driver is the best way to do this because only it has knowledge of
what's going on re autoneg.
> If the IFF_RUNNING flag wasn't set, or the NIC_FLAG_LINK_DOWN
> bit was set in the (legacy) cfg->flags, no transmission of
> packets was attempted - the packet was left queued.
>
Queuing the packet is certainly better.
Problem is that this is just one driver doing that. Not all of our
drivers. And not all of customer's know that they should do this. (Do
the BSD drivers do this?)
Unfortunately this can also mean that the packets are severely delayed.
While I believe this is ok for most packets, a minority will have
problems because they have timing constraints.
E.g. if an IPv6 address is assigned it'll be subject to Duplicate
Address Detection (DAD). And the stack sends Neighbor Solicitations
(NSs) to see if any other node has the same address configured. It then
waits a few seconds, giving the other nodes a chance to respond. If the
packet is queued during that time, because as you say autoneg can take a
few seconds, then the other nodes may not get a chance to respond at
all! Or, equally bad, the link goes up, driver sends out the NS packet,
autoneg brings link down, other node responds, but it doesn't get
received because link is down!
The consequences are severe because DAD is mandatory and pretty critical
for IPv6 operation. There is a similar mechanism in IPv4, using ARP
probes which would have the same problems. Although it isn't mandatory
in IPv4 so the consequences may be lesser.
Out of all the packets that most commonly will be sent during the time
when Ethernet autonegotiation is in progress the IPv4/IPv6 DAD is
probably the only example which is time critical. Anybody know of others?
Maybe we could somehow special case the ones that are?
/P
|
|
|
|
Re: IO-PKT send a packet on startup.
|
02/23/2010 9:17 AM
post47989
|
Re: IO-PKT send a packet on startup.
I agree with Patrick, setting IFF_RUNNING after the link is really a UP state might be a better idea. But are we sure
the stack will not sending pkt down if IFF_RUNNING is not set. Is there any other side effect. Since I don't see any
driver is doing this way, not sure if there is any side effects.
|
|
|
|
Re: IO-PKT send a packet on startup.
|
02/23/2010 10:34 AM
post48008
|
Re: IO-PKT send a packet on startup.
On 23/02/10 09:17 AM, Lichun Zhu wrote:
> I agree with Patrick, setting IFF_RUNNING after the link is really a UP state might be a better idea. But are we sure
the stack will not sending pkt down if IFF_RUNNING is not set. Is there any other side effect. Since I don't see any
driver is doing this way, not sure if there is any side effects.
>
>
Thanks for the vote :-)
Regarding side effects. The stack is designed to look at IFF_RUNNING.
There are side effects, but the stack is designed to handle them. I.e.
stack will return ENETDOWN if it's not set and drop the packet (ie. apps
will learn the real state of affairs of IFF_RUNNING is set properly,
that's the intent of ENETDOWN!) and stack will retry for internal
mechanisms like DAD.
(of course, there may be bugs, but that's life, and it'll still behave a
lot better than things are today where nobody knows the real operational
state of the link)
Can always look at the occurrences of IFF_RUNNING in the code.
Hope this clarifies...
Cheers!
/P
|
|
|
|
RE: IO-PKT send a packet on startup.
|
02/23/2010 10:59 AM
post48020
|
RE: IO-PKT send a packet on startup.
The driver is free to set IFF_RUNNING whenever it sees
fit during initialization, AFAIK.
Most people aren't quite this sensitive to the behaviour
in the first couple of seconds - either way, the packet
isn't going to get transmitted, all you can really do
is either delay it or drop it, and either is ok with
the driver.
--
aboyd
|
|
|
|
Re: IO-PKT send a packet on startup.
|
02/23/2010 11:33 AM
post48030
|
Re: IO-PKT send a packet on startup.
On 23/02/10 11:00 AM, Andrew Boyd wrote:
> The driver is free to set IFF_RUNNING whenever it sees
> fit during initialization, AFAIK.
>
This is where the contention lies. The stack expects IFF_RUNNING to be
set ONLY when the link is operational.
See e.g. if_ethersubr.c:ether_output()
if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING))
senderr(ENETDOWN);
> Most people aren't quite this sensitive to the behaviour
> in the first couple of seconds
The apps that *are* sensitive are usually quite important for the
interface's operation, like getting an IP address (DHCP, autoip) or
verifying that the address is unique (DAD). All critical because without
a unique IP address IP cannot function.
> either way, the packet
> isn't going to get transmitted, all you can really do
> is either delay it or drop it, and either is ok with
> the driver.
>
Delaying is not ok for reasons I outlined earlier.
Yes, the packet needs to be dropped. This is fine, as long as the app is
informed of that with an error so it can retry.
If the IFF_RUNNING flag is not set, then the stack drops the packet and
returns ENETDOWN to the app. Otherwise it enqueues the packet. And then
when the driver goes to transmit the packet, it's asynchronous, so if
the driver then drops the packet then there is nowhere to return an error...
/P
|
|
|
|
RE: IO-PKT send a packet on startup.
|
02/23/2010 1:09 PM
post48051
|
RE: IO-PKT send a packet on startup.
> Yes, the packet needs to be dropped.
> This is fine, as long as the app is
> informed of that with an error so it
> can retry.
I agree that it might be somewhat nicer
behaviour of the driver to set IFF_RUNNING
later.
However, I'm not sure that an application
can really rely on returned error codes to
detect packet loss :)
--
aboyd
|
|
|
|
Re: IO-PKT send a packet on startup.
|
02/23/2010 2:38 PM
post48083
|
Re: IO-PKT send a packet on startup.
On 23/02/10 01:09 PM, Andrew Boyd wrote:
>
>> Yes, the packet needs to be dropped.
>> This is fine, as long as the app is
>> informed of that with an error so it
>> can retry.
>>
> I agree that it might be somewhat nicer
> behaviour of the driver to set IFF_RUNNING
> later.
>
I wouldn't use the word "nicer" :-) As has been exemplified in this
thread, there are critical mechanisms that rely link state being
properly reported. From what I've seen so far setting IFF_RUNNING
appropriate is the way to accomplish this.
> However, I'm not sure that an application
> can really rely on returned error codes to
> detect packet loss :)
>
Obviously not all packet loss can be detected. But within the scope of
the stack, when it is *known* that a packet will get dropped then an
error should be returned.
We don't want one hand not knowing what the other is doing...
/P
|
|
|
|
Re: RE: RE: IO-PKT send a packet on startup.
|
02/16/2010 1:34 PM
post47442
|
Re: RE: RE: IO-PKT send a packet on startup.
>>I am clear is that
Should say ''not clear"
|
|
|
|