lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <9848F2DB572E5649BA045B288BE08FBE01682504@039-SN2MPN1-021.039d.mgd.msft.net>
Date:	Tue, 3 Sep 2013 01:39:25 +0000
From:	Duan Fugang-B38611 <B38611@...escale.com>
To:	Li Frank-B20596 <B20596@...escale.com>,
	"davem@...emloft.net" <davem@...emloft.net>
CC:	"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	"bhutchings@...arflare.com" <bhutchings@...arflare.com>,
	"stephen@...workplumber.org" <stephen@...workplumber.org>
Subject: RE: [PATCH] net: fec: fix the error to get the previous BD entry

From: Li Frank-B20596
Data: Monday, September 02, 2013 10:30 PM

> To: Duan Fugang-B38611; davem@...emloft.net
> Cc: netdev@...r.kernel.org; bhutchings@...arflare.com;
> stephen@...workplumber.org
> Subject: RE: [PATCH] net: fec: fix the error to get the previous BD entry
> 
> 
> 
> > -----Original Message-----
> > From: Duan Fugang-B38611
> > Sent: Monday, September 02, 2013 6:36 AM
> > To: Li Frank-B20596; davem@...emloft.net
> > Cc: netdev@...r.kernel.org; bhutchings@...arflare.com;
> > stephen@...workplumber.org
> > Subject: [PATCH] net: fec: fix the error to get the previous BD entry
> >
> > Bug: error to get the previous BD entry. When the current BD is the
> > first BD, the previous BD entry must be the last BD, not "bdp - 1" in
> current logic.
> >
> > V2:
> >   Add tx_ring_size and rx_ring_size to struct fec_enet_private.
> >   Replace api fec_enet_get_nextdesc() with next_bd().
> >   Replace api fec_enet_get_prevdesc() with pre_bd().
> >
> >   Move all ring size check logic to next_bd() and pre_bd, which
> >   simplifies the code redundancy.
> >
> > V1:
> >   Add BD ring size check to get the previous BD entry in correctly.
> >
> > Signed-off-by: Fugang Duan  <B38611@...escale.com>
> > ---
> >  drivers/net/ethernet/freescale/fec.h      |    3 +
> >  drivers/net/ethernet/freescale/fec_main.c |   94 +++++++++++++++-------
> -----
> > -
> >  2 files changed, 53 insertions(+), 44 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/freescale/fec.h
> > b/drivers/net/ethernet/freescale/fec.h
> > index ae23600..0120217 100644
> > --- a/drivers/net/ethernet/freescale/fec.h
> > +++ b/drivers/net/ethernet/freescale/fec.h
> > @@ -296,6 +296,9 @@ struct fec_enet_private {
> >  	/* The ring entries to be free()ed */
> >  	struct bufdesc	*dirty_tx;
> >
> > +	unsigned short tx_ring_size;
> > +	unsigned short rx_ring_size;
> > +
> >  	struct	platform_device *pdev;
> >
> >  	int	opened;
> > diff --git a/drivers/net/ethernet/freescale/fec_main.c
> > b/drivers/net/ethernet/freescale/fec_main.c
> > index 4ea1555..9894dd3 100644
> > --- a/drivers/net/ethernet/freescale/fec_main.c
> > +++ b/drivers/net/ethernet/freescale/fec_main.c
> > @@ -239,22 +239,35 @@ MODULE_PARM_DESC(macaddr, "FEC Ethernet MAC
> > address");
> >
> >  static int mii_cnt;
> >
> > -static struct bufdesc *fec_enet_get_nextdesc(struct bufdesc *bdp, int
> > is_ex)
> > +static inline
> > +struct bufdesc *next_bd(struct bufdesc *bdp, struct bufdesc *base,
> > +			int ring_size, int is_ex)
> 
> David suggest use fec_enet_ prefix for all function in fec driver when I
> upstream it.
> 
> 
> How about use
> 	Fec_enet_next_bd(struct bufdesc *bdp, *fep)
> 	The parameter will become little and easy to call.
> 
> >  {
> > -	struct bufdesc_ex *ex = (struct bufdesc_ex *)bdp;
> > +	struct bufdesc *new_bd = bdp + 1;
> > +	struct bufdesc_ex *ex_new_bd = (struct bufdesc_ex *)bdp + 1;
> > +	struct bufdesc_ex *ex_base = (struct bufdesc_ex *)base;
> > +
> 
> If pass down fep,
> 	If( bdp > fep->rx_base) {
> 		Ex_base = fep->rx_base;
> 		Ring_size = fep->rx_ring_size;
> 	}
> 	Else {
> 		Ex_base = fep->tx_base.
> 		Ring_size = fep->tx_ring_size;
> 	}
> 
> Because RX always behind of TX.
> 

Good idea, I will send patch V3.  Thanks.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ