EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

Ethernet causing reboot

Started by seecwriter May 8, 2013
I have another Ethernet issue on an RCM6750. I power up the module with an Ethernet cable attached, it powers up fine. I then unplug the Ethernet cable, my app correctly detects the disconnected cable and brings Ethernet down. When the cable is plugged back in, the Net.Lib crashes and the module reboots.

Here is what I do:

void CheckCable()
if ( !pd_havelink( IF_ETH0 ) ) {
if (ifpending( IF_ETH0 )==IF_UP)
ifdown(IF_ETH0);
}
else {
if (ifpending( IF_ETH0 )==IF_DOWN)
ifup(IF_ETH0);
}
}

When ifup() is called, I get error message:

Runtime error: Bad parameter passed to I/O function
File: NET.LIB
Function: vifconfig
Line: 5614

I then enable verbose in Net.Lib, and when it crashes it prints out this message:

NET: ifconfig() bad or inappropriate IFS/IFG parameter ID: 1
Apparently at IFS/IFG parameter number 2
Last apparently successful IFS/IFG parameter is 312

The message indicates that there is something wrong with a parameter passed in ifconfig(). But I'm not calling ifconfig() in this process, and I can't tell which parameter it's referring to.

I only call ifconfig() on power-up to initialize Ethernet. Here are the two calls I make:

i = ifconfig( IF_ETH0,
IFS_IF_CALLBACK, EnetUpDown, // Set Up/Down status
IFS_DHCP, IsDhcpIP(), // Use DHCP to configure port if enabled
IFS_DHCP_TIMEOUT, 65, // Specify timeout in seconds
IFS_DHCP_FALLBACK, 1, // Allow use of fallbacks to
// static configuration
IFS_ICMP_CONFIG, 0, // Don't allow use of directed
// ping to configure.
IFS_END );

// Set Static IP parameters. These are also the DHCP fallback parameters.
i = ifconfig( IF_ETH0,
IFS_IPADDR, static_ip_adrs,
IFS_NETMASK, net_mask,
IFS_END );

A comment in Net.Lib states that the most common reason for this error is an improper parameter size being used in ifconfig(), such as an int being used when it calls for a long. I've verified all the parameters I pass.

Once again, code that has been working the R3k modules doesn't with R6k.

Any ideas?

Steve

I figured it out. I was calling ifconfig(). It's in the callback function I'm using. And I had a wrong parameter type, just like the
notes in Net.Lib suggested.

As a result of troubleshooting this problem, I stumbled across another. But I start a new thread for it.

Steve

--- In r..., "seecwriter" wrote:
>
> I have another Ethernet issue on an RCM6750. I power up the module with an Ethernet cable attached, it powers up fine. I then unplug the Ethernet cable, my app correctly detects the disconnected cable and brings Ethernet down. When the cable is plugged back in, the Net.Lib crashes and the module reboots.
>
> Here is what I do:
>
> void CheckCable()
> if ( !pd_havelink( IF_ETH0 ) ) {
> if (ifpending( IF_ETH0 )==IF_UP)
> ifdown(IF_ETH0);
> }
> else {
> if (ifpending( IF_ETH0 )==IF_DOWN)
> ifup(IF_ETH0);
> }
> }
>
> When ifup() is called, I get error message:
>
> Runtime error: Bad parameter passed to I/O function
> File: NET.LIB
> Function: vifconfig
> Line: 5614
>
> I then enable verbose in Net.Lib, and when it crashes it prints out this message:
>
> NET: ifconfig() bad or inappropriate IFS/IFG parameter ID: 1
> Apparently at IFS/IFG parameter number 2
> Last apparently successful IFS/IFG parameter is 312
>
> The message indicates that there is something wrong with a parameter passed in ifconfig(). But I'm not calling ifconfig() in this process, and I can't tell which parameter it's referring to.
>
> I only call ifconfig() on power-up to initialize Ethernet. Here are the two calls I make:
>
> i = ifconfig( IF_ETH0,
> IFS_IF_CALLBACK, EnetUpDown, // Set Up/Down status
> IFS_DHCP, IsDhcpIP(), // Use DHCP to configure port if enabled
> IFS_DHCP_TIMEOUT, 65, // Specify timeout in seconds
> IFS_DHCP_FALLBACK, 1, // Allow use of fallbacks to
> // static configuration
> IFS_ICMP_CONFIG, 0, // Don't allow use of directed
> // ping to configure.
> IFS_END );
>
> // Set Static IP parameters. These are also the DHCP fallback parameters.
> i = ifconfig( IF_ETH0,
> IFS_IPADDR, static_ip_adrs,
> IFS_NETMASK, net_mask,
> IFS_END );
>
> A comment in Net.Lib states that the most common reason for this error is an improper parameter size being used in ifconfig(), such as an int being used when it calls for a long. I've verified all the parameters I pass.
>
> Once again, code that has been working the R3k modules doesn't with R6k.
>
> Any ideas?
>
> Steve
>


The 2024 Embedded Online Conference