]>
Commit | Line | Data |
---|---|---|
9f95a23c TL |
1 | /* SPDX-License-Identifier: BSD-3-Clause |
2 | * Copyright (c) 2015-2018 Atomic Rules LLC | |
11fdf7f2 TL |
3 | */ |
4 | ||
5 | #ifndef _ARK_PKTCHKR_H_ | |
6 | #define _ARK_PKTCHKR_H_ | |
7 | ||
8 | #include <stdint.h> | |
9 | #include <inttypes.h> | |
10 | ||
11 | #define ARK_PKTCHKR_BASE_ADR 0x90000 | |
12 | ||
13 | typedef void *ark_pkt_chkr_t; | |
14 | ||
15 | /* The packet checker is an internal Arkville hardware module, which | |
16 | * verifies packet streams generated from the corresponding packet | |
17 | * generator. This module is used for Arkville testing. | |
18 | * This module is *not* intended for end-user manipulation, hence | |
19 | * there is minimal documentation. | |
20 | */ | |
21 | ||
22 | /* | |
23 | * This are overlay structures to a memory mapped FPGA device. These | |
24 | * structs will never be instantiated in ram memory | |
25 | */ | |
26 | struct ark_pkt_chkr_stat_regs { | |
27 | uint32_t r0; | |
28 | uint32_t pkt_start_stop; | |
29 | uint32_t pkt_ctrl; | |
30 | uint32_t pkts_rcvd; | |
31 | uint64_t bytes_rcvd; | |
32 | uint32_t pkts_ok; | |
33 | uint32_t pkts_mismatch; | |
34 | uint32_t pkts_err; | |
35 | uint32_t first_mismatch; | |
36 | uint32_t resync_events; | |
37 | uint32_t pkts_missing; | |
38 | uint32_t min_latency; | |
39 | uint32_t max_latency; | |
40 | } __attribute__ ((packed)); | |
41 | ||
42 | struct ark_pkt_chkr_ctl_regs { | |
43 | uint32_t pkt_ctrl; | |
44 | uint32_t pkt_payload; | |
45 | uint32_t pkt_size_min; | |
46 | uint32_t pkt_size_max; | |
47 | uint32_t pkt_size_incr; | |
48 | uint32_t num_pkts; | |
49 | uint32_t pkts_sent; | |
50 | uint32_t src_mac_addr_l; | |
51 | uint32_t src_mac_addr_h; | |
52 | uint32_t dst_mac_addr_l; | |
53 | uint32_t dst_mac_addr_h; | |
54 | uint32_t eth_type; | |
55 | uint32_t hdr_dw[7]; | |
56 | } __attribute__ ((packed)); | |
57 | ||
58 | struct ark_pkt_chkr_inst { | |
59 | struct rte_eth_dev_info *dev_info; | |
60 | volatile struct ark_pkt_chkr_stat_regs *sregs; | |
61 | volatile struct ark_pkt_chkr_ctl_regs *cregs; | |
62 | int l2_mode; | |
63 | int ordinal; | |
64 | }; | |
65 | ||
66 | /* packet checker functions */ | |
67 | ark_pkt_chkr_t ark_pktchkr_init(void *addr, int ord, int l2_mode); | |
68 | void ark_pktchkr_uninit(ark_pkt_chkr_t handle); | |
69 | void ark_pktchkr_run(ark_pkt_chkr_t handle); | |
70 | int ark_pktchkr_stopped(ark_pkt_chkr_t handle); | |
71 | void ark_pktchkr_stop(ark_pkt_chkr_t handle); | |
72 | int ark_pktchkr_is_running(ark_pkt_chkr_t handle); | |
73 | int ark_pktchkr_get_pkts_sent(ark_pkt_chkr_t handle); | |
74 | void ark_pktchkr_set_payload_byte(ark_pkt_chkr_t handle, uint32_t b); | |
75 | void ark_pktchkr_set_pkt_size_min(ark_pkt_chkr_t handle, uint32_t x); | |
76 | void ark_pktchkr_set_pkt_size_max(ark_pkt_chkr_t handle, uint32_t x); | |
77 | void ark_pktchkr_set_pkt_size_incr(ark_pkt_chkr_t handle, uint32_t x); | |
78 | void ark_pktchkr_set_num_pkts(ark_pkt_chkr_t handle, uint32_t x); | |
79 | void ark_pktchkr_set_src_mac_addr(ark_pkt_chkr_t handle, uint64_t mac_addr); | |
80 | void ark_pktchkr_set_dst_mac_addr(ark_pkt_chkr_t handle, uint64_t mac_addr); | |
81 | void ark_pktchkr_set_eth_type(ark_pkt_chkr_t handle, uint32_t x); | |
82 | void ark_pktchkr_set_hdr_dW(ark_pkt_chkr_t handle, uint32_t *hdr); | |
83 | void ark_pktchkr_parse(char *args); | |
84 | void ark_pktchkr_setup(ark_pkt_chkr_t handle); | |
85 | void ark_pktchkr_dump_stats(ark_pkt_chkr_t handle); | |
86 | int ark_pktchkr_wait_done(ark_pkt_chkr_t handle); | |
87 | ||
88 | #endif |