Shad Ansari | 2f7f9be | 2017-06-07 13:34:53 -0700 | [diff] [blame^] | 1 | /****************************************************************************** |
| 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 | The message format will look like the following |
| 34 | |
| 35 | ----------------------------------------------------------------------------------- |
| 36 | | BAL Header | | Payload Data | |
| 37 | ----------------------------------|------------------------------------------------ |
| 38 | | *bcmos_header | | App Header | | |
| 39 | ----------------------------------------------------------------------------------- |
| 40 | | | | version | | |
| 41 | | type | msg_type | obj_key | bal_util_ind_flow_t | |
| 42 | | | msg_id | status | | |
| 43 | ----------------------------------------------------------------------------------- |
| 44 | |
| 45 | *The bcmos Header is actually the first field of BAL Header structure (bal_comm_msg_hdr_t) |
| 46 | |
| 47 | type can be: |
| 48 | BCMBAL_SWITCH_UTIL_MSG |
| 49 | BCMBAL_MAC_UTIL_MSG |
| 50 | |
| 51 | msg_type can be: |
| 52 | BAL_MSG_IND, |
| 53 | BAL_MSG_AUTO_IND |
| 54 | |
| 55 | msg_id is module specific, but contains two 16 bits fields (OBJECT_ID, OPERATION_ID) |
| 56 | see bal_objs.h for OBJECT_ID details |
| 57 | The OPERATION_ID should be unique within the OBJECT - see example below |
| 58 | bal_msg.h |
| 59 | |
| 60 | status is for indication message to show general results. The value is bcmos_errno. |
| 61 | |
| 62 | *********************************************************************************/ |
| 63 | |
| 64 | /** |
| 65 | * @file bal_utils_msg.h |
| 66 | * |
| 67 | * @brief Common header for messages sent between Utils and Core |
| 68 | * |
| 69 | * @ingroup apps |
| 70 | */ |
| 71 | |
| 72 | #ifndef _BAL_UTIL_MSG_H_ |
| 73 | #define _BAL_UTIL_MSG_H_ |
| 74 | |
| 75 | /*@{*/ |
| 76 | |
| 77 | #include <bal_msg.h> |
| 78 | #include <stdint.h> |
| 79 | |
| 80 | #define BAL_UTIL_MSG_VERSION 1 |
| 81 | |
| 82 | /* access terminal request list, |
| 83 | */ |
| 84 | typedef enum |
| 85 | { |
| 86 | BAL_UTIL_OPER_ACC_TERM_CONNECT, |
| 87 | BAL_UTIL_OPER_ACC_TERM_DISCONNECT |
| 88 | } bal_util_oper_acc_term; |
| 89 | |
| 90 | /* subscriber terminal request list, |
| 91 | */ |
| 92 | typedef enum |
| 93 | { |
| 94 | BAL_UTIL_OPER_SUB_TERM_ADD, |
| 95 | BAL_UTIL_OPER_SUB_TERM_REMOVE, |
| 96 | BAL_UTIL_OPER_SUB_TERM_CLEAR, |
| 97 | BAL_UTIL_OPER_SUB_TERM_DISCOVERY |
| 98 | } bal_util_oper_sub_term; |
| 99 | |
| 100 | /* interface request list, |
| 101 | */ |
| 102 | typedef enum |
| 103 | { |
| 104 | BAL_UTIL_OPER_IF_UP, |
| 105 | BAL_UTIL_OPER_IF_DOWN |
| 106 | } bal_util_oper_if; |
| 107 | |
| 108 | /* flow request list, |
| 109 | */ |
| 110 | typedef enum |
| 111 | { |
| 112 | BAL_UTIL_OPER_FLOW_ADD, |
| 113 | BAL_UTIL_OPER_FLOW_REMOVE, |
| 114 | BAL_UTIL_OPER_FLOW_CLEAR |
| 115 | } bal_util_oper_flow; |
| 116 | |
| 117 | typedef enum |
| 118 | { |
| 119 | BAL_UTIL_FLOW_IND_SEND_NONE, |
| 120 | BAL_UTIL_FLOW_IND_SEND_SUCCESS, |
| 121 | BAL_UTIL_FLOW_IND_SEND_FAIL |
| 122 | } bal_util_flow_ind; |
| 123 | |
| 124 | /* group request list, |
| 125 | */ |
| 126 | typedef enum |
| 127 | { |
| 128 | BAL_UTIL_OPER_GROUP_CREATE, |
| 129 | BAL_UTIL_OPER_GROUP_ADD, |
| 130 | BAL_UTIL_OPER_GROUP_REMOVE, |
| 131 | BAL_UTIL_OPER_GROUP_SET, |
| 132 | BAL_UTIL_OPER_GROUP_DESTROY |
| 133 | } bal_util_oper_group; |
| 134 | |
| 135 | typedef enum |
| 136 | { |
| 137 | BAL_UTIL_OPER_AGG_PORT_ADD, |
| 138 | BAL_UTIL_OPER_AGG_PORT_REMOVE, |
| 139 | BAL_UTIL_OPER_AGG_PORT_CLEAR |
| 140 | } bal_util_oper_agg_port; |
| 141 | |
| 142 | /* Macro to retrieve the name string of the GROUP oper */ |
| 143 | #define BCMBAL_UTIL_GROUP_OPER_STR_GET(__op_type__) \ |
| 144 | ( BAL_UTIL_OPER_GROUP_CREATE == __op_type__ ) ? "create" : \ |
| 145 | ( BAL_UTIL_OPER_GROUP_ADD == __op_type__ ) ? "add" : \ |
| 146 | ( BAL_UTIL_OPER_GROUP_REMOVE == __op_type__ ) ? "remove" : \ |
| 147 | ( BAL_UTIL_OPER_GROUP_SET == __op_type__ ) ? "set" : \ |
| 148 | ( BAL_UTIL_OPER_GROUP_DESTROY == __op_type__ ) ? "destroy" : \ |
| 149 | "unknown" |
| 150 | |
| 151 | /* bal_app_msg_obj_key_t allow applications to id which instance of object |
| 152 | * this message should be processed |
| 153 | */ |
| 154 | typedef union bal_util_msg_obj_key |
| 155 | { |
| 156 | bcmbal_access_terminal_key acc_term_key; |
| 157 | bcmbal_interface_key if_key; |
| 158 | bcmbal_subscriber_terminal_key sub_term_key; |
| 159 | bcmbal_flow_key flow_key; |
| 160 | bcmbal_group_key group_key; |
| 161 | bcmbal_tm_sched_key tm_sched_key; |
| 162 | } bal_util_msg_obj_key; |
| 163 | |
| 164 | #define BCMBAL_INVALID_TUNNEL_ID 0xffffffff |
| 165 | |
| 166 | /* indication message header */ |
| 167 | typedef struct bal_util_msg_ind |
| 168 | { |
| 169 | bal_comm_msg_hdr comm_hdr; /* Communication header */ |
| 170 | uint32_t version; /* version of the app message format */ |
| 171 | bal_util_msg_obj_key obj_key; |
| 172 | int32_t status; /* bcmos_errno */ |
| 173 | /* Optional custom BAL MAC/SWITCH UTIL indication data follows */ |
| 174 | char data[0]; |
| 175 | } bal_util_msg_ind; |
| 176 | |
| 177 | /* auto indication message header */ |
| 178 | typedef bal_util_msg_ind bal_util_msg_auto_ind; |
| 179 | |
| 180 | #endif /* _BAL_UTIL_MSG_H */ |