Project Home
Project Home
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - How to disable receive in mpc85xx: (12 Items)
   
How to disable receive in mpc85xx  
Hi,

I need a help.

I am using devnp-mpc85xx.so driver and stack version is io-pkt-v6-hc. Based on certain conditions I need to disable 
receiving packets for sometime and then enable it later. I wanted to achieve it in my application code. Can someone help
 me what should I do to achieve it.

Thanks & Regards
Vijaya
Re: How to disable receive in mpc85xx  
There's no way in the standard driver to just disable receive and leave transmit active. If you need to do this then you
 would need to customise the driver and drop the received packets.

If you need to stop receiving and also transmitting then you could do the equivalent of "ifconfig ... down". This is an 
ioctl() for SIOCGIFFLAGS, clear IFF_UP from the returned flags and then do ioctl() for SIOCSIFFLAGS.
Re: How to disable receive in mpc85xx  
Thanks for your reply.

I am trying to deal with network storm conditions. I need to disable Rx when number of packets received crosses a limit 
in a given time. This is to give application code required time to process already received packets. Taking down the 
interface (using ifconfig down etc) is not an option as it would disturb the transmit also.

  1)  What are your suggestions to handle storm conditions? Any other ways other than taking down the interface?
  2) I have only devnp-mpc85xx.so file. How do I get latest driver code? 

Thanks & Regards
Vijaya
Re: How to disable receive in mpc85xx  
I suggest contacting your support contact, they should be able to provide you with the latest version of the driver code
.

You would need to add a custom ioctl() that shuts off the receive in hardware to get it to drop packets with the minimum
 CPU load if you are worried about network storms. Any other option is still going to have some CPU usage as it runs the
 Rx descriptor ring.
Re: How to disable receive in mpc85xx  
How do I achieve this custom ioctl ()? Is there a sample code for shutting off receive in hardware? Does it require 
changes to driver code?

Appreciate your help on this.

Thanks & Regards
Vijaya
Re: How to disable receive in mpc85xx  
It is changes to driver code.
Re: How to disable receive in mpc85xx  
I got hold of the code. For enabling and disabling Rx, I am trying below code:

Disable Rx:

*(base + MPC_MACCFG1) &= ~MACCFG1_RXEN;

Enable Rx:

*(base + MPC_MACCFG1) |= MACCFG1_RXEN;

Is this sufficient or do I need to modify any other registers.

Thanks& Regards
Vijaya
Re: How to disable receive in mpc85xx  
You might want to add the following as well:

    if  ((*(base + MPC_DMACTRL) & DMACTRL_GRS) == 0) {
        /* Graceful receive stop and wait for completion. */
        *(base + MPC_DMACTRL) |= DMACTRL_GRS;
        timeout = MPC_TIMEOUT;
        do {
            nanospin_ns (10);
            if (! --timeout)
                break;
            status = *(base + MPC_IEVENT);
        } while ((status & IEVENT_GRSC) != IEVENT_GRSC);

        if (!timeout) {
            log(LOG_ERR, "%s(): DMA GRS stop failed", __FUNCTION__);
        }
    }


On 2019-03-05, 5:54 AM, "Vijaya V" <community-noreply@qnx.com> wrote:

    I got hold of the code. For enabling and disabling Rx, I am trying below code:
    
    Disable Rx:
    
    *(base + MPC_MACCFG1) &= ~MACCFG1_RXEN;
    
    Enable Rx:
    
    *(base + MPC_MACCFG1) |= MACCFG1_RXEN;
    
    Is this sufficient or do I need to modify any other registers.
    
    Thanks& Regards
    Vijaya
    
    
    
    _______________________________________________
    
    Networking Drivers
    http://community.qnx.com/sf/go/post119559
    To cancel your subscription to this discussion, please e-mail drivers-networking-unsubscribe@community.qnx.com
    

Re: How to disable receive in mpc85xx  
I think the code you provided should be added while disabling receive.  Similarly is there anything to be added while 
enabling receive?
Re: How to disable receive in mpc85xx  
    *(base + MPC_DMACTRL) &= ~(DMACTRL_GRS | DMACTRL_GTS);


On 2019-03-05, 8:46 AM, "Vijaya V" <community-noreply@qnx.com> wrote:

    I think the code you provided should be added while disabling receive.  Similarly is there anything to be added 
while enabling receive?
    
    
    
    _______________________________________________
    
    Networking Drivers
    http://community.qnx.com/sf/go/post119561
    To cancel your subscription to this discussion, please e-mail drivers-networking-unsubscribe@community.qnx.com
    

Re: How to disable receive in mpc85xx  
Thanks a lot for your response.

I am testing with these changes. I have applied storm such that receive disable and enable happens frequently. It is 
working for quiet some time. And then there is a kind of hang on communications side. I can see trough print statement 
that receive is enabled. My application also seems to be running. The problem is occurring randomly.

How do I debug this situation. Is there any tool or utility?

Thanks & Regards
Vijaya
Re: How to disable receive in mpc85xx  
I have no idea as to what is happening, so you will have to debug your code.


On 2019-03-05, 10:14 AM, "Vijaya V" <community-noreply@qnx.com> wrote:

    Thanks a lot for your response.
    
    I am testing with these changes. I have applied storm such that receive disable and enable happens frequently. It is
 working for quiet some time. And then there is a kind of hang on communications side. I can see trough print statement 
that receive is enabled. My application also seems to be running. The problem is occurring randomly.
    
    How do I debug this situation. Is there any tool or utility?
    
    Thanks & Regards
    Vijaya
    
    
    
    _______________________________________________
    
    Networking Drivers
    http://community.qnx.com/sf/go/post119563
    To cancel your subscription to this discussion, please e-mail drivers-networking-unsubscribe@community.qnx.com