Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Nov 2006 17:40:34 GMT
From:      Sam Leffler <sam@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 109807 for review
Message-ID:  <200611121740.kACHeYMn047064@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=109807

Change 109807 by sam@sam_ebb on 2006/11/12 17:39:51

	add comments

Affected files ...

.. //depot/projects/arm/src/sys/arm/xscale/ixp425/if_npe.c#22 edit

Differences ...

==== //depot/projects/arm/src/sys/arm/xscale/ixp425/if_npe.c#22 (text+ko) ====

@@ -25,6 +25,22 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
+/*
+ * Intel XScale NPE Ethernet driver.
+ *
+ * This driver handles the two ports present on the IXP425.
+ * Packet processing is done by the Network Processing Engines
+ * (NPE's) that work together with a MAC and PHY. The MAC
+ * is also mapped to the XScale cpu; the PHY is accessed via
+ * the MAC. NPE-XScale communication happens through h/w
+ * queues managed by the Q Manager block.
+ *
+ * The code here replaces the ethAcc, ethMii, and ethDB classes
+ * in the Intel Access Library (IAL) and the OS-specific driver.
+ *
+ * XXX add vlan support
+ * XXX NPE-C port doesn't work yet
+ */
 #ifdef HAVE_KERNEL_OPTION_HEADERS
 #include "opt_device_polling.h"
 #endif
@@ -120,7 +136,15 @@
 };
 
 /*
- * Per-unit static configuration for IXP425.
+ * Per-unit static configuration for IXP425.  The tx and
+ * rx free Q id's are fixed by the NPE microcode.  The
+ * rx Q id's are programmed to be separate to simplify
+ * multi-port processing.  It may be better to handle
+ * all traffic through one Q (as done by the Intel drivers).
+ *
+ * Note that the PHY's are accessible only from MAC A
+ * on the IXP425.  This and other platform-specific
+ * assumptions probably need to be handled through hints.
  */
 static const struct {
 	const char	*desc;		/* device description */
@@ -756,6 +780,15 @@
 
 	NPE_ASSERT_LOCKED(sc);
 
+	/*
+	 * NB: to avoid sleeping with the softc lock held we
+	 * split the NPE msg processing into two parts.  The
+	 * request for statistics is sent w/o waiting for a
+	 * reply and then on the next tick we retrieve the
+	 * results.  This works because npe_tick is the only
+	 * code that talks via the mailbox's (except at setup).
+	 * This likely can be handled better.
+	 */
 	if (ixpnpe_recvmsg(sc->sc_npe, msg) == 0 && msg[0] == ACK) {
 		bus_dmamap_sync(sc->sc_stats_tag, sc->sc_stats_map,
 		    BUS_DMASYNC_POSTREAD);
@@ -822,9 +855,9 @@
  * Q manager callback on tx done queue.  Reap mbufs
  * and return tx buffers to the free list.  Finally
  * restart output.  Note the microcode has only one
- * txdone q wired into it so we must use the port id
- * returned with each npebuf to decide where to send
- * buffers.
+ * txdone q wired into it so we must use the NPE ID
+ * returned with each npehwbuf to decide where to
+ * send buffers.
  */
 static void
 npe_txdone(int qid, void *arg)
@@ -1021,7 +1054,7 @@
 	struct ifnet *ifp = sc->sc_ifp;
 
 	NPE_ASSERT_LOCKED(sc);
-if (ifp->if_drv_flags & IFF_DRV_RUNNING) return;
+if (ifp->if_drv_flags & IFF_DRV_RUNNING) return;/*XXX*/
 
 	/*
 	 * Reset MAC core.
@@ -1177,7 +1210,7 @@
 }
 
 /*
- * dequeu packets and transmit
+ * Dequeue packets and place on the h/w transmit queue.
  */
 static void
 npestart_locked(struct ifnet *ifp)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200611121740.kACHeYMn047064>