Changeset View
Changeset View
Standalone View
Standalone View
head/sys/net/iflib.c
Show First 20 Lines • Show All 997 Lines • ▼ Show 20 Lines | |||||
static void | static void | ||||
iflib_netmap_txq_init(if_ctx_t ctx, iflib_txq_t txq) | iflib_netmap_txq_init(if_ctx_t ctx, iflib_txq_t txq) | ||||
{ | { | ||||
struct netmap_adapter *na = NA(ctx->ifc_ifp); | struct netmap_adapter *na = NA(ctx->ifc_ifp); | ||||
struct netmap_slot *slot; | struct netmap_slot *slot; | ||||
slot = netmap_reset(na, NR_TX, txq->ift_id, 0); | slot = netmap_reset(na, NR_TX, txq->ift_id, 0); | ||||
if (slot == 0) | if (slot == NULL) | ||||
return; | return; | ||||
for (int i = 0; i < ctx->ifc_softc_ctx.isc_ntxd[0]; i++) { | for (int i = 0; i < ctx->ifc_softc_ctx.isc_ntxd[0]; i++) { | ||||
/* | /* | ||||
* In netmap mode, set the map for the packet buffer. | * In netmap mode, set the map for the packet buffer. | ||||
* NOTE: Some drivers (not this one) also need to set | * NOTE: Some drivers (not this one) also need to set | ||||
* the physical buffer address in the NIC ring. | * the physical buffer address in the NIC ring. | ||||
* netmap_idx_n2k() maps a nic index, i, into the corresponding | * netmap_idx_n2k() maps a nic index, i, into the corresponding | ||||
* netmap slot index, si | * netmap slot index, si | ||||
*/ | */ | ||||
int si = netmap_idx_n2k(&na->tx_rings[txq->ift_id], i); | int si = netmap_idx_n2k(&na->tx_rings[txq->ift_id], i); | ||||
netmap_load_map(na, txq->ift_desc_tag, txq->ift_sds.ifsd_map[i], NMB(na, slot + si)); | netmap_load_map(na, txq->ift_desc_tag, txq->ift_sds.ifsd_map[i], NMB(na, slot + si)); | ||||
} | } | ||||
} | } | ||||
static void | static void | ||||
iflib_netmap_rxq_init(if_ctx_t ctx, iflib_rxq_t rxq) | iflib_netmap_rxq_init(if_ctx_t ctx, iflib_rxq_t rxq) | ||||
{ | { | ||||
struct netmap_adapter *na = NA(ctx->ifc_ifp); | struct netmap_adapter *na = NA(ctx->ifc_ifp); | ||||
struct netmap_slot *slot; | struct netmap_slot *slot; | ||||
bus_dmamap_t *map; | bus_dmamap_t *map; | ||||
int nrxd; | int nrxd; | ||||
slot = netmap_reset(na, NR_RX, rxq->ifr_id, 0); | slot = netmap_reset(na, NR_RX, rxq->ifr_id, 0); | ||||
if (slot == 0) | if (slot == NULL) | ||||
return; | return; | ||||
map = rxq->ifr_fl[0].ifl_sds.ifsd_map; | map = rxq->ifr_fl[0].ifl_sds.ifsd_map; | ||||
nrxd = ctx->ifc_softc_ctx.isc_nrxd[0]; | nrxd = ctx->ifc_softc_ctx.isc_nrxd[0]; | ||||
for (int i = 0; i < nrxd; i++, map++) { | for (int i = 0; i < nrxd; i++, map++) { | ||||
int sj = netmap_idx_n2k(&na->rx_rings[rxq->ifr_id], i); | int sj = netmap_idx_n2k(&na->rx_rings[rxq->ifr_id], i); | ||||
uint64_t paddr; | uint64_t paddr; | ||||
void *addr; | void *addr; | ||||
caddr_t vaddr; | caddr_t vaddr; | ||||
▲ Show 20 Lines • Show All 4,205 Lines • Show Last 20 Lines |