| 162 | } |
| 163 | |
| 164 | int |
| 165 | sw_xstats_init(struct sw_evdev *sw) |
| 166 | { |
| 167 | /* |
| 168 | * define the stats names and types. Used to build up the device |
| 169 | * xstats array |
| 170 | * There are multiple set of stats: |
| 171 | * - device-level, |
| 172 | * - per-port, |
| 173 | * - per-port-dequeue-burst-sizes |
| 174 | * - per-qid, |
| 175 | * - per-iq |
| 176 | * - per-port-per-qid |
| 177 | * |
| 178 | * For each of these sets, we have three parallel arrays, one for the |
| 179 | * names, the other for the stat type parameter to be passed in the fn |
| 180 | * call to get that stat. The third array allows resetting or not. |
| 181 | * All these arrays must be kept in sync |
| 182 | */ |
| 183 | static const char * const dev_stats[] = { "rx", "tx", "drop", |
| 184 | "sched_calls", "sched_no_iq_enq", "sched_no_cq_enq", |
| 185 | "sched_last_iter_bitmask", "sched_progress_last_iter", |
| 186 | }; |
| 187 | static const enum xstats_type dev_types[] = { rx, tx, dropped, |
| 188 | calls, no_iq_enq, no_cq_enq, sched_last_iter_bitmask, |
| 189 | sched_progress_last_iter, |
| 190 | }; |
| 191 | /* all device stats are allowed to be reset */ |
| 192 | |
| 193 | static const char * const port_stats[] = {"rx", "tx", "drop", |
| 194 | "inflight", "avg_pkt_cycles", "credits", |
| 195 | "rx_ring_used", "rx_ring_free", |
| 196 | "cq_ring_used", "cq_ring_free", |
| 197 | "dequeue_calls", "dequeues_returning_0", |
| 198 | }; |
| 199 | static const enum xstats_type port_types[] = { rx, tx, dropped, |
| 200 | inflight, pkt_cycles, credits, |
| 201 | rx_used, rx_free, tx_used, tx_free, |
| 202 | calls, poll_return, |
| 203 | }; |
| 204 | static const uint8_t port_reset_allowed[] = {1, 1, 1, |
| 205 | 0, 1, 0, |
| 206 | 0, 0, 0, 0, |
| 207 | 1, 1, |
| 208 | }; |
| 209 | |
| 210 | static const char * const port_bucket_stats[] = { |
| 211 | "dequeues_returning" }; |
| 212 | static const enum xstats_type port_bucket_types[] = { poll_return }; |
| 213 | /* all bucket dequeues are allowed to be reset, handled in loop below */ |
| 214 | |
| 215 | static const char * const qid_stats[] = {"rx", "tx", "drop", |
| 216 | "inflight" |
| 217 | }; |
| 218 | static const enum xstats_type qid_types[] = { rx, tx, dropped, |
| 219 | inflight |
| 220 | }; |
| 221 | static const uint8_t qid_reset_allowed[] = {1, 1, 1, |
no test coverage detected