dear philipp,


On Sat, 16 Aug 2008, Philipp Hachtmann wrote:

I am currently wondering if someone has experience with the emaclite
driver. When I unset the "ping pong" (double buffering) parameters of
...

I found a driver (xilinx_emaclite.c) in the U-boot git. That completely
refuses to work correctly (of course with parameters corrected). The
other driver I once found "somewhere" (in the Petalinux distribution).

i don't know what exact versions are you using. for me the following
combination works reasonably both with tx-ping-pong = rx-ping-pong = 0
and with tx-ping-pong = rx-ping-pong = 1, both under u-boot and
linux (i'm normally using ping-pong = 1, i've only made a quick test
with ping-pong = 0):

- edk 9.1, opb_ethernetlite v1.01.b, v4-fx12 (memec/avnet minimodule)
- u-boot: ftp://ftp.denx.de/pub/u-boot/u-boot-1.3.3.tar.bz2
- linux: xilinx's git://git.xilinx.com/linux-2.6-xlnx, 2.6.26-rc6


also, i think there is a bug in the linux driver: the XEmacLite_Config
structure used to set up the device is located on the stack. so
after the init returns, further references to this struct by the
os independent part of the driver are invalid. see the attached
patch. i don't know if it solves your prolem, though..

(the patch also replaces a few calls of dev_kfree_skb() from
interrupt context. thoose can generate lots of warnings on the
console, thus slowing down operation.)


--
mazsi

----------------------------------------------------------------
strawberry fields forever!                       [EMAIL PROTECTED]
----------------------------------------------------------------
diff --git a/drivers/net/xilinx_emaclite/adapter.c b/drivers/net/xilinx_emaclite/adapter.c
index ed7a947..2a50e29 100644
--- a/drivers/net/xilinx_emaclite/adapter.c
+++ b/drivers/net/xilinx_emaclite/adapter.c
@@ -100,6 +100,7 @@ struct net_local {
 	 * data as an opaque object in this file (meaning that we never
 	 * reference any of the fields inside of the structure).
 	 */
+	XEmacLite_Config Config;
 	XEmacLite EmacLite;
 
 	void *desc_space;
@@ -168,7 +169,7 @@ static void reset(struct net_device *dev, DUPLEX duplex)
 	XEmacLite_EnableInterrupts(&lp->EmacLite);
 
 	if (lp->deferred_skb) {
-		dev_kfree_skb(lp->deferred_skb);
+		dev_kfree_skb_any(lp->deferred_skb);
 		lp->deferred_skb = NULL;
 		lp->stats.tx_errors++;
 	}
@@ -279,7 +280,7 @@ static int xemaclite_Send(struct sk_buff *orig_skb, struct net_device *dev)
 	spin_unlock_irqrestore(&reset_lock, flags);
 
 	lp->stats.tx_bytes += len;
-	dev_kfree_skb(new_skb);
+	dev_kfree_skb_any(new_skb);
 	dev->trans_start = jiffies;
 
 	return 0;
@@ -298,7 +299,7 @@ static void SendHandler(void *CallbackRef)
 			return;
 		}
 		else {
-			dev_kfree_skb(lp->deferred_skb);
+			dev_kfree_skb_any(lp->deferred_skb);
 			lp->deferred_skb = NULL;
 			netif_wake_queue(dev);
 		}
@@ -354,7 +355,7 @@ static void RecvHandler(void *CallbackRef)
 	if (!len) {
 
 		lp->stats.rx_errors++;
-		dev_kfree_skb(skb);
+		dev_kfree_skb_any(skb);
 		//printk(KERN_ERR "%s: Could not receive buffer\n",dev->name);
 		spin_lock(&reset_lock);
 		//reset(dev, UNKNOWN_DUPLEX);
@@ -438,8 +439,6 @@ static int xemaclite_setup(
 
 	u32 virt_baddr;		/* virtual base address of emac */
 
-	XEmacLite_Config Config;
-
 	struct net_device *ndev = NULL;
 	struct net_local *lp = NULL;
 
@@ -471,9 +470,9 @@ static int xemaclite_setup(
 	lp->ndev = ndev;
 
 	/* Setup the Config structure for the XEmacLite_CfgInitialize() call. */
-	Config.BaseAddress	= r_mem->start;	/* Physical address */
-	Config.TxPingPong	= pdata->tx_ping_pong;
-	Config.RxPingPong	= pdata->rx_ping_pong;
+	lp->Config.BaseAddress	= r_mem->start;	/* Physical address */
+	lp->Config.TxPingPong	= pdata->tx_ping_pong;
+	lp->Config.RxPingPong	= pdata->rx_ping_pong;
 
 
 	/* Get the virtual base address for the device */
@@ -485,7 +484,7 @@ static int xemaclite_setup(
 	}
 
 
-	if (XEmacLite_CfgInitialize(&lp->EmacLite, &Config, virt_baddr) != XST_SUCCESS) {
+	if (XEmacLite_CfgInitialize(&lp->EmacLite, &lp->Config, virt_baddr) != XST_SUCCESS) {
 		dev_err(dev, "XEmacLite: Could not initialize device.\n");
 		rc = -ENODEV;
 		goto error;
@@ -498,12 +497,12 @@ static int xemaclite_setup(
         XEmacLite_SetMacAddress(&lp->EmacLite, ndev->dev_addr);
 
 	dev_info(dev,
-			"MAC address is now %2x:%2x:%2x:%2x:%2x:%2x\n",
+			"MAC address is now %02x:%02x:%02x:%02x:%02x:%02x\n",
 			pdata->mac_addr[0], pdata->mac_addr[1],
 			pdata->mac_addr[2], pdata->mac_addr[3],
 			pdata->mac_addr[4], pdata->mac_addr[5]);
 
-	dev_err(dev, "using fifo mode.\n");
+	dev_err(dev, "using fifo mode, tx-ping-pong=%d, rx-ping-pong=%d.\n", lp->Config.TxPingPong, lp->Config.RxPingPong);
 	XEmacLite_SetRecvHandler(&lp->EmacLite, ndev, RecvHandler);
 	XEmacLite_SetSendHandler(&lp->EmacLite, ndev, SendHandler);
 	ndev->hard_start_xmit = xemaclite_Send;
_______________________________________________
Linuxppc-embedded mailing list
Linuxppc-embedded@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-embedded

Reply via email to