net: Only process 1 packet per ethernet RX interrupt
net: Only process 1 packet per ethernet RX interrupt

Previously the packet_rx() function would wait on the RxSem and when
signalled it would process all available inbound packets.  This used to
cause no problem but once the thread synchronization was turned
on via SYS_LIGHTWEIGHT_PROT, the semaphore actually started to overflow
its maximum token count of 65535.  This caused the mbed_die() flashing
LEDs of death.  The old code was really breaking the producer/consumer
pattern that I typically see with a semaphore since the consumer was
written to consume more than 1 produced object per semaphore wait.
Before the thread synchronization was enabled, the packet_rx() thread
could use a single time slice to process all of these packets and then
loop back around a few more times to decrement the semaphore count
while skipping the packet processing since it had all been done.
Now the packet processing code would cause the thread to give up its
time slice as it hit newly enabled critical sections.  In the end it
was possible for the code to leak 2 semaphore signals for every 1 by
which the thread was awaken.  After about 10 seconds of load, this
would cause a leak of 65535 signals.

NOTE: Two potential issues with this change:
1) The LPC_EMAC->RxConsumeIndex != LPC_EMAC->RxProduceIndex check was
   removed from packet_rx().  I believe that this is Ok since the same
   condition is later checked in lpc_low_level_input() anyway so it
   won't now try to process more packets than what exist.
2) What if ENET_IRQHandler(void) ends up not signalling the RxSem for
   every packet received?  When would that happen?  I could see it
   happening if the ethernet hardware would try to pend more than 1
   interrupt when the priority was too elevated to process the
   pending requests.  Putting the consumer loop back in packet_rx()
   and using a Signal instead of a Semaphore might be a better
   solution?

tung7970/mbed-os-1,fahhem/mbed-os,kpurusho/mbed,Timmmm/mbed,JasonHow44/mbed,andcor02/mbed-os,jpbrucker/mbed,ban4jp/mbed,fpiot/mbed-ats,rosterloh/mbed,rosterloh/mbed,catiedev/mbed-os,infinnovation/mbed-os,HeadsUpDisplayInc/mbed,iriark01/mbed-drivers,NXPmicro/mbed,autopulated/mbed,pi19404/mbed,pradeep-gr/mbed-os5-onsemi,Willem23/mbed,logost/mbed,adamgreen/mbed,RonEld/mbed,arostm/mbed-os,kl-cruz/mbed-os,struempelix/mbed,al177/mbed,naves-thiago/mbed-midi,EmuxEvans/mbed,Timmmm/mbed,mbedmicro/mbed,getopenmono/mbed,JasonHow44/mbed,svogl/mbed-os,mbedmicro/mbed,bulislaw/mbed-os,mazimkhan/mbed-os,NXPmicro/mbed,screamerbg/mbed,adamgreen/mbed,nvlsianpu/mbed,struempelix/mbed,CalSol/mbed,naves-thiago/mbed-midi,jrjang/mbed,jrjang/mbed,dbestm/mbed,radhika-raghavendran/mbed-os5.1-onsemi,xcrespo/mbed,xcrespo/mbed,kpurusho/mbed,hwfwgrp/mbed,fvincenzo/mbed-os,bulislaw/mbed-os,autopulated/mbed,mnlipp/mbed,geky/mbed,adamgreen/mbed,jferreir/mbed,GustavWi/mbed,jamesadevine/mbed,bulislaw/mbed-os,bikeNomad/mbed,iriark01/mbed-drivers,dbestm/mbed,fanghuaqi/mbed,j-greffe/mbed-os,fpiot/mbed-ats,NordicSemiconductor/mbed,larks/mbed,pedromes/mbed,Timmmm/mbed,Timmmm/mbed,nabilbendafi/mbed,wodji/mbed,0xc0170/mbed-drivers,andreaslarssonublox/mbed,dbestm/mbed,adustm/mbed,fvincenzo/mbed-os,JasonHow44/mbed,brstew/MBED-BUILD,mnlipp/mbed,maximmbed/mbed,Tiryoh/mbed,fvincenzo/mbed-os,jeremybrodt/mbed,autopulated/mbed,kjbracey-arm/mbed,bentwire/mbed,ryankurte/mbed-os,tung7970/mbed-os,jrjang/mbed,NordicSemiconductor/mbed,kl-cruz/mbed-os,betzw/mbed-os,logost/mbed,NXPmicro/mbed,pbrook/mbed,Tiryoh/mbed,mbedmicro/mbed,bentwire/mbed,Marcomissyou/mbed,jamesadevine/mbed,ban4jp/mbed,JasonHow44/mbed,getopenmono/mbed,radhika-raghavendran/mbed-os5.1-onsemi,RonEld/mbed,fanghuaqi/mbed,sam-geek/mbed,theotherjimmy/mbed,catiedev/mbed-os,GustavWi/mbed,GustavWi/mbed,bcostm/mbed-os,kpurusho/mbed,andreaslarssonublox/mbed,NXPmicro/mbed,pbrook/mbed,mmorenobarm/mbed-os,bulislaw/mbed-os,maximmbed/mbed,bentwire/mbed,infinnovation/mbed-os,svastm/mbed,ryankurte/mbed-os,K4zuki/mbed,CalSol/mbed,rgrover/mbed,NXPmicro/mbed,svastm/mbed,mikaleppanen/mbed-os,YarivCol/mbed-os,DanKupiniak/mbed,svogl/mbed-os,ARM-software/mbed-beetle,al177/mbed,adamgreen/mbed,sam-geek/mbed,autopulated/mbed,jpbrucker/mbed,fahhem/mbed-os,screamerbg/mbed,Sweet-Peas/mbed,fanghuaqi/mbed,adustm/mbed,ban4jp/mbed,infinnovation/mbed-os,svogl/mbed-os,EmuxEvans/mbed,bcostm/mbed-os,CalSol/mbed,cvtsi2sd/mbed-os,geky/mbed,rosterloh/mbed,jeremybrodt/mbed,al177/mbed,mikaleppanen/mbed-os,YarivCol/mbed-os,Archcady/mbed-os,svastm/mbed,0xc0170/mbed-drivers,struempelix/mbed,brstew/MBED-BUILD,mnlipp/mbed,cvtsi2sd/mbed-os,bentwire/mbed,GustavWi/mbed,catiedev/mbed-os,fpiot/mbed-ats,brstew/MBED-BUILD,arostm/mbed-os,nRFMesh/mbed-os,bremoran/mbed-drivers,jrjang/mbed,brstew/MBED-BUILD,bikeNomad/mbed,bcostm/mbed-os,larks/mbed,fahhem/mbed-os,naves-thiago/mbed-midi,alertby/mbed,maximmbed/mbed,Sweet-Peas/mbed,j-greffe/mbed-os,andcor02/mbed-os,nvlsianpu/mbed,netzimme/mbed-os,Archcady/mbed-os,NordicSemiconductor/mbed,alertby/mbed,wodji/mbed,pbrook/mbed,tung7970/mbed-os,andreaslarssonublox/mbed,fahhem/mbed-os,arostm/mbed-os,RonEld/mbed,ban4jp/mbed,kjbracey-arm/mbed,Tiryoh/mbed,YarivCol/mbed-os,nvlsianpu/mbed,alertby/mbed,Shengliang/mbed,sam-geek/mbed,j-greffe/mbed-os,getopenmono/mbed,jpbrucker/mbed,arostm/mbed-os,Willem23/mbed,mmorenobarm/mbed-os,al177/mbed,mmorenobarm/mbed-os,larks/mbed,ARM-software/mbed-beetle,logost/mbed,geky/mbed,nvlsianpu/mbed,adustm/mbed,rgrover/mbed,j-greffe/mbed-os,infinnovation/mbed-os,Willem23/mbed,maximmbed/mbed,adustm/mbed,screamerbg/mbed,masaohamanaka/mbed,logost/mbed,kl-cruz/mbed-os,al177/mbed,radhika-raghavendran/mbed-os5.1-onsemi,bikeNomad/mbed,bcostm/mbed-os,andcor02/mbed-os,Marcomissyou/mbed,monkiineko/mbed-os,Shengliang/mbed,pradeep-gr/mbed-os5-onsemi,fahhem/mbed-os,masaohamanaka/mbed,DanKupiniak/mbed,struempelix/mbed,mazimkhan/mbed-os,c1728p9/mbed-os,bremoran/mbed-drivers,wodji/mbed,karsev/mbed-os,svogl/mbed-os,hwfwgrp/mbed,bikeNomad/mbed,CalSol/mbed,c1728p9/mbed-os,karsev/mbed-os,xcrespo/mbed,Sweet-Peas/mbed,hwfwgrp/mbed,fpiot/mbed-ats,nvlsianpu/mbed,Marcomissyou/mbed,YarivCol/mbed-os,xcrespo/mbed,bentwire/mbed,betzw/mbed-os,arostm/mbed-os,netzimme/mbed-os,RonEld/mbed,logost/mbed,fvincenzo/mbed-os,Tiryoh/mbed,bikeNomad/mbed,mikaleppanen/mbed-os,mikaleppanen/mbed-os,andcor02/mbed-os,HeadsUpDisplayInc/mbed,mnlipp/mbed,radhika-raghavendran/mbed-os5.1-onsemi,pbrook/mbed,Shengliang/mbed,netzimme/mbed-os,pradeep-gr/mbed-os5-onsemi,FranklyDev/mbed,alertby/mbed,naves-thiago/mbed-midi,masaohamanaka/mbed,andreaslarssonublox/mbed,NitinBhaskar/mbed,pedromes/mbed,GustavWi/mbed,maximmbed/mbed,EmuxEvans/mbed,rosterloh/mbed,theotherjimmy/mbed,al177/mbed,geky/mbed,mnlipp/mbed,jamesadevine/mbed,nRFMesh/mbed-os,pedromes/mbed,cvtsi2sd/mbed-os,xcrespo/mbed,Archcady/mbed-os,jpbrucker/mbed,wodji/mbed,YarivCol/mbed-os,adamgreen/mbed,Timmmm/mbed,andcor02/mbed-os,NitinBhaskar/mbed,jferreir/mbed,Marcomissyou/mbed,devanlai/mbed,ban4jp/mbed,pi19404/mbed,K4zuki/mbed,Archcady/mbed-os,tung7970/mbed-os,kl-cruz/mbed-os,kpurusho/mbed,K4zuki/mbed,hwfwgrp/mbed,masaohamanaka/mbed,jferreir/mbed,pbrook/mbed,theotherjimmy/mbed,mazimkhan/mbed-os,pbrook/mbed,kpurusho/mbed,FranklyDev/mbed,Willem23/mbed,jferreir/mbed,alertby/mbed,pedromes/mbed,devanlai/mbed,pedromes/mbed,jrjang/mbed,DanKupiniak/mbed,infinnovation/mbed-os,NitinBhaskar/mbed,HeadsUpDisplayInc/mbed,nRFMesh/mbed-os,netzimme/mbed-os,RonEld/mbed,ryankurte/mbed-os,c1728p9/mbed-os,NitinBhaskar/mbed,Sweet-Peas/mbed,JasonHow44/mbed,mbedmicro/mbed,nabilbendafi/mbed,c1728p9/mbed-os,alertby/mbed,NitinBhaskar/mbed,jpbrucker/mbed,nRFMesh/mbed-os,devanlai/mbed,catiedev/mbed-os,svastm/mbed,andcor02/mbed-os,andreaslarssonublox/mbed,DanKupiniak/mbed,jamesadevine/mbed,larks/mbed,logost/mbed,kl-cruz/mbed-os,EmuxEvans/mbed,pi19404/mbed,CalSol/mbed,naves-thiago/mbed-midi,tung7970/mbed-os,kjbracey-arm/mbed,nRFMesh/mbed-os,betzw/mbed-os,jrjang/mbed,svogl/mbed-os,tung7970/mbed-os-1,pi19404/mbed,arostm/mbed-os,jferreir/mbed,larks/mbed,HeadsUpDisplayInc/mbed,fanghuaqi/mbed,jamesadevine/mbed,jeremybrodt/mbed,theotherjimmy/mbed,Archcady/mbed-os,theotherjimmy/mbed,geky/mbed,cvtsi2sd/mbed-os,Archcady/mbed-os,c1728p9/mbed-os,larks/mbed,kpurusho/mbed,j-greffe/mbed-os,netzimme/mbed-os,mazimkhan/mbed-os,struempelix/mbed,dbestm/mbed,nRFMesh/mbed-os,cvtsi2sd/mbed-os,monkiineko/mbed-os,K4zuki/mbed,bcostm/mbed-os,ryankurte/mbed-os,kl-cruz/mbed-os,fvincenzo/mbed-os,jferreir/mbed,rgrover/mbed,HeadsUpDisplayInc/mbed,monkiineko/mbed-os,catiedev/mbed-os,nabilbendafi/mbed,nvlsianpu/mbed,JasonHow44/mbed,ryankurte/mbed-os,xcrespo/mbed,Tiryoh/mbed,svogl/mbed-os,svastm/mbed,masaohamanaka/mbed,wodji/mbed,hwfwgrp/mbed,mikaleppanen/mbed-os,nabilbendafi/mbed,adamgreen/mbed,Willem23/mbed,Shengliang/mbed,screamerbg/mbed,monkiineko/mbed-os,bulislaw/mbed-os,radhika-raghavendran/mbed-os5.1-onsemi,sam-geek/mbed,adustm/mbed,RonEld/mbed,tung7970/mbed-os-1,kjbracey-arm/mbed,fanghuaqi/mbed,sg-/mbed-drivers,NordicSemiconductor/mbed,FranklyDev/mbed,karsev/mbed-os,CalSol/mbed,karsev/mbed-os,jpbrucker/mbed,bcostm/mbed-os,rosterloh/mbed,ARM-software/mbed-beetle,bentwire/mbed,pradeep-gr/mbed-os5-onsemi,rgrover/mbed,struempelix/mbed,infinnovation/mbed-os,hwfwgrp/mbed,Shengliang/mbed,pradeep-gr/mbed-os5-onsemi,dbestm/mbed,adustm/mbed,nabilbendafi/mbed,bulislaw/mbed-os,mikaleppanen/mbed-os,karsev/mbed-os,jeremybrodt/mbed,sg-/mbed-drivers,getopenmono/mbed,Sweet-Peas/mbed,netzimme/mbed-os,mbedmicro/mbed,ARM-software/mbed-beetle,catiedev/mbed-os,sam-geek/mbed,radhika-raghavendran/mbed-os5.1-onsemi,theotherjimmy/mbed,Marcomissyou/mbed,getopenmono/mbed,pedromes/mbed,tung7970/mbed-os,autopulated/mbed,K4zuki/mbed,monkiineko/mbed-os,NXPmicro/mbed,EmuxEvans/mbed,pi19404/mbed,devanlai/mbed,FranklyDev/mbed,fpiot/mbed-ats,wodji/mbed,getopenmono/mbed,mazimkhan/mbed-os,dbestm/mbed,nabilbendafi/mbed,tung7970/mbed-os-1,mmorenobarm/mbed-os,ban4jp/mbed,mmorenobarm/mbed-os,karsev/mbed-os,masaohamanaka/mbed,screamerbg/mbed,brstew/MBED-BUILD,EmuxEvans/mbed,rgrover/mbed,monkiineko/mbed-os,ryankurte/mbed-os,betzw/mbed-os,FranklyDev/mbed,Timmmm/mbed,devanlai/mbed,Marcomissyou/mbed,betzw/mbed-os,autopulated/mbed,mmorenobarm/mbed-os,cvtsi2sd/mbed-os,betzw/mbed-os,rosterloh/mbed,Shengliang/mbed,maximmbed/mbed,tung7970/mbed-os-1,mnlipp/mbed,pi19404/mbed,devanlai/mbed,c1728p9/mbed-os,pradeep-gr/mbed-os5-onsemi,mazimkhan/mbed-os,K4zuki/mbed,screamerbg/mbed,jamesadevine/mbed,brstew/MBED-BUILD,jeremybrodt/mbed,Tiryoh/mbed,j-greffe/mbed-os,Sweet-Peas/mbed,HeadsUpDisplayInc/mbed,fpiot/mbed-ats,YarivCol/mbed-os,naves-thiago/mbed-midi,fahhem/mbed-os