]>
git.proxmox.com Git - ceph.git/blob - ceph/src/seastar/dpdk/drivers/net/ark/ark_pktgen.h
4 * Copyright (c) 2015-2017 Atomic Rules LLC
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
17 * * Neither the name of copyright holder nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 #ifndef _ARK_PKTGEN_H_
35 #define _ARK_PKTGEN_H_
40 #define ARK_PKTGEN_BASE_ADR 0x10000
42 typedef void *ark_pkt_gen_t
;
44 /* The packet generator is an internal Arkville hardware module, which
45 * generates known packets for use in integrity and line-rate testing.
46 * This module is *not* intended for end-user manipulation, hence
47 * there is minimal documentation.
51 * This is an overlay structure to a memory mapped FPGA device. These
52 * structs will never be instantiated in ram memory
54 struct ark_pkt_gen_regs
{
56 volatile uint32_t pkt_start_stop
;
57 volatile uint32_t pkt_ctrl
;
60 uint32_t pkt_size_min
;
61 uint32_t pkt_size_max
;
62 uint32_t pkt_size_incr
;
63 volatile uint32_t num_pkts
;
64 volatile uint32_t pkts_sent
;
65 uint32_t src_mac_addr_l
;
66 uint32_t src_mac_addr_h
;
67 uint32_t dst_mac_addr_l
;
68 uint32_t dst_mac_addr_h
;
71 uint32_t start_offset
;
72 uint32_t bytes_per_cycle
;
73 } __attribute__ ((packed
));
75 struct ark_pkt_gen_inst
{
76 struct rte_eth_dev_info
*dev_info
;
77 struct ark_pkt_gen_regs
*regs
;
82 /* packet generator functions */
83 ark_pkt_gen_t
ark_pktgen_init(void *arg
, int ord
, int l2_mode
);
84 void ark_pktgen_uninit(ark_pkt_gen_t handle
);
85 void ark_pktgen_run(ark_pkt_gen_t handle
);
86 void ark_pktgen_pause(ark_pkt_gen_t handle
);
87 uint32_t ark_pktgen_paused(ark_pkt_gen_t handle
);
88 uint32_t ark_pktgen_is_gen_forever(ark_pkt_gen_t handle
);
89 uint32_t ark_pktgen_is_running(ark_pkt_gen_t handle
);
90 uint32_t ark_pktgen_tx_done(ark_pkt_gen_t handle
);
91 void ark_pktgen_reset(ark_pkt_gen_t handle
);
92 void ark_pktgen_wait_done(ark_pkt_gen_t handle
);
93 uint32_t ark_pktgen_get_pkts_sent(ark_pkt_gen_t handle
);
94 void ark_pktgen_set_payload_byte(ark_pkt_gen_t handle
, uint32_t b
);
95 void ark_pktgen_set_pkt_spacing(ark_pkt_gen_t handle
, uint32_t x
);
96 void ark_pktgen_set_pkt_size_min(ark_pkt_gen_t handle
, uint32_t x
);
97 void ark_pktgen_set_pkt_size_max(ark_pkt_gen_t handle
, uint32_t x
);
98 void ark_pktgen_set_pkt_size_incr(ark_pkt_gen_t handle
, uint32_t x
);
99 void ark_pktgen_set_num_pkts(ark_pkt_gen_t handle
, uint32_t x
);
100 void ark_pktgen_set_src_mac_addr(ark_pkt_gen_t handle
, uint64_t mac_addr
);
101 void ark_pktgen_set_dst_mac_addr(ark_pkt_gen_t handle
, uint64_t mac_addr
);
102 void ark_pktgen_set_eth_type(ark_pkt_gen_t handle
, uint32_t x
);
103 void ark_pktgen_set_hdr_dW(ark_pkt_gen_t handle
, uint32_t *hdr
);
104 void ark_pktgen_set_start_offset(ark_pkt_gen_t handle
, uint32_t x
);
105 void ark_pktgen_parse(char *argv
);
106 void ark_pktgen_setup(ark_pkt_gen_t handle
);