New upstream version 18.08
[deb_dpdk.git] / drivers / net / ena / ena_ethdev.h
index 394d05e..2dc8129 100644 (file)
 #ifndef _ENA_ETHDEV_H_
 #define _ENA_ETHDEV_H_
 
+#include <rte_cycles.h>
 #include <rte_pci.h>
 #include <rte_bus_pci.h>
+#include <rte_timer.h>
 
 #include "ena_com.h"
 
 #define ENA_NAME_MAX_LEN       20
 #define ENA_PKT_MAX_BUFS       17
 
+#define ENA_MIN_MTU            128
+
 #define ENA_MMIO_DISABLE_REG_READ      BIT(0)
 
+#define ENA_WD_TIMEOUT_SEC     3
+#define ENA_DEVICE_KALIVE_TIMEOUT (ENA_WD_TIMEOUT_SEC * rte_get_timer_hz())
+
 struct ena_adapter;
 
 enum ena_ring_type {
@@ -70,8 +77,12 @@ struct ena_ring {
 
        enum ena_ring_type type;
        enum ena_admin_placement_policy_type tx_mem_queue_type;
-       /* Holds the empty requests for TX OOO completions */
-       uint16_t *empty_tx_reqs;
+       /* Holds the empty requests for TX/RX OOO completions */
+       union {
+               uint16_t *empty_tx_reqs;
+               uint16_t *empty_rx_reqs;
+       };
+
        union {
                struct ena_tx_buffer *tx_buffer_info; /* contex of tx packet */
                struct rte_mbuf **rx_buffer_info; /* contex of rx packet */
@@ -92,14 +103,16 @@ struct ena_ring {
        int configured;
        struct ena_adapter *adapter;
        uint64_t offloads;
+       u16 sgl_size;
 } __rte_cache_aligned;
 
 enum ena_adapter_state {
        ENA_ADAPTER_STATE_FREE    = 0,
        ENA_ADAPTER_STATE_INIT    = 1,
-       ENA_ADAPTER_STATE_RUNNING  = 2,
+       ENA_ADAPTER_STATE_RUNNING = 2,
        ENA_ADAPTER_STATE_STOPPED = 3,
        ENA_ADAPTER_STATE_CONFIG  = 4,
+       ENA_ADAPTER_STATE_CLOSED  = 5,
 };
 
 struct ena_driver_stats {
@@ -157,6 +170,7 @@ struct ena_adapter {
        /* TX */
        struct ena_ring tx_ring[ENA_MAX_NUM_QUEUES] __rte_cache_aligned;
        int tx_ring_size;
+       u16 max_tx_sgl_size;
 
        /* RX */
        struct ena_ring rx_ring[ENA_MAX_NUM_QUEUES] __rte_cache_aligned;
@@ -180,6 +194,18 @@ struct ena_adapter {
        uint64_t tx_selected_offloads;
        uint64_t rx_supported_offloads;
        uint64_t rx_selected_offloads;
+
+       bool link_status;
+
+       enum ena_regs_reset_reason_types reset_reason;
+
+       struct rte_timer timer_wd;
+       uint64_t timestamp_wd;
+       uint64_t keep_alive_timeout;
+
+       bool trigger_reset;
+
+       bool wd_state;
 };
 
 #endif /* _ENA_ETHDEV_H_ */