4 * Copyright (C) Cavium Inc. 2017. All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
16 * * Neither the name of Cavium networks nor the names of its
17 * contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 #ifndef __OCTEONTX_BGX_H__
34 #define __OCTEONTX_BGX_H__
39 #include <octeontx_mbox.h>
41 #define OCTEONTX_BGX_COPROC 6
44 #define MBOX_BGX_PORT_OPEN 0
45 #define MBOX_BGX_PORT_CLOSE 1
46 #define MBOX_BGX_PORT_START 2
47 #define MBOX_BGX_PORT_STOP 3
48 #define MBOX_BGX_PORT_GET_CONFIG 4
49 #define MBOX_BGX_PORT_GET_STATUS 5
50 #define MBOX_BGX_PORT_GET_STATS 6
51 #define MBOX_BGX_PORT_CLR_STATS 7
52 #define MBOX_BGX_PORT_GET_LINK_STATUS 8
53 #define MBOX_BGX_PORT_SET_PROMISC 9
54 #define MBOX_BGX_PORT_SET_MACADDR 10
55 #define MBOX_BGX_PORT_SET_BP 11
56 #define MBOX_BGX_PORT_SET_BCAST 12
57 #define MBOX_BGX_PORT_SET_MCAST 13
59 /* BGX port configuration parameters: */
60 typedef struct octeontx_mbox_bgx_port_conf {
64 uint8_t macaddr[6]; /* MAC address.*/
68 uint8_t node; /* CPU node */
76 } octeontx_mbox_bgx_port_conf_t;
78 /* BGX port status: */
79 typedef struct octeontx_mbox_bgx_port_status {
82 } octeontx_mbox_bgx_port_status_t;
84 /* BGX port statistics: */
85 typedef struct octeontx_mbox_bgx_port_stats {
97 uint64_t rx_length_errors;
98 uint64_t rx_over_errors;
99 uint64_t rx_crc_errors;
100 uint64_t rx_frame_errors;
101 uint64_t rx_fifo_errors;
102 uint64_t rx_missed_errors;
104 /* Detailed transmit errors. */
105 uint64_t tx_aborted_errors;
106 uint64_t tx_carrier_errors;
107 uint64_t tx_fifo_errors;
108 uint64_t tx_heartbeat_errors;
109 uint64_t tx_window_errors;
111 /* Extended statistics based on RFC2819. */
112 uint64_t rx_1_to_64_packets;
113 uint64_t rx_65_to_127_packets;
114 uint64_t rx_128_to_255_packets;
115 uint64_t rx_256_to_511_packets;
116 uint64_t rx_512_to_1023_packets;
117 uint64_t rx_1024_to_1522_packets;
118 uint64_t rx_1523_to_max_packets;
120 uint64_t tx_1_to_64_packets;
121 uint64_t tx_65_to_127_packets;
122 uint64_t tx_128_to_255_packets;
123 uint64_t tx_256_to_511_packets;
124 uint64_t tx_512_to_1023_packets;
125 uint64_t tx_1024_to_1522_packets;
126 uint64_t tx_1523_to_max_packets;
128 uint64_t tx_multicast_packets;
129 uint64_t rx_broadcast_packets;
130 uint64_t tx_broadcast_packets;
131 uint64_t rx_undersized_errors;
132 uint64_t rx_oversize_errors;
133 uint64_t rx_fragmented_errors;
134 uint64_t rx_jabber_errors;
135 } octeontx_mbox_bgx_port_stats_t;
137 int octeontx_bgx_port_open(int port, octeontx_mbox_bgx_port_conf_t *conf);
138 int octeontx_bgx_port_close(int port);
139 int octeontx_bgx_port_start(int port);
140 int octeontx_bgx_port_stop(int port);
141 int octeontx_bgx_port_get_config(int port, octeontx_mbox_bgx_port_conf_t *conf);
142 int octeontx_bgx_port_status(int port, octeontx_mbox_bgx_port_status_t *stat);
143 int octeontx_bgx_port_stats(int port, octeontx_mbox_bgx_port_stats_t *stats);
144 int octeontx_bgx_port_stats_clr(int port);
145 int octeontx_bgx_port_link_status(int port);
146 int octeontx_bgx_port_promisc_set(int port, int en);
147 int octeontx_bgx_port_mac_set(int port, uint8_t *mac_addr);
149 #endif /* __OCTEONTX_BGX_H__ */