netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next]r8169: Correct values on dma_alloc_coherent
@ 2015-07-27 10:21 Corcodel Marian
  2015-07-27 20:55 ` Francois Romieu
  0 siblings, 1 reply; 2+ messages in thread
From: Corcodel Marian @ 2015-07-27 10:21 UTC (permalink / raw)
  To: netdev; +Cc: Francois Romieu, Corcodel Marian

From: Corcodel Marian <asu@192-168-0-3.rdsnet.ro>


   Correct values on dma_alloc_coherent to fit on 256
 wich is size   rx descriptor and tx descriptor provided by the cip.   On my
 chip try to solve running on full duplex wo low speed.   Wo this patch
 running from terminal ethtool -s eth0 autoneg on   from many times to obtain
 full duplex and full speed now(with this   patch) after start network when
 start autoneg for 1 2 times work   on full duplex and full speed(important).

Signed-off-by: Corcodel Marian <asu@192-168-0-3.rdsnet.ro>

diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index 3df51fa..fd249a6 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -6724,8 +6724,8 @@ static int rtl8169_init_ring(struct net_device *dev)
 
 	rtl8169_init_ring_indexes(tp);
 
-	memset(tp->tx_skb, 0x0, NUM_TX_DESC * sizeof(struct ring_info));
-	memset(tp->Rx_databuff, 0x0, NUM_RX_DESC * sizeof(void *));
+	memset(tp->tx_skb, 0x0, NUM_RX_DESC);
+	memset(tp->Rx_databuff, 0x0, NUM_RX_DESC);
 
 	return rtl8169_rx_fill(tp);
 }
@@ -7555,9 +7555,9 @@ static int rtl8169_close(struct net_device *dev)
 
 	free_irq(pdev->irq, dev);
 
-	dma_free_coherent(&pdev->dev, R8169_RX_RING_BYTES, tp->RxDescArray,
+	dma_free_coherent(&pdev->dev, NUM_RX_DESC, tp->RxDescArray,
 			  tp->RxPhyAddr);
-	dma_free_coherent(&pdev->dev, R8169_TX_RING_BYTES, tp->TxDescArray,
+	dma_free_coherent(&pdev->dev, NUM_RX_DESC, tp->TxDescArray,
 			  tp->TxPhyAddr);
 	tp->TxDescArray = NULL;
 	tp->RxDescArray = NULL;
@@ -7589,12 +7589,12 @@ static int rtl_open(struct net_device *dev)
 	 * Rx and Tx descriptors needs 256 bytes alignment.
 	 * dma_alloc_coherent provides more.
 	 */
-	tp->TxDescArray = dma_alloc_coherent(&pdev->dev, R8169_TX_RING_BYTES,
+	tp->TxDescArray = dma_alloc_coherent(&pdev->dev, NUM_RX_DESC,
 					     &tp->TxPhyAddr, GFP_KERNEL);
 	if (!tp->TxDescArray)
 		goto err_pm_runtime_put;
 
-	tp->RxDescArray = dma_alloc_coherent(&pdev->dev, R8169_RX_RING_BYTES,
+	tp->RxDescArray = dma_alloc_coherent(&pdev->dev, NUM_RX_DESC,
 					     &tp->RxPhyAddr, GFP_KERNEL);
 	if (!tp->RxDescArray)
 		goto err_free_tx_0;
@@ -7644,11 +7644,11 @@ err_release_fw_2:
 	rtl_release_firmware(tp);
 	rtl8169_rx_clear(tp);
 err_free_rx_1:
-	dma_free_coherent(&pdev->dev, R8169_RX_RING_BYTES, tp->RxDescArray,
+	dma_free_coherent(&pdev->dev, NUM_RX_DESC, tp->RxDescArray,
 			  tp->RxPhyAddr);
 	tp->RxDescArray = NULL;
 err_free_tx_0:
-	dma_free_coherent(&pdev->dev, R8169_TX_RING_BYTES, tp->TxDescArray,
+	dma_free_coherent(&pdev->dev, NUM_RX_DESC, tp->TxDescArray,
 			  tp->TxPhyAddr);
 	tp->TxDescArray = NULL;
 err_pm_runtime_put:
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next]r8169: Correct values on dma_alloc_coherent
  2015-07-27 10:21 [PATCH net-next]r8169: Correct values on dma_alloc_coherent Corcodel Marian
@ 2015-07-27 20:55 ` Francois Romieu
  0 siblings, 0 replies; 2+ messages in thread
From: Francois Romieu @ 2015-07-27 20:55 UTC (permalink / raw)
  To: Corcodel Marian; +Cc: netdev, Corcodel Marian

Corcodel Marian <corcodel.marian@gmail.com> :
[...]
> diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
> index 3df51fa..fd249a6 100644
> --- a/drivers/net/ethernet/realtek/r8169.c
> +++ b/drivers/net/ethernet/realtek/r8169.c
> @@ -6724,8 +6724,8 @@ static int rtl8169_init_ring(struct net_device *dev)
>  
>  	rtl8169_init_ring_indexes(tp);
>  
> -	memset(tp->tx_skb, 0x0, NUM_TX_DESC * sizeof(struct ring_info));
> -	memset(tp->Rx_databuff, 0x0, NUM_RX_DESC * sizeof(void *));
> +	memset(tp->tx_skb, 0x0, NUM_RX_DESC);
> +	memset(tp->Rx_databuff, 0x0, NUM_RX_DESC);

	void *Rx_databuff[NUM_RX_DESC];

:o(

Please don't mess with the kernel code until you've figured how wrong
these changes are. Then give yourself a few months and read more code.

Really.

-- 
Ueimor

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-07-27 20:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-27 10:21 [PATCH net-next]r8169: Correct values on dma_alloc_coherent Corcodel Marian
2015-07-27 20:55 ` Francois Romieu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).