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 /* The max frame size with default MTU */
17 #define LIO_ETH_MAX_LEN (RTE_ETHER_MTU + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN)
19 #define LIO_DEV(_eth_dev) ((_eth_dev)->data->dev_private)
21 /* LIO Response condition variable */
22 struct lio_dev_ctrl_cmd {
23 struct rte_eth_dev *eth_dev;
28 LIO_LINK_SPEED_UNKNOWN = 0,
29 LIO_LINK_SPEED_10000 = 10000,
30 LIO_LINK_SPEED_25000 = 25000
33 struct octeon_if_cfg_info {
34 uint64_t iqmask; /** mask for IQs enabled for the port */
35 uint64_t oqmask; /** mask for OQs enabled for the port */
36 struct octeon_link_info linfo; /** initial link information */
37 char lio_firmware_version[LIO_FW_VERSION_LENGTH];
40 /** Stats for each NIC port in RX direction. */
41 struct octeon_rx_stats {
42 /* link-level stats */
49 uint64_t fifo_err; /* Accounts for over/under-run of buffers */
57 uint64_t fw_total_rcvd;
58 uint64_t fw_total_fwd;
59 uint64_t fw_total_fwd_bytes;
64 uint64_t fw_rx_vxlan_err;
67 uint64_t fw_lro_pkts; /* Number of packets that are LROed */
68 uint64_t fw_lro_octs; /* Number of octets that are LROed */
69 uint64_t fw_total_lro; /* Number of LRO packets formed */
70 uint64_t fw_lro_aborts; /* Number of times lRO of packet aborted */
71 uint64_t fw_lro_aborts_port;
72 uint64_t fw_lro_aborts_seq;
73 uint64_t fw_lro_aborts_tsval;
74 uint64_t fw_lro_aborts_timer;
75 /* intrmod: packet forward rate */
79 /** Stats for each NIC port in RX direction. */
80 struct octeon_tx_stats {
81 /* link-level stats */
82 uint64_t total_pkts_sent;
83 uint64_t total_bytes_sent;
84 uint64_t mcast_pkts_sent;
85 uint64_t bcast_pkts_sent;
87 uint64_t one_collision_sent; /* Packets sent after one collision */
88 /* Packets sent after multiple collision */
89 uint64_t multi_collision_sent;
90 /* Packets not sent due to max collisions */
91 uint64_t max_collision_fail;
92 /* Packets not sent due to max deferrals */
93 uint64_t max_deferral_fail;
94 /* Accounts for over/under-run of buffers */
97 uint64_t total_collisions; /* Total number of collisions detected */
100 uint64_t fw_total_sent;
101 uint64_t fw_total_fwd;
102 uint64_t fw_total_fwd_bytes;
104 uint64_t fw_err_link;
105 uint64_t fw_err_drop;
107 uint64_t fw_tso; /* number of tso requests */
108 uint64_t fw_tso_fwd; /* number of packets segmented in tso */
109 uint64_t fw_tx_vxlan;
112 struct octeon_link_stats {
113 struct octeon_rx_stats fromwire;
114 struct octeon_tx_stats fromhost;
120 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
121 uint64_t base_queue : 16;
122 uint64_t num_iqueues : 16;
123 uint64_t num_oqueues : 16;
124 uint64_t gmx_port_id : 8;
128 uint64_t gmx_port_id : 8;
129 uint64_t num_oqueues : 16;
130 uint64_t num_iqueues : 16;
131 uint64_t base_queue : 16;
136 struct lio_if_cfg_resp {
138 struct octeon_if_cfg_info cfg_info;
142 struct lio_link_stats_resp {
144 struct octeon_link_stats link_stats;
148 struct lio_link_status_resp {
150 struct octeon_link_info link_info;
156 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
158 uint64_t hashinfo : 32;
159 uint64_t itablesize : 16;
160 uint64_t hashkeysize : 16;
161 uint64_t reserved : 48;
162 #elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
163 uint64_t itablesize : 16;
164 uint64_t hashinfo : 32;
166 uint64_t reserved : 48;
167 uint64_t hashkeysize : 16;
171 uint8_t itable[LIO_RSS_MAX_TABLE_SZ];
172 uint8_t key[LIO_RSS_MAX_KEY_SZ];
175 void lio_dev_rx_queue_release(struct rte_eth_dev *dev, uint16_t q_no);
177 void lio_dev_tx_queue_release(struct rte_eth_dev *dev, uint16_t q_no);
179 #endif /* _LIO_ETHDEV_H_ */