Bug in MCF54452 FEC broadcast reject function?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Bug in MCF54452 FEC broadcast reject function?

437 Views
p123
Contributor I

Hello everyone,the following is my problem during MCF54452 FEC:

 

I need to reject broadcast frame accord to the flux of broadcast to avoid broadcast storm.So, I enable fec accept broadcast in one millisecond and reject in next milliseond.At the same time,I  test fec with PING request  and UDP broadcast packet, soon later fec stop and never trigger RXF interrupt and also MIB conunter stop,I read the MCF54452 manual carefully,no register can flag the fec stop.How can I monitor the activity of FEC  and restart FEC ? My sample code as follows:

 

/********************************************************************/

 unsigned long nld_rx_count=0;
int slt0_interrupt_handler (void* arg1, void* arg2) //slt0 trigger interrupt every one millisecond
{
 (void)arg1;(void)arg2; 
    MCF_PIT_PCSR(0)|=MCF_PIT_PCSR_PIF; 
        int mResult=0;  
    
    static unsigned bkt_enable=0;///////////for test

 nld_rx_count=MCF_FEC_RMON_R_OCTETS(0);  //accept broadcast frame
 if(bkt_enable)
 {
   bkt_enable=0;
   MCF_FEC_RCR(0)&=~MCF_FEC_RCR_BC_REJ; //reject broadcast frame
    
 }
 else
 {
   bkt_enable=1;
  
   MCF_FEC_RCR(0)|=MCF_FEC_RCR_BC_REJ;
  }

    return mResult;   
}

 /********************************************************************/

////interrupt handler for FEC isr

int nld_fec_isr(void* arg1,void* arg2)
{
 (void)arg1;(void)arg2;
  unsigned char ch; 
  unsigned long mEvent;

 
  NLD_FEC_DEV_PTR uptr=(NLD_FEC_DEV_PTR)arg1; //retrieve fec from arg1
   ch=(unsigned char)uptr->tag;//we use ch to select fec module,0-fec0 1-fec1
    mEvent=MCF_FEC_EIR(ch);
    ///////
    MCF_FEC_EIR(ch)=mEvent;
    if(mEvent&MCF_FEC_EIR_RXF)   
    {
        uptr->fec_statics.rxf_ints++;
        //we check for data receive 
        nld_fec_rcv(uptr); 
    }

}

Labels (1)
0 Kudos
1 Reply

283 Views
TomE
Specialist II
26.4.10 Receive Control Registers (RCR0 & RCR1)RCRn controls the operational mode of the receive block and must be written only when ECRn[ETHER_EN] is cleared (initialization time).

You can't write to that register while the chip is running. No wonder the chip is stopping.

 

You don't need to "monitor the FEC to restart it". Don't write to registers you're not allowed to write to and it won't stop.

 

You probably don't want to shut down the entire chip in order to change that bit in that register, as you'll lose "real packets" while doing that.

 

It doesn't take any CPU overhead to receive packet. The FEC is doing all that for you. So leave it to receive all packets and then simply ignore the ones you don't want in the receive code.

 

> I need to reject broadcast frame accord to the flux of broadcast to avoid broadcast storm

 

That's not a good way to "avoid broadcast storms". There's only a "storm" if a device wrongly responds to broadcasts. You can get a "storm" if a buggy device responds to a broadcast packet with a broadcast response. That's a software bug. You find them and fix them (in your gear) or stop using devices from someone else that does that. Or you write your own code to ignore the packets at the software level.

 

Tom

 

0 Kudos