Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/ena/ena.c
Show First 20 Lines • Show All 74 Lines • ▼ Show 20 Lines | |||||
#include <vm/vm.h> | #include <vm/vm.h> | ||||
#include <vm/pmap.h> | #include <vm/pmap.h> | ||||
#include "ena_datapath.h" | #include "ena_datapath.h" | ||||
#include "ena.h" | #include "ena.h" | ||||
#include "ena_sysctl.h" | #include "ena_sysctl.h" | ||||
#ifdef DEV_NETMAP | |||||
#include "ena_netmap.h" | |||||
#endif /* DEV_NETMAP */ | |||||
/********************************************************* | /********************************************************* | ||||
* Function prototypes | * Function prototypes | ||||
*********************************************************/ | *********************************************************/ | ||||
static int ena_probe(device_t); | static int ena_probe(device_t); | ||||
static void ena_intr_msix_mgmnt(void *); | static void ena_intr_msix_mgmnt(void *); | ||||
static void ena_free_pci_resources(struct ena_adapter *); | static void ena_free_pci_resources(struct ena_adapter *); | ||||
static int ena_change_mtu(if_t, int); | static int ena_change_mtu(if_t, int); | ||||
static inline void ena_alloc_counters(counter_u64_t *, int); | static inline void ena_alloc_counters(counter_u64_t *, int); | ||||
▲ Show 20 Lines • Show All 1,982 Lines • ▼ Show 20 Lines | |||||
/* Initialize statistics */ | /* Initialize statistics */ | ||||
ena_alloc_counters((counter_u64_t *)&adapter->dev_stats, | ena_alloc_counters((counter_u64_t *)&adapter->dev_stats, | ||||
sizeof(struct ena_stats_dev)); | sizeof(struct ena_stats_dev)); | ||||
ena_alloc_counters((counter_u64_t *)&adapter->hw_stats, | ena_alloc_counters((counter_u64_t *)&adapter->hw_stats, | ||||
sizeof(struct ena_hw_stats)); | sizeof(struct ena_hw_stats)); | ||||
ena_sysctl_add_nodes(adapter); | ena_sysctl_add_nodes(adapter); | ||||
#ifdef DEV_NETMAP | |||||
rc = ena_netmap_attach(adapter); | |||||
if (rc != 0) { | |||||
device_printf(pdev, "netmap attach failed: %d\n", rc); | |||||
goto err_detach; | |||||
} | |||||
#endif /* DEV_NETMAP */ | |||||
/* Tell the stack that the interface is not active */ | /* Tell the stack that the interface is not active */ | ||||
if_setdrvflagbits(adapter->ifp, IFF_DRV_OACTIVE, IFF_DRV_RUNNING); | if_setdrvflagbits(adapter->ifp, IFF_DRV_OACTIVE, IFF_DRV_RUNNING); | ||||
ENA_FLAG_SET_ATOMIC(ENA_FLAG_DEVICE_RUNNING, adapter); | ENA_FLAG_SET_ATOMIC(ENA_FLAG_DEVICE_RUNNING, adapter); | ||||
return (0); | return (0); | ||||
#ifdef DEV_NETMAP | |||||
err_detach: | |||||
ether_ifdetach(adapter->ifp); | |||||
#endif /* DEV_NETMAP */ | |||||
err_msix_free: | err_msix_free: | ||||
ena_com_dev_reset(adapter->ena_dev, ENA_REGS_RESET_INIT_ERR); | ena_com_dev_reset(adapter->ena_dev, ENA_REGS_RESET_INIT_ERR); | ||||
ena_free_mgmnt_irq(adapter); | ena_free_mgmnt_irq(adapter); | ||||
ena_disable_msix(adapter); | ena_disable_msix(adapter); | ||||
err_io_free: | err_io_free: | ||||
ena_free_all_io_rings_resources(adapter); | ena_free_all_io_rings_resources(adapter); | ||||
ena_free_rx_dma_tag(adapter); | ena_free_rx_dma_tag(adapter); | ||||
err_tx_tag_free: | err_tx_tag_free: | ||||
Show All 39 Lines | |||||
taskqueue_drain(adapter->reset_tq, &adapter->reset_task); | taskqueue_drain(adapter->reset_tq, &adapter->reset_task); | ||||
taskqueue_free(adapter->reset_tq); | taskqueue_free(adapter->reset_tq); | ||||
sx_xlock(&adapter->ioctl_sx); | sx_xlock(&adapter->ioctl_sx); | ||||
ena_down(adapter); | ena_down(adapter); | ||||
ena_destroy_device(adapter, true); | ena_destroy_device(adapter, true); | ||||
sx_unlock(&adapter->ioctl_sx); | sx_unlock(&adapter->ioctl_sx); | ||||
#ifdef DEV_NETMAP | |||||
netmap_detach(adapter->ifp); | |||||
#endif /* DEV_NETMAP */ | |||||
ena_free_all_io_rings_resources(adapter); | ena_free_all_io_rings_resources(adapter); | ||||
ena_free_counters((counter_u64_t *)&adapter->hw_stats, | ena_free_counters((counter_u64_t *)&adapter->hw_stats, | ||||
sizeof(struct ena_hw_stats)); | sizeof(struct ena_hw_stats)); | ||||
ena_free_counters((counter_u64_t *)&adapter->dev_stats, | ena_free_counters((counter_u64_t *)&adapter->dev_stats, | ||||
sizeof(struct ena_stats_dev)); | sizeof(struct ena_stats_dev)); | ||||
rc = ena_free_rx_dma_tag(adapter); | rc = ena_free_rx_dma_tag(adapter); | ||||
▲ Show 20 Lines • Show All 137 Lines • Show Last 20 Lines |