socsvn commit: r305290 - soc2016/vincenzo/head/sys/dev/netmap

vincenzo at FreeBSD.org vincenzo at FreeBSD.org
Fri Jun 17 16:22:29 UTC 2016


Author: vincenzo
Date: Fri Jun 17 16:22:28 2016
New Revision: 305290
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=305290

Log:
   freebsd: ptnet_tx_intr: update hwcur/hwtail from host

Modified:
  soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c

Modified: soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c
==============================================================================
--- soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c	Fri Jun 17 16:22:19 2016	(r305289)
+++ soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c	Fri Jun 17 16:22:28 2016	(r305290)
@@ -105,8 +105,8 @@
 	char			lock_name[16];
 };
 
-#define PTNET_Q_LOCK(_pq)	mtx_lock(&(_pq_->lock)
-#define PTNET_Q_UNLOCK(_pq)	mtx_unlock(&(_pq_->lock)
+#define PTNET_Q_LOCK(_pq)	mtx_lock(&(_pq)->lock)
+#define PTNET_Q_UNLOCK(_pq)	mtx_unlock(&(_pq)->lock)
 
 struct ptnet_softc {
 	device_t		dev;
@@ -743,14 +743,18 @@
 
 	pq = sc->queues + 0;
 	ptring = pq->ptring;
-	kring = na->tx_rings + 0;
+	kring = na->tx_rings + pq->kring_id;
 	ring = kring->ring;
 	lim = kring->nkr_num_slots - 1;
 
+	PTNET_Q_LOCK(pq);
+
 	/* Update hwcur and hwtail (completed TX slots) as known by the host,
 	 * by reading from CSB. */
 	ptnet_sync_tail(ptring, kring);
 
+	PTNET_Q_UNLOCK(pq);
+
 	head = ring->head;
 	slot = ring->slot + head;
 	nmbuf = NMB(na, slot);
@@ -1100,12 +1104,21 @@
 {
 	struct ptnet_queue *pq = opaque;
 	struct ptnet_softc *sc = pq->sc;
+	struct netmap_adapter *na_dr = &sc->ptna_dr.hwup.up;
 
 	DBG(device_printf(sc->dev, "Tx interrupt #%d\n", pq->kring_id));
 
+	if (!(sc->ifp->if_drv_flags & IFF_DRV_RUNNING)) {
+		return;
+	}
+
 	if (netmap_tx_irq(sc->ifp, pq->kring_id) != NM_IRQ_PASS) {
 		return;
 	}
+
+	PTNET_Q_LOCK(pq);
+	ptnet_sync_tail(pq->ptring, na_dr->tx_rings + pq->kring_id);
+	PTNET_Q_UNLOCK(pq);
 }
 
 static void
@@ -1117,6 +1130,10 @@
 
 	DBG(device_printf(sc->dev, "Rx interrupt #%d\n", pq->kring_id));
 
+	if (!(sc->ifp->if_drv_flags & IFF_DRV_RUNNING)) {
+		return;
+	}
+
 	if (netmap_rx_irq(sc->ifp, pq->kring_id, &unused) != NM_IRQ_PASS) {
 		return;
 	}


More information about the svn-soc-all mailing list