socsvn commit: r304510 - soc2016/vincenzo/head/sys/dev/netmap
vincenzo at FreeBSD.org
vincenzo at FreeBSD.org
Fri Jun 3 14:07:24 UTC 2016
Author: vincenzo
Date: Fri Jun 3 14:07:23 2016
New Revision: 304510
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304510
Log:
freebsd: ptnet_queue: add ptring and kick fields
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 3 14:07:08 2016 (r304509)
+++ soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c Fri Jun 3 14:07:23 2016 (r304510)
@@ -92,6 +92,8 @@
struct resource *irq;
void *cookie;
int kring_id;
+ struct ptnet_ring *ptring;
+ unsigned int kick;
};
struct ptnet_softc {
@@ -231,11 +233,29 @@
}
sc->ptfeatures = ptfeatures;
+ /* Allocate CSB and carry out CSB allocation protocol (CSBBAH first,
+ * then CSBBAL). */
+ sc->csb = malloc(sizeof(struct ptnet_csb), M_DEVBUF,
+ M_NOWAIT | M_ZERO);
+ if (sc->csb == NULL) {
+ device_printf(dev, "Failed to allocate CSB\n");
+ err = ENOMEM;
+ goto err_path;
+ }
+
+ {
+ vm_paddr_t paddr = vtophys(sc->csb);
+
+ bus_write_4(sc->iomem, PTNET_IO_CSBBAH,
+ (paddr >> 32) & 0xffffffff);
+ bus_write_4(sc->iomem, PTNET_IO_CSBBAL, paddr & 0xffffffff);
+ }
+
num_tx_rings = bus_read_4(sc->iomem, PTNET_IO_NUM_TX_RINGS);
num_rx_rings = bus_read_4(sc->iomem, PTNET_IO_NUM_RX_RINGS);
sc->num_rings = num_tx_rings + num_rx_rings;
- /* Allocate per-queue data structures. */
+ /* Allocate and initialize per-queue data structures. */
sc->queues = malloc(sizeof(struct ptnet_queue) * sc->num_rings,
M_DEVBUF, M_NOWAIT | M_ZERO);
if (sc->queues == NULL) {
@@ -248,29 +268,13 @@
pq->sc = sc;
pq->kring_id = i;
+ pq->kick = PTNET_IO_KICK_BASE + 4 * i;
+ pq->ptring = sc->csb->rings + i;
if (i >= num_tx_rings) {
pq->kring_id -= num_tx_rings;
}
}
- /* Allocate CSB and carry out CSB allocation protocol (CSBBAH first,
- * then CSBBAL). */
- sc->csb = malloc(sizeof(struct ptnet_csb), M_DEVBUF,
- M_NOWAIT | M_ZERO);
- if (sc->csb == NULL) {
- device_printf(dev, "Failed to allocate CSB\n");
- err = ENOMEM;
- goto err_path;
- }
-
- {
- vm_paddr_t paddr = vtophys(sc->csb);
-
- bus_write_4(sc->iomem, PTNET_IO_CSBBAH,
- (paddr >> 32) & 0xffffffff);
- bus_write_4(sc->iomem, PTNET_IO_CSBBAL, paddr & 0xffffffff);
- }
-
err = ptnet_irqs_init(sc);
if (err) {
goto err_path;
More information about the svn-soc-all
mailing list