Lines Matching full:adapter

42 	struct ena_adapter *adapter;  member
82 ena_netmap_attach(struct ena_adapter *adapter) in ena_netmap_attach() argument
86 ena_log_nm(adapter->pdev, INFO, "netmap attach\n"); in ena_netmap_attach()
90 na.ifp = adapter->ifp; in ena_netmap_attach()
91 na.num_tx_desc = adapter->requested_tx_ring_size; in ena_netmap_attach()
92 na.num_rx_desc = adapter->requested_rx_ring_size; in ena_netmap_attach()
93 na.num_tx_rings = adapter->num_io_queues; in ena_netmap_attach()
94 na.num_rx_rings = adapter->num_io_queues; in ena_netmap_attach()
95 na.rx_buf_maxsize = adapter->buf_ring_size; in ena_netmap_attach()
104 ena_netmap_alloc_rx_slot(struct ena_adapter *adapter, struct ena_ring *rx_ring, in ena_netmap_alloc_rx_slot() argument
107 struct netmap_adapter *na = NA(adapter->ifp); in ena_netmap_alloc_rx_slot()
124 ena_log_nm(adapter->pdev, DBG, in ena_netmap_alloc_rx_slot()
130 ena_log_nm(adapter->pdev, ERR, in ena_netmap_alloc_rx_slot()
137 ena_log_nm(adapter->pdev, ERR, "Rx ring %d is NULL\n", qid); in ena_netmap_alloc_rx_slot()
144 ena_log_nm(adapter->pdev, ERR, "Bad buff in slot\n"); in ena_netmap_alloc_rx_slot()
148 rc = netmap_load_map(na, adapter->rx_buf_tag, rx_info->map, addr); in ena_netmap_alloc_rx_slot()
150 ena_log_nm(adapter->pdev, WARN, "DMA mapping error\n"); in ena_netmap_alloc_rx_slot()
153 bus_dmamap_sync(adapter->rx_buf_tag, rx_info->map, BUS_DMASYNC_PREREAD); in ena_netmap_alloc_rx_slot()
169 ena_netmap_free_rx_slot(struct ena_adapter *adapter, struct ena_ring *rx_ring, in ena_netmap_free_rx_slot() argument
177 na = NA(adapter->ifp); in ena_netmap_free_rx_slot()
179 ena_log_nm(adapter->pdev, ERR, "netmap adapter is NULL\n"); in ena_netmap_free_rx_slot()
184 ena_log_nm(adapter->pdev, ERR, "netmap rings are NULL\n"); in ena_netmap_free_rx_slot()
191 ena_log_nm(adapter->pdev, ERR, in ena_netmap_free_rx_slot()
202 bus_dmamap_sync(adapter->rx_buf_tag, rx_info->map, in ena_netmap_free_rx_slot()
204 netmap_unload_map(na, adapter->rx_buf_tag, rx_info->map); in ena_netmap_free_rx_slot()
210 ENA_WARN(slot->buf_idx != 0, adapter->ena_dev, "Overwrite slot buf\n"); in ena_netmap_free_rx_slot()
219 ena_ring_in_netmap(struct ena_adapter *adapter, int qid, enum txrx x) in ena_ring_in_netmap() argument
224 if (if_getcapenable(adapter->ifp) & IFCAP_NETMAP) { in ena_ring_in_netmap()
225 na = NA(adapter->ifp); in ena_ring_in_netmap()
234 ena_tx_ring_in_netmap(struct ena_adapter *adapter, int qid) in ena_tx_ring_in_netmap() argument
236 return ena_ring_in_netmap(adapter, qid, NR_TX); in ena_tx_ring_in_netmap()
240 ena_rx_ring_in_netmap(struct ena_adapter *adapter, int qid) in ena_rx_ring_in_netmap() argument
242 return ena_ring_in_netmap(adapter, qid, NR_RX); in ena_rx_ring_in_netmap()
246 ena_netmap_reset_ring(struct ena_adapter *adapter, int qid, enum txrx x) in ena_netmap_reset_ring() argument
248 if (!ena_ring_in_netmap(adapter, qid, x)) in ena_netmap_reset_ring()
251 netmap_reset(NA(adapter->ifp), x, qid, 0); in ena_netmap_reset_ring()
252 ena_log_nm(adapter->pdev, INFO, "%s ring %d is in netmap mode\n", in ena_netmap_reset_ring()
257 ena_netmap_reset_rx_ring(struct ena_adapter *adapter, int qid) in ena_netmap_reset_rx_ring() argument
259 ena_netmap_reset_ring(adapter, qid, NR_RX); in ena_netmap_reset_rx_ring()
263 ena_netmap_reset_tx_ring(struct ena_adapter *adapter, int qid) in ena_netmap_reset_tx_ring() argument
265 ena_netmap_reset_ring(adapter, qid, NR_TX); in ena_netmap_reset_tx_ring()
272 struct ena_adapter *adapter = if_getsoftc(ifp); in ena_netmap_reg() local
273 device_t pdev = adapter->pdev; in ena_netmap_reg()
279 ENA_FLAG_CLEAR_ATOMIC(ENA_FLAG_TRIGGER_RESET, adapter); in ena_netmap_reg()
280 ena_down(adapter); in ena_netmap_reg()
306 rc = ena_up(adapter); in ena_netmap_reg()
309 adapter->reset_reason = ENA_REGS_RESET_DRIVER_INVALID_STATE; in ena_netmap_reg()
311 ena_destroy_device(adapter, false); in ena_netmap_reg()
312 ENA_FLAG_SET_ATOMIC(ENA_FLAG_DEV_UP_BEFORE_RESET, adapter); in ena_netmap_reg()
313 rc = ena_restore_device(adapter); in ena_netmap_reg()
327 ctx.ring = &ctx.adapter->tx_ring[kring->ring_id]; in ena_netmap_txsync()
330 if (unlikely(!ENA_FLAG_ISSET(ENA_FLAG_DEV_UP, ctx.adapter))) in ena_netmap_txsync()
333 if (unlikely(!ENA_FLAG_ISSET(ENA_FLAG_LINK_UP, ctx.adapter))) in ena_netmap_txsync()
388 struct ena_adapter *adapter; in ena_netmap_tx_frame() local
398 adapter = ctx->adapter; in ena_netmap_tx_frame()
399 if (ena_netmap_count_slots(ctx) > adapter->max_tx_sgl_size) { in ena_netmap_tx_frame()
400 ena_log_nm(adapter->pdev, WARN, "Too many slots per packet\n"); in ena_netmap_tx_frame()
414 ena_log_nm(adapter->pdev, ERR, "Failed to map Tx slot\n"); in ena_netmap_tx_frame()
424 ena_tx_ctx.meta_valid = adapter->disable_meta_caching; in ena_netmap_tx_frame()
435 ena_log_nm(adapter->pdev, DBG, in ena_netmap_tx_frame()
438 ena_log_nm(adapter->pdev, ERR, in ena_netmap_tx_frame()
440 ena_trigger_reset(adapter, in ena_netmap_tx_frame()
452 counter_u64_add_protected(adapter->hw_stats.tx_packets, 1); in ena_netmap_tx_frame()
453 counter_u64_add_protected(adapter->hw_stats.tx_bytes, packet_len); in ena_netmap_tx_frame()
461 bus_dmamap_sync(adapter->tx_buf_tag, in ena_netmap_tx_frame()
553 struct ena_adapter *adapter; in ena_netmap_tx_map_slots() local
567 adapter = ctx->adapter; in ena_netmap_tx_map_slots()
599 ena_log_nm(adapter->pdev, ERR, in ena_netmap_tx_map_slots()
612 ena_log_nm(adapter->pdev, ERR, in ena_netmap_tx_map_slots()
623 ena_log_nm(adapter->pdev, DBG, in ena_netmap_tx_map_slots()
633 adapter->tx_buf_tag, *nm_maps, &vaddr, &paddr); in ena_netmap_tx_map_slots()
635 ena_log_nm(adapter->pdev, ERR, in ena_netmap_tx_map_slots()
682 adapter->tx_buf_tag, *nm_maps, &vaddr, in ena_netmap_tx_map_slots()
685 ena_log_nm(adapter->pdev, ERR, in ena_netmap_tx_map_slots()
728 adapter->tx_buf_tag, *nm_maps, &vaddr, &paddr); in ena_netmap_tx_map_slots()
730 ena_log_nm(adapter->pdev, ERR, "DMA mapping error\n"); in ena_netmap_tx_map_slots()
778 netmap_unload_map(ctx->na, ctx->adapter->tx_buf_tag, in ena_netmap_unmap_last_socket_chain()
844 netmap_unload_map(ctx->na, ctx->adapter->tx_buf_tag, in ena_netmap_tx_clean_one()
853 ctx->adapter->ena_dev, "Tx idx is not 0.\n"); in ena_netmap_tx_clean_one()
873 ctx.ring = &ctx.adapter->rx_ring[kring->ring_id]; in ena_netmap_rxsync()
883 if (unlikely(!ENA_FLAG_ISSET(ENA_FLAG_LINK_UP, ctx.adapter))) in ena_netmap_rxsync()
908 ena_log_nm(ctx->adapter->pdev, ERR, in ena_netmap_rx_frames()
930 ena_rx_ctx.max_bufs = ctx->adapter->max_rx_sgl_size; in ena_netmap_rx_frame()
936 ena_log_nm(ctx->adapter->pdev, ERR, in ena_netmap_rx_frame()
947 ena_trigger_reset(ctx->adapter, reset_reason); in ena_netmap_rx_frame()
953 ena_log_nm(ctx->adapter->pdev, DBG, in ena_netmap_rx_frame()
978 counter_u64_add_protected(ctx->adapter->hw_stats.rx_bytes, len); in ena_netmap_rx_frame()
980 counter_u64_add_protected(ctx->adapter->hw_stats.rx_packets, 1); in ena_netmap_rx_frame()
1006 bus_dmamap_sync(ctx->adapter->rx_buf_tag, rx_info->map, in ena_netmap_rx_load_desc()
1008 netmap_unload_map(ctx->na, ctx->adapter->rx_buf_tag, rx_info->map); in ena_netmap_rx_load_desc()
1010 ENA_WARN(ctx->slots[ctx->nm_i].buf_idx != 0, ctx->adapter->ena_dev, in ena_netmap_rx_load_desc()
1023 ena_log_nm(ctx->adapter->pdev, DBG, in ena_netmap_rx_load_desc()
1057 ctx->adapter = if_getsoftc(ctx->na->ifp); in ena_netmap_fill_ctx()
1059 ctx->io_cq = &ctx->adapter->ena_dev->io_cq_queues[ena_qid]; in ena_netmap_fill_ctx()
1060 ctx->io_sq = &ctx->adapter->ena_dev->io_sq_queues[ena_qid]; in ena_netmap_fill_ctx()
1065 ena_netmap_unload(struct ena_adapter *adapter, bus_dmamap_t map) in ena_netmap_unload() argument
1067 struct netmap_adapter *na = NA(adapter->ifp); in ena_netmap_unload()
1069 netmap_unload_map(na, adapter->tx_buf_tag, map); in ena_netmap_unload()