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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <496EC791.10209@snapgear.com>
Date:	Thu, 15 Jan 2009 15:20:17 +1000
From:	Greg Ungerer <gerg@...pgear.com>
To:	Sascha Hauer <s.hauer@...gutronix.de>
CC:	netdev@...r.kernel.org, Sebastian Siewior <bigeasy@...utronix.de>
Subject: Re: [PATCH] fec: use dma_alloc_coherent for descriptor ring

Hi Sascha,

Sascha Hauer wrote:
> Signed-off-by: Sascha Hauer <s.hauer@...gutronix.de>
> ---

I found a problem in the ColdFire ZONE_DMA setup that was
causing this patch to break. Fixed that now, and it is
working fine.

Acked-by:  Greg Ungerer <gerg@...inux.org>

Regards
Greg


>  drivers/net/fec.c |   11 ++++++-----
>  1 files changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/fec.c b/drivers/net/fec.c
> index 29df0df..81c8e11 100644
> --- a/drivers/net/fec.c
> +++ b/drivers/net/fec.c
> @@ -184,6 +184,7 @@ struct fec_enet_private {
>  
>  	/* CPM dual port RAM relative addresses.
>  	*/
> +	dma_addr_t	bd_dma;
>  	cbd_t	*rx_bd_base;		/* Address of Rx and Tx buffers. */
>  	cbd_t	*tx_bd_base;
>  	cbd_t	*cur_rx, *cur_tx;		/* The next free ring entry */
> @@ -2105,7 +2106,7 @@ int __init fec_enet_init(struct net_device *dev)
>  
>  	/* Allocate memory for buffer descriptors.
>  	*/
> -	mem_addr = __get_free_page(GFP_KERNEL);
> +	mem_addr = (unsigned long)dma_alloc_coherent(NULL, PAGE_SIZE, &fep->bd_dma, GFP_KERNEL);
>  	if (mem_addr == 0) {
>  		printk("FEC: allocate descriptor memory failed?\n");
>  		return -ENOMEM;
> @@ -2200,8 +2201,8 @@ int __init fec_enet_init(struct net_device *dev)
>  
>  	/* Set receive and transmit descriptor base.
>  	*/
> -	fecp->fec_r_des_start = __pa((uint)(fep->rx_bd_base));
> -	fecp->fec_x_des_start = __pa((uint)(fep->tx_bd_base));
> +	fecp->fec_r_des_start = fep->bd_dma;
> +	fecp->fec_x_des_start = (unsigned long)fep->bd_dma + sizeof(cbd_t) * RX_RING_SIZE;
>  
>  	/* Install our interrupt handlers. This varies depending on
>  	 * the architecture.
> @@ -2289,8 +2290,8 @@ fec_restart(struct net_device *dev, int duplex)
>  
>  	/* Set receive and transmit descriptor base.
>  	*/
> -	fecp->fec_r_des_start = __pa((uint)(fep->rx_bd_base));
> -	fecp->fec_x_des_start = __pa((uint)(fep->tx_bd_base));
> +	fecp->fec_r_des_start = fep->bd_dma;
> +	fecp->fec_x_des_start = (unsigned long)fep->bd_dma + sizeof(cbd_t) * RX_RING_SIZE;
>  
>  	fep->dirty_tx = fep->cur_tx = fep->tx_bd_base;
>  	fep->cur_rx = fep->rx_bd_base;

-- 
------------------------------------------------------------------------
Greg Ungerer  --  Principal Engineer        EMAIL:     gerg@...pgear.com
SnapGear, a McAfee Company                  PHONE:       +61 7 3435 2888
825 Stanley St,                             FAX:         +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia         WEB: http://www.SnapGear.com
--
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