1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2017 Cavium, Inc
10 #include "lio_struct.h"
12 /* timeout to check link state updates from firmware in us */
13 #define LIO_LSC_TIMEOUT 100000 /* 100000us (100ms) */
14 #define LIO_MAX_CMD_TIMEOUT 10000 /* 10000ms (10s) */
16 #define LIO_DEV(_eth_dev) ((_eth_dev)->data->dev_private)
18 /* LIO Response condition variable */
19 struct lio_dev_ctrl_cmd {
20 struct rte_eth_dev *eth_dev;
25 LIO_LINK_SPEED_UNKNOWN = 0,
26 LIO_LINK_SPEED_10000 = 10000,
27 LIO_LINK_SPEED_25000 = 25000
30 struct octeon_if_cfg_info {
31 uint64_t iqmask; /** mask for IQs enabled for the port */
32 uint64_t oqmask; /** mask for OQs enabled for the port */
33 struct octeon_link_info linfo; /** initial link information */
34 char lio_firmware_version[LIO_FW_VERSION_LENGTH];
37 /** Stats for each NIC port in RX direction. */
38 struct octeon_rx_stats {
39 /* link-level stats */
46 uint64_t fifo_err; /* Accounts for over/under-run of buffers */
54 uint64_t fw_total_rcvd;
55 uint64_t fw_total_fwd;
56 uint64_t fw_total_fwd_bytes;
61 uint64_t fw_rx_vxlan_err;
64 uint64_t fw_lro_pkts; /* Number of packets that are LROed */
65 uint64_t fw_lro_octs; /* Number of octets that are LROed */
66 uint64_t fw_total_lro; /* Number of LRO packets formed */
67 uint64_t fw_lro_aborts; /* Number of times lRO of packet aborted */
68 uint64_t fw_lro_aborts_port;
69 uint64_t fw_lro_aborts_seq;
70 uint64_t fw_lro_aborts_tsval;
71 uint64_t fw_lro_aborts_timer;
72 /* intrmod: packet forward rate */
76 /** Stats for each NIC port in RX direction. */
77 struct octeon_tx_stats {
78 /* link-level stats */
79 uint64_t total_pkts_sent;
80 uint64_t total_bytes_sent;
81 uint64_t mcast_pkts_sent;
82 uint64_t bcast_pkts_sent;
84 uint64_t one_collision_sent; /* Packets sent after one collision */
85 /* Packets sent after multiple collision */
86 uint64_t multi_collision_sent;
87 /* Packets not sent due to max collisions */
88 uint64_t max_collision_fail;
89 /* Packets not sent due to max deferrals */
90 uint64_t max_deferral_fail;
91 /* Accounts for over/under-run of buffers */
94 uint64_t total_collisions; /* Total number of collisions detected */
97 uint64_t fw_total_sent;
98 uint64_t fw_total_fwd;
99 uint64_t fw_total_fwd_bytes;
101 uint64_t fw_err_link;
102 uint64_t fw_err_drop;
104 uint64_t fw_tso; /* number of tso requests */
105 uint64_t fw_tso_fwd; /* number of packets segmented in tso */
106 uint64_t fw_tx_vxlan;
109 struct octeon_link_stats {
110 struct octeon_rx_stats fromwire;
111 struct octeon_tx_stats fromhost;
117 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
118 uint64_t base_queue : 16;
119 uint64_t num_iqueues : 16;
120 uint64_t num_oqueues : 16;
121 uint64_t gmx_port_id : 8;
125 uint64_t gmx_port_id : 8;
126 uint64_t num_oqueues : 16;
127 uint64_t num_iqueues : 16;
128 uint64_t base_queue : 16;
133 struct lio_if_cfg_resp {
135 struct octeon_if_cfg_info cfg_info;
139 struct lio_link_stats_resp {
141 struct octeon_link_stats link_stats;
145 struct lio_link_status_resp {
147 struct octeon_link_info link_info;
153 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
155 uint64_t hashinfo : 32;
156 uint64_t itablesize : 16;
157 uint64_t hashkeysize : 16;
158 uint64_t reserved : 48;
159 #elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
160 uint64_t itablesize : 16;
161 uint64_t hashinfo : 32;
163 uint64_t reserved : 48;
164 uint64_t hashkeysize : 16;
168 uint8_t itable[LIO_RSS_MAX_TABLE_SZ];
169 uint8_t key[LIO_RSS_MAX_KEY_SZ];
172 void lio_dev_rx_queue_release(void *rxq);
174 void lio_dev_tx_queue_release(void *txq);
176 #endif /* _LIO_ETHDEV_H_ */