| 1285 | } |
| 1286 | |
| 1287 | static int |
| 1288 | iflib_netmap_txq_init(if_ctx_t ctx, iflib_txq_t txq) |
| 1289 | { |
| 1290 | struct netmap_adapter *na = NA(ctx->ifc_ifp); |
| 1291 | struct netmap_slot *slot; |
| 1292 | |
| 1293 | slot = netmap_reset(na, NR_TX, txq->ift_id, 0); |
| 1294 | if (slot == NULL) |
| 1295 | return (0); |
| 1296 | for (int i = 0; i < ctx->ifc_softc_ctx.isc_ntxd[0]; i++) { |
| 1297 | /* |
| 1298 | * In netmap mode, set the map for the packet buffer. |
| 1299 | * NOTE: Some drivers (not this one) also need to set |
| 1300 | * the physical buffer address in the NIC ring. |
| 1301 | * netmap_idx_n2k() maps a nic index, i, into the corresponding |
| 1302 | * netmap slot index, si |
| 1303 | */ |
| 1304 | int si = netmap_idx_n2k(na->tx_rings[txq->ift_id], i); |
| 1305 | netmap_load_map(na, txq->ift_buf_tag, txq->ift_sds.ifsd_map[i], |
| 1306 | NMB(na, slot + si)); |
| 1307 | } |
| 1308 | return (1); |
| 1309 | } |
| 1310 | |
| 1311 | static int |
| 1312 | iflib_netmap_rxq_init(if_ctx_t ctx, iflib_rxq_t rxq) |