1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright (c) 2015-2018 Atomic Rules LLC
5 #ifndef _ARK_PKTCHKR_H_
6 #define _ARK_PKTCHKR_H_
11 #define ARK_PKTCHKR_BASE_ADR 0x90000
13 typedef void *ark_pkt_chkr_t;
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.
23 * This are overlay structures to a memory mapped FPGA device. These
24 * structs will never be instantiated in ram memory
26 struct ark_pkt_chkr_stat_regs {
28 uint32_t pkt_start_stop;
33 uint32_t pkts_mismatch;
35 uint32_t first_mismatch;
36 uint32_t resync_events;
37 uint32_t pkts_missing;
42 struct ark_pkt_chkr_ctl_regs {
45 uint32_t pkt_size_min;
46 uint32_t pkt_size_max;
47 uint32_t pkt_size_incr;
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;
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;
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);