blob: 4410c47889297cb3c92cd0697a80701872a30e59 [file] [log] [blame]
Shad Ansari2f7f9be2017-06-07 13:34:53 -07001/******************************************************************************
2 *
3 * <:copyright-BRCM:2016:DUAL/GPL:standard
4 *
5 * Copyright (c) 2016 Broadcom
6 * All Rights Reserved
7 *
8 * Unless you and Broadcom execute a separate written software license
9 * agreement governing use of this software, this software is licensed
10 * to you under the terms of the GNU General Public License version 2
11 * (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
12 * with the following added to such license:
13 *
14 * As a special exception, the copyright holders of this software give
15 * you permission to link this software with independent modules, and
16 * to copy and distribute the resulting executable under terms of your
17 * choice, provided that you also meet, for each linked independent
18 * module, the terms and conditions of the license of that module.
19 * An independent module is a module which is not derived from this
20 * software. The special exception does not apply to any modifications
21 * of the software.
22 *
23 * Not withstanding the above, under no circumstances may you combine
24 * this software in any way with any other Broadcom software provided
25 * under a license other than the GPL, without Broadcom's express prior
26 * written consent.
27 *
28 * :>
29 *
30 *****************************************************************************/
31
32/**
33 * @file bal_core.h
34 * @brief The include files common to all core files
35 *
36 * @addtogroup ctrlr
37 */
38
39
40#ifndef COREMAIN_H
41#define COREMAIN_H
42
43/*@{*/
44#include <bcmos_system.h>
45#include <bal_objs.h>
46#ifdef ENABLE_LOG
47#include <bcm_dev_log.h>
48#endif
49#include <bcm_topo.h>
50#include <cmdline.h>
51
52extern dev_log_id log_id_core;
53
54
55#define BIT_FIELD_MAC_IN_LOOPBACK 0x01
56#define BIT_FIELD_SWITCH_IN_LOOPBACK 0x02
57#define IS_MAC_IN_LOOPBACK(config) ((config) & BIT_FIELD_MAC_IN_LOOPBACK)
58#define IS_NNI_INTF_AUTONEG_ON(config, intf) (config & (1 << intf))
59
60typedef struct bcmbal_config_params
61{
62 bcmbal_iwf_mode iwf_mode;
63 uint32_t intf_maptable;
64 uint32_t trap_udp_port;
65 uint16_t num_nni_ports;
66 uint32_t ds_sched_mode;
67 uint32_t pkt_send_svr_listen_port; /* The port number where the bcm.user process listens for packet send messages from the core */
68 uint8_t loopback_modes_bit_mask; /* mac | switch | something else in loopback mode */
69 bcm_topo_params topo_params;
70 uint32_t nni_autoneg_bit_mask; /* NNI autoneg is ON */
71
72 /*
73 * IP:Port strings specifying IP:Port assignments of the queues
74 * required for IPC between BAL components
75 */
76 const char *core_mgmt_ip_port;
77 const char *balapi_mgmt_ip_port;
78 const char *mac_rpc_ip_port;
79 const char *sw_rpc_ip;
80
81 /* CLI session configuration */
82 bcmcli_access_right access;
83 bcmcli_line_edit_mode edit_mode;
84 const char *init_script;
85
86 /* Logger parameters */
87 bcmos_bool disable_log;
88 const char *log_file_name;
89 bcmos_bool log_syslog;
90} bcmbal_config_params;
91
92extern bcmos_errno bcmbal_init(void);
93extern void bcmbal_finish(void);
94extern int bcmbal_supported_args_get(cl_argument supported_args[], int size);
95extern bcmos_errno bcmbal_cmdline_parse(int argc, char *argv[]);
96extern bcmos_errno bcmbal_log_init(void);
97extern const bcmbal_config_params *bcmbal_config_get(void);
98
99typedef void (* bcmbal_exit_cb)(void);
100
101/* Top-level initialization sequence
102 * - parse commend line
103 * - initialize OS abstraction
104 * - initialize logger
105 * - initialize BAL core and utils
106 * - initialize BAL CLI
107 */
108extern bcmos_errno bcmbal_init_all(int argc, char *argv[], bcmbal_exit_cb exit_cb);
109
110extern bcmos_bool bcmbal_is_mac_in_loopback(void);
111
112extern bcmos_bool bcmbal_is_nni_autoneg_on(bcmbal_intf_id intf_id);
113
114/*@}*/
115
116#endif /*COREMAIN_H*/
117