4 * Copyright(c) 2017 Cavium, Inc.. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
17 * * Neither the name of Cavium, Inc. nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER(S) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 #ifndef _LIO_ETHDEV_H_
35 #define _LIO_ETHDEV_H_
39 #include "lio_struct.h"
41 /* timeout to check link state updates from firmware in us */
42 #define LIO_LSC_TIMEOUT 100000 /* 100000us (100ms) */
43 #define LIO_MAX_CMD_TIMEOUT 10000 /* 10000ms (10s) */
45 #define LIO_DEV(_eth_dev) ((_eth_dev)->data->dev_private)
47 /* LIO Response condition variable */
48 struct lio_dev_ctrl_cmd {
49 struct rte_eth_dev *eth_dev;
54 LIO_LINK_SPEED_UNKNOWN = 0,
55 LIO_LINK_SPEED_10000 = 10000
58 struct octeon_if_cfg_info {
59 uint64_t iqmask; /** mask for IQs enabled for the port */
60 uint64_t oqmask; /** mask for OQs enabled for the port */
61 struct octeon_link_info linfo; /** initial link information */
62 char lio_firmware_version[LIO_FW_VERSION_LENGTH];
65 /** Stats for each NIC port in RX direction. */
66 struct octeon_rx_stats {
67 /* link-level stats */
74 uint64_t fifo_err; /* Accounts for over/under-run of buffers */
82 uint64_t fw_total_rcvd;
83 uint64_t fw_total_fwd;
84 uint64_t fw_total_fwd_bytes;
89 uint64_t fw_rx_vxlan_err;
92 uint64_t fw_lro_pkts; /* Number of packets that are LROed */
93 uint64_t fw_lro_octs; /* Number of octets that are LROed */
94 uint64_t fw_total_lro; /* Number of LRO packets formed */
95 uint64_t fw_lro_aborts; /* Number of times lRO of packet aborted */
96 uint64_t fw_lro_aborts_port;
97 uint64_t fw_lro_aborts_seq;
98 uint64_t fw_lro_aborts_tsval;
99 uint64_t fw_lro_aborts_timer;
100 /* intrmod: packet forward rate */
104 /** Stats for each NIC port in RX direction. */
105 struct octeon_tx_stats {
106 /* link-level stats */
107 uint64_t total_pkts_sent;
108 uint64_t total_bytes_sent;
109 uint64_t mcast_pkts_sent;
110 uint64_t bcast_pkts_sent;
112 uint64_t one_collision_sent; /* Packets sent after one collision */
113 /* Packets sent after multiple collision */
114 uint64_t multi_collision_sent;
115 /* Packets not sent due to max collisions */
116 uint64_t max_collision_fail;
117 /* Packets not sent due to max deferrals */
118 uint64_t max_deferral_fail;
119 /* Accounts for over/under-run of buffers */
122 uint64_t total_collisions; /* Total number of collisions detected */
125 uint64_t fw_total_sent;
126 uint64_t fw_total_fwd;
127 uint64_t fw_total_fwd_bytes;
129 uint64_t fw_err_link;
130 uint64_t fw_err_drop;
132 uint64_t fw_tso; /* number of tso requests */
133 uint64_t fw_tso_fwd; /* number of packets segmented in tso */
134 uint64_t fw_tx_vxlan;
137 struct octeon_link_stats {
138 struct octeon_rx_stats fromwire;
139 struct octeon_tx_stats fromhost;
145 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
146 uint64_t base_queue : 16;
147 uint64_t num_iqueues : 16;
148 uint64_t num_oqueues : 16;
149 uint64_t gmx_port_id : 8;
153 uint64_t gmx_port_id : 8;
154 uint64_t num_oqueues : 16;
155 uint64_t num_iqueues : 16;
156 uint64_t base_queue : 16;
161 struct lio_if_cfg_resp {
163 struct octeon_if_cfg_info cfg_info;
167 struct lio_link_stats_resp {
169 struct octeon_link_stats link_stats;
173 struct lio_link_status_resp {
175 struct octeon_link_info link_info;
181 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
183 uint64_t hashinfo : 32;
184 uint64_t itablesize : 16;
185 uint64_t hashkeysize : 16;
186 uint64_t reserved : 48;
187 #elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
188 uint64_t itablesize : 16;
189 uint64_t hashinfo : 32;
191 uint64_t reserved : 48;
192 uint64_t hashkeysize : 16;
196 uint8_t itable[LIO_RSS_MAX_TABLE_SZ];
197 uint8_t key[LIO_RSS_MAX_KEY_SZ];
200 void lio_dev_rx_queue_release(void *rxq);
202 void lio_dev_tx_queue_release(void *txq);
204 #endif /* _LIO_ETHDEV_H_ */