[RFC] [WIP] net: add initial ENC28J60 support

Sascha Hauer s.hauer at pengutronix.de
Tue Jun 10 23:23:35 PDT 2014


On Wed, Jun 11, 2014 at 07:48:00AM +0400, Antony Pavlov wrote:
> On Tue, 10 Jun 2014 09:08:33 +0200
> Sascha Hauer <s.hauer at pengutronix.de> wrote:
> 
> > Hi Antony,
> > 
> > On Fri, Jun 06, 2014 at 12:02:57PM +0400, Antony Pavlov wrote:
> 
> Thanks for comments!
> But there is one issue (see below).
> 
> ...
> 
> > > +
> > > +static int enc28j60_eth_rx(struct eth_device *edev)
> > > +{
> > > +	struct enc28j60_net *priv = edev->priv;
> > > +	int pk_counter;
> > > +
> > > +	pk_counter = locked_regb_read(priv, EPKTCNT);
> > > +	if (pk_counter && netif_msg_intr(priv))
> > > +		printk(KERN_DEBUG DRV_NAME ": intRX, pk_cnt: %d\n", pk_counter);
> > > +
> > > +	if (pk_counter > priv->max_pk_counter) {
> > > +		priv->max_pk_counter = pk_counter;
> > > +		if (netif_msg_rx_status(priv) && priv->max_pk_counter > 1)
> > > +			printk(KERN_DEBUG DRV_NAME ": RX max_pk_cnt: %d\n",
> > > +				priv->max_pk_counter);
> > > +	}
> > > +
> > > +	while (pk_counter-- > 0)
> > > +		enc28j60_hw_rx(edev);
> > 
> > You should only receive a single packet in your receive function.
> > Otherwise some protocols may not function properly. We noticed this
> > recently and didn't have the chance to fix all drivers.
> > 
> 
> If I receive only one packet (I have simply dropped 'while (pk_counter-- > 0)')
> then tftp does not work.

Does pk_counter have the correct value the second time you read from
EPKTCNT?

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list