11738cd3eSNetanel Belgazal /* 21738cd3eSNetanel Belgazal * Copyright 2015 Amazon.com, Inc. or its affiliates. 31738cd3eSNetanel Belgazal * 41738cd3eSNetanel Belgazal * This software is available to you under a choice of one of two 51738cd3eSNetanel Belgazal * licenses. You may choose to be licensed under the terms of the GNU 61738cd3eSNetanel Belgazal * General Public License (GPL) Version 2, available from the file 71738cd3eSNetanel Belgazal * COPYING in the main directory of this source tree, or the 81738cd3eSNetanel Belgazal * BSD license below: 91738cd3eSNetanel Belgazal * 101738cd3eSNetanel Belgazal * Redistribution and use in source and binary forms, with or 111738cd3eSNetanel Belgazal * without modification, are permitted provided that the following 121738cd3eSNetanel Belgazal * conditions are met: 131738cd3eSNetanel Belgazal * 141738cd3eSNetanel Belgazal * - Redistributions of source code must retain the above 151738cd3eSNetanel Belgazal * copyright notice, this list of conditions and the following 161738cd3eSNetanel Belgazal * disclaimer. 171738cd3eSNetanel Belgazal * 181738cd3eSNetanel Belgazal * - Redistributions in binary form must reproduce the above 191738cd3eSNetanel Belgazal * copyright notice, this list of conditions and the following 201738cd3eSNetanel Belgazal * disclaimer in the documentation and/or other materials 211738cd3eSNetanel Belgazal * provided with the distribution. 221738cd3eSNetanel Belgazal * 231738cd3eSNetanel Belgazal * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 241738cd3eSNetanel Belgazal * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 251738cd3eSNetanel Belgazal * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 261738cd3eSNetanel Belgazal * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 271738cd3eSNetanel Belgazal * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 281738cd3eSNetanel Belgazal * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 291738cd3eSNetanel Belgazal * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 301738cd3eSNetanel Belgazal * SOFTWARE. 311738cd3eSNetanel Belgazal */ 321738cd3eSNetanel Belgazal 331738cd3eSNetanel Belgazal #ifndef ENA_H 341738cd3eSNetanel Belgazal #define ENA_H 351738cd3eSNetanel Belgazal 361738cd3eSNetanel Belgazal #include <linux/bitops.h> 371738cd3eSNetanel Belgazal #include <linux/etherdevice.h> 381738cd3eSNetanel Belgazal #include <linux/inetdevice.h> 391738cd3eSNetanel Belgazal #include <linux/interrupt.h> 401738cd3eSNetanel Belgazal #include <linux/netdevice.h> 411738cd3eSNetanel Belgazal #include <linux/skbuff.h> 421738cd3eSNetanel Belgazal 431738cd3eSNetanel Belgazal #include "ena_com.h" 441738cd3eSNetanel Belgazal #include "ena_eth_com.h" 451738cd3eSNetanel Belgazal 461738cd3eSNetanel Belgazal #define DRV_MODULE_VER_MAJOR 1 4770097445SNetanel Belgazal #define DRV_MODULE_VER_MINOR 5 4885238999SNetanel Belgazal #define DRV_MODULE_VER_SUBMINOR 0 491738cd3eSNetanel Belgazal 501738cd3eSNetanel Belgazal #define DRV_MODULE_NAME "ena" 511738cd3eSNetanel Belgazal #ifndef DRV_MODULE_VERSION 521738cd3eSNetanel Belgazal #define DRV_MODULE_VERSION \ 531738cd3eSNetanel Belgazal __stringify(DRV_MODULE_VER_MAJOR) "." \ 541738cd3eSNetanel Belgazal __stringify(DRV_MODULE_VER_MINOR) "." \ 55046b3071SNetanel Belgazal __stringify(DRV_MODULE_VER_SUBMINOR) "K" 561738cd3eSNetanel Belgazal #endif 571738cd3eSNetanel Belgazal 581738cd3eSNetanel Belgazal #define DEVICE_NAME "Elastic Network Adapter (ENA)" 591738cd3eSNetanel Belgazal 601738cd3eSNetanel Belgazal /* 1 for AENQ + ADMIN */ 6106443684SNetanel Belgazal #define ENA_ADMIN_MSIX_VEC 1 6206443684SNetanel Belgazal #define ENA_MAX_MSIX_VEC(io_queues) (ENA_ADMIN_MSIX_VEC + (io_queues)) 6306443684SNetanel Belgazal 64*bd791175SArthur Kiyanovski /* The ENA buffer length fields is 16 bit long. So when PAGE_SIZE == 64kB the 65*bd791175SArthur Kiyanovski * driver passes 0. 66*bd791175SArthur Kiyanovski * Since the max packet size the ENA handles is ~9kB limit the buffer length to 67*bd791175SArthur Kiyanovski * 16kB. 68*bd791175SArthur Kiyanovski */ 69*bd791175SArthur Kiyanovski #if PAGE_SIZE > SZ_16K 70*bd791175SArthur Kiyanovski #define ENA_PAGE_SIZE SZ_16K 71*bd791175SArthur Kiyanovski #else 72*bd791175SArthur Kiyanovski #define ENA_PAGE_SIZE PAGE_SIZE 73*bd791175SArthur Kiyanovski #endif 74*bd791175SArthur Kiyanovski 7506443684SNetanel Belgazal #define ENA_MIN_MSIX_VEC 2 761738cd3eSNetanel Belgazal 771738cd3eSNetanel Belgazal #define ENA_REG_BAR 0 781738cd3eSNetanel Belgazal #define ENA_MEM_BAR 2 791738cd3eSNetanel Belgazal #define ENA_BAR_MASK (BIT(ENA_REG_BAR) | BIT(ENA_MEM_BAR)) 801738cd3eSNetanel Belgazal 811738cd3eSNetanel Belgazal #define ENA_DEFAULT_RING_SIZE (1024) 821738cd3eSNetanel Belgazal 831738cd3eSNetanel Belgazal #define ENA_TX_WAKEUP_THRESH (MAX_SKB_FRAGS + 2) 841738cd3eSNetanel Belgazal #define ENA_DEFAULT_RX_COPYBREAK (128 - NET_IP_ALIGN) 851738cd3eSNetanel Belgazal 861738cd3eSNetanel Belgazal /* limit the buffer size to 600 bytes to handle MTU changes from very 871738cd3eSNetanel Belgazal * small to very large, in which case the number of buffers per packet 881738cd3eSNetanel Belgazal * could exceed ENA_PKT_MAX_BUFS 891738cd3eSNetanel Belgazal */ 901738cd3eSNetanel Belgazal #define ENA_DEFAULT_MIN_RX_BUFF_ALLOC_SIZE 600 911738cd3eSNetanel Belgazal 921738cd3eSNetanel Belgazal #define ENA_MIN_MTU 128 931738cd3eSNetanel Belgazal 941738cd3eSNetanel Belgazal #define ENA_NAME_MAX_LEN 20 951738cd3eSNetanel Belgazal #define ENA_IRQNAME_SIZE 40 961738cd3eSNetanel Belgazal 971738cd3eSNetanel Belgazal #define ENA_PKT_MAX_BUFS 19 981738cd3eSNetanel Belgazal 991738cd3eSNetanel Belgazal #define ENA_RX_RSS_TABLE_LOG_SIZE 7 1001738cd3eSNetanel Belgazal #define ENA_RX_RSS_TABLE_SIZE (1 << ENA_RX_RSS_TABLE_LOG_SIZE) 1011738cd3eSNetanel Belgazal 1021738cd3eSNetanel Belgazal #define ENA_HASH_KEY_SIZE 40 1031738cd3eSNetanel Belgazal 1041738cd3eSNetanel Belgazal /* The number of tx packet completions that will be handled each NAPI poll 1051738cd3eSNetanel Belgazal * cycle is ring_size / ENA_TX_POLL_BUDGET_DIVIDER. 1061738cd3eSNetanel Belgazal */ 1071738cd3eSNetanel Belgazal #define ENA_TX_POLL_BUDGET_DIVIDER 4 1081738cd3eSNetanel Belgazal 1091738cd3eSNetanel Belgazal /* Refill Rx queue when number of available descriptors is below 1101738cd3eSNetanel Belgazal * QUEUE_SIZE / ENA_RX_REFILL_THRESH_DIVIDER 1111738cd3eSNetanel Belgazal */ 1121738cd3eSNetanel Belgazal #define ENA_RX_REFILL_THRESH_DIVIDER 8 1131738cd3eSNetanel Belgazal 1141738cd3eSNetanel Belgazal /* Number of queues to check for missing queues per timer service */ 1151738cd3eSNetanel Belgazal #define ENA_MONITORED_TX_QUEUES 4 1161738cd3eSNetanel Belgazal /* Max timeout packets before device reset */ 1177102a18aSNetanel Belgazal #define MAX_NUM_OF_TIMEOUTED_PACKETS 128 1181738cd3eSNetanel Belgazal 1191738cd3eSNetanel Belgazal #define ENA_TX_RING_IDX_NEXT(idx, ring_size) (((idx) + 1) & ((ring_size) - 1)) 1201738cd3eSNetanel Belgazal 1211738cd3eSNetanel Belgazal #define ENA_RX_RING_IDX_NEXT(idx, ring_size) (((idx) + 1) & ((ring_size) - 1)) 1221738cd3eSNetanel Belgazal #define ENA_RX_RING_IDX_ADD(idx, n, ring_size) \ 1231738cd3eSNetanel Belgazal (((idx) + (n)) & ((ring_size) - 1)) 1241738cd3eSNetanel Belgazal 1251738cd3eSNetanel Belgazal #define ENA_IO_TXQ_IDX(q) (2 * (q)) 1261738cd3eSNetanel Belgazal #define ENA_IO_RXQ_IDX(q) (2 * (q) + 1) 1271738cd3eSNetanel Belgazal 1281738cd3eSNetanel Belgazal #define ENA_MGMNT_IRQ_IDX 0 1291738cd3eSNetanel Belgazal #define ENA_IO_IRQ_FIRST_IDX 1 1301738cd3eSNetanel Belgazal #define ENA_IO_IRQ_IDX(q) (ENA_IO_IRQ_FIRST_IDX + (q)) 1311738cd3eSNetanel Belgazal 1321738cd3eSNetanel Belgazal /* ENA device should send keep alive msg every 1 sec. 1337102a18aSNetanel Belgazal * We wait for 6 sec just to be on the safe side. 1341738cd3eSNetanel Belgazal */ 1357102a18aSNetanel Belgazal #define ENA_DEVICE_KALIVE_TIMEOUT (6 * HZ) 1368510e1a3SNetanel Belgazal #define ENA_MAX_NO_INTERRUPT_ITERATIONS 3 1371738cd3eSNetanel Belgazal 1381738cd3eSNetanel Belgazal #define ENA_MMIO_DISABLE_REG_READ BIT(0) 1391738cd3eSNetanel Belgazal 1401738cd3eSNetanel Belgazal struct ena_irq { 1411738cd3eSNetanel Belgazal irq_handler_t handler; 1421738cd3eSNetanel Belgazal void *data; 1431738cd3eSNetanel Belgazal int cpu; 1441738cd3eSNetanel Belgazal u32 vector; 1451738cd3eSNetanel Belgazal cpumask_t affinity_hint_mask; 1461738cd3eSNetanel Belgazal char name[ENA_IRQNAME_SIZE]; 1471738cd3eSNetanel Belgazal }; 1481738cd3eSNetanel Belgazal 1491738cd3eSNetanel Belgazal struct ena_napi { 1501738cd3eSNetanel Belgazal struct napi_struct napi ____cacheline_aligned; 1511738cd3eSNetanel Belgazal struct ena_ring *tx_ring; 1521738cd3eSNetanel Belgazal struct ena_ring *rx_ring; 1531738cd3eSNetanel Belgazal u32 qid; 1541738cd3eSNetanel Belgazal }; 1551738cd3eSNetanel Belgazal 1561738cd3eSNetanel Belgazal struct ena_tx_buffer { 1571738cd3eSNetanel Belgazal struct sk_buff *skb; 1581738cd3eSNetanel Belgazal /* num of ena desc for this specific skb 1591738cd3eSNetanel Belgazal * (includes data desc and metadata desc) 1601738cd3eSNetanel Belgazal */ 1611738cd3eSNetanel Belgazal u32 tx_descs; 1621738cd3eSNetanel Belgazal /* num of buffers used by this skb */ 1631738cd3eSNetanel Belgazal u32 num_of_bufs; 164800c55cbSNetanel Belgazal 16538005ca8SArthur Kiyanovski /* Indicate if bufs[0] map the linear data of the skb. */ 16638005ca8SArthur Kiyanovski u8 map_linear_data; 16738005ca8SArthur Kiyanovski 168800c55cbSNetanel Belgazal /* Used for detect missing tx packets to limit the number of prints */ 169800c55cbSNetanel Belgazal u32 print_once; 170800c55cbSNetanel Belgazal /* Save the last jiffies to detect missing tx packets 171800c55cbSNetanel Belgazal * 172800c55cbSNetanel Belgazal * sets to non zero value on ena_start_xmit and set to zero on 173800c55cbSNetanel Belgazal * napi and timer_Service_routine. 174800c55cbSNetanel Belgazal * 175800c55cbSNetanel Belgazal * while this value is not protected by lock, 176800c55cbSNetanel Belgazal * a given packet is not expected to be handled by ena_start_xmit 177800c55cbSNetanel Belgazal * and by napi/timer_service at the same time. 178800c55cbSNetanel Belgazal */ 1791738cd3eSNetanel Belgazal unsigned long last_jiffies; 1801738cd3eSNetanel Belgazal struct ena_com_buf bufs[ENA_PKT_MAX_BUFS]; 1811738cd3eSNetanel Belgazal } ____cacheline_aligned; 1821738cd3eSNetanel Belgazal 1831738cd3eSNetanel Belgazal struct ena_rx_buffer { 1841738cd3eSNetanel Belgazal struct sk_buff *skb; 1851738cd3eSNetanel Belgazal struct page *page; 1861738cd3eSNetanel Belgazal u32 page_offset; 1871738cd3eSNetanel Belgazal struct ena_com_buf ena_buf; 1881738cd3eSNetanel Belgazal } ____cacheline_aligned; 1891738cd3eSNetanel Belgazal 1901738cd3eSNetanel Belgazal struct ena_stats_tx { 1911738cd3eSNetanel Belgazal u64 cnt; 1921738cd3eSNetanel Belgazal u64 bytes; 1931738cd3eSNetanel Belgazal u64 queue_stop; 1941738cd3eSNetanel Belgazal u64 prepare_ctx_err; 1951738cd3eSNetanel Belgazal u64 queue_wakeup; 1961738cd3eSNetanel Belgazal u64 dma_mapping_err; 1971738cd3eSNetanel Belgazal u64 linearize; 1981738cd3eSNetanel Belgazal u64 linearize_failed; 1991738cd3eSNetanel Belgazal u64 napi_comp; 2001738cd3eSNetanel Belgazal u64 tx_poll; 2011738cd3eSNetanel Belgazal u64 doorbells; 2021738cd3eSNetanel Belgazal u64 bad_req_id; 20338005ca8SArthur Kiyanovski u64 llq_buffer_copy; 20411095fdbSNetanel Belgazal u64 missed_tx; 2051738cd3eSNetanel Belgazal }; 2061738cd3eSNetanel Belgazal 2071738cd3eSNetanel Belgazal struct ena_stats_rx { 2081738cd3eSNetanel Belgazal u64 cnt; 2091738cd3eSNetanel Belgazal u64 bytes; 2101738cd3eSNetanel Belgazal u64 refil_partial; 2111738cd3eSNetanel Belgazal u64 bad_csum; 2121738cd3eSNetanel Belgazal u64 page_alloc_fail; 2131738cd3eSNetanel Belgazal u64 skb_alloc_fail; 2141738cd3eSNetanel Belgazal u64 dma_mapping_err; 2151738cd3eSNetanel Belgazal u64 bad_desc_num; 2161738cd3eSNetanel Belgazal u64 rx_copybreak_pkt; 217ad974baeSNetanel Belgazal u64 bad_req_id; 218a3af7c18SNetanel Belgazal u64 empty_rx_ring; 219cb36bb36SArthur Kiyanovski u64 csum_unchecked; 2201738cd3eSNetanel Belgazal }; 2211738cd3eSNetanel Belgazal 2221738cd3eSNetanel Belgazal struct ena_ring { 223ad974baeSNetanel Belgazal union { 224ad974baeSNetanel Belgazal /* Holds the empty requests for TX/RX 225ad974baeSNetanel Belgazal * out of order completions 226ad974baeSNetanel Belgazal */ 2271738cd3eSNetanel Belgazal u16 *free_tx_ids; 228ad974baeSNetanel Belgazal u16 *free_rx_ids; 229ad974baeSNetanel Belgazal }; 230ad974baeSNetanel Belgazal 2311738cd3eSNetanel Belgazal union { 2321738cd3eSNetanel Belgazal struct ena_tx_buffer *tx_buffer_info; 2331738cd3eSNetanel Belgazal struct ena_rx_buffer *rx_buffer_info; 2341738cd3eSNetanel Belgazal }; 2351738cd3eSNetanel Belgazal 2361738cd3eSNetanel Belgazal /* cache ptr to avoid using the adapter */ 2371738cd3eSNetanel Belgazal struct device *dev; 2381738cd3eSNetanel Belgazal struct pci_dev *pdev; 2391738cd3eSNetanel Belgazal struct napi_struct *napi; 2401738cd3eSNetanel Belgazal struct net_device *netdev; 2411738cd3eSNetanel Belgazal struct ena_com_dev *ena_dev; 2421738cd3eSNetanel Belgazal struct ena_adapter *adapter; 2431738cd3eSNetanel Belgazal struct ena_com_io_cq *ena_com_io_cq; 2441738cd3eSNetanel Belgazal struct ena_com_io_sq *ena_com_io_sq; 2451738cd3eSNetanel Belgazal 2461738cd3eSNetanel Belgazal u16 next_to_use; 2471738cd3eSNetanel Belgazal u16 next_to_clean; 2481738cd3eSNetanel Belgazal u16 rx_copybreak; 2491738cd3eSNetanel Belgazal u16 qid; 2501738cd3eSNetanel Belgazal u16 mtu; 2511738cd3eSNetanel Belgazal u16 sgl_size; 2521738cd3eSNetanel Belgazal 2531738cd3eSNetanel Belgazal /* The maximum header length the device can handle */ 2541738cd3eSNetanel Belgazal u8 tx_max_header_size; 2551738cd3eSNetanel Belgazal 2568510e1a3SNetanel Belgazal bool first_interrupt; 2578510e1a3SNetanel Belgazal u16 no_interrupt_event_cnt; 2588510e1a3SNetanel Belgazal 2591738cd3eSNetanel Belgazal /* cpu for TPH */ 2601738cd3eSNetanel Belgazal int cpu; 2611738cd3eSNetanel Belgazal /* number of tx/rx_buffer_info's entries */ 2621738cd3eSNetanel Belgazal int ring_size; 2631738cd3eSNetanel Belgazal 2641738cd3eSNetanel Belgazal enum ena_admin_placement_policy_type tx_mem_queue_type; 2651738cd3eSNetanel Belgazal 2661738cd3eSNetanel Belgazal struct ena_com_rx_buf_info ena_bufs[ENA_PKT_MAX_BUFS]; 2671738cd3eSNetanel Belgazal u32 smoothed_interval; 2681738cd3eSNetanel Belgazal u32 per_napi_packets; 2691738cd3eSNetanel Belgazal u32 per_napi_bytes; 2701738cd3eSNetanel Belgazal enum ena_intr_moder_level moder_tbl_idx; 2711738cd3eSNetanel Belgazal struct u64_stats_sync syncp; 2721738cd3eSNetanel Belgazal union { 2731738cd3eSNetanel Belgazal struct ena_stats_tx tx_stats; 2741738cd3eSNetanel Belgazal struct ena_stats_rx rx_stats; 2751738cd3eSNetanel Belgazal }; 27638005ca8SArthur Kiyanovski 27738005ca8SArthur Kiyanovski u8 *push_buf_intermediate_buf; 278a3af7c18SNetanel Belgazal int empty_rx_queue; 2791738cd3eSNetanel Belgazal } ____cacheline_aligned; 2801738cd3eSNetanel Belgazal 2811738cd3eSNetanel Belgazal struct ena_stats_dev { 2821738cd3eSNetanel Belgazal u64 tx_timeout; 2838c5c7abdSNetanel Belgazal u64 suspend; 2848c5c7abdSNetanel Belgazal u64 resume; 2851738cd3eSNetanel Belgazal u64 wd_expired; 2861738cd3eSNetanel Belgazal u64 interface_up; 2871738cd3eSNetanel Belgazal u64 interface_down; 2881738cd3eSNetanel Belgazal u64 admin_q_pause; 289d81db240SNetanel Belgazal u64 rx_drops; 2901738cd3eSNetanel Belgazal }; 2911738cd3eSNetanel Belgazal 2921738cd3eSNetanel Belgazal enum ena_flags_t { 2931738cd3eSNetanel Belgazal ENA_FLAG_DEVICE_RUNNING, 2941738cd3eSNetanel Belgazal ENA_FLAG_DEV_UP, 2951738cd3eSNetanel Belgazal ENA_FLAG_LINK_UP, 29606443684SNetanel Belgazal ENA_FLAG_MSIX_ENABLED, 297d18e4f68SNetanel Belgazal ENA_FLAG_TRIGGER_RESET, 298d18e4f68SNetanel Belgazal ENA_FLAG_ONGOING_RESET 2991738cd3eSNetanel Belgazal }; 3001738cd3eSNetanel Belgazal 3011738cd3eSNetanel Belgazal /* adapter specific private data structure */ 3021738cd3eSNetanel Belgazal struct ena_adapter { 3031738cd3eSNetanel Belgazal struct ena_com_dev *ena_dev; 3041738cd3eSNetanel Belgazal /* OS defined structs */ 3051738cd3eSNetanel Belgazal struct net_device *netdev; 3061738cd3eSNetanel Belgazal struct pci_dev *pdev; 3071738cd3eSNetanel Belgazal 3081738cd3eSNetanel Belgazal /* rx packets that shorter that this len will be copied to the skb 3091738cd3eSNetanel Belgazal * header 3101738cd3eSNetanel Belgazal */ 3111738cd3eSNetanel Belgazal u32 rx_copybreak; 3121738cd3eSNetanel Belgazal u32 max_mtu; 3131738cd3eSNetanel Belgazal 3141738cd3eSNetanel Belgazal int num_queues; 3151738cd3eSNetanel Belgazal 3161738cd3eSNetanel Belgazal int msix_vecs; 3171738cd3eSNetanel Belgazal 31882ef30f1SNetanel Belgazal u32 missing_tx_completion_threshold; 31982ef30f1SNetanel Belgazal 3201738cd3eSNetanel Belgazal u32 tx_usecs, rx_usecs; /* interrupt moderation */ 3211738cd3eSNetanel Belgazal u32 tx_frames, rx_frames; /* interrupt moderation */ 3221738cd3eSNetanel Belgazal 3231738cd3eSNetanel Belgazal u32 tx_ring_size; 3241738cd3eSNetanel Belgazal u32 rx_ring_size; 3251738cd3eSNetanel Belgazal 3261738cd3eSNetanel Belgazal u32 msg_enable; 3271738cd3eSNetanel Belgazal 3281738cd3eSNetanel Belgazal u16 max_tx_sgl_size; 3291738cd3eSNetanel Belgazal u16 max_rx_sgl_size; 3301738cd3eSNetanel Belgazal 3311738cd3eSNetanel Belgazal u8 mac_addr[ETH_ALEN]; 3321738cd3eSNetanel Belgazal 33382ef30f1SNetanel Belgazal unsigned long keep_alive_timeout; 33482ef30f1SNetanel Belgazal unsigned long missing_tx_completion_to; 33582ef30f1SNetanel Belgazal 3361738cd3eSNetanel Belgazal char name[ENA_NAME_MAX_LEN]; 3371738cd3eSNetanel Belgazal 3381738cd3eSNetanel Belgazal unsigned long flags; 3391738cd3eSNetanel Belgazal /* TX */ 3401738cd3eSNetanel Belgazal struct ena_ring tx_ring[ENA_MAX_NUM_IO_QUEUES] 3411738cd3eSNetanel Belgazal ____cacheline_aligned_in_smp; 3421738cd3eSNetanel Belgazal 3431738cd3eSNetanel Belgazal /* RX */ 3441738cd3eSNetanel Belgazal struct ena_ring rx_ring[ENA_MAX_NUM_IO_QUEUES] 3451738cd3eSNetanel Belgazal ____cacheline_aligned_in_smp; 3461738cd3eSNetanel Belgazal 3471738cd3eSNetanel Belgazal struct ena_napi ena_napi[ENA_MAX_NUM_IO_QUEUES]; 3481738cd3eSNetanel Belgazal 3491738cd3eSNetanel Belgazal struct ena_irq irq_tbl[ENA_MAX_MSIX_VEC(ENA_MAX_NUM_IO_QUEUES)]; 3501738cd3eSNetanel Belgazal 3511738cd3eSNetanel Belgazal /* timer service */ 3521738cd3eSNetanel Belgazal struct work_struct reset_task; 3531738cd3eSNetanel Belgazal struct timer_list timer_service; 3541738cd3eSNetanel Belgazal 3551738cd3eSNetanel Belgazal bool wd_state; 3568c5c7abdSNetanel Belgazal bool dev_up_before_reset; 3571738cd3eSNetanel Belgazal unsigned long last_keep_alive_jiffies; 3581738cd3eSNetanel Belgazal 3591738cd3eSNetanel Belgazal struct u64_stats_sync syncp; 3601738cd3eSNetanel Belgazal struct ena_stats_dev dev_stats; 3611738cd3eSNetanel Belgazal 3621738cd3eSNetanel Belgazal /* last queue index that was checked for uncompleted tx packets */ 3631738cd3eSNetanel Belgazal u32 last_monitored_tx_qid; 364e2eed0e3SNetanel Belgazal 365e2eed0e3SNetanel Belgazal enum ena_regs_reset_reason_types reset_reason; 3661738cd3eSNetanel Belgazal }; 3671738cd3eSNetanel Belgazal 3681738cd3eSNetanel Belgazal void ena_set_ethtool_ops(struct net_device *netdev); 3691738cd3eSNetanel Belgazal 3701738cd3eSNetanel Belgazal void ena_dump_stats_to_dmesg(struct ena_adapter *adapter); 3711738cd3eSNetanel Belgazal 3721738cd3eSNetanel Belgazal void ena_dump_stats_to_buf(struct ena_adapter *adapter, u8 *buf); 3731738cd3eSNetanel Belgazal 3741738cd3eSNetanel Belgazal int ena_get_sset_count(struct net_device *netdev, int sset); 3751738cd3eSNetanel Belgazal 3761738cd3eSNetanel Belgazal #endif /* !(ENA_H) */ 377