]> git.proxmox.com Git - ceph.git/blob - ceph/src/seastar/dpdk/drivers/net/liquidio/lio_ethdev.h
import 15.2.0 Octopus source
[ceph.git] / ceph / src / seastar / dpdk / drivers / net / liquidio / lio_ethdev.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2017 Cavium, Inc
3 */
4
5 #ifndef _LIO_ETHDEV_H_
6 #define _LIO_ETHDEV_H_
7
8 #include <stdint.h>
9
10 #include "lio_struct.h"
11
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) */
15
16 #define LIO_DEV(_eth_dev) ((_eth_dev)->data->dev_private)
17
18 /* LIO Response condition variable */
19 struct lio_dev_ctrl_cmd {
20 struct rte_eth_dev *eth_dev;
21 uint64_t cond;
22 };
23
24 enum lio_bus_speed {
25 LIO_LINK_SPEED_UNKNOWN = 0,
26 LIO_LINK_SPEED_10000 = 10000,
27 LIO_LINK_SPEED_25000 = 25000
28 };
29
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];
35 };
36
37 /** Stats for each NIC port in RX direction. */
38 struct octeon_rx_stats {
39 /* link-level stats */
40 uint64_t total_rcvd;
41 uint64_t bytes_rcvd;
42 uint64_t total_bcst;
43 uint64_t total_mcst;
44 uint64_t runts;
45 uint64_t ctl_rcvd;
46 uint64_t fifo_err; /* Accounts for over/under-run of buffers */
47 uint64_t dmac_drop;
48 uint64_t fcs_err;
49 uint64_t jabber_err;
50 uint64_t l2_err;
51 uint64_t frame_err;
52
53 /* firmware stats */
54 uint64_t fw_total_rcvd;
55 uint64_t fw_total_fwd;
56 uint64_t fw_total_fwd_bytes;
57 uint64_t fw_err_pko;
58 uint64_t fw_err_link;
59 uint64_t fw_err_drop;
60 uint64_t fw_rx_vxlan;
61 uint64_t fw_rx_vxlan_err;
62
63 /* LRO */
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 */
73 uint64_t fwd_rate;
74 };
75
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;
83 uint64_t ctl_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 */
92 uint64_t fifo_err;
93 uint64_t runts;
94 uint64_t total_collisions; /* Total number of collisions detected */
95
96 /* firmware stats */
97 uint64_t fw_total_sent;
98 uint64_t fw_total_fwd;
99 uint64_t fw_total_fwd_bytes;
100 uint64_t fw_err_pko;
101 uint64_t fw_err_link;
102 uint64_t fw_err_drop;
103 uint64_t fw_err_tso;
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;
107 };
108
109 struct octeon_link_stats {
110 struct octeon_rx_stats fromwire;
111 struct octeon_tx_stats fromhost;
112 };
113
114 union lio_if_cfg {
115 uint64_t if_cfg64;
116 struct {
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;
122 uint64_t vf_id : 8;
123 #else
124 uint64_t vf_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;
129 #endif
130 } s;
131 };
132
133 struct lio_if_cfg_resp {
134 uint64_t rh;
135 struct octeon_if_cfg_info cfg_info;
136 uint64_t status;
137 };
138
139 struct lio_link_stats_resp {
140 uint64_t rh;
141 struct octeon_link_stats link_stats;
142 uint64_t status;
143 };
144
145 struct lio_link_status_resp {
146 uint64_t rh;
147 struct octeon_link_info link_info;
148 uint64_t status;
149 };
150
151 struct lio_rss_set {
152 struct param {
153 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
154 uint64_t flags : 16;
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;
162 uint64_t flags : 16;
163 uint64_t reserved : 48;
164 uint64_t hashkeysize : 16;
165 #endif
166 } param;
167
168 uint8_t itable[LIO_RSS_MAX_TABLE_SZ];
169 uint8_t key[LIO_RSS_MAX_KEY_SZ];
170 };
171
172 void lio_dev_rx_queue_release(void *rxq);
173
174 void lio_dev_tx_queue_release(void *txq);
175
176 #endif /* _LIO_ETHDEV_H_ */