BAL and Maple Release 2.2
Signed-off-by: Shad Ansari <developer@Carbon.local>
diff --git a/bal_release/src/lib/common/placeholder b/bal_release/src/lib/common/placeholder
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/bal_release/src/lib/common/placeholder
diff --git a/bal_release/src/lib/libbalapi/Makefile b/bal_release/src/lib/libbalapi/Makefile
new file mode 100644
index 0000000..79fea84
--- /dev/null
+++ b/bal_release/src/lib/libbalapi/Makefile
@@ -0,0 +1,38 @@
+###############################################################################
+#
+# <:copyright-BRCM:2016:DUAL/GPL:standard
+#
+# Copyright (c) 2016 Broadcom
+# All Rights Reserved
+#
+# Unless you and Broadcom execute a separate written software license
+# agreement governing use of this software, this software is licensed
+# to you under the terms of the GNU General Public License version 2
+# (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
+# with the following added to such license:
+#
+# As a special exception, the copyright holders of this software give
+# you permission to link this software with independent modules, and
+# to copy and distribute the resulting executable under terms of your
+# choice, provided that you also meet, for each linked independent
+# module, the terms and conditions of the license of that module.
+# An independent module is a module which is not derived from this
+# software. The special exception does not apply to any modifications
+# of the software.
+#
+# Not withstanding the above, under no circumstances may you combine
+# this software in any way with any other Broadcom software provided
+# under a license other than the GPL, without Broadcom's express prior
+# written consent.
+#
+# :>
+#
+###############################################################################
+MOD_NAME = bal_api
+MOD_TYPE = lib
+MOD_DEPS = common_include dev_log maple_sdk balobjmsg
+ifeq ("$(BAL_MONOLITHIC)", "y")
+MOD_DEPS += bal_core
+endif
+
+srcs = bal_api.c bal_api_worker.c
diff --git a/bal_release/src/lib/libbalapi/bal_api.c b/bal_release/src/lib/libbalapi/bal_api.c
new file mode 100644
index 0000000..4374fd2
--- /dev/null
+++ b/bal_release/src/lib/libbalapi/bal_api.c
@@ -0,0 +1,658 @@
+/******************************************************************************
+ *
+ * <:copyright-BRCM:2016:DUAL/GPL:standard
+ *
+ * Copyright (c) 2016 Broadcom
+ * All Rights Reserved
+ *
+ * Unless you and Broadcom execute a separate written software license
+ * agreement governing use of this software, this software is licensed
+ * to you under the terms of the GNU General Public License version 2
+ * (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
+ * with the following added to such license:
+ *
+ * As a special exception, the copyright holders of this software give
+ * you permission to link this software with independent modules, and
+ * to copy and distribute the resulting executable under terms of your
+ * choice, provided that you also meet, for each linked independent
+ * module, the terms and conditions of the license of that module.
+ * An independent module is a module which is not derived from this
+ * software. The special exception does not apply to any modifications
+ * of the software.
+ *
+ * Not withstanding the above, under no circumstances may you combine
+ * this software in any way with any other Broadcom software provided
+ * under a license other than the GPL, without Broadcom's express prior
+ * written consent.
+ *
+ * :>
+ *
+ *****************************************************************************/
+
+/**
+ * @file bal_api.c
+ * @brief The BAL Public API
+ *
+ * @addtogroup api
+ */
+
+/*@{*/
+
+/* Project includes */
+#include "bal_api.h"
+#include "bal_msg.h"
+#include "bal_api_worker.h"
+#include "bal_obj_msg_pack_unpack.h"
+#ifdef BAL_MONOLITHIC
+#include <bal_worker.h>
+#endif
+
+#ifdef ENABLE_LOG
+#include <bcm_dev_log.h>
+
+/*
+ * @brief The logging device id for the BAL public API
+ */
+dev_log_id log_id_public_api;
+#endif
+
+/*
+ * @brief The global mgmt queues
+ *
+ * These are the queues through which the BAL API communicates with
+ * the core, and vice versa.
+ */
+static bcmos_msg_queue balapi_rsp_queue;
+static bcmos_msg_queue balapi_to_core_queue;
+
+bcmos_msg_queue *p_balapi_rsp_queue;
+bcmos_msg_queue *p_balapi_to_core_queue;
+
+static bcmos_mutex balapi_lock;
+static uint32_t balapi_exchange_id;
+static STAILQ_HEAD(pending_req_list, bcmos_msg) pending_req_list;
+
+static bcmos_task api_rsp_rx_thread;
+static int _bal_ipc_api_rx_handler(long data);
+
+/* Rx polling timeout (us) */
+#define BAL_API_RX_POLL_TIMEOUT 100000
+
+/*****************************************************************************
+ * Initialize the BAL Public API internal data structures
+ *****************************************************************************/
+bcmos_errno bcmbal_api_init(const char *balapi_mgmt_ip_port,
+ const char *core_mgmt_ip_port)
+{
+ bcmos_errno ret = BCM_ERR_OK;
+ bcmos_msg_queue_parm msg_q_p = {};
+ bcmos_task_parm task_p = {};
+
+#ifdef ENABLE_LOG
+ log_id_public_api = bcm_dev_log_id_register("BAL_API", DEV_LOG_LEVEL_INFO, DEV_LOG_ID_TYPE_BOTH);
+ BUG_ON(log_id_public_api == DEV_LOG_INVALID_ID);
+#endif
+
+ do
+ {
+ STAILQ_INIT(&pending_req_list);
+
+ ret = bcmos_mutex_create(&balapi_lock, 0, "bal_api");
+ if (BCM_ERR_OK != ret)
+ {
+ BCM_LOG(ERROR, log_id_public_api, "Couldn't create BAL API protection mutex\n");
+ break;
+ }
+
+ /* Create BAL API RX management queue - the BAL Public API
+ * exchanges management messages with the BAL core using this queue.
+ */
+ msg_q_p.name = "balapi_mgmt_q";
+ if (NULL != balapi_mgmt_ip_port)
+ {
+ msg_q_p.local_ep_address = balapi_mgmt_ip_port;
+ msg_q_p.remote_ep_address = NULL;
+ msg_q_p.ep_type = BCMOS_MSG_QUEUE_EP_UDP_SOCKET;
+ }
+ else
+ {
+ msg_q_p.ep_type = BCMOS_MSG_QUEUE_EP_LOCAL;
+ }
+ ret = bcmos_msg_queue_create(&balapi_rsp_queue, &msg_q_p);
+ if (BCM_ERR_OK != ret)
+ {
+ BCM_LOG(ERROR, log_id_public_api, "Couldn't create BAL API mgmt queue\n");
+ ret = BCM_ERR_INTERNAL;
+ break;
+ }
+ p_balapi_rsp_queue = &balapi_rsp_queue;
+#ifdef BAL_MONOLITHIC
+ if (NULL == balapi_mgmt_ip_port)
+ p_bal_core_to_api_queue = p_balapi_rsp_queue;
+#endif
+
+ /* Create queue for sending API requests to the core. Only do it if API and core interact via UDP
+ */
+ if (NULL != core_mgmt_ip_port)
+ {
+ msg_q_p.name = "balapi_to_core_q";
+ msg_q_p.local_ep_address = NULL;
+ msg_q_p.remote_ep_address = core_mgmt_ip_port;
+ msg_q_p.ep_type = BCMOS_MSG_QUEUE_EP_UDP_SOCKET;
+
+ ret = bcmos_msg_queue_create(&balapi_to_core_queue, &msg_q_p);
+ if (BCM_ERR_OK != ret)
+ {
+ BCM_LOG(ERROR, log_id_public_api, "Couldn't create BAL API mgmt queue\n");
+ ret = BCM_ERR_INTERNAL;
+ break;
+ }
+ p_balapi_to_core_queue = &balapi_to_core_queue;
+ }
+
+ /* Create BAL API RX thread */
+ task_p.name = "ipc_api_rsp_rx_thread";
+ task_p.priority = TASK_PRIORITY_IPC_RX;
+ task_p.handler = _bal_ipc_api_rx_handler;
+ task_p.data = (long)p_balapi_rsp_queue;
+
+ ret = bcmos_task_create(&api_rsp_rx_thread, &task_p);
+ if (ret)
+ {
+ BCM_LOG(ERROR, log_id_public_api, "Couldn't create BAL API response RX thread\n");
+ break;
+ }
+
+ /*
+ * Initialize the BAL Public API backend worker and rx threads. These
+ * threads are used to receive asynchronous indications from the core.
+ */
+ enable_bal_api_indications(balapi_mgmt_ip_port);
+
+ }
+ while(0);
+
+ return ret;
+}
+
+/*****************************************************************************
+ * Un-initialize the BAL Public API internal data structures
+ *****************************************************************************/
+bcmos_errno bcmbal_api_finish(void)
+{
+ bcmos_task_destroy(&api_rsp_rx_thread);
+ bcmos_msg_queue_destroy(&balapi_rsp_queue);
+ if (p_balapi_to_core_queue == &balapi_to_core_queue)
+ bcmos_msg_queue_destroy(&balapi_to_core_queue);
+
+ bal_api_indications_finish();
+
+ return BCM_ERR_OK;
+}
+
+/* Find pending request matching response */
+static bal_comm_msg_hdr *_bal_api_get_request_by_ex_id(uint32_t ex_id)
+{
+ bcmos_msg *req_msg, *tmp_msg;
+ bal_comm_msg_hdr *comm_hdr = NULL;
+
+ STAILQ_FOREACH_SAFE(req_msg, &pending_req_list, next, tmp_msg)
+ {
+ comm_hdr = bcmbal_bal_hdr_get_by_bcmos_hdr(req_msg);
+ if (comm_hdr->ex_id == ex_id)
+ {
+ STAILQ_REMOVE(&pending_req_list, req_msg, bcmos_msg, next);
+ break;
+ }
+ }
+ return req_msg ? comm_hdr : NULL;
+}
+
+/* Check if any pending request timed out */
+static void _bal_api_check_req_timeout(void)
+{
+ bcmos_msg *req_msg, *tmp_msg;
+ bal_comm_msg_hdr *comm_hdr;
+ bcmbal_obj *req_obj;
+ uint32_t ts = bcmos_timestamp();
+
+ STAILQ_FOREACH_SAFE(req_msg, &pending_req_list, next, tmp_msg)
+ {
+ comm_hdr = bcmbal_bal_hdr_get_by_bcmos_hdr(req_msg);
+ if (ts - comm_hdr->timestamp >= BCMBAL_MSG_TIMEOUT_1_SEC)
+ {
+ STAILQ_REMOVE(&pending_req_list, req_msg, bcmos_msg, next);
+ req_obj = (bcmbal_obj *)bcmbal_payload_ptr_get(comm_hdr);
+ /* Release pending API call */
+ req_obj->status = BCM_ERR_TIMEOUT;
+ BCM_LOG(DEBUG, log_id_public_api, "Timing out request %p\n", comm_hdr);
+ bcmos_sem_post(&comm_hdr->sem);
+ }
+ }
+}
+
+/* API response handler */
+static int _bal_ipc_api_rx_handler(long data)
+{
+ static uint32_t last_timeout_check_ts;
+ bcmos_msg_queue *rxq = (bcmos_msg_queue *)data;
+ bcmos_task *my_task = bcmos_task_current();
+ bcmos_msg *msg;
+ bcmos_errno ret = BCM_ERR_OK;
+ uint32_t ex_id;
+ bal_comm_msg_hdr *req;
+ bcmbal_obj *req_obj;
+
+ last_timeout_check_ts = bcmos_timestamp();
+ while (!my_task->destroy_request)
+ {
+ /* Wait for response */
+ msg = NULL;
+ req = NULL;
+
+ ret = bcmos_msg_recv(rxq, BAL_API_RX_POLL_TIMEOUT, &msg);
+ if(BCM_ERR_OK != ret && BCM_ERR_TIMEOUT != ret)
+ {
+ BCM_LOG(ERROR, log_id_public_api,
+ "error during bcmos_msg_recv (error:%s)\n", bcmos_strerror(ret));
+ }
+
+ /* Peek exchange id */
+ if (msg)
+ {
+ ret = bcmbal_bal_msg_peek_ex_id(msg, &ex_id);
+ if(BCM_ERR_OK != ret)
+ {
+ BCM_LOG(ERROR, log_id_public_api,
+ "bad message. Can't find exchange id (error:%s)\n", bcmos_strerror(ret));
+ bcmos_msg_free(msg);
+ msg = NULL;
+ }
+ else
+ {
+ BCM_LOG(DEBUG, log_id_public_api, "Received message with ex_id=%u\n", ex_id);
+ }
+ }
+
+ /* Now find pending request and also check if any pending request(s) timed out */
+ bcmos_mutex_lock(&balapi_lock);
+ if (msg)
+ {
+ req = _bal_api_get_request_by_ex_id(ex_id);
+ if (NULL == req)
+ {
+ BCM_LOG(ERROR, log_id_public_api,
+ "Request with ex_id=%u is not found. Probably expired. Response discarded\n", ex_id);
+ }
+ else
+ {
+ BCM_LOG(DEBUG, log_id_public_api, "Found request %p\n", req);
+ }
+ }
+ if (bcmos_timestamp() - last_timeout_check_ts >= BCMBAL_MSG_TIMEOUT_1_SEC)
+ {
+ _bal_api_check_req_timeout();
+ last_timeout_check_ts = bcmos_timestamp();
+ }
+ bcmos_mutex_unlock(&balapi_lock);
+
+ /* Got a message. Now unpack it */
+ if (req)
+ {
+ req_obj = (bcmbal_obj *)bcmbal_payload_ptr_get(req);
+ ret = bcmbal_obj_msg_unpack(msg, &req);
+ if (BCM_ERR_OK != ret)
+ {
+ BCM_LOG(ERROR, log_id_public_api, "Error during message unpack: %s\n", bcmos_strerror(ret));
+ req_obj->status = ret;
+ }
+ /* Release pending API */
+ BCM_LOG(DEBUG, log_id_public_api, "Posting request semaphore for %p\n", req);
+ bcmos_sem_post(&req->sem);
+ }
+
+ if (msg)
+ bcmos_msg_free(msg); /* release packed message. It is no longer needed */
+ }
+
+ my_task->destroyed = BCMOS_TRUE;
+
+ return (BCM_ERR_OK == ret) ? 0 : -EINVAL;
+}
+
+static bcmbal_mgmt_oper_id _bcmbal_obj_to_oper_id(const bcmbal_obj *objinfo)
+{
+ if (objinfo->group == BCMBAL_MGT_GROUP_STAT)
+ {
+ return BCMBAL_MGMT_OPER_ID_GET_STATS;
+ }
+ else if ((objinfo->type & BCMBAL_OBJ_MSG_TYPE_GET))
+ {
+ return BCMBAL_MGMT_OPER_ID_GET;
+ }
+ else if ((objinfo->type & BCMBAL_OBJ_MSG_TYPE_CLEAR))
+ {
+ return BCMBAL_MGMT_OPER_ID_CLEAR;
+ }
+ else
+ {
+ return BCMBAL_MGMT_OPER_ID_SET;
+ }
+}
+
+#define BALAPI_OPER_TIMEOUT (30000000) /* 30 seconds */
+
+static bcmos_errno _bcmbal_oper(bcmbal_obj *objinfo)
+{
+ bal_comm_msg_hdr *comm_hdr = bcmbal_bal_hdr_get(objinfo);
+ bcmos_msg *os_msg;
+ bcmos_errno ret = BCM_ERR_OK;
+
+ /*
+ * Send the message to the core for processing
+ */
+
+ /* Parameter checks */
+ BUG_ON(NULL == objinfo);
+
+ /* Check the magic number to be sure that the object has been properly initialized */
+ if(BCMBAL_OBJ_INIT_VAL != objinfo->obj_init_val)
+ {
+ BCM_LOG(ERROR, log_id_public_api,
+ "Object has not been initialized: must use a BCMBAL INIT macro on the object before calling the BAL API\n");
+ return BCM_ERR_PARM;
+ }
+
+ ret = bcmos_sem_create(&comm_hdr->sem, 0, 0, "api_req");
+ if (ret)
+ {
+ BCM_LOG(ERROR, log_id_public_api, "Can't create semaphore: %s\n", bcmos_strerror(ret));
+ /* return here. We don't want to destroy semaphore that wasn't created */
+ return ret;
+ }
+
+ do
+ {
+ bcmbal_msg_hdr_set(objinfo,
+ BCMBAL_MGMT_MSG,
+ BAL_MSG_TYPE_REQ,
+ BAL_SUBSYSTEM_PUBLIC_API,
+ objinfo->obj_type,
+ _bcmbal_obj_to_oper_id(objinfo),
+ 0);
+
+ BCM_LOG(DEBUG, log_id_public_api, "about to send %p\n", objinfo);
+
+ bcmos_mutex_lock(&balapi_lock);
+ bcmbal_ex_id_set(objinfo, ++balapi_exchange_id);
+ os_msg = bcmbal_bcmos_hdr_get(objinfo);
+ STAILQ_INSERT_TAIL(&pending_req_list, os_msg, next);
+ bcmos_mutex_unlock(&balapi_lock);
+
+ if (BCM_ERR_OK != (ret = bcmbal_msg_send(p_balapi_to_core_queue, objinfo, BCMOS_MSG_SEND_NO_FREE_ON_ERROR)))
+ {
+ BCM_LOG(ERROR, log_id_public_api, "message send failed with error: %s\n", bcmos_strerror(ret));
+ break;
+ }
+ BCM_LOG(DEBUG, log_id_public_api, "REQ message sent to core\n");
+
+ /*
+ * We've sent the message to the core, now, wait for the response (or timeout)
+ */
+ ret = bcmos_sem_wait(&comm_hdr->sem, BALAPI_OPER_TIMEOUT);
+ if (BCM_ERR_OK != ret)
+ {
+ BCM_LOG(ERROR, log_id_public_api, "rsp message receive for failed with error: %s\n",
+ bcmos_strerror(ret));
+ break;
+ }
+ BCM_LOG(DEBUG, log_id_public_api, "RSP message received from core\n");
+
+ if (BCM_ERR_OK != ret)
+ {
+ BCM_LOG(ERROR, log_id_public_api, "failed to process rsp msg\n");
+ break;
+ }
+
+ if(BCM_ERR_OK != objinfo->status)
+ {
+ BCM_LOG(ERROR, log_id_public_api, "remote message command status is: %s\n",
+ bcmos_strerror(objinfo->status));
+ }
+
+ /*
+ * Pass the command status received from the core back to the caller
+ */
+ ret = objinfo->status;
+ }
+ while(0);
+
+ bcmos_sem_destroy(&comm_hdr->sem);
+
+ return ret;
+}
+
+/*****************************************************************************
+ * BAL Public API Set (or modify) command.
+ *****************************************************************************/
+bcmos_errno bcmbal_cfg_set(bcmbal_cfg *objinfo)
+{
+ bcmos_errno ret = BCM_ERR_OK;
+
+ BCM_LOG(INFO, log_id_public_api, "BAL PUBLIC API - BCMBAL_SET\n");
+
+ if(BCMBAL_OBJ_ID_PACKET == objinfo->hdr.obj_type)
+ {
+ BCM_LOG(ERROR, log_id_public_api, "unsupported object id detected %d\n", objinfo->hdr.obj_type);
+ ret = BCM_ERR_NOT_SUPPORTED;
+
+ }
+ else
+ {
+ objinfo->hdr.type = BCMBAL_OBJ_MSG_TYPE_SET;
+ ret = _bcmbal_oper(&objinfo->hdr);
+ }
+
+ return ret;
+}
+
+#define BCMBAL_MAX_PROXY_PACKET_SIZE (1600)
+
+/*****************************************************************************
+ * BAL Public API Packet Send function.
+ *****************************************************************************/
+bcmos_errno bcmbal_pkt_send(bcmbal_dest dest,
+ const char *packet_to_send,
+ uint16_t packet_len)
+{
+ /* Convert the user packet into a BAL object */
+ bcmbal_packet_cfg *p_packet_obj;
+ bcmbal_packet_key key;
+ bcmbal_u8_list_u32 pkt;
+ bcmos_errno ret;
+
+ BCM_LOG(INFO, log_id_public_api, "BAL PUBLIC API - BCMBAL_SEND to %s\n",
+ (BCMBAL_DEST_TYPE_NNI == dest.type) ? "NNI" : "SUB-TERM");
+
+ if(BCMBAL_MAX_PROXY_PACKET_SIZE < packet_len)
+ {
+ BCM_LOG(ERROR, log_id_public_api, "user packet length (%d) cannot be greater than %d\n",
+ packet_len,
+ BCMBAL_MAX_PROXY_PACKET_SIZE);
+
+ return BCM_ERR_PARM;
+ }
+
+ BCM_LOG(INFO, log_id_public_api, "user packet first 8 bytes %02X%02X%02X%02X%02X%02X%02X%02X\n",
+ packet_to_send[0], packet_to_send[1], packet_to_send[2], packet_to_send[3],
+ packet_to_send[4], packet_to_send[5], packet_to_send[6], packet_to_send[7]);
+
+ /* Set up the object key */
+ key.packet_send_dest = dest;
+
+ /* Allocate room for the packet object including the user packet */
+ p_packet_obj = bcmos_calloc(sizeof(bcmbal_packet_cfg) + packet_len);
+
+ BCMBAL_CFG_INIT(p_packet_obj, packet, key);
+
+ /* Now fill in user packet data into the object */
+ pkt.len = packet_len;
+ pkt.val = (uint8_t *)&p_packet_obj[1];
+ memcpy(pkt.val, packet_to_send, packet_len);
+
+ BCMBAL_CFG_PROP_SET(p_packet_obj, packet, pkt, pkt);
+
+ p_packet_obj->hdr.hdr.type = BCMBAL_OBJ_MSG_TYPE_SET; /* internally packet SEND is modeled as a config SET */
+ ret = _bcmbal_oper(&(p_packet_obj->hdr.hdr));
+ bcmos_free(p_packet_obj);
+
+ return ret;
+}
+
+/*****************************************************************************
+ * BAL Public API Get command.
+ *****************************************************************************/
+bcmos_errno bcmbal_cfg_get(bcmbal_cfg *objinfo)
+{
+ bcmos_errno ret = BCM_ERR_OK;
+
+ BCM_LOG(DEBUG, log_id_public_api, "BAL PUBLIC API - BCMBAL_GET\n");
+
+ if(BCMBAL_OBJ_ID_PACKET == objinfo->hdr.obj_type)
+ {
+ BCM_LOG(ERROR, log_id_public_api, "unsupported object id detected %d\n", objinfo->hdr.obj_type);
+ ret = BCM_ERR_NOT_SUPPORTED;
+
+ }
+ else
+ {
+ objinfo->hdr.type = BCMBAL_OBJ_MSG_TYPE_GET;
+ ret = _bcmbal_oper(&(objinfo->hdr));
+ }
+
+ return ret;
+}
+
+/*****************************************************************************
+ * BAL Public API Clear command.
+ *****************************************************************************/
+bcmos_errno bcmbal_cfg_clear(bcmbal_cfg *objinfo)
+{
+ bcmos_errno ret = BCM_ERR_OK;
+
+ BCM_LOG(INFO, log_id_public_api, "BAL PUBLIC API - BCMBAL_CLEAR\n");
+
+ if(BCMBAL_OBJ_ID_PACKET == objinfo->hdr.obj_type)
+ {
+ BCM_LOG(ERROR, log_id_public_api, "unsupported object id detected %d\n", objinfo->hdr.obj_type);
+ ret = BCM_ERR_NOT_SUPPORTED;
+
+ }
+ else
+ {
+ objinfo->hdr.type = BCMBAL_OBJ_MSG_TYPE_CLEAR;
+ ret = _bcmbal_oper(&objinfo->hdr);
+ }
+
+ return ret;
+}
+
+/*****************************************************************************
+ * @brief BAL Public API Get Stats command.
+ *****************************************************************************/
+bcmos_errno bcmbal_stat_get(bcmbal_stat *objinfo)
+{
+
+ /* Parameter checks */
+ BUG_ON(NULL == objinfo);
+
+ /*
+ * @todo Finish the stats function
+ */
+
+ BCM_LOG(ERROR, log_id_public_api, "bal get stats API not supported\n");
+
+ return BCM_ERR_NOT_SUPPORTED;
+}
+
+/*****************************************************************************
+ * BAL Public API indication subscription.
+ *****************************************************************************/
+bcmos_errno bcmbal_subscribe_ind(bcmbal_cb_cfg *cb_cfg)
+{
+
+ bcmos_errno ret = BCM_ERR_OK;
+
+ /*
+ * The indication subscription function
+ */
+ BCM_LOG(DEBUG, log_id_public_api, "BAL indication subscription for type: %s (%d)\n",
+ bcmbal_objtype_str(cb_cfg->obj_type), cb_cfg->obj_type);
+
+ ret = _manage_api_ind_listener(IND_CB_SUBSCRIBE, cb_cfg);
+
+ return ret;
+}
+
+/*****************************************************************************
+ * BAL Public API indication un-subscription.
+ *****************************************************************************/
+bcmos_errno bcmbal_unsubscribe_ind(bcmbal_cb_cfg *cb_cfg)
+{
+
+ bcmos_errno ret = BCM_ERR_OK;
+
+ BUG_ON(NULL == cb_cfg);
+
+ /*
+ * The indication subscription function
+ */
+ BCM_LOG(DEBUG, log_id_public_api, "BAL indication un-subscription for type: %s (%d)\n",
+ bcmbal_objtype_str(cb_cfg->obj_type), cb_cfg->obj_type);
+
+ ret = _manage_api_ind_listener(IND_CB_UNSUBSCRIBE, cb_cfg);
+
+ return ret;
+}
+
+/*****************************************************************************/
+/**
+ * @brief A function to get the string representation of the interface type
+ *
+ * @param int_type The interface type to get
+ *
+ * @returns const char * A pointer to a string containing the interface type,
+ * or "INVALID", if not a valid type.
+ *
+ *****************************************************************************/
+const char *bcmbal_get_interface_type_str(bcmbal_intf_type int_type)
+{
+ const char *type_str;
+
+ switch (int_type)
+ {
+ case(BCMBAL_INTF_TYPE_PON):
+ {
+ type_str = "pon";
+ }
+ break;
+
+ case(BCMBAL_INTF_TYPE_NNI):
+ {
+ type_str = "nni";
+ }
+ break;
+
+ default:
+ {
+ type_str = "INVALID";
+ }
+ break;
+
+ }
+
+ return type_str;
+}
+
+
+/*@}*/
diff --git a/bal_release/src/lib/libbalapi/bal_api.dox b/bal_release/src/lib/libbalapi/bal_api.dox
new file mode 100644
index 0000000..f8db011
--- /dev/null
+++ b/bal_release/src/lib/libbalapi/bal_api.dox
@@ -0,0 +1,108 @@
+/*
+ * BAL Programmers Guide - introduction
+ */
+
+/** \mainpage BAL Public Interface Concept
+
+\section intro Introduction
+This document describes the BAL user interface. The user interface is constructed from a
+small set of public APIs and an objects model.
+
+The objects model is designed to manage different entities in the system, and enables a simple and intuitive
+approach for managing line card.
+
+The API layer is designed to enable the management of line card containing muultiple MAC and SWITCH devices
+and support any host application architecture. It includes a set of APIs to access the line card configuration and
+asynchronous indications to send events to the host application.
+
+The API layer is part of the Broadcom® BAL SDK, which is provided as C source code, which is
+independent of the CPU and operating system being used.
+
+\section object_model_table BAL Object Model
+
+The system is modeled as a set of managed objects. The term “object” here doesn’t imply any inheritance, it
+means an entity that can be addressed individually and has a set of properties (attributes) and methods
+(operations), for example, access_terminal, flow, etc.
+
+Each object can have multiple properties (aka attributes), whereas a property is an object parameter that can be set or
+retrieved independently.
+ - A property is a simple type or a structure containing one or more fields, where fields can themselves be
+structures
+ - Each property has a specific permission type, such as Read-Only (RO) and Read-Write (RW).
+
+Object properties are grouped into sections/management groups. The following sections can contain zero or
+more properties:
+ - Key—Field(s) that uniquely identify the object instance (for example, subscriber_terminal key = {subs_id, intf_id}).
+ - Configuration
+ - Read-Write, Read-Only and Write-Only configuration properties
+ - Statistics
+ - Performance monitoring counters
+ - Debug counters
+ - Autonomous Indications
+ - Notifications that are generated asynchronously.
+ Indications can be either autonomous (such as alarms) or asynchronous responses to previously
+ submitted configuration change (for instance, subscriber_terminal admin_state=up request).
+
+\section object_model_prop Object and Properties Implementation
+
+\subsection object_model_structs Object Structures
+
+The main input parameter of all the APIs is an object structure, referred to as the Object Request Message. Each
+object section has a different structure that includes a generic header, object key, and a specific section structure
+according to the section type (for example, configuration, statics, etc).
+ - Generic header: A basic component of all the different section structures is the object generic header
+ \ref bcmbal_obj
+
+ - The configuration structure bcmbal_xx_cfg contains:
+ - The generic header \ref bcmbal_cfg
+ - The object key, if any
+ - The structure bcmbal_xx_cfg_data, containing all object configuration properties
+
+ - This statistics structure bcmbal_xx_stat contains:
+ - The generic header \ref bcmbal_stat
+ - The object key, if any
+ - The structure bcmbal_xx_stat_data, containing all the object statistics
+
+ - The per-autonomous indication structure bcmbal_xx_auto_yy contains:
+ - The generic header \ref bcmbal_auto
+ - The autonomous message ID is stored in the subgroup field.
+ - The object key, if any
+ - The structure bcmbal_xx_auto_yy_data, containing all indication properties, if any
+
+\subsection object_model_init_macros Structure Initialization Macros
+The following macros are used for initializing objects:
+ - \ref BCMBAL_CFG_INIT(cfg_msg, _object, _key)
+ - \ref BCMBAL_STAT_INIT(stat_msg, _object, _key)
+
+The macros perform the following tasks:
+ - Check that the structure matches the object section.
+ - Clear all control fields in the generic header \ref bcmbal_obj.
+
+\subsection object_model_prop_macros Property Presence Mask Manipulation Macros
+The presence mask indicates which of the properties in the object structure need to be accessed (set/get, etc.)
+The mask is a bit field, wherein each bit corresponds to a specific property. The following macros should be used
+for setting the presence mask:
+
+ - Set configuration parameter value:\n
+ \ref BCMBAL_CFG_PROP_SET(_msg, _object, _parm_name, _parm_value)
+ - Indicate that the property should be fetched by a bcmolt_cfg_get() request:\n
+ \ref BCMBAL_CFG_PROP_GET(_msg, _object, _parm_name)
+ - Indicate that the statistic should be fetched by a bcmolt_stat_get() request:\n
+ \ref BCMBAL_STAT_PROP_GET(_msg, _object, _parm_name)
+
+\subsection object_model_enums Enumerations
+In the following descriptions, XX is the object name and YY is the property name from the XML model.
+
+The system model includes the enumerations:
+ - The bcmbal_obj_id enumeration lists all objects. It includes per-object BCMBAL_OBJ_ID_XX constants,
+ where XX is the object name from the XML model.
+ - The bcmbal_xx_cfg_id enumeration lists all XX objects' properties from the “Configuration” section in the
+ XML model. It includes the BCMBAL_XX_CFG_ID_YY constants.
+ - The bcmbal_xx_stat_id enumeration lists all XX object's properties from the “Statistics” section in the XML
+ model. It includes the BCMBAL_XX_STAT_ID_YY constants.
+ - The bcmbal_xx_auto_id enumeration lists all XX object's indications from the “Autonomous Indications”
+ section in the XML model. It includes the BCMBAL_XX_AUTO_ID_YY constants.
+
+\section api_section BAL Public API
+ See \ref api in API Reference chapter
+*/
diff --git a/bal_release/src/lib/libbalapi/bal_api.h b/bal_release/src/lib/libbalapi/bal_api.h
new file mode 100644
index 0000000..60f1e0b
--- /dev/null
+++ b/bal_release/src/lib/libbalapi/bal_api.h
@@ -0,0 +1,286 @@
+/******************************************************************************
+ *
+ * <:copyright-BRCM:2016:DUAL/GPL:standard
+ *
+ * Copyright (c) 2016 Broadcom
+ * All Rights Reserved
+ *
+ * Unless you and Broadcom execute a separate written software license
+ * agreement governing use of this software, this software is licensed
+ * to you under the terms of the GNU General Public License version 2
+ * (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
+ * with the following added to such license:
+ *
+ * As a special exception, the copyright holders of this software give
+ * you permission to link this software with independent modules, and
+ * to copy and distribute the resulting executable under terms of your
+ * choice, provided that you also meet, for each linked independent
+ * module, the terms and conditions of the license of that module.
+ * An independent module is a module which is not derived from this
+ * software. The special exception does not apply to any modifications
+ * of the software.
+ *
+ * Not withstanding the above, under no circumstances may you combine
+ * this software in any way with any other Broadcom software provided
+ * under a license other than the GPL, without Broadcom's express prior
+ * written consent.
+ *
+ * :>
+ *
+ *****************************************************************************/
+
+/**
+ * @file bal_api.h
+ * @brief Function declarations and all inclusions required for the BAL Public API
+ *
+ * @defgroup api BAL Public API
+ */
+#ifndef BCMBAL_API_H
+#define BCMBAL_API_H
+
+#include <bcmos_system.h>
+#include <bcmolt_model_types.h>
+
+#include <bal_objs.h>
+
+
+/*@{*/
+
+/*
+ * This example only controls the default access terminal
+ */
+#define DEFAULT_ATERM_ID (0)
+
+/* Max number of access-terminals supported by BAL */
+#define MAX_ACC_TERM_ID (255)
+
+/*------------------------------------------------
+ * See the bal_objs.h file for the BAL objects
+ *------------------------------------------------
+ */
+
+/*
+ * An enumeration of the BAL mgmt operations
+ */
+typedef enum
+{
+ BCMBAL_MGMT_OPER_ID_SET = 1 << 0,
+ BCMBAL_MGMT_OPER_ID_GET = 1 << 1,
+ BCMBAL_MGMT_OPER_ID_GET_STATS = 1 << 2,
+ BCMBAL_MGMT_OPER_ID_CLEAR = 1 << 3,
+ BCMBAL_MGMT_OPER_ID__NUM_OF = 1 << 4,
+ BCMBAL_MGMT_OPER_ID_ALL = BCMBAL_MGMT_OPER_ID__NUM_OF - 1,
+} bcmbal_mgmt_oper_id;
+
+
+/* access_terminal:key:acc_term_id max value */
+#define BAL_API_MAX_ACC_TERM_ID (255)
+
+/* flow:key:flow_id max value */
+#define BAL_API_MAX_FLOW_ID (65535)
+
+/* interface:mtu limits */
+#define BAL_API_MIN_INTF_MTU_SIZE (64)
+#define BAL_API_MAX_INTF_MTU_SIZE (9216)
+
+/* Max number of interfaces per interface:type in BAL */
+#define BAL_API_MAX_INTF_ID (15)
+
+/* Max sub_term_id per interface for the various modes */
+#define BAL_API_MAX_SUB_TERM_ID_GPON (127)
+#define BAL_API_MAX_SUB_TERM_ID_EPON (256)
+#define BAL_API_MAX_SUB_TERM_ID_XGPON (511)
+
+/* Max and min values for interface attributes */
+#define BAL_API_MIN_LOW_DATA_AGG_PORT_ID (256)
+#define BAL_API_MAX_LOW_DATA_AGG_PORT_ID (14591)
+
+#define BAL_API_MIN_LOW_DATA_SVC_PORT_ID (1024)
+#define BAL_API_MAX_LOW_DATA_SVC_PORT_ID (57598)
+
+
+/* Max and Min values for agg_port_id and svc_port_id */
+#define BAL_API_MIN_DATA_SVC_PORT_ID (256)
+#define BAL_API_MAX_DATA_SVC_PORT_ID (16383)
+
+/* Max and Min values for agg_port_id and svc_port_id */
+#define BAL_API_MIN_DATA_AGG_PORT_ID (256)
+#define BAL_API_MAX_DATA_AGG_PORT_ID (16383)
+
+/* Max value for pbits */
+#define MAX_PBITS_VALUE (7)
+
+/*
+ * BAL CLI max values
+ */
+/** Max number of supported OLTs */
+#define MAX_SUPPORTED_OLTS (BAL_API_MAX_ACC_TERM_ID+1)
+
+/** Max number of supported subscriber terminals (ONUs) */
+#define MAX_SUPPORTED_SUBS (BAL_API_MAX_SUB_TERM_ID_XGPON+1)
+
+/** Max number of supported flows */
+#define MAX_SUPPORTED_FLOWS (BAL_API_MAX_FLOW_ID+1)
+
+/** Max number of supported PON and NNI interfaces */
+#define MAX_SUPPORTED_INTF (BAL_API_MAX_INTF_ID+1)
+
+/** BAL Indication callback handler function prototype */
+typedef void (*f_bcmbal_ind_handler)(bcmbal_obj *obj);
+
+/** BAL Indication callback registration parameters */
+typedef struct bcmbal_cb_cfg
+{
+ bcmbal_obj_id obj_type; /**< Object type */
+ f_bcmbal_ind_handler ind_cb_hdlr; /**< Indication callback function. NULL=unregister */
+ bcmos_module_id module; /**< Target module id.
+ If it is BCMOS_MODULE_ID_NONE (0), the callback will be called
+ in BAL's context. Otherwise, it will be called in application
+ module's context */
+} bcmbal_cb_cfg; /* This structure is used for passing the mgmt queue
+
+ * IP:port information between the core main thread and
+ * core worker thread and bal API.
+ */
+typedef struct mgmt_queue_addr_ports
+{
+ const char *core_mgmt_ip_port;
+ const char *balapi_mgmt_ip_port;
+} mgmt_queue_addr_ports;
+
+extern dev_log_id log_id_public_api;
+
+const char *bcmbal_get_interface_type_str(bcmbal_intf_type int_type);
+
+/*
+ *------------------------------------------------------------------------------------------
+ *
+ * @brief The BAL Public API
+ *
+ *------------------------------------------------------------------------------------------
+ */
+
+/**
+ * @brief Initialize the BAL Public API internal data structures
+ *
+ * @param balapi_mgmt_ip_port The IP:port of the BAL API management queue
+ *
+ * @param core_mgmt_ip_port The IP:port of the core management queue
+ *
+ * @returns bcmos_errno
+ *
+ **/
+bcmos_errno bcmbal_api_init(const char *balapi_mgmt_ip_port, const char *core_mgmt_ip_port);
+
+/**
+ * @brief Un-initialize the BAL Public API internal data structures
+ *
+ * @returns bcmos_errno == BCM_ERR_OK
+ *
+ **/
+bcmos_errno bcmbal_api_finish(void);
+
+/**
+ * @brief BAL Public API Set (or modify) command.
+ *
+ * Set (or modify) the specified object instance (with implicit creation
+ * of dynamic objects) associated with the specified access-terminal device.
+ *
+ * @param objinfo A pointer to a BAL object
+ *
+ * @returns bcmos_errno
+ *
+ **/
+bcmos_errno bcmbal_cfg_set(bcmbal_cfg *objinfo);
+
+/**
+ * @brief BAL Public API Get command.
+ *
+ * Get the specified object instance
+ *
+ * @param objinfo A pointer to a BAL object
+ *
+ * @returns bcmos_errno
+ *
+ */
+bcmos_errno bcmbal_cfg_get(bcmbal_cfg *objinfo);
+
+/**
+ * @brief BAL Public API Packet Send function.
+ *
+ * Send a packet to the specified destination
+ *
+ * @param dest The destination of the user packet
+ *
+ * @param packet_to_send A pointer to the user packet to send to the specified destination
+ *
+ * @param packet_len The length of the user packet (must be <=1600 bytes)
+ *
+ * @returns bcmos_errno
+ *
+ */
+bcmos_errno bcmbal_pkt_send(bcmbal_dest dest,
+ const char *packet_to_send,
+ uint16_t packet_len);
+
+/**
+ * @brief BAL Public API Clear command.
+ *
+ * Set all attributes to default (or remove the object instance for
+ * dynamic objects) for the specified object instance
+ *
+ * @param objinfo A pointer to a BAL object
+ *
+ * @returns bcmos_errno
+ *
+ */
+bcmos_errno bcmbal_cfg_clear(bcmbal_cfg * objinfo);
+
+/**
+ * @brief BAL Public API Get Stats command.
+ *
+ * Get (and clear) the stats associated with specified object instance
+ *
+ * @param objinfo A pointer to a BAL object
+ *
+ * @returns bcmos_errno
+ *
+ */
+bcmos_errno bcmbal_stat_get(bcmbal_stat *objinfo);
+
+/**
+ * @brief BAL Public API indication subscription.
+ *
+ * Subscription function for the specified indications
+ *
+ * @param cb_cfg A pointer to the callback configuration parameters for the
+ * object indications being subscribed to.
+ *
+ * @returns bcmos_errno
+ *
+ */
+bcmos_errno bcmbal_subscribe_ind(bcmbal_cb_cfg *cb_cfg);
+
+/**
+ * @brief BAL Public API indication un-subscription.
+ *
+ * Un-subscription function for the specified (or all) indications
+ *
+ * @param cb_cfg A pointer to the callback configuration parameters for the
+ * object indications being un-subscribed from.
+ *
+ * @returns bcmos_errno
+ *
+ */
+bcmos_errno bcmbal_unsubscribe_ind(bcmbal_cb_cfg *cb_cfg);
+
+/**
+ * @brief Get the number of NNI ports supported by the running system
+ *
+ * @returns Number of NNI ports
+ */
+uint16_t bcmbal_num_nni_ports_get(void);
+
+/*@}*/
+
+#endif /* BCMBAL_API_H */
diff --git a/bal_release/src/lib/libbalapi/bal_api_worker.c b/bal_release/src/lib/libbalapi/bal_api_worker.c
new file mode 100644
index 0000000..178060c
--- /dev/null
+++ b/bal_release/src/lib/libbalapi/bal_api_worker.c
@@ -0,0 +1,513 @@
+/******************************************************************************
+ *
+ * <:copyright-BRCM:2016:DUAL/GPL:standard
+ *
+ * Copyright (c) 2016 Broadcom
+ * All Rights Reserved
+ *
+ * Unless you and Broadcom execute a separate written software license
+ * agreement governing use of this software, this software is licensed
+ * to you under the terms of the GNU General Public License version 2
+ * (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
+ * with the following added to such license:
+ *
+ * As a special exception, the copyright holders of this software give
+ * you permission to link this software with independent modules, and
+ * to copy and distribute the resulting executable under terms of your
+ * choice, provided that you also meet, for each linked independent
+ * module, the terms and conditions of the license of that module.
+ * An independent module is a module which is not derived from this
+ * software. The special exception does not apply to any modifications
+ * of the software.
+ *
+ * Not withstanding the above, under no circumstances may you combine
+ * this software in any way with any other Broadcom software provided
+ * under a license other than the GPL, without Broadcom's express prior
+ * written consent.
+ *
+ * :>
+ *
+ *****************************************************************************/
+
+/**
+ * @file bal_api_worker.c
+ * @brief Main processing loop for the worker thread that handles INDications
+ * sent from the core to the BAL public API
+ *
+ */
+
+/*
+ * We need access to the BAL subsystem names
+ */
+#define BAL_SUBSYSTEM_STR_REQ
+
+#include <bcmos_system.h>
+#include <bal_msg.h>
+#include <bal_obj_msg_pack_unpack.h>
+#include <bal_osmsg.h>
+#include <bal_api.h>
+#include "bal_api_worker.h"
+#ifdef BAL_MONOLITHIC
+#include <bal_worker.h>
+#endif
+#ifdef ENABLE_LOG
+#include <bcm_dev_log.h>
+#endif
+
+/* This rx thread and worker thread are used to process indications from the core
+ */
+static bcmos_task api_ind_rx_thread;
+static bcmos_task api_ind_worker_thread;
+
+/* Local function declarations */
+static int _bal_ipc_api_ind_rx_handler(long data);
+static void bal_ipc_api_indication_handler(bcmos_module_id module_id, bcmos_msg *msg);
+
+
+typedef struct indication_subscription_inst indication_subscription_inst;
+struct indication_subscription_inst
+{
+ bcmbal_cb_cfg cb_cfg;
+ /**< TAILQ link for list management */
+ TAILQ_ENTRY(indication_subscription_inst) indication_subscription_inst_next;
+};
+
+TAILQ_HEAD(indication_subscription_list_head, indication_subscription_inst) indication_subscription_list;
+
+/*
+ * The queue through which the core converses with
+ * the backend of the Public API for indications.
+ */
+static bcmos_msg_queue bal_api_ind_backend_queue;
+bcmos_msg_queue *p_bal_api_ind_queue;
+
+/* Create API backend message queue */
+bcmos_errno bal_api_ind_msg_queue_create(mgmt_queue_addr_ports *mgmt_queue_info)
+{
+ bcmos_msg_queue_parm msg_q_p = {};
+ bcmos_errno ret = BCM_ERR_OK;
+
+ do
+ {
+ /* Create BAL API indication receive queue - the core sends IND messages
+ * to the BAL public API using this queue.
+ */
+ msg_q_p.name = "api_ind_rx_q";
+
+ if (NULL != mgmt_queue_info->balapi_mgmt_ip_port)
+ {
+ uint16_t portnum;
+ char *p_ind_portnum_str;
+ char balapi_ind_port_str[256];
+
+ /*
+ * make a copy of the user chosen bal api mgmt port
+ */
+ strcpy(balapi_ind_port_str, mgmt_queue_info->balapi_mgmt_ip_port);
+
+ /* Find the port number */
+ p_ind_portnum_str = strchr(balapi_ind_port_str, ':') + 1;
+
+ /* convert to an integer and increment it by one */
+ portnum = atoi(p_ind_portnum_str) + 1;
+
+ /* create the new string defining the BAL API indication port */
+ sprintf(p_ind_portnum_str,"%d", portnum);
+
+ /* Set up the BAL API indication IP:port access parameter
+ */
+ msg_q_p.local_ep_address = balapi_ind_port_str;
+ msg_q_p.remote_ep_address = NULL;
+ msg_q_p.ep_type = BCMOS_MSG_QUEUE_EP_UDP_SOCKET;
+ }
+ else
+ {
+ msg_q_p.ep_type = BCMOS_MSG_QUEUE_EP_LOCAL;
+ }
+
+ ret = bcmos_msg_queue_create(&bal_api_ind_backend_queue, &msg_q_p);
+ if (BCM_ERR_OK != ret)
+ {
+ BCM_LOG(ERROR, log_id_public_api, "Couldn't BAL API rx indication queue\n");
+ break;
+ }
+
+ p_bal_api_ind_queue = &bal_api_ind_backend_queue;
+#ifdef BAL_MONOLITHIC
+ if (NULL == mgmt_queue_info->balapi_mgmt_ip_port)
+ p_bal_core_to_api_ind_queue = p_bal_api_ind_queue;
+#endif
+ } while (0);
+
+ return ret;
+}
+
+/* Worker module init function.
+ * Register for messages this module is expected to receive
+ */
+static bcmos_errno _bal_worker_module_bal_api_init(long data)
+{
+ bcmos_task_parm task_p = {};
+ bcmos_errno ret = BCM_ERR_OK;
+
+ BUG_ON(0 == data);
+
+ do
+ {
+ /* Create BAL API indication RX thread */
+ task_p.name = "ipc_api_ind_rx_thread";
+ task_p.priority = TASK_PRIORITY_IPC_RX;
+ task_p.handler = _bal_ipc_api_ind_rx_handler;
+ task_p.data = (long)&bal_api_ind_backend_queue;
+
+ ret = bcmos_task_create(&api_ind_rx_thread, &task_p);
+ if (ret)
+ {
+ BCM_LOG(ERROR, log_id_public_api, "Couldn't create BAL API indication RX thread\n");
+ break;
+ }
+
+ /* Register the message types to be handled by the mgmt module
+ */
+ bcmos_msg_register(BCMBAL_MGMT_API_IND_MSG,
+ 0,
+ BCMOS_MODULE_ID_WORKER_API_IND, bal_ipc_api_indication_handler);
+
+ }
+ while(0);
+
+ return ret;
+}
+
+static int _bal_ipc_api_ind_rx_handler(long data)
+{
+ bcmos_msg_queue *rxq = (bcmos_msg_queue *)data;
+ bcmos_task *my_task = bcmos_task_current();
+ bcmos_msg *msg;
+ bcmos_errno ret = BCM_ERR_OK;
+ void *payload;
+
+ while (!my_task->destroy_request)
+ {
+ payload = NULL;
+ ret = bcmbal_msg_recv(rxq, BCMOS_WAIT_FOREVER, &payload);
+ if (ret)
+ {
+ /* Unexpected failure */
+ BCM_LOG(ERROR, log_id_public_api, "bcmbal_msg_recv() -> %s\n", bcmos_strerror(ret));
+ continue;
+ }
+
+ /* Message received */
+ BCM_LOG(DEBUG, log_id_public_api, "bcmbal_msg_recv(%p) -> %s\n", payload, bcmos_strerror(ret));
+
+ /*
+ * Got a message, so now dispatch it. This will result in one
+ * of the modules (registered for the message being processed)
+ * executing its message callback handler.
+ */
+ msg = bcmbal_bcmos_hdr_get(payload);
+ ret = bcmos_msg_dispatch(msg, BCMOS_MSG_SEND_AUTO_FREE);
+ if (ret)
+ {
+ BCM_LOG(ERROR, log_id_public_api,
+ "Couldn't dispatch message %d:%d\n",
+ (int)msg->type, (int)msg->instance);
+ }
+ }
+
+ my_task->destroyed = BCMOS_TRUE;
+
+ return (BCM_ERR_OK == ret) ? 0 : -EINVAL;
+}
+
+
+/* Message wrapper that is called when indication is delivered in application module's context */
+static void _int_deliver_wrapper_cb(bcmos_module_id module_id, bcmos_msg *msg)
+{
+ void *msg_payload = bcmbal_payload_ptr_get(bcmbal_bal_hdr_get_by_bcmos_hdr(msg));
+ f_bcmbal_ind_handler handler = (f_bcmbal_ind_handler)bcmbal_scratchpad_get(msg_payload);
+
+ handler((bcmbal_obj *)msg_payload);
+ bcmbal_msg_free((bcmbal_obj *)msg_payload);
+}
+
+static void process_listener_callbacks(bcmbal_obj *obj)
+{
+
+ indication_subscription_inst *current_entry, *p_temp_entry;
+
+ BCM_LOG(DEBUG, log_id_public_api, "inspecting registered callback for object %d\n",
+ obj->obj_type);
+
+ TAILQ_FOREACH_SAFE(current_entry,
+ &indication_subscription_list,
+ indication_subscription_inst_next,
+ p_temp_entry)
+ {
+ BCM_LOG(DEBUG, log_id_public_api, "entry objtype %d\n", current_entry->cb_cfg.obj_type);
+
+ if((BCMBAL_OBJ_ID_ANY == current_entry->cb_cfg.obj_type) ||
+ (current_entry->cb_cfg.obj_type == obj->obj_type))
+ {
+ BCM_LOG(DEBUG, log_id_public_api,
+ "Calling registered callback for object %d\n",
+ obj->obj_type);
+
+ /* call the registered function directly or in the target module's context */
+ if (BCMOS_MODULE_ID_NONE == current_entry->cb_cfg.module)
+ {
+ current_entry->cb_cfg.ind_cb_hdlr(obj);
+ }
+ else
+ {
+ bcmbal_obj *clone = bcmbal_msg_clone(obj);
+ bcmos_errno err;
+ if (NULL == clone)
+ {
+ BCM_LOG(ERROR, log_id_public_api,
+ "Couldn't clone message for object %d\n",
+ obj->obj_type);
+ continue;
+ }
+ bcmbal_scratchpad_set(clone, current_entry->cb_cfg.ind_cb_hdlr);
+ err = bcmbal_msg_call(clone,
+ current_entry->cb_cfg.module,
+ _int_deliver_wrapper_cb,
+ BCMOS_MSG_SEND_AUTO_FREE);
+ if (BCM_ERR_OK != err)
+ {
+ BCM_LOG(ERROR, log_id_public_api,
+ "Couldn't deliver message for object %d to module %d. Error %s\n",
+ obj->obj_type, current_entry->cb_cfg.module, bcmos_strerror(err));
+ }
+ }
+ }
+ }
+
+ return;
+}
+
+/*
+ * This is the handler for indication messages received by the BAL Public API
+ * backend from the core. We need to see who has subscribed for these messages,
+ * and call those registered functions.
+ */
+static void bal_ipc_api_indication_handler(bcmos_module_id module_id, bcmos_msg *msg)
+{
+
+ void *msg_payload;
+
+ msg_payload = bcmbal_payload_ptr_get(bcmbal_bal_hdr_get_by_bcmos_hdr(msg));
+
+ /*
+ * TO-DO
+ * validate the message major and minor version is correct
+ */
+
+ do
+ {
+ if(BAL_SUBSYSTEM_CORE != bcmbal_sender_get(msg_payload))
+ {
+ BCM_LOG(ERROR, log_id_public_api, "Mgmt IND message received from wrong subsystem (%s)\n",
+ subsystem_str[bcmbal_sender_get(msg_payload)]);
+ break;
+ }
+
+ if(BCMBAL_MGMT_API_IND_MSG != bcmbal_type_major_get(msg_payload))
+ {
+ BCM_LOG(ERROR, log_id_public_api,"Mgmt IND message received with wrong major type (%d)\n",
+ bcmbal_type_major_get(msg_payload));
+ break;
+ }
+
+ /* Look through the list of registered subscribers for this indication
+ * and call them.
+ */
+ BCM_LOG(DEBUG, log_id_public_api,
+ "Processing indication listeners\n");
+
+ process_listener_callbacks((bcmbal_obj *)msg_payload);
+
+ }
+ while(0);
+
+ bcmbal_msg_free(msg_payload);
+
+ return;
+}
+
+void enable_bal_api_indications(const char *balapi_mgmt_ip_port)
+{
+
+ bcmos_task_parm task_p = {};
+ bcmos_module_parm module_p = {};
+ bcmos_errno ret = BCM_ERR_OK;
+ mgmt_queue_addr_ports mgmt_queue_info;
+
+ TAILQ_INIT(&indication_subscription_list);
+
+ do
+ {
+ /* Create quues for communication between BAL API and the core */
+ mgmt_queue_info.balapi_mgmt_ip_port = balapi_mgmt_ip_port;
+ ret = bal_api_ind_msg_queue_create(&mgmt_queue_info);
+ if (BCM_ERR_OK != ret)
+ {
+ BCM_LOG(ERROR, log_id_public_api, "Couldn't create BAL API indication queue\n");
+ break;
+ }
+
+ module_p.qparm.name = "bal_api_ind_worker_module";
+ module_p.init = _bal_worker_module_bal_api_init;
+ module_p.data = (long)&mgmt_queue_info; /* IP address and port information */
+
+ /* Create worker thread & modules for BAL indication messages from the core */
+ task_p.name = "bal_api_ind_worker";
+ task_p.priority = TASK_PRIORITY_WORKER;
+
+ ret = bcmos_task_create(&api_ind_worker_thread, &task_p);
+ if (BCM_ERR_OK != ret)
+ {
+ BCM_LOG(ERROR, log_id_public_api, "Couldn't create BAL API indication worker thread\n");
+ break;
+ }
+
+ ret = bcmos_module_create(BCMOS_MODULE_ID_WORKER_API_IND, &api_ind_worker_thread, &module_p);
+ if (ret)
+ {
+ BCM_LOG(ERROR, log_id_public_api, "Couldn't create BAL API indication worker module\n");
+ break;
+ }
+
+ BCM_LOG(DEBUG, log_id_public_api, "BAL API indication handler registered\n");
+
+ }
+ while(0);
+
+ return;
+}
+
+
+/** NOTE: when cb_cfg->obj_type is BCMBAL_OBJ_ID_ANY AND type is UN-SUBSCRIBE, then this is unsubscribe all */
+bcmos_errno _manage_api_ind_listener(bcmbal_ind_cb_management_type type, bcmbal_cb_cfg *cb_cfg)
+{
+
+ bcmos_errno ret = BCM_ERR_OK;
+ indication_subscription_inst *new_ind_entry;
+ indication_subscription_inst *current_entry, *p_temp_entry;
+ bcmos_bool is_unsubscribe;
+
+ BUG_ON(NULL == cb_cfg);
+ BUG_ON(NULL == cb_cfg->ind_cb_hdlr);
+
+ is_unsubscribe = (IND_CB_UNSUBSCRIBE == type);
+
+ BCM_LOG(DEBUG,log_id_public_api,
+ "%s: %s for BAL API indications\n",
+ __FUNCTION__,
+ is_unsubscribe ? "Unsubscribing" : "Subscribing");
+
+ do
+ {
+ bcmos_bool b_found_existing_entry = BCMOS_FALSE;
+
+ TAILQ_FOREACH_SAFE(current_entry,
+ &indication_subscription_list,
+ indication_subscription_inst_next,
+ p_temp_entry)
+ {
+ if(
+ ((is_unsubscribe && (BCMBAL_OBJ_ID_ANY == cb_cfg->obj_type)) ? BCMOS_TRUE :
+ (current_entry->cb_cfg.obj_type == cb_cfg->obj_type)) &&
+ (current_entry->cb_cfg.ind_cb_hdlr == cb_cfg->ind_cb_hdlr) &&
+ (current_entry->cb_cfg.module == cb_cfg->module))
+ {
+ BCM_LOG(DEBUG,log_id_public_api,
+ "Found existing registration\n");
+
+ if(is_unsubscribe)
+ {
+ BCM_LOG(DEBUG,log_id_public_api,
+ "Removing registration\n");
+ TAILQ_REMOVE(&indication_subscription_list, current_entry, indication_subscription_inst_next);
+ bcmos_free(current_entry);
+ }
+
+ b_found_existing_entry = BCMOS_TRUE;
+
+ /* Don't stop looking for matches if we are unsubscribing from ANY indications, there could be many
+ * assigned to a single callback function */
+ if(!(is_unsubscribe && (BCMBAL_OBJ_ID_ANY == cb_cfg->obj_type))) break;
+ }
+
+ }
+
+ /* If we are subscribing to indication and we have already recorded
+ * this subscription, OR we are un-subscribing (whether or not we
+ * found a subscription to remove), then return right away with OK
+ */
+ if((BCMOS_TRUE == b_found_existing_entry) || is_unsubscribe)
+ {
+ break;
+ }
+
+ BCM_LOG(DEBUG,log_id_public_api,
+ "Registering NEW subscriber for BAL API indications\n");
+
+ /* This is a new subscription */
+ new_ind_entry = bcmos_calloc(sizeof(indication_subscription_inst));
+
+ if (NULL == new_ind_entry)
+ {
+ BCM_LOG(FATAL, log_id_public_api,
+ "Failed to register api indication subscription\n");
+ ret = BCM_ERR_NOMEM;
+ break;
+ }
+
+ new_ind_entry->cb_cfg = *cb_cfg;
+
+ TAILQ_INSERT_TAIL(&indication_subscription_list, new_ind_entry, indication_subscription_inst_next);
+
+ } while(0);
+
+ return ret;
+
+}
+
+static void free_all_indication_subscriptions(void)
+{
+ indication_subscription_inst *current_entry, *p_temp_entry;
+
+ TAILQ_FOREACH_SAFE(current_entry,
+ &indication_subscription_list,
+ indication_subscription_inst_next,
+ p_temp_entry)
+ {
+ TAILQ_REMOVE(&indication_subscription_list, current_entry, indication_subscription_inst_next);
+ bcmos_free(current_entry);
+ }
+
+ return;
+}
+
+
+void bal_api_indications_finish(void)
+{
+ free_all_indication_subscriptions();
+
+ bcmos_msg_unregister(BCMBAL_MGMT_API_IND_MSG,
+ 0,
+ BCMOS_MODULE_ID_WORKER_API_IND);
+
+ bcmos_msg_queue_destroy(&bal_api_ind_backend_queue);
+
+ bcmos_module_destroy(BCMOS_MODULE_ID_WORKER_API_IND);
+
+ bcmos_task_destroy(&api_ind_rx_thread);
+
+ bcmos_task_destroy(&api_ind_worker_thread);
+
+ return;
+}
diff --git a/bal_release/src/lib/libbalapi/bal_api_worker.h b/bal_release/src/lib/libbalapi/bal_api_worker.h
new file mode 100644
index 0000000..7e258ca
--- /dev/null
+++ b/bal_release/src/lib/libbalapi/bal_api_worker.h
@@ -0,0 +1,62 @@
+/******************************************************************************
+ *
+ * <:copyright-BRCM:2016:DUAL/GPL:standard
+ *
+ * Copyright (c) 2016 Broadcom
+ * All Rights Reserved
+ *
+ * Unless you and Broadcom execute a separate written software license
+ * agreement governing use of this software, this software is licensed
+ * to you under the terms of the GNU General Public License version 2
+ * (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
+ * with the following added to such license:
+ *
+ * As a special exception, the copyright holders of this software give
+ * you permission to link this software with independent modules, and
+ * to copy and distribute the resulting executable under terms of your
+ * choice, provided that you also meet, for each linked independent
+ * module, the terms and conditions of the license of that module.
+ * An independent module is a module which is not derived from this
+ * software. The special exception does not apply to any modifications
+ * of the software.
+ *
+ * Not withstanding the above, under no circumstances may you combine
+ * this software in any way with any other Broadcom software provided
+ * under a license other than the GPL, without Broadcom's express prior
+ * written consent.
+ *
+ * :>
+ *
+ *****************************************************************************/
+
+/**
+ * @file bal_worker.h
+ *
+ * @brief Bal worker thread included
+ *
+ * Module contains the data structures and functions used to support the
+ * BAL core worker thread.
+ */
+
+#ifndef BAL_API_WORKER_H
+#define BAL_API_WORKER_H
+
+#include <bcmos_errno.h>
+
+extern bcmos_msg_queue *p_balapi_to_core_queue;
+
+typedef enum {
+ IND_CB_SUBSCRIBE,
+ IND_CB_UNSUBSCRIBE
+}bcmbal_ind_cb_management_type;
+
+/*
+ * Function declarations
+ */
+extern bcmos_errno bal_api_ind_msg_queue_create(mgmt_queue_addr_ports *mgmt_queue_info);
+extern void enable_bal_api_indications(const char *balapi_mgmt_ip_port);
+extern bcmos_errno _manage_api_ind_listener(bcmbal_ind_cb_management_type type, bcmbal_cb_cfg *cb_cfg);
+extern void bal_api_indications_finish(void);
+
+
+#endif /* BAL_API_WORKER_H */
diff --git a/bal_release/src/lib/libbalapicli/Makefile b/bal_release/src/lib/libbalapicli/Makefile
new file mode 100644
index 0000000..44b7bac
--- /dev/null
+++ b/bal_release/src/lib/libbalapicli/Makefile
@@ -0,0 +1,37 @@
+###############################################################################
+#
+# <:copyright-BRCM:2016:DUAL/GPL:standard
+#
+# Copyright (c) 2016 Broadcom
+# All Rights Reserved
+#
+# Unless you and Broadcom execute a separate written software license
+# agreement governing use of this software, this software is licensed
+# to you under the terms of the GNU General Public License version 2
+# (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
+# with the following added to such license:
+#
+# As a special exception, the copyright holders of this software give
+# you permission to link this software with independent modules, and
+# to copy and distribute the resulting executable under terms of your
+# choice, provided that you also meet, for each linked independent
+# module, the terms and conditions of the license of that module.
+# An independent module is a module which is not derived from this
+# software. The special exception does not apply to any modifications
+# of the software.
+#
+# Not withstanding the above, under no circumstances may you combine
+# this software in any way with any other Broadcom software provided
+# under a license other than the GPL, without Broadcom's express prior
+# written consent.
+#
+# :>
+#
+###############################################################################
+MOD_NAME = bal_api_cli
+MOD_TYPE = lib
+MOD_DEPS = cli bal_api
+MOD_INC_DIRS = $(SRC_DIR) $(OUT_DIR)
+
+srcs = bal_api_cli.c bal_api_cli_dump.c
+gen_bal_srcs = bal_api_cli_helpers.c bal_api_cli_handlers.c
diff --git a/bal_release/src/lib/libbalapicli/bal_api_cli.c b/bal_release/src/lib/libbalapicli/bal_api_cli.c
new file mode 100644
index 0000000..cbbe973
--- /dev/null
+++ b/bal_release/src/lib/libbalapicli/bal_api_cli.c
@@ -0,0 +1,1059 @@
+/*
+<:copyright-BRCM:2016:DUAL/GPL:standard
+
+ Broadcom Proprietary and Confidential.(c) 2016 Broadcom
+ All Rights Reserved
+
+Unless you and Broadcom execute a separate written software license
+agreement governing use of this software, this software is licensed
+to you under the terms of the GNU General Public License version 2
+(the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
+with the following added to such license:
+
+ As a special exception, the copyright holders of this software give
+ you permission to link this software with independent modules, and
+ to copy and distribute the resulting executable under terms of your
+ choice, provided that you also meet, for each linked independent
+ module, the terms and conditions of the license of that module.
+ An independent module is a module which is not derived from this
+ software. The special exception does not apply to any modifications
+ of the software.
+
+Not withstanding the above, under no circumstances may you combine
+this software in any way with any other Broadcom software provided
+under a license other than the GPL, without Broadcom's express prior
+written consent.
+
+:>
+ */
+
+#include <bcmos_system.h>
+#include <bcmcli.h>
+#include <bal_api.h>
+#include "bal_api_cli.h"
+#include "bal_api_cli_helpers.h"
+#include "bal_api_cli_handlers.h"
+
+#define BCMBAL_APICLI_CAST_DISCARD_CONST(p, type) (type)((long)(p))
+
+/* bool enum table */
+static bcmcli_enum_val bool_enum[] =
+{
+ { .name = "yes", .val = 1 },
+ { .name = "no", .val = 0 },
+ BCMCLI_ENUM_LAST
+};
+
+static bcmbal_apicli_type_descr bool_type_descr = {
+ .name = "bool",
+ .descr = "Boolean",
+ .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM,
+ .size = sizeof(bcmos_bool),
+ .x = {.e = bool_enum}
+};
+
+/* parameter data */
+typedef struct
+{
+ const bcmbal_apicli_prop_descr *prop; /* property */
+ const bcmbal_apicli_field_descr *field; /* field or NULL */
+ const bcmbal_apicli_field_descr *array_fd; /* array field descriptor or NULL */
+ uint16_t offset; /* offset from the beginning of the property */
+ uint16_t array_fd_offset; /* offset of array_fd from the beginning of the property */
+ bcmbal_mgt_group group; /* management group */
+} bcmbal_apicli_parm_data;
+
+typedef enum
+{
+ BCMBAL_APICLI_FLAGS_NONE = 0,
+ BCMBAL_APICLI_FLAGS_IGNORE_FIELDS = 1 << 0
+} bcmbal_apicli_flags;
+
+/* Current session */
+static bcmcli_session *current_session;
+
+/*
+ * helpers
+ */
+
+/* calculate number of fields in type */
+static uint32_t bcmbal_apicli_get_num_fields_in_type(const bcmbal_apicli_type_descr *td)
+{
+ uint16_t f;
+ uint32_t nf = 0;
+
+
+ switch (td->base_type)
+ {
+ case BCMBAL_APICLI_BASE_TYPE_ID_STRUCT:
+ {
+ if (!td->x.s.num_fields)
+ return 0;
+ BUG_ON(!td->x.s.fields);
+ for (f = 0; f < td->x.s.num_fields; f++)
+ {
+ nf += bcmbal_apicli_get_num_fields_in_type(td->x.s.fields[f].type);
+ }
+ break;
+ }
+
+ case BCMBAL_APICLI_BASE_TYPE_ID_UNION:
+ {
+ /* Union. Count only common fields */
+ nf = td->x.u.num_common_fields;
+ break;
+ }
+
+ case BCMBAL_APICLI_BASE_TYPE_ID_ARR_FIXED:
+ {
+ nf = bcmbal_apicli_get_num_fields_in_type(td->x.arr_fixed.elem_type);
+ break;
+ }
+
+ case BCMBAL_APICLI_BASE_TYPE_ID_ARR_DYN:
+ {
+ nf = bcmbal_apicli_get_num_fields_in_type(td->x.arr_dyn.elem_type);
+ break;
+ }
+
+ default:
+ {
+ nf = 1;
+ break;
+ }
+ }
+
+ return nf;
+}
+
+/* calculate number of property fields for given object+group+subgroup+access. simple property=single field */
+static bcmos_errno bcmbal_apicli_get_num_fields_in_group(bcmbal_obj_id o, bcmbal_mgt_group group, uint16_t subgroup,
+ bcmbal_apicli_prop_access_id access_level, uint32_t *nfields)
+{
+ uint32_t nf = 0;
+ int i;
+ bcmos_errno rc = BCM_ERR_OK;
+
+ for (i = 0; rc != BCM_ERR_RANGE; i++)
+ {
+ const bcmbal_apicli_prop_descr *pd;
+ rc = bcmbal_apicli_object_property(o, group, subgroup, i, &pd);
+ if (rc == BCM_ERR_OK && (pd->access & access_level))
+ {
+ /* Calculate number of fields if write access. Count only properties for read access */
+ if ((access_level & BCMBAL_APICLI_PROP_ACCESS_ID_W) != 0)
+ {
+ BUG_ON(!pd->type);
+ nf += bcmbal_apicli_get_num_fields_in_type(pd->type);
+ }
+ else
+ {
+ ++nf;
+ }
+ }
+ }
+ *nfields = nf;
+
+ return BCM_ERR_OK;
+}
+
+/*
+ * Command handlers
+ */
+
+static bcmos_errno bcmbal_apicli_objects_handler(bcmcli_session *session, const bcmcli_cmd_parm parm[], uint16_t nparms)
+{
+ int rc;
+ bcmbal_obj_id o;
+ const char *name, *descr;
+
+ bcmcli_print(session, "System Object Types:\n");
+ bcmcli_print(session, "=======================================\n");
+ bcmcli_print(session, "Id Name Description\n");
+ bcmcli_print(session, "=======================================\n");
+ for (o = 0; o < BCMBAL_OBJ_ID__NUM_OF; o++)
+ {
+ rc = bcmbal_apicli_object_name(o, &name, &descr);
+ if (!rc)
+ bcmcli_print(session, "%.4d %-22s %s\n", o, name, descr);
+ }
+
+ return 0;
+}
+
+static bcmos_errno bcmbal_apicli_set_handler(bcmcli_session *session, const bcmcli_cmd_parm parm[], uint16_t nparms)
+{
+ return bcmbal_apicli_call(BCMBAL_MGT_GROUP_CFG, BCMBAL_OBJ_MSG_TYPE_SET, session);
+}
+
+static bcmos_errno bcmbal_apicli_get_handler(bcmcli_session *session, const bcmcli_cmd_parm parm[], uint16_t nparms)
+{
+ return bcmbal_apicli_call(BCMBAL_MGT_GROUP_CFG, BCMBAL_OBJ_MSG_TYPE_GET, session);
+}
+
+static bcmos_errno bcmbal_apicli_clear_handler(bcmcli_session *session, const bcmcli_cmd_parm parm[], uint16_t nparms)
+{
+ return bcmbal_apicli_call(BCMBAL_MGT_GROUP_CFG, BCMBAL_OBJ_MSG_TYPE_CLEAR, session);
+}
+
+static bcmos_errno bcmbal_apicli_stat_handler(bcmcli_session *session, const bcmcli_cmd_parm parm[], uint16_t nparms)
+{
+ return bcmbal_apicli_call(BCMBAL_MGT_GROUP_STAT, BCMBAL_OBJ_MSG_TYPE_GET, session);
+}
+
+/*
+ * Init-time helpers
+ */
+
+/* map to CLI type */
+static bcmos_errno bcmbal_apicli_map_type(
+ const bcmbal_apicli_type_descr *td,
+ const bcmbal_apicli_type_descr *array_td,
+ bcmcli_cmd_parm *cmd_parm)
+{
+ bcmbal_apicli_parm_data *parm_data = cmd_parm->user_data;
+ bcmos_errno rc = BCM_ERR_OK;
+
+ /* Map type */
+ switch(td->base_type)
+ {
+ case BCMBAL_APICLI_BASE_TYPE_ID_SNUM:
+ cmd_parm->type = BCMCLI_PARM_NUMBER;
+ break;
+ case BCMBAL_APICLI_BASE_TYPE_ID_UNUM:
+ cmd_parm->type = BCMCLI_PARM_UNUMBER;
+ break;
+ case BCMBAL_APICLI_BASE_TYPE_ID_UNUM_HEX:
+ cmd_parm->type = BCMCLI_PARM_HEX;
+ break;
+ case BCMBAL_APICLI_BASE_TYPE_ID_BOOL:
+ cmd_parm->type = BCMCLI_PARM_ENUM;
+ cmd_parm->enum_table = bool_enum;
+ break;
+ case BCMBAL_APICLI_BASE_TYPE_ID_FLOAT:
+ cmd_parm->type = td->size == sizeof(double) ? BCMCLI_PARM_DOUBLE : BCMCLI_PARM_FLOAT;
+ break;
+ case BCMBAL_APICLI_BASE_TYPE_ID_STRING:
+ cmd_parm->type = BCMCLI_PARM_STRING;
+ break;
+ case BCMBAL_APICLI_BASE_TYPE_ID_IPV4:
+ cmd_parm->type = BCMCLI_PARM_IP;
+ break;
+ case BCMBAL_APICLI_BASE_TYPE_ID_MAC:
+ cmd_parm->type = BCMCLI_PARM_MAC;
+ break;
+ case BCMBAL_APICLI_BASE_TYPE_ID_ENUM:
+ cmd_parm->type = BCMCLI_PARM_ENUM;
+ cmd_parm->enum_table = td->x.e;
+ break;
+ case BCMBAL_APICLI_BASE_TYPE_ID_ENUM_MASK:
+ cmd_parm->type = BCMCLI_PARM_ENUM_MASK;
+ cmd_parm->enum_table = td->x.e;
+ break;
+ default:
+ bcmcli_print(current_session, "*** can't map type %s (%d)\n", td->name, (int)td->base_type);
+ rc = BCM_ERR_NOT_SUPPORTED;
+ break;
+ }
+
+ /* Map uint8_t array to buffer if it is independent (not structure field) */
+ if (array_td &&
+ td->size == 1 &&
+ (td->base_type == BCMBAL_APICLI_BASE_TYPE_ID_UNUM || td->base_type == BCMBAL_APICLI_BASE_TYPE_ID_UNUM_HEX) &&
+ (parm_data->array_fd == parm_data->field || !parm_data->field))
+ {
+ cmd_parm->type = BCMCLI_PARM_BUFFER;
+ }
+
+ return rc;
+}
+
+/* allocate memory for name and description and copy to to parm */
+static bcmos_errno bcmbal_apicli_copy_parm_name(bcmcli_cmd_parm *parm, const char *name, const char *descr)
+{
+ parm->name = bcmos_alloc(strlen(name) + 1);
+ parm->description = bcmos_alloc(strlen(descr) + 1);
+ if ((parm->name == NULL) || (parm->description == NULL))
+ {
+ /* Successful allocation if any will be released by common cleanup
+ * along with the rest of dynamic parameter fields */
+ return BCM_ERR_NOMEM;
+ }
+ strcpy(BCMBAL_APICLI_CAST_DISCARD_CONST(parm->name, void *), name);
+ strcpy(BCMBAL_APICLI_CAST_DISCARD_CONST(parm->description, void *), descr);
+ return BCM_ERR_OK;
+}
+
+/* populate single parameter */
+static int bcmbal_apicli_populate_parm1(
+ const bcmbal_apicli_prop_descr *pd,
+ const bcmbal_apicli_field_descr *fd,
+ const bcmbal_apicli_type_descr *td,
+ const bcmbal_apicli_field_descr *array_fd,
+ uint32_t offset,
+ uint32_t array_fd_offset,
+ bcmcli_cmd_parm *cmd_parm,
+ uint32_t cmd_flags,
+ char *name,
+ char *help)
+{
+ bcmbal_apicli_parm_data *parm_data = cmd_parm->user_data;
+ int rc;
+
+ parm_data->prop = pd;
+ parm_data->field = fd;
+ parm_data->offset = offset;
+ parm_data->array_fd = array_fd;
+ parm_data->array_fd_offset = array_fd_offset;
+
+ rc = bcmbal_apicli_copy_parm_name(cmd_parm, name, help);
+ if (rc)
+ {
+ return rc;
+ }
+ cmd_parm->flags = cmd_flags;
+ if (td->min_val != td->max_val || td->min_val)
+ {
+ cmd_parm->flags |= BCMCLI_PARM_FLAG_RANGE;
+ cmd_parm->low_val = td->min_val;
+ cmd_parm->hi_val = td->max_val;
+ }
+ rc = bcmbal_apicli_map_type(td, array_fd ? array_fd->type : NULL, cmd_parm);
+ if (rc < 0)
+ {
+ return rc;
+ }
+
+ /* Arrays require more work.
+ * - Calculate size. Known for fixed arrays, hard-coded max for dynamic
+ * - Allocate either buffer or array of values based on CLI parameter type
+ * - Calculate offset from the beginning of array entry
+ */
+ if (array_fd)
+ {
+ uint32_t array_size;
+
+ if (array_fd->type->base_type == BCMBAL_APICLI_BASE_TYPE_ID_ARR_FIXED)
+ {
+ array_size = array_fd->type->x.arr_fixed.size;
+ }
+ else
+ {
+ array_size = array_fd->type->x.arr_dyn.max_size;
+ }
+ if (!array_size)
+ {
+ bcmcli_print(current_session, "*** Error in %s array descriptor. Size is not set.\n", array_fd->name);
+ return BCM_ERR_INTERNAL;
+ }
+ if (cmd_parm->type == BCMCLI_PARM_BUFFER)
+ {
+ rc = bcmbal_buf_alloc(&cmd_parm->value.buffer, array_size);
+ if (rc)
+ {
+ return rc;
+ }
+ }
+ else
+ {
+ cmd_parm->values = bcmos_calloc(sizeof(bcmcli_parm_value) * array_size);
+ if (!cmd_parm->values)
+ {
+ return BCM_ERR_NOMEM;
+ }
+ cmd_parm->max_array_size = array_size;
+ }
+ }
+
+ return 1;
+}
+
+
+/* populate name buf and help buf */
+static void bcmbal_apicli_populate_name_help(const bcmbal_apicli_field_descr *fld, char *name_buf0, char *help_buf0,
+ char *name_buf, char *help_buf)
+{
+ name_buf[0] = 0;
+ help_buf[0] = 0;
+ bcmcli_strncpy(name_buf, name_buf0, BCMBAL_APICLI_MAX_PARM_NAME_LENGTH);
+ if (strlen(name_buf))
+ bcmcli_strncat(name_buf, ".", BCMBAL_APICLI_MAX_PARM_NAME_LENGTH);
+ bcmcli_strncat(name_buf, fld->cli_name ? fld->cli_name : fld->name, BCMBAL_APICLI_MAX_PARM_NAME_LENGTH);
+ bcmcli_strncpy(help_buf, help_buf0, BCMBAL_APICLI_MAX_PARM_HELP_LENGTH);
+ bcmcli_strncat(help_buf, " - ", BCMBAL_APICLI_MAX_PARM_HELP_LENGTH);
+ bcmcli_strncat(help_buf, fld->descr ? fld->descr : fld->name, BCMBAL_APICLI_MAX_PARM_HELP_LENGTH);
+}
+
+/* Allocate CLI parameter array. Set up parm->data */
+static bcmcli_cmd_parm *bcmbal_apicli_parm_alloc(int nparms)
+{
+ uint32_t size;
+ bcmcli_cmd_parm *parms;
+ bcmbal_apicli_parm_data *parm_data;
+ int i;
+
+ /* Allocate parameter table and populate it */
+ size = (sizeof(bcmcli_cmd_parm) + sizeof(bcmbal_apicli_parm_data)) * (nparms + 1);
+ parms = bcmos_calloc(size);
+ if (!parms)
+ return NULL;
+
+ /* Associate parameter_data structs with parameters */
+ parm_data = (bcmbal_apicli_parm_data *)(parms + nparms + 1);
+ for (i = 0; i < nparms; i++)
+ {
+ parms[i].user_data = &parm_data[i];
+ }
+ return parms;
+}
+
+/* clone enum table */
+static bcmcli_enum_val *bcmbal_apicli_clone_enum_table(bcmcli_cmd_parm *parm)
+{
+ bcmcli_enum_val *org_table = parm->enum_table;
+ bcmcli_enum_val *val = org_table;
+ bcmcli_enum_val *clone_table = org_table;
+ int i, n;
+
+ BUG_ON(parm->type != BCMCLI_PARM_ENUM);
+ while (val && val->name)
+ {
+ ++val;
+ }
+ n = val - org_table;
+
+ clone_table = bcmos_calloc(sizeof(bcmcli_enum_val) * (n + 1));
+ if (!clone_table)
+ {
+ return NULL;
+ }
+ for (i = 0; i < n; i++)
+ {
+ clone_table[i].name = org_table[i].name;
+ clone_table[i].val = org_table[i].val;
+ }
+ return clone_table;
+}
+
+
+/* populate CLI parameter(s) from a single property. Can be multiple parameters
+ * if property contains multiple fields.
+ * Returns number of parameters populated >= 0 or error < 0
+ */
+static int bcmbal_apicli_populate_parms_from_property(const bcmbal_apicli_prop_descr *pd,
+ const bcmbal_apicli_field_descr *fd, const bcmbal_apicli_field_descr *array_fd, uint32_t offset,
+ uint32_t array_fd_offset, bcmcli_cmd_parm *parms, bcmbal_apicli_prop_access_id access_level, uint32_t cmd_flags,
+ char *name_buf0, char *help_buf0)
+{
+ const bcmbal_apicli_type_descr *td = fd ? fd->type : pd->type;
+ uint32_t nf = 0;
+ char name_buf[BCMBAL_APICLI_MAX_PARM_NAME_LENGTH];
+ char help_buf[BCMBAL_APICLI_MAX_PARM_HELP_LENGTH];
+ int rc = 0;
+
+ /* presence masks are not set directly, they are calculated based on other fields */
+ if (fd != NULL && (fd->flags & BCMBAL_APICLI_FIELD_DESCR_FLAGS_PRESENCE_MASK) != 0)
+ {
+ return BCM_ERR_READ_ONLY;
+ }
+
+ /* At top level take name from property */
+ if (td == pd->type)
+ {
+ /* In case there's a global prefix */
+ char *top_name_buf = name_buf0;
+ uint32_t top_name_buf_len = BCMBAL_APICLI_MAX_PARM_NAME_LENGTH;
+ uint32_t prefix_len = strlen(name_buf0);
+ if (prefix_len > 0)
+ {
+ top_name_buf += prefix_len;
+ top_name_buf_len -= prefix_len;
+ }
+
+ bcmcli_strncpy(top_name_buf, pd->cli_name ? pd->cli_name : pd->name, top_name_buf_len);
+ bcmcli_strncpy(help_buf0, pd->descr ? pd->descr : pd->name, BCMBAL_APICLI_MAX_PARM_HELP_LENGTH);
+ }
+
+ /* For read access we only mark whether read property or not. It is not field-by-field operation */
+ if (access_level == BCMBAL_APICLI_PROP_ACCESS_ID_R)
+ {
+ td = &bool_type_descr;
+ }
+
+ /* In case of arrays we should
+ * - check that there is no array in array. It is not supported
+ * - store array type descriptor FFU and replace the "current" type descriptor with element type
+ * - reset offset because for array fields it should be calculated from array base rather than property
+ */
+ if (td->base_type == BCMBAL_APICLI_BASE_TYPE_ID_ARR_DYN || td->base_type == BCMBAL_APICLI_BASE_TYPE_ID_ARR_FIXED)
+ {
+ if (array_fd)
+ {
+ bcmcli_print(
+ current_session,
+ "*** %s in %s: arrays-in-arrays are not supported\n",
+ pd->name,
+ array_fd->name);
+ return BCM_ERR_NOT_SUPPORTED;
+ }
+ /* store array type and fetch element type */
+ array_fd = fd ? fd : (const bcmbal_apicli_field_descr *)pd;
+ if (td->base_type == BCMBAL_APICLI_BASE_TYPE_ID_ARR_DYN)
+ {
+ td = td->x.arr_dyn.elem_type;
+ }
+ else
+ {
+ td = td->x.arr_fixed.elem_type;
+ }
+ array_fd_offset = offset;
+ offset = 0;
+ }
+
+ if (td->base_type == BCMBAL_APICLI_BASE_TYPE_ID_STRUCT)
+ {
+ uint16_t f;
+ if (!td->x.s.num_fields)
+ return 0;
+ BUG_ON(!td->x.s.fields);
+ for (f = 0; f < td->x.s.num_fields; f++)
+ {
+ const bcmbal_apicli_field_descr *fld = &td->x.s.fields[f];
+ bcmbal_apicli_populate_name_help(fld, name_buf0, help_buf0, name_buf, help_buf);
+ rc = bcmbal_apicli_populate_parms_from_property(pd, fld, array_fd, offset+fld->offset,
+ array_fd_offset, &parms[nf], access_level, cmd_flags, name_buf, help_buf);
+ if (rc > 0)
+ nf += rc;
+ }
+ }
+ else if (td->base_type == BCMBAL_APICLI_BASE_TYPE_ID_UNION)
+ {
+ /* Union */
+ uint16_t f;
+ const bcmbal_apicli_field_descr *fld;
+ bcmcli_cmd_parm *sel_parm;
+ bcmbal_apicli_parm_data *sel_data;
+ bcmcli_enum_val *e;
+
+ if (!td->x.u.num_common_fields)
+ return 0;
+ BUG_ON(!td->x.u.common_fields);
+
+ /* Populate parameters preceding the union selector */
+ for (f = 0; f < td->x.u.classifier_idx; f++)
+ {
+ fld = &td->x.u.common_fields[f];
+ bcmbal_apicli_populate_name_help(fld, name_buf0, help_buf0, name_buf, help_buf);
+ rc = bcmbal_apicli_populate_parms_from_property(pd, fld, array_fd,
+ offset+fld->offset, array_fd_offset, &parms[nf], access_level, cmd_flags, name_buf, help_buf);
+ if (rc > 0)
+ nf += rc;
+ }
+
+ /* Now populate parameter for selector */
+ sel_parm = &parms[nf];
+ fld = &td->x.u.common_fields[f];
+ bcmbal_apicli_populate_name_help(fld, name_buf0, help_buf0, name_buf, help_buf);
+ rc = bcmbal_apicli_populate_parms_from_property(pd, fld, array_fd,
+ offset+fld->offset, array_fd_offset, sel_parm, access_level, cmd_flags, name_buf, help_buf);
+ if (rc > 0)
+ nf += rc;
+ /* Clone enum table in order to allow modifying it */
+ if (rc >= 1)
+ {
+ sel_parm->enum_table = bcmbal_apicli_clone_enum_table(sel_parm);
+ if (!sel_parm->enum_table)
+ {
+ rc = BCM_ERR_NOMEM;
+ }
+ }
+
+ /* Now set-up selector */
+ sel_parm->flags |= BCMCLI_PARM_FLAG_SELECTOR;
+ sel_data = sel_parm->user_data;
+ e = sel_parm->enum_table;
+ while (e && e->name && rc >= 0)
+ {
+ fld = &td->x.u.union_fields[e - sel_parm->enum_table];
+ if (fld->type)
+ {
+ int np = bcmbal_apicli_get_num_fields_in_type(fld->type);
+ int i;
+
+ e->parms = bcmbal_apicli_parm_alloc(np);
+ if (!e->parms)
+ {
+ rc = BCM_ERR_NOMEM;
+ break;
+ }
+ for (i = 0; i < np; i++)
+ {
+ bcmbal_apicli_parm_data *data = e->parms[i].user_data;
+ data->group = sel_data->group;
+ }
+ /* Collapse substructure name */
+ if (fld->type->base_type == BCMBAL_APICLI_BASE_TYPE_ID_STRUCT ||
+ fld->type->base_type == BCMBAL_APICLI_BASE_TYPE_ID_UNION)
+ {
+ bcmcli_strncpy(name_buf, name_buf0, sizeof(name_buf));
+ bcmcli_strncpy(help_buf, help_buf0, sizeof(help_buf));
+ }
+ else
+ {
+ bcmbal_apicli_populate_name_help(fld, name_buf0, help_buf0, name_buf, help_buf);
+ }
+ rc = bcmbal_apicli_populate_parms_from_property(pd, fld, array_fd,
+ offset+fld->offset, array_fd_offset, e->parms, access_level, cmd_flags, name_buf, help_buf);
+ }
+ ++e;
+ }
+
+ /* Finally populate parameters following the selector parameter */
+ for (f = td->x.u.classifier_idx + 1; f < td->x.u.num_common_fields && rc >= 0; f++)
+ {
+ fld = &td->x.u.common_fields[f];
+ bcmbal_apicli_populate_name_help(fld, name_buf0, help_buf0, name_buf, help_buf);
+ rc = bcmbal_apicli_populate_parms_from_property(pd, fld, array_fd,
+ offset+fld->offset, array_fd_offset, &parms[nf], access_level, cmd_flags, name_buf, help_buf);
+ if (rc > 0)
+ nf += rc;
+ }
+ }
+ else
+ {
+ /* Finally! Simple type that maps to a single CLI parameter */
+ nf = bcmbal_apicli_populate_parm1(pd, fd, td, array_fd, offset, array_fd_offset,
+ &parms[0], cmd_flags, name_buf0, help_buf0);
+ }
+ return (rc >= 0) ? nf : rc;
+}
+
+/* populate CLI parameter table */
+static int bcmbal_apicli_populate_parms(
+ bcmbal_obj_id o,
+ bcmbal_mgt_group group,
+ uint16_t subgroup,
+ bcmbal_apicli_prop_access_id access_level,
+ bcmcli_cmd_parm *parms,
+ uint32_t cmd_flags,
+ const char *prefix)
+{
+ int nf = 0;
+ int i;
+ bcmos_errno rc = BCM_ERR_OK;
+
+ for (i = 0; rc != BCM_ERR_RANGE; i++)
+ {
+ const bcmbal_apicli_prop_descr *pd;
+ char name_buf[BCMBAL_APICLI_MAX_PARM_NAME_LENGTH] = "";
+ char help_buf[BCMBAL_APICLI_MAX_PARM_HELP_LENGTH] = "";
+
+ strncpy(name_buf, prefix, BCMBAL_APICLI_MAX_PARM_NAME_LENGTH-1);
+ name_buf[BCMBAL_APICLI_MAX_PARM_NAME_LENGTH-1] = 0;
+
+ rc = bcmbal_apicli_object_property(o, group, subgroup, i, &pd);
+ if (rc == BCM_ERR_OK && (pd->access & access_level))
+ {
+ rc = bcmbal_apicli_populate_parms_from_property(pd, NULL, NULL, 0, 0, &parms[nf],
+ access_level, cmd_flags, name_buf, help_buf);
+ if (rc > 0)
+ nf += rc;
+ }
+ }
+ return nf;
+}
+
+
+/* compact selector table. squeeze out values that don't have parameter table attached */
+static void bcmbal_apicli_compact_selector(bcmcli_enum_val *selector, int size)
+{
+ int i, j;
+
+ for (i = 0; i < size; i++)
+ {
+ if (!selector[i].parms)
+ {
+ for ( j = i + 1; j < size && !selector[j].parms; j ++)
+ ;
+ if (j < size)
+ {
+ memcpy(&selector[i], &selector[j], sizeof(bcmcli_enum_val));
+ memset(&selector[j], 0, sizeof(bcmcli_enum_val));
+ }
+ else
+ {
+ memset(&selector[i], 0, sizeof(bcmcli_enum_val));
+ }
+ }
+ }
+}
+
+/* Free CLI parameters. both name and description are allocated dynamically */
+static void bcmbal_apicli_free_parms(bcmcli_cmd_parm *parms)
+{
+ bcmcli_cmd_parm *p = parms;
+
+ while (p->name)
+ {
+ if ((p->flags & BCMCLI_PARM_FLAG_SELECTOR))
+ {
+ /* Remove selector table */
+ bcmcli_enum_val *sel = p->enum_table;
+ if (sel)
+ {
+ bcmcli_enum_val *e = sel;
+ while(e->name)
+ {
+ if (e->parms)
+ {
+ bcmbal_apicli_free_parms(e->parms);
+ }
+ ++e;
+ }
+ bcmos_free(sel);
+ }
+ }
+ if (p->description)
+ bcmos_free(BCMBAL_APICLI_CAST_DISCARD_CONST(p->description, void *));
+ if (p->name)
+ bcmos_free(BCMBAL_APICLI_CAST_DISCARD_CONST(p->name, void *));
+ if (p->max_array_size && p->values)
+ bcmos_free(p->values);
+ if (p->value.buffer.start)
+ bcmbal_buf_free(&p->value.buffer);
+
+ ++p;
+ }
+ bcmos_free(parms);
+}
+
+static uint8_t bcmbal_apicli_get_num_cmd_parms(bcmbal_mgt_group group, bcmbal_apicli_flags flags)
+{
+ if (group == BCMBAL_MGT_GROUP_STAT)
+ return 2; /* object + stat ID */
+ else
+ return 1; /* object */
+}
+
+/* Read generated info and add CLI command */
+static bcmos_errno bcmbal_apicli_add(bcmcli_entry *dir, const char *cmd_name, const char *cmd_descr,
+ bcmbal_mgt_group group, bcmbal_apicli_prop_access_id access_level, bcmcli_cmd_cb cmd_handler,
+ bcmbal_apicli_flags flags)
+{
+ bcmcli_cmd_extra_parm cmd_extras = { .free_parms = bcmbal_apicli_free_parms };
+ bcmcli_cmd_parm *cmd_parms;
+ bcmcli_enum_val *obj_selector;
+ bcmbal_obj_id o;
+ bcmos_errno rc = BCM_ERR_OK;
+ uint32_t cmd_flags = 0;
+ uint8_t num_cmd_parms = bcmbal_apicli_get_num_cmd_parms(group, flags);
+ int n_obj;
+ int i;
+
+ /* Command flags: parameters in the following groups are optional */
+ if (group == BCMBAL_MGT_GROUP_CFG || group == BCMBAL_MGT_GROUP_STAT || group == BCMBAL_MGT_GROUP_AUTO_CFG)
+ cmd_flags = BCMCLI_PARM_FLAG_OPTIONAL;
+
+ /* command parameters are:
+ * - object_name (selector)
+ * - object_key_fields
+ * - object_per_group_fields filtered by access
+ * Therefore, there is 1 top-level enum parameter (object type) with per-value parameter tables
+ * In the case of operations or proxy messages, there is also a top-level enum parameter for the oper/proxy name
+ */
+
+ /* Allocate enum table based on max number of objects. Will be compacted in the end */
+ cmd_parms = bcmos_calloc(sizeof(bcmcli_cmd_parm) * (num_cmd_parms + 1));
+ if (!cmd_parms)
+ return BCM_ERR_NOMEM;
+
+ /* Allocate enough space for all object entries as well as a terminator entry (which is left NULL) */
+ obj_selector = bcmos_calloc(sizeof(bcmcli_enum_val) * (BCMBAL_OBJ_ID__NUM_OF + 1));
+ if (!obj_selector)
+ goto nomem_cleanup;
+
+ /* Allocate parameter table */
+ n_obj = 0;
+ for (o = 0; o < BCMBAL_OBJ_ID__NUM_OF; o++)
+ {
+ uint32_t nkeyfields = 0;
+ uint32_t nfields = 0;
+ uint32_t nfilterfields = 0;
+ uint32_t size;
+ uint16_t s;
+ uint16_t subgroup_count = bcmbal_apicli_get_subgroup_count(o, group);
+ bcmcli_enum_val *sub_selector;
+
+ if (subgroup_count == 0)
+ continue;
+
+ obj_selector[n_obj].val = o;
+ rc = bcmbal_apicli_object_name(o, &obj_selector[n_obj].name, NULL);
+ if (rc)
+ continue;
+
+ /* Get number of key fields and save it */
+ if (group == BCMBAL_MGT_GROUP_AUTO_CFG)
+ {
+ nkeyfields = 0;
+ }
+ else
+ {
+ bcmbal_apicli_get_num_fields_in_group(
+ o, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_APICLI_PROP_ACCESS_ID_W, &nkeyfields);
+ }
+
+ /* Allocate subgroup enum table */
+ sub_selector = bcmos_calloc(sizeof(bcmcli_enum_val) * (subgroup_count + 1));
+ if (!sub_selector)
+ goto nomem_cleanup;
+
+ /* Allocate single subgroup command parameter */
+ size = sizeof(bcmcli_cmd_parm) * 2;
+ obj_selector[n_obj].parms = bcmos_calloc(size);
+ if (!obj_selector[n_obj].parms)
+ {
+ bcmos_free(sub_selector);
+ goto nomem_cleanup;
+ }
+
+ /* Setup single subgroup command parameter */
+ obj_selector[n_obj].parms[0].type = BCMCLI_PARM_ENUM;
+ obj_selector[n_obj].parms[0].flags = BCMCLI_PARM_FLAG_SELECTOR;
+ obj_selector[n_obj].parms[0].enum_table = sub_selector;
+ rc = bcmbal_apicli_copy_parm_name(&obj_selector[n_obj].parms[0],
+ "sub",
+ "Subgroup (specific operation / proxy msg)");
+ if (rc)
+ goto nomem_cleanup;
+
+ for (s = 0; s < subgroup_count; ++s)
+ {
+ const char *sub_name;
+ bcmcli_cmd_parm *parm_ptr;
+
+ /* Get name of specific subgroup */
+ rc = bcmbal_apicli_object_subgroup_name(o, group, s, &sub_name, NULL);
+ if (rc)
+ continue;
+
+ /* Setup entry in subgroup enum table */
+ sub_selector[s].name = sub_name;
+ sub_selector[s].val = s;
+
+ /* Get number of group fields */
+ rc = bcmbal_apicli_get_num_fields_in_group(o, group, s, access_level, &nfields);
+ if (rc)
+ continue;
+
+ if ((flags & BCMBAL_APICLI_FLAGS_IGNORE_FIELDS) != BCMBAL_APICLI_FLAGS_NONE)
+ {
+ nfilterfields = 0;
+ nfields = 0;
+ }
+
+ /* Allocate parameter table and populate it */
+ sub_selector[s].parms = bcmbal_apicli_parm_alloc(nfields + nkeyfields + nfilterfields);
+ if (!sub_selector[s].parms)
+ {
+ rc = BCM_ERR_NOMEM;
+ goto nomem_cleanup;
+ }
+ for (i = 0; i < nkeyfields + nfields + nfilterfields; i++)
+ {
+ bcmbal_apicli_parm_data *parm_data = sub_selector[s].parms[i].user_data;
+ parm_data->group = (i < nkeyfields) ? BCMBAL_MGT_GROUP_KEY : group;
+ }
+
+ parm_ptr = sub_selector[s].parms;
+ if (nkeyfields)
+ {
+ rc = bcmbal_apicli_populate_parms(
+ o, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_APICLI_PROP_ACCESS_ID_W, parm_ptr, 0, "");
+ if (rc < 0)
+ goto nomem_cleanup;
+ parm_ptr += rc;
+ }
+ if (nfilterfields)
+ {
+ rc = bcmbal_apicli_populate_parms(
+ o, group, s, BCMBAL_APICLI_PROP_ACCESS_ID_RW, parm_ptr, cmd_flags, "filter.");
+ if (rc < 0)
+ goto nomem_cleanup;
+ parm_ptr += rc;
+ }
+ if (nfields)
+ {
+ rc = bcmbal_apicli_populate_parms(o, group, s, access_level, parm_ptr, cmd_flags, "");
+ if (rc < 0)
+ goto nomem_cleanup;
+ parm_ptr += rc;
+ }
+ }
+
+ /* Compact sub_selector enum. Removes holes (values without parameter table) */
+ bcmbal_apicli_compact_selector(sub_selector, subgroup_count);
+
+ /* If the group type doesn't support subgroups, remove the subgroup param entry */
+ if (group == BCMBAL_MGT_GROUP_CFG || group == BCMBAL_MGT_GROUP_STAT || group == BCMBAL_MGT_GROUP_AUTO_CFG)
+ {
+ /* Free the memory associated with the (single) subgroup param */
+ bcmos_free(BCMBAL_APICLI_CAST_DISCARD_CONST(obj_selector[n_obj].parms[0].name, void *));
+ bcmos_free(BCMBAL_APICLI_CAST_DISCARD_CONST(obj_selector[n_obj].parms[0].description, void *));
+ bcmos_free(obj_selector[n_obj].parms);
+ /* Assign the subgroup params to the root object params */
+ obj_selector[n_obj].parms = sub_selector[0].parms;
+ bcmos_free(sub_selector);
+ }
+
+ ++n_obj; /* number of configured objects */
+ }
+
+ /* Compact obj_selector enum. Removes holes (values without parameter table) */
+ bcmbal_apicli_compact_selector(obj_selector, BCMBAL_OBJ_ID__NUM_OF);
+
+ /* Add a 'clear on read' to stats group */
+ if (group == BCMBAL_MGT_GROUP_STAT)
+ {
+ cmd_parms[0].type = BCMCLI_PARM_ENUM;
+ cmd_parms[0].enum_table = bool_enum;
+ rc = bcmbal_apicli_copy_parm_name(&cmd_parms[0], "clear", "clear on read");
+ if (rc)
+ goto nomem_cleanup;
+ }
+
+ /* We are ready to add this command */
+ cmd_parms[num_cmd_parms - 1].type = BCMCLI_PARM_ENUM;
+ cmd_parms[num_cmd_parms - 1].flags = BCMCLI_PARM_FLAG_SELECTOR;
+ cmd_parms[num_cmd_parms - 1].enum_table = obj_selector;
+ rc = bcmbal_apicli_copy_parm_name(&cmd_parms[num_cmd_parms - 1], "object", "Object Type");
+ if (rc)
+ goto nomem_cleanup;
+ rc = bcmcli_cmd_add(dir, cmd_name, cmd_handler, cmd_descr,
+ (access_level == BCMBAL_APICLI_PROP_ACCESS_ID_W) ? BCMCLI_ACCESS_ADMIN : BCMCLI_ACCESS_GUEST,
+ &cmd_extras, cmd_parms);
+ if (rc)
+ goto nomem_cleanup;
+ return 0;
+
+nomem_cleanup:
+ if (obj_selector)
+ {
+ for (o = 0; o < BCMBAL_OBJ_ID__NUM_OF; o++)
+ {
+ if (obj_selector[o].parms)
+ bcmbal_apicli_free_parms(obj_selector[o].parms);
+ }
+ bcmos_free(obj_selector);
+ }
+ bcmos_free(cmd_parms);
+ return rc;
+}
+
+static bcmcli_session *bcmbal_apicli_log;
+static FILE *bcmbal_apicli_log_file;
+
+static int bcmbal_apicli_log_write_cb(bcmcli_session *session, const char *buf, uint32_t size)
+{
+ if (bcmbal_apicli_log_file == NULL || buf == NULL)
+ return BCM_ERR_INTERNAL;
+ fwrite(buf, 1, size, bcmbal_apicli_log_file);
+ fflush(bcmbal_apicli_log_file);
+ return BCM_ERR_OK;
+}
+
+/* Enable/disable API logging
+ * BCMCLI_MAKE_PARM("file", "Log file. Use \"-\" to disable logging", BCMCLI_PARM_STRING, 0));
+ */
+static bcmos_errno bcmbal_apicli_log_handler(bcmcli_session *session, const bcmcli_cmd_parm parm[], uint16_t nparms)
+{
+ const char *fname = parm[0].value.string;
+ bcmcli_session_parm session_params =
+ {
+ .write = bcmbal_apicli_log_write_cb,
+ .name = "api_log"
+ };
+ bcmos_errno rc;
+ time_t start_time;
+
+ /* Close existing log session if any */
+ if (bcmbal_apicli_log)
+ {
+ bcmcli_log_set(BCMCLI_LOG_NONE, NULL);
+ bcmcli_session_close(bcmbal_apicli_log);
+ fclose(bcmbal_apicli_log_file);
+ bcmbal_apicli_log = NULL;
+ bcmbal_apicli_log_file = NULL;
+ }
+
+ if (!strcmp(fname, "-"))
+ return BCM_ERR_OK;
+
+ /* Starting a new log session */
+ bcmbal_apicli_log_file = fopen(fname, "a");
+ if (bcmbal_apicli_log_file == NULL)
+ {
+ bcmcli_print(session, "Can't open file %s for logging\n", fname);
+ return BCM_ERR_PARM;
+ }
+ rc = bcmcli_session_open_user(&session_params, &bcmbal_apicli_log);
+ if (rc)
+ {
+ fclose(bcmbal_apicli_log_file);
+ bcmbal_apicli_log_file = NULL;
+ bcmcli_print(session, "Can't open log session. Error %s\n", bcmos_strerror(rc));
+ return rc;
+ }
+ time(&start_time);
+ bcmcli_log_set(BCMCLI_LOG_C_COMMENT, bcmbal_apicli_log);
+ bcmcli_log("/* API logging session started. %s */\n", ctime(&start_time));
+ return BCM_ERR_OK;
+}
+
+static void bcmbal_apicli_find_del_cmd(bcmcli_entry *dir, const char *cmd_name)
+{
+ bcmcli_entry *cmd;
+ cmd = bcmcli_cmd_find(dir, cmd_name);
+ if (cmd)
+ {
+ bcmcli_token_destroy(cmd);
+ }
+}
+
+/* Unregisters commands and directories */
+void bcmbal_apicli_del_commands(bcmcli_session *session, bcmcli_entry *api_dir)
+{
+ bcmbal_apicli_find_del_cmd(api_dir, "set");
+ bcmbal_apicli_find_del_cmd(api_dir, "get");
+ bcmbal_apicli_find_del_cmd(api_dir, "clear");
+ bcmbal_apicli_find_del_cmd(api_dir, "stat");
+ bcmbal_apicli_find_del_cmd(api_dir, "objects");
+ bcmbal_apicli_find_del_cmd(api_dir, "log");
+}
+
+/* Registers commands and directories */
+bcmos_errno bcmbal_apicli_add_commands(bcmcli_session *session, bcmcli_entry *api_dir)
+{
+ bcmos_errno rc;
+
+ current_session = session;
+
+ /* Now generate and add commands */
+ rc = bcmbal_apicli_add(api_dir, "set", "Set object configuration", BCMBAL_MGT_GROUP_CFG,
+ BCMBAL_APICLI_PROP_ACCESS_ID_W, bcmbal_apicli_set_handler, BCMBAL_APICLI_FLAGS_NONE);
+ rc = rc ? rc : bcmbal_apicli_add(api_dir, "get", "Get object configuration", BCMBAL_MGT_GROUP_CFG,
+ BCMBAL_APICLI_PROP_ACCESS_ID_R, bcmbal_apicli_get_handler, BCMBAL_APICLI_FLAGS_NONE);
+ rc = rc ? rc : bcmbal_apicli_add(api_dir, "clear", "Clear object configuration", BCMBAL_MGT_GROUP_CFG,
+ BCMBAL_APICLI_PROP_ACCESS_ID_R, bcmbal_apicli_clear_handler, BCMBAL_APICLI_FLAGS_IGNORE_FIELDS);
+ rc = rc ? rc : bcmbal_apicli_add(api_dir, "stat", "Get statistics", BCMBAL_MGT_GROUP_STAT,
+ BCMBAL_APICLI_PROP_ACCESS_ID_R, bcmbal_apicli_stat_handler, BCMBAL_APICLI_FLAGS_NONE);
+
+ /* List all system objects */
+ rc = rc ? rc : bcmcli_cmd_add(api_dir, "objects", bcmbal_apicli_objects_handler,
+ "Object Types", BCMCLI_ACCESS_GUEST, NULL, NULL);
+
+ BCMCLI_MAKE_CMD(api_dir, "log", "Log API calls", bcmbal_apicli_log_handler,
+ BCMCLI_MAKE_PARM("file", "Log file. Use \"-\" to disable logging", BCMCLI_PARM_STRING, 0));
+
+ return rc;
+}
diff --git a/bal_release/src/lib/libbalapicli/bal_api_cli.h b/bal_release/src/lib/libbalapicli/bal_api_cli.h
new file mode 100644
index 0000000..2acc2a7
--- /dev/null
+++ b/bal_release/src/lib/libbalapicli/bal_api_cli.h
@@ -0,0 +1,40 @@
+/*
+<:copyright-BRCM:2016:DUAL/GPL:standard
+
+ Broadcom Proprietary and Confidential.(c) 2016 Broadcom
+ All Rights Reserved
+
+Unless you and Broadcom execute a separate written software license
+agreement governing use of this software, this software is licensed
+to you under the terms of the GNU General Public License version 2
+(the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
+with the following added to such license:
+
+ As a special exception, the copyright holders of this software give
+ you permission to link this software with independent modules, and
+ to copy and distribute the resulting executable under terms of your
+ choice, provided that you also meet, for each linked independent
+ module, the terms and conditions of the license of that module.
+ An independent module is a module which is not derived from this
+ software. The special exception does not apply to any modifications
+ of the software.
+
+Not withstanding the above, under no circumstances may you combine
+this software in any way with any other Broadcom software provided
+under a license other than the GPL, without Broadcom's express prior
+written consent.
+
+:>
+ */
+
+#ifndef BCMBAL_APICLI_H_
+#define BCMBAL_APICLI_H_
+
+#include <bcmcli.h>
+
+void bcmbal_apicli_del_commands(bcmcli_session *session, bcmcli_entry *api_dir);
+
+/* Add BAL CLI commands */
+bcmos_errno bcmbal_apicli_add_commands(bcmcli_session *session, bcmcli_entry *api_dir);
+
+#endif /* BCMBAL_APICLI_H_ */
diff --git a/bal_release/src/lib/libbalapicli/bal_api_cli_dump.c b/bal_release/src/lib/libbalapicli/bal_api_cli_dump.c
new file mode 100644
index 0000000..5a34961
--- /dev/null
+++ b/bal_release/src/lib/libbalapicli/bal_api_cli_dump.c
@@ -0,0 +1,823 @@
+/*
+<:copyright-BRCM:2016:DUAL/GPL:standard
+
+ Broadcom Proprietary and Confidential.(c) 2016 Broadcom
+ All Rights Reserved
+
+Unless you and Broadcom execute a separate written software license
+agreement governing use of this software, this software is licensed
+to you under the terms of the GNU General Public License version 2
+(the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
+with the following added to such license:
+
+ As a special exception, the copyright holders of this software give
+ you permission to link this software with independent modules, and
+ to copy and distribute the resulting executable under terms of your
+ choice, provided that you also meet, for each linked independent
+ module, the terms and conditions of the license of that module.
+ An independent module is a module which is not derived from this
+ software. The special exception does not apply to any modifications
+ of the software.
+
+Not withstanding the above, under no circumstances may you combine
+this software in any way with any other Broadcom software provided
+under a license other than the GPL, without Broadcom's express prior
+written consent.
+
+:>
+ */
+
+#include <bcmos_system.h>
+#include <bal_obj.h>
+#include <bcmcli.h>
+#include "bal_api_cli_helpers.h"
+
+typedef enum
+{
+ BCMBAL_APICLI_OUTPUT_STYLE_STD,
+ BCMBAL_APICLI_OUTPUT_STYLE_C_INIT
+} bcmbal_apicli_output_style;
+
+typedef struct
+{
+ const bcmbal_apicli_type_descr *type;
+ void *data;
+ uint8_t bit;
+} bcmbal_apicli_presence_mask_info;
+
+static bcmos_errno bcmbal_apicli_dump_array(
+ bcmcli_session *session,
+ const bcmbal_apicli_type_descr *td,
+ void *data,
+ uint32_t size,
+ const char *name,
+ bcmbal_apicli_output_style style,
+ const bcmbal_apicli_presence_mask_info *presence_mask);
+
+static bcmos_errno bcmbal_apicli_read_snum(
+ bcmcli_session *session, const bcmbal_apicli_type_descr *td, void *data, int64_t *n)
+{
+ switch (td->size)
+ {
+ case 1:
+ {
+ int8_t n1 = *(int8_t *)data;
+ *n = n1;
+ break;
+ }
+ case 2:
+ {
+ int16_t n2 = *(int16_t *)data;
+ *n = n2;
+ break;
+ }
+ case 4:
+ {
+ int32_t n4 = *(int32_t *)data;
+ *n = n4;
+ break;
+ }
+ case 8:
+ {
+ memcpy(n, data, sizeof(*n));
+ break;
+ }
+ default:
+ bcmcli_print(session, "*** number size %u is not supported\n", td->size);
+ return BCM_ERR_NOT_SUPPORTED;
+ }
+ return BCM_ERR_OK;
+}
+
+static bcmos_errno bcmbal_apicli_read_unum(
+ bcmcli_session *session, const bcmbal_apicli_type_descr *td, void *data, uint64_t *n)
+{
+ switch (td->size)
+ {
+ case 1:
+ {
+ uint8_t n1 = *(uint8_t *)data;
+ *n = n1;
+ break;
+ }
+ case 2:
+ {
+ uint16_t n2 = *(uint16_t *)data;
+ *n = n2;
+ break;
+ }
+ case 4:
+ {
+ uint32_t n4 = *(uint32_t *)data;
+ *n = n4;
+ break;
+ }
+ case 8:
+ {
+ memcpy(n, data, sizeof(*n));
+ break;
+ }
+ default:
+ bcmcli_print(session, "*** number size %u is not supported\n", td->size);
+ return BCM_ERR_NOT_SUPPORTED;
+ }
+ return BCM_ERR_OK;
+}
+
+static void bcmbal_apicli_strcat_upper(char *dest, uint32_t dest_len, const char *src, uint32_t src_len)
+{
+ uint32_t src_idx;
+ uint32_t dest_idx;
+
+ for (dest_idx = 0; dest_idx < dest_len - 1; ++dest_idx)
+ {
+ if (dest[dest_idx] == '\0')
+ {
+ break;
+ }
+ }
+
+ for (src_idx = 0; src_idx < src_len && dest_idx < dest_len - 1; ++src_idx, ++dest_idx)
+ {
+ dest[dest_idx] = src[src_idx];
+ if (dest[dest_idx] >= 'a' && dest[dest_idx] <= 'z')
+ {
+ dest[dest_idx] = 'A' + (dest[dest_idx] - 'a');
+ }
+ }
+
+ dest[dest_idx] = '\0';
+}
+
+static const char *bcmbal_apicli_get_c_enum_id(const bcmbal_apicli_type_descr *td, const char *name)
+{
+ static char full_name_buf[256];
+ full_name_buf[0] = '\0';
+ bcmbal_apicli_strcat_upper(full_name_buf, sizeof(full_name_buf), td->name, strlen(td->name));
+ bcmbal_apicli_strcat_upper(full_name_buf, sizeof(full_name_buf), "_", 1);
+ bcmbal_apicli_strcat_upper(full_name_buf, sizeof(full_name_buf), name, strlen(name));
+ return full_name_buf;
+}
+
+static bcmos_errno bcmbal_apicli_dump_simple_data_type(
+ bcmcli_session *session,
+ const bcmbal_apicli_type_descr *td,
+ void *data,
+ const char *name,
+ bcmbal_apicli_output_style style)
+{
+ bcmos_errno rc = BCM_ERR_OK;
+
+ switch (td->base_type)
+ {
+ case BCMBAL_APICLI_BASE_TYPE_ID_SNUM: /* signed number */
+ {
+ int64_t n = 0;
+ rc = bcmbal_apicli_read_snum(session, td, data, &n);
+ bcmcli_print(session, "%lld", (long long)n);
+ break;
+ }
+
+ case BCMBAL_APICLI_BASE_TYPE_ID_UNUM: /* unsigned number */
+ {
+ uint64_t n = 0;
+ rc = bcmbal_apicli_read_unum(session, td, data, &n);
+ bcmcli_print(session, "%llu", (unsigned long long)n);
+ break;
+ }
+
+ case BCMBAL_APICLI_BASE_TYPE_ID_UNUM_HEX: /* unsigned number printed in hex */
+ {
+ uint64_t n = 0;
+ rc = bcmbal_apicli_read_unum(session, td, data, &n);
+ bcmcli_print(session, "0x%llx", (unsigned long long)n);
+ break;
+ }
+
+ case BCMBAL_APICLI_BASE_TYPE_ID_FLOAT: /* floating-point number */
+ {
+ if (td->size == sizeof(float))
+ {
+ bcmcli_print(session, "%f", *(float *)data);
+ }
+ else if (td->size == sizeof(double))
+ {
+ bcmcli_print(session, "%f", *(double *)data);
+ }
+ else
+ {
+ bcmcli_print(session, "*** floating-point number of width %u is not supported\n", td->size);
+ rc = BCM_ERR_NOT_SUPPORTED;
+ }
+ break;
+ }
+
+ case BCMBAL_APICLI_BASE_TYPE_ID_BOOL:
+ {
+ const char *no_str = style == BCMBAL_APICLI_OUTPUT_STYLE_C_INIT ? "BCMOS_FALSE" : "no";
+ const char *yes_str = style == BCMBAL_APICLI_OUTPUT_STYLE_C_INIT ? "BCMOS_TRUE" : "yes";
+ uint64_t n = 0;
+ rc = bcmbal_apicli_read_unum(session, td, data, &n);
+ bcmcli_print(session, "%s", n == 0 ? no_str : yes_str);
+ break;
+ }
+
+ case BCMBAL_APICLI_BASE_TYPE_ID_STRING: /* string */
+ {
+ if (td->size == 0)
+ {
+ bcmcli_print(session, "\"%s\"", (char *)data);
+ }
+ else
+ {
+ /* we know the size of the buffer */
+ bcmcli_print(session, "\"%.*s\"", td->size, (char *)data);
+ }
+ break;
+ }
+
+ case BCMBAL_APICLI_BASE_TYPE_ID_IPV4: /* IPv4 address */
+ {
+ uint32_t ip;
+ memcpy(&ip, data, sizeof(ip));
+ bcmcli_print(
+ session,
+ style == BCMBAL_APICLI_OUTPUT_STYLE_C_INIT ? "{ %d,%d,%d,%d }" : "%d.%d.%d.%d",
+ (ip >> 24) & 0xff, (ip >> 16) & 0xff, (ip >> 8) & 0xff, ip & 0xff);
+ break;
+ }
+
+ case BCMBAL_APICLI_BASE_TYPE_ID_MAC: /* MAC address */
+ {
+ bcmos_mac_address mac;
+ memcpy(mac.u8, data, sizeof(mac.u8));
+ bcmcli_print(
+ session,
+ style == BCMBAL_APICLI_OUTPUT_STYLE_C_INIT ?
+ "{{ 0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x }}" :
+ "%02x:%02x:%02x:%02x:%02x:%02x",
+ mac.u8[0], mac.u8[1], mac.u8[2], mac.u8[3], mac.u8[4], mac.u8[5]);
+ break;
+ }
+
+ case BCMBAL_APICLI_BASE_TYPE_ID_ENUM: /* enum */
+ {
+ uint64_t n = 0;
+ const char *s;
+ rc = bcmbal_apicli_read_unum(session, td, data, &n);
+ BUG_ON(td->x.e == NULL);
+ s = bcmcli_enum_stringval(td->x.e, (long)n);
+ if (style == BCMBAL_APICLI_OUTPUT_STYLE_C_INIT)
+ {
+ s = bcmbal_apicli_get_c_enum_id(td, s);
+ }
+ bcmcli_print(session, "%s", s);
+ break;
+ }
+
+ case BCMBAL_APICLI_BASE_TYPE_ID_ENUM_MASK:
+ {
+ uint64_t n = 0;
+ const char *s;
+ const char *none = NULL;
+ bcmcli_enum_val *value = td->x.e;
+ bcmos_bool first = BCMOS_TRUE;
+ BUG_ON(value == NULL);
+ rc = bcmbal_apicli_read_unum(session, td, data, &n);
+ while (value->name != NULL)
+ {
+ if (value->val == 0)
+ {
+ none = value->name;
+ }
+ if ((value->val & n) != 0)
+ {
+ s = value->name;
+ if (style == BCMBAL_APICLI_OUTPUT_STYLE_C_INIT)
+ {
+ s = bcmbal_apicli_get_c_enum_id(td, s);
+ }
+ bcmcli_print(session, "%s%s", first ? "" : (style == BCMBAL_APICLI_OUTPUT_STYLE_C_INIT ? "|" : BCMCLI_ENUM_MASK_DEL_STR), s);
+ first = BCMOS_FALSE;
+ n -= value->val;
+ }
+ ++value;
+ }
+ if (first)
+ {
+ bcmcli_print(session, "%s", (style == BCMBAL_APICLI_OUTPUT_STYLE_C_INIT) || (NULL == none) ? "0" : none);
+ }
+ break;
+ }
+
+ default:
+ bcmcli_print(session, "*** type %d is not supported\n", (int)td->base_type);
+ rc = BCM_ERR_NOT_SUPPORTED;
+ break;
+ }
+ return rc;
+}
+
+
+/* calculate number of enum values */
+static int bcmbal_apicli_get_num_enum_vals(const bcmcli_enum_val *vals)
+{
+ const bcmcli_enum_val *v = vals;
+ while (v && v->name)
+ {
+ ++v;
+ }
+ return (v - vals);
+}
+
+/* helper function to skip the "u." in front of union field names */
+static inline const char *bcmbal_apicli_skip_union_prefix(const char *name)
+{
+ if (name[0] == 'u' && name[1] == '.')
+ {
+ name += 2;
+ }
+ return name;
+}
+
+static bcmos_bool bcmbal_apicli_is_value_set(
+ bcmcli_session *session,
+ const bcmbal_apicli_presence_mask_info *presence_mask)
+{
+ uint64_t pm_value_num = 0;
+ if (!presence_mask || !presence_mask->type)
+ {
+ /* no presence mask - all values are implicitly set */
+ return BCMOS_TRUE;
+ }
+ bcmbal_apicli_read_unum(session, presence_mask->type, presence_mask->data, &pm_value_num);
+ return ((pm_value_num >> presence_mask->bit) & 1) != 0;
+}
+
+/* Dump data type */
+static bcmos_errno bcmbal_apicli_dump_data_type(
+ bcmcli_session *session,
+ const bcmbal_apicli_type_descr *td,
+ void *data,
+ const char *name,
+ uint32_t num_entries,
+ uint32_t entry_size,
+ bcmbal_apicli_output_style style,
+ const bcmbal_apicli_presence_mask_info *presence_mask)
+{
+ bcmos_errno rc = BCM_ERR_OK;
+
+ switch (td->base_type)
+ {
+ case BCMBAL_APICLI_BASE_TYPE_ID_STRUCT:
+ {
+ uint16_t f;
+ char full_name[BCMBAL_APICLI_MAX_PARM_NAME_LENGTH];
+ if (!td->x.s.num_fields)
+ return 0;
+ BUG_ON(!td->x.s.fields);
+ if (style == BCMBAL_APICLI_OUTPUT_STYLE_C_INIT)
+ {
+ bcmcli_print(session, "{ ");
+ }
+ for (f = 0; f < td->x.s.num_fields; f++)
+ {
+ const bcmbal_apicli_field_descr *fld = &td->x.s.fields[f];
+ void *fdata = (void *)((long)data + fld->offset);
+ bcmbal_apicli_presence_mask_info field_pm = {};
+ if (((td->x.s.fields[0].flags & BCMBAL_APICLI_FIELD_DESCR_FLAGS_PRESENCE_MASK) != 0) &&
+ style != BCMBAL_APICLI_OUTPUT_STYLE_C_INIT)
+ {
+ /* If the struct has a presence mask, skip the presence mask field itself, then record the position
+ * of the presence mask so we can check it later for each entry. */
+ if (f == 0)
+ {
+ continue;
+ }
+
+ field_pm.type = td->x.s.fields[0].type;
+ field_pm.data = (uint8_t *)data + td->x.s.fields[0].offset;
+ field_pm.bit = (uint8_t)(f - 1);
+ }
+ if (style == BCMBAL_APICLI_OUTPUT_STYLE_C_INIT && f > 0)
+ {
+ bcmcli_print(session, ", ");
+ }
+ bcmcli_strncpy(full_name, name, sizeof(full_name));
+ bcmcli_strncat(full_name, ".", sizeof(full_name));
+ bcmcli_strncat(full_name, fld->name, sizeof(full_name));
+ rc = bcmbal_apicli_dump_data_type(session, fld->type, fdata, full_name, num_entries, entry_size, style, &field_pm);
+ }
+ if (style == BCMBAL_APICLI_OUTPUT_STYLE_C_INIT)
+ {
+ bcmcli_print(session, " }");
+ }
+ break;
+ }
+
+ case BCMBAL_APICLI_BASE_TYPE_ID_UNION:
+ {
+ /* Print fields up to selector, then selector, then selected sub-structure */
+ uint16_t f;
+ char full_name[BCMBAL_APICLI_MAX_PARM_NAME_LENGTH];
+ const bcmbal_apicli_field_descr *fld;
+ void *fdata;
+ int64_t selector_val = 0;
+ int num_union_vals;
+
+ if (!td->x.u.num_common_fields)
+ return 0;
+ BUG_ON(!td->x.u.common_fields);
+ if (style == BCMBAL_APICLI_OUTPUT_STYLE_C_INIT)
+ {
+ bcmcli_print(session, "{ ");
+ }
+ /* Common fields, including selector */
+ for (f = 0; f <= td->x.u.classifier_idx && !rc; f++)
+ {
+ fld = &td->x.u.common_fields[f];
+ fdata = (void *)((long)data + fld->offset);
+
+ bcmcli_strncpy(full_name, name, sizeof(full_name));
+ if (fld->name && strlen(fld->name))
+ {
+ bcmcli_strncat(full_name, ".", sizeof(full_name));
+ bcmcli_strncat(full_name, fld->name, sizeof(full_name));
+ }
+ rc = bcmbal_apicli_dump_data_type(session, fld->type, fdata, full_name, num_entries, entry_size, style, presence_mask);
+ if (f == td->x.u.classifier_idx)
+ {
+ rc = rc ? rc : bcmbal_apicli_read_snum(session, fld->type, fdata, &selector_val);
+ }
+ if (style == BCMBAL_APICLI_OUTPUT_STYLE_C_INIT)
+ {
+ bcmcli_print(session, ", ");
+ }
+ }
+ if (rc)
+ {
+ bcmcli_print(session, "***internal error when dumping field %s\n",
+ td->x.u.common_fields[f].name);
+ return rc;
+ }
+
+ num_union_vals = bcmbal_apicli_get_num_enum_vals(td->x.u.common_fields[td->x.u.classifier_idx].type->x.e);
+ if ((unsigned)selector_val >= num_union_vals)
+ {
+ bcmcli_print(session, "***invalid union selector value %lld\n", (long long)selector_val);
+ return BCM_ERR_INTERNAL;
+ }
+
+ /* Common fields following selector */
+ for (; f < td->x.u.num_common_fields; f++)
+ {
+ fld = &td->x.u.common_fields[f];
+ fdata = (void *)((long)data + fld->offset);
+
+ if (style == BCMBAL_APICLI_OUTPUT_STYLE_C_INIT)
+ {
+ bcmcli_print(session, ", ");
+ }
+ bcmcli_strncpy(full_name, name, sizeof(full_name));
+ if (fld->name && strlen(fld->name))
+ {
+ bcmcli_strncat(full_name, ".", sizeof(full_name));
+ bcmcli_strncat(full_name, fld->name, sizeof(full_name));
+ }
+ rc = bcmbal_apicli_dump_data_type(session, fld->type, fdata, full_name, num_entries, entry_size, style, presence_mask);
+ }
+
+ /* Selected field */
+ fld = &td->x.u.union_fields[selector_val];
+ if (fld->type)
+ {
+ if (style == BCMBAL_APICLI_OUTPUT_STYLE_C_INIT)
+ {
+ bcmcli_print(session, "{ .%s = ", bcmbal_apicli_skip_union_prefix(fld->name));
+ }
+ fdata = (void *)((long)data + fld->offset);
+
+ bcmcli_strncpy(full_name, name, sizeof(full_name));
+ if (fld->name && strlen(fld->name))
+ {
+ bcmcli_strncat(full_name, ".", sizeof(full_name));
+ bcmcli_strncat(full_name, fld->name, sizeof(full_name));
+ }
+ rc = bcmbal_apicli_dump_data_type(session, fld->type, fdata, full_name, num_entries, entry_size, style, presence_mask);
+ if (style == BCMBAL_APICLI_OUTPUT_STYLE_C_INIT)
+ {
+ bcmcli_print(session, " }");
+ }
+ }
+ if (style == BCMBAL_APICLI_OUTPUT_STYLE_C_INIT)
+ {
+ bcmcli_print(session, " }");
+ }
+ break;
+ }
+
+ case BCMBAL_APICLI_BASE_TYPE_ID_ARR_FIXED: /* fixed array */
+ {
+ rc = bcmbal_apicli_dump_array(session, td->x.arr_fixed.elem_type, data, td->x.arr_fixed.size, name, style, presence_mask);
+ break;
+ }
+
+ case BCMBAL_APICLI_BASE_TYPE_ID_ARR_DYN: /* dynamic array that should be printed as buffer */
+ {
+ /* Read length */
+ uint32_t array_size;
+ long base_ptr;
+
+ switch (td->x.arr_dyn.len_size )
+ {
+ case 1: array_size = *(uint8_t *)data; break;
+ case 2: array_size = *(uint16_t *)data; break;
+ case 4: array_size = *(uint32_t *)data; break;
+ default:
+ bcmcli_print(session,
+ "*** %s: dyn array len_size %u is not supported\n", name, td->x.arr_dyn.len_size);
+ return BCM_ERR_NOT_SUPPORTED;
+ }
+ base_ptr = BCMOS_ROUND_UP((long)data + td->x.arr_dyn.len_size, sizeof(void *));
+ BUG_ON(!base_ptr);
+ data = *(void **)base_ptr;
+ rc = bcmbal_apicli_dump_array(session, td->x.arr_dyn.elem_type, data, array_size, name, style, presence_mask);
+ break;
+ }
+
+ default:
+ {
+ /* Finally! Simple type that maps to a single CLI parameter */
+ int n;
+ bcmbal_apicli_presence_mask_info local_pm;
+
+ /* If we have a single value and that value is not included in the presence mask, just skip it entirely */
+ if (num_entries == 1 && !bcmbal_apicli_is_value_set(session, presence_mask))
+ {
+ break;
+ }
+
+ if (style != BCMBAL_APICLI_OUTPUT_STYLE_C_INIT)
+ {
+ if (name)
+ {
+ bcmcli_print(session, " %s=", name);
+ }
+ if (!num_entries)
+ {
+ bcmcli_print(session, BCMCLI_ARRAY_EMPTY);
+ }
+ }
+
+ /* Dump simple value or array of simple values */
+ local_pm = presence_mask ? *presence_mask : (bcmbal_apicli_presence_mask_info){};
+ for (n = 0; n < num_entries; n++)
+ {
+ if (n)
+ {
+ bcmcli_print(session, ",");
+ }
+
+ /* If we have a presence mask, make sure to print a special token if the value is unset */
+ if (bcmbal_apicli_is_value_set(session, &local_pm))
+ {
+ rc = bcmbal_apicli_dump_simple_data_type(session, td, data, name, style);
+ }
+ else
+ {
+ bcmcli_print(session, BCMCLI_PARM_NO_VALUE);
+ }
+
+ data = (void *)((long)data + entry_size);
+ local_pm.data = (void *)((long)local_pm.data + entry_size);
+ }
+ if (style != BCMBAL_APICLI_OUTPUT_STYLE_C_INIT)
+ {
+ bcmcli_print(session, "\n");
+ }
+ break;
+ }
+ }
+ return rc;
+}
+
+/* Dump array */
+static bcmos_errno bcmbal_apicli_dump_array(
+ bcmcli_session *session,
+ const bcmbal_apicli_type_descr *td,
+ void *data,
+ uint32_t size,
+ const char *name,
+ bcmbal_apicli_output_style style,
+ const bcmbal_apicli_presence_mask_info *presence_mask)
+{
+ bcmos_errno rc = BCM_ERR_OK;
+
+ /* Print as buffer or element by element ? */
+ if (style == BCMBAL_APICLI_OUTPUT_STYLE_C_INIT)
+ {
+ bcmcli_print(session, "{ ");
+ rc = bcmbal_apicli_dump_data_type(session, td, data, name, size, td->size, style, presence_mask);
+ bcmcli_print(session, " }");
+ }
+ else if ((td->base_type == BCMBAL_APICLI_BASE_TYPE_ID_UNUM ||
+ td->base_type == BCMBAL_APICLI_BASE_TYPE_ID_UNUM_HEX) && td->size == 1)
+ {
+ if (bcmbal_apicli_is_value_set(session, presence_mask))
+ {
+ bcmcli_print(session, " %s=\n", name);
+ bcmcli_session_hexdump(session, data, 0, size, " ");
+ }
+ }
+ else
+ {
+ rc = bcmbal_apicli_dump_data_type(session, td, data, name, size, td->size, style, presence_mask);
+ }
+ return rc;
+}
+
+/* Dump property */
+bcmos_errno bcmbal_apicli_dump_prop(bcmcli_session *session, const bcmbal_apicli_prop_descr *pd, void *prop_data)
+{
+ return bcmbal_apicli_dump_data_type(
+ session, pd->type, prop_data, pd->name, 1, 0, BCMBAL_APICLI_OUTPUT_STYLE_STD, NULL);
+}
+
+/* Dump a single property value in C initializer format */
+bcmos_errno bcmbal_apicli_dump_prop_initializer(
+ bcmcli_session *session, const bcmbal_apicli_prop_descr *pd, void *prop_data)
+{
+ return bcmbal_apicli_dump_data_type(
+ session, pd->type, prop_data, pd->name, 1, 0, BCMBAL_APICLI_OUTPUT_STYLE_C_INIT, NULL);
+}
+
+/* Calculate property pointer given the group data pointer and property description */
+static inline void *bcmbal_apicli_prop_data_ptr(void *group_ptr, const bcmbal_apicli_prop_descr *pd)
+{
+ return (void *)((long)group_ptr + pd->offset);
+}
+
+/* Dump object data */
+static bcmos_errno bcmbal_apicli_dump_data(bcmcli_session *session, bcmbal_obj *msg, void *data, uint32_t data_size)
+{
+ uint16_t prop;
+ bcmos_errno rc = BCM_ERR_OK;
+ const bcmbal_apicli_prop_descr *pd;
+
+ bcmcli_print(session, "data:\n");
+ for (prop = 0;
+ bcmbal_apicli_object_property(msg->obj_type, msg->group, msg->subgroup, prop, &pd) == BCM_ERR_OK;
+ ++prop)
+ {
+ void *prop_data = bcmbal_apicli_prop_data_ptr(data, pd);
+ if (!(msg->presence_mask & (1LL << prop)))
+ continue;
+ if (!prop_data)
+ {
+ continue;
+ }
+ BUG_ON(pd->offset > data_size);
+ rc = bcmbal_apicli_dump_prop(session, pd, prop_data);
+ if (rc != BCM_ERR_OK)
+ {
+ break;
+ }
+ }
+ return rc;
+}
+
+/* Dump object key */
+static bcmos_errno bcmbal_apicli_dump_key(bcmcli_session *session, bcmbal_obj *msg, void *key, uint32_t key_size)
+{
+ uint16_t prop;
+ bcmos_errno rc = BCM_ERR_OK;
+ const bcmbal_apicli_prop_descr *pd;
+
+ bcmcli_print(session, "key:\n");
+ for (prop = 0;
+ bcmbal_apicli_object_property(msg->obj_type, BCMBAL_MGT_GROUP_KEY, 0, prop, &pd) == BCM_ERR_OK;
+ ++prop)
+ {
+ void *prop_data = bcmbal_apicli_prop_data_ptr(key, pd);
+ if (!prop_data)
+ {
+ continue;
+ }
+ BUG_ON(pd->offset > key_size);
+ rc = bcmbal_apicli_dump_prop(session, pd, prop_data);
+ if (rc != BCM_ERR_OK)
+ {
+ break;
+ }
+ }
+ return rc;
+}
+
+const char *bcmbal_apicli_mgt_group_to_str(bcmbal_mgt_group group)
+{
+ static const char *str_table[BCMBAL_MGT_GROUP__NUM_OF] =
+ {
+ [BCMBAL_MGT_GROUP_KEY] = "key",
+ [BCMBAL_MGT_GROUP_CFG] = "cfg",
+ [BCMBAL_MGT_GROUP_STAT] = "stat",
+ [BCMBAL_MGT_GROUP_AUTO] = "auto",
+ [BCMBAL_MGT_GROUP_AUTO_CFG] = "auto_cfg",
+ };
+ return (group >= BCMBAL_MGT_GROUP__NUM_OF) ? "<unknown>" : str_table[group];
+}
+
+/* Dump message */
+bcmos_errno bcmbal_apicli_msg_dump(bcmcli_session *session, bcmbal_obj *msg)
+{
+ bcmos_errno rc;
+ const char *name, *descr;
+ uint32_t key_size;
+ uint32_t key_offset;
+ uint32_t data_size = 0;
+ uint32_t data_offset;
+ void *key = NULL;
+ void *data = NULL;
+
+ rc = bcmbal_apicli_object_name(msg->obj_type, &name, &descr);
+ if (rc)
+ {
+ goto dump_error;
+ }
+
+ bcmcli_print(session, "object: ");
+ if (name)
+ {
+ bcmcli_print(session, "%s", name);
+ }
+ if (descr)
+ {
+ bcmcli_print(session, " - %s", descr);
+ }
+ bcmcli_print(session, "\n");
+ rc = bcmbal_apicli_object_struct_size(msg->obj_type, BCMBAL_MGT_GROUP_KEY, 0, &key_size, &key_offset, &data_size, &data_offset);
+ rc = rc ? rc : bcmbal_apicli_object_struct_size(msg->obj_type, msg->group, msg->subgroup, &key_size, &key_offset, &data_size, &data_offset);
+ if (rc)
+ {
+ goto dump_error;
+ }
+
+ bcmcli_print(session, (msg->type & BCMBAL_OBJ_MSG_TYPE_GET) != 0 ? "get" : "set");
+ if ((msg->type & BCMBAL_OBJ_MSG_TYPE_CLEAR) != 0)
+ {
+ bcmcli_print(session, ",clear");
+ }
+ bcmcli_print(session, " %s ", bcmbal_apicli_mgt_group_to_str(msg->group));
+
+ if (msg->group != BCMBAL_MGT_GROUP_CFG &&
+ msg->group != BCMBAL_MGT_GROUP_STAT &&
+ msg->group != BCMBAL_MGT_GROUP_AUTO_CFG)
+ {
+ const char *sub_name, *sub_descr;
+ /* Get name of specific subgroup */
+ rc = bcmbal_apicli_object_subgroup_name(msg->obj_type, msg->group, msg->subgroup, &sub_name, &sub_descr);
+ if (rc)
+ {
+ goto dump_error;
+ }
+ bcmcli_print(session, "subgroup: %s-%s ", sub_name ? sub_name : "?", sub_descr ? sub_descr : "");
+ }
+ if (msg->dir == BCMBAL_OBJ_MSG_DIR_REQUEST)
+ {
+ bcmcli_print(session, "request\n");
+ }
+ else
+ {
+ bcmcli_print(session, "response: %s\n", bcmos_strerror(msg->status));
+ bcmcli_print(session, "is in-progress: %s\n", (msg->is_inprogress == BCMOS_TRUE) ? "yes" : "no");
+ }
+
+ if ((msg->group != BCMBAL_MGT_GROUP_AUTO_CFG) && key_size)
+ {
+ key = (void *)((long)msg + sizeof(bcmbal_obj));
+ rc = bcmbal_apicli_dump_key(session, msg, key, key_size);
+ if (rc)
+ {
+ goto dump_error;
+ }
+ }
+ if (data_size &&
+ ( ((msg->dir == BCMBAL_OBJ_MSG_DIR_REQUEST) && (msg->type & BCMBAL_OBJ_MSG_TYPE_SET)) ||
+ ((msg->dir == BCMBAL_OBJ_MSG_DIR_RESPONSE) && (msg->type & BCMBAL_OBJ_MSG_TYPE_GET)) ||
+ (msg->group == BCMBAL_MGT_GROUP_AUTO)
+ )
+ )
+ {
+ data = (void *)((long)msg + data_offset);
+ rc = bcmbal_apicli_dump_data(session, msg, data, data_size);
+ if (rc)
+ {
+ goto dump_error;
+ }
+ }
+ return BCM_ERR_OK;
+
+dump_error:
+ bcmcli_print(session, "*** Object dump error %s (%d)\n", bcmos_strerror(rc), rc);
+ return rc;
+}
+
diff --git a/bal_release/src/lib/libbalapicli/bal_api_cli_handlers.c b/bal_release/src/lib/libbalapicli/bal_api_cli_handlers.c
new file mode 100644
index 0000000..cc90bbf
--- /dev/null
+++ b/bal_release/src/lib/libbalapicli/bal_api_cli_handlers.c
@@ -0,0 +1,4516 @@
+#include <bcmos_system.h>
+#include <bal_api.h>
+#include <bcmcli.h>
+#include "bal_api_cli_helpers.h"
+#include "bal_api_cli_handlers.h"
+
+bcmcli_session *bcmbal_apicli_log_session = NULL;
+
+typedef struct
+{
+ uint8_t *start;
+ uint32_t used;
+} bcmbal_apicli_byte_pool;
+
+static bcmos_errno bcmbal_apicli_byte_pool_create(bcmbal_apicli_byte_pool *buf)
+{
+ buf->used = 0;
+ buf->start = bcmos_calloc(BCMBAL_APICLI_DYNAMIC_LIST_BUFFER_SIZE);
+ return (buf->start == NULL) ? BCM_ERR_NOMEM : BCM_ERR_OK;
+}
+
+static void bcmbal_apicli_byte_pool_destroy(bcmbal_apicli_byte_pool *buf)
+{
+ bcmos_free(buf->start);
+}
+
+static void *bcmbal_apicli_byte_pool_calloc(bcmbal_apicli_byte_pool *buf, uint32_t num_bytes)
+{
+ void *ret;
+ if (buf->used + num_bytes > BCMBAL_APICLI_DYNAMIC_LIST_BUFFER_SIZE)
+ {
+ return NULL;
+ }
+
+ ret = buf->start + buf->used;
+ buf->used += num_bytes;
+ memset(ret, 0, num_bytes);
+ return ret;
+}
+
+/*
+ * Start/end banners - these are specially formatted so listening apps can easily tell where API handling starts/ends.
+ */
+static void bcmbal_apicli_print_start(bcmcli_session *session, const char *api_name)
+{
+ bcmcli_print(session, "[-- API Start: %s --]\n", api_name);
+}
+
+static void bcmbal_apicli_print_data_start(bcmcli_session *session)
+{
+ bcmcli_print(session, "[-- API Message Data --]\n");
+}
+
+static void bcmbal_apicli_print_complete(bcmcli_session *session, bcmos_errno err, const char *err_text)
+{
+ if (err != BCM_ERR_OK && err_text != NULL && err_text[0] != '\0')
+ {
+ bcmcli_print(session, "ERROR: %s", err_text);
+ }
+
+ bcmcli_print(session, "[-- API Complete: %d (%s) --]\n", err, bcmos_strerror(err));
+}
+
+static int bcmbal_apicli_session_write_cb(bcmcli_session *cli_session, const char *buf, uint32_t size)
+{
+ bcmcli_log(buf, "%.*s", size, buf);
+ return (int)size;
+}
+
+/* Logs a property value to the CLI log in such a way that it is a valid RHS in an initializer. For a primitve, this
+ * will just print the value (e.g. "42"). For a struct, it will emit all members in between curly braces. */
+static void bcmbal_apicli_log_prop_val(bcmolt_obj_id obj, bcmolt_mgt_group group, uint16_t subgroup, uint16_t prop, void *value)
+{
+ bcmos_errno err;
+ const bcmbal_apicli_prop_descr *prop_descr;
+
+ if (bcmbal_apicli_log_session == NULL)
+ {
+ static bcmcli_session_parm session_params = { .write = bcmbal_apicli_session_write_cb };
+
+ err = bcmcli_session_open(&session_params, &bcmbal_apicli_log_session);
+ if (err != BCM_ERR_OK)
+ {
+ bcmos_trace(BCMOS_TRACE_LEVEL_ERROR, "Error opening session: %s", bcmos_strerror(err));
+ return;
+ }
+ }
+
+ err = bcmbal_apicli_object_property(obj, group, subgroup, prop, &prop_descr);
+ if (err != BCM_ERR_OK)
+ {
+ bcmos_trace(BCMOS_TRACE_LEVEL_ERROR, "Error getting info for property: %s", bcmos_strerror(err));
+ return;
+ }
+
+ err = bcmbal_apicli_dump_prop_initializer(bcmbal_apicli_log_session, prop_descr, value);
+ if (err != BCM_ERR_OK)
+ {
+ bcmos_trace(BCMOS_TRACE_LEVEL_ERROR, "Error printing property: %s", bcmos_strerror(err));
+ }
+}
+
+static inline bcmos_ipv4_address bcmbal_apicli_unumber_to_ipv4(uint32_t num)
+{
+ bcmos_ipv4_address ip = { .u32 = num };
+ return ip;
+}
+
+/******************************************************************************/
+static bcmos_errno bcmbal_cli_access_terminal_cfg_get(bcmcli_session *session)
+{
+ bcmcli_cmd_parm *cli_parm;
+ bcmos_errno err;
+ bcmbal_access_terminal_cfg cfg; /**< declare main API struct */
+ bcmbal_access_terminal_key key = { }; /**< declare key */
+ bcmcli_log("bcmbal_access_terminal_cfg cfg;\n");
+ bcmcli_log("bcmbal_access_terminal_key key = { };\n");
+ bcmbal_apicli_print_start(session, "bcmbal_cfg_get");
+
+ /* init the API struct */
+ BCMBAL_CFG_INIT(&cfg, access_terminal, key);
+ bcmcli_log("BCMBAL_CFG_INIT(&cfg, access_terminal, key);\n");
+
+ /* decode API parameters from CLI */
+ cli_parm = bcmcli_find_named_parm(session, "admin_state");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, access_terminal, admin_state);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, access_terminal, admin_state);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "oper_status");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, access_terminal, oper_status);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, access_terminal, oper_status);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "iwf_mode");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, access_terminal, iwf_mode);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, access_terminal, iwf_mode);\n");
+ }
+ }
+
+ /* if no properties were requested, include everything */
+ if (!BCMBAL_CFG_PROP_IS_SET(&cfg, access_terminal, admin_state) && !BCMBAL_CFG_PROP_IS_SET(&cfg, access_terminal, oper_status) && !BCMBAL_CFG_PROP_IS_SET(&cfg, access_terminal, iwf_mode))
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, access_terminal, all_properties);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, access_terminal, all_properties);\n");
+ }
+
+ /* call API */
+ err = bcmbal_cfg_get(&cfg.hdr);
+ bcmcli_log("bcmbal_cfg_get(&cfg.hdr);\n");
+ if (err == BCM_ERR_OK)
+ {
+ /* print API contents to the CLI */
+ bcmbal_apicli_print_data_start(session);
+ err = bcmbal_apicli_msg_dump(session, &cfg.hdr.hdr);
+ }
+
+ bcmbal_apicli_print_complete(session, err, NULL);
+ return err;
+}
+
+/******************************************************************************/
+static bcmos_errno bcmbal_cli_access_terminal_cfg_set(bcmcli_session *session)
+{
+ bcmcli_cmd_parm *cli_parm;
+ bcmos_errno err;
+ bcmbal_access_terminal_cfg cfg; /**< declare main API struct */
+ bcmbal_access_terminal_key key = { }; /**< declare key */
+ bcmcli_log("bcmbal_access_terminal_cfg cfg;\n");
+ bcmcli_log("bcmbal_access_terminal_key key = { };\n");
+ bcmbal_apicli_print_start(session, "bcmbal_cfg_set");
+
+ /* init the API struct */
+ BCMBAL_CFG_INIT(&cfg, access_terminal, key);
+ bcmcli_log("BCMBAL_CFG_INIT(&cfg, access_terminal, key);\n");
+
+ /* decode API parameters from CLI */
+ cli_parm = bcmcli_find_named_parm(session, "admin_state");
+ if (cli_parm != NULL)
+ {
+ bcmbal_state val;
+ val = (bcmbal_state) cli_parm->value.enum_val;
+ BCMBAL_CFG_PROP_SET(&cfg, access_terminal, admin_state, val);
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, access_terminal, admin_state, ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_ACCESS_TERMINAL, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_ACCESS_TERMINAL_CFG_ID_ADMIN_STATE, &val);
+ bcmcli_log(");\n");
+ }
+
+ /* call API */
+ err = bcmbal_cfg_set(&cfg.hdr);
+ bcmcli_log("bcmbal_cfg_set(&cfg.hdr);\n");
+ bcmbal_apicli_print_complete(session, err, NULL);
+ return err;
+}
+
+/******************************************************************************/
+static bcmos_errno bcmbal_cli_access_terminal_cfg_clear(bcmcli_session *session)
+{
+ bcmos_errno err;
+ bcmbal_access_terminal_cfg cfg; /**< declare main API struct */
+ bcmbal_access_terminal_key key = { }; /**< declare key */
+ bcmcli_log("bcmbal_access_terminal_cfg cfg;\n");
+ bcmcli_log("bcmbal_access_terminal_key key = { };\n");
+ bcmbal_apicli_print_start(session, "bcmbal_cfg_clear");
+
+ /* init the API struct */
+ BCMBAL_CFG_INIT(&cfg, access_terminal, key);
+ bcmcli_log("BCMBAL_CFG_INIT(&cfg, access_terminal, key);\n");
+
+ /* call API */
+ err = bcmbal_cfg_clear(&cfg.hdr);
+ bcmcli_log("bcmbal_cfg_clear(&cfg.hdr);\n");
+ bcmbal_apicli_print_complete(session, err, NULL);
+ return err;
+}
+
+/******************************************************************************/
+static bcmos_errno bcmbal_cli_flow_cfg_get(bcmcli_session *session)
+{
+ bcmcli_cmd_parm *cli_parm;
+ bcmos_errno err;
+ bcmbal_flow_cfg cfg; /**< declare main API struct */
+ bcmbal_flow_key key = { }; /**< declare key */
+ bcmcli_log("bcmbal_flow_cfg cfg;\n");
+ bcmcli_log("bcmbal_flow_key key = { };\n");
+ bcmbal_apicli_print_start(session, "bcmbal_cfg_get");
+
+ /* build key from CLI parameters */
+ cli_parm = bcmcli_find_named_parm(session, "flow_id");
+ if (cli_parm != NULL)
+ {
+ key.flow_id = (bcmbal_flow_id) cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "flow_id is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmcli_log("key.flow_id = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_FLOW, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_FLOW_KEY_ID_FLOW_ID, &key.flow_id);
+ bcmcli_log(";\n");
+ cli_parm = bcmcli_find_named_parm(session, "flow_type");
+ if (cli_parm != NULL)
+ {
+ key.flow_type = (bcmbal_flow_type) cli_parm->value.enum_val;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "flow_type is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmcli_log("key.flow_type = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_FLOW, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_FLOW_KEY_ID_FLOW_TYPE, &key.flow_type);
+ bcmcli_log(";\n");
+
+ /* init the API struct */
+ BCMBAL_CFG_INIT(&cfg, flow, key);
+ bcmcli_log("BCMBAL_CFG_INIT(&cfg, flow, key);\n");
+
+ /* decode API parameters from CLI */
+ cli_parm = bcmcli_find_named_parm(session, "admin_state");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, flow, admin_state);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, flow, admin_state);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "oper_status");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, flow, oper_status);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, flow, oper_status);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "access_int_id");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, flow, access_int_id);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, flow, access_int_id);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "network_int_id");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, flow, network_int_id);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, flow, network_int_id);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "sub_term_id");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, flow, sub_term_id);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, flow, sub_term_id);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "sub_term_uni_idx");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, flow, sub_term_uni_idx);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, flow, sub_term_uni_idx);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "svc_port_id");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, flow, svc_port_id);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, flow, svc_port_id);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "agg_port_id");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, flow, agg_port_id);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, flow, agg_port_id);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "resolve_mac");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, flow, resolve_mac);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, flow, resolve_mac);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "classifier");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, flow, classifier);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, flow, classifier);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "action");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, flow, action);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, flow, action);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "sla");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, flow, sla);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, flow, sla);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "cookie");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, flow, cookie);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, flow, cookie);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "priority");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, flow, priority);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, flow, priority);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "group_id");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, flow, group_id);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, flow, group_id);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "queue");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, flow, queue);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, flow, queue);\n");
+ }
+ }
+
+ /* if no properties were requested, include everything */
+ if (!BCMBAL_CFG_PROP_IS_SET(&cfg, flow, admin_state) && !BCMBAL_CFG_PROP_IS_SET(&cfg, flow, oper_status) && !BCMBAL_CFG_PROP_IS_SET(&cfg, flow, access_int_id) && !BCMBAL_CFG_PROP_IS_SET(&cfg, flow, network_int_id) && !BCMBAL_CFG_PROP_IS_SET(&cfg, flow, sub_term_id) && !BCMBAL_CFG_PROP_IS_SET(&cfg, flow, sub_term_uni_idx) && !BCMBAL_CFG_PROP_IS_SET(&cfg, flow, svc_port_id) && !BCMBAL_CFG_PROP_IS_SET(&cfg, flow, agg_port_id) && !BCMBAL_CFG_PROP_IS_SET(&cfg, flow, resolve_mac) && !BCMBAL_CFG_PROP_IS_SET(&cfg, flow, classifier) && !BCMBAL_CFG_PROP_IS_SET(&cfg, flow, action) && !BCMBAL_CFG_PROP_IS_SET(&cfg, flow, sla) && !BCMBAL_CFG_PROP_IS_SET(&cfg, flow, cookie) && !BCMBAL_CFG_PROP_IS_SET(&cfg, flow, priority) && !BCMBAL_CFG_PROP_IS_SET(&cfg, flow, group_id) && !BCMBAL_CFG_PROP_IS_SET(&cfg, flow, queue))
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, flow, all_properties);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, flow, all_properties);\n");
+ }
+
+ /* call API */
+ err = bcmbal_cfg_get(&cfg.hdr);
+ bcmcli_log("bcmbal_cfg_get(&cfg.hdr);\n");
+ if (err == BCM_ERR_OK)
+ {
+ /* print API contents to the CLI */
+ bcmbal_apicli_print_data_start(session);
+ err = bcmbal_apicli_msg_dump(session, &cfg.hdr.hdr);
+ }
+
+ bcmbal_apicli_print_complete(session, err, NULL);
+ return err;
+}
+
+/******************************************************************************/
+static bcmos_errno bcmbal_cli_flow_cfg_set(bcmcli_session *session)
+{
+ bcmcli_cmd_parm *cli_parm;
+ bcmos_errno err;
+ bcmbal_flow_cfg cfg; /**< declare main API struct */
+ bcmbal_flow_key key = { }; /**< declare key */
+ bcmcli_log("bcmbal_flow_cfg cfg;\n");
+ bcmcli_log("bcmbal_flow_key key = { };\n");
+ bcmbal_apicli_print_start(session, "bcmbal_cfg_set");
+
+ /* build key from CLI parameters */
+ cli_parm = bcmcli_find_named_parm(session, "flow_id");
+ if (cli_parm != NULL)
+ {
+ key.flow_id = (bcmbal_flow_id) cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "flow_id is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmcli_log("key.flow_id = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_FLOW, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_FLOW_KEY_ID_FLOW_ID, &key.flow_id);
+ bcmcli_log(";\n");
+ cli_parm = bcmcli_find_named_parm(session, "flow_type");
+ if (cli_parm != NULL)
+ {
+ key.flow_type = (bcmbal_flow_type) cli_parm->value.enum_val;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "flow_type is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmcli_log("key.flow_type = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_FLOW, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_FLOW_KEY_ID_FLOW_TYPE, &key.flow_type);
+ bcmcli_log(";\n");
+
+ /* init the API struct */
+ BCMBAL_CFG_INIT(&cfg, flow, key);
+ bcmcli_log("BCMBAL_CFG_INIT(&cfg, flow, key);\n");
+
+ /* decode API parameters from CLI */
+ cli_parm = bcmcli_find_named_parm(session, "admin_state");
+ if (cli_parm != NULL)
+ {
+ bcmbal_state val;
+ val = (bcmbal_state) cli_parm->value.enum_val;
+ BCMBAL_CFG_PROP_SET(&cfg, flow, admin_state, val);
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, flow, admin_state, ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_FLOW, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_FLOW_CFG_ID_ADMIN_STATE, &val);
+ bcmcli_log(");\n");
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "access_int_id");
+ if (cli_parm != NULL)
+ {
+ bcmbal_intf_id val;
+ val = (bcmbal_intf_id) cli_parm->value.unumber;
+ BCMBAL_CFG_PROP_SET(&cfg, flow, access_int_id, val);
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, flow, access_int_id, ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_FLOW, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_FLOW_CFG_ID_ACCESS_INT_ID, &val);
+ bcmcli_log(");\n");
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "network_int_id");
+ if (cli_parm != NULL)
+ {
+ bcmbal_intf_id val;
+ val = (bcmbal_intf_id) cli_parm->value.unumber;
+ BCMBAL_CFG_PROP_SET(&cfg, flow, network_int_id, val);
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, flow, network_int_id, ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_FLOW, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_FLOW_CFG_ID_NETWORK_INT_ID, &val);
+ bcmcli_log(");\n");
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "sub_term_id");
+ if (cli_parm != NULL)
+ {
+ bcmbal_sub_id val;
+ val = (bcmbal_sub_id) cli_parm->value.unumber;
+ BCMBAL_CFG_PROP_SET(&cfg, flow, sub_term_id, val);
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, flow, sub_term_id, ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_FLOW, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_FLOW_CFG_ID_SUB_TERM_ID, &val);
+ bcmcli_log(");\n");
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "sub_term_uni_idx");
+ if (cli_parm != NULL)
+ {
+ uint8_t val;
+ val = cli_parm->value.unumber;
+ BCMBAL_CFG_PROP_SET(&cfg, flow, sub_term_uni_idx, val);
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, flow, sub_term_uni_idx, ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_FLOW, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_FLOW_CFG_ID_SUB_TERM_UNI_IDX, &val);
+ bcmcli_log(");\n");
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "svc_port_id");
+ if (cli_parm != NULL)
+ {
+ bcmbal_service_port_id val;
+ val = (bcmbal_service_port_id) cli_parm->value.unumber;
+ BCMBAL_CFG_PROP_SET(&cfg, flow, svc_port_id, val);
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, flow, svc_port_id, ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_FLOW, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_FLOW_CFG_ID_SVC_PORT_ID, &val);
+ bcmcli_log(");\n");
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "agg_port_id");
+ if (cli_parm != NULL)
+ {
+ bcmbal_aggregation_port_id val;
+ val = (bcmbal_aggregation_port_id) cli_parm->value.unumber;
+ BCMBAL_CFG_PROP_SET(&cfg, flow, agg_port_id, val);
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, flow, agg_port_id, ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_FLOW, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_FLOW_CFG_ID_AGG_PORT_ID, &val);
+ bcmcli_log(");\n");
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "resolve_mac");
+ if (cli_parm != NULL)
+ {
+ bcmos_bool val;
+ val = cli_parm->value.number;
+ BCMBAL_CFG_PROP_SET(&cfg, flow, resolve_mac, val);
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, flow, resolve_mac, ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_FLOW, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_FLOW_CFG_ID_RESOLVE_MAC, &val);
+ bcmcli_log(");\n");
+ }
+
+ cli_parm = bcmcli_find_parm_by_prefix(session, "classifier.");
+ if (cli_parm != NULL)
+ {
+ bcmbal_classifier val = { };
+ cli_parm = bcmcli_find_named_parm(session, "classifier.o_tpid");
+ if (cli_parm != NULL)
+ {
+ val.o_tpid = cli_parm->value.unumber;
+ val.presence_mask = val.presence_mask | BCMBAL_CLASSIFIER_ID_O_TPID;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "classifier.o_vid");
+ if (cli_parm != NULL)
+ {
+ val.o_vid = cli_parm->value.unumber;
+ val.presence_mask = val.presence_mask | BCMBAL_CLASSIFIER_ID_O_VID;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "classifier.i_tpid");
+ if (cli_parm != NULL)
+ {
+ val.i_tpid = cli_parm->value.unumber;
+ val.presence_mask = val.presence_mask | BCMBAL_CLASSIFIER_ID_I_TPID;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "classifier.i_vid");
+ if (cli_parm != NULL)
+ {
+ val.i_vid = cli_parm->value.unumber;
+ val.presence_mask = val.presence_mask | BCMBAL_CLASSIFIER_ID_I_VID;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "classifier.o_pbits");
+ if (cli_parm != NULL)
+ {
+ val.o_pbits = cli_parm->value.unumber;
+ val.presence_mask = val.presence_mask | BCMBAL_CLASSIFIER_ID_O_PBITS;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "classifier.i_pbits");
+ if (cli_parm != NULL)
+ {
+ val.i_pbits = cli_parm->value.unumber;
+ val.presence_mask = val.presence_mask | BCMBAL_CLASSIFIER_ID_I_PBITS;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "classifier.ether_type");
+ if (cli_parm != NULL)
+ {
+ val.ether_type = cli_parm->value.unumber;
+ val.presence_mask = val.presence_mask | BCMBAL_CLASSIFIER_ID_ETHER_TYPE;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "classifier.dst_mac");
+ if (cli_parm != NULL)
+ {
+ val.dst_mac = cli_parm->value.mac;
+ val.presence_mask = val.presence_mask | BCMBAL_CLASSIFIER_ID_DST_MAC;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "classifier.src_mac");
+ if (cli_parm != NULL)
+ {
+ val.src_mac = cli_parm->value.mac;
+ val.presence_mask = val.presence_mask | BCMBAL_CLASSIFIER_ID_SRC_MAC;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "classifier.ip_proto");
+ if (cli_parm != NULL)
+ {
+ val.ip_proto = cli_parm->value.unumber;
+ val.presence_mask = val.presence_mask | BCMBAL_CLASSIFIER_ID_IP_PROTO;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "classifier.dst_ip");
+ if (cli_parm != NULL)
+ {
+ val.dst_ip = bcmbal_apicli_unumber_to_ipv4(cli_parm->value.unumber);
+ val.presence_mask = val.presence_mask | BCMBAL_CLASSIFIER_ID_DST_IP;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "classifier.src_ip");
+ if (cli_parm != NULL)
+ {
+ val.src_ip = bcmbal_apicli_unumber_to_ipv4(cli_parm->value.unumber);
+ val.presence_mask = val.presence_mask | BCMBAL_CLASSIFIER_ID_SRC_IP;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "classifier.src_port");
+ if (cli_parm != NULL)
+ {
+ val.src_port = cli_parm->value.unumber;
+ val.presence_mask = val.presence_mask | BCMBAL_CLASSIFIER_ID_SRC_PORT;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "classifier.dst_port");
+ if (cli_parm != NULL)
+ {
+ val.dst_port = cli_parm->value.unumber;
+ val.presence_mask = val.presence_mask | BCMBAL_CLASSIFIER_ID_DST_PORT;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "classifier.pkt_tag_type");
+ if (cli_parm != NULL)
+ {
+ val.pkt_tag_type = (bcmbal_pkt_tag_type) cli_parm->value.enum_val;
+ val.presence_mask = val.presence_mask | BCMBAL_CLASSIFIER_ID_PKT_TAG_TYPE;
+ }
+
+ BCMBAL_CFG_PROP_SET(&cfg, flow, classifier, val);
+ bcmcli_log("{\n");
+ bcmcli_log("bcmbal_classifier val = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_FLOW, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_FLOW_CFG_ID_CLASSIFIER, &val);
+ bcmcli_log(";\n");
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, flow, classifier, val);\n");
+ bcmcli_log("}\n");
+ }
+
+ cli_parm = bcmcli_find_parm_by_prefix(session, "action.");
+ if (cli_parm != NULL)
+ {
+ bcmbal_action val = { };
+ cli_parm = bcmcli_find_named_parm(session, "action.cmds_bitmask");
+ if (cli_parm != NULL)
+ {
+ val.cmds_bitmask = (bcmbal_action_cmd_id) cli_parm->value.enum_val;
+ val.presence_mask = val.presence_mask | BCMBAL_ACTION_ID_CMDS_BITMASK;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "action.o_vid");
+ if (cli_parm != NULL)
+ {
+ val.o_vid = cli_parm->value.unumber;
+ val.presence_mask = val.presence_mask | BCMBAL_ACTION_ID_O_VID;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "action.o_pbits");
+ if (cli_parm != NULL)
+ {
+ val.o_pbits = cli_parm->value.unumber;
+ val.presence_mask = val.presence_mask | BCMBAL_ACTION_ID_O_PBITS;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "action.o_tpid");
+ if (cli_parm != NULL)
+ {
+ val.o_tpid = cli_parm->value.unumber;
+ val.presence_mask = val.presence_mask | BCMBAL_ACTION_ID_O_TPID;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "action.i_vid");
+ if (cli_parm != NULL)
+ {
+ val.i_vid = cli_parm->value.unumber;
+ val.presence_mask = val.presence_mask | BCMBAL_ACTION_ID_I_VID;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "action.i_pbits");
+ if (cli_parm != NULL)
+ {
+ val.i_pbits = cli_parm->value.unumber;
+ val.presence_mask = val.presence_mask | BCMBAL_ACTION_ID_I_PBITS;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "action.i_tpid");
+ if (cli_parm != NULL)
+ {
+ val.i_tpid = cli_parm->value.unumber;
+ val.presence_mask = val.presence_mask | BCMBAL_ACTION_ID_I_TPID;
+ }
+
+ BCMBAL_CFG_PROP_SET(&cfg, flow, action, val);
+ bcmcli_log("{\n");
+ bcmcli_log("bcmbal_action val = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_FLOW, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_FLOW_CFG_ID_ACTION, &val);
+ bcmcli_log(";\n");
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, flow, action, val);\n");
+ bcmcli_log("}\n");
+ }
+
+ cli_parm = bcmcli_find_parm_by_prefix(session, "sla.");
+ if (cli_parm != NULL)
+ {
+ bcmbal_sla val = { };
+ cli_parm = bcmcli_find_named_parm(session, "sla.min_rate");
+ if (cli_parm != NULL)
+ {
+ val.min_rate = cli_parm->value.unumber;
+ val.presence_mask = val.presence_mask | BCMBAL_SLA_ID_MIN_RATE;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "sla.max_rate");
+ if (cli_parm != NULL)
+ {
+ val.max_rate = cli_parm->value.unumber;
+ val.presence_mask = val.presence_mask | BCMBAL_SLA_ID_MAX_RATE;
+ }
+
+ BCMBAL_CFG_PROP_SET(&cfg, flow, sla, val);
+ bcmcli_log("{\n");
+ bcmcli_log("bcmbal_sla val = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_FLOW, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_FLOW_CFG_ID_SLA, &val);
+ bcmcli_log(";\n");
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, flow, sla, val);\n");
+ bcmcli_log("}\n");
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "cookie");
+ if (cli_parm != NULL)
+ {
+ bcmbal_cookie val;
+ val = (bcmbal_cookie) cli_parm->value.unumber64;
+ BCMBAL_CFG_PROP_SET(&cfg, flow, cookie, val);
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, flow, cookie, ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_FLOW, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_FLOW_CFG_ID_COOKIE, &val);
+ bcmcli_log(");\n");
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "priority");
+ if (cli_parm != NULL)
+ {
+ uint16_t val;
+ val = cli_parm->value.unumber;
+ BCMBAL_CFG_PROP_SET(&cfg, flow, priority, val);
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, flow, priority, ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_FLOW, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_FLOW_CFG_ID_PRIORITY, &val);
+ bcmcli_log(");\n");
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "group_id");
+ if (cli_parm != NULL)
+ {
+ bcmbal_group_id val;
+ val = (bcmbal_group_id) cli_parm->value.unumber;
+ BCMBAL_CFG_PROP_SET(&cfg, flow, group_id, val);
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, flow, group_id, ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_FLOW, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_FLOW_CFG_ID_GROUP_ID, &val);
+ bcmcli_log(");\n");
+ }
+
+ cli_parm = bcmcli_find_parm_by_prefix(session, "queue.");
+ if (cli_parm != NULL)
+ {
+ bcmbal_tm_queue_ref val = { };
+ cli_parm = bcmcli_find_named_parm(session, "queue.sched_id");
+ if (cli_parm != NULL)
+ {
+ val.sched_id = (bcmbal_tm_sched_id) cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "queue.sched_id is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "queue.queue_id");
+ if (cli_parm != NULL)
+ {
+ val.queue_id = (bcmbal_tm_queue_id) cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "queue.queue_id is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ BCMBAL_CFG_PROP_SET(&cfg, flow, queue, val);
+ bcmcli_log("{\n");
+ bcmcli_log("bcmbal_tm_queue_ref val = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_FLOW, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_FLOW_CFG_ID_QUEUE, &val);
+ bcmcli_log(";\n");
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, flow, queue, val);\n");
+ bcmcli_log("}\n");
+ }
+
+ /* call API */
+ err = bcmbal_cfg_set(&cfg.hdr);
+ bcmcli_log("bcmbal_cfg_set(&cfg.hdr);\n");
+ bcmbal_apicli_print_complete(session, err, NULL);
+ return err;
+}
+
+/******************************************************************************/
+static bcmos_errno bcmbal_cli_flow_cfg_clear(bcmcli_session *session)
+{
+ bcmcli_cmd_parm *cli_parm;
+ bcmos_errno err;
+ bcmbal_flow_cfg cfg; /**< declare main API struct */
+ bcmbal_flow_key key = { }; /**< declare key */
+ bcmcli_log("bcmbal_flow_cfg cfg;\n");
+ bcmcli_log("bcmbal_flow_key key = { };\n");
+ bcmbal_apicli_print_start(session, "bcmbal_cfg_clear");
+
+ /* build key from CLI parameters */
+ cli_parm = bcmcli_find_named_parm(session, "flow_id");
+ if (cli_parm != NULL)
+ {
+ key.flow_id = (bcmbal_flow_id) cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "flow_id is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmcli_log("key.flow_id = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_FLOW, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_FLOW_KEY_ID_FLOW_ID, &key.flow_id);
+ bcmcli_log(";\n");
+ cli_parm = bcmcli_find_named_parm(session, "flow_type");
+ if (cli_parm != NULL)
+ {
+ key.flow_type = (bcmbal_flow_type) cli_parm->value.enum_val;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "flow_type is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmcli_log("key.flow_type = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_FLOW, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_FLOW_KEY_ID_FLOW_TYPE, &key.flow_type);
+ bcmcli_log(";\n");
+
+ /* init the API struct */
+ BCMBAL_CFG_INIT(&cfg, flow, key);
+ bcmcli_log("BCMBAL_CFG_INIT(&cfg, flow, key);\n");
+
+ /* call API */
+ err = bcmbal_cfg_clear(&cfg.hdr);
+ bcmcli_log("bcmbal_cfg_clear(&cfg.hdr);\n");
+ bcmbal_apicli_print_complete(session, err, NULL);
+ return err;
+}
+
+/******************************************************************************/
+static bcmos_errno bcmbal_cli_flow_stat_get(bcmcli_session *session)
+{
+ bcmcli_cmd_parm *cli_parm;
+ bcmos_errno err;
+ bcmbal_flow_stat stat; /**< declare main API struct */
+ bcmbal_flow_key key = { }; /**< declare key */
+ bcmcli_log("bcmbal_flow_stat stat;\n");
+ bcmcli_log("bcmbal_flow_key key = { };\n");
+ bcmbal_apicli_print_start(session, "bcmbal_stat_get");
+
+ /* build key from CLI parameters */
+ cli_parm = bcmcli_find_named_parm(session, "flow_id");
+ if (cli_parm != NULL)
+ {
+ key.flow_id = (bcmbal_flow_id) cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "flow_id is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmcli_log("key.flow_id = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_FLOW, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_FLOW_KEY_ID_FLOW_ID, &key.flow_id);
+ bcmcli_log(";\n");
+ cli_parm = bcmcli_find_named_parm(session, "flow_type");
+ if (cli_parm != NULL)
+ {
+ key.flow_type = (bcmbal_flow_type) cli_parm->value.enum_val;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "flow_type is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmcli_log("key.flow_type = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_FLOW, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_FLOW_KEY_ID_FLOW_TYPE, &key.flow_type);
+ bcmcli_log(";\n");
+
+ /* init the API struct */
+ BCMBAL_STAT_INIT(&stat, flow, key);
+ bcmcli_log("BCMBAL_STAT_INIT(&stat, flow, key);\n");
+
+ /* decode API parameters from CLI */
+ cli_parm = bcmcli_find_named_parm(session, "rx_packets");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_STAT_PROP_GET(&stat, flow, rx_packets);
+ bcmcli_log("BCMBAL_STAT_PROP_GET(&stat, flow, rx_packets);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "rx_bytes");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_STAT_PROP_GET(&stat, flow, rx_bytes);
+ bcmcli_log("BCMBAL_STAT_PROP_GET(&stat, flow, rx_bytes);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "tx_packets");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_STAT_PROP_GET(&stat, flow, tx_packets);
+ bcmcli_log("BCMBAL_STAT_PROP_GET(&stat, flow, tx_packets);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "tx_bytes");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_STAT_PROP_GET(&stat, flow, tx_bytes);
+ bcmcli_log("BCMBAL_STAT_PROP_GET(&stat, flow, tx_bytes);\n");
+ }
+ }
+
+ /* if no properties were requested, include everything */
+ if (!BCMBAL_STAT_PROP_IS_SET(&stat, flow, rx_packets) && !BCMBAL_STAT_PROP_IS_SET(&stat, flow, rx_bytes) && !BCMBAL_STAT_PROP_IS_SET(&stat, flow, tx_packets) && !BCMBAL_STAT_PROP_IS_SET(&stat, flow, tx_bytes))
+ {
+ BCMBAL_STAT_PROP_GET(&stat, flow, all_properties);
+ bcmcli_log("BCMBAL_STAT_PROP_GET(&stat, flow, all_properties);\n");
+ }
+
+ /* call API */
+ err = bcmbal_stat_get(&stat.hdr);
+ bcmcli_log("bcmbal_stat_get(&stat.hdr);\n");
+ if (err == BCM_ERR_OK)
+ {
+ /* print API contents to the CLI */
+ bcmbal_apicli_print_data_start(session);
+ err = bcmbal_apicli_msg_dump(session, &stat.hdr.hdr);
+ }
+
+ bcmbal_apicli_print_complete(session, err, NULL);
+ return err;
+}
+
+/******************************************************************************/
+static bcmos_errno bcmbal_cli_group_cfg_get(bcmcli_session *session, bcmbal_apicli_byte_pool *byte_pool)
+{
+ bcmcli_cmd_parm *cli_parm;
+ bcmos_errno err;
+ bcmbal_group_cfg cfg; /**< declare main API struct */
+ bcmbal_group_key key = { }; /**< declare key */
+ uint8_t *list_mem; /**< declare memory buffer for variable-sized lists */
+ bcmcli_log("bcmbal_group_cfg cfg;\n");
+ bcmcli_log("bcmbal_group_key key = { };\n");
+ bcmcli_log("uint8_t* list_mem;\n");
+ bcmbal_apicli_print_start(session, "bcmbal_cfg_get");
+
+ /* build key from CLI parameters */
+ cli_parm = bcmcli_find_named_parm(session, "group_id");
+ if (cli_parm != NULL)
+ {
+ key.group_id = (bcmbal_group_id) cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "group_id is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmcli_log("key.group_id = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_GROUP, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_GROUP_KEY_ID_GROUP_ID, &key.group_id);
+ bcmcli_log(";\n");
+
+ /* init the API struct */
+ BCMBAL_CFG_INIT(&cfg, group, key);
+ bcmcli_log("BCMBAL_CFG_INIT(&cfg, group, key);\n");
+
+ /* decode API parameters from CLI */
+ cli_parm = bcmcli_find_named_parm(session, "members_cmd");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, group, members_cmd);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, group, members_cmd);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "members");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, group, members);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, group, members);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "cookie");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, group, cookie);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, group, cookie);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "flows");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, group, flows);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, group, flows);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "owner");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, group, owner);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, group, owner);\n");
+ }
+ }
+
+ /* if no properties were requested, include everything */
+ if (!BCMBAL_CFG_PROP_IS_SET(&cfg, group, members_cmd) && !BCMBAL_CFG_PROP_IS_SET(&cfg, group, members) && !BCMBAL_CFG_PROP_IS_SET(&cfg, group, cookie) && !BCMBAL_CFG_PROP_IS_SET(&cfg, group, flows) && !BCMBAL_CFG_PROP_IS_SET(&cfg, group, owner))
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, group, all_properties);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, group, all_properties);\n");
+ }
+
+ /* set memory to use for variable-sized lists */
+ list_mem = bcmbal_apicli_byte_pool_calloc(byte_pool, BCMBAL_APICLI_DYNAMIC_LIST_BUFFER_SIZE);
+ if (list_mem == NULL)
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_NOMEM, "\n");
+ return BCM_ERR_NOMEM;
+ }
+
+ bcmcli_log("list_mem = bcmos_calloc(BCMBAL_APICLI_DYNAMIC_LIST_BUFFER_SIZE);\n");
+ BCMBAL_CFG_LIST_BUF_SET(&cfg, group, list_mem, BCMBAL_APICLI_DYNAMIC_LIST_BUFFER_SIZE);
+ bcmcli_log("BCMBAL_CFG_LIST_BUF_SET(&cfg, group, list_mem, BCMBAL_APICLI_DYNAMIC_LIST_BUFFER_SIZE);\n");
+
+ /* call API */
+ err = bcmbal_cfg_get(&cfg.hdr);
+ bcmcli_log("bcmbal_cfg_get(&cfg.hdr);\n");
+ if (err == BCM_ERR_OK)
+ {
+ /* print API contents to the CLI */
+ bcmbal_apicli_print_data_start(session);
+ err = bcmbal_apicli_msg_dump(session, &cfg.hdr.hdr);
+ }
+
+ bcmbal_apicli_print_complete(session, err, NULL);
+ return err;
+}
+
+/******************************************************************************/
+static bcmos_errno bcmbal_cli_group_cfg_set(bcmcli_session *session, bcmbal_apicli_byte_pool *byte_pool)
+{
+ bcmcli_cmd_parm *cli_parm;
+ bcmos_errno err;
+ bcmbal_group_cfg cfg; /**< declare main API struct */
+ bcmbal_group_key key = { }; /**< declare key */
+ bcmcli_log("bcmbal_group_cfg cfg;\n");
+ bcmcli_log("bcmbal_group_key key = { };\n");
+ bcmbal_apicli_print_start(session, "bcmbal_cfg_set");
+
+ /* build key from CLI parameters */
+ cli_parm = bcmcli_find_named_parm(session, "group_id");
+ if (cli_parm != NULL)
+ {
+ key.group_id = (bcmbal_group_id) cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "group_id is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmcli_log("key.group_id = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_GROUP, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_GROUP_KEY_ID_GROUP_ID, &key.group_id);
+ bcmcli_log(";\n");
+
+ /* init the API struct */
+ BCMBAL_CFG_INIT(&cfg, group, key);
+ bcmcli_log("BCMBAL_CFG_INIT(&cfg, group, key);\n");
+
+ /* decode API parameters from CLI */
+ cli_parm = bcmcli_find_named_parm(session, "members_cmd");
+ if (cli_parm != NULL)
+ {
+ bcmbal_group_member_cmd val;
+ val = (bcmbal_group_member_cmd) cli_parm->value.enum_val;
+ BCMBAL_CFG_PROP_SET(&cfg, group, members_cmd, val);
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, group, members_cmd, ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_GROUP, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_GROUP_CFG_ID_MEMBERS_CMD, &val);
+ bcmcli_log(");\n");
+ }
+
+ cli_parm = bcmcli_find_parm_by_prefix(session, "members.");
+ if (cli_parm != NULL)
+ {
+ bcmbal_group_member_info_list_u16 val = { };
+ int32_t i0;
+ val.val = bcmbal_apicli_byte_pool_calloc(byte_pool, cli_parm->array_size * sizeof(*val.val));
+ if (val.val == NULL)
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_NOMEM, "\n");
+ return BCM_ERR_NOMEM;
+ }
+
+ val.len = cli_parm->array_size;
+ cli_parm = bcmcli_find_named_parm(session, "members.intf_id");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->array_size != val.len)
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "members.intf_id is a different size than other arrays in the struct\n");
+ return BCM_ERR_PARM;
+ }
+
+ for (i0 = 0; i0 < val.len; i0++)
+ {
+ val.val[i0].intf_id = (bcmbal_intf_id) cli_parm->values[i0].unumber;
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "members.svc_port_id");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->array_size != val.len)
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "members.svc_port_id is a different size than other arrays in the struct\n");
+ return BCM_ERR_PARM;
+ }
+
+ for (i0 = 0; i0 < val.len; i0++)
+ {
+ val.val[i0].svc_port_id = (bcmbal_service_port_id) cli_parm->values[i0].unumber;
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "members.action.cmds_bitmask");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->array_size != val.len)
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "members.action.cmds_bitmask is a different size than other arrays in the struct\n");
+ return BCM_ERR_PARM;
+ }
+
+ for (i0 = 0; i0 < val.len; i0++)
+ {
+ if (bcmcli_parm_value_is_set(session, cli_parm, i0))
+ {
+ val.val[i0].action.cmds_bitmask = (bcmbal_action_cmd_id) cli_parm->values[i0].enum_val;
+ val.val[i0].action.presence_mask = val.val[i0].action.presence_mask | BCMBAL_ACTION_ID_CMDS_BITMASK;
+ }
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "members.action.o_vid");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->array_size != val.len)
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "members.action.o_vid is a different size than other arrays in the struct\n");
+ return BCM_ERR_PARM;
+ }
+
+ for (i0 = 0; i0 < val.len; i0++)
+ {
+ if (bcmcli_parm_value_is_set(session, cli_parm, i0))
+ {
+ val.val[i0].action.o_vid = cli_parm->values[i0].unumber;
+ val.val[i0].action.presence_mask = val.val[i0].action.presence_mask | BCMBAL_ACTION_ID_O_VID;
+ }
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "members.action.o_pbits");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->array_size != val.len)
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "members.action.o_pbits is a different size than other arrays in the struct\n");
+ return BCM_ERR_PARM;
+ }
+
+ for (i0 = 0; i0 < val.len; i0++)
+ {
+ if (bcmcli_parm_value_is_set(session, cli_parm, i0))
+ {
+ val.val[i0].action.o_pbits = cli_parm->values[i0].unumber;
+ val.val[i0].action.presence_mask = val.val[i0].action.presence_mask | BCMBAL_ACTION_ID_O_PBITS;
+ }
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "members.action.o_tpid");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->array_size != val.len)
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "members.action.o_tpid is a different size than other arrays in the struct\n");
+ return BCM_ERR_PARM;
+ }
+
+ for (i0 = 0; i0 < val.len; i0++)
+ {
+ if (bcmcli_parm_value_is_set(session, cli_parm, i0))
+ {
+ val.val[i0].action.o_tpid = cli_parm->values[i0].unumber;
+ val.val[i0].action.presence_mask = val.val[i0].action.presence_mask | BCMBAL_ACTION_ID_O_TPID;
+ }
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "members.action.i_vid");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->array_size != val.len)
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "members.action.i_vid is a different size than other arrays in the struct\n");
+ return BCM_ERR_PARM;
+ }
+
+ for (i0 = 0; i0 < val.len; i0++)
+ {
+ if (bcmcli_parm_value_is_set(session, cli_parm, i0))
+ {
+ val.val[i0].action.i_vid = cli_parm->values[i0].unumber;
+ val.val[i0].action.presence_mask = val.val[i0].action.presence_mask | BCMBAL_ACTION_ID_I_VID;
+ }
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "members.action.i_pbits");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->array_size != val.len)
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "members.action.i_pbits is a different size than other arrays in the struct\n");
+ return BCM_ERR_PARM;
+ }
+
+ for (i0 = 0; i0 < val.len; i0++)
+ {
+ if (bcmcli_parm_value_is_set(session, cli_parm, i0))
+ {
+ val.val[i0].action.i_pbits = cli_parm->values[i0].unumber;
+ val.val[i0].action.presence_mask = val.val[i0].action.presence_mask | BCMBAL_ACTION_ID_I_PBITS;
+ }
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "members.action.i_tpid");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->array_size != val.len)
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "members.action.i_tpid is a different size than other arrays in the struct\n");
+ return BCM_ERR_PARM;
+ }
+
+ for (i0 = 0; i0 < val.len; i0++)
+ {
+ if (bcmcli_parm_value_is_set(session, cli_parm, i0))
+ {
+ val.val[i0].action.i_tpid = cli_parm->values[i0].unumber;
+ val.val[i0].action.presence_mask = val.val[i0].action.presence_mask | BCMBAL_ACTION_ID_I_TPID;
+ }
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "members.queue.sched_id");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->array_size != val.len)
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "members.queue.sched_id is a different size than other arrays in the struct\n");
+ return BCM_ERR_PARM;
+ }
+
+ for (i0 = 0; i0 < val.len; i0++)
+ {
+ val.val[i0].queue.sched_id = (bcmbal_tm_sched_id) cli_parm->values[i0].unumber;
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "members.queue.queue_id");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->array_size != val.len)
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "members.queue.queue_id is a different size than other arrays in the struct\n");
+ return BCM_ERR_PARM;
+ }
+
+ for (i0 = 0; i0 < val.len; i0++)
+ {
+ val.val[i0].queue.queue_id = (bcmbal_tm_queue_id) cli_parm->values[i0].unumber;
+ }
+ }
+
+ BCMBAL_CFG_PROP_SET(&cfg, group, members, val);
+ bcmcli_log("{\n");
+ bcmcli_log("bcmbal_group_member_info_list_u16 val = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_GROUP, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_GROUP_CFG_ID_MEMBERS, &val);
+ bcmcli_log(";\n");
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, group, members, val);\n");
+ bcmcli_log("}\n");
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "cookie");
+ if (cli_parm != NULL)
+ {
+ bcmbal_cookie val;
+ val = (bcmbal_cookie) cli_parm->value.unumber64;
+ BCMBAL_CFG_PROP_SET(&cfg, group, cookie, val);
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, group, cookie, ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_GROUP, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_GROUP_CFG_ID_COOKIE, &val);
+ bcmcli_log(");\n");
+ }
+
+ /* call API */
+ err = bcmbal_cfg_set(&cfg.hdr);
+ bcmcli_log("bcmbal_cfg_set(&cfg.hdr);\n");
+ bcmbal_apicli_print_complete(session, err, NULL);
+ return err;
+}
+
+/******************************************************************************/
+static bcmos_errno bcmbal_cli_group_cfg_clear(bcmcli_session *session)
+{
+ bcmcli_cmd_parm *cli_parm;
+ bcmos_errno err;
+ bcmbal_group_cfg cfg; /**< declare main API struct */
+ bcmbal_group_key key = { }; /**< declare key */
+ bcmcli_log("bcmbal_group_cfg cfg;\n");
+ bcmcli_log("bcmbal_group_key key = { };\n");
+ bcmbal_apicli_print_start(session, "bcmbal_cfg_clear");
+
+ /* build key from CLI parameters */
+ cli_parm = bcmcli_find_named_parm(session, "group_id");
+ if (cli_parm != NULL)
+ {
+ key.group_id = (bcmbal_group_id) cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "group_id is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmcli_log("key.group_id = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_GROUP, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_GROUP_KEY_ID_GROUP_ID, &key.group_id);
+ bcmcli_log(";\n");
+
+ /* init the API struct */
+ BCMBAL_CFG_INIT(&cfg, group, key);
+ bcmcli_log("BCMBAL_CFG_INIT(&cfg, group, key);\n");
+
+ /* call API */
+ err = bcmbal_cfg_clear(&cfg.hdr);
+ bcmcli_log("bcmbal_cfg_clear(&cfg.hdr);\n");
+ bcmbal_apicli_print_complete(session, err, NULL);
+ return err;
+}
+
+/******************************************************************************/
+static bcmos_errno bcmbal_cli_interface_cfg_get(bcmcli_session *session, bcmbal_apicli_byte_pool *byte_pool)
+{
+ bcmcli_cmd_parm *cli_parm;
+ bcmos_errno err;
+ bcmbal_interface_cfg cfg; /**< declare main API struct */
+ bcmbal_interface_key key = { }; /**< declare key */
+ uint8_t *list_mem; /**< declare memory buffer for variable-sized lists */
+ bcmcli_log("bcmbal_interface_cfg cfg;\n");
+ bcmcli_log("bcmbal_interface_key key = { };\n");
+ bcmcli_log("uint8_t* list_mem;\n");
+ bcmbal_apicli_print_start(session, "bcmbal_cfg_get");
+
+ /* build key from CLI parameters */
+ cli_parm = bcmcli_find_named_parm(session, "intf_id");
+ if (cli_parm != NULL)
+ {
+ key.intf_id = cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "intf_id is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmcli_log("key.intf_id = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_INTERFACE, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_INTERFACE_KEY_ID_INTF_ID, &key.intf_id);
+ bcmcli_log(";\n");
+ cli_parm = bcmcli_find_named_parm(session, "intf_type");
+ if (cli_parm != NULL)
+ {
+ key.intf_type = (bcmbal_intf_type) cli_parm->value.enum_val;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "intf_type is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmcli_log("key.intf_type = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_INTERFACE, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_INTERFACE_KEY_ID_INTF_TYPE, &key.intf_type);
+ bcmcli_log(";\n");
+
+ /* init the API struct */
+ BCMBAL_CFG_INIT(&cfg, interface, key);
+ bcmcli_log("BCMBAL_CFG_INIT(&cfg, interface, key);\n");
+
+ /* decode API parameters from CLI */
+ cli_parm = bcmcli_find_named_parm(session, "admin_state");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, interface, admin_state);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, interface, admin_state);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "oper_status");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, interface, oper_status);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, interface, oper_status);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "min_data_agg_port_id");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, interface, min_data_agg_port_id);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, interface, min_data_agg_port_id);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "min_data_svc_port_id");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, interface, min_data_svc_port_id);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, interface, min_data_svc_port_id);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "transceiver_type");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, interface, transceiver_type);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, interface, transceiver_type);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "ds_miss_mode");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, interface, ds_miss_mode);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, interface, ds_miss_mode);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "mtu");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, interface, mtu);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, interface, mtu);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "flow_control");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, interface, flow_control);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, interface, flow_control);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "ds_tm");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, interface, ds_tm);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, interface, ds_tm);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "us_tm");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, interface, us_tm);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, interface, us_tm);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "sub_term_id_list");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, interface, sub_term_id_list);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, interface, sub_term_id_list);\n");
+ }
+ }
+
+ /* if no properties were requested, include everything */
+ if (!BCMBAL_CFG_PROP_IS_SET(&cfg, interface, admin_state) && !BCMBAL_CFG_PROP_IS_SET(&cfg, interface, oper_status) && !BCMBAL_CFG_PROP_IS_SET(&cfg, interface, min_data_agg_port_id) && !BCMBAL_CFG_PROP_IS_SET(&cfg, interface, min_data_svc_port_id) && !BCMBAL_CFG_PROP_IS_SET(&cfg, interface, transceiver_type) && !BCMBAL_CFG_PROP_IS_SET(&cfg, interface, ds_miss_mode) && !BCMBAL_CFG_PROP_IS_SET(&cfg, interface, mtu) && !BCMBAL_CFG_PROP_IS_SET(&cfg, interface, flow_control) && !BCMBAL_CFG_PROP_IS_SET(&cfg, interface, ds_tm) && !BCMBAL_CFG_PROP_IS_SET(&cfg, interface, us_tm) && !BCMBAL_CFG_PROP_IS_SET(&cfg, interface, sub_term_id_list))
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, interface, all_properties);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, interface, all_properties);\n");
+ }
+
+ /* set memory to use for variable-sized lists */
+ list_mem = bcmbal_apicli_byte_pool_calloc(byte_pool, BCMBAL_APICLI_DYNAMIC_LIST_BUFFER_SIZE);
+ if (list_mem == NULL)
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_NOMEM, "\n");
+ return BCM_ERR_NOMEM;
+ }
+
+ bcmcli_log("list_mem = bcmos_calloc(BCMBAL_APICLI_DYNAMIC_LIST_BUFFER_SIZE);\n");
+ BCMBAL_CFG_LIST_BUF_SET(&cfg, interface, list_mem, BCMBAL_APICLI_DYNAMIC_LIST_BUFFER_SIZE);
+ bcmcli_log("BCMBAL_CFG_LIST_BUF_SET(&cfg, interface, list_mem, BCMBAL_APICLI_DYNAMIC_LIST_BUFFER_SIZE);\n");
+
+ /* call API */
+ err = bcmbal_cfg_get(&cfg.hdr);
+ bcmcli_log("bcmbal_cfg_get(&cfg.hdr);\n");
+ if (err == BCM_ERR_OK)
+ {
+ /* print API contents to the CLI */
+ bcmbal_apicli_print_data_start(session);
+ err = bcmbal_apicli_msg_dump(session, &cfg.hdr.hdr);
+ }
+
+ bcmbal_apicli_print_complete(session, err, NULL);
+ return err;
+}
+
+/******************************************************************************/
+static bcmos_errno bcmbal_cli_interface_cfg_set(bcmcli_session *session, bcmbal_apicli_byte_pool *byte_pool)
+{
+ bcmcli_cmd_parm *cli_parm;
+ bcmos_errno err;
+ bcmbal_interface_cfg cfg; /**< declare main API struct */
+ bcmbal_interface_key key = { }; /**< declare key */
+ bcmcli_log("bcmbal_interface_cfg cfg;\n");
+ bcmcli_log("bcmbal_interface_key key = { };\n");
+ bcmbal_apicli_print_start(session, "bcmbal_cfg_set");
+
+ /* build key from CLI parameters */
+ cli_parm = bcmcli_find_named_parm(session, "intf_id");
+ if (cli_parm != NULL)
+ {
+ key.intf_id = cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "intf_id is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmcli_log("key.intf_id = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_INTERFACE, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_INTERFACE_KEY_ID_INTF_ID, &key.intf_id);
+ bcmcli_log(";\n");
+ cli_parm = bcmcli_find_named_parm(session, "intf_type");
+ if (cli_parm != NULL)
+ {
+ key.intf_type = (bcmbal_intf_type) cli_parm->value.enum_val;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "intf_type is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmcli_log("key.intf_type = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_INTERFACE, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_INTERFACE_KEY_ID_INTF_TYPE, &key.intf_type);
+ bcmcli_log(";\n");
+
+ /* init the API struct */
+ BCMBAL_CFG_INIT(&cfg, interface, key);
+ bcmcli_log("BCMBAL_CFG_INIT(&cfg, interface, key);\n");
+
+ /* decode API parameters from CLI */
+ cli_parm = bcmcli_find_named_parm(session, "admin_state");
+ if (cli_parm != NULL)
+ {
+ bcmbal_state val;
+ val = (bcmbal_state) cli_parm->value.enum_val;
+ BCMBAL_CFG_PROP_SET(&cfg, interface, admin_state, val);
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, interface, admin_state, ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_INTERFACE, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_INTERFACE_CFG_ID_ADMIN_STATE, &val);
+ bcmcli_log(");\n");
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "min_data_agg_port_id");
+ if (cli_parm != NULL)
+ {
+ bcmbal_aggregation_port_id val;
+ val = (bcmbal_aggregation_port_id) cli_parm->value.unumber;
+ BCMBAL_CFG_PROP_SET(&cfg, interface, min_data_agg_port_id, val);
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, interface, min_data_agg_port_id, ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_INTERFACE, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_INTERFACE_CFG_ID_MIN_DATA_AGG_PORT_ID, &val);
+ bcmcli_log(");\n");
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "min_data_svc_port_id");
+ if (cli_parm != NULL)
+ {
+ bcmbal_service_port_id val;
+ val = (bcmbal_service_port_id) cli_parm->value.unumber;
+ BCMBAL_CFG_PROP_SET(&cfg, interface, min_data_svc_port_id, val);
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, interface, min_data_svc_port_id, ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_INTERFACE, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_INTERFACE_CFG_ID_MIN_DATA_SVC_PORT_ID, &val);
+ bcmcli_log(");\n");
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "transceiver_type");
+ if (cli_parm != NULL)
+ {
+ bcmbal_trx_type val;
+ val = (bcmbal_trx_type) cli_parm->value.enum_val;
+ BCMBAL_CFG_PROP_SET(&cfg, interface, transceiver_type, val);
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, interface, transceiver_type, ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_INTERFACE, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_INTERFACE_CFG_ID_TRANSCEIVER_TYPE, &val);
+ bcmcli_log(");\n");
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "ds_miss_mode");
+ if (cli_parm != NULL)
+ {
+ bcmbal_ds_miss_mode val;
+ val = (bcmbal_ds_miss_mode) cli_parm->value.enum_val;
+ BCMBAL_CFG_PROP_SET(&cfg, interface, ds_miss_mode, val);
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, interface, ds_miss_mode, ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_INTERFACE, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_INTERFACE_CFG_ID_DS_MISS_MODE, &val);
+ bcmcli_log(");\n");
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "mtu");
+ if (cli_parm != NULL)
+ {
+ uint16_t val;
+ val = cli_parm->value.unumber;
+ BCMBAL_CFG_PROP_SET(&cfg, interface, mtu, val);
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, interface, mtu, ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_INTERFACE, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_INTERFACE_CFG_ID_MTU, &val);
+ bcmcli_log(");\n");
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "flow_control");
+ if (cli_parm != NULL)
+ {
+ bcmbal_control val;
+ val = (bcmbal_control) cli_parm->value.enum_val;
+ BCMBAL_CFG_PROP_SET(&cfg, interface, flow_control, val);
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, interface, flow_control, ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_INTERFACE, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_INTERFACE_CFG_ID_FLOW_CONTROL, &val);
+ bcmcli_log(");\n");
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "ds_tm");
+ if (cli_parm != NULL)
+ {
+ bcmbal_tm_sched_id val;
+ val = (bcmbal_tm_sched_id) cli_parm->value.unumber;
+ BCMBAL_CFG_PROP_SET(&cfg, interface, ds_tm, val);
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, interface, ds_tm, ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_INTERFACE, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_INTERFACE_CFG_ID_DS_TM, &val);
+ bcmcli_log(");\n");
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "us_tm");
+ if (cli_parm != NULL)
+ {
+ bcmbal_tm_sched_id val;
+ val = (bcmbal_tm_sched_id) cli_parm->value.unumber;
+ BCMBAL_CFG_PROP_SET(&cfg, interface, us_tm, val);
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, interface, us_tm, ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_INTERFACE, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_INTERFACE_CFG_ID_US_TM, &val);
+ bcmcli_log(");\n");
+ }
+
+ /* call API */
+ err = bcmbal_cfg_set(&cfg.hdr);
+ bcmcli_log("bcmbal_cfg_set(&cfg.hdr);\n");
+ bcmbal_apicli_print_complete(session, err, NULL);
+ return err;
+}
+
+/******************************************************************************/
+static bcmos_errno bcmbal_cli_interface_cfg_clear(bcmcli_session *session)
+{
+ bcmcli_cmd_parm *cli_parm;
+ bcmos_errno err;
+ bcmbal_interface_cfg cfg; /**< declare main API struct */
+ bcmbal_interface_key key = { }; /**< declare key */
+ bcmcli_log("bcmbal_interface_cfg cfg;\n");
+ bcmcli_log("bcmbal_interface_key key = { };\n");
+ bcmbal_apicli_print_start(session, "bcmbal_cfg_clear");
+
+ /* build key from CLI parameters */
+ cli_parm = bcmcli_find_named_parm(session, "intf_id");
+ if (cli_parm != NULL)
+ {
+ key.intf_id = cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "intf_id is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmcli_log("key.intf_id = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_INTERFACE, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_INTERFACE_KEY_ID_INTF_ID, &key.intf_id);
+ bcmcli_log(";\n");
+ cli_parm = bcmcli_find_named_parm(session, "intf_type");
+ if (cli_parm != NULL)
+ {
+ key.intf_type = (bcmbal_intf_type) cli_parm->value.enum_val;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "intf_type is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmcli_log("key.intf_type = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_INTERFACE, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_INTERFACE_KEY_ID_INTF_TYPE, &key.intf_type);
+ bcmcli_log(";\n");
+
+ /* init the API struct */
+ BCMBAL_CFG_INIT(&cfg, interface, key);
+ bcmcli_log("BCMBAL_CFG_INIT(&cfg, interface, key);\n");
+
+ /* call API */
+ err = bcmbal_cfg_clear(&cfg.hdr);
+ bcmcli_log("bcmbal_cfg_clear(&cfg.hdr);\n");
+ bcmbal_apicli_print_complete(session, err, NULL);
+ return err;
+}
+
+/******************************************************************************/
+static bcmos_errno bcmbal_cli_interface_stat_get(bcmcli_session *session)
+{
+ bcmcli_cmd_parm *cli_parm;
+ bcmos_errno err;
+ bcmbal_interface_stat stat; /**< declare main API struct */
+ bcmbal_interface_key key = { }; /**< declare key */
+ bcmcli_log("bcmbal_interface_stat stat;\n");
+ bcmcli_log("bcmbal_interface_key key = { };\n");
+ bcmbal_apicli_print_start(session, "bcmbal_stat_get");
+
+ /* build key from CLI parameters */
+ cli_parm = bcmcli_find_named_parm(session, "intf_id");
+ if (cli_parm != NULL)
+ {
+ key.intf_id = cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "intf_id is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmcli_log("key.intf_id = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_INTERFACE, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_INTERFACE_KEY_ID_INTF_ID, &key.intf_id);
+ bcmcli_log(";\n");
+ cli_parm = bcmcli_find_named_parm(session, "intf_type");
+ if (cli_parm != NULL)
+ {
+ key.intf_type = (bcmbal_intf_type) cli_parm->value.enum_val;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "intf_type is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmcli_log("key.intf_type = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_INTERFACE, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_INTERFACE_KEY_ID_INTF_TYPE, &key.intf_type);
+ bcmcli_log(";\n");
+
+ /* init the API struct */
+ BCMBAL_STAT_INIT(&stat, interface, key);
+ bcmcli_log("BCMBAL_STAT_INIT(&stat, interface, key);\n");
+
+ /* decode API parameters from CLI */
+ cli_parm = bcmcli_find_named_parm(session, "rx_packets");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_STAT_PROP_GET(&stat, interface, rx_packets);
+ bcmcli_log("BCMBAL_STAT_PROP_GET(&stat, interface, rx_packets);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "rx_bytes");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_STAT_PROP_GET(&stat, interface, rx_bytes);
+ bcmcli_log("BCMBAL_STAT_PROP_GET(&stat, interface, rx_bytes);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "tx_packets");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_STAT_PROP_GET(&stat, interface, tx_packets);
+ bcmcli_log("BCMBAL_STAT_PROP_GET(&stat, interface, tx_packets);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "tx_bytes");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_STAT_PROP_GET(&stat, interface, tx_bytes);
+ bcmcli_log("BCMBAL_STAT_PROP_GET(&stat, interface, tx_bytes);\n");
+ }
+ }
+
+ /* if no properties were requested, include everything */
+ if (!BCMBAL_STAT_PROP_IS_SET(&stat, interface, rx_packets) && !BCMBAL_STAT_PROP_IS_SET(&stat, interface, rx_bytes) && !BCMBAL_STAT_PROP_IS_SET(&stat, interface, tx_packets) && !BCMBAL_STAT_PROP_IS_SET(&stat, interface, tx_bytes))
+ {
+ BCMBAL_STAT_PROP_GET(&stat, interface, all_properties);
+ bcmcli_log("BCMBAL_STAT_PROP_GET(&stat, interface, all_properties);\n");
+ }
+
+ /* call API */
+ err = bcmbal_stat_get(&stat.hdr);
+ bcmcli_log("bcmbal_stat_get(&stat.hdr);\n");
+ if (err == BCM_ERR_OK)
+ {
+ /* print API contents to the CLI */
+ bcmbal_apicli_print_data_start(session);
+ err = bcmbal_apicli_msg_dump(session, &stat.hdr.hdr);
+ }
+
+ bcmbal_apicli_print_complete(session, err, NULL);
+ return err;
+}
+
+/******************************************************************************/
+static bcmos_errno bcmbal_cli_packet_cfg_get(bcmcli_session *session, bcmbal_apicli_byte_pool *byte_pool)
+{
+ bcmcli_cmd_parm *cli_parm;
+ bcmos_errno err;
+ bcmbal_packet_cfg cfg; /**< declare main API struct */
+ bcmbal_packet_key key = { }; /**< declare key */
+ uint8_t *list_mem; /**< declare memory buffer for variable-sized lists */
+ bcmcli_log("bcmbal_packet_cfg cfg;\n");
+ bcmcli_log("bcmbal_packet_key key = { };\n");
+ bcmcli_log("uint8_t* list_mem;\n");
+ bcmbal_apicli_print_start(session, "bcmbal_cfg_get");
+
+ /* build key from CLI parameters */
+ cli_parm = bcmcli_find_named_parm(session, "reserved");
+ if (cli_parm != NULL)
+ {
+ key.reserved = cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "reserved is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmcli_log("key.reserved = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_PACKET, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_PACKET_KEY_ID_RESERVED, &key.reserved);
+ bcmcli_log(";\n");
+ cli_parm = bcmcli_find_parm_by_prefix(session, "packet_send_dest.");
+ if (cli_parm != NULL)
+ {
+ cli_parm = bcmcli_find_named_parm(session, "packet_send_dest.type");
+ if (cli_parm != NULL)
+ {
+ key.packet_send_dest.type = (bcmbal_dest_type) cli_parm->value.enum_val;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "packet_send_dest.type is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ switch (key.packet_send_dest.type)
+ {
+ case BCMBAL_DEST_TYPE_NNI:
+ cli_parm = bcmcli_find_named_parm(session, "packet_send_dest.int_id");
+ if (cli_parm != NULL)
+ {
+ key.packet_send_dest.u.nni.int_id = (bcmbal_intf_id) cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "packet_send_dest.int_id is not set\n");
+ return BCM_ERR_PARM;
+ }
+ break;
+ case BCMBAL_DEST_TYPE_SUB_TERM:
+ cli_parm = bcmcli_find_named_parm(session, "packet_send_dest.sub_term_id");
+ if (cli_parm != NULL)
+ {
+ key.packet_send_dest.u.sub_term.sub_term_id = (bcmbal_sub_id) cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "packet_send_dest.sub_term_id is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "packet_send_dest.sub_term_uni");
+ if (cli_parm != NULL)
+ {
+ key.packet_send_dest.u.sub_term.sub_term_uni = cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "packet_send_dest.sub_term_uni is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "packet_send_dest.int_id");
+ if (cli_parm != NULL)
+ {
+ key.packet_send_dest.u.sub_term.int_id = cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "packet_send_dest.int_id is not set\n");
+ return BCM_ERR_PARM;
+ }
+ break;
+ case BCMBAL_DEST_TYPE_HOST:
+ break;
+ default:
+ bcmbal_apicli_print_complete(session, BCM_ERR_RANGE, "\n");
+ return BCM_ERR_RANGE;
+ }
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "packet_send_dest is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmcli_log("key.packet_send_dest = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_PACKET, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_PACKET_KEY_ID_PACKET_SEND_DEST, &key.packet_send_dest);
+ bcmcli_log(";\n");
+
+ /* init the API struct */
+ BCMBAL_CFG_INIT(&cfg, packet, key);
+ bcmcli_log("BCMBAL_CFG_INIT(&cfg, packet, key);\n");
+
+ /* decode API parameters from CLI */
+ cli_parm = bcmcli_find_named_parm(session, "flow_id");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, packet, flow_id);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, packet, flow_id);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "flow_type");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, packet, flow_type);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, packet, flow_type);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "intf_id");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, packet, intf_id);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, packet, intf_id);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "intf_type");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, packet, intf_type);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, packet, intf_type);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "svc_port");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, packet, svc_port);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, packet, svc_port);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "flow_cookie");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, packet, flow_cookie);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, packet, flow_cookie);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "pkt");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, packet, pkt);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, packet, pkt);\n");
+ }
+ }
+
+ /* if no properties were requested, include everything */
+ if (!BCMBAL_CFG_PROP_IS_SET(&cfg, packet, flow_id) && !BCMBAL_CFG_PROP_IS_SET(&cfg, packet, flow_type) && !BCMBAL_CFG_PROP_IS_SET(&cfg, packet, intf_id) && !BCMBAL_CFG_PROP_IS_SET(&cfg, packet, intf_type) && !BCMBAL_CFG_PROP_IS_SET(&cfg, packet, svc_port) && !BCMBAL_CFG_PROP_IS_SET(&cfg, packet, flow_cookie) && !BCMBAL_CFG_PROP_IS_SET(&cfg, packet, pkt))
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, packet, all_properties);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, packet, all_properties);\n");
+ }
+
+ /* set memory to use for variable-sized lists */
+ list_mem = bcmbal_apicli_byte_pool_calloc(byte_pool, BCMBAL_APICLI_DYNAMIC_LIST_BUFFER_SIZE);
+ if (list_mem == NULL)
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_NOMEM, "\n");
+ return BCM_ERR_NOMEM;
+ }
+
+ bcmcli_log("list_mem = bcmos_calloc(BCMBAL_APICLI_DYNAMIC_LIST_BUFFER_SIZE);\n");
+ BCMBAL_CFG_LIST_BUF_SET(&cfg, packet, list_mem, BCMBAL_APICLI_DYNAMIC_LIST_BUFFER_SIZE);
+ bcmcli_log("BCMBAL_CFG_LIST_BUF_SET(&cfg, packet, list_mem, BCMBAL_APICLI_DYNAMIC_LIST_BUFFER_SIZE);\n");
+
+ /* call API */
+ err = bcmbal_cfg_get(&cfg.hdr);
+ bcmcli_log("bcmbal_cfg_get(&cfg.hdr);\n");
+ if (err == BCM_ERR_OK)
+ {
+ /* print API contents to the CLI */
+ bcmbal_apicli_print_data_start(session);
+ err = bcmbal_apicli_msg_dump(session, &cfg.hdr.hdr);
+ }
+
+ bcmbal_apicli_print_complete(session, err, NULL);
+ return err;
+}
+
+/******************************************************************************/
+static bcmos_errno bcmbal_cli_packet_cfg_set(bcmcli_session *session, bcmbal_apicli_byte_pool *byte_pool)
+{
+ bcmcli_cmd_parm *cli_parm;
+ bcmos_errno err;
+ bcmbal_packet_cfg cfg; /**< declare main API struct */
+ bcmbal_packet_key key = { }; /**< declare key */
+ bcmcli_log("bcmbal_packet_cfg cfg;\n");
+ bcmcli_log("bcmbal_packet_key key = { };\n");
+ bcmbal_apicli_print_start(session, "bcmbal_cfg_set");
+
+ /* build key from CLI parameters */
+ cli_parm = bcmcli_find_named_parm(session, "reserved");
+ if (cli_parm != NULL)
+ {
+ key.reserved = cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "reserved is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmcli_log("key.reserved = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_PACKET, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_PACKET_KEY_ID_RESERVED, &key.reserved);
+ bcmcli_log(";\n");
+ cli_parm = bcmcli_find_parm_by_prefix(session, "packet_send_dest.");
+ if (cli_parm != NULL)
+ {
+ cli_parm = bcmcli_find_named_parm(session, "packet_send_dest.type");
+ if (cli_parm != NULL)
+ {
+ key.packet_send_dest.type = (bcmbal_dest_type) cli_parm->value.enum_val;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "packet_send_dest.type is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ switch (key.packet_send_dest.type)
+ {
+ case BCMBAL_DEST_TYPE_NNI:
+ cli_parm = bcmcli_find_named_parm(session, "packet_send_dest.int_id");
+ if (cli_parm != NULL)
+ {
+ key.packet_send_dest.u.nni.int_id = (bcmbal_intf_id) cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "packet_send_dest.int_id is not set\n");
+ return BCM_ERR_PARM;
+ }
+ break;
+ case BCMBAL_DEST_TYPE_SUB_TERM:
+ cli_parm = bcmcli_find_named_parm(session, "packet_send_dest.sub_term_id");
+ if (cli_parm != NULL)
+ {
+ key.packet_send_dest.u.sub_term.sub_term_id = (bcmbal_sub_id) cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "packet_send_dest.sub_term_id is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "packet_send_dest.sub_term_uni");
+ if (cli_parm != NULL)
+ {
+ key.packet_send_dest.u.sub_term.sub_term_uni = cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "packet_send_dest.sub_term_uni is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "packet_send_dest.int_id");
+ if (cli_parm != NULL)
+ {
+ key.packet_send_dest.u.sub_term.int_id = cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "packet_send_dest.int_id is not set\n");
+ return BCM_ERR_PARM;
+ }
+ break;
+ case BCMBAL_DEST_TYPE_HOST:
+ break;
+ default:
+ bcmbal_apicli_print_complete(session, BCM_ERR_RANGE, "\n");
+ return BCM_ERR_RANGE;
+ }
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "packet_send_dest is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmcli_log("key.packet_send_dest = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_PACKET, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_PACKET_KEY_ID_PACKET_SEND_DEST, &key.packet_send_dest);
+ bcmcli_log(";\n");
+
+ /* init the API struct */
+ BCMBAL_CFG_INIT(&cfg, packet, key);
+ bcmcli_log("BCMBAL_CFG_INIT(&cfg, packet, key);\n");
+
+ /* decode API parameters from CLI */
+ cli_parm = bcmcli_find_named_parm(session, "flow_id");
+ if (cli_parm != NULL)
+ {
+ bcmbal_flow_id val;
+ val = (bcmbal_flow_id) cli_parm->value.unumber;
+ BCMBAL_CFG_PROP_SET(&cfg, packet, flow_id, val);
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, packet, flow_id, ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_PACKET, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_PACKET_CFG_ID_FLOW_ID, &val);
+ bcmcli_log(");\n");
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "flow_type");
+ if (cli_parm != NULL)
+ {
+ bcmbal_flow_type val;
+ val = (bcmbal_flow_type) cli_parm->value.enum_val;
+ BCMBAL_CFG_PROP_SET(&cfg, packet, flow_type, val);
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, packet, flow_type, ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_PACKET, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_PACKET_CFG_ID_FLOW_TYPE, &val);
+ bcmcli_log(");\n");
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "intf_id");
+ if (cli_parm != NULL)
+ {
+ bcmbal_intf_id val;
+ val = (bcmbal_intf_id) cli_parm->value.unumber;
+ BCMBAL_CFG_PROP_SET(&cfg, packet, intf_id, val);
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, packet, intf_id, ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_PACKET, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_PACKET_CFG_ID_INTF_ID, &val);
+ bcmcli_log(");\n");
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "intf_type");
+ if (cli_parm != NULL)
+ {
+ bcmbal_intf_type val;
+ val = (bcmbal_intf_type) cli_parm->value.enum_val;
+ BCMBAL_CFG_PROP_SET(&cfg, packet, intf_type, val);
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, packet, intf_type, ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_PACKET, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_PACKET_CFG_ID_INTF_TYPE, &val);
+ bcmcli_log(");\n");
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "svc_port");
+ if (cli_parm != NULL)
+ {
+ bcmbal_service_port_id val;
+ val = (bcmbal_service_port_id) cli_parm->value.unumber;
+ BCMBAL_CFG_PROP_SET(&cfg, packet, svc_port, val);
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, packet, svc_port, ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_PACKET, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_PACKET_CFG_ID_SVC_PORT, &val);
+ bcmcli_log(");\n");
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "flow_cookie");
+ if (cli_parm != NULL)
+ {
+ bcmbal_cookie val;
+ val = (bcmbal_cookie) cli_parm->value.unumber64;
+ BCMBAL_CFG_PROP_SET(&cfg, packet, flow_cookie, val);
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, packet, flow_cookie, ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_PACKET, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_PACKET_CFG_ID_FLOW_COOKIE, &val);
+ bcmcli_log(");\n");
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "pkt");
+ if (cli_parm != NULL)
+ {
+ bcmbal_u8_list_u32 val = { };
+ val.len = bcmbal_buf_get_used(&cli_parm->value.buffer);
+ val.val = bcmbal_apicli_byte_pool_calloc(byte_pool, val.len);
+ if (val.val == NULL)
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_NOMEM, "\n");
+ return BCM_ERR_NOMEM;
+ }
+
+ bcmbal_buf_set_pos(&cli_parm->value.buffer, 0);
+ bcmbal_buf_read(&cli_parm->value.buffer, val.val, val.len);
+ BCMBAL_CFG_PROP_SET(&cfg, packet, pkt, val);
+ bcmcli_log("{\n");
+ bcmcli_log("bcmbal_u8_list_u32 val = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_PACKET, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_PACKET_CFG_ID_PKT, &val);
+ bcmcli_log(";\n");
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, packet, pkt, val);\n");
+ bcmcli_log("}\n");
+ }
+
+ /* call API */
+ err = bcmbal_cfg_set(&cfg.hdr);
+ bcmcli_log("bcmbal_cfg_set(&cfg.hdr);\n");
+ bcmbal_apicli_print_complete(session, err, NULL);
+ return err;
+}
+
+/******************************************************************************/
+static bcmos_errno bcmbal_cli_packet_cfg_clear(bcmcli_session *session)
+{
+ bcmcli_cmd_parm *cli_parm;
+ bcmos_errno err;
+ bcmbal_packet_cfg cfg; /**< declare main API struct */
+ bcmbal_packet_key key = { }; /**< declare key */
+ bcmcli_log("bcmbal_packet_cfg cfg;\n");
+ bcmcli_log("bcmbal_packet_key key = { };\n");
+ bcmbal_apicli_print_start(session, "bcmbal_cfg_clear");
+
+ /* build key from CLI parameters */
+ cli_parm = bcmcli_find_named_parm(session, "reserved");
+ if (cli_parm != NULL)
+ {
+ key.reserved = cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "reserved is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmcli_log("key.reserved = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_PACKET, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_PACKET_KEY_ID_RESERVED, &key.reserved);
+ bcmcli_log(";\n");
+ cli_parm = bcmcli_find_parm_by_prefix(session, "packet_send_dest.");
+ if (cli_parm != NULL)
+ {
+ cli_parm = bcmcli_find_named_parm(session, "packet_send_dest.type");
+ if (cli_parm != NULL)
+ {
+ key.packet_send_dest.type = (bcmbal_dest_type) cli_parm->value.enum_val;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "packet_send_dest.type is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ switch (key.packet_send_dest.type)
+ {
+ case BCMBAL_DEST_TYPE_NNI:
+ cli_parm = bcmcli_find_named_parm(session, "packet_send_dest.int_id");
+ if (cli_parm != NULL)
+ {
+ key.packet_send_dest.u.nni.int_id = (bcmbal_intf_id) cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "packet_send_dest.int_id is not set\n");
+ return BCM_ERR_PARM;
+ }
+ break;
+ case BCMBAL_DEST_TYPE_SUB_TERM:
+ cli_parm = bcmcli_find_named_parm(session, "packet_send_dest.sub_term_id");
+ if (cli_parm != NULL)
+ {
+ key.packet_send_dest.u.sub_term.sub_term_id = (bcmbal_sub_id) cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "packet_send_dest.sub_term_id is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "packet_send_dest.sub_term_uni");
+ if (cli_parm != NULL)
+ {
+ key.packet_send_dest.u.sub_term.sub_term_uni = cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "packet_send_dest.sub_term_uni is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "packet_send_dest.int_id");
+ if (cli_parm != NULL)
+ {
+ key.packet_send_dest.u.sub_term.int_id = cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "packet_send_dest.int_id is not set\n");
+ return BCM_ERR_PARM;
+ }
+ break;
+ case BCMBAL_DEST_TYPE_HOST:
+ break;
+ default:
+ bcmbal_apicli_print_complete(session, BCM_ERR_RANGE, "\n");
+ return BCM_ERR_RANGE;
+ }
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "packet_send_dest is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmcli_log("key.packet_send_dest = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_PACKET, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_PACKET_KEY_ID_PACKET_SEND_DEST, &key.packet_send_dest);
+ bcmcli_log(";\n");
+
+ /* init the API struct */
+ BCMBAL_CFG_INIT(&cfg, packet, key);
+ bcmcli_log("BCMBAL_CFG_INIT(&cfg, packet, key);\n");
+
+ /* call API */
+ err = bcmbal_cfg_clear(&cfg.hdr);
+ bcmcli_log("bcmbal_cfg_clear(&cfg.hdr);\n");
+ bcmbal_apicli_print_complete(session, err, NULL);
+ return err;
+}
+
+/******************************************************************************/
+static bcmos_errno bcmbal_cli_subscriber_terminal_cfg_get(bcmcli_session *session, bcmbal_apicli_byte_pool *byte_pool)
+{
+ bcmcli_cmd_parm *cli_parm;
+ bcmos_errno err;
+ bcmbal_subscriber_terminal_cfg cfg; /**< declare main API struct */
+ bcmbal_subscriber_terminal_key key = { }; /**< declare key */
+ uint8_t *list_mem; /**< declare memory buffer for variable-sized lists */
+ bcmcli_log("bcmbal_subscriber_terminal_cfg cfg;\n");
+ bcmcli_log("bcmbal_subscriber_terminal_key key = { };\n");
+ bcmcli_log("uint8_t* list_mem;\n");
+ bcmbal_apicli_print_start(session, "bcmbal_cfg_get");
+
+ /* build key from CLI parameters */
+ cli_parm = bcmcli_find_named_parm(session, "sub_term_id");
+ if (cli_parm != NULL)
+ {
+ key.sub_term_id = (bcmbal_sub_id) cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "sub_term_id is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmcli_log("key.sub_term_id = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_SUBSCRIBER_TERMINAL_KEY_ID_SUB_TERM_ID, &key.sub_term_id);
+ bcmcli_log(";\n");
+ cli_parm = bcmcli_find_named_parm(session, "intf_id");
+ if (cli_parm != NULL)
+ {
+ key.intf_id = (bcmbal_intf_id) cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "intf_id is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmcli_log("key.intf_id = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_SUBSCRIBER_TERMINAL_KEY_ID_INTF_ID, &key.intf_id);
+ bcmcli_log(";\n");
+
+ /* init the API struct */
+ BCMBAL_CFG_INIT(&cfg, subscriber_terminal, key);
+ bcmcli_log("BCMBAL_CFG_INIT(&cfg, subscriber_terminal, key);\n");
+
+ /* decode API parameters from CLI */
+ cli_parm = bcmcli_find_named_parm(session, "admin_state");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, subscriber_terminal, admin_state);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, subscriber_terminal, admin_state);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "oper_status");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, subscriber_terminal, oper_status);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, subscriber_terminal, oper_status);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "serial_number");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, subscriber_terminal, serial_number);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, subscriber_terminal, serial_number);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "password");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, subscriber_terminal, password);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, subscriber_terminal, password);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "registration_id");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, subscriber_terminal, registration_id);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, subscriber_terminal, registration_id);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "svc_port_id");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, subscriber_terminal, svc_port_id);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, subscriber_terminal, svc_port_id);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "mac_address");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, subscriber_terminal, mac_address);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, subscriber_terminal, mac_address);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "ds_tm");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, subscriber_terminal, ds_tm);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, subscriber_terminal, ds_tm);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "us_tm");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, subscriber_terminal, us_tm);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, subscriber_terminal, us_tm);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "svc_port_id_list");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, subscriber_terminal, svc_port_id_list);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, subscriber_terminal, svc_port_id_list);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "agg_port_id_list");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, subscriber_terminal, agg_port_id_list);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, subscriber_terminal, agg_port_id_list);\n");
+ }
+ }
+
+ /* if no properties were requested, include everything */
+ if (!BCMBAL_CFG_PROP_IS_SET(&cfg, subscriber_terminal, admin_state) && !BCMBAL_CFG_PROP_IS_SET(&cfg, subscriber_terminal, oper_status) && !BCMBAL_CFG_PROP_IS_SET(&cfg, subscriber_terminal, serial_number) && !BCMBAL_CFG_PROP_IS_SET(&cfg, subscriber_terminal, password) && !BCMBAL_CFG_PROP_IS_SET(&cfg, subscriber_terminal, registration_id) && !BCMBAL_CFG_PROP_IS_SET(&cfg, subscriber_terminal, svc_port_id) && !BCMBAL_CFG_PROP_IS_SET(&cfg, subscriber_terminal, mac_address) && !BCMBAL_CFG_PROP_IS_SET(&cfg, subscriber_terminal, ds_tm) && !BCMBAL_CFG_PROP_IS_SET(&cfg, subscriber_terminal, us_tm) && !BCMBAL_CFG_PROP_IS_SET(&cfg, subscriber_terminal, svc_port_id_list) && !BCMBAL_CFG_PROP_IS_SET(&cfg, subscriber_terminal, agg_port_id_list))
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, subscriber_terminal, all_properties);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, subscriber_terminal, all_properties);\n");
+ }
+
+ /* set memory to use for variable-sized lists */
+ list_mem = bcmbal_apicli_byte_pool_calloc(byte_pool, BCMBAL_APICLI_DYNAMIC_LIST_BUFFER_SIZE);
+ if (list_mem == NULL)
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_NOMEM, "\n");
+ return BCM_ERR_NOMEM;
+ }
+
+ bcmcli_log("list_mem = bcmos_calloc(BCMBAL_APICLI_DYNAMIC_LIST_BUFFER_SIZE);\n");
+ BCMBAL_CFG_LIST_BUF_SET(&cfg, subscriber_terminal, list_mem, BCMBAL_APICLI_DYNAMIC_LIST_BUFFER_SIZE);
+ bcmcli_log("BCMBAL_CFG_LIST_BUF_SET(&cfg, subscriber_terminal, list_mem, BCMBAL_APICLI_DYNAMIC_LIST_BUFFER_SIZE);\n");
+
+ /* call API */
+ err = bcmbal_cfg_get(&cfg.hdr);
+ bcmcli_log("bcmbal_cfg_get(&cfg.hdr);\n");
+ if (err == BCM_ERR_OK)
+ {
+ /* print API contents to the CLI */
+ bcmbal_apicli_print_data_start(session);
+ err = bcmbal_apicli_msg_dump(session, &cfg.hdr.hdr);
+ }
+
+ bcmbal_apicli_print_complete(session, err, NULL);
+ return err;
+}
+
+/******************************************************************************/
+static bcmos_errno bcmbal_cli_subscriber_terminal_cfg_set(bcmcli_session *session, bcmbal_apicli_byte_pool *byte_pool)
+{
+ bcmcli_cmd_parm *cli_parm;
+ bcmos_errno err;
+ bcmbal_subscriber_terminal_cfg cfg; /**< declare main API struct */
+ bcmbal_subscriber_terminal_key key = { }; /**< declare key */
+ bcmcli_log("bcmbal_subscriber_terminal_cfg cfg;\n");
+ bcmcli_log("bcmbal_subscriber_terminal_key key = { };\n");
+ bcmbal_apicli_print_start(session, "bcmbal_cfg_set");
+
+ /* build key from CLI parameters */
+ cli_parm = bcmcli_find_named_parm(session, "sub_term_id");
+ if (cli_parm != NULL)
+ {
+ key.sub_term_id = (bcmbal_sub_id) cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "sub_term_id is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmcli_log("key.sub_term_id = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_SUBSCRIBER_TERMINAL_KEY_ID_SUB_TERM_ID, &key.sub_term_id);
+ bcmcli_log(";\n");
+ cli_parm = bcmcli_find_named_parm(session, "intf_id");
+ if (cli_parm != NULL)
+ {
+ key.intf_id = (bcmbal_intf_id) cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "intf_id is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmcli_log("key.intf_id = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_SUBSCRIBER_TERMINAL_KEY_ID_INTF_ID, &key.intf_id);
+ bcmcli_log(";\n");
+
+ /* init the API struct */
+ BCMBAL_CFG_INIT(&cfg, subscriber_terminal, key);
+ bcmcli_log("BCMBAL_CFG_INIT(&cfg, subscriber_terminal, key);\n");
+
+ /* decode API parameters from CLI */
+ cli_parm = bcmcli_find_named_parm(session, "admin_state");
+ if (cli_parm != NULL)
+ {
+ bcmbal_state val;
+ val = (bcmbal_state) cli_parm->value.enum_val;
+ BCMBAL_CFG_PROP_SET(&cfg, subscriber_terminal, admin_state, val);
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, subscriber_terminal, admin_state, ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_ADMIN_STATE, &val);
+ bcmcli_log(");\n");
+ }
+
+ cli_parm = bcmcli_find_parm_by_prefix(session, "serial_number.");
+ if (cli_parm != NULL)
+ {
+ bcmbal_serial_number val = { };
+ cli_parm = bcmcli_find_named_parm(session, "serial_number.vendor_id");
+ if (cli_parm != NULL)
+ {
+ if (bcmbal_buf_get_used(&cli_parm->value.buffer) != 4)
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "buffer serial_number.vendor_id must have 4 bytes\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmbal_buf_set_pos(&cli_parm->value.buffer, 0);
+ bcmbal_buf_read(&cli_parm->value.buffer, val.vendor_id, 4);
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "serial_number.vendor_id is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "serial_number.vendor_specific");
+ if (cli_parm != NULL)
+ {
+ if (bcmbal_buf_get_used(&cli_parm->value.buffer) != 4)
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "buffer serial_number.vendor_specific must have 4 bytes\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmbal_buf_set_pos(&cli_parm->value.buffer, 0);
+ bcmbal_buf_read(&cli_parm->value.buffer, val.vendor_specific, 4);
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "serial_number.vendor_specific is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ BCMBAL_CFG_PROP_SET(&cfg, subscriber_terminal, serial_number, val);
+ bcmcli_log("{\n");
+ bcmcli_log("bcmbal_serial_number val = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_SERIAL_NUMBER, &val);
+ bcmcli_log(";\n");
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, subscriber_terminal, serial_number, val);\n");
+ bcmcli_log("}\n");
+ }
+
+ cli_parm = bcmcli_find_parm_by_prefix(session, "password.");
+ if (cli_parm != NULL)
+ {
+ bcmbal_password val = { };
+ cli_parm = bcmcli_find_named_parm(session, "password.arr");
+ if (cli_parm != NULL)
+ {
+ if (bcmbal_buf_get_used(&cli_parm->value.buffer) != 10)
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "buffer password.arr must have 10 bytes\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmbal_buf_set_pos(&cli_parm->value.buffer, 0);
+ bcmbal_buf_read(&cli_parm->value.buffer, val.arr, 10);
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "password.arr is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ BCMBAL_CFG_PROP_SET(&cfg, subscriber_terminal, password, val);
+ bcmcli_log("{\n");
+ bcmcli_log("bcmbal_password val = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_PASSWORD, &val);
+ bcmcli_log(";\n");
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, subscriber_terminal, password, val);\n");
+ bcmcli_log("}\n");
+ }
+
+ cli_parm = bcmcli_find_parm_by_prefix(session, "registration_id.");
+ if (cli_parm != NULL)
+ {
+ bcmbal_registration_id val = { };
+ cli_parm = bcmcli_find_named_parm(session, "registration_id.arr");
+ if (cli_parm != NULL)
+ {
+ if (bcmbal_buf_get_used(&cli_parm->value.buffer) != 36)
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "buffer registration_id.arr must have 36 bytes\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmbal_buf_set_pos(&cli_parm->value.buffer, 0);
+ bcmbal_buf_read(&cli_parm->value.buffer, val.arr, 36);
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "registration_id.arr is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ BCMBAL_CFG_PROP_SET(&cfg, subscriber_terminal, registration_id, val);
+ bcmcli_log("{\n");
+ bcmcli_log("bcmbal_registration_id val = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_REGISTRATION_ID, &val);
+ bcmcli_log(";\n");
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, subscriber_terminal, registration_id, val);\n");
+ bcmcli_log("}\n");
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "mac_address");
+ if (cli_parm != NULL)
+ {
+ bcmos_mac_address val;
+ val = cli_parm->value.mac;
+ BCMBAL_CFG_PROP_SET(&cfg, subscriber_terminal, mac_address, val);
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, subscriber_terminal, mac_address, ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_MAC_ADDRESS, &val);
+ bcmcli_log(");\n");
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "ds_tm");
+ if (cli_parm != NULL)
+ {
+ bcmbal_tm_sched_id val;
+ val = (bcmbal_tm_sched_id) cli_parm->value.unumber;
+ BCMBAL_CFG_PROP_SET(&cfg, subscriber_terminal, ds_tm, val);
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, subscriber_terminal, ds_tm, ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_DS_TM, &val);
+ bcmcli_log(");\n");
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "us_tm");
+ if (cli_parm != NULL)
+ {
+ bcmbal_tm_sched_id val;
+ val = (bcmbal_tm_sched_id) cli_parm->value.unumber;
+ BCMBAL_CFG_PROP_SET(&cfg, subscriber_terminal, us_tm, val);
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, subscriber_terminal, us_tm, ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_US_TM, &val);
+ bcmcli_log(");\n");
+ }
+
+ /* call API */
+ err = bcmbal_cfg_set(&cfg.hdr);
+ bcmcli_log("bcmbal_cfg_set(&cfg.hdr);\n");
+ bcmbal_apicli_print_complete(session, err, NULL);
+ return err;
+}
+
+/******************************************************************************/
+static bcmos_errno bcmbal_cli_subscriber_terminal_cfg_clear(bcmcli_session *session)
+{
+ bcmcli_cmd_parm *cli_parm;
+ bcmos_errno err;
+ bcmbal_subscriber_terminal_cfg cfg; /**< declare main API struct */
+ bcmbal_subscriber_terminal_key key = { }; /**< declare key */
+ bcmcli_log("bcmbal_subscriber_terminal_cfg cfg;\n");
+ bcmcli_log("bcmbal_subscriber_terminal_key key = { };\n");
+ bcmbal_apicli_print_start(session, "bcmbal_cfg_clear");
+
+ /* build key from CLI parameters */
+ cli_parm = bcmcli_find_named_parm(session, "sub_term_id");
+ if (cli_parm != NULL)
+ {
+ key.sub_term_id = (bcmbal_sub_id) cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "sub_term_id is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmcli_log("key.sub_term_id = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_SUBSCRIBER_TERMINAL_KEY_ID_SUB_TERM_ID, &key.sub_term_id);
+ bcmcli_log(";\n");
+ cli_parm = bcmcli_find_named_parm(session, "intf_id");
+ if (cli_parm != NULL)
+ {
+ key.intf_id = (bcmbal_intf_id) cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "intf_id is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmcli_log("key.intf_id = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_SUBSCRIBER_TERMINAL_KEY_ID_INTF_ID, &key.intf_id);
+ bcmcli_log(";\n");
+
+ /* init the API struct */
+ BCMBAL_CFG_INIT(&cfg, subscriber_terminal, key);
+ bcmcli_log("BCMBAL_CFG_INIT(&cfg, subscriber_terminal, key);\n");
+
+ /* call API */
+ err = bcmbal_cfg_clear(&cfg.hdr);
+ bcmcli_log("bcmbal_cfg_clear(&cfg.hdr);\n");
+ bcmbal_apicli_print_complete(session, err, NULL);
+ return err;
+}
+
+/******************************************************************************/
+static bcmos_errno bcmbal_cli_subscriber_terminal_stat_get(bcmcli_session *session)
+{
+ bcmcli_cmd_parm *cli_parm;
+ bcmos_errno err;
+ bcmbal_subscriber_terminal_stat stat; /**< declare main API struct */
+ bcmbal_subscriber_terminal_key key = { }; /**< declare key */
+ bcmcli_log("bcmbal_subscriber_terminal_stat stat;\n");
+ bcmcli_log("bcmbal_subscriber_terminal_key key = { };\n");
+ bcmbal_apicli_print_start(session, "bcmbal_stat_get");
+
+ /* build key from CLI parameters */
+ cli_parm = bcmcli_find_named_parm(session, "sub_term_id");
+ if (cli_parm != NULL)
+ {
+ key.sub_term_id = (bcmbal_sub_id) cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "sub_term_id is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmcli_log("key.sub_term_id = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_SUBSCRIBER_TERMINAL_KEY_ID_SUB_TERM_ID, &key.sub_term_id);
+ bcmcli_log(";\n");
+ cli_parm = bcmcli_find_named_parm(session, "intf_id");
+ if (cli_parm != NULL)
+ {
+ key.intf_id = (bcmbal_intf_id) cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "intf_id is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmcli_log("key.intf_id = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_SUBSCRIBER_TERMINAL_KEY_ID_INTF_ID, &key.intf_id);
+ bcmcli_log(";\n");
+
+ /* init the API struct */
+ BCMBAL_STAT_INIT(&stat, subscriber_terminal, key);
+ bcmcli_log("BCMBAL_STAT_INIT(&stat, subscriber_terminal, key);\n");
+
+ /* decode API parameters from CLI */
+ cli_parm = bcmcli_find_named_parm(session, "rx_packets");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_STAT_PROP_GET(&stat, subscriber_terminal, rx_packets);
+ bcmcli_log("BCMBAL_STAT_PROP_GET(&stat, subscriber_terminal, rx_packets);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "rx_bytes");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_STAT_PROP_GET(&stat, subscriber_terminal, rx_bytes);
+ bcmcli_log("BCMBAL_STAT_PROP_GET(&stat, subscriber_terminal, rx_bytes);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "tx_packets");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_STAT_PROP_GET(&stat, subscriber_terminal, tx_packets);
+ bcmcli_log("BCMBAL_STAT_PROP_GET(&stat, subscriber_terminal, tx_packets);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "tx_bytes");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_STAT_PROP_GET(&stat, subscriber_terminal, tx_bytes);
+ bcmcli_log("BCMBAL_STAT_PROP_GET(&stat, subscriber_terminal, tx_bytes);\n");
+ }
+ }
+
+ /* if no properties were requested, include everything */
+ if (!BCMBAL_STAT_PROP_IS_SET(&stat, subscriber_terminal, rx_packets) && !BCMBAL_STAT_PROP_IS_SET(&stat, subscriber_terminal, rx_bytes) && !BCMBAL_STAT_PROP_IS_SET(&stat, subscriber_terminal, tx_packets) && !BCMBAL_STAT_PROP_IS_SET(&stat, subscriber_terminal, tx_bytes))
+ {
+ BCMBAL_STAT_PROP_GET(&stat, subscriber_terminal, all_properties);
+ bcmcli_log("BCMBAL_STAT_PROP_GET(&stat, subscriber_terminal, all_properties);\n");
+ }
+
+ /* call API */
+ err = bcmbal_stat_get(&stat.hdr);
+ bcmcli_log("bcmbal_stat_get(&stat.hdr);\n");
+ if (err == BCM_ERR_OK)
+ {
+ /* print API contents to the CLI */
+ bcmbal_apicli_print_data_start(session);
+ err = bcmbal_apicli_msg_dump(session, &stat.hdr.hdr);
+ }
+
+ bcmbal_apicli_print_complete(session, err, NULL);
+ return err;
+}
+
+/******************************************************************************/
+static bcmos_errno bcmbal_cli_tm_queue_cfg_get(bcmcli_session *session)
+{
+ bcmcli_cmd_parm *cli_parm;
+ bcmos_errno err;
+ bcmbal_tm_queue_cfg cfg; /**< declare main API struct */
+ bcmbal_tm_queue_key key = { }; /**< declare key */
+ bcmcli_log("bcmbal_tm_queue_cfg cfg;\n");
+ bcmcli_log("bcmbal_tm_queue_key key = { };\n");
+ bcmbal_apicli_print_start(session, "bcmbal_cfg_get");
+
+ /* build key from CLI parameters */
+ cli_parm = bcmcli_find_named_parm(session, "sched_id");
+ if (cli_parm != NULL)
+ {
+ key.sched_id = (bcmbal_tm_sched_id) cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "sched_id is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmcli_log("key.sched_id = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_TM_QUEUE, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_TM_QUEUE_KEY_ID_SCHED_ID, &key.sched_id);
+ bcmcli_log(";\n");
+ cli_parm = bcmcli_find_named_parm(session, "sched_dir");
+ if (cli_parm != NULL)
+ {
+ key.sched_dir = (bcmbal_tm_sched_dir) cli_parm->value.enum_val;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "sched_dir is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmcli_log("key.sched_dir = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_TM_QUEUE, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_TM_QUEUE_KEY_ID_SCHED_DIR, &key.sched_dir);
+ bcmcli_log(";\n");
+ cli_parm = bcmcli_find_named_parm(session, "id");
+ if (cli_parm != NULL)
+ {
+ key.id = (bcmbal_tm_queue_id) cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "id is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmcli_log("key.id = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_TM_QUEUE, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_TM_QUEUE_KEY_ID_ID, &key.id);
+ bcmcli_log(";\n");
+
+ /* init the API struct */
+ BCMBAL_CFG_INIT(&cfg, tm_queue, key);
+ bcmcli_log("BCMBAL_CFG_INIT(&cfg, tm_queue, key);\n");
+
+ /* decode API parameters from CLI */
+ cli_parm = bcmcli_find_named_parm(session, "priority");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, tm_queue, priority);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, tm_queue, priority);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "weight");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, tm_queue, weight);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, tm_queue, weight);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "rate");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, tm_queue, rate);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, tm_queue, rate);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "bac");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, tm_queue, bac);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, tm_queue, bac);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "creation_mode");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, tm_queue, creation_mode);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, tm_queue, creation_mode);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "ref_count");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, tm_queue, ref_count);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, tm_queue, ref_count);\n");
+ }
+ }
+
+ /* if no properties were requested, include everything */
+ if (!BCMBAL_CFG_PROP_IS_SET(&cfg, tm_queue, priority) && !BCMBAL_CFG_PROP_IS_SET(&cfg, tm_queue, weight) && !BCMBAL_CFG_PROP_IS_SET(&cfg, tm_queue, rate) && !BCMBAL_CFG_PROP_IS_SET(&cfg, tm_queue, bac) && !BCMBAL_CFG_PROP_IS_SET(&cfg, tm_queue, creation_mode) && !BCMBAL_CFG_PROP_IS_SET(&cfg, tm_queue, ref_count))
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, tm_queue, all_properties);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, tm_queue, all_properties);\n");
+ }
+
+ /* call API */
+ err = bcmbal_cfg_get(&cfg.hdr);
+ bcmcli_log("bcmbal_cfg_get(&cfg.hdr);\n");
+ if (err == BCM_ERR_OK)
+ {
+ /* print API contents to the CLI */
+ bcmbal_apicli_print_data_start(session);
+ err = bcmbal_apicli_msg_dump(session, &cfg.hdr.hdr);
+ }
+
+ bcmbal_apicli_print_complete(session, err, NULL);
+ return err;
+}
+
+/******************************************************************************/
+static bcmos_errno bcmbal_cli_tm_queue_cfg_set(bcmcli_session *session)
+{
+ bcmcli_cmd_parm *cli_parm;
+ bcmos_errno err;
+ bcmbal_tm_queue_cfg cfg; /**< declare main API struct */
+ bcmbal_tm_queue_key key = { }; /**< declare key */
+ bcmcli_log("bcmbal_tm_queue_cfg cfg;\n");
+ bcmcli_log("bcmbal_tm_queue_key key = { };\n");
+ bcmbal_apicli_print_start(session, "bcmbal_cfg_set");
+
+ /* build key from CLI parameters */
+ cli_parm = bcmcli_find_named_parm(session, "sched_id");
+ if (cli_parm != NULL)
+ {
+ key.sched_id = (bcmbal_tm_sched_id) cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "sched_id is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmcli_log("key.sched_id = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_TM_QUEUE, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_TM_QUEUE_KEY_ID_SCHED_ID, &key.sched_id);
+ bcmcli_log(";\n");
+ cli_parm = bcmcli_find_named_parm(session, "sched_dir");
+ if (cli_parm != NULL)
+ {
+ key.sched_dir = (bcmbal_tm_sched_dir) cli_parm->value.enum_val;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "sched_dir is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmcli_log("key.sched_dir = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_TM_QUEUE, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_TM_QUEUE_KEY_ID_SCHED_DIR, &key.sched_dir);
+ bcmcli_log(";\n");
+ cli_parm = bcmcli_find_named_parm(session, "id");
+ if (cli_parm != NULL)
+ {
+ key.id = (bcmbal_tm_queue_id) cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "id is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmcli_log("key.id = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_TM_QUEUE, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_TM_QUEUE_KEY_ID_ID, &key.id);
+ bcmcli_log(";\n");
+
+ /* init the API struct */
+ BCMBAL_CFG_INIT(&cfg, tm_queue, key);
+ bcmcli_log("BCMBAL_CFG_INIT(&cfg, tm_queue, key);\n");
+
+ /* decode API parameters from CLI */
+ cli_parm = bcmcli_find_named_parm(session, "priority");
+ if (cli_parm != NULL)
+ {
+ bcmbal_tm_priority val;
+ val = (bcmbal_tm_priority) cli_parm->value.unumber;
+ BCMBAL_CFG_PROP_SET(&cfg, tm_queue, priority, val);
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, tm_queue, priority, ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_TM_QUEUE, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_TM_QUEUE_CFG_ID_PRIORITY, &val);
+ bcmcli_log(");\n");
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "weight");
+ if (cli_parm != NULL)
+ {
+ bcmbal_tm_weight val;
+ val = (bcmbal_tm_weight) cli_parm->value.unumber;
+ BCMBAL_CFG_PROP_SET(&cfg, tm_queue, weight, val);
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, tm_queue, weight, ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_TM_QUEUE, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_TM_QUEUE_CFG_ID_WEIGHT, &val);
+ bcmcli_log(");\n");
+ }
+
+ cli_parm = bcmcli_find_parm_by_prefix(session, "rate.");
+ if (cli_parm != NULL)
+ {
+ bcmbal_tm_shaping val = { };
+ cli_parm = bcmcli_find_named_parm(session, "rate.sbr");
+ if (cli_parm != NULL)
+ {
+ val.sbr = cli_parm->value.unumber;
+ val.presence_mask = val.presence_mask | BCMBAL_TM_SHAPING_ID_SBR;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "rate.pbr");
+ if (cli_parm != NULL)
+ {
+ val.pbr = cli_parm->value.unumber;
+ val.presence_mask = val.presence_mask | BCMBAL_TM_SHAPING_ID_PBR;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "rate.burst");
+ if (cli_parm != NULL)
+ {
+ val.burst = cli_parm->value.unumber;
+ val.presence_mask = val.presence_mask | BCMBAL_TM_SHAPING_ID_BURST;
+ }
+
+ BCMBAL_CFG_PROP_SET(&cfg, tm_queue, rate, val);
+ bcmcli_log("{\n");
+ bcmcli_log("bcmbal_tm_shaping val = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_TM_QUEUE, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_TM_QUEUE_CFG_ID_RATE, &val);
+ bcmcli_log(";\n");
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, tm_queue, rate, val);\n");
+ bcmcli_log("}\n");
+ }
+
+ cli_parm = bcmcli_find_parm_by_prefix(session, "bac.");
+ if (cli_parm != NULL)
+ {
+ bcmbal_tm_bac val = { };
+ cli_parm = bcmcli_find_named_parm(session, "bac.type");
+ if (cli_parm != NULL)
+ {
+ val.type = (bcmbal_tm_bac_type) cli_parm->value.enum_val;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "bac.type is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ switch (val.type)
+ {
+ case BCMBAL_TM_BAC_TYPE_TAILDROP:
+ cli_parm = bcmcli_find_named_parm(session, "bac.max_size");
+ if (cli_parm != NULL)
+ {
+ val.u.taildrop.max_size = cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "bac.max_size is not set\n");
+ return BCM_ERR_PARM;
+ }
+ break;
+ case BCMBAL_TM_BAC_TYPE_RED:
+ cli_parm = bcmcli_find_parm_by_prefix(session, "bac.red.");
+ if (cli_parm != NULL)
+ {
+ cli_parm = bcmcli_find_named_parm(session, "bac.red.min_threshold");
+ if (cli_parm != NULL)
+ {
+ val.u.red.red.min_threshold = (bcmbal_percent) cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "bac.red.min_threshold is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "bac.red.max_threshold");
+ if (cli_parm != NULL)
+ {
+ val.u.red.red.max_threshold = (bcmbal_percent) cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "bac.red.max_threshold is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "bac.red.max_probability");
+ if (cli_parm != NULL)
+ {
+ val.u.red.red.max_probability = (bcmbal_percent) cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "bac.red.max_probability is not set\n");
+ return BCM_ERR_PARM;
+ }
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "bac.red is not set\n");
+ return BCM_ERR_PARM;
+ }
+ break;
+ case BCMBAL_TM_BAC_TYPE_WRED:
+ cli_parm = bcmcli_find_parm_by_prefix(session, "bac.green.");
+ if (cli_parm != NULL)
+ {
+ cli_parm = bcmcli_find_named_parm(session, "bac.green.min_threshold");
+ if (cli_parm != NULL)
+ {
+ val.u.wred.green.min_threshold = (bcmbal_percent) cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "bac.green.min_threshold is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "bac.green.max_threshold");
+ if (cli_parm != NULL)
+ {
+ val.u.wred.green.max_threshold = (bcmbal_percent) cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "bac.green.max_threshold is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "bac.green.max_probability");
+ if (cli_parm != NULL)
+ {
+ val.u.wred.green.max_probability = (bcmbal_percent) cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "bac.green.max_probability is not set\n");
+ return BCM_ERR_PARM;
+ }
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "bac.green is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ cli_parm = bcmcli_find_parm_by_prefix(session, "bac.yellow.");
+ if (cli_parm != NULL)
+ {
+ cli_parm = bcmcli_find_named_parm(session, "bac.yellow.min_threshold");
+ if (cli_parm != NULL)
+ {
+ val.u.wred.yellow.min_threshold = (bcmbal_percent) cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "bac.yellow.min_threshold is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "bac.yellow.max_threshold");
+ if (cli_parm != NULL)
+ {
+ val.u.wred.yellow.max_threshold = (bcmbal_percent) cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "bac.yellow.max_threshold is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "bac.yellow.max_probability");
+ if (cli_parm != NULL)
+ {
+ val.u.wred.yellow.max_probability = (bcmbal_percent) cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "bac.yellow.max_probability is not set\n");
+ return BCM_ERR_PARM;
+ }
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "bac.yellow is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ cli_parm = bcmcli_find_parm_by_prefix(session, "bac.red.");
+ if (cli_parm != NULL)
+ {
+ cli_parm = bcmcli_find_named_parm(session, "bac.red.min_threshold");
+ if (cli_parm != NULL)
+ {
+ val.u.wred.red.min_threshold = (bcmbal_percent) cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "bac.red.min_threshold is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "bac.red.max_threshold");
+ if (cli_parm != NULL)
+ {
+ val.u.wred.red.max_threshold = (bcmbal_percent) cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "bac.red.max_threshold is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "bac.red.max_probability");
+ if (cli_parm != NULL)
+ {
+ val.u.wred.red.max_probability = (bcmbal_percent) cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "bac.red.max_probability is not set\n");
+ return BCM_ERR_PARM;
+ }
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "bac.red is not set\n");
+ return BCM_ERR_PARM;
+ }
+ break;
+ default:
+ bcmbal_apicli_print_complete(session, BCM_ERR_RANGE, "\n");
+ return BCM_ERR_RANGE;
+ }
+
+ BCMBAL_CFG_PROP_SET(&cfg, tm_queue, bac, val);
+ bcmcli_log("{\n");
+ bcmcli_log("bcmbal_tm_bac val = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_TM_QUEUE, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_TM_QUEUE_CFG_ID_BAC, &val);
+ bcmcli_log(";\n");
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, tm_queue, bac, val);\n");
+ bcmcli_log("}\n");
+ }
+
+ /* call API */
+ err = bcmbal_cfg_set(&cfg.hdr);
+ bcmcli_log("bcmbal_cfg_set(&cfg.hdr);\n");
+ bcmbal_apicli_print_complete(session, err, NULL);
+ return err;
+}
+
+/******************************************************************************/
+static bcmos_errno bcmbal_cli_tm_queue_cfg_clear(bcmcli_session *session)
+{
+ bcmcli_cmd_parm *cli_parm;
+ bcmos_errno err;
+ bcmbal_tm_queue_cfg cfg; /**< declare main API struct */
+ bcmbal_tm_queue_key key = { }; /**< declare key */
+ bcmcli_log("bcmbal_tm_queue_cfg cfg;\n");
+ bcmcli_log("bcmbal_tm_queue_key key = { };\n");
+ bcmbal_apicli_print_start(session, "bcmbal_cfg_clear");
+
+ /* build key from CLI parameters */
+ cli_parm = bcmcli_find_named_parm(session, "sched_id");
+ if (cli_parm != NULL)
+ {
+ key.sched_id = (bcmbal_tm_sched_id) cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "sched_id is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmcli_log("key.sched_id = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_TM_QUEUE, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_TM_QUEUE_KEY_ID_SCHED_ID, &key.sched_id);
+ bcmcli_log(";\n");
+ cli_parm = bcmcli_find_named_parm(session, "sched_dir");
+ if (cli_parm != NULL)
+ {
+ key.sched_dir = (bcmbal_tm_sched_dir) cli_parm->value.enum_val;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "sched_dir is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmcli_log("key.sched_dir = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_TM_QUEUE, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_TM_QUEUE_KEY_ID_SCHED_DIR, &key.sched_dir);
+ bcmcli_log(";\n");
+ cli_parm = bcmcli_find_named_parm(session, "id");
+ if (cli_parm != NULL)
+ {
+ key.id = (bcmbal_tm_queue_id) cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "id is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmcli_log("key.id = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_TM_QUEUE, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_TM_QUEUE_KEY_ID_ID, &key.id);
+ bcmcli_log(";\n");
+
+ /* init the API struct */
+ BCMBAL_CFG_INIT(&cfg, tm_queue, key);
+ bcmcli_log("BCMBAL_CFG_INIT(&cfg, tm_queue, key);\n");
+
+ /* call API */
+ err = bcmbal_cfg_clear(&cfg.hdr);
+ bcmcli_log("bcmbal_cfg_clear(&cfg.hdr);\n");
+ bcmbal_apicli_print_complete(session, err, NULL);
+ return err;
+}
+
+/******************************************************************************/
+static bcmos_errno bcmbal_cli_tm_queue_stat_get(bcmcli_session *session)
+{
+ bcmcli_cmd_parm *cli_parm;
+ bcmos_errno err;
+ bcmbal_tm_queue_stat stat; /**< declare main API struct */
+ bcmbal_tm_queue_key key = { }; /**< declare key */
+ bcmcli_log("bcmbal_tm_queue_stat stat;\n");
+ bcmcli_log("bcmbal_tm_queue_key key = { };\n");
+ bcmbal_apicli_print_start(session, "bcmbal_stat_get");
+
+ /* build key from CLI parameters */
+ cli_parm = bcmcli_find_named_parm(session, "sched_id");
+ if (cli_parm != NULL)
+ {
+ key.sched_id = (bcmbal_tm_sched_id) cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "sched_id is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmcli_log("key.sched_id = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_TM_QUEUE, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_TM_QUEUE_KEY_ID_SCHED_ID, &key.sched_id);
+ bcmcli_log(";\n");
+ cli_parm = bcmcli_find_named_parm(session, "sched_dir");
+ if (cli_parm != NULL)
+ {
+ key.sched_dir = (bcmbal_tm_sched_dir) cli_parm->value.enum_val;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "sched_dir is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmcli_log("key.sched_dir = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_TM_QUEUE, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_TM_QUEUE_KEY_ID_SCHED_DIR, &key.sched_dir);
+ bcmcli_log(";\n");
+ cli_parm = bcmcli_find_named_parm(session, "id");
+ if (cli_parm != NULL)
+ {
+ key.id = (bcmbal_tm_queue_id) cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "id is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmcli_log("key.id = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_TM_QUEUE, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_TM_QUEUE_KEY_ID_ID, &key.id);
+ bcmcli_log(";\n");
+
+ /* init the API struct */
+ BCMBAL_STAT_INIT(&stat, tm_queue, key);
+ bcmcli_log("BCMBAL_STAT_INIT(&stat, tm_queue, key);\n");
+
+ /* decode API parameters from CLI */
+ cli_parm = bcmcli_find_named_parm(session, "packets_ok");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_STAT_PROP_GET(&stat, tm_queue, packets_ok);
+ bcmcli_log("BCMBAL_STAT_PROP_GET(&stat, tm_queue, packets_ok);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "bytes_ok");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_STAT_PROP_GET(&stat, tm_queue, bytes_ok);
+ bcmcli_log("BCMBAL_STAT_PROP_GET(&stat, tm_queue, bytes_ok);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "packets_discarded");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_STAT_PROP_GET(&stat, tm_queue, packets_discarded);
+ bcmcli_log("BCMBAL_STAT_PROP_GET(&stat, tm_queue, packets_discarded);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "bytes_discarded");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_STAT_PROP_GET(&stat, tm_queue, bytes_discarded);
+ bcmcli_log("BCMBAL_STAT_PROP_GET(&stat, tm_queue, bytes_discarded);\n");
+ }
+ }
+
+ /* if no properties were requested, include everything */
+ if (!BCMBAL_STAT_PROP_IS_SET(&stat, tm_queue, packets_ok) && !BCMBAL_STAT_PROP_IS_SET(&stat, tm_queue, bytes_ok) && !BCMBAL_STAT_PROP_IS_SET(&stat, tm_queue, packets_discarded) && !BCMBAL_STAT_PROP_IS_SET(&stat, tm_queue, bytes_discarded))
+ {
+ BCMBAL_STAT_PROP_GET(&stat, tm_queue, all_properties);
+ bcmcli_log("BCMBAL_STAT_PROP_GET(&stat, tm_queue, all_properties);\n");
+ }
+
+ /* call API */
+ err = bcmbal_stat_get(&stat.hdr);
+ bcmcli_log("bcmbal_stat_get(&stat.hdr);\n");
+ if (err == BCM_ERR_OK)
+ {
+ /* print API contents to the CLI */
+ bcmbal_apicli_print_data_start(session);
+ err = bcmbal_apicli_msg_dump(session, &stat.hdr.hdr);
+ }
+
+ bcmbal_apicli_print_complete(session, err, NULL);
+ return err;
+}
+
+/******************************************************************************/
+static bcmos_errno bcmbal_cli_tm_sched_cfg_get(bcmcli_session *session, bcmbal_apicli_byte_pool *byte_pool)
+{
+ bcmcli_cmd_parm *cli_parm;
+ bcmos_errno err;
+ bcmbal_tm_sched_cfg cfg; /**< declare main API struct */
+ bcmbal_tm_sched_key key = { }; /**< declare key */
+ uint8_t *list_mem; /**< declare memory buffer for variable-sized lists */
+ bcmcli_log("bcmbal_tm_sched_cfg cfg;\n");
+ bcmcli_log("bcmbal_tm_sched_key key = { };\n");
+ bcmcli_log("uint8_t* list_mem;\n");
+ bcmbal_apicli_print_start(session, "bcmbal_cfg_get");
+
+ /* build key from CLI parameters */
+ cli_parm = bcmcli_find_named_parm(session, "dir");
+ if (cli_parm != NULL)
+ {
+ key.dir = (bcmbal_tm_sched_dir) cli_parm->value.enum_val;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "dir is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmcli_log("key.dir = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_TM_SCHED, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_TM_SCHED_KEY_ID_DIR, &key.dir);
+ bcmcli_log(";\n");
+ cli_parm = bcmcli_find_named_parm(session, "id");
+ if (cli_parm != NULL)
+ {
+ key.id = (bcmbal_tm_sched_id) cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "id is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmcli_log("key.id = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_TM_SCHED, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_TM_SCHED_KEY_ID_ID, &key.id);
+ bcmcli_log(";\n");
+
+ /* init the API struct */
+ BCMBAL_CFG_INIT(&cfg, tm_sched, key);
+ bcmcli_log("BCMBAL_CFG_INIT(&cfg, tm_sched, key);\n");
+
+ /* decode API parameters from CLI */
+ cli_parm = bcmcli_find_named_parm(session, "owner");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, tm_sched, owner);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, tm_sched, owner);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "sched_type");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, tm_sched, sched_type);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, tm_sched, sched_type);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "sched_parent");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, tm_sched, sched_parent);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, tm_sched, sched_parent);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "sched_child_type");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, tm_sched, sched_child_type);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, tm_sched, sched_child_type);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "rate");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, tm_sched, rate);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, tm_sched, rate);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "tcont_sla");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, tm_sched, tcont_sla);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, tm_sched, tcont_sla);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "creation_mode");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, tm_sched, creation_mode);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, tm_sched, creation_mode);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "queues");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, tm_sched, queues);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, tm_sched, queues);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "sub_scheds");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, tm_sched, sub_scheds);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, tm_sched, sub_scheds);\n");
+ }
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "num_priorities");
+ if (cli_parm != NULL)
+ {
+ if (cli_parm->value.number)
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, tm_sched, num_priorities);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, tm_sched, num_priorities);\n");
+ }
+ }
+
+ /* if no properties were requested, include everything */
+ if (!BCMBAL_CFG_PROP_IS_SET(&cfg, tm_sched, owner) && !BCMBAL_CFG_PROP_IS_SET(&cfg, tm_sched, sched_type) && !BCMBAL_CFG_PROP_IS_SET(&cfg, tm_sched, sched_parent) && !BCMBAL_CFG_PROP_IS_SET(&cfg, tm_sched, sched_child_type) && !BCMBAL_CFG_PROP_IS_SET(&cfg, tm_sched, rate) && !BCMBAL_CFG_PROP_IS_SET(&cfg, tm_sched, tcont_sla) && !BCMBAL_CFG_PROP_IS_SET(&cfg, tm_sched, creation_mode) && !BCMBAL_CFG_PROP_IS_SET(&cfg, tm_sched, queues) && !BCMBAL_CFG_PROP_IS_SET(&cfg, tm_sched, sub_scheds) && !BCMBAL_CFG_PROP_IS_SET(&cfg, tm_sched, num_priorities))
+ {
+ BCMBAL_CFG_PROP_GET(&cfg, tm_sched, all_properties);
+ bcmcli_log("BCMBAL_CFG_PROP_GET(&cfg, tm_sched, all_properties);\n");
+ }
+
+ /* set memory to use for variable-sized lists */
+ list_mem = bcmbal_apicli_byte_pool_calloc(byte_pool, BCMBAL_APICLI_DYNAMIC_LIST_BUFFER_SIZE);
+ if (list_mem == NULL)
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_NOMEM, "\n");
+ return BCM_ERR_NOMEM;
+ }
+
+ bcmcli_log("list_mem = bcmos_calloc(BCMBAL_APICLI_DYNAMIC_LIST_BUFFER_SIZE);\n");
+ BCMBAL_CFG_LIST_BUF_SET(&cfg, tm_sched, list_mem, BCMBAL_APICLI_DYNAMIC_LIST_BUFFER_SIZE);
+ bcmcli_log("BCMBAL_CFG_LIST_BUF_SET(&cfg, tm_sched, list_mem, BCMBAL_APICLI_DYNAMIC_LIST_BUFFER_SIZE);\n");
+
+ /* call API */
+ err = bcmbal_cfg_get(&cfg.hdr);
+ bcmcli_log("bcmbal_cfg_get(&cfg.hdr);\n");
+ if (err == BCM_ERR_OK)
+ {
+ /* print API contents to the CLI */
+ bcmbal_apicli_print_data_start(session);
+ err = bcmbal_apicli_msg_dump(session, &cfg.hdr.hdr);
+ }
+
+ bcmbal_apicli_print_complete(session, err, NULL);
+ return err;
+}
+
+/******************************************************************************/
+static bcmos_errno bcmbal_cli_tm_sched_cfg_set(bcmcli_session *session, bcmbal_apicli_byte_pool *byte_pool)
+{
+ bcmcli_cmd_parm *cli_parm;
+ bcmos_errno err;
+ bcmbal_tm_sched_cfg cfg; /**< declare main API struct */
+ bcmbal_tm_sched_key key = { }; /**< declare key */
+ bcmcli_log("bcmbal_tm_sched_cfg cfg;\n");
+ bcmcli_log("bcmbal_tm_sched_key key = { };\n");
+ bcmbal_apicli_print_start(session, "bcmbal_cfg_set");
+
+ /* build key from CLI parameters */
+ cli_parm = bcmcli_find_named_parm(session, "dir");
+ if (cli_parm != NULL)
+ {
+ key.dir = (bcmbal_tm_sched_dir) cli_parm->value.enum_val;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "dir is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmcli_log("key.dir = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_TM_SCHED, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_TM_SCHED_KEY_ID_DIR, &key.dir);
+ bcmcli_log(";\n");
+ cli_parm = bcmcli_find_named_parm(session, "id");
+ if (cli_parm != NULL)
+ {
+ key.id = (bcmbal_tm_sched_id) cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "id is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmcli_log("key.id = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_TM_SCHED, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_TM_SCHED_KEY_ID_ID, &key.id);
+ bcmcli_log(";\n");
+
+ /* init the API struct */
+ BCMBAL_CFG_INIT(&cfg, tm_sched, key);
+ bcmcli_log("BCMBAL_CFG_INIT(&cfg, tm_sched, key);\n");
+
+ /* decode API parameters from CLI */
+ cli_parm = bcmcli_find_parm_by_prefix(session, "owner.");
+ if (cli_parm != NULL)
+ {
+ bcmbal_tm_sched_owner val = { };
+ cli_parm = bcmcli_find_named_parm(session, "owner.type");
+ if (cli_parm != NULL)
+ {
+ val.type = (bcmbal_tm_sched_owner_type) cli_parm->value.enum_val;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "owner.type is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ switch (val.type)
+ {
+ case BCMBAL_TM_SCHED_OWNER_TYPE_INTERFACE:
+ cli_parm = bcmcli_find_named_parm(session, "owner.intf_type");
+ if (cli_parm != NULL)
+ {
+ val.u.interface.intf_type = (bcmbal_intf_type) cli_parm->value.enum_val;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "owner.intf_type is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "owner.intf_id");
+ if (cli_parm != NULL)
+ {
+ val.u.interface.intf_id = (bcmbal_intf_id) cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "owner.intf_id is not set\n");
+ return BCM_ERR_PARM;
+ }
+ break;
+ case BCMBAL_TM_SCHED_OWNER_TYPE_SUB_TERM:
+ cli_parm = bcmcli_find_named_parm(session, "owner.intf_id");
+ if (cli_parm != NULL)
+ {
+ val.u.sub_term.intf_id = (bcmbal_intf_id) cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "owner.intf_id is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "owner.sub_term_id");
+ if (cli_parm != NULL)
+ {
+ val.u.sub_term.sub_term_id = (bcmbal_sub_id) cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "owner.sub_term_id is not set\n");
+ return BCM_ERR_PARM;
+ }
+ break;
+ case BCMBAL_TM_SCHED_OWNER_TYPE_AGG_PORT:
+ cli_parm = bcmcli_find_named_parm(session, "owner.intf_id");
+ if (cli_parm != NULL)
+ {
+ val.u.agg_port.intf_id = cli_parm->value.unumber;
+ val.u.agg_port.presence_mask = val.u.agg_port.presence_mask | BCMBAL_TM_SCHED_OWNER_AGG_PORT_ID_INTF_ID;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "owner.sub_term_id");
+ if (cli_parm != NULL)
+ {
+ val.u.agg_port.sub_term_id = (bcmbal_sub_id) cli_parm->value.unumber;
+ val.u.agg_port.presence_mask = val.u.agg_port.presence_mask | BCMBAL_TM_SCHED_OWNER_AGG_PORT_ID_SUB_TERM_ID;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "owner.agg_port_id");
+ if (cli_parm != NULL)
+ {
+ val.u.agg_port.agg_port_id = (bcmbal_aggregation_port_id) cli_parm->value.unumber;
+ val.u.agg_port.presence_mask = val.u.agg_port.presence_mask | BCMBAL_TM_SCHED_OWNER_AGG_PORT_ID_AGG_PORT_ID;
+ }
+ break;
+ case BCMBAL_TM_SCHED_OWNER_TYPE_UNI:
+ cli_parm = bcmcli_find_named_parm(session, "owner.intf_id");
+ if (cli_parm != NULL)
+ {
+ val.u.uni.intf_id = cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "owner.intf_id is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "owner.sub_term_id");
+ if (cli_parm != NULL)
+ {
+ val.u.uni.sub_term_id = (bcmbal_sub_id) cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "owner.sub_term_id is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "owner.idx");
+ if (cli_parm != NULL)
+ {
+ val.u.uni.idx = cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "owner.idx is not set\n");
+ return BCM_ERR_PARM;
+ }
+ break;
+ case BCMBAL_TM_SCHED_OWNER_TYPE_VIRTUAL:
+ cli_parm = bcmcli_find_named_parm(session, "owner.idx");
+ if (cli_parm != NULL)
+ {
+ val.u.virtual.idx = cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "owner.idx is not set\n");
+ return BCM_ERR_PARM;
+ }
+ break;
+ default:
+ bcmbal_apicli_print_complete(session, BCM_ERR_RANGE, "\n");
+ return BCM_ERR_RANGE;
+ }
+
+ BCMBAL_CFG_PROP_SET(&cfg, tm_sched, owner, val);
+ bcmcli_log("{\n");
+ bcmcli_log("bcmbal_tm_sched_owner val = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_TM_SCHED, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_TM_SCHED_CFG_ID_OWNER, &val);
+ bcmcli_log(";\n");
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, tm_sched, owner, val);\n");
+ bcmcli_log("}\n");
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "sched_type");
+ if (cli_parm != NULL)
+ {
+ bcmbal_tm_sched_type val;
+ val = (bcmbal_tm_sched_type) cli_parm->value.enum_val;
+ BCMBAL_CFG_PROP_SET(&cfg, tm_sched, sched_type, val);
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, tm_sched, sched_type, ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_TM_SCHED, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_TM_SCHED_CFG_ID_SCHED_TYPE, &val);
+ bcmcli_log(");\n");
+ }
+
+ cli_parm = bcmcli_find_parm_by_prefix(session, "sched_parent.");
+ if (cli_parm != NULL)
+ {
+ bcmbal_tm_sched_parent val = { };
+ cli_parm = bcmcli_find_named_parm(session, "sched_parent.sched_id");
+ if (cli_parm != NULL)
+ {
+ val.sched_id = (bcmbal_tm_sched_id) cli_parm->value.unumber;
+ val.presence_mask = val.presence_mask | BCMBAL_TM_SCHED_PARENT_ID_SCHED_ID;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "sched_parent.priority");
+ if (cli_parm != NULL)
+ {
+ val.priority = (bcmbal_tm_priority) cli_parm->value.unumber;
+ val.presence_mask = val.presence_mask | BCMBAL_TM_SCHED_PARENT_ID_PRIORITY;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "sched_parent.weight");
+ if (cli_parm != NULL)
+ {
+ val.weight = (bcmbal_tm_weight) cli_parm->value.unumber;
+ val.presence_mask = val.presence_mask | BCMBAL_TM_SCHED_PARENT_ID_WEIGHT;
+ }
+
+ BCMBAL_CFG_PROP_SET(&cfg, tm_sched, sched_parent, val);
+ bcmcli_log("{\n");
+ bcmcli_log("bcmbal_tm_sched_parent val = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_TM_SCHED, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_TM_SCHED_CFG_ID_SCHED_PARENT, &val);
+ bcmcli_log(";\n");
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, tm_sched, sched_parent, val);\n");
+ bcmcli_log("}\n");
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "sched_child_type");
+ if (cli_parm != NULL)
+ {
+ bcmbal_tm_sched_child_type val;
+ val = (bcmbal_tm_sched_child_type) cli_parm->value.enum_val;
+ BCMBAL_CFG_PROP_SET(&cfg, tm_sched, sched_child_type, val);
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, tm_sched, sched_child_type, ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_TM_SCHED, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_TM_SCHED_CFG_ID_SCHED_CHILD_TYPE, &val);
+ bcmcli_log(");\n");
+ }
+
+ cli_parm = bcmcli_find_parm_by_prefix(session, "rate.");
+ if (cli_parm != NULL)
+ {
+ bcmbal_tm_shaping val = { };
+ cli_parm = bcmcli_find_named_parm(session, "rate.sbr");
+ if (cli_parm != NULL)
+ {
+ val.sbr = cli_parm->value.unumber;
+ val.presence_mask = val.presence_mask | BCMBAL_TM_SHAPING_ID_SBR;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "rate.pbr");
+ if (cli_parm != NULL)
+ {
+ val.pbr = cli_parm->value.unumber;
+ val.presence_mask = val.presence_mask | BCMBAL_TM_SHAPING_ID_PBR;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "rate.burst");
+ if (cli_parm != NULL)
+ {
+ val.burst = cli_parm->value.unumber;
+ val.presence_mask = val.presence_mask | BCMBAL_TM_SHAPING_ID_BURST;
+ }
+
+ BCMBAL_CFG_PROP_SET(&cfg, tm_sched, rate, val);
+ bcmcli_log("{\n");
+ bcmcli_log("bcmbal_tm_shaping val = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_TM_SCHED, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_TM_SCHED_CFG_ID_RATE, &val);
+ bcmcli_log(";\n");
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, tm_sched, rate, val);\n");
+ bcmcli_log("}\n");
+ }
+
+ cli_parm = bcmcli_find_parm_by_prefix(session, "tcont_sla.");
+ if (cli_parm != NULL)
+ {
+ bcmbal_tm_tcont_sla val = { };
+ cli_parm = bcmcli_find_named_parm(session, "tcont_sla.extra_bw_elig");
+ if (cli_parm != NULL)
+ {
+ val.extra_bw_elig = (bcmbal_extra_bw_eligibility_type) cli_parm->value.enum_val;
+ val.presence_mask = val.presence_mask | BCMBAL_TM_TCONT_SLA_ID_EXTRA_BW_ELIG;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "tcont_sla.nrt_cbr");
+ if (cli_parm != NULL)
+ {
+ val.nrt_cbr = cli_parm->value.unumber;
+ val.presence_mask = val.presence_mask | BCMBAL_TM_TCONT_SLA_ID_NRT_CBR;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "tcont_sla.rt_cbr");
+ if (cli_parm != NULL)
+ {
+ val.rt_cbr = cli_parm->value.unumber;
+ val.presence_mask = val.presence_mask | BCMBAL_TM_TCONT_SLA_ID_RT_CBR;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "tcont_sla.rt_profile");
+ if (cli_parm != NULL)
+ {
+ val.rt_profile = cli_parm->value.unumber;
+ val.presence_mask = val.presence_mask | BCMBAL_TM_TCONT_SLA_ID_RT_PROFILE;
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "tcont_sla.nrt_profile");
+ if (cli_parm != NULL)
+ {
+ val.nrt_profile = cli_parm->value.unumber;
+ val.presence_mask = val.presence_mask | BCMBAL_TM_TCONT_SLA_ID_NRT_PROFILE;
+ }
+
+ BCMBAL_CFG_PROP_SET(&cfg, tm_sched, tcont_sla, val);
+ bcmcli_log("{\n");
+ bcmcli_log("bcmbal_tm_tcont_sla val = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_TM_SCHED, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_TM_SCHED_CFG_ID_TCONT_SLA, &val);
+ bcmcli_log(";\n");
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, tm_sched, tcont_sla, val);\n");
+ bcmcli_log("}\n");
+ }
+
+ cli_parm = bcmcli_find_named_parm(session, "num_priorities");
+ if (cli_parm != NULL)
+ {
+ uint8_t val;
+ val = cli_parm->value.unumber;
+ BCMBAL_CFG_PROP_SET(&cfg, tm_sched, num_priorities, val);
+ bcmcli_log("BCMBAL_CFG_PROP_SET(&cfg, tm_sched, num_priorities, ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_TM_SCHED, BCMBAL_MGT_GROUP_CFG, 0, BCMBAL_TM_SCHED_CFG_ID_NUM_PRIORITIES, &val);
+ bcmcli_log(");\n");
+ }
+
+ /* call API */
+ err = bcmbal_cfg_set(&cfg.hdr);
+ bcmcli_log("bcmbal_cfg_set(&cfg.hdr);\n");
+ bcmbal_apicli_print_complete(session, err, NULL);
+ return err;
+}
+
+/******************************************************************************/
+static bcmos_errno bcmbal_cli_tm_sched_cfg_clear(bcmcli_session *session)
+{
+ bcmcli_cmd_parm *cli_parm;
+ bcmos_errno err;
+ bcmbal_tm_sched_cfg cfg; /**< declare main API struct */
+ bcmbal_tm_sched_key key = { }; /**< declare key */
+ bcmcli_log("bcmbal_tm_sched_cfg cfg;\n");
+ bcmcli_log("bcmbal_tm_sched_key key = { };\n");
+ bcmbal_apicli_print_start(session, "bcmbal_cfg_clear");
+
+ /* build key from CLI parameters */
+ cli_parm = bcmcli_find_named_parm(session, "dir");
+ if (cli_parm != NULL)
+ {
+ key.dir = (bcmbal_tm_sched_dir) cli_parm->value.enum_val;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "dir is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmcli_log("key.dir = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_TM_SCHED, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_TM_SCHED_KEY_ID_DIR, &key.dir);
+ bcmcli_log(";\n");
+ cli_parm = bcmcli_find_named_parm(session, "id");
+ if (cli_parm != NULL)
+ {
+ key.id = (bcmbal_tm_sched_id) cli_parm->value.unumber;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "id is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ bcmcli_log("key.id = ");
+ bcmbal_apicli_log_prop_val(BCMBAL_OBJ_ID_TM_SCHED, BCMBAL_MGT_GROUP_KEY, 0, BCMBAL_TM_SCHED_KEY_ID_ID, &key.id);
+ bcmcli_log(";\n");
+
+ /* init the API struct */
+ BCMBAL_CFG_INIT(&cfg, tm_sched, key);
+ bcmcli_log("BCMBAL_CFG_INIT(&cfg, tm_sched, key);\n");
+
+ /* call API */
+ err = bcmbal_cfg_clear(&cfg.hdr);
+ bcmcli_log("bcmbal_cfg_clear(&cfg.hdr);\n");
+ bcmbal_apicli_print_complete(session, err, NULL);
+ return err;
+}
+
+/******************************************************************************/
+static bcmos_errno bcmbal_apicli_root(bcmbal_mgt_group group_type, bcmbal_obj_msg_type msg_type, bcmcli_session *session, bcmbal_apicli_byte_pool *byte_pool)
+{
+ bcmcli_cmd_parm *cli_parm;
+ bcmbal_obj_id obj_id;
+ cli_parm = bcmcli_find_named_parm(session, "object");
+ if (cli_parm != NULL)
+ {
+ obj_id = cli_parm->value.number;
+ }
+ else
+ {
+ bcmbal_apicli_print_complete(session, BCM_ERR_PARM, "object is not set\n");
+ return BCM_ERR_PARM;
+ }
+
+ switch (obj_id)
+ {
+ case BCMBAL_OBJ_ID_ACCESS_TERMINAL:
+ switch (group_type)
+ {
+ case BCMBAL_MGT_GROUP_CFG:
+ switch (msg_type)
+ {
+ case BCMBAL_OBJ_MSG_TYPE_GET:
+ return bcmbal_cli_access_terminal_cfg_get(session);
+ case BCMBAL_OBJ_MSG_TYPE_SET:
+ return bcmbal_cli_access_terminal_cfg_set(session);
+ case BCMBAL_OBJ_MSG_TYPE_CLEAR:
+ return bcmbal_cli_access_terminal_cfg_clear(session);
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_OBJ_ID_FLOW:
+ switch (group_type)
+ {
+ case BCMBAL_MGT_GROUP_CFG:
+ switch (msg_type)
+ {
+ case BCMBAL_OBJ_MSG_TYPE_GET:
+ return bcmbal_cli_flow_cfg_get(session);
+ case BCMBAL_OBJ_MSG_TYPE_SET:
+ return bcmbal_cli_flow_cfg_set(session);
+ case BCMBAL_OBJ_MSG_TYPE_CLEAR:
+ return bcmbal_cli_flow_cfg_clear(session);
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_MGT_GROUP_STAT:
+ return bcmbal_cli_flow_stat_get(session);
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_OBJ_ID_GROUP:
+ switch (group_type)
+ {
+ case BCMBAL_MGT_GROUP_CFG:
+ switch (msg_type)
+ {
+ case BCMBAL_OBJ_MSG_TYPE_GET:
+ return bcmbal_cli_group_cfg_get(session, byte_pool);
+ case BCMBAL_OBJ_MSG_TYPE_SET:
+ return bcmbal_cli_group_cfg_set(session, byte_pool);
+ case BCMBAL_OBJ_MSG_TYPE_CLEAR:
+ return bcmbal_cli_group_cfg_clear(session);
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_OBJ_ID_INTERFACE:
+ switch (group_type)
+ {
+ case BCMBAL_MGT_GROUP_CFG:
+ switch (msg_type)
+ {
+ case BCMBAL_OBJ_MSG_TYPE_GET:
+ return bcmbal_cli_interface_cfg_get(session, byte_pool);
+ case BCMBAL_OBJ_MSG_TYPE_SET:
+ return bcmbal_cli_interface_cfg_set(session, byte_pool);
+ case BCMBAL_OBJ_MSG_TYPE_CLEAR:
+ return bcmbal_cli_interface_cfg_clear(session);
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_MGT_GROUP_STAT:
+ return bcmbal_cli_interface_stat_get(session);
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_OBJ_ID_PACKET:
+ switch (group_type)
+ {
+ case BCMBAL_MGT_GROUP_CFG:
+ switch (msg_type)
+ {
+ case BCMBAL_OBJ_MSG_TYPE_GET:
+ return bcmbal_cli_packet_cfg_get(session, byte_pool);
+ case BCMBAL_OBJ_MSG_TYPE_SET:
+ return bcmbal_cli_packet_cfg_set(session, byte_pool);
+ case BCMBAL_OBJ_MSG_TYPE_CLEAR:
+ return bcmbal_cli_packet_cfg_clear(session);
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL:
+ switch (group_type)
+ {
+ case BCMBAL_MGT_GROUP_CFG:
+ switch (msg_type)
+ {
+ case BCMBAL_OBJ_MSG_TYPE_GET:
+ return bcmbal_cli_subscriber_terminal_cfg_get(session, byte_pool);
+ case BCMBAL_OBJ_MSG_TYPE_SET:
+ return bcmbal_cli_subscriber_terminal_cfg_set(session, byte_pool);
+ case BCMBAL_OBJ_MSG_TYPE_CLEAR:
+ return bcmbal_cli_subscriber_terminal_cfg_clear(session);
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_MGT_GROUP_STAT:
+ return bcmbal_cli_subscriber_terminal_stat_get(session);
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_OBJ_ID_TM_QUEUE:
+ switch (group_type)
+ {
+ case BCMBAL_MGT_GROUP_CFG:
+ switch (msg_type)
+ {
+ case BCMBAL_OBJ_MSG_TYPE_GET:
+ return bcmbal_cli_tm_queue_cfg_get(session);
+ case BCMBAL_OBJ_MSG_TYPE_SET:
+ return bcmbal_cli_tm_queue_cfg_set(session);
+ case BCMBAL_OBJ_MSG_TYPE_CLEAR:
+ return bcmbal_cli_tm_queue_cfg_clear(session);
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_MGT_GROUP_STAT:
+ return bcmbal_cli_tm_queue_stat_get(session);
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_OBJ_ID_TM_SCHED:
+ switch (group_type)
+ {
+ case BCMBAL_MGT_GROUP_CFG:
+ switch (msg_type)
+ {
+ case BCMBAL_OBJ_MSG_TYPE_GET:
+ return bcmbal_cli_tm_sched_cfg_get(session, byte_pool);
+ case BCMBAL_OBJ_MSG_TYPE_SET:
+ return bcmbal_cli_tm_sched_cfg_set(session, byte_pool);
+ case BCMBAL_OBJ_MSG_TYPE_CLEAR:
+ return bcmbal_cli_tm_sched_cfg_clear(session);
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ default:
+ return BCM_ERR_RANGE;
+ }
+}
+
+/* Perform an API call based on CLI input */
+bcmos_errno bcmbal_apicli_call(bcmbal_mgt_group group_type, bcmbal_obj_msg_type msg_type, bcmcli_session *session)
+{
+ bcmos_errno err;
+ bcmbal_apicli_byte_pool byte_pool;
+
+ /* setup memory pool for dynamically-sized list memory allocation */
+ err = bcmbal_apicli_byte_pool_create(&byte_pool);
+ if (err != BCM_ERR_OK)
+ {
+ return err;
+ }
+
+ /* call the root API handler */
+ err = bcmbal_apicli_root(group_type, msg_type, session, &byte_pool);
+
+ /* free all dynamically allocated memory */
+ bcmbal_apicli_byte_pool_destroy(&byte_pool);
+
+ return err;
+}
diff --git a/bal_release/src/lib/libbalapicli/bal_api_cli_handlers.h b/bal_release/src/lib/libbalapicli/bal_api_cli_handlers.h
new file mode 100644
index 0000000..dc7f1fc
--- /dev/null
+++ b/bal_release/src/lib/libbalapicli/bal_api_cli_handlers.h
@@ -0,0 +1,46 @@
+/*
+<:copyright-BRCM:2016:DUAL/GPL:standard
+
+ Broadcom Proprietary and Confidential.(c) 2016 Broadcom
+ All Rights Reserved
+
+Unless you and Broadcom execute a separate written software license
+agreement governing use of this software, this software is licensed
+to you under the terms of the GNU General Public License version 2
+(the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
+with the following added to such license:
+
+ As a special exception, the copyright holders of this software give
+ you permission to link this software with independent modules, and
+ to copy and distribute the resulting executable under terms of your
+ choice, provided that you also meet, for each linked independent
+ module, the terms and conditions of the license of that module.
+ An independent module is a module which is not derived from this
+ software. The special exception does not apply to any modifications
+ of the software.
+
+Not withstanding the above, under no circumstances may you combine
+this software in any way with any other Broadcom software provided
+under a license other than the GPL, without Broadcom's express prior
+written consent.
+
+:>
+*/
+
+#ifndef BCMBAL_APICLI_HANDLERS_H_
+#define BCMBAL_APICLI_HANDLERS_H_
+
+#include <bcmos_system.h>
+#include <bal_api.h>
+#include <bcmcli.h>
+
+/* the maximum amount of memory that could possibly by used by all variable-sized lists within a GET request */
+#define BCMBAL_APICLI_DYNAMIC_LIST_BUFFER_SIZE (32 * 1024)
+
+/* Perform an API call based on CLI input */
+bcmos_errno bcmbal_apicli_call(
+ bcmbal_mgt_group group_type,
+ bcmbal_obj_msg_type msg_type,
+ bcmcli_session *session);
+
+#endif
diff --git a/bal_release/src/lib/libbalapicli/bal_api_cli_helpers.c b/bal_release/src/lib/libbalapicli/bal_api_cli_helpers.c
new file mode 100644
index 0000000..d9b6e43
--- /dev/null
+++ b/bal_release/src/lib/libbalapicli/bal_api_cli_helpers.c
@@ -0,0 +1,1913 @@
+#include <bcmos_system.h>
+#include <bcmcli.h>
+#include <bal_api.h>
+#include "bal_api_cli_helpers.h"
+
+/* allow possibly unused descriptors to make the code easier to generate */
+#ifdef __GNUC__
+#define BCM_DESCR __attribute__((unused))
+#else
+#define BCM_DESCR
+#endif
+
+/* Unless specified in the XML model, dynamic arrays will have this max size (in bytes, will divide by element size) */
+#define DEFAULT_DYN_ARR_MAX_SIZE 2048
+
+/* ==== Base Type Descriptors ==== */
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_uint8_t = { .name = "uint8", .base_type = BCMBAL_APICLI_BASE_TYPE_ID_UNUM, .size = sizeof(uint8_t) };
+
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_uint16_t = { .name = "uint16", .base_type = BCMBAL_APICLI_BASE_TYPE_ID_UNUM, .size = sizeof(uint16_t) };
+
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_uint32_t = { .name = "uint32", .base_type = BCMBAL_APICLI_BASE_TYPE_ID_UNUM, .size = sizeof(uint32_t) };
+
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_uint64_t = { .name = "uint64", .base_type = BCMBAL_APICLI_BASE_TYPE_ID_UNUM, .size = sizeof(uint64_t) };
+
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_uint8_t_hex = { .name = "uint8_hex", .base_type = BCMBAL_APICLI_BASE_TYPE_ID_UNUM_HEX, .size = sizeof(uint8_t) };
+
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_uint16_t_hex = { .name = "uint16_hex", .base_type = BCMBAL_APICLI_BASE_TYPE_ID_UNUM_HEX, .size = sizeof(uint16_t) };
+
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_uint32_t_hex = { .name = "uint32_hex", .base_type = BCMBAL_APICLI_BASE_TYPE_ID_UNUM_HEX, .size = sizeof(uint32_t) };
+
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_uint64_t_hex = { .name = "uint64_hex", .base_type = BCMBAL_APICLI_BASE_TYPE_ID_UNUM_HEX, .size = sizeof(uint64_t) };
+
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_int8_t = { .name = "int8", .base_type = BCMBAL_APICLI_BASE_TYPE_ID_SNUM, .size = sizeof(int8_t) };
+
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_int16_t = { .name = "int16", .base_type = BCMBAL_APICLI_BASE_TYPE_ID_SNUM, .size = sizeof(int16_t) };
+
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_int32_t = { .name = "int32", .base_type = BCMBAL_APICLI_BASE_TYPE_ID_SNUM, .size = sizeof(int32_t) };
+
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_int64_t = { .name = "int64", .base_type = BCMBAL_APICLI_BASE_TYPE_ID_SNUM, .size = sizeof(int64_t) };
+
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_float = { .name = "float", .base_type = BCMBAL_APICLI_BASE_TYPE_ID_FLOAT, .size = sizeof(float) };
+
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_double = { .name = "double", .base_type = BCMBAL_APICLI_BASE_TYPE_ID_FLOAT, .size = sizeof(double) };
+
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmos_mac_address = { .name = "mac", .descr = "MAC address", .base_type = BCMBAL_APICLI_BASE_TYPE_ID_MAC, .size = sizeof(bcmos_mac_address) };
+
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmos_ipv4_address = { .name = "ipv4", .descr = "IPv4 address", .base_type = BCMBAL_APICLI_BASE_TYPE_ID_IPV4, .size = sizeof(bcmos_ipv4_address) };
+
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmos_bool = { .name = "bool", .descr = "Boolean", .base_type = BCMBAL_APICLI_BASE_TYPE_ID_BOOL, .size = sizeof(bcmos_bool) };
+
+/* ==== Object Type Information ==== */
+static char *object_name[] = { "access_terminal", "flow", "group", "interface", "packet", "subscriber_terminal", "tm_queue", "tm_sched" };
+static char *object_descr[] = { "BAL Access Terminal Object", "BAL Flow", "BAL Group", "BAL interface object", "Packet that can be transmitted or received", "BAL Subscriber Terminal", "Transmit queue", "Scheduling node" };
+
+/* ==== Supporting Types ==== */
+bcmcli_enum_val bcmbal_access_terminal_cfg_id_string_table[] = { { .name = "admin_state", .val = BCMBAL_ACCESS_TERMINAL_CFG_ID_ADMIN_STATE }, { .name = "oper_status", .val = BCMBAL_ACCESS_TERMINAL_CFG_ID_OPER_STATUS }, { .name = "iwf_mode", .val = BCMBAL_ACCESS_TERMINAL_CFG_ID_IWF_MODE }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_access_terminal_cfg_id = { .name = "bcmbal_access_terminal_cfg_id", .descr = "Identifiers for all properties contained in the access_terminal_cfg group.", .size = sizeof(bcmbal_access_terminal_cfg_id), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM, .x = { .e = bcmbal_access_terminal_cfg_id_string_table } };
+bcmcli_enum_val bcmbal_access_terminal_ind_id_string_table[] = { { .name = "admin_state", .val = BCMBAL_ACCESS_TERMINAL_IND_ID_ADMIN_STATE }, { .name = "oper_status", .val = BCMBAL_ACCESS_TERMINAL_IND_ID_OPER_STATUS }, { .name = "iwf_mode", .val = BCMBAL_ACCESS_TERMINAL_IND_ID_IWF_MODE }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_access_terminal_ind_id = { .name = "bcmbal_access_terminal_ind_id", .descr = "Identifiers for all properties contained in the access_terminal_ind group.", .size = sizeof(bcmbal_access_terminal_ind_id), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM, .x = { .e = bcmbal_access_terminal_ind_id_string_table } };
+bcmcli_enum_val bcmbal_access_terminal_key_id_string_table[] = { { .name = "access_term_id", .val = BCMBAL_ACCESS_TERMINAL_KEY_ID_ACCESS_TERM_ID }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_access_terminal_key_id = { .name = "bcmbal_access_terminal_key_id", .descr = "Identifiers for all properties contained in the access_terminal_key group.", .size = sizeof(bcmbal_access_terminal_key_id), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM, .x = { .e = bcmbal_access_terminal_key_id_string_table } };
+bcmcli_enum_val bcmbal_action_id_string_table[] = { { .name = "none", .val = BCMBAL_ACTION_ID_NONE }, { .name = "cmds_bitmask", .val = BCMBAL_ACTION_ID_CMDS_BITMASK }, { .name = "o_vid", .val = BCMBAL_ACTION_ID_O_VID }, { .name = "o_pbits", .val = BCMBAL_ACTION_ID_O_PBITS }, { .name = "o_tpid", .val = BCMBAL_ACTION_ID_O_TPID }, { .name = "i_vid", .val = BCMBAL_ACTION_ID_I_VID }, { .name = "i_pbits", .val = BCMBAL_ACTION_ID_I_PBITS }, { .name = "i_tpid", .val = BCMBAL_ACTION_ID_I_TPID }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_action_id = { .name = "bcmbal_action_id", .descr = "action ID", .size = sizeof(bcmbal_action_id), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM_MASK, .x = { .e = bcmbal_action_id_string_table } };
+bcmcli_enum_val bcmbal_action_cmd_id_string_table[] = { { .name = "none", .val = BCMBAL_ACTION_CMD_ID_NONE }, { .name = "add_outer_tag", .val = BCMBAL_ACTION_CMD_ID_ADD_OUTER_TAG }, { .name = "remove_outer_tag", .val = BCMBAL_ACTION_CMD_ID_REMOVE_OUTER_TAG }, { .name = "xlate_outer_tag", .val = BCMBAL_ACTION_CMD_ID_XLATE_OUTER_TAG }, { .name = "xlate_two_tags", .val = BCMBAL_ACTION_CMD_ID_XLATE_TWO_TAGS }, { .name = "discard_ds_bcast", .val = BCMBAL_ACTION_CMD_ID_DISCARD_DS_BCAST }, { .name = "discard_ds_unknown", .val = BCMBAL_ACTION_CMD_ID_DISCARD_DS_UNKNOWN }, { .name = "add_two_tags", .val = BCMBAL_ACTION_CMD_ID_ADD_TWO_TAGS }, { .name = "remove_two_tags", .val = BCMBAL_ACTION_CMD_ID_REMOVE_TWO_TAGS }, { .name = "remark_pbits", .val = BCMBAL_ACTION_CMD_ID_REMARK_PBITS }, { .name = "copy_pbits", .val = BCMBAL_ACTION_CMD_ID_COPY_PBITS }, { .name = "reverse_copy_pbits", .val = BCMBAL_ACTION_CMD_ID_REVERSE_COPY_PBITS }, { .name = "dscp_to_pbits", .val = BCMBAL_ACTION_CMD_ID_DSCP_TO_PBITS }, { .name = "trap_to_host", .val = BCMBAL_ACTION_CMD_ID_TRAP_TO_HOST }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_action_cmd_id = { .name = "bcmbal_action_cmd_id", .descr = "action_cmd_id", .size = sizeof(bcmbal_action_cmd_id), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM_MASK, .x = { .e = bcmbal_action_cmd_id_string_table } };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_action_fields[] = { { .name = "presence_mask", .descr = "Presence Mask", .offset = offsetof(bcmbal_action, presence_mask), .type = &type_descr_bcmbal_action_id, .flags = BCMBAL_APICLI_FIELD_DESCR_FLAGS_PRESENCE_MASK }, { .name = "cmds_bitmask", .descr = "Commands bitmask", .offset = offsetof(bcmbal_action, cmds_bitmask), .type = &type_descr_bcmbal_action_cmd_id }, { .name = "o_vid", .descr = "Outer vid", .offset = offsetof(bcmbal_action, o_vid), .type = &type_descr_uint16_t }, { .name = "o_pbits", .descr = "Outer pbits", .offset = offsetof(bcmbal_action, o_pbits), .type = &type_descr_uint8_t }, { .name = "o_tpid", .descr = "Outer tpid", .offset = offsetof(bcmbal_action, o_tpid), .type = &type_descr_uint16_t }, { .name = "i_vid", .descr = "Inner vid", .offset = offsetof(bcmbal_action, i_vid), .type = &type_descr_uint16_t }, { .name = "i_pbits", .descr = "Inner pbits", .offset = offsetof(bcmbal_action, i_pbits), .type = &type_descr_uint8_t }, { .name = "i_tpid", .descr = "Inner tpid", .offset = offsetof(bcmbal_action, i_tpid), .type = &type_descr_uint16_t } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_action = { .name = "bcmbal_action", .descr = "action", .size = sizeof(bcmbal_action), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_STRUCT, .x = { .s = { .num_fields = sizeof(type_descr_bcmbal_action_fields) / sizeof(bcmbal_apicli_field_descr), .fields = type_descr_bcmbal_action_fields } } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_aggregation_port_id_list_u8 = { .name = "bcmbal_aggregation_port_id_list_u8", .descr = "Variable-length list of aggregation_port_id", .size = sizeof(bcmbal_aggregation_port_id_list_u8), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ARR_DYN, .x = { .arr_dyn = { .elem_type = &type_descr_uint16_t, .len_size = 1, .max_size = DEFAULT_DYN_ARR_MAX_SIZE / sizeof(bcmbal_aggregation_port_id) } } };
+bcmcli_enum_val bcmbal_classifier_id_string_table[] = { { .name = "none", .val = BCMBAL_CLASSIFIER_ID_NONE }, { .name = "o_tpid", .val = BCMBAL_CLASSIFIER_ID_O_TPID }, { .name = "o_vid", .val = BCMBAL_CLASSIFIER_ID_O_VID }, { .name = "i_tpid", .val = BCMBAL_CLASSIFIER_ID_I_TPID }, { .name = "i_vid", .val = BCMBAL_CLASSIFIER_ID_I_VID }, { .name = "o_pbits", .val = BCMBAL_CLASSIFIER_ID_O_PBITS }, { .name = "i_pbits", .val = BCMBAL_CLASSIFIER_ID_I_PBITS }, { .name = "ether_type", .val = BCMBAL_CLASSIFIER_ID_ETHER_TYPE }, { .name = "dst_mac", .val = BCMBAL_CLASSIFIER_ID_DST_MAC }, { .name = "src_mac", .val = BCMBAL_CLASSIFIER_ID_SRC_MAC }, { .name = "ip_proto", .val = BCMBAL_CLASSIFIER_ID_IP_PROTO }, { .name = "dst_ip", .val = BCMBAL_CLASSIFIER_ID_DST_IP }, { .name = "src_ip", .val = BCMBAL_CLASSIFIER_ID_SRC_IP }, { .name = "src_port", .val = BCMBAL_CLASSIFIER_ID_SRC_PORT }, { .name = "dst_port", .val = BCMBAL_CLASSIFIER_ID_DST_PORT }, { .name = "pkt_tag_type", .val = BCMBAL_CLASSIFIER_ID_PKT_TAG_TYPE }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_classifier_id = { .name = "bcmbal_classifier_id", .descr = "classifier ID", .size = sizeof(bcmbal_classifier_id), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM_MASK, .x = { .e = bcmbal_classifier_id_string_table } };
+bcmcli_enum_val bcmbal_pkt_tag_type_string_table[] = { { .name = "none", .val = BCMBAL_PKT_TAG_TYPE_NONE }, { .name = "untagged", .val = BCMBAL_PKT_TAG_TYPE_UNTAGGED }, { .name = "single_tag", .val = BCMBAL_PKT_TAG_TYPE_SINGLE_TAG }, { .name = "double_tag", .val = BCMBAL_PKT_TAG_TYPE_DOUBLE_TAG }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_pkt_tag_type = { .name = "bcmbal_pkt_tag_type", .descr = "Packet tag type", .size = sizeof(bcmbal_pkt_tag_type), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM_MASK, .x = { .e = bcmbal_pkt_tag_type_string_table } };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_classifier_fields[] = { { .name = "presence_mask", .descr = "Presence Mask", .offset = offsetof(bcmbal_classifier, presence_mask), .type = &type_descr_bcmbal_classifier_id, .flags = BCMBAL_APICLI_FIELD_DESCR_FLAGS_PRESENCE_MASK }, { .name = "o_tpid", .descr = "Outer TPID of the packet to be classified", .offset = offsetof(bcmbal_classifier, o_tpid), .type = &type_descr_uint16_t }, { .name = "o_vid", .descr = "Outer VID of the packet to be classified", .offset = offsetof(bcmbal_classifier, o_vid), .type = &type_descr_uint16_t }, { .name = "i_tpid", .descr = "Inner TPID of the packet to be classified", .offset = offsetof(bcmbal_classifier, i_tpid), .type = &type_descr_uint16_t }, { .name = "i_vid", .descr = "Inner VID of the packet to be classified", .offset = offsetof(bcmbal_classifier, i_vid), .type = &type_descr_uint16_t }, { .name = "o_pbits", .descr = "Outer PBITS of the packet to be classified", .offset = offsetof(bcmbal_classifier, o_pbits), .type = &type_descr_uint8_t }, { .name = "i_pbits", .descr = "Inner PBITS of the packet to be classified", .offset = offsetof(bcmbal_classifier, i_pbits), .type = &type_descr_uint8_t }, { .name = "ether_type", .descr = "Ethertype of the packet to be classified", .offset = offsetof(bcmbal_classifier, ether_type), .type = &type_descr_uint16_t }, { .name = "dst_mac", .descr = "Destination MAC address of the packet to be classified", .offset = offsetof(bcmbal_classifier, dst_mac), .type = &type_descr_bcmos_mac_address }, { .name = "src_mac", .descr = "Source MAC address of the packet to be classified", .offset = offsetof(bcmbal_classifier, src_mac), .type = &type_descr_bcmos_mac_address }, { .name = "ip_proto", .descr = "IP protocol of the packet to be classified", .offset = offsetof(bcmbal_classifier, ip_proto), .type = &type_descr_uint8_t }, { .name = "dst_ip", .descr = "Destination IP address of the packet to be classified", .offset = offsetof(bcmbal_classifier, dst_ip), .type = &type_descr_bcmos_ipv4_address }, { .name = "src_ip", .descr = "Source IP address of the packet to be classified", .offset = offsetof(bcmbal_classifier, src_ip), .type = &type_descr_bcmos_ipv4_address }, { .name = "src_port", .descr = "Source port of the packet to be classified", .offset = offsetof(bcmbal_classifier, src_port), .type = &type_descr_uint16_t }, { .name = "dst_port", .descr = "Destination port of the packet to be classified", .offset = offsetof(bcmbal_classifier, dst_port), .type = &type_descr_uint16_t }, { .name = "pkt_tag_type", .descr = "The tag type of the ingress packets", .offset = offsetof(bcmbal_classifier, pkt_tag_type), .type = &type_descr_bcmbal_pkt_tag_type } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_classifier = { .name = "bcmbal_classifier", .descr = "classifier", .size = sizeof(bcmbal_classifier), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_STRUCT, .x = { .s = { .num_fields = sizeof(type_descr_bcmbal_classifier_fields) / sizeof(bcmbal_apicli_field_descr), .fields = type_descr_bcmbal_classifier_fields } } };
+bcmcli_enum_val bcmbal_control_string_table[] = { { .name = "disable", .val = BCMBAL_CONTROL_DISABLE }, { .name = "enable", .val = BCMBAL_CONTROL_ENABLE }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_control = { .name = "bcmbal_control", .descr = "Generic enable/disable enumeration", .size = sizeof(bcmbal_control), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM, .x = { .e = bcmbal_control_string_table } };
+bcmcli_enum_val bcmbal_dest_type_string_table[] = { { .name = "nni", .val = BCMBAL_DEST_TYPE_NNI }, { .name = "sub_term", .val = BCMBAL_DEST_TYPE_SUB_TERM }, { .name = "host", .val = BCMBAL_DEST_TYPE_HOST }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_dest_type = { .name = "bcmbal_dest_type", .descr = "Destination type", .size = sizeof(bcmbal_dest_type), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM, .x = { .e = bcmbal_dest_type_string_table } };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_dest_fields[] = { { .name = "type", .descr = "packet destination", .offset = offsetof(bcmbal_dest, type), .type = &type_descr_bcmbal_dest_type } };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_dest_nni_fields[] = { { .name = "int_id", .descr = "Interface ID", .offset = offsetof(bcmbal_dest, u.nni.int_id) - offsetof(bcmbal_dest, u.nni.int_id), .type = &type_descr_uint32_t } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_dest_nni = { .name = "bcmbal_dest_nni", .descr = "Packet destination nni", .size = sizeof(((bcmbal_dest *)0)->u.nni), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_STRUCT, .x = { .s = { .num_fields = sizeof(type_descr_bcmbal_dest_nni_fields) / sizeof(bcmbal_apicli_field_descr), .fields = type_descr_bcmbal_dest_nni_fields } } };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_dest_sub_term_fields[] = { { .name = "sub_term_id", .descr = "Subscriber terminal ID", .offset = offsetof(bcmbal_dest, u.sub_term.sub_term_id) - offsetof(bcmbal_dest, u.sub_term.sub_term_id), .type = &type_descr_uint32_t }, { .name = "sub_term_uni", .descr = "Subscriber terminal UNI", .offset = offsetof(bcmbal_dest, u.sub_term.sub_term_uni) - offsetof(bcmbal_dest, u.sub_term.sub_term_id), .type = &type_descr_uint16_t }, { .name = "int_id", .descr = "Interface ID", .offset = offsetof(bcmbal_dest, u.sub_term.int_id) - offsetof(bcmbal_dest, u.sub_term.sub_term_id), .type = &type_descr_uint16_t } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_dest_sub_term = { .name = "bcmbal_dest_sub_term", .descr = "Packet destination subscriber terminal", .size = sizeof(((bcmbal_dest *)0)->u.sub_term), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_STRUCT, .x = { .s = { .num_fields = sizeof(type_descr_bcmbal_dest_sub_term_fields) / sizeof(bcmbal_apicli_field_descr), .fields = type_descr_bcmbal_dest_sub_term_fields } } };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_dest_union_fields[] = { { .name = "u.nni", .descr = "", .offset = offsetof(bcmbal_dest, u.nni), .type = &type_descr_bcmbal_dest_nni }, { .name = "u.sub_term", .descr = "", .offset = offsetof(bcmbal_dest, u.sub_term), .type = &type_descr_bcmbal_dest_sub_term }, { }, { } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_dest = { .name = "bcmbal_dest", .descr = "Packet destination", .size = sizeof(bcmbal_dest), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_UNION, .x = { .u = { .num_common_fields = sizeof(type_descr_bcmbal_dest_fields) / sizeof(bcmbal_apicli_field_descr), .common_fields = type_descr_bcmbal_dest_fields, .classifier_idx = 0, .union_fields = type_descr_bcmbal_dest_union_fields } } };
+bcmcli_enum_val bcmbal_ds_miss_mode_string_table[] = { { .name = "discard", .val = BCMBAL_DS_MISS_MODE_DISCARD }, { .name = "broadcast", .val = BCMBAL_DS_MISS_MODE_BROADCAST }, { .name = "vid", .val = BCMBAL_DS_MISS_MODE_VID }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_ds_miss_mode = { .name = "bcmbal_ds_miss_mode", .descr = "Downstrean action for unknown packets", .size = sizeof(bcmbal_ds_miss_mode), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM, .x = { .e = bcmbal_ds_miss_mode_string_table } };
+bcmcli_enum_val bcmbal_extra_bw_eligibility_type_string_table[] = { { .name = "none", .val = BCMBAL_EXTRA_BW_ELIGIBILITY_TYPE_NONE }, { .name = "not_assured", .val = BCMBAL_EXTRA_BW_ELIGIBILITY_TYPE_NOT_ASSURED }, { .name = "best_effort", .val = BCMBAL_EXTRA_BW_ELIGIBILITY_TYPE_BEST_EFFORT }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_extra_bw_eligibility_type = { .name = "bcmbal_extra_bw_eligibility_type", .descr = "Extra BW Eligibility Type", .size = sizeof(bcmbal_extra_bw_eligibility_type), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM, .x = { .e = bcmbal_extra_bw_eligibility_type_string_table } };
+bcmcli_enum_val bcmbal_flow_cfg_id_string_table[] = { { .name = "admin_state", .val = BCMBAL_FLOW_CFG_ID_ADMIN_STATE }, { .name = "oper_status", .val = BCMBAL_FLOW_CFG_ID_OPER_STATUS }, { .name = "access_int_id", .val = BCMBAL_FLOW_CFG_ID_ACCESS_INT_ID }, { .name = "network_int_id", .val = BCMBAL_FLOW_CFG_ID_NETWORK_INT_ID }, { .name = "sub_term_id", .val = BCMBAL_FLOW_CFG_ID_SUB_TERM_ID }, { .name = "sub_term_uni_idx", .val = BCMBAL_FLOW_CFG_ID_SUB_TERM_UNI_IDX }, { .name = "svc_port_id", .val = BCMBAL_FLOW_CFG_ID_SVC_PORT_ID }, { .name = "agg_port_id", .val = BCMBAL_FLOW_CFG_ID_AGG_PORT_ID }, { .name = "resolve_mac", .val = BCMBAL_FLOW_CFG_ID_RESOLVE_MAC }, { .name = "classifier", .val = BCMBAL_FLOW_CFG_ID_CLASSIFIER }, { .name = "action", .val = BCMBAL_FLOW_CFG_ID_ACTION }, { .name = "sla", .val = BCMBAL_FLOW_CFG_ID_SLA }, { .name = "cookie", .val = BCMBAL_FLOW_CFG_ID_COOKIE }, { .name = "priority", .val = BCMBAL_FLOW_CFG_ID_PRIORITY }, { .name = "group_id", .val = BCMBAL_FLOW_CFG_ID_GROUP_ID }, { .name = "queue", .val = BCMBAL_FLOW_CFG_ID_QUEUE }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_flow_cfg_id = { .name = "bcmbal_flow_cfg_id", .descr = "Identifiers for all properties contained in the flow_cfg group.", .size = sizeof(bcmbal_flow_cfg_id), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM, .x = { .e = bcmbal_flow_cfg_id_string_table } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_flow_id_list_u32 = { .name = "bcmbal_flow_id_list_u32", .descr = "Variable-length list of flow_id", .size = sizeof(bcmbal_flow_id_list_u32), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ARR_DYN, .x = { .arr_dyn = { .elem_type = &type_descr_uint32_t, .len_size = 4, .max_size = DEFAULT_DYN_ARR_MAX_SIZE / sizeof(bcmbal_flow_id) } } };
+bcmcli_enum_val bcmbal_flow_ind_id_string_table[] = { { .name = "admin_state", .val = BCMBAL_FLOW_IND_ID_ADMIN_STATE }, { .name = "oper_status", .val = BCMBAL_FLOW_IND_ID_OPER_STATUS }, { .name = "access_int_id", .val = BCMBAL_FLOW_IND_ID_ACCESS_INT_ID }, { .name = "network_int_id", .val = BCMBAL_FLOW_IND_ID_NETWORK_INT_ID }, { .name = "sub_term_id", .val = BCMBAL_FLOW_IND_ID_SUB_TERM_ID }, { .name = "svc_port_id", .val = BCMBAL_FLOW_IND_ID_SVC_PORT_ID }, { .name = "agg_port_id", .val = BCMBAL_FLOW_IND_ID_AGG_PORT_ID }, { .name = "resolve_mac", .val = BCMBAL_FLOW_IND_ID_RESOLVE_MAC }, { .name = "base_tc_id", .val = BCMBAL_FLOW_IND_ID_BASE_TC_ID }, { .name = "classifier", .val = BCMBAL_FLOW_IND_ID_CLASSIFIER }, { .name = "action", .val = BCMBAL_FLOW_IND_ID_ACTION }, { .name = "sla", .val = BCMBAL_FLOW_IND_ID_SLA }, { .name = "cookie", .val = BCMBAL_FLOW_IND_ID_COOKIE }, { .name = "priority", .val = BCMBAL_FLOW_IND_ID_PRIORITY }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_flow_ind_id = { .name = "bcmbal_flow_ind_id", .descr = "Identifiers for all properties contained in the flow_ind group.", .size = sizeof(bcmbal_flow_ind_id), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM, .x = { .e = bcmbal_flow_ind_id_string_table } };
+bcmcli_enum_val bcmbal_flow_key_id_string_table[] = { { .name = "flow_id", .val = BCMBAL_FLOW_KEY_ID_FLOW_ID }, { .name = "flow_type", .val = BCMBAL_FLOW_KEY_ID_FLOW_TYPE }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_flow_key_id = { .name = "bcmbal_flow_key_id", .descr = "Identifiers for all properties contained in the flow_key group.", .size = sizeof(bcmbal_flow_key_id), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM, .x = { .e = bcmbal_flow_key_id_string_table } };
+bcmcli_enum_val bcmbal_flow_stat_id_string_table[] = { { .name = "rx_packets", .val = BCMBAL_FLOW_STAT_ID_RX_PACKETS }, { .name = "rx_bytes", .val = BCMBAL_FLOW_STAT_ID_RX_BYTES }, { .name = "tx_packets", .val = BCMBAL_FLOW_STAT_ID_TX_PACKETS }, { .name = "tx_bytes", .val = BCMBAL_FLOW_STAT_ID_TX_BYTES }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_flow_stat_id = { .name = "bcmbal_flow_stat_id", .descr = "Identifiers for all properties contained in the flow_stat group.", .size = sizeof(bcmbal_flow_stat_id), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM, .x = { .e = bcmbal_flow_stat_id_string_table } };
+bcmcli_enum_val bcmbal_flow_type_string_table[] = { { .name = "upstream", .val = BCMBAL_FLOW_TYPE_UPSTREAM }, { .name = "downstream", .val = BCMBAL_FLOW_TYPE_DOWNSTREAM }, { .name = "broadcast", .val = BCMBAL_FLOW_TYPE_BROADCAST }, { .name = "multicast", .val = BCMBAL_FLOW_TYPE_MULTICAST }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_flow_type = { .name = "bcmbal_flow_type", .descr = "Flow Type", .size = sizeof(bcmbal_flow_type), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM, .x = { .e = bcmbal_flow_type_string_table } };
+bcmcli_enum_val bcmbal_group_cfg_id_string_table[] = { { .name = "members_cmd", .val = BCMBAL_GROUP_CFG_ID_MEMBERS_CMD }, { .name = "members", .val = BCMBAL_GROUP_CFG_ID_MEMBERS }, { .name = "cookie", .val = BCMBAL_GROUP_CFG_ID_COOKIE }, { .name = "flows", .val = BCMBAL_GROUP_CFG_ID_FLOWS }, { .name = "owner", .val = BCMBAL_GROUP_CFG_ID_OWNER }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_group_cfg_id = { .name = "bcmbal_group_cfg_id", .descr = "Identifiers for all properties contained in the group_cfg group.", .size = sizeof(bcmbal_group_cfg_id), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM, .x = { .e = bcmbal_group_cfg_id_string_table } };
+bcmcli_enum_val bcmbal_group_key_id_string_table[] = { { .name = "group_id", .val = BCMBAL_GROUP_KEY_ID_GROUP_ID }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_group_key_id = { .name = "bcmbal_group_key_id", .descr = "Identifiers for all properties contained in the group_key group.", .size = sizeof(bcmbal_group_key_id), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM, .x = { .e = bcmbal_group_key_id_string_table } };
+bcmcli_enum_val bcmbal_group_member_cmd_string_table[] = { { .name = "add_members", .val = BCMBAL_GROUP_MEMBER_CMD_ADD_MEMBERS }, { .name = "rem_members", .val = BCMBAL_GROUP_MEMBER_CMD_REM_MEMBERS }, { .name = "set_members", .val = BCMBAL_GROUP_MEMBER_CMD_SET_MEMBERS }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_group_member_cmd = { .name = "bcmbal_group_member_cmd", .descr = "Member operation type", .size = sizeof(bcmbal_group_member_cmd), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM, .x = { .e = bcmbal_group_member_cmd_string_table } };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_tm_queue_ref_fields[] = { { .name = "sched_id", .descr = "Scheduler (tm_sched) ID", .offset = offsetof(bcmbal_tm_queue_ref, sched_id), .type = &type_descr_uint32_t }, { .name = "queue_id", .descr = "Queue ID", .offset = offsetof(bcmbal_tm_queue_ref, queue_id), .type = &type_descr_uint8_t } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_tm_queue_ref = { .name = "bcmbal_tm_queue_ref", .descr = "Queue Reference", .size = sizeof(bcmbal_tm_queue_ref), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_STRUCT, .x = { .s = { .num_fields = sizeof(type_descr_bcmbal_tm_queue_ref_fields) / sizeof(bcmbal_apicli_field_descr), .fields = type_descr_bcmbal_tm_queue_ref_fields } } };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_group_member_info_fields[] = { { .name = "intf_id", .descr = "Access interface id for this member", .offset = offsetof(bcmbal_group_member_info, intf_id), .type = &type_descr_uint32_t }, { .name = "svc_port_id", .descr = "The multicast \"GEM\" for this member", .offset = offsetof(bcmbal_group_member_info, svc_port_id), .type = &type_descr_uint16_t }, { .name = "action", .descr = "VLAN actions", .offset = offsetof(bcmbal_group_member_info, action), .type = &type_descr_bcmbal_action }, { .name = "queue", .descr = "Egress queue", .offset = offsetof(bcmbal_group_member_info, queue), .type = &type_descr_bcmbal_tm_queue_ref } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_group_member_info = { .name = "bcmbal_group_member_info", .descr = "Group Member Info", .size = sizeof(bcmbal_group_member_info), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_STRUCT, .x = { .s = { .num_fields = sizeof(type_descr_bcmbal_group_member_info_fields) / sizeof(bcmbal_apicli_field_descr), .fields = type_descr_bcmbal_group_member_info_fields } } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_group_member_info_list_u16 = { .name = "bcmbal_group_member_info_list_u16", .descr = "Variable-length list of group_member_info", .size = sizeof(bcmbal_group_member_info_list_u16), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ARR_DYN, .x = { .arr_dyn = { .elem_type = &type_descr_bcmbal_group_member_info, .len_size = 2, .max_size = DEFAULT_DYN_ARR_MAX_SIZE / sizeof(bcmbal_group_member_info) } } };
+bcmcli_enum_val bcmbal_group_owner_string_table[] = { { .name = "none", .val = BCMBAL_GROUP_OWNER_NONE }, { .name = "multicast", .val = BCMBAL_GROUP_OWNER_MULTICAST }, { .name = "unicast", .val = BCMBAL_GROUP_OWNER_UNICAST }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_group_owner = { .name = "bcmbal_group_owner", .descr = "owner of the group", .size = sizeof(bcmbal_group_owner), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM, .x = { .e = bcmbal_group_owner_string_table } };
+bcmcli_enum_val bcmbal_interface_cfg_id_string_table[] = { { .name = "admin_state", .val = BCMBAL_INTERFACE_CFG_ID_ADMIN_STATE }, { .name = "oper_status", .val = BCMBAL_INTERFACE_CFG_ID_OPER_STATUS }, { .name = "min_data_agg_port_id", .val = BCMBAL_INTERFACE_CFG_ID_MIN_DATA_AGG_PORT_ID }, { .name = "min_data_svc_port_id", .val = BCMBAL_INTERFACE_CFG_ID_MIN_DATA_SVC_PORT_ID }, { .name = "transceiver_type", .val = BCMBAL_INTERFACE_CFG_ID_TRANSCEIVER_TYPE }, { .name = "ds_miss_mode", .val = BCMBAL_INTERFACE_CFG_ID_DS_MISS_MODE }, { .name = "mtu", .val = BCMBAL_INTERFACE_CFG_ID_MTU }, { .name = "flow_control", .val = BCMBAL_INTERFACE_CFG_ID_FLOW_CONTROL }, { .name = "ds_tm", .val = BCMBAL_INTERFACE_CFG_ID_DS_TM }, { .name = "us_tm", .val = BCMBAL_INTERFACE_CFG_ID_US_TM }, { .name = "sub_term_id_list", .val = BCMBAL_INTERFACE_CFG_ID_SUB_TERM_ID_LIST }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_interface_cfg_id = { .name = "bcmbal_interface_cfg_id", .descr = "Identifiers for all properties contained in the interface_cfg group.", .size = sizeof(bcmbal_interface_cfg_id), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM, .x = { .e = bcmbal_interface_cfg_id_string_table } };
+bcmcli_enum_val bcmbal_interface_ind_id_string_table[] = { { .name = "admin_state", .val = BCMBAL_INTERFACE_IND_ID_ADMIN_STATE }, { .name = "oper_status", .val = BCMBAL_INTERFACE_IND_ID_OPER_STATUS }, { .name = "min_data_agg_port_id", .val = BCMBAL_INTERFACE_IND_ID_MIN_DATA_AGG_PORT_ID }, { .name = "min_data_svc_port_id", .val = BCMBAL_INTERFACE_IND_ID_MIN_DATA_SVC_PORT_ID }, { .name = "transceiver_type", .val = BCMBAL_INTERFACE_IND_ID_TRANSCEIVER_TYPE }, { .name = "ds_miss_mode", .val = BCMBAL_INTERFACE_IND_ID_DS_MISS_MODE }, { .name = "mtu", .val = BCMBAL_INTERFACE_IND_ID_MTU }, { .name = "flow_control", .val = BCMBAL_INTERFACE_IND_ID_FLOW_CONTROL }, { .name = "ds_tm", .val = BCMBAL_INTERFACE_IND_ID_DS_TM }, { .name = "us_tm", .val = BCMBAL_INTERFACE_IND_ID_US_TM }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_interface_ind_id = { .name = "bcmbal_interface_ind_id", .descr = "Identifiers for all properties contained in the interface_ind group.", .size = sizeof(bcmbal_interface_ind_id), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM, .x = { .e = bcmbal_interface_ind_id_string_table } };
+bcmcli_enum_val bcmbal_interface_key_id_string_table[] = { { .name = "intf_id", .val = BCMBAL_INTERFACE_KEY_ID_INTF_ID }, { .name = "intf_type", .val = BCMBAL_INTERFACE_KEY_ID_INTF_TYPE }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_interface_key_id = { .name = "bcmbal_interface_key_id", .descr = "Identifiers for all properties contained in the interface_key group.", .size = sizeof(bcmbal_interface_key_id), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM, .x = { .e = bcmbal_interface_key_id_string_table } };
+bcmcli_enum_val bcmbal_interface_stat_id_string_table[] = { { .name = "rx_packets", .val = BCMBAL_INTERFACE_STAT_ID_RX_PACKETS }, { .name = "rx_bytes", .val = BCMBAL_INTERFACE_STAT_ID_RX_BYTES }, { .name = "tx_packets", .val = BCMBAL_INTERFACE_STAT_ID_TX_PACKETS }, { .name = "tx_bytes", .val = BCMBAL_INTERFACE_STAT_ID_TX_BYTES }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_interface_stat_id = { .name = "bcmbal_interface_stat_id", .descr = "Identifiers for all properties contained in the interface_stat group.", .size = sizeof(bcmbal_interface_stat_id), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM, .x = { .e = bcmbal_interface_stat_id_string_table } };
+bcmcli_enum_val bcmbal_intf_type_string_table[] = { { .name = "nni", .val = BCMBAL_INTF_TYPE_NNI }, { .name = "pon", .val = BCMBAL_INTF_TYPE_PON }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_intf_type = { .name = "bcmbal_intf_type", .descr = "Interface type", .size = sizeof(bcmbal_intf_type), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM, .x = { .e = bcmbal_intf_type_string_table } };
+bcmcli_enum_val bcmbal_iwf_mode_string_table[] = { { .name = "direct_mapping", .val = BCMBAL_IWF_MODE_DIRECT_MAPPING }, { .name = "per_flow", .val = BCMBAL_IWF_MODE_PER_FLOW }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_iwf_mode = { .name = "bcmbal_iwf_mode", .descr = "Interworking Function Mode", .size = sizeof(bcmbal_iwf_mode), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM, .x = { .e = bcmbal_iwf_mode_string_table } };
+bcmcli_enum_val bcmbal_packet_cfg_id_string_table[] = { { .name = "flow_id", .val = BCMBAL_PACKET_CFG_ID_FLOW_ID }, { .name = "flow_type", .val = BCMBAL_PACKET_CFG_ID_FLOW_TYPE }, { .name = "intf_id", .val = BCMBAL_PACKET_CFG_ID_INTF_ID }, { .name = "intf_type", .val = BCMBAL_PACKET_CFG_ID_INTF_TYPE }, { .name = "svc_port", .val = BCMBAL_PACKET_CFG_ID_SVC_PORT }, { .name = "flow_cookie", .val = BCMBAL_PACKET_CFG_ID_FLOW_COOKIE }, { .name = "pkt", .val = BCMBAL_PACKET_CFG_ID_PKT }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_packet_cfg_id = { .name = "bcmbal_packet_cfg_id", .descr = "Identifiers for all properties contained in the packet_cfg group.", .size = sizeof(bcmbal_packet_cfg_id), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM, .x = { .e = bcmbal_packet_cfg_id_string_table } };
+bcmcli_enum_val bcmbal_packet_ind_id_string_table[] = { { .name = "flow_id", .val = BCMBAL_PACKET_IND_ID_FLOW_ID }, { .name = "flow_type", .val = BCMBAL_PACKET_IND_ID_FLOW_TYPE }, { .name = "intf_id", .val = BCMBAL_PACKET_IND_ID_INTF_ID }, { .name = "intf_type", .val = BCMBAL_PACKET_IND_ID_INTF_TYPE }, { .name = "svc_port", .val = BCMBAL_PACKET_IND_ID_SVC_PORT }, { .name = "flow_cookie", .val = BCMBAL_PACKET_IND_ID_FLOW_COOKIE }, { .name = "pkt", .val = BCMBAL_PACKET_IND_ID_PKT }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_packet_ind_id = { .name = "bcmbal_packet_ind_id", .descr = "Identifiers for all properties contained in the packet_ind group.", .size = sizeof(bcmbal_packet_ind_id), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM, .x = { .e = bcmbal_packet_ind_id_string_table } };
+bcmcli_enum_val bcmbal_packet_key_id_string_table[] = { { .name = "reserved", .val = BCMBAL_PACKET_KEY_ID_RESERVED }, { .name = "packet_send_dest", .val = BCMBAL_PACKET_KEY_ID_PACKET_SEND_DEST }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_packet_key_id = { .name = "bcmbal_packet_key_id", .descr = "Identifiers for all properties contained in the packet_key group.", .size = sizeof(bcmbal_packet_key_id), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM, .x = { .e = bcmbal_packet_key_id_string_table } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_uint8_t_arr_10 = { .name = "uint8_t[10]", .descr = "Array of 10 elements of type uint8_t", .size = sizeof(uint8_t[10]), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ARR_FIXED, .x = { .arr_fixed = { .elem_type = &type_descr_uint8_t, .size = 10 } } };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_password_fields[] = { { .name = "arr", .descr = "Array", .offset = offsetof(bcmbal_password, arr), .type = &type_descr_uint8_t_arr_10 } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_password = { .name = "bcmbal_password", .descr = "Password", .size = sizeof(bcmbal_password), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_STRUCT, .x = { .s = { .num_fields = sizeof(type_descr_bcmbal_password_fields) / sizeof(bcmbal_apicli_field_descr), .fields = type_descr_bcmbal_password_fields } } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_uint8_t_arr_36 = { .name = "uint8_t[36]", .descr = "Array of 36 elements of type uint8_t", .size = sizeof(uint8_t[36]), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ARR_FIXED, .x = { .arr_fixed = { .elem_type = &type_descr_uint8_t, .size = 36 } } };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_registration_id_fields[] = { { .name = "arr", .descr = "ONU registration ID", .offset = offsetof(bcmbal_registration_id, arr), .type = &type_descr_uint8_t_arr_36 } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_registration_id = { .name = "bcmbal_registration_id", .descr = "Registration id", .size = sizeof(bcmbal_registration_id), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_STRUCT, .x = { .s = { .num_fields = sizeof(type_descr_bcmbal_registration_id_fields) / sizeof(bcmbal_apicli_field_descr), .fields = type_descr_bcmbal_registration_id_fields } } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_uint8_t_arr_4 = { .name = "uint8_t[4]", .descr = "Array of 4 elements of type uint8_t", .size = sizeof(uint8_t[4]), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ARR_FIXED, .x = { .arr_fixed = { .elem_type = &type_descr_uint8_t, .size = 4 } } };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_serial_number_fields[] = { { .name = "vendor_id", .descr = "vendor id", .offset = offsetof(bcmbal_serial_number, vendor_id), .type = &type_descr_uint8_t_arr_4 }, { .name = "vendor_specific", .descr = "vendor specific", .offset = offsetof(bcmbal_serial_number, vendor_specific), .type = &type_descr_uint8_t_arr_4 } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_serial_number = { .name = "bcmbal_serial_number", .descr = "Serial number", .size = sizeof(bcmbal_serial_number), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_STRUCT, .x = { .s = { .num_fields = sizeof(type_descr_bcmbal_serial_number_fields) / sizeof(bcmbal_apicli_field_descr), .fields = type_descr_bcmbal_serial_number_fields } } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_service_port_id_list_u8 = { .name = "bcmbal_service_port_id_list_u8", .descr = "Variable-length list of service_port_id", .size = sizeof(bcmbal_service_port_id_list_u8), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ARR_DYN, .x = { .arr_dyn = { .elem_type = &type_descr_uint16_t, .len_size = 1, .max_size = DEFAULT_DYN_ARR_MAX_SIZE / sizeof(bcmbal_service_port_id) } } };
+bcmcli_enum_val bcmbal_sla_id_string_table[] = { { .name = "none", .val = BCMBAL_SLA_ID_NONE }, { .name = "min_rate", .val = BCMBAL_SLA_ID_MIN_RATE }, { .name = "max_rate", .val = BCMBAL_SLA_ID_MAX_RATE }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_sla_id = { .name = "bcmbal_sla_id", .descr = "SLA ID", .size = sizeof(bcmbal_sla_id), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM_MASK, .x = { .e = bcmbal_sla_id_string_table } };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_sla_fields[] = { { .name = "presence_mask", .descr = "Presence Mask", .offset = offsetof(bcmbal_sla, presence_mask), .type = &type_descr_bcmbal_sla_id, .flags = BCMBAL_APICLI_FIELD_DESCR_FLAGS_PRESENCE_MASK }, { .name = "min_rate", .descr = "The minimal rate for this flow, in kilobits per second (optional)", .offset = offsetof(bcmbal_sla, min_rate), .type = &type_descr_uint32_t }, { .name = "max_rate", .descr = "The maximum rate for this flow, in kilobits per second (optional)", .offset = offsetof(bcmbal_sla, max_rate), .type = &type_descr_uint32_t } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_sla = { .name = "bcmbal_sla", .descr = "SLA", .size = sizeof(bcmbal_sla), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_STRUCT, .x = { .s = { .num_fields = sizeof(type_descr_bcmbal_sla_fields) / sizeof(bcmbal_apicli_field_descr), .fields = type_descr_bcmbal_sla_fields } } };
+bcmcli_enum_val bcmbal_state_string_table[] = { { .name = "up", .val = BCMBAL_STATE_UP }, { .name = "down", .val = BCMBAL_STATE_DOWN }, { .name = "testing", .val = BCMBAL_STATE_TESTING }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_state = { .name = "bcmbal_state", .descr = "Admin state values for access terminal object", .size = sizeof(bcmbal_state), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM, .x = { .e = bcmbal_state_string_table } };
+bcmcli_enum_val bcmbal_status_string_table[] = { { .name = "up", .val = BCMBAL_STATUS_UP }, { .name = "down", .val = BCMBAL_STATUS_DOWN }, { .name = "testing", .val = BCMBAL_STATUS_TESTING }, { .name = "not_present", .val = BCMBAL_STATUS_NOT_PRESENT }, { .name = "lower_layer_down", .val = BCMBAL_STATUS_LOWER_LAYER_DOWN }, { .name = "unknown", .val = BCMBAL_STATUS_UNKNOWN }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_status = { .name = "bcmbal_status", .descr = "Oper status values", .size = sizeof(bcmbal_status), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM, .x = { .e = bcmbal_status_string_table } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_sub_id_list_u16 = { .name = "bcmbal_sub_id_list_u16", .descr = "Variable-length list of sub_id", .size = sizeof(bcmbal_sub_id_list_u16), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ARR_DYN, .x = { .arr_dyn = { .elem_type = &type_descr_uint32_t, .len_size = 2, .max_size = DEFAULT_DYN_ARR_MAX_SIZE / sizeof(bcmbal_sub_id) } } };
+bcmcli_enum_val bcmbal_subscriber_terminal_cfg_id_string_table[] = { { .name = "admin_state", .val = BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_ADMIN_STATE }, { .name = "oper_status", .val = BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_OPER_STATUS }, { .name = "serial_number", .val = BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_SERIAL_NUMBER }, { .name = "password", .val = BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_PASSWORD }, { .name = "registration_id", .val = BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_REGISTRATION_ID }, { .name = "svc_port_id", .val = BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_SVC_PORT_ID }, { .name = "mac_address", .val = BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_MAC_ADDRESS }, { .name = "ds_tm", .val = BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_DS_TM }, { .name = "us_tm", .val = BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_US_TM }, { .name = "svc_port_id_list", .val = BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_SVC_PORT_ID_LIST }, { .name = "agg_port_id_list", .val = BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_AGG_PORT_ID_LIST }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_subscriber_terminal_cfg_id = { .name = "bcmbal_subscriber_terminal_cfg_id", .descr = "Identifiers for all properties contained in the subscriber_terminal_cfg group.", .size = sizeof(bcmbal_subscriber_terminal_cfg_id), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM, .x = { .e = bcmbal_subscriber_terminal_cfg_id_string_table } };
+bcmcli_enum_val bcmbal_subscriber_terminal_ind_id_string_table[] = { { .name = "admin_state", .val = BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_ADMIN_STATE }, { .name = "oper_status", .val = BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_OPER_STATUS }, { .name = "serial_number", .val = BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_SERIAL_NUMBER }, { .name = "password", .val = BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_PASSWORD }, { .name = "registration_id", .val = BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_REGISTRATION_ID }, { .name = "svc_port_id", .val = BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_SVC_PORT_ID }, { .name = "mac_address", .val = BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_MAC_ADDRESS }, { .name = "ds_tm", .val = BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_DS_TM }, { .name = "us_tm", .val = BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_US_TM }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_subscriber_terminal_ind_id = { .name = "bcmbal_subscriber_terminal_ind_id", .descr = "Identifiers for all properties contained in the subscriber_terminal_ind group.", .size = sizeof(bcmbal_subscriber_terminal_ind_id), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM, .x = { .e = bcmbal_subscriber_terminal_ind_id_string_table } };
+bcmcli_enum_val bcmbal_subscriber_terminal_key_id_string_table[] = { { .name = "sub_term_id", .val = BCMBAL_SUBSCRIBER_TERMINAL_KEY_ID_SUB_TERM_ID }, { .name = "intf_id", .val = BCMBAL_SUBSCRIBER_TERMINAL_KEY_ID_INTF_ID }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_subscriber_terminal_key_id = { .name = "bcmbal_subscriber_terminal_key_id", .descr = "Identifiers for all properties contained in the subscriber_terminal_key group.", .size = sizeof(bcmbal_subscriber_terminal_key_id), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM, .x = { .e = bcmbal_subscriber_terminal_key_id_string_table } };
+bcmcli_enum_val bcmbal_subscriber_terminal_stat_id_string_table[] = { { .name = "rx_packets", .val = BCMBAL_SUBSCRIBER_TERMINAL_STAT_ID_RX_PACKETS }, { .name = "rx_bytes", .val = BCMBAL_SUBSCRIBER_TERMINAL_STAT_ID_RX_BYTES }, { .name = "tx_packets", .val = BCMBAL_SUBSCRIBER_TERMINAL_STAT_ID_TX_PACKETS }, { .name = "tx_bytes", .val = BCMBAL_SUBSCRIBER_TERMINAL_STAT_ID_TX_BYTES }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_subscriber_terminal_stat_id = { .name = "bcmbal_subscriber_terminal_stat_id", .descr = "Identifiers for all properties contained in the subscriber_terminal_stat group.", .size = sizeof(bcmbal_subscriber_terminal_stat_id), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM, .x = { .e = bcmbal_subscriber_terminal_stat_id_string_table } };
+bcmcli_enum_val bcmbal_tm_bac_type_string_table[] = { { .name = "taildrop", .val = BCMBAL_TM_BAC_TYPE_TAILDROP }, { .name = "wtaildrop", .val = BCMBAL_TM_BAC_TYPE_WTAILDROP }, { .name = "red", .val = BCMBAL_TM_BAC_TYPE_RED }, { .name = "wred", .val = BCMBAL_TM_BAC_TYPE_WRED }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_tm_bac_type = { .name = "bcmbal_tm_bac_type", .descr = "Buffer Admission Control Type", .size = sizeof(bcmbal_tm_bac_type), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM, .x = { .e = bcmbal_tm_bac_type_string_table } };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_tm_red_fields[] = { { .name = "min_threshold", .descr = "Min threshold in percent of max queue size", .offset = offsetof(bcmbal_tm_red, min_threshold), .type = &type_descr_uint8_t }, { .name = "max_threshold", .descr = "Max threshold in percent of max queue size", .offset = offsetof(bcmbal_tm_red, max_threshold), .type = &type_descr_uint8_t }, { .name = "max_probability", .descr = "Discard probability for occupancy between min_threshold and max_threshold", .offset = offsetof(bcmbal_tm_red, max_probability), .type = &type_descr_uint8_t } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_tm_red = { .name = "bcmbal_tm_red", .descr = "Random Early Discard Configuration", .size = sizeof(bcmbal_tm_red), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_STRUCT, .x = { .s = { .num_fields = sizeof(type_descr_bcmbal_tm_red_fields) / sizeof(bcmbal_apicli_field_descr), .fields = type_descr_bcmbal_tm_red_fields } } };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_tm_bac_fields[] = { { .name = "type", .descr = "Buffer Admission Control Type", .offset = offsetof(bcmbal_tm_bac, type), .type = &type_descr_bcmbal_tm_bac_type } };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_tm_bac_taildrop_fields[] = { { .name = "max_size", .descr = "max number of packets in the queue", .offset = offsetof(bcmbal_tm_bac, u.taildrop.max_size) - offsetof(bcmbal_tm_bac, u.taildrop.max_size), .type = &type_descr_uint32_t } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_tm_bac_taildrop = { .name = "bcmbal_tm_bac_taildrop", .descr = "tm_bac taildrop", .size = sizeof(((bcmbal_tm_bac *)0)->u.taildrop), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_STRUCT, .x = { .s = { .num_fields = sizeof(type_descr_bcmbal_tm_bac_taildrop_fields) / sizeof(bcmbal_apicli_field_descr), .fields = type_descr_bcmbal_tm_bac_taildrop_fields } } };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_tm_bac_red_fields[] = { { .name = "red", .descr = "Random Early Discard configuration", .offset = offsetof(bcmbal_tm_bac, u.red.red) - offsetof(bcmbal_tm_bac, u.red.red), .type = &type_descr_bcmbal_tm_red } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_tm_bac_red = { .name = "bcmbal_tm_bac_red", .descr = "tm_bac red", .size = sizeof(((bcmbal_tm_bac *)0)->u.red), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_STRUCT, .x = { .s = { .num_fields = sizeof(type_descr_bcmbal_tm_bac_red_fields) / sizeof(bcmbal_apicli_field_descr), .fields = type_descr_bcmbal_tm_bac_red_fields } } };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_tm_bac_wred_fields[] = { { .name = "green", .descr = "Green Random Early Discard Configuration", .offset = offsetof(bcmbal_tm_bac, u.wred.green) - offsetof(bcmbal_tm_bac, u.wred.green), .type = &type_descr_bcmbal_tm_red }, { .name = "yellow", .descr = "Yellow Random Early Discard Configuration", .offset = offsetof(bcmbal_tm_bac, u.wred.yellow) - offsetof(bcmbal_tm_bac, u.wred.green), .type = &type_descr_bcmbal_tm_red }, { .name = "red", .descr = "Red Random Early Discard Configuration", .offset = offsetof(bcmbal_tm_bac, u.wred.red) - offsetof(bcmbal_tm_bac, u.wred.green), .type = &type_descr_bcmbal_tm_red } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_tm_bac_wred = { .name = "bcmbal_tm_bac_wred", .descr = "tm_bac wred", .size = sizeof(((bcmbal_tm_bac *)0)->u.wred), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_STRUCT, .x = { .s = { .num_fields = sizeof(type_descr_bcmbal_tm_bac_wred_fields) / sizeof(bcmbal_apicli_field_descr), .fields = type_descr_bcmbal_tm_bac_wred_fields } } };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_tm_bac_union_fields[] = { { .name = "u.taildrop", .descr = "", .offset = offsetof(bcmbal_tm_bac, u.taildrop), .type = &type_descr_bcmbal_tm_bac_taildrop }, { }, { .name = "u.red", .descr = "", .offset = offsetof(bcmbal_tm_bac, u.red), .type = &type_descr_bcmbal_tm_bac_red }, { .name = "u.wred", .descr = "", .offset = offsetof(bcmbal_tm_bac, u.wred), .type = &type_descr_bcmbal_tm_bac_wred }, { } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_tm_bac = { .name = "bcmbal_tm_bac", .descr = "Queue Buffer Admission Control", .size = sizeof(bcmbal_tm_bac), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_UNION, .x = { .u = { .num_common_fields = sizeof(type_descr_bcmbal_tm_bac_fields) / sizeof(bcmbal_apicli_field_descr), .common_fields = type_descr_bcmbal_tm_bac_fields, .classifier_idx = 0, .union_fields = type_descr_bcmbal_tm_bac_union_fields } } };
+bcmcli_enum_val bcmbal_tm_creation_mode_string_table[] = { { .name = "manual", .val = BCMBAL_TM_CREATION_MODE_MANUAL }, { .name = "auto", .val = BCMBAL_TM_CREATION_MODE_AUTO }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_tm_creation_mode = { .name = "bcmbal_tm_creation_mode", .descr = "TM Creation Mode", .size = sizeof(bcmbal_tm_creation_mode), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM, .x = { .e = bcmbal_tm_creation_mode_string_table } };
+bcmcli_enum_val bcmbal_tm_queue_cfg_id_string_table[] = { { .name = "priority", .val = BCMBAL_TM_QUEUE_CFG_ID_PRIORITY }, { .name = "weight", .val = BCMBAL_TM_QUEUE_CFG_ID_WEIGHT }, { .name = "rate", .val = BCMBAL_TM_QUEUE_CFG_ID_RATE }, { .name = "bac", .val = BCMBAL_TM_QUEUE_CFG_ID_BAC }, { .name = "creation_mode", .val = BCMBAL_TM_QUEUE_CFG_ID_CREATION_MODE }, { .name = "ref_count", .val = BCMBAL_TM_QUEUE_CFG_ID_REF_COUNT }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_tm_queue_cfg_id = { .name = "bcmbal_tm_queue_cfg_id", .descr = "Identifiers for all properties contained in the tm_queue_cfg group.", .size = sizeof(bcmbal_tm_queue_cfg_id), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM, .x = { .e = bcmbal_tm_queue_cfg_id_string_table } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_tm_queue_id_list_u8 = { .name = "bcmbal_tm_queue_id_list_u8", .descr = "Variable-length list of tm_queue_id", .size = sizeof(bcmbal_tm_queue_id_list_u8), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ARR_DYN, .x = { .arr_dyn = { .elem_type = &type_descr_uint8_t, .len_size = 1, .max_size = DEFAULT_DYN_ARR_MAX_SIZE / sizeof(bcmbal_tm_queue_id) } } };
+bcmcli_enum_val bcmbal_tm_queue_ind_id_string_table[] = { { .name = "ret", .val = BCMBAL_TM_QUEUE_IND_ID_RET }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_tm_queue_ind_id = { .name = "bcmbal_tm_queue_ind_id", .descr = "Identifiers for all properties contained in the tm_queue_ind group.", .size = sizeof(bcmbal_tm_queue_ind_id), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM, .x = { .e = bcmbal_tm_queue_ind_id_string_table } };
+bcmcli_enum_val bcmbal_tm_queue_key_id_string_table[] = { { .name = "sched_id", .val = BCMBAL_TM_QUEUE_KEY_ID_SCHED_ID }, { .name = "sched_dir", .val = BCMBAL_TM_QUEUE_KEY_ID_SCHED_DIR }, { .name = "id", .val = BCMBAL_TM_QUEUE_KEY_ID_ID }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_tm_queue_key_id = { .name = "bcmbal_tm_queue_key_id", .descr = "Identifiers for all properties contained in the tm_queue_key group.", .size = sizeof(bcmbal_tm_queue_key_id), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM, .x = { .e = bcmbal_tm_queue_key_id_string_table } };
+bcmcli_enum_val bcmbal_tm_queue_stat_id_string_table[] = { { .name = "packets_ok", .val = BCMBAL_TM_QUEUE_STAT_ID_PACKETS_OK }, { .name = "bytes_ok", .val = BCMBAL_TM_QUEUE_STAT_ID_BYTES_OK }, { .name = "packets_discarded", .val = BCMBAL_TM_QUEUE_STAT_ID_PACKETS_DISCARDED }, { .name = "bytes_discarded", .val = BCMBAL_TM_QUEUE_STAT_ID_BYTES_DISCARDED }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_tm_queue_stat_id = { .name = "bcmbal_tm_queue_stat_id", .descr = "Identifiers for all properties contained in the tm_queue_stat group.", .size = sizeof(bcmbal_tm_queue_stat_id), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM, .x = { .e = bcmbal_tm_queue_stat_id_string_table } };
+bcmcli_enum_val bcmbal_tm_sched_cfg_id_string_table[] = { { .name = "owner", .val = BCMBAL_TM_SCHED_CFG_ID_OWNER }, { .name = "sched_type", .val = BCMBAL_TM_SCHED_CFG_ID_SCHED_TYPE }, { .name = "sched_parent", .val = BCMBAL_TM_SCHED_CFG_ID_SCHED_PARENT }, { .name = "sched_child_type", .val = BCMBAL_TM_SCHED_CFG_ID_SCHED_CHILD_TYPE }, { .name = "rate", .val = BCMBAL_TM_SCHED_CFG_ID_RATE }, { .name = "tcont_sla", .val = BCMBAL_TM_SCHED_CFG_ID_TCONT_SLA }, { .name = "creation_mode", .val = BCMBAL_TM_SCHED_CFG_ID_CREATION_MODE }, { .name = "queues", .val = BCMBAL_TM_SCHED_CFG_ID_QUEUES }, { .name = "sub_scheds", .val = BCMBAL_TM_SCHED_CFG_ID_SUB_SCHEDS }, { .name = "num_priorities", .val = BCMBAL_TM_SCHED_CFG_ID_NUM_PRIORITIES }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_tm_sched_cfg_id = { .name = "bcmbal_tm_sched_cfg_id", .descr = "Identifiers for all properties contained in the tm_sched_cfg group.", .size = sizeof(bcmbal_tm_sched_cfg_id), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM, .x = { .e = bcmbal_tm_sched_cfg_id_string_table } };
+bcmcli_enum_val bcmbal_tm_sched_child_type_string_table[] = { { .name = "queue", .val = BCMBAL_TM_SCHED_CHILD_TYPE_QUEUE }, { .name = "sched", .val = BCMBAL_TM_SCHED_CHILD_TYPE_SCHED }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_tm_sched_child_type = { .name = "bcmbal_tm_sched_child_type", .descr = "Scheduling Level for the Children TM ", .size = sizeof(bcmbal_tm_sched_child_type), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM, .x = { .e = bcmbal_tm_sched_child_type_string_table } };
+bcmcli_enum_val bcmbal_tm_sched_dir_string_table[] = { { .name = "us", .val = BCMBAL_TM_SCHED_DIR_US }, { .name = "ds", .val = BCMBAL_TM_SCHED_DIR_DS }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_tm_sched_dir = { .name = "bcmbal_tm_sched_dir", .descr = "Traffic Direction", .size = sizeof(bcmbal_tm_sched_dir), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM, .x = { .e = bcmbal_tm_sched_dir_string_table } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_tm_sched_id_list_u8 = { .name = "bcmbal_tm_sched_id_list_u8", .descr = "Variable-length list of tm_sched_id", .size = sizeof(bcmbal_tm_sched_id_list_u8), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ARR_DYN, .x = { .arr_dyn = { .elem_type = &type_descr_uint32_t, .len_size = 1, .max_size = DEFAULT_DYN_ARR_MAX_SIZE / sizeof(bcmbal_tm_sched_id) } } };
+bcmcli_enum_val bcmbal_tm_sched_ind_id_string_table[] = { { .name = "ret", .val = BCMBAL_TM_SCHED_IND_ID_RET }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_tm_sched_ind_id = { .name = "bcmbal_tm_sched_ind_id", .descr = "Identifiers for all properties contained in the tm_sched_ind group.", .size = sizeof(bcmbal_tm_sched_ind_id), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM, .x = { .e = bcmbal_tm_sched_ind_id_string_table } };
+bcmcli_enum_val bcmbal_tm_sched_key_id_string_table[] = { { .name = "dir", .val = BCMBAL_TM_SCHED_KEY_ID_DIR }, { .name = "id", .val = BCMBAL_TM_SCHED_KEY_ID_ID }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_tm_sched_key_id = { .name = "bcmbal_tm_sched_key_id", .descr = "Identifiers for all properties contained in the tm_sched_key group.", .size = sizeof(bcmbal_tm_sched_key_id), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM, .x = { .e = bcmbal_tm_sched_key_id_string_table } };
+bcmcli_enum_val bcmbal_tm_sched_owner_type_string_table[] = { { .name = "undefined", .val = BCMBAL_TM_SCHED_OWNER_TYPE_UNDEFINED }, { .name = "interface", .val = BCMBAL_TM_SCHED_OWNER_TYPE_INTERFACE }, { .name = "sub_term", .val = BCMBAL_TM_SCHED_OWNER_TYPE_SUB_TERM }, { .name = "agg_port", .val = BCMBAL_TM_SCHED_OWNER_TYPE_AGG_PORT }, { .name = "uni", .val = BCMBAL_TM_SCHED_OWNER_TYPE_UNI }, { .name = "virtual", .val = BCMBAL_TM_SCHED_OWNER_TYPE_VIRTUAL }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_tm_sched_owner_type = { .name = "bcmbal_tm_sched_owner_type", .descr = "TM Scheduler Owner Type", .size = sizeof(bcmbal_tm_sched_owner_type), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM, .x = { .e = bcmbal_tm_sched_owner_type_string_table } };
+bcmcli_enum_val bcmbal_tm_sched_owner_agg_port_id_string_table[] = { { .name = "none", .val = BCMBAL_TM_SCHED_OWNER_AGG_PORT_ID_NONE }, { .name = "intf_id", .val = BCMBAL_TM_SCHED_OWNER_AGG_PORT_ID_INTF_ID }, { .name = "sub_term_id", .val = BCMBAL_TM_SCHED_OWNER_AGG_PORT_ID_SUB_TERM_ID }, { .name = "agg_port_id", .val = BCMBAL_TM_SCHED_OWNER_AGG_PORT_ID_AGG_PORT_ID }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_tm_sched_owner_agg_port_id = { .name = "bcmbal_tm_sched_owner_agg_port_id", .descr = "tm_sched_owner agg_port ID", .size = sizeof(bcmbal_tm_sched_owner_agg_port_id), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM_MASK, .x = { .e = bcmbal_tm_sched_owner_agg_port_id_string_table } };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_tm_sched_owner_fields[] = { { .name = "type", .descr = "Owner type", .offset = offsetof(bcmbal_tm_sched_owner, type), .type = &type_descr_bcmbal_tm_sched_owner_type } };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_tm_sched_owner_interface_fields[] = { { .name = "intf_type", .descr = "Interface Type", .offset = offsetof(bcmbal_tm_sched_owner, u.interface.intf_type) - offsetof(bcmbal_tm_sched_owner, u.interface.intf_type), .type = &type_descr_bcmbal_intf_type }, { .name = "intf_id", .descr = "Interface ID", .offset = offsetof(bcmbal_tm_sched_owner, u.interface.intf_id) - offsetof(bcmbal_tm_sched_owner, u.interface.intf_type), .type = &type_descr_uint32_t } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_tm_sched_owner_interface = { .name = "bcmbal_tm_sched_owner_interface", .descr = "tm_sched_owner interface", .size = sizeof(((bcmbal_tm_sched_owner *)0)->u.interface), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_STRUCT, .x = { .s = { .num_fields = sizeof(type_descr_bcmbal_tm_sched_owner_interface_fields) / sizeof(bcmbal_apicli_field_descr), .fields = type_descr_bcmbal_tm_sched_owner_interface_fields } } };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_tm_sched_owner_sub_term_fields[] = { { .name = "intf_id", .descr = "PON interface id", .offset = offsetof(bcmbal_tm_sched_owner, u.sub_term.intf_id) - offsetof(bcmbal_tm_sched_owner, u.sub_term.intf_id), .type = &type_descr_uint32_t }, { .name = "sub_term_id", .descr = "Subscriber terminal ID", .offset = offsetof(bcmbal_tm_sched_owner, u.sub_term.sub_term_id) - offsetof(bcmbal_tm_sched_owner, u.sub_term.intf_id), .type = &type_descr_uint32_t } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_tm_sched_owner_sub_term = { .name = "bcmbal_tm_sched_owner_sub_term", .descr = "tm_sched_owner subs_term", .size = sizeof(((bcmbal_tm_sched_owner *)0)->u.sub_term), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_STRUCT, .x = { .s = { .num_fields = sizeof(type_descr_bcmbal_tm_sched_owner_sub_term_fields) / sizeof(bcmbal_apicli_field_descr), .fields = type_descr_bcmbal_tm_sched_owner_sub_term_fields } } };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_tm_sched_owner_agg_port_fields[] = { { .name = "presence_mask", .descr = "Presence Mask", .offset = offsetof(bcmbal_tm_sched_owner, u.agg_port.presence_mask) - offsetof(bcmbal_tm_sched_owner, u.agg_port.presence_mask), .type = &type_descr_bcmbal_tm_sched_owner_agg_port_id, .flags = BCMBAL_APICLI_FIELD_DESCR_FLAGS_PRESENCE_MASK }, { .name = "intf_id", .descr = "PON interface id", .offset = offsetof(bcmbal_tm_sched_owner, u.agg_port.intf_id) - offsetof(bcmbal_tm_sched_owner, u.agg_port.presence_mask), .type = &type_descr_uint8_t }, { .name = "sub_term_id", .descr = "Subscriber terminal id", .offset = offsetof(bcmbal_tm_sched_owner, u.agg_port.sub_term_id) - offsetof(bcmbal_tm_sched_owner, u.agg_port.presence_mask), .type = &type_descr_uint32_t }, { .name = "agg_port_id", .descr = "Aggregation port id", .offset = offsetof(bcmbal_tm_sched_owner, u.agg_port.agg_port_id) - offsetof(bcmbal_tm_sched_owner, u.agg_port.presence_mask), .type = &type_descr_uint16_t } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_tm_sched_owner_agg_port = { .name = "bcmbal_tm_sched_owner_agg_port", .descr = "tm_sched_owner agg_port", .size = sizeof(((bcmbal_tm_sched_owner *)0)->u.agg_port), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_STRUCT, .x = { .s = { .num_fields = sizeof(type_descr_bcmbal_tm_sched_owner_agg_port_fields) / sizeof(bcmbal_apicli_field_descr), .fields = type_descr_bcmbal_tm_sched_owner_agg_port_fields } } };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_tm_sched_owner_uni_fields[] = { { .name = "intf_id", .descr = "PON interface id", .offset = offsetof(bcmbal_tm_sched_owner, u.uni.intf_id) - offsetof(bcmbal_tm_sched_owner, u.uni.intf_id), .type = &type_descr_uint8_t }, { .name = "sub_term_id", .descr = "Subscriber terminal id", .offset = offsetof(bcmbal_tm_sched_owner, u.uni.sub_term_id) - offsetof(bcmbal_tm_sched_owner, u.uni.intf_id), .type = &type_descr_uint32_t }, { .name = "idx", .descr = "Index at subscriber terminal", .offset = offsetof(bcmbal_tm_sched_owner, u.uni.idx) - offsetof(bcmbal_tm_sched_owner, u.uni.intf_id), .type = &type_descr_uint8_t } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_tm_sched_owner_uni = { .name = "bcmbal_tm_sched_owner_uni", .descr = "tm_sched_owner uni", .size = sizeof(((bcmbal_tm_sched_owner *)0)->u.uni), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_STRUCT, .x = { .s = { .num_fields = sizeof(type_descr_bcmbal_tm_sched_owner_uni_fields) / sizeof(bcmbal_apicli_field_descr), .fields = type_descr_bcmbal_tm_sched_owner_uni_fields } } };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_tm_sched_owner_virtual_fields[] = { { .name = "idx", .descr = "Owner index", .offset = offsetof(bcmbal_tm_sched_owner, u.virtual.idx) - offsetof(bcmbal_tm_sched_owner, u.virtual.idx), .type = &type_descr_uint32_t } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_tm_sched_owner_virtual = { .name = "bcmbal_tm_sched_owner_virtual", .descr = "tm_sched_owner virtual", .size = sizeof(((bcmbal_tm_sched_owner *)0)->u.virtual), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_STRUCT, .x = { .s = { .num_fields = sizeof(type_descr_bcmbal_tm_sched_owner_virtual_fields) / sizeof(bcmbal_apicli_field_descr), .fields = type_descr_bcmbal_tm_sched_owner_virtual_fields } } };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_tm_sched_owner_union_fields[] = { { }, { .name = "u.interface", .descr = "", .offset = offsetof(bcmbal_tm_sched_owner, u.interface), .type = &type_descr_bcmbal_tm_sched_owner_interface }, { .name = "u.sub_term", .descr = "", .offset = offsetof(bcmbal_tm_sched_owner, u.sub_term), .type = &type_descr_bcmbal_tm_sched_owner_sub_term }, { .name = "u.agg_port", .descr = "", .offset = offsetof(bcmbal_tm_sched_owner, u.agg_port), .type = &type_descr_bcmbal_tm_sched_owner_agg_port }, { .name = "u.uni", .descr = "", .offset = offsetof(bcmbal_tm_sched_owner, u.uni), .type = &type_descr_bcmbal_tm_sched_owner_uni }, { .name = "u.virtual", .descr = "", .offset = offsetof(bcmbal_tm_sched_owner, u.virtual), .type = &type_descr_bcmbal_tm_sched_owner_virtual }, { } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_tm_sched_owner = { .name = "bcmbal_tm_sched_owner", .descr = "TM Scheduler Owner", .size = sizeof(bcmbal_tm_sched_owner), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_UNION, .x = { .u = { .num_common_fields = sizeof(type_descr_bcmbal_tm_sched_owner_fields) / sizeof(bcmbal_apicli_field_descr), .common_fields = type_descr_bcmbal_tm_sched_owner_fields, .classifier_idx = 0, .union_fields = type_descr_bcmbal_tm_sched_owner_union_fields } } };
+bcmcli_enum_val bcmbal_tm_sched_parent_id_string_table[] = { { .name = "none", .val = BCMBAL_TM_SCHED_PARENT_ID_NONE }, { .name = "sched_id", .val = BCMBAL_TM_SCHED_PARENT_ID_SCHED_ID }, { .name = "priority", .val = BCMBAL_TM_SCHED_PARENT_ID_PRIORITY }, { .name = "weight", .val = BCMBAL_TM_SCHED_PARENT_ID_WEIGHT }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_tm_sched_parent_id = { .name = "bcmbal_tm_sched_parent_id", .descr = "tm_sched_parent ID", .size = sizeof(bcmbal_tm_sched_parent_id), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM_MASK, .x = { .e = bcmbal_tm_sched_parent_id_string_table } };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_tm_sched_parent_fields[] = { { .name = "presence_mask", .descr = "Presence Mask", .offset = offsetof(bcmbal_tm_sched_parent, presence_mask), .type = &type_descr_bcmbal_tm_sched_parent_id, .flags = BCMBAL_APICLI_FIELD_DESCR_FLAGS_PRESENCE_MASK }, { .name = "sched_id", .descr = "Parent scheduler id", .offset = offsetof(bcmbal_tm_sched_parent, sched_id), .type = &type_descr_uint32_t }, { .name = "priority", .descr = "Priority", .offset = offsetof(bcmbal_tm_sched_parent, priority), .type = &type_descr_uint8_t }, { .name = "weight", .descr = "Weight", .offset = offsetof(bcmbal_tm_sched_parent, weight), .type = &type_descr_uint8_t } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_tm_sched_parent = { .name = "bcmbal_tm_sched_parent", .descr = "Scheduling Parent Connect Point", .size = sizeof(bcmbal_tm_sched_parent), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_STRUCT, .x = { .s = { .num_fields = sizeof(type_descr_bcmbal_tm_sched_parent_fields) / sizeof(bcmbal_apicli_field_descr), .fields = type_descr_bcmbal_tm_sched_parent_fields } } };
+bcmcli_enum_val bcmbal_tm_sched_type_string_table[] = { { .name = "none", .val = BCMBAL_TM_SCHED_TYPE_NONE }, { .name = "wfq", .val = BCMBAL_TM_SCHED_TYPE_WFQ }, { .name = "sp", .val = BCMBAL_TM_SCHED_TYPE_SP }, { .name = "sp_wfq", .val = BCMBAL_TM_SCHED_TYPE_SP_WFQ }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_tm_sched_type = { .name = "bcmbal_tm_sched_type", .descr = "Scheduler Type", .size = sizeof(bcmbal_tm_sched_type), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM, .x = { .e = bcmbal_tm_sched_type_string_table } };
+bcmcli_enum_val bcmbal_tm_shaping_id_string_table[] = { { .name = "none", .val = BCMBAL_TM_SHAPING_ID_NONE }, { .name = "sbr", .val = BCMBAL_TM_SHAPING_ID_SBR }, { .name = "pbr", .val = BCMBAL_TM_SHAPING_ID_PBR }, { .name = "burst", .val = BCMBAL_TM_SHAPING_ID_BURST }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_tm_shaping_id = { .name = "bcmbal_tm_shaping_id", .descr = "tm_shaping ID", .size = sizeof(bcmbal_tm_shaping_id), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM_MASK, .x = { .e = bcmbal_tm_shaping_id_string_table } };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_tm_shaping_fields[] = { { .name = "presence_mask", .descr = "Presence Mask", .offset = offsetof(bcmbal_tm_shaping, presence_mask), .type = &type_descr_bcmbal_tm_shaping_id, .flags = BCMBAL_APICLI_FIELD_DESCR_FLAGS_PRESENCE_MASK }, { .name = "sbr", .descr = "Sustained Bit Rate (kbps)", .offset = offsetof(bcmbal_tm_shaping, sbr), .type = &type_descr_uint32_t }, { .name = "pbr", .descr = "Peak Bit Rate (kbps)", .offset = offsetof(bcmbal_tm_shaping, pbr), .type = &type_descr_uint32_t }, { .name = "burst", .descr = "Max Burst Bytes at Peak Bit Rate", .offset = offsetof(bcmbal_tm_shaping, burst), .type = &type_descr_uint32_t } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_tm_shaping = { .name = "bcmbal_tm_shaping", .descr = "Shaping Parameters", .size = sizeof(bcmbal_tm_shaping), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_STRUCT, .x = { .s = { .num_fields = sizeof(type_descr_bcmbal_tm_shaping_fields) / sizeof(bcmbal_apicli_field_descr), .fields = type_descr_bcmbal_tm_shaping_fields } } };
+bcmcli_enum_val bcmbal_tm_tcont_sla_id_string_table[] = { { .name = "none", .val = BCMBAL_TM_TCONT_SLA_ID_NONE }, { .name = "extra_bw_elig", .val = BCMBAL_TM_TCONT_SLA_ID_EXTRA_BW_ELIG }, { .name = "nrt_cbr", .val = BCMBAL_TM_TCONT_SLA_ID_NRT_CBR }, { .name = "rt_cbr", .val = BCMBAL_TM_TCONT_SLA_ID_RT_CBR }, { .name = "rt_profile", .val = BCMBAL_TM_TCONT_SLA_ID_RT_PROFILE }, { .name = "nrt_profile", .val = BCMBAL_TM_TCONT_SLA_ID_NRT_PROFILE }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_tm_tcont_sla_id = { .name = "bcmbal_tm_tcont_sla_id", .descr = "tm_tcont_sla ID", .size = sizeof(bcmbal_tm_tcont_sla_id), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM_MASK, .x = { .e = bcmbal_tm_tcont_sla_id_string_table } };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_tm_tcont_sla_fields[] = { { .name = "presence_mask", .descr = "Presence Mask", .offset = offsetof(bcmbal_tm_tcont_sla, presence_mask), .type = &type_descr_bcmbal_tm_tcont_sla_id, .flags = BCMBAL_APICLI_FIELD_DESCR_FLAGS_PRESENCE_MASK }, { .name = "extra_bw_elig", .descr = "Extra BW eligibility type", .offset = offsetof(bcmbal_tm_tcont_sla, extra_bw_elig), .type = &type_descr_bcmbal_extra_bw_eligibility_type }, { .name = "nrt_cbr", .descr = "NRT CBR", .offset = offsetof(bcmbal_tm_tcont_sla, nrt_cbr), .type = &type_descr_uint8_t }, { .name = "rt_cbr", .descr = "RT_CBR", .offset = offsetof(bcmbal_tm_tcont_sla, rt_cbr), .type = &type_descr_uint8_t }, { .name = "rt_profile", .descr = "RT Profile", .offset = offsetof(bcmbal_tm_tcont_sla, rt_profile), .type = &type_descr_uint8_t }, { .name = "nrt_profile", .descr = "NRT Profile", .offset = offsetof(bcmbal_tm_tcont_sla, nrt_profile), .type = &type_descr_uint8_t } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_tm_tcont_sla = { .name = "bcmbal_tm_tcont_sla", .descr = "ITU-PON Extended SLA Parameters", .size = sizeof(bcmbal_tm_tcont_sla), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_STRUCT, .x = { .s = { .num_fields = sizeof(type_descr_bcmbal_tm_tcont_sla_fields) / sizeof(bcmbal_apicli_field_descr), .fields = type_descr_bcmbal_tm_tcont_sla_fields } } };
+bcmcli_enum_val bcmbal_trx_type_string_table[] = { { .name = "gpon_sps_43_48", .val = BCMBAL_TRX_TYPE_GPON_SPS_43_48 }, { .name = "gpon_sps_sog_4321", .val = BCMBAL_TRX_TYPE_GPON_SPS_SOG_4321 }, { .name = "gpon_lte_3680_m", .val = BCMBAL_TRX_TYPE_GPON_LTE_3680_M }, { .name = "gpon_source_photonics", .val = BCMBAL_TRX_TYPE_GPON_SOURCE_PHOTONICS }, { .name = "gpon_lte_3680_p", .val = BCMBAL_TRX_TYPE_GPON_LTE_3680_P }, { .name = "xgpon_lth_7222_pc", .val = BCMBAL_TRX_TYPE_XGPON_LTH_7222_PC }, { .name = "xgpon_lth_7226_pc", .val = BCMBAL_TRX_TYPE_XGPON_LTH_7226_PC }, { .name = "xgpon_lth_5302_pc", .val = BCMBAL_TRX_TYPE_XGPON_LTH_5302_PC }, BCMCLI_ENUM_LAST };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_trx_type = { .name = "bcmbal_trx_type", .descr = "Transceiver types", .size = sizeof(bcmbal_trx_type), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ENUM, .x = { .e = bcmbal_trx_type_string_table } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_u8_list_u32 = { .name = "bcmbal_u8_list_u32", .descr = "Variable-length list of U8", .size = sizeof(bcmbal_u8_list_u32), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_ARR_DYN, .x = { .arr_dyn = { .elem_type = &type_descr_uint8_t, .len_size = 4, .max_size = DEFAULT_DYN_ARR_MAX_SIZE / sizeof(uint8_t) } } };
+
+/* ==== Object: access_terminal ==== */
+
+/* Group: access_terminal - key */
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_access_terminal_key_access_term_id = { .name = "access_term_id", .descr = "Reserved (set to 0)", .access = 0, .property = BCMBAL_ACCESS_TERMINAL_KEY_ID_ACCESS_TERM_ID, .offset = offsetof(bcmbal_access_terminal_key, access_term_id), .type = &type_descr_uint32_t };
+static bcmbal_apicli_prop_descr * BCM_DESCR access_terminal_key_prop_array[] = { &prop_descr_access_terminal_key_access_term_id };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_access_terminal_key_fields[] = { { .name = "access_term_id", .descr = "Reserved (set to 0)", .offset = offsetof(bcmbal_access_terminal_key, access_term_id), .type = &type_descr_uint32_t } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_access_terminal_key = { .name = "bcmbal_access_terminal_key", .descr = "key", .size = sizeof(bcmbal_access_terminal_key), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_STRUCT, .x = { .s = { .num_fields = sizeof(type_descr_bcmbal_access_terminal_key_fields) / sizeof(bcmbal_apicli_field_descr), .fields = type_descr_bcmbal_access_terminal_key_fields } } };
+
+/* Group: access_terminal - cfg */
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_access_terminal_cfg_admin_state = { .name = "admin_state", .descr = "Administrative state", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_ACCESS_TERMINAL_CFG_ID_ADMIN_STATE, .offset = offsetof(bcmbal_access_terminal_cfg_data, admin_state), .type = &type_descr_bcmbal_state };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_access_terminal_cfg_oper_status = { .name = "oper_status", .descr = "Operational status", .access = BCMBAL_APICLI_PROP_ACCESS_ID_R, .property = BCMBAL_ACCESS_TERMINAL_CFG_ID_OPER_STATUS, .offset = offsetof(bcmbal_access_terminal_cfg_data, oper_status), .type = &type_descr_bcmbal_status };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_access_terminal_cfg_iwf_mode = { .name = "iwf_mode", .descr = "The interworking mode", .access = BCMBAL_APICLI_PROP_ACCESS_ID_R, .property = BCMBAL_ACCESS_TERMINAL_CFG_ID_IWF_MODE, .offset = offsetof(bcmbal_access_terminal_cfg_data, iwf_mode), .type = &type_descr_bcmbal_iwf_mode };
+static bcmbal_apicli_prop_descr * BCM_DESCR access_terminal_cfg_prop_array[] = { &prop_descr_access_terminal_cfg_admin_state, &prop_descr_access_terminal_cfg_oper_status, &prop_descr_access_terminal_cfg_iwf_mode };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_access_terminal_cfg_data_fields[] = { { .name = "admin_state", .descr = "Administrative state", .offset = offsetof(bcmbal_access_terminal_cfg_data, admin_state), .type = &type_descr_bcmbal_state }, { .name = "oper_status", .descr = "Operational status", .offset = offsetof(bcmbal_access_terminal_cfg_data, oper_status), .type = &type_descr_bcmbal_status }, { .name = "iwf_mode", .descr = "The interworking mode", .offset = offsetof(bcmbal_access_terminal_cfg_data, iwf_mode), .type = &type_descr_bcmbal_iwf_mode } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_access_terminal_cfg_data = { .name = "bcmbal_access_terminal_cfg_data", .descr = "cfg", .size = sizeof(bcmbal_access_terminal_cfg_data), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_STRUCT, .x = { .s = { .num_fields = sizeof(type_descr_bcmbal_access_terminal_cfg_data_fields) / sizeof(bcmbal_apicli_field_descr), .fields = type_descr_bcmbal_access_terminal_cfg_data_fields } } };
+
+/* Group: access_terminal - ind */
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_access_terminal_ind_admin_state = { .name = "admin_state", .descr = "Current administrative state", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_ACCESS_TERMINAL_IND_ID_ADMIN_STATE, .offset = offsetof(bcmbal_access_terminal_ind_data, admin_state), .type = &type_descr_bcmbal_state };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_access_terminal_ind_oper_status = { .name = "oper_status", .descr = "Current operational status", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_ACCESS_TERMINAL_IND_ID_OPER_STATUS, .offset = offsetof(bcmbal_access_terminal_ind_data, oper_status), .type = &type_descr_bcmbal_status };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_access_terminal_ind_iwf_mode = { .name = "iwf_mode", .descr = "The interworking mode", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_ACCESS_TERMINAL_IND_ID_IWF_MODE, .offset = offsetof(bcmbal_access_terminal_ind_data, iwf_mode), .type = &type_descr_bcmbal_iwf_mode };
+static bcmbal_apicli_prop_descr * BCM_DESCR access_terminal_ind_prop_array[] = { &prop_descr_access_terminal_ind_admin_state, &prop_descr_access_terminal_ind_oper_status, &prop_descr_access_terminal_ind_iwf_mode };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_access_terminal_ind_data_fields[] = { { .name = "admin_state", .descr = "Current administrative state", .offset = offsetof(bcmbal_access_terminal_ind_data, admin_state), .type = &type_descr_bcmbal_state }, { .name = "oper_status", .descr = "Current operational status", .offset = offsetof(bcmbal_access_terminal_ind_data, oper_status), .type = &type_descr_bcmbal_status }, { .name = "iwf_mode", .descr = "The interworking mode", .offset = offsetof(bcmbal_access_terminal_ind_data, iwf_mode), .type = &type_descr_bcmbal_iwf_mode } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_access_terminal_ind_data = { .name = "bcmbal_access_terminal_ind_data", .descr = "Access Terminal Indication", .size = sizeof(bcmbal_access_terminal_ind_data), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_STRUCT, .x = { .s = { .num_fields = sizeof(type_descr_bcmbal_access_terminal_ind_data_fields) / sizeof(bcmbal_apicli_field_descr), .fields = type_descr_bcmbal_access_terminal_ind_data_fields } } };
+
+/* ==== Object: flow ==== */
+
+/* Group: flow - cfg */
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_flow_cfg_admin_state = { .name = "admin_state", .descr = "Administrative state", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_FLOW_CFG_ID_ADMIN_STATE, .offset = offsetof(bcmbal_flow_cfg_data, admin_state), .type = &type_descr_bcmbal_state };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_flow_cfg_oper_status = { .name = "oper_status", .descr = "Operational status", .access = BCMBAL_APICLI_PROP_ACCESS_ID_R, .property = BCMBAL_FLOW_CFG_ID_OPER_STATUS, .offset = offsetof(bcmbal_flow_cfg_data, oper_status), .type = &type_descr_bcmbal_status };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_flow_cfg_access_int_id = { .name = "access_int_id", .descr = "The ID of the subscriber side interface; i.e. PON", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_FLOW_CFG_ID_ACCESS_INT_ID, .offset = offsetof(bcmbal_flow_cfg_data, access_int_id), .type = &type_descr_uint32_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_flow_cfg_network_int_id = { .name = "network_int_id", .descr = "The ID of the network side interface; i.e. NNI", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_FLOW_CFG_ID_NETWORK_INT_ID, .offset = offsetof(bcmbal_flow_cfg_data, network_int_id), .type = &type_descr_uint32_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_flow_cfg_sub_term_id = { .name = "sub_term_id", .descr = "The ID of the subsccriber terminal device", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_FLOW_CFG_ID_SUB_TERM_ID, .offset = offsetof(bcmbal_flow_cfg_data, sub_term_id), .type = &type_descr_uint32_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_flow_cfg_sub_term_uni_idx = { .name = "sub_term_uni_idx", .descr = "The index of the subsccriber terminal uni port the flow is related to", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_FLOW_CFG_ID_SUB_TERM_UNI_IDX, .offset = offsetof(bcmbal_flow_cfg_data, sub_term_uni_idx), .type = &type_descr_uint8_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_flow_cfg_svc_port_id = { .name = "svc_port_id", .descr = "The ID of the service port (for GPON/XGPON - GEM ID)", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_FLOW_CFG_ID_SVC_PORT_ID, .offset = offsetof(bcmbal_flow_cfg_data, svc_port_id), .type = &type_descr_uint16_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_flow_cfg_agg_port_id = { .name = "agg_port_id", .descr = "The ID of the aggregate port (for GPON/XGPON - ALLOC ID)", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_FLOW_CFG_ID_AGG_PORT_ID, .offset = offsetof(bcmbal_flow_cfg_data, agg_port_id), .type = &type_descr_uint16_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_flow_cfg_resolve_mac = { .name = "resolve_mac", .descr = "A flag indicating if the MAC address table should be used in DS GEM resolution", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_FLOW_CFG_ID_RESOLVE_MAC, .offset = offsetof(bcmbal_flow_cfg_data, resolve_mac), .type = &type_descr_bcmos_bool };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_flow_cfg_classifier = { .name = "classifier", .descr = "The classifier for this flow", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_FLOW_CFG_ID_CLASSIFIER, .offset = offsetof(bcmbal_flow_cfg_data, classifier), .type = &type_descr_bcmbal_classifier };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_flow_cfg_action = { .name = "action", .descr = "The action associated with the flow", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_FLOW_CFG_ID_ACTION, .offset = offsetof(bcmbal_flow_cfg_data, action), .type = &type_descr_bcmbal_action };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_flow_cfg_sla = { .name = "sla", .descr = "SLA parameters for this flow", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_FLOW_CFG_ID_SLA, .offset = offsetof(bcmbal_flow_cfg_data, sla), .type = &type_descr_bcmbal_sla };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_flow_cfg_cookie = { .name = "cookie", .descr = "Application cookie", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_FLOW_CFG_ID_COOKIE, .offset = offsetof(bcmbal_flow_cfg_data, cookie), .type = &type_descr_uint64_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_flow_cfg_priority = { .name = "priority", .descr = "Priority", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_FLOW_CFG_ID_PRIORITY, .offset = offsetof(bcmbal_flow_cfg_data, priority), .type = &type_descr_uint16_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_flow_cfg_group_id = { .name = "group_id", .descr = "RW - The multicast group associated with this flow, valid for type MULTICAST only", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_FLOW_CFG_ID_GROUP_ID, .offset = offsetof(bcmbal_flow_cfg_data, group_id), .type = &type_descr_uint32_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_flow_cfg_queue = { .name = "queue", .descr = "Egress queue", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_FLOW_CFG_ID_QUEUE, .offset = offsetof(bcmbal_flow_cfg_data, queue), .type = &type_descr_bcmbal_tm_queue_ref };
+static bcmbal_apicli_prop_descr * BCM_DESCR flow_cfg_prop_array[] = { &prop_descr_flow_cfg_admin_state, &prop_descr_flow_cfg_oper_status, &prop_descr_flow_cfg_access_int_id, &prop_descr_flow_cfg_network_int_id, &prop_descr_flow_cfg_sub_term_id, &prop_descr_flow_cfg_sub_term_uni_idx, &prop_descr_flow_cfg_svc_port_id, &prop_descr_flow_cfg_agg_port_id, &prop_descr_flow_cfg_resolve_mac, &prop_descr_flow_cfg_classifier, &prop_descr_flow_cfg_action, &prop_descr_flow_cfg_sla, &prop_descr_flow_cfg_cookie, &prop_descr_flow_cfg_priority, &prop_descr_flow_cfg_group_id, &prop_descr_flow_cfg_queue };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_flow_cfg_data_fields[] = { { .name = "admin_state", .descr = "Administrative state", .offset = offsetof(bcmbal_flow_cfg_data, admin_state), .type = &type_descr_bcmbal_state }, { .name = "oper_status", .descr = "Operational status", .offset = offsetof(bcmbal_flow_cfg_data, oper_status), .type = &type_descr_bcmbal_status }, { .name = "access_int_id", .descr = "The ID of the subscriber side interface; i.e. PON", .offset = offsetof(bcmbal_flow_cfg_data, access_int_id), .type = &type_descr_uint32_t }, { .name = "network_int_id", .descr = "The ID of the network side interface; i.e. NNI", .offset = offsetof(bcmbal_flow_cfg_data, network_int_id), .type = &type_descr_uint32_t }, { .name = "sub_term_id", .descr = "The ID of the subsccriber terminal device", .offset = offsetof(bcmbal_flow_cfg_data, sub_term_id), .type = &type_descr_uint32_t }, { .name = "sub_term_uni_idx", .descr = "The index of the subsccriber terminal uni port the flow is related to", .offset = offsetof(bcmbal_flow_cfg_data, sub_term_uni_idx), .type = &type_descr_uint8_t }, { .name = "svc_port_id", .descr = "The ID of the service port (for GPON/XGPON - GEM ID)", .offset = offsetof(bcmbal_flow_cfg_data, svc_port_id), .type = &type_descr_uint16_t }, { .name = "agg_port_id", .descr = "The ID of the aggregate port (for GPON/XGPON - ALLOC ID)", .offset = offsetof(bcmbal_flow_cfg_data, agg_port_id), .type = &type_descr_uint16_t }, { .name = "resolve_mac", .descr = "A flag indicating if the MAC address table should be used in DS GEM resolution", .offset = offsetof(bcmbal_flow_cfg_data, resolve_mac), .type = &type_descr_bcmos_bool }, { .name = "classifier", .descr = "The classifier for this flow", .offset = offsetof(bcmbal_flow_cfg_data, classifier), .type = &type_descr_bcmbal_classifier }, { .name = "action", .descr = "The action associated with the flow", .offset = offsetof(bcmbal_flow_cfg_data, action), .type = &type_descr_bcmbal_action }, { .name = "sla", .descr = "SLA parameters for this flow", .offset = offsetof(bcmbal_flow_cfg_data, sla), .type = &type_descr_bcmbal_sla }, { .name = "cookie", .descr = "Application cookie", .offset = offsetof(bcmbal_flow_cfg_data, cookie), .type = &type_descr_uint64_t }, { .name = "priority", .descr = "Priority", .offset = offsetof(bcmbal_flow_cfg_data, priority), .type = &type_descr_uint16_t }, { .name = "group_id", .descr = "RW - The multicast group associated with this flow, valid for type MULTICAST only", .offset = offsetof(bcmbal_flow_cfg_data, group_id), .type = &type_descr_uint32_t }, { .name = "queue", .descr = "Egress queue", .offset = offsetof(bcmbal_flow_cfg_data, queue), .type = &type_descr_bcmbal_tm_queue_ref } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_flow_cfg_data = { .name = "bcmbal_flow_cfg_data", .descr = "cfg", .size = sizeof(bcmbal_flow_cfg_data), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_STRUCT, .x = { .s = { .num_fields = sizeof(type_descr_bcmbal_flow_cfg_data_fields) / sizeof(bcmbal_apicli_field_descr), .fields = type_descr_bcmbal_flow_cfg_data_fields } } };
+
+/* Group: flow - key */
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_flow_key_flow_id = { .name = "flow_id", .descr = "The ID of the flow object instance being referenced", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_FLOW_KEY_ID_FLOW_ID, .offset = offsetof(bcmbal_flow_key, flow_id), .type = &type_descr_uint32_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_flow_key_flow_type = { .name = "flow_type", .descr = "The type of the flow, Upstream, Downstream, Broadcast or Multicast", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_FLOW_KEY_ID_FLOW_TYPE, .offset = offsetof(bcmbal_flow_key, flow_type), .type = &type_descr_bcmbal_flow_type };
+static bcmbal_apicli_prop_descr * BCM_DESCR flow_key_prop_array[] = { &prop_descr_flow_key_flow_id, &prop_descr_flow_key_flow_type };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_flow_key_fields[] = { { .name = "flow_id", .descr = "The ID of the flow object instance being referenced", .offset = offsetof(bcmbal_flow_key, flow_id), .type = &type_descr_uint32_t }, { .name = "flow_type", .descr = "The type of the flow, Upstream, Downstream, Broadcast or Multicast", .offset = offsetof(bcmbal_flow_key, flow_type), .type = &type_descr_bcmbal_flow_type } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_flow_key = { .name = "bcmbal_flow_key", .descr = "key", .size = sizeof(bcmbal_flow_key), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_STRUCT, .x = { .s = { .num_fields = sizeof(type_descr_bcmbal_flow_key_fields) / sizeof(bcmbal_apicli_field_descr), .fields = type_descr_bcmbal_flow_key_fields } } };
+
+/* Group: flow - stat */
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_flow_stat_rx_packets = { .name = "rx_packets", .descr = "Received packets", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_FLOW_STAT_ID_RX_PACKETS, .offset = offsetof(bcmbal_flow_stat_data, rx_packets), .type = &type_descr_uint64_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_flow_stat_rx_bytes = { .name = "rx_bytes", .descr = "Received bytes", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_FLOW_STAT_ID_RX_BYTES, .offset = offsetof(bcmbal_flow_stat_data, rx_bytes), .type = &type_descr_uint64_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_flow_stat_tx_packets = { .name = "tx_packets", .descr = "Transmitted packets", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_FLOW_STAT_ID_TX_PACKETS, .offset = offsetof(bcmbal_flow_stat_data, tx_packets), .type = &type_descr_uint64_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_flow_stat_tx_bytes = { .name = "tx_bytes", .descr = "Transmitted bytes", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_FLOW_STAT_ID_TX_BYTES, .offset = offsetof(bcmbal_flow_stat_data, tx_bytes), .type = &type_descr_uint64_t };
+static bcmbal_apicli_prop_descr * BCM_DESCR flow_stat_prop_array[] = { &prop_descr_flow_stat_rx_packets, &prop_descr_flow_stat_rx_bytes, &prop_descr_flow_stat_tx_packets, &prop_descr_flow_stat_tx_bytes };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_flow_stat_data_fields[] = { { .name = "rx_packets", .descr = "Received packets", .offset = offsetof(bcmbal_flow_stat_data, rx_packets), .type = &type_descr_uint64_t }, { .name = "rx_bytes", .descr = "Received bytes", .offset = offsetof(bcmbal_flow_stat_data, rx_bytes), .type = &type_descr_uint64_t }, { .name = "tx_packets", .descr = "Transmitted packets", .offset = offsetof(bcmbal_flow_stat_data, tx_packets), .type = &type_descr_uint64_t }, { .name = "tx_bytes", .descr = "Transmitted bytes", .offset = offsetof(bcmbal_flow_stat_data, tx_bytes), .type = &type_descr_uint64_t } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_flow_stat_data = { .name = "bcmbal_flow_stat_data", .descr = "stat", .size = sizeof(bcmbal_flow_stat_data), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_STRUCT, .x = { .s = { .num_fields = sizeof(type_descr_bcmbal_flow_stat_data_fields) / sizeof(bcmbal_apicli_field_descr), .fields = type_descr_bcmbal_flow_stat_data_fields } } };
+
+/* Group: flow - ind */
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_flow_ind_admin_state = { .name = "admin_state", .descr = "Administrative state", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_FLOW_IND_ID_ADMIN_STATE, .offset = offsetof(bcmbal_flow_ind_data, admin_state), .type = &type_descr_bcmbal_state };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_flow_ind_oper_status = { .name = "oper_status", .descr = "Operational Status", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_FLOW_IND_ID_OPER_STATUS, .offset = offsetof(bcmbal_flow_ind_data, oper_status), .type = &type_descr_bcmbal_status };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_flow_ind_access_int_id = { .name = "access_int_id", .descr = "The ID of the subscriber side interface; i.e. PON", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_FLOW_IND_ID_ACCESS_INT_ID, .offset = offsetof(bcmbal_flow_ind_data, access_int_id), .type = &type_descr_uint16_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_flow_ind_network_int_id = { .name = "network_int_id", .descr = "The ID of the network side interface; i.e. NNI", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_FLOW_IND_ID_NETWORK_INT_ID, .offset = offsetof(bcmbal_flow_ind_data, network_int_id), .type = &type_descr_uint16_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_flow_ind_sub_term_id = { .name = "sub_term_id", .descr = "The ID of the subsccriber terminal device", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_FLOW_IND_ID_SUB_TERM_ID, .offset = offsetof(bcmbal_flow_ind_data, sub_term_id), .type = &type_descr_uint32_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_flow_ind_svc_port_id = { .name = "svc_port_id", .descr = "The ID of the service port (for GPON/XGPON - GEM ID)", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_FLOW_IND_ID_SVC_PORT_ID, .offset = offsetof(bcmbal_flow_ind_data, svc_port_id), .type = &type_descr_uint16_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_flow_ind_agg_port_id = { .name = "agg_port_id", .descr = "The ID of the aggregate port (for GPON/XGPON - ALLOC ID)", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_FLOW_IND_ID_AGG_PORT_ID, .offset = offsetof(bcmbal_flow_ind_data, agg_port_id), .type = &type_descr_uint16_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_flow_ind_resolve_mac = { .name = "resolve_mac", .descr = "A flag indicating if the MAC address table should be used in DS GEM resolution", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_FLOW_IND_ID_RESOLVE_MAC, .offset = offsetof(bcmbal_flow_ind_data, resolve_mac), .type = &type_descr_bcmos_bool };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_flow_ind_base_tc_id = { .name = "base_tc_id", .descr = "The base index of the TC object(s) to be used for this flow", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_FLOW_IND_ID_BASE_TC_ID, .offset = offsetof(bcmbal_flow_ind_data, base_tc_id), .type = &type_descr_uint16_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_flow_ind_classifier = { .name = "classifier", .descr = "The classifier for this flow", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_FLOW_IND_ID_CLASSIFIER, .offset = offsetof(bcmbal_flow_ind_data, classifier), .type = &type_descr_bcmbal_classifier };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_flow_ind_action = { .name = "action", .descr = "The action associated with the flow", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_FLOW_IND_ID_ACTION, .offset = offsetof(bcmbal_flow_ind_data, action), .type = &type_descr_bcmbal_action };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_flow_ind_sla = { .name = "sla", .descr = "SLA parameters for this flow", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_FLOW_IND_ID_SLA, .offset = offsetof(bcmbal_flow_ind_data, sla), .type = &type_descr_bcmbal_sla };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_flow_ind_cookie = { .name = "cookie", .descr = "Application cookie", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_FLOW_IND_ID_COOKIE, .offset = offsetof(bcmbal_flow_ind_data, cookie), .type = &type_descr_uint32_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_flow_ind_priority = { .name = "priority", .descr = "Priority", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_FLOW_IND_ID_PRIORITY, .offset = offsetof(bcmbal_flow_ind_data, priority), .type = &type_descr_uint16_t };
+static bcmbal_apicli_prop_descr * BCM_DESCR flow_ind_prop_array[] = { &prop_descr_flow_ind_admin_state, &prop_descr_flow_ind_oper_status, &prop_descr_flow_ind_access_int_id, &prop_descr_flow_ind_network_int_id, &prop_descr_flow_ind_sub_term_id, &prop_descr_flow_ind_svc_port_id, &prop_descr_flow_ind_agg_port_id, &prop_descr_flow_ind_resolve_mac, &prop_descr_flow_ind_base_tc_id, &prop_descr_flow_ind_classifier, &prop_descr_flow_ind_action, &prop_descr_flow_ind_sla, &prop_descr_flow_ind_cookie, &prop_descr_flow_ind_priority };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_flow_ind_data_fields[] = { { .name = "admin_state", .descr = "Administrative state", .offset = offsetof(bcmbal_flow_ind_data, admin_state), .type = &type_descr_bcmbal_state }, { .name = "oper_status", .descr = "Operational Status", .offset = offsetof(bcmbal_flow_ind_data, oper_status), .type = &type_descr_bcmbal_status }, { .name = "access_int_id", .descr = "The ID of the subscriber side interface; i.e. PON", .offset = offsetof(bcmbal_flow_ind_data, access_int_id), .type = &type_descr_uint16_t }, { .name = "network_int_id", .descr = "The ID of the network side interface; i.e. NNI", .offset = offsetof(bcmbal_flow_ind_data, network_int_id), .type = &type_descr_uint16_t }, { .name = "sub_term_id", .descr = "The ID of the subsccriber terminal device", .offset = offsetof(bcmbal_flow_ind_data, sub_term_id), .type = &type_descr_uint32_t }, { .name = "svc_port_id", .descr = "The ID of the service port (for GPON/XGPON - GEM ID)", .offset = offsetof(bcmbal_flow_ind_data, svc_port_id), .type = &type_descr_uint16_t }, { .name = "agg_port_id", .descr = "The ID of the aggregate port (for GPON/XGPON - ALLOC ID)", .offset = offsetof(bcmbal_flow_ind_data, agg_port_id), .type = &type_descr_uint16_t }, { .name = "resolve_mac", .descr = "A flag indicating if the MAC address table should be used in DS GEM resolution", .offset = offsetof(bcmbal_flow_ind_data, resolve_mac), .type = &type_descr_bcmos_bool }, { .name = "base_tc_id", .descr = "The base index of the TC object(s) to be used for this flow", .offset = offsetof(bcmbal_flow_ind_data, base_tc_id), .type = &type_descr_uint16_t }, { .name = "classifier", .descr = "The classifier for this flow", .offset = offsetof(bcmbal_flow_ind_data, classifier), .type = &type_descr_bcmbal_classifier }, { .name = "action", .descr = "The action associated with the flow", .offset = offsetof(bcmbal_flow_ind_data, action), .type = &type_descr_bcmbal_action }, { .name = "sla", .descr = "SLA parameters for this flow", .offset = offsetof(bcmbal_flow_ind_data, sla), .type = &type_descr_bcmbal_sla }, { .name = "cookie", .descr = "Application cookie", .offset = offsetof(bcmbal_flow_ind_data, cookie), .type = &type_descr_uint32_t }, { .name = "priority", .descr = "Priority", .offset = offsetof(bcmbal_flow_ind_data, priority), .type = &type_descr_uint16_t } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_flow_ind_data = { .name = "bcmbal_flow_ind_data", .descr = "Flow Indication", .size = sizeof(bcmbal_flow_ind_data), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_STRUCT, .x = { .s = { .num_fields = sizeof(type_descr_bcmbal_flow_ind_data_fields) / sizeof(bcmbal_apicli_field_descr), .fields = type_descr_bcmbal_flow_ind_data_fields } } };
+
+/* ==== Object: group ==== */
+
+/* Group: group - cfg */
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_group_cfg_members_cmd = { .name = "members_cmd", .descr = "Membership operation commands", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_GROUP_CFG_ID_MEMBERS_CMD, .offset = offsetof(bcmbal_group_cfg_data, members_cmd), .type = &type_descr_bcmbal_group_member_cmd };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_group_cfg_members = { .name = "members", .descr = "The list of members associated with this group", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_GROUP_CFG_ID_MEMBERS, .offset = offsetof(bcmbal_group_cfg_data, members), .type = &type_descr_bcmbal_group_member_info_list_u16 };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_group_cfg_cookie = { .name = "cookie", .descr = "Application cookie", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_GROUP_CFG_ID_COOKIE, .offset = offsetof(bcmbal_group_cfg_data, cookie), .type = &type_descr_uint64_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_group_cfg_flows = { .name = "flows", .descr = "List of flows associated with this group", .access = BCMBAL_APICLI_PROP_ACCESS_ID_R, .property = BCMBAL_GROUP_CFG_ID_FLOWS, .offset = offsetof(bcmbal_group_cfg_data, flows), .type = &type_descr_bcmbal_flow_id_list_u32 };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_group_cfg_owner = { .name = "owner", .descr = "Owner of the group", .access = BCMBAL_APICLI_PROP_ACCESS_ID_R, .property = BCMBAL_GROUP_CFG_ID_OWNER, .offset = offsetof(bcmbal_group_cfg_data, owner), .type = &type_descr_bcmbal_group_owner };
+static bcmbal_apicli_prop_descr * BCM_DESCR group_cfg_prop_array[] = { &prop_descr_group_cfg_members_cmd, &prop_descr_group_cfg_members, &prop_descr_group_cfg_cookie, &prop_descr_group_cfg_flows, &prop_descr_group_cfg_owner };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_group_cfg_data_fields[] = { { .name = "members_cmd", .descr = "Membership operation commands", .offset = offsetof(bcmbal_group_cfg_data, members_cmd), .type = &type_descr_bcmbal_group_member_cmd }, { .name = "members", .descr = "The list of members associated with this group", .offset = offsetof(bcmbal_group_cfg_data, members), .type = &type_descr_bcmbal_group_member_info_list_u16 }, { .name = "cookie", .descr = "Application cookie", .offset = offsetof(bcmbal_group_cfg_data, cookie), .type = &type_descr_uint64_t }, { .name = "flows", .descr = "List of flows associated with this group", .offset = offsetof(bcmbal_group_cfg_data, flows), .type = &type_descr_bcmbal_flow_id_list_u32 }, { .name = "owner", .descr = "Owner of the group", .offset = offsetof(bcmbal_group_cfg_data, owner), .type = &type_descr_bcmbal_group_owner } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_group_cfg_data = { .name = "bcmbal_group_cfg_data", .descr = "cfg", .size = sizeof(bcmbal_group_cfg_data), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_STRUCT, .x = { .s = { .num_fields = sizeof(type_descr_bcmbal_group_cfg_data_fields) / sizeof(bcmbal_apicli_field_descr), .fields = type_descr_bcmbal_group_cfg_data_fields } } };
+
+/* Group: group - key */
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_group_key_group_id = { .name = "group_id", .descr = "The ID of the group object instance being referenced", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_GROUP_KEY_ID_GROUP_ID, .offset = offsetof(bcmbal_group_key, group_id), .type = &type_descr_uint32_t };
+static bcmbal_apicli_prop_descr * BCM_DESCR group_key_prop_array[] = { &prop_descr_group_key_group_id };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_group_key_fields[] = { { .name = "group_id", .descr = "The ID of the group object instance being referenced", .offset = offsetof(bcmbal_group_key, group_id), .type = &type_descr_uint32_t } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_group_key = { .name = "bcmbal_group_key", .descr = "key", .size = sizeof(bcmbal_group_key), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_STRUCT, .x = { .s = { .num_fields = sizeof(type_descr_bcmbal_group_key_fields) / sizeof(bcmbal_apicli_field_descr), .fields = type_descr_bcmbal_group_key_fields } } };
+
+/* ==== Object: interface ==== */
+
+/* Group: interface - key */
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_interface_key_intf_id = { .name = "intf_id", .descr = "intf_id", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_INTERFACE_KEY_ID_INTF_ID, .offset = offsetof(bcmbal_interface_key, intf_id), .type = &type_descr_uint32_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_interface_key_intf_type = { .name = "intf_type", .descr = "intf_type", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_INTERFACE_KEY_ID_INTF_TYPE, .offset = offsetof(bcmbal_interface_key, intf_type), .type = &type_descr_bcmbal_intf_type };
+static bcmbal_apicli_prop_descr * BCM_DESCR interface_key_prop_array[] = { &prop_descr_interface_key_intf_id, &prop_descr_interface_key_intf_type };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_interface_key_fields[] = { { .name = "intf_id", .descr = "intf_id", .offset = offsetof(bcmbal_interface_key, intf_id), .type = &type_descr_uint32_t }, { .name = "intf_type", .descr = "intf_type", .offset = offsetof(bcmbal_interface_key, intf_type), .type = &type_descr_bcmbal_intf_type } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_interface_key = { .name = "bcmbal_interface_key", .descr = "key", .size = sizeof(bcmbal_interface_key), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_STRUCT, .x = { .s = { .num_fields = sizeof(type_descr_bcmbal_interface_key_fields) / sizeof(bcmbal_apicli_field_descr), .fields = type_descr_bcmbal_interface_key_fields } } };
+
+/* Group: interface - cfg */
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_interface_cfg_admin_state = { .name = "admin_state", .descr = "Administrative state", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_INTERFACE_CFG_ID_ADMIN_STATE, .offset = offsetof(bcmbal_interface_cfg_data, admin_state), .type = &type_descr_bcmbal_state };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_interface_cfg_oper_status = { .name = "oper_status", .descr = "Operational status", .access = BCMBAL_APICLI_PROP_ACCESS_ID_R, .property = BCMBAL_INTERFACE_CFG_ID_OPER_STATUS, .offset = offsetof(bcmbal_interface_cfg_data, oper_status), .type = &type_descr_bcmbal_status };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_interface_cfg_min_data_agg_port_id = { .name = "min_data_agg_port_id", .descr = "The minimum agg_port_id that is allowed in the system", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_INTERFACE_CFG_ID_MIN_DATA_AGG_PORT_ID, .offset = offsetof(bcmbal_interface_cfg_data, min_data_agg_port_id), .type = &type_descr_uint16_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_interface_cfg_min_data_svc_port_id = { .name = "min_data_svc_port_id", .descr = "The minimum svc_port_id that is allowed in the system", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_INTERFACE_CFG_ID_MIN_DATA_SVC_PORT_ID, .offset = offsetof(bcmbal_interface_cfg_data, min_data_svc_port_id), .type = &type_descr_uint16_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_interface_cfg_transceiver_type = { .name = "transceiver_type", .descr = "The transceiver type used on an interface", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_INTERFACE_CFG_ID_TRANSCEIVER_TYPE, .offset = offsetof(bcmbal_interface_cfg_data, transceiver_type), .type = &type_descr_bcmbal_trx_type };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_interface_cfg_ds_miss_mode = { .name = "ds_miss_mode", .descr = "Defines the action to take for unknown downstream packets", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_INTERFACE_CFG_ID_DS_MISS_MODE, .offset = offsetof(bcmbal_interface_cfg_data, ds_miss_mode), .type = &type_descr_bcmbal_ds_miss_mode };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_interface_cfg_mtu = { .name = "mtu", .descr = "The MTU for an interface", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_INTERFACE_CFG_ID_MTU, .offset = offsetof(bcmbal_interface_cfg_data, mtu), .type = &type_descr_uint16_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_interface_cfg_flow_control = { .name = "flow_control", .descr = "Flow control enable or disable", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_INTERFACE_CFG_ID_FLOW_CONTROL, .offset = offsetof(bcmbal_interface_cfg_data, flow_control), .type = &type_descr_bcmbal_control };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_interface_cfg_ds_tm = { .name = "ds_tm", .descr = "Downstream scheduler and shaper", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_INTERFACE_CFG_ID_DS_TM, .offset = offsetof(bcmbal_interface_cfg_data, ds_tm), .type = &type_descr_uint32_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_interface_cfg_us_tm = { .name = "us_tm", .descr = "Upstream scheduler and shaper", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_INTERFACE_CFG_ID_US_TM, .offset = offsetof(bcmbal_interface_cfg_data, us_tm), .type = &type_descr_uint32_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_interface_cfg_sub_term_id_list = { .name = "sub_term_id_list", .descr = "A list of subscriber terminal ids configured on this interface", .access = BCMBAL_APICLI_PROP_ACCESS_ID_R, .property = BCMBAL_INTERFACE_CFG_ID_SUB_TERM_ID_LIST, .offset = offsetof(bcmbal_interface_cfg_data, sub_term_id_list), .type = &type_descr_bcmbal_sub_id_list_u16 };
+static bcmbal_apicli_prop_descr * BCM_DESCR interface_cfg_prop_array[] = { &prop_descr_interface_cfg_admin_state, &prop_descr_interface_cfg_oper_status, &prop_descr_interface_cfg_min_data_agg_port_id, &prop_descr_interface_cfg_min_data_svc_port_id, &prop_descr_interface_cfg_transceiver_type, &prop_descr_interface_cfg_ds_miss_mode, &prop_descr_interface_cfg_mtu, &prop_descr_interface_cfg_flow_control, &prop_descr_interface_cfg_ds_tm, &prop_descr_interface_cfg_us_tm, &prop_descr_interface_cfg_sub_term_id_list };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_interface_cfg_data_fields[] = { { .name = "admin_state", .descr = "Administrative state", .offset = offsetof(bcmbal_interface_cfg_data, admin_state), .type = &type_descr_bcmbal_state }, { .name = "oper_status", .descr = "Operational status", .offset = offsetof(bcmbal_interface_cfg_data, oper_status), .type = &type_descr_bcmbal_status }, { .name = "min_data_agg_port_id", .descr = "The minimum agg_port_id that is allowed in the system", .offset = offsetof(bcmbal_interface_cfg_data, min_data_agg_port_id), .type = &type_descr_uint16_t }, { .name = "min_data_svc_port_id", .descr = "The minimum svc_port_id that is allowed in the system", .offset = offsetof(bcmbal_interface_cfg_data, min_data_svc_port_id), .type = &type_descr_uint16_t }, { .name = "transceiver_type", .descr = "The transceiver type used on an interface", .offset = offsetof(bcmbal_interface_cfg_data, transceiver_type), .type = &type_descr_bcmbal_trx_type }, { .name = "ds_miss_mode", .descr = "Defines the action to take for unknown downstream packets", .offset = offsetof(bcmbal_interface_cfg_data, ds_miss_mode), .type = &type_descr_bcmbal_ds_miss_mode }, { .name = "mtu", .descr = "The MTU for an interface", .offset = offsetof(bcmbal_interface_cfg_data, mtu), .type = &type_descr_uint16_t }, { .name = "flow_control", .descr = "Flow control enable or disable", .offset = offsetof(bcmbal_interface_cfg_data, flow_control), .type = &type_descr_bcmbal_control }, { .name = "ds_tm", .descr = "Downstream scheduler and shaper", .offset = offsetof(bcmbal_interface_cfg_data, ds_tm), .type = &type_descr_uint32_t }, { .name = "us_tm", .descr = "Upstream scheduler and shaper", .offset = offsetof(bcmbal_interface_cfg_data, us_tm), .type = &type_descr_uint32_t }, { .name = "sub_term_id_list", .descr = "A list of subscriber terminal ids configured on this interface", .offset = offsetof(bcmbal_interface_cfg_data, sub_term_id_list), .type = &type_descr_bcmbal_sub_id_list_u16 } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_interface_cfg_data = { .name = "bcmbal_interface_cfg_data", .descr = "cfg", .size = sizeof(bcmbal_interface_cfg_data), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_STRUCT, .x = { .s = { .num_fields = sizeof(type_descr_bcmbal_interface_cfg_data_fields) / sizeof(bcmbal_apicli_field_descr), .fields = type_descr_bcmbal_interface_cfg_data_fields } } };
+
+/* Group: interface - stat */
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_interface_stat_rx_packets = { .name = "rx_packets", .descr = "Recieved packets", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_INTERFACE_STAT_ID_RX_PACKETS, .offset = offsetof(bcmbal_interface_stat_data, rx_packets), .type = &type_descr_uint64_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_interface_stat_rx_bytes = { .name = "rx_bytes", .descr = "Received bytes", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_INTERFACE_STAT_ID_RX_BYTES, .offset = offsetof(bcmbal_interface_stat_data, rx_bytes), .type = &type_descr_uint64_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_interface_stat_tx_packets = { .name = "tx_packets", .descr = "Transmitted packets", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_INTERFACE_STAT_ID_TX_PACKETS, .offset = offsetof(bcmbal_interface_stat_data, tx_packets), .type = &type_descr_uint64_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_interface_stat_tx_bytes = { .name = "tx_bytes", .descr = "Transmitted bytes", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_INTERFACE_STAT_ID_TX_BYTES, .offset = offsetof(bcmbal_interface_stat_data, tx_bytes), .type = &type_descr_uint64_t };
+static bcmbal_apicli_prop_descr * BCM_DESCR interface_stat_prop_array[] = { &prop_descr_interface_stat_rx_packets, &prop_descr_interface_stat_rx_bytes, &prop_descr_interface_stat_tx_packets, &prop_descr_interface_stat_tx_bytes };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_interface_stat_data_fields[] = { { .name = "rx_packets", .descr = "Recieved packets", .offset = offsetof(bcmbal_interface_stat_data, rx_packets), .type = &type_descr_uint64_t }, { .name = "rx_bytes", .descr = "Received bytes", .offset = offsetof(bcmbal_interface_stat_data, rx_bytes), .type = &type_descr_uint64_t }, { .name = "tx_packets", .descr = "Transmitted packets", .offset = offsetof(bcmbal_interface_stat_data, tx_packets), .type = &type_descr_uint64_t }, { .name = "tx_bytes", .descr = "Transmitted bytes", .offset = offsetof(bcmbal_interface_stat_data, tx_bytes), .type = &type_descr_uint64_t } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_interface_stat_data = { .name = "bcmbal_interface_stat_data", .descr = "stat", .size = sizeof(bcmbal_interface_stat_data), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_STRUCT, .x = { .s = { .num_fields = sizeof(type_descr_bcmbal_interface_stat_data_fields) / sizeof(bcmbal_apicli_field_descr), .fields = type_descr_bcmbal_interface_stat_data_fields } } };
+
+/* Group: interface - ind */
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_interface_ind_admin_state = { .name = "admin_state", .descr = "Current administrative state", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_INTERFACE_IND_ID_ADMIN_STATE, .offset = offsetof(bcmbal_interface_ind_data, admin_state), .type = &type_descr_bcmbal_state };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_interface_ind_oper_status = { .name = "oper_status", .descr = "Current operational state", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_INTERFACE_IND_ID_OPER_STATUS, .offset = offsetof(bcmbal_interface_ind_data, oper_status), .type = &type_descr_bcmbal_status };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_interface_ind_min_data_agg_port_id = { .name = "min_data_agg_port_id", .descr = "The minimum agg_port_id that is allowed in the system", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_INTERFACE_IND_ID_MIN_DATA_AGG_PORT_ID, .offset = offsetof(bcmbal_interface_ind_data, min_data_agg_port_id), .type = &type_descr_uint16_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_interface_ind_min_data_svc_port_id = { .name = "min_data_svc_port_id", .descr = "The minimum svc_port_id that is allowed in the system", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_INTERFACE_IND_ID_MIN_DATA_SVC_PORT_ID, .offset = offsetof(bcmbal_interface_ind_data, min_data_svc_port_id), .type = &type_descr_uint16_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_interface_ind_transceiver_type = { .name = "transceiver_type", .descr = "The transceiver type used on an interface", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_INTERFACE_IND_ID_TRANSCEIVER_TYPE, .offset = offsetof(bcmbal_interface_ind_data, transceiver_type), .type = &type_descr_bcmbal_trx_type };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_interface_ind_ds_miss_mode = { .name = "ds_miss_mode", .descr = "Defines the action to take for DS unknown packets", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_INTERFACE_IND_ID_DS_MISS_MODE, .offset = offsetof(bcmbal_interface_ind_data, ds_miss_mode), .type = &type_descr_bcmbal_ds_miss_mode };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_interface_ind_mtu = { .name = "mtu", .descr = "The MTU for an interface", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_INTERFACE_IND_ID_MTU, .offset = offsetof(bcmbal_interface_ind_data, mtu), .type = &type_descr_uint16_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_interface_ind_flow_control = { .name = "flow_control", .descr = "Flow control enable or disable", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_INTERFACE_IND_ID_FLOW_CONTROL, .offset = offsetof(bcmbal_interface_ind_data, flow_control), .type = &type_descr_bcmbal_control };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_interface_ind_ds_tm = { .name = "ds_tm", .descr = "Downstream scheduler and shaper", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_INTERFACE_IND_ID_DS_TM, .offset = offsetof(bcmbal_interface_ind_data, ds_tm), .type = &type_descr_uint32_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_interface_ind_us_tm = { .name = "us_tm", .descr = "Upstream scheduler and shaper", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_INTERFACE_IND_ID_US_TM, .offset = offsetof(bcmbal_interface_ind_data, us_tm), .type = &type_descr_uint32_t };
+static bcmbal_apicli_prop_descr * BCM_DESCR interface_ind_prop_array[] = { &prop_descr_interface_ind_admin_state, &prop_descr_interface_ind_oper_status, &prop_descr_interface_ind_min_data_agg_port_id, &prop_descr_interface_ind_min_data_svc_port_id, &prop_descr_interface_ind_transceiver_type, &prop_descr_interface_ind_ds_miss_mode, &prop_descr_interface_ind_mtu, &prop_descr_interface_ind_flow_control, &prop_descr_interface_ind_ds_tm, &prop_descr_interface_ind_us_tm };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_interface_ind_data_fields[] = { { .name = "admin_state", .descr = "Current administrative state", .offset = offsetof(bcmbal_interface_ind_data, admin_state), .type = &type_descr_bcmbal_state }, { .name = "oper_status", .descr = "Current operational state", .offset = offsetof(bcmbal_interface_ind_data, oper_status), .type = &type_descr_bcmbal_status }, { .name = "min_data_agg_port_id", .descr = "The minimum agg_port_id that is allowed in the system", .offset = offsetof(bcmbal_interface_ind_data, min_data_agg_port_id), .type = &type_descr_uint16_t }, { .name = "min_data_svc_port_id", .descr = "The minimum svc_port_id that is allowed in the system", .offset = offsetof(bcmbal_interface_ind_data, min_data_svc_port_id), .type = &type_descr_uint16_t }, { .name = "transceiver_type", .descr = "The transceiver type used on an interface", .offset = offsetof(bcmbal_interface_ind_data, transceiver_type), .type = &type_descr_bcmbal_trx_type }, { .name = "ds_miss_mode", .descr = "Defines the action to take for DS unknown packets", .offset = offsetof(bcmbal_interface_ind_data, ds_miss_mode), .type = &type_descr_bcmbal_ds_miss_mode }, { .name = "mtu", .descr = "The MTU for an interface", .offset = offsetof(bcmbal_interface_ind_data, mtu), .type = &type_descr_uint16_t }, { .name = "flow_control", .descr = "Flow control enable or disable", .offset = offsetof(bcmbal_interface_ind_data, flow_control), .type = &type_descr_bcmbal_control }, { .name = "ds_tm", .descr = "Downstream scheduler and shaper", .offset = offsetof(bcmbal_interface_ind_data, ds_tm), .type = &type_descr_uint32_t }, { .name = "us_tm", .descr = "Upstream scheduler and shaper", .offset = offsetof(bcmbal_interface_ind_data, us_tm), .type = &type_descr_uint32_t } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_interface_ind_data = { .name = "bcmbal_interface_ind_data", .descr = "Interface Indication", .size = sizeof(bcmbal_interface_ind_data), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_STRUCT, .x = { .s = { .num_fields = sizeof(type_descr_bcmbal_interface_ind_data_fields) / sizeof(bcmbal_apicli_field_descr), .fields = type_descr_bcmbal_interface_ind_data_fields } } };
+
+/* ==== Object: packet ==== */
+
+/* Group: packet - cfg */
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_packet_cfg_flow_id = { .name = "flow_id", .descr = "N/A for sending a packet", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_PACKET_CFG_ID_FLOW_ID, .offset = offsetof(bcmbal_packet_cfg_data, flow_id), .type = &type_descr_uint32_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_packet_cfg_flow_type = { .name = "flow_type", .descr = "Flow Type", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_PACKET_CFG_ID_FLOW_TYPE, .offset = offsetof(bcmbal_packet_cfg_data, flow_type), .type = &type_descr_bcmbal_flow_type };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_packet_cfg_intf_id = { .name = "intf_id", .descr = "Interface ID", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_PACKET_CFG_ID_INTF_ID, .offset = offsetof(bcmbal_packet_cfg_data, intf_id), .type = &type_descr_uint32_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_packet_cfg_intf_type = { .name = "intf_type", .descr = "Interface Type", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_PACKET_CFG_ID_INTF_TYPE, .offset = offsetof(bcmbal_packet_cfg_data, intf_type), .type = &type_descr_bcmbal_intf_type };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_packet_cfg_svc_port = { .name = "svc_port", .descr = "N/A for sending a packet", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_PACKET_CFG_ID_SVC_PORT, .offset = offsetof(bcmbal_packet_cfg_data, svc_port), .type = &type_descr_uint16_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_packet_cfg_flow_cookie = { .name = "flow_cookie", .descr = "N/A for sending a packet", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_PACKET_CFG_ID_FLOW_COOKIE, .offset = offsetof(bcmbal_packet_cfg_data, flow_cookie), .type = &type_descr_uint64_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_packet_cfg_pkt = { .name = "pkt", .descr = "Packet Data", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_PACKET_CFG_ID_PKT, .offset = offsetof(bcmbal_packet_cfg_data, pkt), .type = &type_descr_bcmbal_u8_list_u32 };
+static bcmbal_apicli_prop_descr * BCM_DESCR packet_cfg_prop_array[] = { &prop_descr_packet_cfg_flow_id, &prop_descr_packet_cfg_flow_type, &prop_descr_packet_cfg_intf_id, &prop_descr_packet_cfg_intf_type, &prop_descr_packet_cfg_svc_port, &prop_descr_packet_cfg_flow_cookie, &prop_descr_packet_cfg_pkt };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_packet_cfg_data_fields[] = { { .name = "flow_id", .descr = "N/A for sending a packet", .offset = offsetof(bcmbal_packet_cfg_data, flow_id), .type = &type_descr_uint32_t }, { .name = "flow_type", .descr = "Flow Type", .offset = offsetof(bcmbal_packet_cfg_data, flow_type), .type = &type_descr_bcmbal_flow_type }, { .name = "intf_id", .descr = "Interface ID", .offset = offsetof(bcmbal_packet_cfg_data, intf_id), .type = &type_descr_uint32_t }, { .name = "intf_type", .descr = "Interface Type", .offset = offsetof(bcmbal_packet_cfg_data, intf_type), .type = &type_descr_bcmbal_intf_type }, { .name = "svc_port", .descr = "N/A for sending a packet", .offset = offsetof(bcmbal_packet_cfg_data, svc_port), .type = &type_descr_uint16_t }, { .name = "flow_cookie", .descr = "N/A for sending a packet", .offset = offsetof(bcmbal_packet_cfg_data, flow_cookie), .type = &type_descr_uint64_t }, { .name = "pkt", .descr = "Packet Data", .offset = offsetof(bcmbal_packet_cfg_data, pkt), .type = &type_descr_bcmbal_u8_list_u32 } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_packet_cfg_data = { .name = "bcmbal_packet_cfg_data", .descr = "cfg", .size = sizeof(bcmbal_packet_cfg_data), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_STRUCT, .x = { .s = { .num_fields = sizeof(type_descr_bcmbal_packet_cfg_data_fields) / sizeof(bcmbal_apicli_field_descr), .fields = type_descr_bcmbal_packet_cfg_data_fields } } };
+
+/* Group: packet - key */
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_packet_key_reserved = { .name = "reserved", .descr = "Reserved key field", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_PACKET_KEY_ID_RESERVED, .offset = offsetof(bcmbal_packet_key, reserved), .type = &type_descr_uint32_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_packet_key_packet_send_dest = { .name = "packet_send_dest", .descr = "Packet destination", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_PACKET_KEY_ID_PACKET_SEND_DEST, .offset = offsetof(bcmbal_packet_key, packet_send_dest), .type = &type_descr_bcmbal_dest };
+static bcmbal_apicli_prop_descr * BCM_DESCR packet_key_prop_array[] = { &prop_descr_packet_key_reserved, &prop_descr_packet_key_packet_send_dest };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_packet_key_fields[] = { { .name = "reserved", .descr = "Reserved key field", .offset = offsetof(bcmbal_packet_key, reserved), .type = &type_descr_uint32_t }, { .name = "packet_send_dest", .descr = "Packet destination", .offset = offsetof(bcmbal_packet_key, packet_send_dest), .type = &type_descr_bcmbal_dest } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_packet_key = { .name = "bcmbal_packet_key", .descr = "key", .size = sizeof(bcmbal_packet_key), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_STRUCT, .x = { .s = { .num_fields = sizeof(type_descr_bcmbal_packet_key_fields) / sizeof(bcmbal_apicli_field_descr), .fields = type_descr_bcmbal_packet_key_fields } } };
+
+/* Group: packet - ind */
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_packet_ind_flow_id = { .name = "flow_id", .descr = "N/A for sending a packet", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_PACKET_IND_ID_FLOW_ID, .offset = offsetof(bcmbal_packet_ind_data, flow_id), .type = &type_descr_uint32_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_packet_ind_flow_type = { .name = "flow_type", .descr = "Flow Type", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_PACKET_IND_ID_FLOW_TYPE, .offset = offsetof(bcmbal_packet_ind_data, flow_type), .type = &type_descr_bcmbal_flow_type };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_packet_ind_intf_id = { .name = "intf_id", .descr = "Interface ID", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_PACKET_IND_ID_INTF_ID, .offset = offsetof(bcmbal_packet_ind_data, intf_id), .type = &type_descr_uint32_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_packet_ind_intf_type = { .name = "intf_type", .descr = "Interface Type", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_PACKET_IND_ID_INTF_TYPE, .offset = offsetof(bcmbal_packet_ind_data, intf_type), .type = &type_descr_bcmbal_intf_type };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_packet_ind_svc_port = { .name = "svc_port", .descr = "N/A for sending a packet", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_PACKET_IND_ID_SVC_PORT, .offset = offsetof(bcmbal_packet_ind_data, svc_port), .type = &type_descr_uint16_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_packet_ind_flow_cookie = { .name = "flow_cookie", .descr = "N/A for sending a packet", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_PACKET_IND_ID_FLOW_COOKIE, .offset = offsetof(bcmbal_packet_ind_data, flow_cookie), .type = &type_descr_uint64_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_packet_ind_pkt = { .name = "pkt", .descr = "Packet Data", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_PACKET_IND_ID_PKT, .offset = offsetof(bcmbal_packet_ind_data, pkt), .type = &type_descr_bcmbal_u8_list_u32 };
+static bcmbal_apicli_prop_descr * BCM_DESCR packet_ind_prop_array[] = { &prop_descr_packet_ind_flow_id, &prop_descr_packet_ind_flow_type, &prop_descr_packet_ind_intf_id, &prop_descr_packet_ind_intf_type, &prop_descr_packet_ind_svc_port, &prop_descr_packet_ind_flow_cookie, &prop_descr_packet_ind_pkt };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_packet_ind_data_fields[] = { { .name = "flow_id", .descr = "N/A for sending a packet", .offset = offsetof(bcmbal_packet_ind_data, flow_id), .type = &type_descr_uint32_t }, { .name = "flow_type", .descr = "Flow Type", .offset = offsetof(bcmbal_packet_ind_data, flow_type), .type = &type_descr_bcmbal_flow_type }, { .name = "intf_id", .descr = "Interface ID", .offset = offsetof(bcmbal_packet_ind_data, intf_id), .type = &type_descr_uint32_t }, { .name = "intf_type", .descr = "Interface Type", .offset = offsetof(bcmbal_packet_ind_data, intf_type), .type = &type_descr_bcmbal_intf_type }, { .name = "svc_port", .descr = "N/A for sending a packet", .offset = offsetof(bcmbal_packet_ind_data, svc_port), .type = &type_descr_uint16_t }, { .name = "flow_cookie", .descr = "N/A for sending a packet", .offset = offsetof(bcmbal_packet_ind_data, flow_cookie), .type = &type_descr_uint64_t }, { .name = "pkt", .descr = "Packet Data", .offset = offsetof(bcmbal_packet_ind_data, pkt), .type = &type_descr_bcmbal_u8_list_u32 } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_packet_ind_data = { .name = "bcmbal_packet_ind_data", .descr = "Packet indication", .size = sizeof(bcmbal_packet_ind_data), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_STRUCT, .x = { .s = { .num_fields = sizeof(type_descr_bcmbal_packet_ind_data_fields) / sizeof(bcmbal_apicli_field_descr), .fields = type_descr_bcmbal_packet_ind_data_fields } } };
+
+/* ==== Object: subscriber_terminal ==== */
+
+/* Group: subscriber_terminal - key */
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_subscriber_terminal_key_sub_term_id = { .name = "sub_term_id", .descr = "sub_term_id", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_SUBSCRIBER_TERMINAL_KEY_ID_SUB_TERM_ID, .offset = offsetof(bcmbal_subscriber_terminal_key, sub_term_id), .type = &type_descr_uint32_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_subscriber_terminal_key_intf_id = { .name = "intf_id", .descr = "intf_id", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_SUBSCRIBER_TERMINAL_KEY_ID_INTF_ID, .offset = offsetof(bcmbal_subscriber_terminal_key, intf_id), .type = &type_descr_uint32_t };
+static bcmbal_apicli_prop_descr * BCM_DESCR subscriber_terminal_key_prop_array[] = { &prop_descr_subscriber_terminal_key_sub_term_id, &prop_descr_subscriber_terminal_key_intf_id };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_subscriber_terminal_key_fields[] = { { .name = "sub_term_id", .descr = "sub_term_id", .offset = offsetof(bcmbal_subscriber_terminal_key, sub_term_id), .type = &type_descr_uint32_t }, { .name = "intf_id", .descr = "intf_id", .offset = offsetof(bcmbal_subscriber_terminal_key, intf_id), .type = &type_descr_uint32_t } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_subscriber_terminal_key = { .name = "bcmbal_subscriber_terminal_key", .descr = "key", .size = sizeof(bcmbal_subscriber_terminal_key), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_STRUCT, .x = { .s = { .num_fields = sizeof(type_descr_bcmbal_subscriber_terminal_key_fields) / sizeof(bcmbal_apicli_field_descr), .fields = type_descr_bcmbal_subscriber_terminal_key_fields } } };
+
+/* Group: subscriber_terminal - cfg */
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_subscriber_terminal_cfg_admin_state = { .name = "admin_state", .descr = "Administrative state", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_ADMIN_STATE, .offset = offsetof(bcmbal_subscriber_terminal_cfg_data, admin_state), .type = &type_descr_bcmbal_state };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_subscriber_terminal_cfg_oper_status = { .name = "oper_status", .descr = "Operational status", .access = BCMBAL_APICLI_PROP_ACCESS_ID_R, .property = BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_OPER_STATUS, .offset = offsetof(bcmbal_subscriber_terminal_cfg_data, oper_status), .type = &type_descr_bcmbal_status };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_subscriber_terminal_cfg_serial_number = { .name = "serial_number", .descr = "The serial number of an ITU PON (GPON/XG-PON1/XGS-PON/NG-PON2) subscriber terminal", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_SERIAL_NUMBER, .offset = offsetof(bcmbal_subscriber_terminal_cfg_data, serial_number), .type = &type_descr_bcmbal_serial_number };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_subscriber_terminal_cfg_password = { .name = "password", .descr = "The password of a GPON subscriber terminal", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_PASSWORD, .offset = offsetof(bcmbal_subscriber_terminal_cfg_data, password), .type = &type_descr_bcmbal_password };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_subscriber_terminal_cfg_registration_id = { .name = "registration_id", .descr = "ONU registration ID of an ITU PON (XG-PON1/XGS-PON/NG-PON2) subscriber terminal", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_REGISTRATION_ID, .offset = offsetof(bcmbal_subscriber_terminal_cfg_data, registration_id), .type = &type_descr_bcmbal_registration_id };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_subscriber_terminal_cfg_svc_port_id = { .name = "svc_port_id", .descr = "The management service port ID (for PON, the ONU ID)", .access = BCMBAL_APICLI_PROP_ACCESS_ID_R, .property = BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_SVC_PORT_ID, .offset = offsetof(bcmbal_subscriber_terminal_cfg_data, svc_port_id), .type = &type_descr_uint16_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_subscriber_terminal_cfg_mac_address = { .name = "mac_address", .descr = "The Ethernet MAC address of an EPON subscriber terminal", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_MAC_ADDRESS, .offset = offsetof(bcmbal_subscriber_terminal_cfg_data, mac_address), .type = &type_descr_bcmos_mac_address };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_subscriber_terminal_cfg_ds_tm = { .name = "ds_tm", .descr = "Downstream scheduler and shaper", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_DS_TM, .offset = offsetof(bcmbal_subscriber_terminal_cfg_data, ds_tm), .type = &type_descr_uint32_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_subscriber_terminal_cfg_us_tm = { .name = "us_tm", .descr = "Upstream scheduler and shaper", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_US_TM, .offset = offsetof(bcmbal_subscriber_terminal_cfg_data, us_tm), .type = &type_descr_uint32_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_subscriber_terminal_cfg_svc_port_id_list = { .name = "svc_port_id_list", .descr = "A list of bearer traffic svc_port_ids associated with this subscriber terminal", .access = BCMBAL_APICLI_PROP_ACCESS_ID_R, .property = BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_SVC_PORT_ID_LIST, .offset = offsetof(bcmbal_subscriber_terminal_cfg_data, svc_port_id_list), .type = &type_descr_bcmbal_service_port_id_list_u8 };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_subscriber_terminal_cfg_agg_port_id_list = { .name = "agg_port_id_list", .descr = "A list of aggr_port_ids associated with this subscriber terminal", .access = BCMBAL_APICLI_PROP_ACCESS_ID_R, .property = BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_AGG_PORT_ID_LIST, .offset = offsetof(bcmbal_subscriber_terminal_cfg_data, agg_port_id_list), .type = &type_descr_bcmbal_aggregation_port_id_list_u8 };
+static bcmbal_apicli_prop_descr * BCM_DESCR subscriber_terminal_cfg_prop_array[] = { &prop_descr_subscriber_terminal_cfg_admin_state, &prop_descr_subscriber_terminal_cfg_oper_status, &prop_descr_subscriber_terminal_cfg_serial_number, &prop_descr_subscriber_terminal_cfg_password, &prop_descr_subscriber_terminal_cfg_registration_id, &prop_descr_subscriber_terminal_cfg_svc_port_id, &prop_descr_subscriber_terminal_cfg_mac_address, &prop_descr_subscriber_terminal_cfg_ds_tm, &prop_descr_subscriber_terminal_cfg_us_tm, &prop_descr_subscriber_terminal_cfg_svc_port_id_list, &prop_descr_subscriber_terminal_cfg_agg_port_id_list };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_subscriber_terminal_cfg_data_fields[] = { { .name = "admin_state", .descr = "Administrative state", .offset = offsetof(bcmbal_subscriber_terminal_cfg_data, admin_state), .type = &type_descr_bcmbal_state }, { .name = "oper_status", .descr = "Operational status", .offset = offsetof(bcmbal_subscriber_terminal_cfg_data, oper_status), .type = &type_descr_bcmbal_status }, { .name = "serial_number", .descr = "The serial number of an ITU PON (GPON/XG-PON1/XGS-PON/NG-PON2) subscriber terminal", .offset = offsetof(bcmbal_subscriber_terminal_cfg_data, serial_number), .type = &type_descr_bcmbal_serial_number }, { .name = "password", .descr = "The password of a GPON subscriber terminal", .offset = offsetof(bcmbal_subscriber_terminal_cfg_data, password), .type = &type_descr_bcmbal_password }, { .name = "registration_id", .descr = "ONU registration ID of an ITU PON (XG-PON1/XGS-PON/NG-PON2) subscriber terminal", .offset = offsetof(bcmbal_subscriber_terminal_cfg_data, registration_id), .type = &type_descr_bcmbal_registration_id }, { .name = "svc_port_id", .descr = "The management service port ID (for PON, the ONU ID)", .offset = offsetof(bcmbal_subscriber_terminal_cfg_data, svc_port_id), .type = &type_descr_uint16_t }, { .name = "mac_address", .descr = "The Ethernet MAC address of an EPON subscriber terminal", .offset = offsetof(bcmbal_subscriber_terminal_cfg_data, mac_address), .type = &type_descr_bcmos_mac_address }, { .name = "ds_tm", .descr = "Downstream scheduler and shaper", .offset = offsetof(bcmbal_subscriber_terminal_cfg_data, ds_tm), .type = &type_descr_uint32_t }, { .name = "us_tm", .descr = "Upstream scheduler and shaper", .offset = offsetof(bcmbal_subscriber_terminal_cfg_data, us_tm), .type = &type_descr_uint32_t }, { .name = "svc_port_id_list", .descr = "A list of bearer traffic svc_port_ids associated with this subscriber terminal", .offset = offsetof(bcmbal_subscriber_terminal_cfg_data, svc_port_id_list), .type = &type_descr_bcmbal_service_port_id_list_u8 }, { .name = "agg_port_id_list", .descr = "A list of aggr_port_ids associated with this subscriber terminal", .offset = offsetof(bcmbal_subscriber_terminal_cfg_data, agg_port_id_list), .type = &type_descr_bcmbal_aggregation_port_id_list_u8 } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_subscriber_terminal_cfg_data = { .name = "bcmbal_subscriber_terminal_cfg_data", .descr = "cfg", .size = sizeof(bcmbal_subscriber_terminal_cfg_data), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_STRUCT, .x = { .s = { .num_fields = sizeof(type_descr_bcmbal_subscriber_terminal_cfg_data_fields) / sizeof(bcmbal_apicli_field_descr), .fields = type_descr_bcmbal_subscriber_terminal_cfg_data_fields } } };
+
+/* Group: subscriber_terminal - stat */
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_subscriber_terminal_stat_rx_packets = { .name = "rx_packets", .descr = "Received packets on specified object", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_SUBSCRIBER_TERMINAL_STAT_ID_RX_PACKETS, .offset = offsetof(bcmbal_subscriber_terminal_stat_data, rx_packets), .type = &type_descr_uint64_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_subscriber_terminal_stat_rx_bytes = { .name = "rx_bytes", .descr = "Received bytes on specified object", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_SUBSCRIBER_TERMINAL_STAT_ID_RX_BYTES, .offset = offsetof(bcmbal_subscriber_terminal_stat_data, rx_bytes), .type = &type_descr_uint64_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_subscriber_terminal_stat_tx_packets = { .name = "tx_packets", .descr = "Transmitted packets on specified object", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_SUBSCRIBER_TERMINAL_STAT_ID_TX_PACKETS, .offset = offsetof(bcmbal_subscriber_terminal_stat_data, tx_packets), .type = &type_descr_uint64_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_subscriber_terminal_stat_tx_bytes = { .name = "tx_bytes", .descr = "Transmittted bytes on specified object", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_SUBSCRIBER_TERMINAL_STAT_ID_TX_BYTES, .offset = offsetof(bcmbal_subscriber_terminal_stat_data, tx_bytes), .type = &type_descr_uint64_t };
+static bcmbal_apicli_prop_descr * BCM_DESCR subscriber_terminal_stat_prop_array[] = { &prop_descr_subscriber_terminal_stat_rx_packets, &prop_descr_subscriber_terminal_stat_rx_bytes, &prop_descr_subscriber_terminal_stat_tx_packets, &prop_descr_subscriber_terminal_stat_tx_bytes };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_subscriber_terminal_stat_data_fields[] = { { .name = "rx_packets", .descr = "Received packets on specified object", .offset = offsetof(bcmbal_subscriber_terminal_stat_data, rx_packets), .type = &type_descr_uint64_t }, { .name = "rx_bytes", .descr = "Received bytes on specified object", .offset = offsetof(bcmbal_subscriber_terminal_stat_data, rx_bytes), .type = &type_descr_uint64_t }, { .name = "tx_packets", .descr = "Transmitted packets on specified object", .offset = offsetof(bcmbal_subscriber_terminal_stat_data, tx_packets), .type = &type_descr_uint64_t }, { .name = "tx_bytes", .descr = "Transmittted bytes on specified object", .offset = offsetof(bcmbal_subscriber_terminal_stat_data, tx_bytes), .type = &type_descr_uint64_t } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_subscriber_terminal_stat_data = { .name = "bcmbal_subscriber_terminal_stat_data", .descr = "stat", .size = sizeof(bcmbal_subscriber_terminal_stat_data), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_STRUCT, .x = { .s = { .num_fields = sizeof(type_descr_bcmbal_subscriber_terminal_stat_data_fields) / sizeof(bcmbal_apicli_field_descr), .fields = type_descr_bcmbal_subscriber_terminal_stat_data_fields } } };
+
+/* Group: subscriber_terminal - ind */
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_subscriber_terminal_ind_admin_state = { .name = "admin_state", .descr = "Current administrative state", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_ADMIN_STATE, .offset = offsetof(bcmbal_subscriber_terminal_ind_data, admin_state), .type = &type_descr_bcmbal_state };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_subscriber_terminal_ind_oper_status = { .name = "oper_status", .descr = "Current operational status", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_OPER_STATUS, .offset = offsetof(bcmbal_subscriber_terminal_ind_data, oper_status), .type = &type_descr_bcmbal_status };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_subscriber_terminal_ind_serial_number = { .name = "serial_number", .descr = "The serial number of an ITU PON (GPON/XG-PON1/XGS-PON/NG-PON2) subscriber terminal", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_SERIAL_NUMBER, .offset = offsetof(bcmbal_subscriber_terminal_ind_data, serial_number), .type = &type_descr_bcmbal_serial_number };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_subscriber_terminal_ind_password = { .name = "password", .descr = "The password of a GPON subscriber terminal", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_PASSWORD, .offset = offsetof(bcmbal_subscriber_terminal_ind_data, password), .type = &type_descr_bcmbal_password };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_subscriber_terminal_ind_registration_id = { .name = "registration_id", .descr = "ONU registration ID of an ITU PON (XG-PON1/XGS-PON/NG-PON2) subscriber terminal", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_REGISTRATION_ID, .offset = offsetof(bcmbal_subscriber_terminal_ind_data, registration_id), .type = &type_descr_bcmbal_registration_id };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_subscriber_terminal_ind_svc_port_id = { .name = "svc_port_id", .descr = "The service port ID (for PON, the ONU ID)", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_SVC_PORT_ID, .offset = offsetof(bcmbal_subscriber_terminal_ind_data, svc_port_id), .type = &type_descr_uint16_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_subscriber_terminal_ind_mac_address = { .name = "mac_address", .descr = "The Ethernet MAC address of an epon subscriber terminal", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_MAC_ADDRESS, .offset = offsetof(bcmbal_subscriber_terminal_ind_data, mac_address), .type = &type_descr_bcmos_mac_address };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_subscriber_terminal_ind_ds_tm = { .name = "ds_tm", .descr = "Downstream scheduler and shaper", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_DS_TM, .offset = offsetof(bcmbal_subscriber_terminal_ind_data, ds_tm), .type = &type_descr_uint32_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_subscriber_terminal_ind_us_tm = { .name = "us_tm", .descr = "Upstream scheduler and shaper", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_US_TM, .offset = offsetof(bcmbal_subscriber_terminal_ind_data, us_tm), .type = &type_descr_uint32_t };
+static bcmbal_apicli_prop_descr * BCM_DESCR subscriber_terminal_ind_prop_array[] = { &prop_descr_subscriber_terminal_ind_admin_state, &prop_descr_subscriber_terminal_ind_oper_status, &prop_descr_subscriber_terminal_ind_serial_number, &prop_descr_subscriber_terminal_ind_password, &prop_descr_subscriber_terminal_ind_registration_id, &prop_descr_subscriber_terminal_ind_svc_port_id, &prop_descr_subscriber_terminal_ind_mac_address, &prop_descr_subscriber_terminal_ind_ds_tm, &prop_descr_subscriber_terminal_ind_us_tm };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_subscriber_terminal_ind_data_fields[] = { { .name = "admin_state", .descr = "Current administrative state", .offset = offsetof(bcmbal_subscriber_terminal_ind_data, admin_state), .type = &type_descr_bcmbal_state }, { .name = "oper_status", .descr = "Current operational status", .offset = offsetof(bcmbal_subscriber_terminal_ind_data, oper_status), .type = &type_descr_bcmbal_status }, { .name = "serial_number", .descr = "The serial number of an ITU PON (GPON/XG-PON1/XGS-PON/NG-PON2) subscriber terminal", .offset = offsetof(bcmbal_subscriber_terminal_ind_data, serial_number), .type = &type_descr_bcmbal_serial_number }, { .name = "password", .descr = "The password of a GPON subscriber terminal", .offset = offsetof(bcmbal_subscriber_terminal_ind_data, password), .type = &type_descr_bcmbal_password }, { .name = "registration_id", .descr = "ONU registration ID of an ITU PON (XG-PON1/XGS-PON/NG-PON2) subscriber terminal", .offset = offsetof(bcmbal_subscriber_terminal_ind_data, registration_id), .type = &type_descr_bcmbal_registration_id }, { .name = "svc_port_id", .descr = "The service port ID (for PON, the ONU ID)", .offset = offsetof(bcmbal_subscriber_terminal_ind_data, svc_port_id), .type = &type_descr_uint16_t }, { .name = "mac_address", .descr = "The Ethernet MAC address of an epon subscriber terminal", .offset = offsetof(bcmbal_subscriber_terminal_ind_data, mac_address), .type = &type_descr_bcmos_mac_address }, { .name = "ds_tm", .descr = "Downstream scheduler and shaper", .offset = offsetof(bcmbal_subscriber_terminal_ind_data, ds_tm), .type = &type_descr_uint32_t }, { .name = "us_tm", .descr = "Upstream scheduler and shaper", .offset = offsetof(bcmbal_subscriber_terminal_ind_data, us_tm), .type = &type_descr_uint32_t } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_subscriber_terminal_ind_data = { .name = "bcmbal_subscriber_terminal_ind_data", .descr = "Subscriber Terminal Indication", .size = sizeof(bcmbal_subscriber_terminal_ind_data), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_STRUCT, .x = { .s = { .num_fields = sizeof(type_descr_bcmbal_subscriber_terminal_ind_data_fields) / sizeof(bcmbal_apicli_field_descr), .fields = type_descr_bcmbal_subscriber_terminal_ind_data_fields } } };
+
+/* ==== Object: tm_queue ==== */
+
+/* Group: tm_queue - key */
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_tm_queue_key_sched_id = { .name = "sched_id", .descr = "Scheduler that owns the queue", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_TM_QUEUE_KEY_ID_SCHED_ID, .offset = offsetof(bcmbal_tm_queue_key, sched_id), .type = &type_descr_uint32_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_tm_queue_key_sched_dir = { .name = "sched_dir", .descr = "sched dir", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_TM_QUEUE_KEY_ID_SCHED_DIR, .offset = offsetof(bcmbal_tm_queue_key, sched_dir), .type = &type_descr_bcmbal_tm_sched_dir };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_tm_queue_key_id = { .name = "id", .descr = "Queue id", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_TM_QUEUE_KEY_ID_ID, .offset = offsetof(bcmbal_tm_queue_key, id), .type = &type_descr_uint8_t };
+static bcmbal_apicli_prop_descr * BCM_DESCR tm_queue_key_prop_array[] = { &prop_descr_tm_queue_key_sched_id, &prop_descr_tm_queue_key_sched_dir, &prop_descr_tm_queue_key_id };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_tm_queue_key_fields[] = { { .name = "sched_id", .descr = "Scheduler that owns the queue", .offset = offsetof(bcmbal_tm_queue_key, sched_id), .type = &type_descr_uint32_t }, { .name = "sched_dir", .descr = "sched dir", .offset = offsetof(bcmbal_tm_queue_key, sched_dir), .type = &type_descr_bcmbal_tm_sched_dir }, { .name = "id", .descr = "Queue id", .offset = offsetof(bcmbal_tm_queue_key, id), .type = &type_descr_uint8_t } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_tm_queue_key = { .name = "bcmbal_tm_queue_key", .descr = "key", .size = sizeof(bcmbal_tm_queue_key), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_STRUCT, .x = { .s = { .num_fields = sizeof(type_descr_bcmbal_tm_queue_key_fields) / sizeof(bcmbal_apicli_field_descr), .fields = type_descr_bcmbal_tm_queue_key_fields } } };
+
+/* Group: tm_queue - cfg */
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_tm_queue_cfg_priority = { .name = "priority", .descr = "Scheduling priority", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_TM_QUEUE_CFG_ID_PRIORITY, .offset = offsetof(bcmbal_tm_queue_cfg_data, priority), .type = &type_descr_uint8_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_tm_queue_cfg_weight = { .name = "weight", .descr = "Scheduling weight", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_TM_QUEUE_CFG_ID_WEIGHT, .offset = offsetof(bcmbal_tm_queue_cfg_data, weight), .type = &type_descr_uint8_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_tm_queue_cfg_rate = { .name = "rate", .descr = "Rate shaping parameters", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_TM_QUEUE_CFG_ID_RATE, .offset = offsetof(bcmbal_tm_queue_cfg_data, rate), .type = &type_descr_bcmbal_tm_shaping };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_tm_queue_cfg_bac = { .name = "bac", .descr = "Buffer admission control", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_TM_QUEUE_CFG_ID_BAC, .offset = offsetof(bcmbal_tm_queue_cfg_data, bac), .type = &type_descr_bcmbal_tm_bac };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_tm_queue_cfg_creation_mode = { .name = "creation_mode", .descr = "Creation mode", .access = BCMBAL_APICLI_PROP_ACCESS_ID_R, .property = BCMBAL_TM_QUEUE_CFG_ID_CREATION_MODE, .offset = offsetof(bcmbal_tm_queue_cfg_data, creation_mode), .type = &type_descr_bcmbal_tm_creation_mode };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_tm_queue_cfg_ref_count = { .name = "ref_count", .descr = "reference count (flows)", .access = BCMBAL_APICLI_PROP_ACCESS_ID_R, .property = BCMBAL_TM_QUEUE_CFG_ID_REF_COUNT, .offset = offsetof(bcmbal_tm_queue_cfg_data, ref_count), .type = &type_descr_uint8_t };
+static bcmbal_apicli_prop_descr * BCM_DESCR tm_queue_cfg_prop_array[] = { &prop_descr_tm_queue_cfg_priority, &prop_descr_tm_queue_cfg_weight, &prop_descr_tm_queue_cfg_rate, &prop_descr_tm_queue_cfg_bac, &prop_descr_tm_queue_cfg_creation_mode, &prop_descr_tm_queue_cfg_ref_count };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_tm_queue_cfg_data_fields[] = { { .name = "priority", .descr = "Scheduling priority", .offset = offsetof(bcmbal_tm_queue_cfg_data, priority), .type = &type_descr_uint8_t }, { .name = "weight", .descr = "Scheduling weight", .offset = offsetof(bcmbal_tm_queue_cfg_data, weight), .type = &type_descr_uint8_t }, { .name = "rate", .descr = "Rate shaping parameters", .offset = offsetof(bcmbal_tm_queue_cfg_data, rate), .type = &type_descr_bcmbal_tm_shaping }, { .name = "bac", .descr = "Buffer admission control", .offset = offsetof(bcmbal_tm_queue_cfg_data, bac), .type = &type_descr_bcmbal_tm_bac }, { .name = "creation_mode", .descr = "Creation mode", .offset = offsetof(bcmbal_tm_queue_cfg_data, creation_mode), .type = &type_descr_bcmbal_tm_creation_mode }, { .name = "ref_count", .descr = "reference count (flows)", .offset = offsetof(bcmbal_tm_queue_cfg_data, ref_count), .type = &type_descr_uint8_t } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_tm_queue_cfg_data = { .name = "bcmbal_tm_queue_cfg_data", .descr = "cfg", .size = sizeof(bcmbal_tm_queue_cfg_data), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_STRUCT, .x = { .s = { .num_fields = sizeof(type_descr_bcmbal_tm_queue_cfg_data_fields) / sizeof(bcmbal_apicli_field_descr), .fields = type_descr_bcmbal_tm_queue_cfg_data_fields } } };
+
+/* Group: tm_queue - stat */
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_tm_queue_stat_packets_ok = { .name = "packets_ok", .descr = "Packets transmitted succewssfully", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_TM_QUEUE_STAT_ID_PACKETS_OK, .offset = offsetof(bcmbal_tm_queue_stat_data, packets_ok), .type = &type_descr_uint64_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_tm_queue_stat_bytes_ok = { .name = "bytes_ok", .descr = "Bytes transmitted successfully", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_TM_QUEUE_STAT_ID_BYTES_OK, .offset = offsetof(bcmbal_tm_queue_stat_data, bytes_ok), .type = &type_descr_uint64_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_tm_queue_stat_packets_discarded = { .name = "packets_discarded", .descr = "Packets discarded", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_TM_QUEUE_STAT_ID_PACKETS_DISCARDED, .offset = offsetof(bcmbal_tm_queue_stat_data, packets_discarded), .type = &type_descr_uint64_t };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_tm_queue_stat_bytes_discarded = { .name = "bytes_discarded", .descr = "Bytes discarded", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_TM_QUEUE_STAT_ID_BYTES_DISCARDED, .offset = offsetof(bcmbal_tm_queue_stat_data, bytes_discarded), .type = &type_descr_uint64_t };
+static bcmbal_apicli_prop_descr * BCM_DESCR tm_queue_stat_prop_array[] = { &prop_descr_tm_queue_stat_packets_ok, &prop_descr_tm_queue_stat_bytes_ok, &prop_descr_tm_queue_stat_packets_discarded, &prop_descr_tm_queue_stat_bytes_discarded };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_tm_queue_stat_data_fields[] = { { .name = "packets_ok", .descr = "Packets transmitted succewssfully", .offset = offsetof(bcmbal_tm_queue_stat_data, packets_ok), .type = &type_descr_uint64_t }, { .name = "bytes_ok", .descr = "Bytes transmitted successfully", .offset = offsetof(bcmbal_tm_queue_stat_data, bytes_ok), .type = &type_descr_uint64_t }, { .name = "packets_discarded", .descr = "Packets discarded", .offset = offsetof(bcmbal_tm_queue_stat_data, packets_discarded), .type = &type_descr_uint64_t }, { .name = "bytes_discarded", .descr = "Bytes discarded", .offset = offsetof(bcmbal_tm_queue_stat_data, bytes_discarded), .type = &type_descr_uint64_t } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_tm_queue_stat_data = { .name = "bcmbal_tm_queue_stat_data", .descr = "stat", .size = sizeof(bcmbal_tm_queue_stat_data), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_STRUCT, .x = { .s = { .num_fields = sizeof(type_descr_bcmbal_tm_queue_stat_data_fields) / sizeof(bcmbal_apicli_field_descr), .fields = type_descr_bcmbal_tm_queue_stat_data_fields } } };
+
+/* Group: tm_queue - ind */
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_tm_queue_ind_ret = { .name = "ret", .descr = "ret", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_TM_QUEUE_IND_ID_RET, .offset = offsetof(bcmbal_tm_queue_ind_data, ret), .type = &type_descr_uint32_t };
+static bcmbal_apicli_prop_descr * BCM_DESCR tm_queue_ind_prop_array[] = { &prop_descr_tm_queue_ind_ret };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_tm_queue_ind_data_fields[] = { { .name = "ret", .descr = "ret", .offset = offsetof(bcmbal_tm_queue_ind_data, ret), .type = &type_descr_uint32_t } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_tm_queue_ind_data = { .name = "bcmbal_tm_queue_ind_data", .descr = "Tm Queue Indication", .size = sizeof(bcmbal_tm_queue_ind_data), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_STRUCT, .x = { .s = { .num_fields = sizeof(type_descr_bcmbal_tm_queue_ind_data_fields) / sizeof(bcmbal_apicli_field_descr), .fields = type_descr_bcmbal_tm_queue_ind_data_fields } } };
+
+/* ==== Object: tm_sched ==== */
+
+/* Group: tm_sched - key */
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_tm_sched_key_dir = { .name = "dir", .descr = "Traffic direction", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_TM_SCHED_KEY_ID_DIR, .offset = offsetof(bcmbal_tm_sched_key, dir), .type = &type_descr_bcmbal_tm_sched_dir };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_tm_sched_key_id = { .name = "id", .descr = "ID", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_TM_SCHED_KEY_ID_ID, .offset = offsetof(bcmbal_tm_sched_key, id), .type = &type_descr_uint32_t };
+static bcmbal_apicli_prop_descr * BCM_DESCR tm_sched_key_prop_array[] = { &prop_descr_tm_sched_key_dir, &prop_descr_tm_sched_key_id };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_tm_sched_key_fields[] = { { .name = "dir", .descr = "Traffic direction", .offset = offsetof(bcmbal_tm_sched_key, dir), .type = &type_descr_bcmbal_tm_sched_dir }, { .name = "id", .descr = "ID", .offset = offsetof(bcmbal_tm_sched_key, id), .type = &type_descr_uint32_t } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_tm_sched_key = { .name = "bcmbal_tm_sched_key", .descr = "key", .size = sizeof(bcmbal_tm_sched_key), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_STRUCT, .x = { .s = { .num_fields = sizeof(type_descr_bcmbal_tm_sched_key_fields) / sizeof(bcmbal_apicli_field_descr), .fields = type_descr_bcmbal_tm_sched_key_fields } } };
+
+/* Group: tm_sched - cfg */
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_tm_sched_cfg_owner = { .name = "owner", .descr = "owner", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_TM_SCHED_CFG_ID_OWNER, .offset = offsetof(bcmbal_tm_sched_cfg_data, owner), .type = &type_descr_bcmbal_tm_sched_owner };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_tm_sched_cfg_sched_type = { .name = "sched_type", .descr = "Scheduler type", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_TM_SCHED_CFG_ID_SCHED_TYPE, .offset = offsetof(bcmbal_tm_sched_cfg_data, sched_type), .type = &type_descr_bcmbal_tm_sched_type };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_tm_sched_cfg_sched_parent = { .name = "sched_parent", .descr = "Scheduling parameters for parent scheduler", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_TM_SCHED_CFG_ID_SCHED_PARENT, .offset = offsetof(bcmbal_tm_sched_cfg_data, sched_parent), .type = &type_descr_bcmbal_tm_sched_parent };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_tm_sched_cfg_sched_child_type = { .name = "sched_child_type", .descr = "Scheduling level for children tm ", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_TM_SCHED_CFG_ID_SCHED_CHILD_TYPE, .offset = offsetof(bcmbal_tm_sched_cfg_data, sched_child_type), .type = &type_descr_bcmbal_tm_sched_child_type };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_tm_sched_cfg_rate = { .name = "rate", .descr = "Rate shaping parameters", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_TM_SCHED_CFG_ID_RATE, .offset = offsetof(bcmbal_tm_sched_cfg_data, rate), .type = &type_descr_bcmbal_tm_shaping };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_tm_sched_cfg_tcont_sla = { .name = "tcont_sla", .descr = "Additional SLA parameters for agg_port owner", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_TM_SCHED_CFG_ID_TCONT_SLA, .offset = offsetof(bcmbal_tm_sched_cfg_data, tcont_sla), .type = &type_descr_bcmbal_tm_tcont_sla };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_tm_sched_cfg_creation_mode = { .name = "creation_mode", .descr = "Creation mode", .access = BCMBAL_APICLI_PROP_ACCESS_ID_R, .property = BCMBAL_TM_SCHED_CFG_ID_CREATION_MODE, .offset = offsetof(bcmbal_tm_sched_cfg_data, creation_mode), .type = &type_descr_bcmbal_tm_creation_mode };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_tm_sched_cfg_queues = { .name = "queues", .descr = "Subsidiary queues", .access = BCMBAL_APICLI_PROP_ACCESS_ID_R, .property = BCMBAL_TM_SCHED_CFG_ID_QUEUES, .offset = offsetof(bcmbal_tm_sched_cfg_data, queues), .type = &type_descr_bcmbal_tm_queue_id_list_u8 };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_tm_sched_cfg_sub_scheds = { .name = "sub_scheds", .descr = "Subsidiary schedulers", .access = BCMBAL_APICLI_PROP_ACCESS_ID_R, .property = BCMBAL_TM_SCHED_CFG_ID_SUB_SCHEDS, .offset = offsetof(bcmbal_tm_sched_cfg_data, sub_scheds), .type = &type_descr_bcmbal_tm_sched_id_list_u8 };
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_tm_sched_cfg_num_priorities = { .name = "num_priorities", .descr = "Max number of strict priority scheduling elements", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_TM_SCHED_CFG_ID_NUM_PRIORITIES, .offset = offsetof(bcmbal_tm_sched_cfg_data, num_priorities), .type = &type_descr_uint8_t };
+static bcmbal_apicli_prop_descr * BCM_DESCR tm_sched_cfg_prop_array[] = { &prop_descr_tm_sched_cfg_owner, &prop_descr_tm_sched_cfg_sched_type, &prop_descr_tm_sched_cfg_sched_parent, &prop_descr_tm_sched_cfg_sched_child_type, &prop_descr_tm_sched_cfg_rate, &prop_descr_tm_sched_cfg_tcont_sla, &prop_descr_tm_sched_cfg_creation_mode, &prop_descr_tm_sched_cfg_queues, &prop_descr_tm_sched_cfg_sub_scheds, &prop_descr_tm_sched_cfg_num_priorities };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_tm_sched_cfg_data_fields[] = { { .name = "owner", .descr = "owner", .offset = offsetof(bcmbal_tm_sched_cfg_data, owner), .type = &type_descr_bcmbal_tm_sched_owner }, { .name = "sched_type", .descr = "Scheduler type", .offset = offsetof(bcmbal_tm_sched_cfg_data, sched_type), .type = &type_descr_bcmbal_tm_sched_type }, { .name = "sched_parent", .descr = "Scheduling parameters for parent scheduler", .offset = offsetof(bcmbal_tm_sched_cfg_data, sched_parent), .type = &type_descr_bcmbal_tm_sched_parent }, { .name = "sched_child_type", .descr = "Scheduling level for children tm ", .offset = offsetof(bcmbal_tm_sched_cfg_data, sched_child_type), .type = &type_descr_bcmbal_tm_sched_child_type }, { .name = "rate", .descr = "Rate shaping parameters", .offset = offsetof(bcmbal_tm_sched_cfg_data, rate), .type = &type_descr_bcmbal_tm_shaping }, { .name = "tcont_sla", .descr = "Additional SLA parameters for agg_port owner", .offset = offsetof(bcmbal_tm_sched_cfg_data, tcont_sla), .type = &type_descr_bcmbal_tm_tcont_sla }, { .name = "creation_mode", .descr = "Creation mode", .offset = offsetof(bcmbal_tm_sched_cfg_data, creation_mode), .type = &type_descr_bcmbal_tm_creation_mode }, { .name = "queues", .descr = "Subsidiary queues", .offset = offsetof(bcmbal_tm_sched_cfg_data, queues), .type = &type_descr_bcmbal_tm_queue_id_list_u8 }, { .name = "sub_scheds", .descr = "Subsidiary schedulers", .offset = offsetof(bcmbal_tm_sched_cfg_data, sub_scheds), .type = &type_descr_bcmbal_tm_sched_id_list_u8 }, { .name = "num_priorities", .descr = "Max number of strict priority scheduling elements", .offset = offsetof(bcmbal_tm_sched_cfg_data, num_priorities), .type = &type_descr_uint8_t } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_tm_sched_cfg_data = { .name = "bcmbal_tm_sched_cfg_data", .descr = "cfg", .size = sizeof(bcmbal_tm_sched_cfg_data), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_STRUCT, .x = { .s = { .num_fields = sizeof(type_descr_bcmbal_tm_sched_cfg_data_fields) / sizeof(bcmbal_apicli_field_descr), .fields = type_descr_bcmbal_tm_sched_cfg_data_fields } } };
+
+/* Group: tm_sched - ind */
+static bcmbal_apicli_prop_descr BCM_DESCR prop_descr_tm_sched_ind_ret = { .name = "ret", .descr = "ret", .access = BCMBAL_APICLI_PROP_ACCESS_ID_RW, .property = BCMBAL_TM_SCHED_IND_ID_RET, .offset = offsetof(bcmbal_tm_sched_ind_data, ret), .type = &type_descr_uint32_t };
+static bcmbal_apicli_prop_descr * BCM_DESCR tm_sched_ind_prop_array[] = { &prop_descr_tm_sched_ind_ret };
+static bcmbal_apicli_field_descr BCM_DESCR type_descr_bcmbal_tm_sched_ind_data_fields[] = { { .name = "ret", .descr = "ret", .offset = offsetof(bcmbal_tm_sched_ind_data, ret), .type = &type_descr_uint32_t } };
+static bcmbal_apicli_type_descr BCM_DESCR type_descr_bcmbal_tm_sched_ind_data = { .name = "bcmbal_tm_sched_ind_data", .descr = "Tm Sched Indication", .size = sizeof(bcmbal_tm_sched_ind_data), .base_type = BCMBAL_APICLI_BASE_TYPE_ID_STRUCT, .x = { .s = { .num_fields = sizeof(type_descr_bcmbal_tm_sched_ind_data_fields) / sizeof(bcmbal_apicli_field_descr), .fields = type_descr_bcmbal_tm_sched_ind_data_fields } } };
+
+/* ==== API Helper Function Implementations ==== */
+bcmos_errno bcmbal_apicli_object_struct_size(bcmbal_obj_id obj, bcmbal_mgt_group group, uint16_t subgroup, uint32_t *key_size, uint32_t *key_offset, uint32_t *data_size, uint32_t *data_offset)
+{
+ if (((key_size == NULL) || (key_offset == NULL)) || ((data_size == NULL) || (data_offset == NULL)))
+ {
+ return BCM_ERR_RANGE;
+ }
+
+ switch (obj)
+ {
+ case BCMBAL_OBJ_ID_ACCESS_TERMINAL:
+ switch (group)
+ {
+ case BCMBAL_MGT_GROUP_KEY:
+ switch (subgroup)
+ {
+ case 0:
+ *key_size = sizeof(bcmbal_access_terminal_key);
+ *key_offset = 0;
+ *data_size = sizeof(bcmbal_access_terminal_key);
+ *data_offset = 0;
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_MGT_GROUP_CFG:
+ switch (subgroup)
+ {
+ case 0:
+ *key_size = sizeof(bcmbal_access_terminal_key);
+ *key_offset = offsetof(bcmbal_access_terminal_cfg, key);
+ *data_size = sizeof(bcmbal_access_terminal_cfg_data);
+ *data_offset = offsetof(bcmbal_access_terminal_cfg, data);
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_MGT_GROUP_AUTO:
+ switch (subgroup)
+ {
+ case BCMBAL_ACCESS_TERMINAL_AUTO_ID_IND:
+ *key_size = sizeof(bcmbal_access_terminal_key);
+ *key_offset = offsetof(bcmbal_access_terminal_ind, key);
+ *data_size = sizeof(bcmbal_access_terminal_ind_data);
+ *data_offset = offsetof(bcmbal_access_terminal_ind, data);
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_OBJ_ID_FLOW:
+ switch (group)
+ {
+ case BCMBAL_MGT_GROUP_KEY:
+ switch (subgroup)
+ {
+ case 0:
+ *key_size = sizeof(bcmbal_flow_key);
+ *key_offset = 0;
+ *data_size = sizeof(bcmbal_flow_key);
+ *data_offset = 0;
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_MGT_GROUP_CFG:
+ switch (subgroup)
+ {
+ case 0:
+ *key_size = sizeof(bcmbal_flow_key);
+ *key_offset = offsetof(bcmbal_flow_cfg, key);
+ *data_size = sizeof(bcmbal_flow_cfg_data);
+ *data_offset = offsetof(bcmbal_flow_cfg, data);
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_MGT_GROUP_STAT:
+ switch (subgroup)
+ {
+ case 0:
+ *key_size = sizeof(bcmbal_flow_key);
+ *key_offset = offsetof(bcmbal_flow_stat, key);
+ *data_size = sizeof(bcmbal_flow_stat_data);
+ *data_offset = offsetof(bcmbal_flow_stat, data);
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_MGT_GROUP_AUTO:
+ switch (subgroup)
+ {
+ case BCMBAL_FLOW_AUTO_ID_IND:
+ *key_size = sizeof(bcmbal_flow_key);
+ *key_offset = offsetof(bcmbal_flow_ind, key);
+ *data_size = sizeof(bcmbal_flow_ind_data);
+ *data_offset = offsetof(bcmbal_flow_ind, data);
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_OBJ_ID_GROUP:
+ switch (group)
+ {
+ case BCMBAL_MGT_GROUP_KEY:
+ switch (subgroup)
+ {
+ case 0:
+ *key_size = sizeof(bcmbal_group_key);
+ *key_offset = 0;
+ *data_size = sizeof(bcmbal_group_key);
+ *data_offset = 0;
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_MGT_GROUP_CFG:
+ switch (subgroup)
+ {
+ case 0:
+ *key_size = sizeof(bcmbal_group_key);
+ *key_offset = offsetof(bcmbal_group_cfg, key);
+ *data_size = sizeof(bcmbal_group_cfg_data);
+ *data_offset = offsetof(bcmbal_group_cfg, data);
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_OBJ_ID_INTERFACE:
+ switch (group)
+ {
+ case BCMBAL_MGT_GROUP_KEY:
+ switch (subgroup)
+ {
+ case 0:
+ *key_size = sizeof(bcmbal_interface_key);
+ *key_offset = 0;
+ *data_size = sizeof(bcmbal_interface_key);
+ *data_offset = 0;
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_MGT_GROUP_CFG:
+ switch (subgroup)
+ {
+ case 0:
+ *key_size = sizeof(bcmbal_interface_key);
+ *key_offset = offsetof(bcmbal_interface_cfg, key);
+ *data_size = sizeof(bcmbal_interface_cfg_data);
+ *data_offset = offsetof(bcmbal_interface_cfg, data);
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_MGT_GROUP_STAT:
+ switch (subgroup)
+ {
+ case 0:
+ *key_size = sizeof(bcmbal_interface_key);
+ *key_offset = offsetof(bcmbal_interface_stat, key);
+ *data_size = sizeof(bcmbal_interface_stat_data);
+ *data_offset = offsetof(bcmbal_interface_stat, data);
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_MGT_GROUP_AUTO:
+ switch (subgroup)
+ {
+ case BCMBAL_INTERFACE_AUTO_ID_IND:
+ *key_size = sizeof(bcmbal_interface_key);
+ *key_offset = offsetof(bcmbal_interface_ind, key);
+ *data_size = sizeof(bcmbal_interface_ind_data);
+ *data_offset = offsetof(bcmbal_interface_ind, data);
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_OBJ_ID_PACKET:
+ switch (group)
+ {
+ case BCMBAL_MGT_GROUP_KEY:
+ switch (subgroup)
+ {
+ case 0:
+ *key_size = sizeof(bcmbal_packet_key);
+ *key_offset = 0;
+ *data_size = sizeof(bcmbal_packet_key);
+ *data_offset = 0;
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_MGT_GROUP_CFG:
+ switch (subgroup)
+ {
+ case 0:
+ *key_size = sizeof(bcmbal_packet_key);
+ *key_offset = offsetof(bcmbal_packet_cfg, key);
+ *data_size = sizeof(bcmbal_packet_cfg_data);
+ *data_offset = offsetof(bcmbal_packet_cfg, data);
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_MGT_GROUP_AUTO:
+ switch (subgroup)
+ {
+ case BCMBAL_PACKET_AUTO_ID_IND:
+ *key_size = sizeof(bcmbal_packet_key);
+ *key_offset = offsetof(bcmbal_packet_ind, key);
+ *data_size = sizeof(bcmbal_packet_ind_data);
+ *data_offset = offsetof(bcmbal_packet_ind, data);
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL:
+ switch (group)
+ {
+ case BCMBAL_MGT_GROUP_KEY:
+ switch (subgroup)
+ {
+ case 0:
+ *key_size = sizeof(bcmbal_subscriber_terminal_key);
+ *key_offset = 0;
+ *data_size = sizeof(bcmbal_subscriber_terminal_key);
+ *data_offset = 0;
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_MGT_GROUP_CFG:
+ switch (subgroup)
+ {
+ case 0:
+ *key_size = sizeof(bcmbal_subscriber_terminal_key);
+ *key_offset = offsetof(bcmbal_subscriber_terminal_cfg, key);
+ *data_size = sizeof(bcmbal_subscriber_terminal_cfg_data);
+ *data_offset = offsetof(bcmbal_subscriber_terminal_cfg, data);
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_MGT_GROUP_STAT:
+ switch (subgroup)
+ {
+ case 0:
+ *key_size = sizeof(bcmbal_subscriber_terminal_key);
+ *key_offset = offsetof(bcmbal_subscriber_terminal_stat, key);
+ *data_size = sizeof(bcmbal_subscriber_terminal_stat_data);
+ *data_offset = offsetof(bcmbal_subscriber_terminal_stat, data);
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_MGT_GROUP_AUTO:
+ switch (subgroup)
+ {
+ case BCMBAL_SUBSCRIBER_TERMINAL_AUTO_ID_IND:
+ *key_size = sizeof(bcmbal_subscriber_terminal_key);
+ *key_offset = offsetof(bcmbal_subscriber_terminal_ind, key);
+ *data_size = sizeof(bcmbal_subscriber_terminal_ind_data);
+ *data_offset = offsetof(bcmbal_subscriber_terminal_ind, data);
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_OBJ_ID_TM_QUEUE:
+ switch (group)
+ {
+ case BCMBAL_MGT_GROUP_KEY:
+ switch (subgroup)
+ {
+ case 0:
+ *key_size = sizeof(bcmbal_tm_queue_key);
+ *key_offset = 0;
+ *data_size = sizeof(bcmbal_tm_queue_key);
+ *data_offset = 0;
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_MGT_GROUP_CFG:
+ switch (subgroup)
+ {
+ case 0:
+ *key_size = sizeof(bcmbal_tm_queue_key);
+ *key_offset = offsetof(bcmbal_tm_queue_cfg, key);
+ *data_size = sizeof(bcmbal_tm_queue_cfg_data);
+ *data_offset = offsetof(bcmbal_tm_queue_cfg, data);
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_MGT_GROUP_STAT:
+ switch (subgroup)
+ {
+ case 0:
+ *key_size = sizeof(bcmbal_tm_queue_key);
+ *key_offset = offsetof(bcmbal_tm_queue_stat, key);
+ *data_size = sizeof(bcmbal_tm_queue_stat_data);
+ *data_offset = offsetof(bcmbal_tm_queue_stat, data);
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_MGT_GROUP_AUTO:
+ switch (subgroup)
+ {
+ case BCMBAL_TM_QUEUE_AUTO_ID_IND:
+ *key_size = sizeof(bcmbal_tm_queue_key);
+ *key_offset = offsetof(bcmbal_tm_queue_ind, key);
+ *data_size = sizeof(bcmbal_tm_queue_ind_data);
+ *data_offset = offsetof(bcmbal_tm_queue_ind, data);
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_OBJ_ID_TM_SCHED:
+ switch (group)
+ {
+ case BCMBAL_MGT_GROUP_KEY:
+ switch (subgroup)
+ {
+ case 0:
+ *key_size = sizeof(bcmbal_tm_sched_key);
+ *key_offset = 0;
+ *data_size = sizeof(bcmbal_tm_sched_key);
+ *data_offset = 0;
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_MGT_GROUP_CFG:
+ switch (subgroup)
+ {
+ case 0:
+ *key_size = sizeof(bcmbal_tm_sched_key);
+ *key_offset = offsetof(bcmbal_tm_sched_cfg, key);
+ *data_size = sizeof(bcmbal_tm_sched_cfg_data);
+ *data_offset = offsetof(bcmbal_tm_sched_cfg, data);
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_MGT_GROUP_AUTO:
+ switch (subgroup)
+ {
+ case BCMBAL_TM_SCHED_AUTO_ID_IND:
+ *key_size = sizeof(bcmbal_tm_sched_key);
+ *key_offset = offsetof(bcmbal_tm_sched_ind, key);
+ *data_size = sizeof(bcmbal_tm_sched_ind_data);
+ *data_offset = offsetof(bcmbal_tm_sched_ind, data);
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ return BCM_ERR_INTERNAL; /**< should never happen. */
+}
+
+bcmos_errno bcmbal_apicli_object_subgroup_name(bcmbal_obj_id obj, bcmbal_mgt_group group, uint16_t subgroup, const char **name, const char **descr)
+{
+ switch (obj)
+ {
+ case BCMBAL_OBJ_ID_ACCESS_TERMINAL:
+ switch (group)
+ {
+ case BCMBAL_MGT_GROUP_KEY:
+ switch (subgroup)
+ {
+ case 0:
+ if (name != NULL)
+ {
+ *name = "key";
+ }
+
+ if (descr != NULL)
+ {
+ *descr = "key";
+ }
+
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_MGT_GROUP_CFG:
+ switch (subgroup)
+ {
+ case 0:
+ if (name != NULL)
+ {
+ *name = "cfg";
+ }
+
+ if (descr != NULL)
+ {
+ *descr = "cfg";
+ }
+
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_MGT_GROUP_AUTO:
+ switch (subgroup)
+ {
+ case BCMBAL_ACCESS_TERMINAL_AUTO_ID_IND:
+ if (name != NULL)
+ {
+ *name = "ind";
+ }
+
+ if (descr != NULL)
+ {
+ *descr = "Access Terminal Indication";
+ }
+
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_OBJ_ID_FLOW:
+ switch (group)
+ {
+ case BCMBAL_MGT_GROUP_KEY:
+ switch (subgroup)
+ {
+ case 0:
+ if (name != NULL)
+ {
+ *name = "key";
+ }
+
+ if (descr != NULL)
+ {
+ *descr = "key";
+ }
+
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_MGT_GROUP_CFG:
+ switch (subgroup)
+ {
+ case 0:
+ if (name != NULL)
+ {
+ *name = "cfg";
+ }
+
+ if (descr != NULL)
+ {
+ *descr = "cfg";
+ }
+
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_MGT_GROUP_STAT:
+ switch (subgroup)
+ {
+ case 0:
+ if (name != NULL)
+ {
+ *name = "stat";
+ }
+
+ if (descr != NULL)
+ {
+ *descr = "stat";
+ }
+
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_MGT_GROUP_AUTO:
+ switch (subgroup)
+ {
+ case BCMBAL_FLOW_AUTO_ID_IND:
+ if (name != NULL)
+ {
+ *name = "ind";
+ }
+
+ if (descr != NULL)
+ {
+ *descr = "Flow Indication";
+ }
+
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_OBJ_ID_GROUP:
+ switch (group)
+ {
+ case BCMBAL_MGT_GROUP_KEY:
+ switch (subgroup)
+ {
+ case 0:
+ if (name != NULL)
+ {
+ *name = "key";
+ }
+
+ if (descr != NULL)
+ {
+ *descr = "key";
+ }
+
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_MGT_GROUP_CFG:
+ switch (subgroup)
+ {
+ case 0:
+ if (name != NULL)
+ {
+ *name = "cfg";
+ }
+
+ if (descr != NULL)
+ {
+ *descr = "cfg";
+ }
+
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_OBJ_ID_INTERFACE:
+ switch (group)
+ {
+ case BCMBAL_MGT_GROUP_KEY:
+ switch (subgroup)
+ {
+ case 0:
+ if (name != NULL)
+ {
+ *name = "key";
+ }
+
+ if (descr != NULL)
+ {
+ *descr = "key";
+ }
+
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_MGT_GROUP_CFG:
+ switch (subgroup)
+ {
+ case 0:
+ if (name != NULL)
+ {
+ *name = "cfg";
+ }
+
+ if (descr != NULL)
+ {
+ *descr = "cfg";
+ }
+
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_MGT_GROUP_STAT:
+ switch (subgroup)
+ {
+ case 0:
+ if (name != NULL)
+ {
+ *name = "stat";
+ }
+
+ if (descr != NULL)
+ {
+ *descr = "stat";
+ }
+
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_MGT_GROUP_AUTO:
+ switch (subgroup)
+ {
+ case BCMBAL_INTERFACE_AUTO_ID_IND:
+ if (name != NULL)
+ {
+ *name = "ind";
+ }
+
+ if (descr != NULL)
+ {
+ *descr = "Interface Indication";
+ }
+
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_OBJ_ID_PACKET:
+ switch (group)
+ {
+ case BCMBAL_MGT_GROUP_KEY:
+ switch (subgroup)
+ {
+ case 0:
+ if (name != NULL)
+ {
+ *name = "key";
+ }
+
+ if (descr != NULL)
+ {
+ *descr = "key";
+ }
+
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_MGT_GROUP_CFG:
+ switch (subgroup)
+ {
+ case 0:
+ if (name != NULL)
+ {
+ *name = "cfg";
+ }
+
+ if (descr != NULL)
+ {
+ *descr = "cfg";
+ }
+
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_MGT_GROUP_AUTO:
+ switch (subgroup)
+ {
+ case BCMBAL_PACKET_AUTO_ID_IND:
+ if (name != NULL)
+ {
+ *name = "ind";
+ }
+
+ if (descr != NULL)
+ {
+ *descr = "Packet indication";
+ }
+
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL:
+ switch (group)
+ {
+ case BCMBAL_MGT_GROUP_KEY:
+ switch (subgroup)
+ {
+ case 0:
+ if (name != NULL)
+ {
+ *name = "key";
+ }
+
+ if (descr != NULL)
+ {
+ *descr = "key";
+ }
+
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_MGT_GROUP_CFG:
+ switch (subgroup)
+ {
+ case 0:
+ if (name != NULL)
+ {
+ *name = "cfg";
+ }
+
+ if (descr != NULL)
+ {
+ *descr = "cfg";
+ }
+
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_MGT_GROUP_STAT:
+ switch (subgroup)
+ {
+ case 0:
+ if (name != NULL)
+ {
+ *name = "stat";
+ }
+
+ if (descr != NULL)
+ {
+ *descr = "stat";
+ }
+
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_MGT_GROUP_AUTO:
+ switch (subgroup)
+ {
+ case BCMBAL_SUBSCRIBER_TERMINAL_AUTO_ID_IND:
+ if (name != NULL)
+ {
+ *name = "ind";
+ }
+
+ if (descr != NULL)
+ {
+ *descr = "Subscriber Terminal Indication";
+ }
+
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_OBJ_ID_TM_QUEUE:
+ switch (group)
+ {
+ case BCMBAL_MGT_GROUP_KEY:
+ switch (subgroup)
+ {
+ case 0:
+ if (name != NULL)
+ {
+ *name = "key";
+ }
+
+ if (descr != NULL)
+ {
+ *descr = "key";
+ }
+
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_MGT_GROUP_CFG:
+ switch (subgroup)
+ {
+ case 0:
+ if (name != NULL)
+ {
+ *name = "cfg";
+ }
+
+ if (descr != NULL)
+ {
+ *descr = "cfg";
+ }
+
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_MGT_GROUP_STAT:
+ switch (subgroup)
+ {
+ case 0:
+ if (name != NULL)
+ {
+ *name = "stat";
+ }
+
+ if (descr != NULL)
+ {
+ *descr = "stat";
+ }
+
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_MGT_GROUP_AUTO:
+ switch (subgroup)
+ {
+ case BCMBAL_TM_QUEUE_AUTO_ID_IND:
+ if (name != NULL)
+ {
+ *name = "ind";
+ }
+
+ if (descr != NULL)
+ {
+ *descr = "Tm Queue Indication";
+ }
+
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_OBJ_ID_TM_SCHED:
+ switch (group)
+ {
+ case BCMBAL_MGT_GROUP_KEY:
+ switch (subgroup)
+ {
+ case 0:
+ if (name != NULL)
+ {
+ *name = "key";
+ }
+
+ if (descr != NULL)
+ {
+ *descr = "key";
+ }
+
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_MGT_GROUP_CFG:
+ switch (subgroup)
+ {
+ case 0:
+ if (name != NULL)
+ {
+ *name = "cfg";
+ }
+
+ if (descr != NULL)
+ {
+ *descr = "cfg";
+ }
+
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ case BCMBAL_MGT_GROUP_AUTO:
+ switch (subgroup)
+ {
+ case BCMBAL_TM_SCHED_AUTO_ID_IND:
+ if (name != NULL)
+ {
+ *name = "ind";
+ }
+
+ if (descr != NULL)
+ {
+ *descr = "Tm Sched Indication";
+ }
+
+ return BCM_ERR_OK;
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ default:
+ return BCM_ERR_RANGE;
+ }
+
+ return BCM_ERR_INTERNAL; /**< should never happen. */
+}
+
+static bcmbal_apicli_prop_descr **obj_get_prop_array(bcmbal_obj_id obj, bcmbal_mgt_group group, uint16_t subgroup, uint32_t *size)
+{
+ switch (obj)
+ {
+ case BCMBAL_OBJ_ID_ACCESS_TERMINAL:
+ switch (group)
+ {
+ case BCMBAL_MGT_GROUP_KEY:
+ switch (subgroup)
+ {
+ case 0:
+ *size = sizeof(access_terminal_key_prop_array) / sizeof(bcmbal_apicli_prop_descr *);
+ return access_terminal_key_prop_array;
+ default:
+ break;
+ }
+
+ case BCMBAL_MGT_GROUP_CFG:
+ switch (subgroup)
+ {
+ case 0:
+ *size = sizeof(access_terminal_cfg_prop_array) / sizeof(bcmbal_apicli_prop_descr *);
+ return access_terminal_cfg_prop_array;
+ default:
+ break;
+ }
+
+ case BCMBAL_MGT_GROUP_AUTO:
+ switch (subgroup)
+ {
+ case BCMBAL_ACCESS_TERMINAL_AUTO_ID_IND:
+ *size = sizeof(access_terminal_ind_prop_array) / sizeof(bcmbal_apicli_prop_descr *);
+ return access_terminal_ind_prop_array;
+ default:
+ break;
+ }
+
+ default:
+ break;
+ }
+
+ case BCMBAL_OBJ_ID_FLOW:
+ switch (group)
+ {
+ case BCMBAL_MGT_GROUP_KEY:
+ switch (subgroup)
+ {
+ case 0:
+ *size = sizeof(flow_key_prop_array) / sizeof(bcmbal_apicli_prop_descr *);
+ return flow_key_prop_array;
+ default:
+ break;
+ }
+
+ case BCMBAL_MGT_GROUP_CFG:
+ switch (subgroup)
+ {
+ case 0:
+ *size = sizeof(flow_cfg_prop_array) / sizeof(bcmbal_apicli_prop_descr *);
+ return flow_cfg_prop_array;
+ default:
+ break;
+ }
+
+ case BCMBAL_MGT_GROUP_STAT:
+ switch (subgroup)
+ {
+ case 0:
+ *size = sizeof(flow_stat_prop_array) / sizeof(bcmbal_apicli_prop_descr *);
+ return flow_stat_prop_array;
+ default:
+ break;
+ }
+
+ case BCMBAL_MGT_GROUP_AUTO:
+ switch (subgroup)
+ {
+ case BCMBAL_FLOW_AUTO_ID_IND:
+ *size = sizeof(flow_ind_prop_array) / sizeof(bcmbal_apicli_prop_descr *);
+ return flow_ind_prop_array;
+ default:
+ break;
+ }
+
+ default:
+ break;
+ }
+
+ case BCMBAL_OBJ_ID_GROUP:
+ switch (group)
+ {
+ case BCMBAL_MGT_GROUP_KEY:
+ switch (subgroup)
+ {
+ case 0:
+ *size = sizeof(group_key_prop_array) / sizeof(bcmbal_apicli_prop_descr *);
+ return group_key_prop_array;
+ default:
+ break;
+ }
+
+ case BCMBAL_MGT_GROUP_CFG:
+ switch (subgroup)
+ {
+ case 0:
+ *size = sizeof(group_cfg_prop_array) / sizeof(bcmbal_apicli_prop_descr *);
+ return group_cfg_prop_array;
+ default:
+ break;
+ }
+
+ default:
+ break;
+ }
+
+ case BCMBAL_OBJ_ID_INTERFACE:
+ switch (group)
+ {
+ case BCMBAL_MGT_GROUP_KEY:
+ switch (subgroup)
+ {
+ case 0:
+ *size = sizeof(interface_key_prop_array) / sizeof(bcmbal_apicli_prop_descr *);
+ return interface_key_prop_array;
+ default:
+ break;
+ }
+
+ case BCMBAL_MGT_GROUP_CFG:
+ switch (subgroup)
+ {
+ case 0:
+ *size = sizeof(interface_cfg_prop_array) / sizeof(bcmbal_apicli_prop_descr *);
+ return interface_cfg_prop_array;
+ default:
+ break;
+ }
+
+ case BCMBAL_MGT_GROUP_STAT:
+ switch (subgroup)
+ {
+ case 0:
+ *size = sizeof(interface_stat_prop_array) / sizeof(bcmbal_apicli_prop_descr *);
+ return interface_stat_prop_array;
+ default:
+ break;
+ }
+
+ case BCMBAL_MGT_GROUP_AUTO:
+ switch (subgroup)
+ {
+ case BCMBAL_INTERFACE_AUTO_ID_IND:
+ *size = sizeof(interface_ind_prop_array) / sizeof(bcmbal_apicli_prop_descr *);
+ return interface_ind_prop_array;
+ default:
+ break;
+ }
+
+ default:
+ break;
+ }
+
+ case BCMBAL_OBJ_ID_PACKET:
+ switch (group)
+ {
+ case BCMBAL_MGT_GROUP_KEY:
+ switch (subgroup)
+ {
+ case 0:
+ *size = sizeof(packet_key_prop_array) / sizeof(bcmbal_apicli_prop_descr *);
+ return packet_key_prop_array;
+ default:
+ break;
+ }
+
+ case BCMBAL_MGT_GROUP_CFG:
+ switch (subgroup)
+ {
+ case 0:
+ *size = sizeof(packet_cfg_prop_array) / sizeof(bcmbal_apicli_prop_descr *);
+ return packet_cfg_prop_array;
+ default:
+ break;
+ }
+
+ case BCMBAL_MGT_GROUP_AUTO:
+ switch (subgroup)
+ {
+ case BCMBAL_PACKET_AUTO_ID_IND:
+ *size = sizeof(packet_ind_prop_array) / sizeof(bcmbal_apicli_prop_descr *);
+ return packet_ind_prop_array;
+ default:
+ break;
+ }
+
+ default:
+ break;
+ }
+
+ case BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL:
+ switch (group)
+ {
+ case BCMBAL_MGT_GROUP_KEY:
+ switch (subgroup)
+ {
+ case 0:
+ *size = sizeof(subscriber_terminal_key_prop_array) / sizeof(bcmbal_apicli_prop_descr *);
+ return subscriber_terminal_key_prop_array;
+ default:
+ break;
+ }
+
+ case BCMBAL_MGT_GROUP_CFG:
+ switch (subgroup)
+ {
+ case 0:
+ *size = sizeof(subscriber_terminal_cfg_prop_array) / sizeof(bcmbal_apicli_prop_descr *);
+ return subscriber_terminal_cfg_prop_array;
+ default:
+ break;
+ }
+
+ case BCMBAL_MGT_GROUP_STAT:
+ switch (subgroup)
+ {
+ case 0:
+ *size = sizeof(subscriber_terminal_stat_prop_array) / sizeof(bcmbal_apicli_prop_descr *);
+ return subscriber_terminal_stat_prop_array;
+ default:
+ break;
+ }
+
+ case BCMBAL_MGT_GROUP_AUTO:
+ switch (subgroup)
+ {
+ case BCMBAL_SUBSCRIBER_TERMINAL_AUTO_ID_IND:
+ *size = sizeof(subscriber_terminal_ind_prop_array) / sizeof(bcmbal_apicli_prop_descr *);
+ return subscriber_terminal_ind_prop_array;
+ default:
+ break;
+ }
+
+ default:
+ break;
+ }
+
+ case BCMBAL_OBJ_ID_TM_QUEUE:
+ switch (group)
+ {
+ case BCMBAL_MGT_GROUP_KEY:
+ switch (subgroup)
+ {
+ case 0:
+ *size = sizeof(tm_queue_key_prop_array) / sizeof(bcmbal_apicli_prop_descr *);
+ return tm_queue_key_prop_array;
+ default:
+ break;
+ }
+
+ case BCMBAL_MGT_GROUP_CFG:
+ switch (subgroup)
+ {
+ case 0:
+ *size = sizeof(tm_queue_cfg_prop_array) / sizeof(bcmbal_apicli_prop_descr *);
+ return tm_queue_cfg_prop_array;
+ default:
+ break;
+ }
+
+ case BCMBAL_MGT_GROUP_STAT:
+ switch (subgroup)
+ {
+ case 0:
+ *size = sizeof(tm_queue_stat_prop_array) / sizeof(bcmbal_apicli_prop_descr *);
+ return tm_queue_stat_prop_array;
+ default:
+ break;
+ }
+
+ case BCMBAL_MGT_GROUP_AUTO:
+ switch (subgroup)
+ {
+ case BCMBAL_TM_QUEUE_AUTO_ID_IND:
+ *size = sizeof(tm_queue_ind_prop_array) / sizeof(bcmbal_apicli_prop_descr *);
+ return tm_queue_ind_prop_array;
+ default:
+ break;
+ }
+
+ default:
+ break;
+ }
+
+ case BCMBAL_OBJ_ID_TM_SCHED:
+ switch (group)
+ {
+ case BCMBAL_MGT_GROUP_KEY:
+ switch (subgroup)
+ {
+ case 0:
+ *size = sizeof(tm_sched_key_prop_array) / sizeof(bcmbal_apicli_prop_descr *);
+ return tm_sched_key_prop_array;
+ default:
+ break;
+ }
+
+ case BCMBAL_MGT_GROUP_CFG:
+ switch (subgroup)
+ {
+ case 0:
+ *size = sizeof(tm_sched_cfg_prop_array) / sizeof(bcmbal_apicli_prop_descr *);
+ return tm_sched_cfg_prop_array;
+ default:
+ break;
+ }
+
+ case BCMBAL_MGT_GROUP_AUTO:
+ switch (subgroup)
+ {
+ case BCMBAL_TM_SCHED_AUTO_ID_IND:
+ *size = sizeof(tm_sched_ind_prop_array) / sizeof(bcmbal_apicli_prop_descr *);
+ return tm_sched_ind_prop_array;
+ default:
+ break;
+ }
+
+ default:
+ break;
+ }
+
+ default:
+ break;
+ }
+
+ return NULL;
+}
+
+bcmos_errno bcmbal_apicli_object_name(bcmbal_obj_id obj, const char **name, const char **descr)
+{
+ if (obj >= BCMBAL_OBJ_ID__NUM_OF)
+ {
+ return BCM_ERR_RANGE;
+ }
+
+ if (object_name[obj] == NULL)
+ {
+ return BCM_ERR_NOENT;
+ }
+
+ if (name != NULL)
+ {
+ *name = object_name[obj];
+ }
+
+ if (descr != NULL)
+ {
+ *descr = object_descr[obj];
+ }
+
+ return BCM_ERR_OK;
+}
+
+bcmos_errno bcmbal_apicli_object_property(bcmbal_obj_id obj, bcmbal_mgt_group group, uint16_t subgroup, uint16_t prop, const bcmbal_apicli_prop_descr **descr)
+{
+ bcmbal_apicli_prop_descr **prop_array = NULL;
+ uint32_t prop_array_size = 0;
+ if (descr == NULL)
+ {
+ return BCM_ERR_PARM;
+ }
+
+ prop_array = obj_get_prop_array(obj, group, subgroup, &prop_array_size);
+ if ((prop_array == NULL) || (prop >= prop_array_size))
+ {
+ return BCM_ERR_RANGE;
+ }
+
+ if (prop_array[prop] == NULL)
+ {
+ return BCM_ERR_NOENT;
+ }
+
+ *descr = prop_array[prop];
+ return BCM_ERR_OK;
+}
diff --git a/bal_release/src/lib/libbalapicli/bal_api_cli_helpers.h b/bal_release/src/lib/libbalapicli/bal_api_cli_helpers.h
new file mode 100644
index 0000000..07e922a
--- /dev/null
+++ b/bal_release/src/lib/libbalapicli/bal_api_cli_helpers.h
@@ -0,0 +1,221 @@
+/*
+<:copyright-BRCM:2016:DUAL/GPL:standard
+
+ Broadcom Proprietary and Confidential.(c) 2016 Broadcom
+ All Rights Reserved
+
+Unless you and Broadcom execute a separate written software license
+agreement governing use of this software, this software is licensed
+to you under the terms of the GNU General Public License version 2
+(the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
+with the following added to such license:
+
+ As a special exception, the copyright holders of this software give
+ you permission to link this software with independent modules, and
+ to copy and distribute the resulting executable under terms of your
+ choice, provided that you also meet, for each linked independent
+ module, the terms and conditions of the license of that module.
+ An independent module is a module which is not derived from this
+ software. The special exception does not apply to any modifications
+ of the software.
+
+Not withstanding the above, under no circumstances may you combine
+this software in any way with any other Broadcom software provided
+under a license other than the GPL, without Broadcom's express prior
+written consent.
+
+:>
+ */
+#ifndef BCMBAL_APICLI_HELPERS_H_
+#define BCMBAL_APICLI_HELPERS_H_
+
+#include <bcmcli.h>
+#include <bal_api.h>
+#include "bal_api_cli_types.h"
+
+/* Mac name length */
+#define BCMBAL_APICLI_MAX_PARM_NAME_LENGTH BCMCLI_MAX_SEARCH_SUBSTR_LENGTH
+
+/* Max help string length */
+#define BCMBAL_APICLI_MAX_PARM_HELP_LENGTH 128
+
+typedef enum bcmbal_apicli_field_descr_flags
+{
+ BCMBAL_APICLI_FIELD_DESCR_FLAGS_NONE = 0,
+ BCMBAL_APICLI_FIELD_DESCR_FLAGS_PRESENCE_MASK = (1 << 0) /* field is a 'presence mask' for a structure */
+} bcmbal_apicli_field_descr_flags;
+
+typedef struct bcmbal_apicli_type_descr bcmbal_apicli_type_descr;
+
+/* Structure field descriptor */
+typedef struct bcmbal_apicli_field_descr
+{
+ const char *name; /* Field name */
+ const char *descr; /* Field description */
+ const char *cli_name; /* Short CLI name. can be missing */
+ bcmbal_apicli_type_descr *type; /* Field type */
+ uint16_t offset; /* Offset from the beginning of the type structure */
+ bcmbal_apicli_field_descr_flags flags;
+} bcmbal_apicli_field_descr;
+
+/* Data type descriptor */
+struct bcmbal_apicli_type_descr
+{
+ const char *name; /* Type name */
+ const char *descr; /* Type description. can be missing */
+ const char *cli_name; /* Short CLI name. can be missing */
+ bcmbal_apicli_base_type_id base_type; /* Base type: snum, unum, string, ip, enum, etc. */
+ uint32_t min_val; /* Min value for range check */
+ uint32_t max_val; /* Max value for range check */
+ uint16_t size; /* Size */
+
+ /* The following union is qualified by the base_type and contains additional
+ * info for array, enum, struct, union */
+ union
+ {
+ bcmcli_enum_val *e; /* enum value array Contains num_elements+1 values. The last value has name=NULL */
+ struct
+ {
+ uint16_t num_fields; /* number of elements in the following structure */
+ bcmbal_apicli_field_descr *fields; /* Structure field array. Contains num_elements values */
+ } s;
+ struct
+ {
+ uint16_t num_common_fields; /* number of non-union fields at the start of the struct */
+ bcmbal_apicli_field_descr *common_fields; /* common field array. Contains num_elements values */
+ uint16_t classifier_idx; /* index of the classifier field within common_fields */
+ bcmbal_apicli_field_descr *union_fields; /* sub-struct fields under the union (name == NULL if no fields present)
+ (one per enum entry in the classifier type, plus one for default) */
+ } u;
+ struct
+ {
+ bcmbal_apicli_type_descr *elem_type; /* Array element type */
+ uint8_t len_size; /* Byte width of array length field (at start of struct) */
+ uint16_t max_size; /* Max array size */
+ } arr_dyn;
+ struct
+ {
+ bcmbal_apicli_type_descr *elem_type; /* Array element type */
+ uint16_t size; /* Fixed array size */
+ } arr_fixed;
+ } x;
+};
+
+/* Property descriptor.
+ * The 1st 5 fields are exactly the same as in bcmbal_apicli_field_descr
+ * ToDo: replace with bcmbal_apicli_field_descr substructure.
+ * Requires changes in code generator
+ */
+typedef struct
+{
+ const char *name; /* C name */
+ const char *descr; /* Property description */
+ const char *cli_name; /* CLI name */
+ bcmbal_apicli_type_descr *type; /* Type reference */
+ uint16_t offset; /* Offset in generated per-group structure */
+ uint16_t property; /* Property id in per-object management group */
+ bcmbal_apicli_prop_access_id access; /* Access */
+} bcmbal_apicli_prop_descr;
+
+/* All APIs return
+ * BCM_ERR_OK - ok
+ * BCM_ERR_NOENT - if id is in range, but doesn't correspond to any value (a hole)
+ * BCM_ERR_RANGE - id is out of range
+ */
+
+/* Get object name by id */
+bcmos_errno bcmbal_apicli_object_name(bcmbal_obj_id obj, const char **name, const char **descr);
+
+/* Get object structure size */
+bcmos_errno bcmbal_apicli_object_struct_size(bcmbal_obj_id obj, bcmbal_mgt_group group, uint16_t subgroup, uint32_t *key_size, uint32_t *key_offset, uint32_t *data_size, uint32_t *data_offset);
+
+/* Get object subgroup (e.g. specific indication) name and description */
+bcmos_errno bcmbal_apicli_object_subgroup_name(bcmbal_obj_id obj, bcmbal_mgt_group group, uint16_t subgroup, const char **name, const char **descr);
+
+/* Get property by object, mgt_group, subgroup (e.g. specific indication), property_id */
+bcmos_errno bcmbal_apicli_object_property(bcmbal_obj_id obj, bcmbal_mgt_group group, uint16_t subgroup, uint16_t prop, const bcmbal_apicli_prop_descr **descr);
+
+/* Get the number of subgroups present for a given group */
+static inline uint16_t bcmbal_apicli_get_subgroup_count(bcmbal_obj_id obj, bcmbal_mgt_group group)
+{
+ uint16_t count = 0;
+ uint32_t dummy;
+ while (bcmbal_apicli_object_struct_size(obj, group, count, &dummy, &dummy, &dummy, &dummy) != BCM_ERR_RANGE)
+ {
+ ++count;
+ }
+
+ return count;
+}
+
+/* Dump a single property */
+bcmos_errno bcmbal_apicli_dump_prop(bcmcli_session *session, const bcmbal_apicli_prop_descr *pd, void *prop_data);
+
+/* Dump a single property value in C initializer format */
+bcmos_errno bcmbal_apicli_dump_prop_initializer(bcmcli_session *session, const bcmbal_apicli_prop_descr *pd, void *prop_data);
+
+/* Dump message */
+bcmos_errno bcmbal_apicli_msg_dump(bcmcli_session *session, bcmbal_obj *msg);
+
+/* Message group name */
+const char *bcmbal_apicli_mgt_group_to_str(bcmbal_mgt_group group);
+
+/* Convert an enum value to the corresponding string */
+#define BCMOLT_ENUM_STRING_VAL(enum_name, value) bcmcli_enum_stringval(enum_name ## _string_table, (value))
+
+/* Enum string tables */
+extern bcmcli_enum_val bcmbal_access_terminal_cfg_id_string_table[];
+extern bcmcli_enum_val bcmbal_access_terminal_ind_id_string_table[];
+extern bcmcli_enum_val bcmbal_access_terminal_key_id_string_table[];
+extern bcmcli_enum_val bcmbal_action_id_string_table[];
+extern bcmcli_enum_val bcmbal_action_cmd_id_string_table[];
+extern bcmcli_enum_val bcmbal_classifier_id_string_table[];
+extern bcmcli_enum_val bcmbal_pkt_tag_type_string_table[];
+extern bcmcli_enum_val bcmbal_control_string_table[];
+extern bcmcli_enum_val bcmbal_dest_type_string_table[];
+extern bcmcli_enum_val bcmbal_ds_miss_mode_string_table[];
+extern bcmcli_enum_val bcmbal_extra_bw_eligibility_type_string_table[];
+extern bcmcli_enum_val bcmbal_flow_cfg_id_string_table[];
+extern bcmcli_enum_val bcmbal_flow_ind_id_string_table[];
+extern bcmcli_enum_val bcmbal_flow_key_id_string_table[];
+extern bcmcli_enum_val bcmbal_flow_stat_id_string_table[];
+extern bcmcli_enum_val bcmbal_flow_type_string_table[];
+extern bcmcli_enum_val bcmbal_group_cfg_id_string_table[];
+extern bcmcli_enum_val bcmbal_group_key_id_string_table[];
+extern bcmcli_enum_val bcmbal_group_member_cmd_string_table[];
+extern bcmcli_enum_val bcmbal_group_owner_string_table[];
+extern bcmcli_enum_val bcmbal_interface_cfg_id_string_table[];
+extern bcmcli_enum_val bcmbal_interface_ind_id_string_table[];
+extern bcmcli_enum_val bcmbal_interface_key_id_string_table[];
+extern bcmcli_enum_val bcmbal_interface_stat_id_string_table[];
+extern bcmcli_enum_val bcmbal_intf_type_string_table[];
+extern bcmcli_enum_val bcmbal_iwf_mode_string_table[];
+extern bcmcli_enum_val bcmbal_packet_cfg_id_string_table[];
+extern bcmcli_enum_val bcmbal_packet_ind_id_string_table[];
+extern bcmcli_enum_val bcmbal_packet_key_id_string_table[];
+extern bcmcli_enum_val bcmbal_sla_id_string_table[];
+extern bcmcli_enum_val bcmbal_state_string_table[];
+extern bcmcli_enum_val bcmbal_status_string_table[];
+extern bcmcli_enum_val bcmbal_subscriber_terminal_cfg_id_string_table[];
+extern bcmcli_enum_val bcmbal_subscriber_terminal_ind_id_string_table[];
+extern bcmcli_enum_val bcmbal_subscriber_terminal_key_id_string_table[];
+extern bcmcli_enum_val bcmbal_subscriber_terminal_stat_id_string_table[];
+extern bcmcli_enum_val bcmbal_tm_bac_type_string_table[];
+extern bcmcli_enum_val bcmbal_tm_creation_mode_string_table[];
+extern bcmcli_enum_val bcmbal_tm_queue_cfg_id_string_table[];
+extern bcmcli_enum_val bcmbal_tm_queue_ind_id_string_table[];
+extern bcmcli_enum_val bcmbal_tm_queue_key_id_string_table[];
+extern bcmcli_enum_val bcmbal_tm_queue_stat_id_string_table[];
+extern bcmcli_enum_val bcmbal_tm_sched_cfg_id_string_table[];
+extern bcmcli_enum_val bcmbal_tm_sched_child_type_string_table[];
+extern bcmcli_enum_val bcmbal_tm_sched_dir_string_table[];
+extern bcmcli_enum_val bcmbal_tm_sched_ind_id_string_table[];
+extern bcmcli_enum_val bcmbal_tm_sched_key_id_string_table[];
+extern bcmcli_enum_val bcmbal_tm_sched_owner_type_string_table[];
+extern bcmcli_enum_val bcmbal_tm_sched_owner_agg_port_id_string_table[];
+extern bcmcli_enum_val bcmbal_tm_sched_parent_id_string_table[];
+extern bcmcli_enum_val bcmbal_tm_sched_type_string_table[];
+extern bcmcli_enum_val bcmbal_tm_shaping_id_string_table[];
+extern bcmcli_enum_val bcmbal_tm_tcont_sla_id_string_table[];
+extern bcmcli_enum_val bcmbal_trx_type_string_table[];
+#endif /* BCMBAL_APICLI_HELPERS_H_ */
diff --git a/bal_release/src/lib/libbalapicli/bal_api_cli_types.h b/bal_release/src/lib/libbalapicli/bal_api_cli_types.h
new file mode 100644
index 0000000..8e38a6c
--- /dev/null
+++ b/bal_release/src/lib/libbalapicli/bal_api_cli_types.h
@@ -0,0 +1,60 @@
+/*
+<:copyright-BRCM:2016:DUAL/GPL:standard
+
+ Broadcom Proprietary and Confidential.(c) 2016 Broadcom
+ All Rights Reserved
+
+Unless you and Broadcom execute a separate written software license
+agreement governing use of this software, this software is licensed
+to you under the terms of the GNU General Public License version 2
+(the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
+with the following added to such license:
+
+ As a special exception, the copyright holders of this software give
+ you permission to link this software with independent modules, and
+ to copy and distribute the resulting executable under terms of your
+ choice, provided that you also meet, for each linked independent
+ module, the terms and conditions of the license of that module.
+ An independent module is a module which is not derived from this
+ software. The special exception does not apply to any modifications
+ of the software.
+
+Not withstanding the above, under no circumstances may you combine
+this software in any way with any other Broadcom software provided
+under a license other than the GPL, without Broadcom's express prior
+written consent.
+
+:>
+ */
+
+#ifndef BCMBAL_APICLI_TYPES_H_
+#define BCMBAL_APICLI_TYPES_H_
+
+/* Property access */
+typedef enum
+{
+ BCMBAL_APICLI_PROP_ACCESS_ID_R = 0x1, /* Read access */
+ BCMBAL_APICLI_PROP_ACCESS_ID_W = 0x2, /* Write access */
+ BCMBAL_APICLI_PROP_ACCESS_ID_RW = 0x3, /* Read-write */
+} bcmbal_apicli_prop_access_id;
+
+/* Base data types */
+typedef enum
+{
+ BCMBAL_APICLI_BASE_TYPE_ID_SNUM, /* signed number */
+ BCMBAL_APICLI_BASE_TYPE_ID_UNUM, /* unsigned number */
+ BCMBAL_APICLI_BASE_TYPE_ID_UNUM_HEX, /* unsigned number printed in hex */
+ BCMBAL_APICLI_BASE_TYPE_ID_FLOAT, /* floating-point number */
+ BCMBAL_APICLI_BASE_TYPE_ID_BOOL, /* boolean (zero=no, nonzero=yes) */
+ BCMBAL_APICLI_BASE_TYPE_ID_STRING, /* string */
+ BCMBAL_APICLI_BASE_TYPE_ID_IPV4, /* IPv4 address */
+ BCMBAL_APICLI_BASE_TYPE_ID_MAC, /* MAC address */
+ BCMBAL_APICLI_BASE_TYPE_ID_ENUM, /* enum */
+ BCMBAL_APICLI_BASE_TYPE_ID_ENUM_MASK, /* bitmask enum */
+ BCMBAL_APICLI_BASE_TYPE_ID_STRUCT, /* struct */
+ BCMBAL_APICLI_BASE_TYPE_ID_UNION, /* union */
+ BCMBAL_APICLI_BASE_TYPE_ID_ARR_DYN, /* dynamically-sized array */
+ BCMBAL_APICLI_BASE_TYPE_ID_ARR_FIXED, /* fixed-size array */
+} bcmbal_apicli_base_type_id;
+
+#endif /* BCMBAL_APICLI_TYPES_H_ */
diff --git a/bal_release/src/lib/libcmdline/Makefile b/bal_release/src/lib/libcmdline/Makefile
new file mode 100644
index 0000000..5c5038d
--- /dev/null
+++ b/bal_release/src/lib/libcmdline/Makefile
@@ -0,0 +1,35 @@
+###############################################################################
+#
+# <:copyright-BRCM:2016:DUAL/GPL:standard
+#
+# Copyright (c) 2016 Broadcom
+# All Rights Reserved
+#
+# Unless you and Broadcom execute a separate written software license
+# agreement governing use of this software, this software is licensed
+# to you under the terms of the GNU General Public License version 2
+# (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
+# with the following added to such license:
+#
+# As a special exception, the copyright holders of this software give
+# you permission to link this software with independent modules, and
+# to copy and distribute the resulting executable under terms of your
+# choice, provided that you also meet, for each linked independent
+# module, the terms and conditions of the license of that module.
+# An independent module is a module which is not derived from this
+# software. The special exception does not apply to any modifications
+# of the software.
+#
+# Not withstanding the above, under no circumstances may you combine
+# this software in any way with any other Broadcom software provided
+# under a license other than the GPL, without Broadcom's express prior
+# written consent.
+#
+# :>
+#
+###############################################################################
+MOD_NAME = cmdline
+MOD_TYPE = lib
+
+srcs = cmdline.c
+
diff --git a/bal_release/src/lib/libcmdline/cmdline.c b/bal_release/src/lib/libcmdline/cmdline.c
new file mode 100644
index 0000000..d20b10a
--- /dev/null
+++ b/bal_release/src/lib/libcmdline/cmdline.c
@@ -0,0 +1,135 @@
+/******************************************************************************
+ *
+ * <:copyright-BRCM:2016:DUAL/GPL:standard
+ *
+ * Copyright (c) 2016 Broadcom
+ * All Rights Reserved
+ *
+ * Unless you and Broadcom execute a separate written software license
+ * agreement governing use of this software, this software is licensed
+ * to you under the terms of the GNU General Public License version 2
+ * (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
+ * with the following added to such license:
+ *
+ * As a special exception, the copyright holders of this software give
+ * you permission to link this software with independent modules, and
+ * to copy and distribute the resulting executable under terms of your
+ * choice, provided that you also meet, for each linked independent
+ * module, the terms and conditions of the license of that module.
+ * An independent module is a module which is not derived from this
+ * software. The special exception does not apply to any modifications
+ * of the software.
+ *
+ * Not withstanding the above, under no circumstances may you combine
+ * this software in any way with any other Broadcom software provided
+ * under a license other than the GPL, without Broadcom's express prior
+ * written consent.
+ *
+ * :>
+ *
+ *****************************************************************************/
+/*
+ * cmdline.c - Command line argument helper
+ */
+
+#include <cmdline.h>
+
+/* Print usage information */
+bcmos_errno cl_print_usage(const char *app, const char *arg,
+ const cl_argument supported_args[], int num_supported_args,
+ cl_argument_usage_flags flags)
+{
+ const char *owner = "";
+ int i;
+
+ if (arg)
+ bcmos_printf("*** Error in parameter %s\n", arg);
+ if (app)
+ {
+ const char *p, *fname;
+ p = strrchr(app, '/');
+ fname = p ? p + 1 : app;
+ bcmos_printf("Usage: %s arguments\n", fname);
+ }
+ for (i = 0; i < num_supported_args; i++)
+ {
+ const cl_argument *opt = &supported_args[i];
+ if ((flags & CL_ARGUMENT_USAGE_FLAG_OWNER) != 0 &&
+ opt->owner && strcmp(opt->owner, owner))
+ {
+ owner = opt->owner;
+ bcmos_printf("\n%s options:\n", owner);
+ }
+ if (opt->short_name)
+ bcmos_printf("%-3s%c", opt->short_name, opt->long_name ? ',' : ' ');
+ else
+ bcmos_printf(" ");
+ bcmos_printf("%-20s %20s %s\n",
+ opt->long_name ? opt->long_name : "",
+ opt->extra_arg ? opt->extra_arg : "",
+ opt->description ? opt->description : "");
+ }
+ return BCM_ERR_PARM;
+}
+
+/* Get parameter by name */
+const cl_argument *cl_parm_get(const char *name, const cl_argument supported_args[], int num_supported_args)
+{
+ const cl_argument *opt = NULL;
+ int i;
+
+ /* Make sure that all mandatory parameters are set */
+ for (i = 0; i < num_supported_args; i++)
+ {
+ opt = &supported_args[i];
+ if ((opt->short_name && !strcmp(opt->short_name, name)) ||
+ (opt->long_name && !strcmp(opt->long_name, name)))
+ break;
+ }
+ return (i < num_supported_args) ? opt : NULL;
+}
+
+/* Validate command line parameters */
+bcmos_errno cl_validate(int argc, char *argv[],
+ const cl_argument supported_args[], int num_supported_args)
+{
+ bcmos_bool parm_set[num_supported_args];
+ bcmos_errno rc = BCM_ERR_OK;
+ int i;
+
+ memset(parm_set, 0, sizeof(parm_set));
+ for (i = 1; i < argc; i++)
+ {
+ const cl_argument *opt = cl_parm_get(argv[i], supported_args, num_supported_args);
+ if (opt == NULL)
+ {
+ bcmos_printf("*** Invalid parameter: %s\n", argv[i]);
+ rc = BCM_ERR_PARM;
+ break;
+ }
+ if (opt->extra_arg)
+ {
+ ++i;
+ if (i >= argc)
+ {
+ bcmos_printf("*** Argument is missing after %s\n", argv[i-1]);
+ rc = BCM_ERR_PARM;
+ break;
+ }
+ }
+ parm_set[opt - supported_args] = BCMOS_TRUE;
+ }
+
+ /* Make sure that all mandatory parameters are set */
+ for (i = 0; i < num_supported_args; i++)
+ {
+ const cl_argument *opt = &supported_args[i];
+ if ((opt->flags & CL_ARGUMENT_FLAG_MANDATORY) && !parm_set[i])
+ {
+ bcmos_printf("*** Mandatory parameter %s is missing\n", opt->long_name ? opt->long_name : opt->short_name);
+ rc = BCM_ERR_PARM;
+ break;
+ }
+ }
+ return rc;
+}
diff --git a/bal_release/src/lib/libcmdline/cmdline.h b/bal_release/src/lib/libcmdline/cmdline.h
new file mode 100644
index 0000000..cad20b0
--- /dev/null
+++ b/bal_release/src/lib/libcmdline/cmdline.h
@@ -0,0 +1,101 @@
+/******************************************************************************
+ *
+ * <:copyright-BRCM:2016:DUAL/GPL:standard
+ *
+ * Copyright (c) 2016 Broadcom
+ * All Rights Reserved
+ *
+ * Unless you and Broadcom execute a separate written software license
+ * agreement governing use of this software, this software is licensed
+ * to you under the terms of the GNU General Public License version 2
+ * (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
+ * with the following added to such license:
+ *
+ * As a special exception, the copyright holders of this software give
+ * you permission to link this software with independent modules, and
+ * to copy and distribute the resulting executable under terms of your
+ * choice, provided that you also meet, for each linked independent
+ * module, the terms and conditions of the license of that module.
+ * An independent module is a module which is not derived from this
+ * software. The special exception does not apply to any modifications
+ * of the software.
+ *
+ * Not withstanding the above, under no circumstances may you combine
+ * this software in any way with any other Broadcom software provided
+ * under a license other than the GPL, without Broadcom's express prior
+ * written consent.
+ *
+ * :>
+ *
+ *****************************************************************************/
+/*
+ * cmdline.h - Command line argument helper
+ */
+
+#ifndef _CMDLINE_H_
+#define _CMDLINE_H_
+
+#include <bcmos_system.h>
+
+/** Argument flags */
+typedef enum
+{
+ CL_ARGUMENT_FLAG_NONE = 0,
+ CL_ARGUMENT_FLAG_MANDATORY = 0x1,
+} cl_argument_flags;
+
+/** Command line argument */
+typedef struct cl_argument
+{
+ const char *long_name; /**< Command line option: long form */
+ const char *short_name; /**< Command line option: short form */
+ const char *extra_arg; /**< Extra arguments */
+ const char *description; /**< Description */
+ const char *owner; /**< Owner module */
+ cl_argument_flags flags; /**< Command line argument flags */
+} cl_argument;
+
+/** Print usage flags */
+typedef enum
+{
+ CL_ARGUMENT_USAGE_FLAG_NONE = 0,
+ CL_ARGUMENT_USAGE_FLAG_OWNER = 0x1, /**< Print argument owners */
+} cl_argument_usage_flags;
+
+/** Print usage
+ * \param[in] app Application name. Can be NULL
+ * \param[in] arg Argument that triggered command line parsing error. Can be NULL
+ * \param[in] supported_args Array of supported arguments
+ * \param[in] num_supported_args Number of elements in supported_args[] array
+ * \param[in] flags Usage flags
+ * \returns BCM_ERR_PARM
+ */
+bcmos_errno cl_print_usage(const char *app, const char *arg,
+ const cl_argument supported_args[], int num_supported_args,
+ cl_argument_usage_flags flags);
+
+/** Validate parameters
+ *
+ * - make sure that there are no unknown parameters
+ * - make sure that all mandatory parameters are present
+ *
+ * \param[in] argc Number of command line arguments
+ * \param[in] argv Command line arguments
+ * \param[in] supported_args Array of supported arguments
+ * \param[in] num_supported_args Number of elements in supported_args[] array
+ * \returns BCM_ERR_OK or BCM_ERR_PARM
+ */
+bcmos_errno cl_validate(int argc, char *argv[],
+ const cl_argument supported_args[], int num_supported_args);
+
+/** Get CL parameter by name
+ *
+ * \param[in] name Parameter name
+ * \param[in] supported_args Supported arguments array
+ * \param[in] num_supported_args Supported arguments array size
+ * \returns argument descriptor pointer or NULL if not found
+ */
+const cl_argument *cl_parm_get(const char *name, const cl_argument supported_args[],
+ int num_supported_args);
+
+#endif /* _CMDLINE_H_ */
diff --git a/bal_release/src/lib/libobjmsg/Makefile b/bal_release/src/lib/libobjmsg/Makefile
new file mode 100644
index 0000000..15ff2d9
--- /dev/null
+++ b/bal_release/src/lib/libobjmsg/Makefile
@@ -0,0 +1,37 @@
+###############################################################################
+#
+# <:copyright-BRCM:2016:DUAL/GPL:standard
+#
+# Copyright (c) 2016 Broadcom
+# All Rights Reserved
+#
+# Unless you and Broadcom execute a separate written software license
+# agreement governing use of this software, this software is licensed
+# to you under the terms of the GNU General Public License version 2
+# (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
+# with the following added to such license:
+#
+# As a special exception, the copyright holders of this software give
+# you permission to link this software with independent modules, and
+# to copy and distribute the resulting executable under terms of your
+# choice, provided that you also meet, for each linked independent
+# module, the terms and conditions of the license of that module.
+# An independent module is a module which is not derived from this
+# software. The special exception does not apply to any modifications
+# of the software.
+#
+# Not withstanding the above, under no circumstances may you combine
+# this software in any way with any other Broadcom software provided
+# under a license other than the GPL, without Broadcom's express prior
+# written consent.
+#
+# :>
+#
+###############################################################################
+MOD_NAME = balobjmsg
+MOD_TYPE = lib
+MOD_DEPS = common_include utils maple_sdk dev_log
+
+gen_bal_hdrs = bal_model_funcs.h bal_obj_msg_pack_unpack.h
+gen_bal_srcs = bal_model_funcs.c bal_obj_msg_pack_unpack.c
+srcs = bal_msg.c
diff --git a/bal_release/src/lib/libobjmsg/bal_model_funcs.c b/bal_release/src/lib/libobjmsg/bal_model_funcs.c
new file mode 100644
index 0000000..262999f
--- /dev/null
+++ b/bal_release/src/lib/libobjmsg/bal_model_funcs.c
@@ -0,0 +1,11384 @@
+#include <bcmos_system.h>
+#include "bal_model_funcs.h"
+
+/******************************************************************************/
+bcmos_bool bcmbal_access_terminal_cfg_id_pack(bcmbal_access_terminal_cfg_id this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u16(buf, (uint16_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_access_terminal_cfg_id_unpack(bcmbal_access_terminal_cfg_id *this, bcmbal_buf *buf)
+{
+ uint16_t num_val;
+ if (!bcmbal_buf_read_u16(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_access_terminal_ind_id_pack(bcmbal_access_terminal_ind_id this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u16(buf, (uint16_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_access_terminal_ind_id_unpack(bcmbal_access_terminal_ind_id *this, bcmbal_buf *buf)
+{
+ uint16_t num_val;
+ if (!bcmbal_buf_read_u16(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_access_terminal_key_id_pack(bcmbal_access_terminal_key_id this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u16(buf, (uint16_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_access_terminal_key_id_unpack(bcmbal_access_terminal_key_id *this, bcmbal_buf *buf)
+{
+ uint16_t num_val;
+ if (!bcmbal_buf_read_u16(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_action_id_pack(bcmbal_action_id this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u64(buf, (uint64_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_action_id_unpack(bcmbal_action_id *this, bcmbal_buf *buf)
+{
+ uint64_t num_val;
+ if (!bcmbal_buf_read_u64(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_action_cmd_id_pack(bcmbal_action_cmd_id this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u32(buf, (uint32_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_action_cmd_id_unpack(bcmbal_action_cmd_id *this, bcmbal_buf *buf)
+{
+ uint32_t num_val;
+ if (!bcmbal_buf_read_u32(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_classifier_id_pack(bcmbal_classifier_id this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u64(buf, (uint64_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_classifier_id_unpack(bcmbal_classifier_id *this, bcmbal_buf *buf)
+{
+ uint64_t num_val;
+ if (!bcmbal_buf_read_u64(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_pkt_tag_type_pack(bcmbal_pkt_tag_type this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u32(buf, (uint32_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_pkt_tag_type_unpack(bcmbal_pkt_tag_type *this, bcmbal_buf *buf)
+{
+ uint32_t num_val;
+ if (!bcmbal_buf_read_u32(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_control_pack(bcmbal_control this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u32(buf, (uint32_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_control_unpack(bcmbal_control *this, bcmbal_buf *buf)
+{
+ uint32_t num_val;
+ if (!bcmbal_buf_read_u32(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_dest_type_pack(bcmbal_dest_type this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u32(buf, (uint32_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_dest_type_unpack(bcmbal_dest_type *this, bcmbal_buf *buf)
+{
+ uint32_t num_val;
+ if (!bcmbal_buf_read_u32(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_ds_miss_mode_pack(bcmbal_ds_miss_mode this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u32(buf, (uint32_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_ds_miss_mode_unpack(bcmbal_ds_miss_mode *this, bcmbal_buf *buf)
+{
+ uint32_t num_val;
+ if (!bcmbal_buf_read_u32(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_extra_bw_eligibility_type_pack(bcmbal_extra_bw_eligibility_type this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u8(buf, (uint8_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_extra_bw_eligibility_type_unpack(bcmbal_extra_bw_eligibility_type *this, bcmbal_buf *buf)
+{
+ uint8_t num_val;
+ if (!bcmbal_buf_read_u8(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_flow_cfg_id_pack(bcmbal_flow_cfg_id this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u16(buf, (uint16_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_flow_cfg_id_unpack(bcmbal_flow_cfg_id *this, bcmbal_buf *buf)
+{
+ uint16_t num_val;
+ if (!bcmbal_buf_read_u16(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_flow_ind_id_pack(bcmbal_flow_ind_id this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u16(buf, (uint16_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_flow_ind_id_unpack(bcmbal_flow_ind_id *this, bcmbal_buf *buf)
+{
+ uint16_t num_val;
+ if (!bcmbal_buf_read_u16(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_flow_key_id_pack(bcmbal_flow_key_id this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u16(buf, (uint16_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_flow_key_id_unpack(bcmbal_flow_key_id *this, bcmbal_buf *buf)
+{
+ uint16_t num_val;
+ if (!bcmbal_buf_read_u16(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_flow_stat_id_pack(bcmbal_flow_stat_id this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u16(buf, (uint16_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_flow_stat_id_unpack(bcmbal_flow_stat_id *this, bcmbal_buf *buf)
+{
+ uint16_t num_val;
+ if (!bcmbal_buf_read_u16(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_flow_type_pack(bcmbal_flow_type this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u32(buf, (uint32_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_flow_type_unpack(bcmbal_flow_type *this, bcmbal_buf *buf)
+{
+ uint32_t num_val;
+ if (!bcmbal_buf_read_u32(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_group_cfg_id_pack(bcmbal_group_cfg_id this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u16(buf, (uint16_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_group_cfg_id_unpack(bcmbal_group_cfg_id *this, bcmbal_buf *buf)
+{
+ uint16_t num_val;
+ if (!bcmbal_buf_read_u16(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_group_key_id_pack(bcmbal_group_key_id this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u16(buf, (uint16_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_group_key_id_unpack(bcmbal_group_key_id *this, bcmbal_buf *buf)
+{
+ uint16_t num_val;
+ if (!bcmbal_buf_read_u16(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_group_member_cmd_pack(bcmbal_group_member_cmd this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u32(buf, (uint32_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_group_member_cmd_unpack(bcmbal_group_member_cmd *this, bcmbal_buf *buf)
+{
+ uint32_t num_val;
+ if (!bcmbal_buf_read_u32(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_group_owner_pack(bcmbal_group_owner this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u8(buf, (uint8_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_group_owner_unpack(bcmbal_group_owner *this, bcmbal_buf *buf)
+{
+ uint8_t num_val;
+ if (!bcmbal_buf_read_u8(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_interface_cfg_id_pack(bcmbal_interface_cfg_id this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u16(buf, (uint16_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_interface_cfg_id_unpack(bcmbal_interface_cfg_id *this, bcmbal_buf *buf)
+{
+ uint16_t num_val;
+ if (!bcmbal_buf_read_u16(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_interface_ind_id_pack(bcmbal_interface_ind_id this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u16(buf, (uint16_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_interface_ind_id_unpack(bcmbal_interface_ind_id *this, bcmbal_buf *buf)
+{
+ uint16_t num_val;
+ if (!bcmbal_buf_read_u16(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_interface_key_id_pack(bcmbal_interface_key_id this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u16(buf, (uint16_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_interface_key_id_unpack(bcmbal_interface_key_id *this, bcmbal_buf *buf)
+{
+ uint16_t num_val;
+ if (!bcmbal_buf_read_u16(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_interface_stat_id_pack(bcmbal_interface_stat_id this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u16(buf, (uint16_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_interface_stat_id_unpack(bcmbal_interface_stat_id *this, bcmbal_buf *buf)
+{
+ uint16_t num_val;
+ if (!bcmbal_buf_read_u16(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_intf_type_pack(bcmbal_intf_type this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u32(buf, (uint32_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_intf_type_unpack(bcmbal_intf_type *this, bcmbal_buf *buf)
+{
+ uint32_t num_val;
+ if (!bcmbal_buf_read_u32(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_iwf_mode_pack(bcmbal_iwf_mode this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u32(buf, (uint32_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_iwf_mode_unpack(bcmbal_iwf_mode *this, bcmbal_buf *buf)
+{
+ uint32_t num_val;
+ if (!bcmbal_buf_read_u32(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_packet_cfg_id_pack(bcmbal_packet_cfg_id this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u16(buf, (uint16_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_packet_cfg_id_unpack(bcmbal_packet_cfg_id *this, bcmbal_buf *buf)
+{
+ uint16_t num_val;
+ if (!bcmbal_buf_read_u16(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_packet_ind_id_pack(bcmbal_packet_ind_id this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u16(buf, (uint16_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_packet_ind_id_unpack(bcmbal_packet_ind_id *this, bcmbal_buf *buf)
+{
+ uint16_t num_val;
+ if (!bcmbal_buf_read_u16(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_packet_key_id_pack(bcmbal_packet_key_id this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u16(buf, (uint16_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_packet_key_id_unpack(bcmbal_packet_key_id *this, bcmbal_buf *buf)
+{
+ uint16_t num_val;
+ if (!bcmbal_buf_read_u16(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_sla_id_pack(bcmbal_sla_id this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u64(buf, (uint64_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_sla_id_unpack(bcmbal_sla_id *this, bcmbal_buf *buf)
+{
+ uint64_t num_val;
+ if (!bcmbal_buf_read_u64(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_state_pack(bcmbal_state this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u32(buf, (uint32_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_state_unpack(bcmbal_state *this, bcmbal_buf *buf)
+{
+ uint32_t num_val;
+ if (!bcmbal_buf_read_u32(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_status_pack(bcmbal_status this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u32(buf, (uint32_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_status_unpack(bcmbal_status *this, bcmbal_buf *buf)
+{
+ uint32_t num_val;
+ if (!bcmbal_buf_read_u32(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_subscriber_terminal_cfg_id_pack(bcmbal_subscriber_terminal_cfg_id this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u16(buf, (uint16_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_subscriber_terminal_cfg_id_unpack(bcmbal_subscriber_terminal_cfg_id *this, bcmbal_buf *buf)
+{
+ uint16_t num_val;
+ if (!bcmbal_buf_read_u16(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_subscriber_terminal_ind_id_pack(bcmbal_subscriber_terminal_ind_id this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u16(buf, (uint16_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_subscriber_terminal_ind_id_unpack(bcmbal_subscriber_terminal_ind_id *this, bcmbal_buf *buf)
+{
+ uint16_t num_val;
+ if (!bcmbal_buf_read_u16(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_subscriber_terminal_key_id_pack(bcmbal_subscriber_terminal_key_id this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u16(buf, (uint16_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_subscriber_terminal_key_id_unpack(bcmbal_subscriber_terminal_key_id *this, bcmbal_buf *buf)
+{
+ uint16_t num_val;
+ if (!bcmbal_buf_read_u16(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_subscriber_terminal_stat_id_pack(bcmbal_subscriber_terminal_stat_id this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u16(buf, (uint16_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_subscriber_terminal_stat_id_unpack(bcmbal_subscriber_terminal_stat_id *this, bcmbal_buf *buf)
+{
+ uint16_t num_val;
+ if (!bcmbal_buf_read_u16(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_bac_type_pack(bcmbal_tm_bac_type this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u8(buf, (uint8_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_bac_type_unpack(bcmbal_tm_bac_type *this, bcmbal_buf *buf)
+{
+ uint8_t num_val;
+ if (!bcmbal_buf_read_u8(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_creation_mode_pack(bcmbal_tm_creation_mode this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u8(buf, (uint8_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_creation_mode_unpack(bcmbal_tm_creation_mode *this, bcmbal_buf *buf)
+{
+ uint8_t num_val;
+ if (!bcmbal_buf_read_u8(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_queue_cfg_id_pack(bcmbal_tm_queue_cfg_id this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u16(buf, (uint16_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_queue_cfg_id_unpack(bcmbal_tm_queue_cfg_id *this, bcmbal_buf *buf)
+{
+ uint16_t num_val;
+ if (!bcmbal_buf_read_u16(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_queue_ind_id_pack(bcmbal_tm_queue_ind_id this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u16(buf, (uint16_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_queue_ind_id_unpack(bcmbal_tm_queue_ind_id *this, bcmbal_buf *buf)
+{
+ uint16_t num_val;
+ if (!bcmbal_buf_read_u16(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_queue_key_id_pack(bcmbal_tm_queue_key_id this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u16(buf, (uint16_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_queue_key_id_unpack(bcmbal_tm_queue_key_id *this, bcmbal_buf *buf)
+{
+ uint16_t num_val;
+ if (!bcmbal_buf_read_u16(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_queue_stat_id_pack(bcmbal_tm_queue_stat_id this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u16(buf, (uint16_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_queue_stat_id_unpack(bcmbal_tm_queue_stat_id *this, bcmbal_buf *buf)
+{
+ uint16_t num_val;
+ if (!bcmbal_buf_read_u16(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_sched_cfg_id_pack(bcmbal_tm_sched_cfg_id this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u16(buf, (uint16_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_sched_cfg_id_unpack(bcmbal_tm_sched_cfg_id *this, bcmbal_buf *buf)
+{
+ uint16_t num_val;
+ if (!bcmbal_buf_read_u16(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_sched_child_type_pack(bcmbal_tm_sched_child_type this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u8(buf, (uint8_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_sched_child_type_unpack(bcmbal_tm_sched_child_type *this, bcmbal_buf *buf)
+{
+ uint8_t num_val;
+ if (!bcmbal_buf_read_u8(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_sched_dir_pack(bcmbal_tm_sched_dir this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u8(buf, (uint8_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_sched_dir_unpack(bcmbal_tm_sched_dir *this, bcmbal_buf *buf)
+{
+ uint8_t num_val;
+ if (!bcmbal_buf_read_u8(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_sched_ind_id_pack(bcmbal_tm_sched_ind_id this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u16(buf, (uint16_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_sched_ind_id_unpack(bcmbal_tm_sched_ind_id *this, bcmbal_buf *buf)
+{
+ uint16_t num_val;
+ if (!bcmbal_buf_read_u16(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_sched_key_id_pack(bcmbal_tm_sched_key_id this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u16(buf, (uint16_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_sched_key_id_unpack(bcmbal_tm_sched_key_id *this, bcmbal_buf *buf)
+{
+ uint16_t num_val;
+ if (!bcmbal_buf_read_u16(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_sched_owner_type_pack(bcmbal_tm_sched_owner_type this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u8(buf, (uint8_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_sched_owner_type_unpack(bcmbal_tm_sched_owner_type *this, bcmbal_buf *buf)
+{
+ uint8_t num_val;
+ if (!bcmbal_buf_read_u8(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_sched_owner_agg_port_id_pack(bcmbal_tm_sched_owner_agg_port_id this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u64(buf, (uint64_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_sched_owner_agg_port_id_unpack(bcmbal_tm_sched_owner_agg_port_id *this, bcmbal_buf *buf)
+{
+ uint64_t num_val;
+ if (!bcmbal_buf_read_u64(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_sched_parent_id_pack(bcmbal_tm_sched_parent_id this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u64(buf, (uint64_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_sched_parent_id_unpack(bcmbal_tm_sched_parent_id *this, bcmbal_buf *buf)
+{
+ uint64_t num_val;
+ if (!bcmbal_buf_read_u64(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_sched_type_pack(bcmbal_tm_sched_type this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u8(buf, (uint8_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_sched_type_unpack(bcmbal_tm_sched_type *this, bcmbal_buf *buf)
+{
+ uint8_t num_val;
+ if (!bcmbal_buf_read_u8(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_shaping_id_pack(bcmbal_tm_shaping_id this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u64(buf, (uint64_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_shaping_id_unpack(bcmbal_tm_shaping_id *this, bcmbal_buf *buf)
+{
+ uint64_t num_val;
+ if (!bcmbal_buf_read_u64(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_tcont_sla_id_pack(bcmbal_tm_tcont_sla_id this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u64(buf, (uint64_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_tcont_sla_id_unpack(bcmbal_tm_tcont_sla_id *this, bcmbal_buf *buf)
+{
+ uint64_t num_val;
+ if (!bcmbal_buf_read_u64(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_trx_type_pack(bcmbal_trx_type this, bcmbal_buf *buf)
+{
+ return bcmbal_buf_write_u32(buf, (uint32_t) this);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_trx_type_unpack(bcmbal_trx_type *this, bcmbal_buf *buf)
+{
+ uint32_t num_val;
+ if (!bcmbal_buf_read_u32(buf, &num_val))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *this = num_val;
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+void bcmbal_action_set_default(bcmbal_action *this)
+{
+ this->presence_mask = (bcmbal_action_id) 0;
+ this->cmds_bitmask = (bcmbal_action_cmd_id) 0;
+ this->o_vid = 0;
+ this->o_pbits = 0;
+ this->o_tpid = 0;
+ this->i_vid = 0;
+ this->i_pbits = 0;
+ this->i_tpid = 0;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_action_pack(const bcmbal_action *this, bcmbal_buf *buf)
+{
+ if (!bcmbal_action_id_pack(this->presence_mask, buf))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0001) == 0x0001))
+ {
+ if (!bcmbal_action_cmd_id_pack(this->cmds_bitmask, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0002) == 0x0002))
+ {
+ if (!bcmbal_buf_write_u16(buf, this->o_vid))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0004) == 0x0004))
+ {
+ if (!bcmbal_buf_write_u8(buf, this->o_pbits))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0008) == 0x0008))
+ {
+ if (!bcmbal_buf_write_u16(buf, this->o_tpid))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0010) == 0x0010))
+ {
+ if (!bcmbal_buf_write_u16(buf, this->i_vid))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0020) == 0x0020))
+ {
+ if (!bcmbal_buf_write_u8(buf, this->i_pbits))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0040) == 0x0040))
+ {
+ if (!bcmbal_buf_write_u16(buf, this->i_tpid))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+uint32_t bcmbal_action_get_packed_length(const bcmbal_action *this)
+{
+ uint32_t count = 8;
+ if ((((uint64_t) this->presence_mask & 0x0001) == 0x0001))
+ {
+ count += 4;
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0002) == 0x0002))
+ {
+ count += 2;
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0004) == 0x0004))
+ {
+ count += 1;
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0008) == 0x0008))
+ {
+ count += 2;
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0010) == 0x0010))
+ {
+ count += 2;
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0020) == 0x0020))
+ {
+ count += 1;
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0040) == 0x0040))
+ {
+ count += 2;
+ }
+
+ return count;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_action_unpack(bcmbal_action *this, bcmbal_buf *buf, void **extra_mem)
+{
+ if (!bcmbal_action_id_unpack(&this->presence_mask, buf))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0001) == 0x0001))
+ {
+ if (!bcmbal_action_cmd_id_unpack(&this->cmds_bitmask, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0002) == 0x0002))
+ {
+ if (!bcmbal_buf_read_u16(buf, &this->o_vid))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0004) == 0x0004))
+ {
+ if (!bcmbal_buf_read_u8(buf, &this->o_pbits))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0008) == 0x0008))
+ {
+ if (!bcmbal_buf_read_u16(buf, &this->o_tpid))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0010) == 0x0010))
+ {
+ if (!bcmbal_buf_read_u16(buf, &this->i_vid))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0020) == 0x0020))
+ {
+ if (!bcmbal_buf_read_u8(buf, &this->i_pbits))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0040) == 0x0040))
+ {
+ if (!bcmbal_buf_read_u16(buf, &this->i_tpid))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_action_scan(bcmbal_buf *packed, uint32_t *extra_mem)
+{
+ bcmbal_action_id presence_mask;
+ if (!bcmbal_action_id_unpack(&presence_mask, packed))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if ((((uint64_t) presence_mask & 0x0001) == 0x0001))
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) presence_mask & 0x0002) == 0x0002))
+ {
+ if (!bcmbal_buf_skip(packed, 2))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) presence_mask & 0x0004) == 0x0004))
+ {
+ if (!bcmbal_buf_skip(packed, 1))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) presence_mask & 0x0008) == 0x0008))
+ {
+ if (!bcmbal_buf_skip(packed, 2))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) presence_mask & 0x0010) == 0x0010))
+ {
+ if (!bcmbal_buf_skip(packed, 2))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) presence_mask & 0x0020) == 0x0020))
+ {
+ if (!bcmbal_buf_skip(packed, 1))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) presence_mask & 0x0040) == 0x0040))
+ {
+ if (!bcmbal_buf_skip(packed, 2))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_action_bounds_check(const bcmbal_action *this)
+{
+ if ((this->presence_mask & 0xFFFFFFFFFFFFFF80ULL) != 0)
+ {
+ return BCMOS_FALSE;
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0001) == 0x0001))
+ {
+ if ((this->cmds_bitmask & 0xFFFFE000UL) != 0)
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+void bcmbal_aggregation_port_id_list_u8_set_default(bcmbal_aggregation_port_id_list_u8 *this)
+{
+ this->len = 0;
+ this->val = NULL;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_aggregation_port_id_list_u8_pack(const bcmbal_aggregation_port_id_list_u8 *this, bcmbal_buf *buf)
+{
+ uint8_t i0;
+ if (!bcmbal_buf_write_u8(buf, this->len))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if ((this->len > 0) && (this->val == NULL))
+ {
+ bcmos_trace(BCMOS_TRACE_LEVEL_ERROR, "Error: list field \"val\" of struct \"bcmbal_aggregation_port_id_list_u8\" is uninitialized (NULL). You must allocate memory for this pointer before sending/receiving the message.\n");
+ return BCMOS_FALSE;
+ }
+
+ for (i0 = 0; i0 < this->len; i0++)
+ {
+ if (!bcmbal_buf_write_u16(buf, (uint16_t) this->val[i0]))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+uint32_t bcmbal_aggregation_port_id_list_u8_get_packed_length(const bcmbal_aggregation_port_id_list_u8 *this)
+{
+ return 1 + (2 * this->len);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_aggregation_port_id_list_u8_unpack(bcmbal_aggregation_port_id_list_u8 *this, bcmbal_buf *buf, void **extra_mem)
+{
+ uint8_t i0;
+ if (!bcmbal_buf_read_u8(buf, &this->len))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if ((this->len > 0) && (this->val == NULL))
+ {
+ if (extra_mem == NULL)
+ {
+ bcmos_trace(BCMOS_TRACE_LEVEL_ERROR, "Error: list field \"val\" of struct \"bcmbal_aggregation_port_id_list_u8\" is uninitialized (NULL). You must allocate memory for this pointer before sending/receiving the message.\n");
+ return BCMOS_FALSE;
+ }
+ else
+ {
+ this->val = (bcmbal_aggregation_port_id *) *extra_mem;
+ *extra_mem = ((uint8_t *) *extra_mem) + BCMOS_ROUND_TO_WORD(this->len * sizeof(bcmbal_aggregation_port_id));
+ }
+ }
+
+ for (i0 = 0; i0 < this->len; i0++)
+ {
+ if (!bcmbal_buf_read_u16(buf, (uint16_t *) &this->val[i0]))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_aggregation_port_id_list_u8_scan(bcmbal_buf *packed, uint32_t *extra_mem)
+{
+ uint8_t len;
+ if (!bcmbal_buf_read_u8(packed, &len))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *extra_mem += BCMOS_ROUND_TO_WORD(sizeof(bcmbal_aggregation_port_id) * len);
+ if (!bcmbal_buf_skip(packed, len * 2))
+ {
+ return BCMOS_FALSE;
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_aggregation_port_id_list_u8_bounds_check(const bcmbal_aggregation_port_id_list_u8 *this)
+{
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+void bcmbal_classifier_set_default(bcmbal_classifier *this)
+{
+ this->presence_mask = (bcmbal_classifier_id) 0;
+ this->o_tpid = 0;
+ this->o_vid = 0;
+ this->i_tpid = 0;
+ this->i_vid = 0;
+ this->o_pbits = 0;
+ this->i_pbits = 0;
+ this->ether_type = 0;
+ bcmos_mac_address_init(&this->dst_mac);
+ bcmos_mac_address_init(&this->src_mac);
+ this->ip_proto = 0;
+ bcmos_ipv4_address_init(&this->dst_ip);
+ bcmos_ipv4_address_init(&this->src_ip);
+ this->src_port = 0;
+ this->dst_port = 0;
+ this->pkt_tag_type = (bcmbal_pkt_tag_type) 0;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_classifier_pack(const bcmbal_classifier *this, bcmbal_buf *buf)
+{
+ if (!bcmbal_classifier_id_pack(this->presence_mask, buf))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0001) == 0x0001))
+ {
+ if (!bcmbal_buf_write_u16(buf, this->o_tpid))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0002) == 0x0002))
+ {
+ if (!bcmbal_buf_write_u16(buf, this->o_vid))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0004) == 0x0004))
+ {
+ if (!bcmbal_buf_write_u16(buf, this->i_tpid))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0008) == 0x0008))
+ {
+ if (!bcmbal_buf_write_u16(buf, this->i_vid))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0010) == 0x0010))
+ {
+ if (!bcmbal_buf_write_u8(buf, this->o_pbits))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0020) == 0x0020))
+ {
+ if (!bcmbal_buf_write_u8(buf, this->i_pbits))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0040) == 0x0040))
+ {
+ if (!bcmbal_buf_write_u16(buf, this->ether_type))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0080) == 0x0080))
+ {
+ if (!bcmbal_buf_write_mac_address(buf, this->dst_mac))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0100) == 0x0100))
+ {
+ if (!bcmbal_buf_write_mac_address(buf, this->src_mac))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0200) == 0x0200))
+ {
+ if (!bcmbal_buf_write_u8(buf, this->ip_proto))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0400) == 0x0400))
+ {
+ if (!bcmbal_buf_write_ipv4_address(buf, this->dst_ip))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0800) == 0x0800))
+ {
+ if (!bcmbal_buf_write_ipv4_address(buf, this->src_ip))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x1000) == 0x1000))
+ {
+ if (!bcmbal_buf_write_u16(buf, this->src_port))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x2000) == 0x2000))
+ {
+ if (!bcmbal_buf_write_u16(buf, this->dst_port))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x4000) == 0x4000))
+ {
+ if (!bcmbal_pkt_tag_type_pack(this->pkt_tag_type, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+uint32_t bcmbal_classifier_get_packed_length(const bcmbal_classifier *this)
+{
+ uint32_t count = 8;
+ if ((((uint64_t) this->presence_mask & 0x0001) == 0x0001))
+ {
+ count += 2;
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0002) == 0x0002))
+ {
+ count += 2;
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0004) == 0x0004))
+ {
+ count += 2;
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0008) == 0x0008))
+ {
+ count += 2;
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0010) == 0x0010))
+ {
+ count += 1;
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0020) == 0x0020))
+ {
+ count += 1;
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0040) == 0x0040))
+ {
+ count += 2;
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0080) == 0x0080))
+ {
+ count += 6;
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0100) == 0x0100))
+ {
+ count += 6;
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0200) == 0x0200))
+ {
+ count += 1;
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0400) == 0x0400))
+ {
+ count += 4;
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0800) == 0x0800))
+ {
+ count += 4;
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x1000) == 0x1000))
+ {
+ count += 2;
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x2000) == 0x2000))
+ {
+ count += 2;
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x4000) == 0x4000))
+ {
+ count += 4;
+ }
+
+ return count;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_classifier_unpack(bcmbal_classifier *this, bcmbal_buf *buf, void **extra_mem)
+{
+ if (!bcmbal_classifier_id_unpack(&this->presence_mask, buf))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0001) == 0x0001))
+ {
+ if (!bcmbal_buf_read_u16(buf, &this->o_tpid))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0002) == 0x0002))
+ {
+ if (!bcmbal_buf_read_u16(buf, &this->o_vid))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0004) == 0x0004))
+ {
+ if (!bcmbal_buf_read_u16(buf, &this->i_tpid))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0008) == 0x0008))
+ {
+ if (!bcmbal_buf_read_u16(buf, &this->i_vid))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0010) == 0x0010))
+ {
+ if (!bcmbal_buf_read_u8(buf, &this->o_pbits))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0020) == 0x0020))
+ {
+ if (!bcmbal_buf_read_u8(buf, &this->i_pbits))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0040) == 0x0040))
+ {
+ if (!bcmbal_buf_read_u16(buf, &this->ether_type))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0080) == 0x0080))
+ {
+ if (!bcmbal_buf_read_mac_address(buf, &this->dst_mac))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0100) == 0x0100))
+ {
+ if (!bcmbal_buf_read_mac_address(buf, &this->src_mac))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0200) == 0x0200))
+ {
+ if (!bcmbal_buf_read_u8(buf, &this->ip_proto))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0400) == 0x0400))
+ {
+ if (!bcmbal_buf_read_ipv4_address(buf, &this->dst_ip))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0800) == 0x0800))
+ {
+ if (!bcmbal_buf_read_ipv4_address(buf, &this->src_ip))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x1000) == 0x1000))
+ {
+ if (!bcmbal_buf_read_u16(buf, &this->src_port))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x2000) == 0x2000))
+ {
+ if (!bcmbal_buf_read_u16(buf, &this->dst_port))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x4000) == 0x4000))
+ {
+ if (!bcmbal_pkt_tag_type_unpack(&this->pkt_tag_type, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_classifier_scan(bcmbal_buf *packed, uint32_t *extra_mem)
+{
+ bcmbal_classifier_id presence_mask;
+ if (!bcmbal_classifier_id_unpack(&presence_mask, packed))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if ((((uint64_t) presence_mask & 0x0001) == 0x0001))
+ {
+ if (!bcmbal_buf_skip(packed, 2))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) presence_mask & 0x0002) == 0x0002))
+ {
+ if (!bcmbal_buf_skip(packed, 2))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) presence_mask & 0x0004) == 0x0004))
+ {
+ if (!bcmbal_buf_skip(packed, 2))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) presence_mask & 0x0008) == 0x0008))
+ {
+ if (!bcmbal_buf_skip(packed, 2))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) presence_mask & 0x0010) == 0x0010))
+ {
+ if (!bcmbal_buf_skip(packed, 1))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) presence_mask & 0x0020) == 0x0020))
+ {
+ if (!bcmbal_buf_skip(packed, 1))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) presence_mask & 0x0040) == 0x0040))
+ {
+ if (!bcmbal_buf_skip(packed, 2))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) presence_mask & 0x0080) == 0x0080))
+ {
+ if (!bcmbal_buf_skip(packed, 6))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) presence_mask & 0x0100) == 0x0100))
+ {
+ if (!bcmbal_buf_skip(packed, 6))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) presence_mask & 0x0200) == 0x0200))
+ {
+ if (!bcmbal_buf_skip(packed, 1))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) presence_mask & 0x0400) == 0x0400))
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) presence_mask & 0x0800) == 0x0800))
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) presence_mask & 0x1000) == 0x1000))
+ {
+ if (!bcmbal_buf_skip(packed, 2))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) presence_mask & 0x2000) == 0x2000))
+ {
+ if (!bcmbal_buf_skip(packed, 2))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) presence_mask & 0x4000) == 0x4000))
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_classifier_bounds_check(const bcmbal_classifier *this)
+{
+ if ((this->presence_mask & 0xFFFFFFFFFFFF8000ULL) != 0)
+ {
+ return BCMOS_FALSE;
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x4000) == 0x4000))
+ {
+ if ((this->pkt_tag_type & 0xFFFFFFF8UL) != 0)
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+void bcmbal_dest_set_default(bcmbal_dest *this)
+{
+ this->type = (bcmbal_dest_type) 0;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_dest_pack(const bcmbal_dest *this, bcmbal_buf *buf)
+{
+ if (!bcmbal_dest_type_pack(this->type, buf))
+ {
+ return BCMOS_FALSE;
+ }
+
+ switch (this->type)
+ {
+ case BCMBAL_DEST_TYPE_NNI:
+ {
+ if (!bcmbal_buf_write_u32(buf, (uint32_t) this->u.nni.int_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+ break;
+ case BCMBAL_DEST_TYPE_SUB_TERM:
+ {
+ if (!bcmbal_buf_write_u32(buf, (uint32_t) this->u.sub_term.sub_term_id))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if (!bcmbal_buf_write_u16(buf, this->u.sub_term.sub_term_uni))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if (!bcmbal_buf_write_u16(buf, this->u.sub_term.int_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+ break;
+ case BCMBAL_DEST_TYPE_HOST:
+ {
+ }
+ break;
+ default:
+ return BCMOS_FALSE;
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+uint32_t bcmbal_dest_get_packed_length(const bcmbal_dest *this)
+{
+ uint32_t count = 4;
+ switch (this->type)
+ {
+ case BCMBAL_DEST_TYPE_NNI:
+ {
+ count += 4;
+ }
+ break;
+ case BCMBAL_DEST_TYPE_SUB_TERM:
+ {
+ count += 8;
+ }
+ break;
+ case BCMBAL_DEST_TYPE_HOST:
+ {
+ }
+ break;
+ default:
+ break;
+ }
+
+ return count;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_dest_unpack(bcmbal_dest *this, bcmbal_buf *buf, void **extra_mem)
+{
+ if (!bcmbal_dest_type_unpack(&this->type, buf))
+ {
+ return BCMOS_FALSE;
+ }
+
+ switch (this->type)
+ {
+ case BCMBAL_DEST_TYPE_NNI:
+ {
+ if (!bcmbal_buf_read_u32(buf, (uint32_t *) &this->u.nni.int_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+ break;
+ case BCMBAL_DEST_TYPE_SUB_TERM:
+ {
+ if (!bcmbal_buf_read_u32(buf, (uint32_t *) &this->u.sub_term.sub_term_id))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if (!bcmbal_buf_read_u16(buf, &this->u.sub_term.sub_term_uni))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if (!bcmbal_buf_read_u16(buf, &this->u.sub_term.int_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+ break;
+ case BCMBAL_DEST_TYPE_HOST:
+ {
+ }
+ break;
+ default:
+ return BCMOS_FALSE;
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_dest_scan(bcmbal_buf *packed, uint32_t *extra_mem)
+{
+ bcmbal_dest_type type;
+ if (!bcmbal_dest_type_unpack(&type, packed))
+ {
+ return BCMOS_FALSE;
+ }
+
+ switch (type)
+ {
+ case BCMBAL_DEST_TYPE_NNI:
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+ break;
+ case BCMBAL_DEST_TYPE_SUB_TERM:
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if (!bcmbal_buf_skip(packed, 2))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if (!bcmbal_buf_skip(packed, 2))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+ break;
+ case BCMBAL_DEST_TYPE_HOST:
+ {
+ }
+ break;
+ default:
+ return BCMOS_FALSE;
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_dest_bounds_check(const bcmbal_dest *this)
+{
+ switch (this->type)
+ {
+ case BCMBAL_DEST_TYPE_NNI:
+ {
+ }
+ break;
+ case BCMBAL_DEST_TYPE_SUB_TERM:
+ {
+ }
+ break;
+ case BCMBAL_DEST_TYPE_HOST:
+ {
+ }
+ break;
+ default:
+ return BCMOS_FALSE;
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+void bcmbal_flow_id_list_u32_set_default(bcmbal_flow_id_list_u32 *this)
+{
+ this->len = 0;
+ this->val = NULL;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_flow_id_list_u32_pack(const bcmbal_flow_id_list_u32 *this, bcmbal_buf *buf)
+{
+ uint32_t i0;
+ if (!bcmbal_buf_write_u32(buf, this->len))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if ((this->len > 0) && (this->val == NULL))
+ {
+ bcmos_trace(BCMOS_TRACE_LEVEL_ERROR, "Error: list field \"val\" of struct \"bcmbal_flow_id_list_u32\" is uninitialized (NULL). You must allocate memory for this pointer before sending/receiving the message.\n");
+ return BCMOS_FALSE;
+ }
+
+ for (i0 = 0; i0 < this->len; i0++)
+ {
+ if (!bcmbal_buf_write_u32(buf, (uint32_t) this->val[i0]))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+uint32_t bcmbal_flow_id_list_u32_get_packed_length(const bcmbal_flow_id_list_u32 *this)
+{
+ return 4 + (4 * this->len);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_flow_id_list_u32_unpack(bcmbal_flow_id_list_u32 *this, bcmbal_buf *buf, void **extra_mem)
+{
+ uint32_t i0;
+ if (!bcmbal_buf_read_u32(buf, &this->len))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if ((this->len > 0) && (this->val == NULL))
+ {
+ if (extra_mem == NULL)
+ {
+ bcmos_trace(BCMOS_TRACE_LEVEL_ERROR, "Error: list field \"val\" of struct \"bcmbal_flow_id_list_u32\" is uninitialized (NULL). You must allocate memory for this pointer before sending/receiving the message.\n");
+ return BCMOS_FALSE;
+ }
+ else
+ {
+ this->val = (bcmbal_flow_id *) *extra_mem;
+ *extra_mem = ((uint8_t *) *extra_mem) + BCMOS_ROUND_TO_WORD(this->len * sizeof(bcmbal_flow_id));
+ }
+ }
+
+ for (i0 = 0; i0 < this->len; i0++)
+ {
+ if (!bcmbal_buf_read_u32(buf, (uint32_t *) &this->val[i0]))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_flow_id_list_u32_scan(bcmbal_buf *packed, uint32_t *extra_mem)
+{
+ uint32_t len;
+ if (!bcmbal_buf_read_u32(packed, &len))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *extra_mem += BCMOS_ROUND_TO_WORD(sizeof(bcmbal_flow_id) * len);
+ if (!bcmbal_buf_skip(packed, len * 4))
+ {
+ return BCMOS_FALSE;
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_flow_id_list_u32_bounds_check(const bcmbal_flow_id_list_u32 *this)
+{
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+void bcmbal_tm_queue_ref_set_default(bcmbal_tm_queue_ref *this)
+{
+ this->sched_id = (bcmbal_tm_sched_id) 0;
+ this->queue_id = (bcmbal_tm_queue_id) 0;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_queue_ref_pack(const bcmbal_tm_queue_ref *this, bcmbal_buf *buf)
+{
+ if (!bcmbal_buf_write_u32(buf, (uint32_t) this->sched_id))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if (!bcmbal_buf_write_u8(buf, (uint8_t) this->queue_id))
+ {
+ return BCMOS_FALSE;
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_queue_ref_unpack(bcmbal_tm_queue_ref *this, bcmbal_buf *buf, void **extra_mem)
+{
+ if (!bcmbal_buf_read_u32(buf, (uint32_t *) &this->sched_id))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if (!bcmbal_buf_read_u8(buf, (uint8_t *) &this->queue_id))
+ {
+ return BCMOS_FALSE;
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_queue_ref_scan(bcmbal_buf *packed, uint32_t *extra_mem)
+{
+ (void)extra_mem;
+ return bcmbal_buf_skip(packed, 5);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_queue_ref_bounds_check(const bcmbal_tm_queue_ref *this)
+{
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+void bcmbal_group_member_info_set_default(bcmbal_group_member_info *this)
+{
+ this->intf_id = (bcmbal_intf_id) 0;
+ this->svc_port_id = (bcmbal_service_port_id) 0;
+ this->action.presence_mask = (bcmbal_action_id) 0;
+ this->action.cmds_bitmask = (bcmbal_action_cmd_id) 0;
+ this->action.o_vid = 0;
+ this->action.o_pbits = 0;
+ this->action.o_tpid = 0;
+ this->action.i_vid = 0;
+ this->action.i_pbits = 0;
+ this->action.i_tpid = 0;
+ this->queue.sched_id = (bcmbal_tm_sched_id) 0;
+ this->queue.queue_id = (bcmbal_tm_queue_id) 0;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_group_member_info_pack(const bcmbal_group_member_info *this, bcmbal_buf *buf)
+{
+ if (!bcmbal_buf_write_u32(buf, (uint32_t) this->intf_id))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if (!bcmbal_buf_write_u16(buf, (uint16_t) this->svc_port_id))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if (!bcmbal_action_pack(&this->action, buf))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if (!bcmbal_tm_queue_ref_pack(&this->queue, buf))
+ {
+ return BCMOS_FALSE;
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+uint32_t bcmbal_group_member_info_get_packed_length(const bcmbal_group_member_info *this)
+{
+ return 11 + bcmbal_action_get_packed_length(&this->action);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_group_member_info_unpack(bcmbal_group_member_info *this, bcmbal_buf *buf, void **extra_mem)
+{
+ if (!bcmbal_buf_read_u32(buf, (uint32_t *) &this->intf_id))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if (!bcmbal_buf_read_u16(buf, (uint16_t *) &this->svc_port_id))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if (!bcmbal_action_unpack(&this->action, buf, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if (!bcmbal_tm_queue_ref_unpack(&this->queue, buf, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_group_member_info_scan(bcmbal_buf *packed, uint32_t *extra_mem)
+{
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if (!bcmbal_buf_skip(packed, 2))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if (!bcmbal_action_scan(packed, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if (!bcmbal_buf_skip(packed, 5))
+ {
+ return BCMOS_FALSE;
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_group_member_info_bounds_check(const bcmbal_group_member_info *this)
+{
+ if (!bcmbal_action_bounds_check(&this->action))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if (!bcmbal_tm_queue_ref_bounds_check(&this->queue))
+ {
+ return BCMOS_FALSE;
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+void bcmbal_group_member_info_list_u16_set_default(bcmbal_group_member_info_list_u16 *this)
+{
+ this->len = 0;
+ this->val = NULL;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_group_member_info_list_u16_pack(const bcmbal_group_member_info_list_u16 *this, bcmbal_buf *buf)
+{
+ uint16_t i0;
+ if (!bcmbal_buf_write_u16(buf, this->len))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if ((this->len > 0) && (this->val == NULL))
+ {
+ bcmos_trace(BCMOS_TRACE_LEVEL_ERROR, "Error: list field \"val\" of struct \"bcmbal_group_member_info_list_u16\" is uninitialized (NULL). You must allocate memory for this pointer before sending/receiving the message.\n");
+ return BCMOS_FALSE;
+ }
+
+ for (i0 = 0; i0 < this->len; i0++)
+ {
+ if (!bcmbal_group_member_info_pack(&this->val[i0], buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+uint32_t bcmbal_group_member_info_list_u16_get_packed_length(const bcmbal_group_member_info_list_u16 *this)
+{
+ uint32_t count = 2;
+ uint32_t i0;
+ if ((this->len > 0) && (this->val == NULL))
+ {
+ bcmos_trace(BCMOS_TRACE_LEVEL_ERROR, "Error: list field \"len\" of struct \"bcmbal_group_member_info_list_u16\" is uninitialized (NULL). You must allocate memory for this pointer before sending/receiving the message.\n");
+ return 0;
+ }
+
+ for (i0 = 0; i0 < this->len; i0++)
+ {
+ count += bcmbal_group_member_info_get_packed_length(&this->val[i0]);
+ }
+
+ return count;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_group_member_info_list_u16_unpack(bcmbal_group_member_info_list_u16 *this, bcmbal_buf *buf, void **extra_mem)
+{
+ uint16_t i0;
+ if (!bcmbal_buf_read_u16(buf, &this->len))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if ((this->len > 0) && (this->val == NULL))
+ {
+ if (extra_mem == NULL)
+ {
+ bcmos_trace(BCMOS_TRACE_LEVEL_ERROR, "Error: list field \"val\" of struct \"bcmbal_group_member_info_list_u16\" is uninitialized (NULL). You must allocate memory for this pointer before sending/receiving the message.\n");
+ return BCMOS_FALSE;
+ }
+ else
+ {
+ this->val = (bcmbal_group_member_info *) *extra_mem;
+ *extra_mem = ((uint8_t *) *extra_mem) + BCMOS_ROUND_TO_WORD(this->len * sizeof(bcmbal_group_member_info));
+ }
+ }
+
+ for (i0 = 0; i0 < this->len; i0++)
+ {
+ if (!bcmbal_group_member_info_unpack(&this->val[i0], buf, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_group_member_info_list_u16_scan(bcmbal_buf *packed, uint32_t *extra_mem)
+{
+ uint16_t len;
+ uint16_t i0;
+ if (!bcmbal_buf_read_u16(packed, &len))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *extra_mem += BCMOS_ROUND_TO_WORD(sizeof(bcmbal_group_member_info) * len);
+ for (i0 = 0; i0 < len; i0++)
+ {
+ if (!bcmbal_group_member_info_scan(packed, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_group_member_info_list_u16_bounds_check(const bcmbal_group_member_info_list_u16 *this)
+{
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+void bcmbal_password_set_default(bcmbal_password *this)
+{
+ memset(this->arr, 0, sizeof(this->arr));
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_password_pack(const bcmbal_password *this, bcmbal_buf *buf)
+{
+ if (!bcmbal_buf_write(buf, this->arr, 10))
+ {
+ return BCMOS_FALSE;
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_password_unpack(bcmbal_password *this, bcmbal_buf *buf, void **extra_mem)
+{
+ if (!bcmbal_buf_read(buf, this->arr, 10))
+ {
+ return BCMOS_FALSE;
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_password_scan(bcmbal_buf *packed, uint32_t *extra_mem)
+{
+ (void)extra_mem;
+ return bcmbal_buf_skip(packed, 10);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_password_bounds_check(const bcmbal_password *this)
+{
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+void bcmbal_registration_id_set_default(bcmbal_registration_id *this)
+{
+ memset(this->arr, 0, sizeof(this->arr));
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_registration_id_pack(const bcmbal_registration_id *this, bcmbal_buf *buf)
+{
+ if (!bcmbal_buf_write(buf, this->arr, 36))
+ {
+ return BCMOS_FALSE;
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_registration_id_unpack(bcmbal_registration_id *this, bcmbal_buf *buf, void **extra_mem)
+{
+ if (!bcmbal_buf_read(buf, this->arr, 36))
+ {
+ return BCMOS_FALSE;
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_registration_id_scan(bcmbal_buf *packed, uint32_t *extra_mem)
+{
+ (void)extra_mem;
+ return bcmbal_buf_skip(packed, 36);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_registration_id_bounds_check(const bcmbal_registration_id *this)
+{
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+void bcmbal_serial_number_set_default(bcmbal_serial_number *this)
+{
+ memset(this->vendor_id, 0, sizeof(this->vendor_id));
+ memset(this->vendor_specific, 0, sizeof(this->vendor_specific));
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_serial_number_pack(const bcmbal_serial_number *this, bcmbal_buf *buf)
+{
+ if (!bcmbal_buf_write(buf, this->vendor_id, 4))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if (!bcmbal_buf_write(buf, this->vendor_specific, 4))
+ {
+ return BCMOS_FALSE;
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_serial_number_unpack(bcmbal_serial_number *this, bcmbal_buf *buf, void **extra_mem)
+{
+ if (!bcmbal_buf_read(buf, this->vendor_id, 4))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if (!bcmbal_buf_read(buf, this->vendor_specific, 4))
+ {
+ return BCMOS_FALSE;
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_serial_number_scan(bcmbal_buf *packed, uint32_t *extra_mem)
+{
+ (void)extra_mem;
+ return bcmbal_buf_skip(packed, 8);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_serial_number_bounds_check(const bcmbal_serial_number *this)
+{
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+void bcmbal_service_port_id_list_u8_set_default(bcmbal_service_port_id_list_u8 *this)
+{
+ this->len = 0;
+ this->val = NULL;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_service_port_id_list_u8_pack(const bcmbal_service_port_id_list_u8 *this, bcmbal_buf *buf)
+{
+ uint8_t i0;
+ if (!bcmbal_buf_write_u8(buf, this->len))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if ((this->len > 0) && (this->val == NULL))
+ {
+ bcmos_trace(BCMOS_TRACE_LEVEL_ERROR, "Error: list field \"val\" of struct \"bcmbal_service_port_id_list_u8\" is uninitialized (NULL). You must allocate memory for this pointer before sending/receiving the message.\n");
+ return BCMOS_FALSE;
+ }
+
+ for (i0 = 0; i0 < this->len; i0++)
+ {
+ if (!bcmbal_buf_write_u16(buf, (uint16_t) this->val[i0]))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+uint32_t bcmbal_service_port_id_list_u8_get_packed_length(const bcmbal_service_port_id_list_u8 *this)
+{
+ return 1 + (2 * this->len);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_service_port_id_list_u8_unpack(bcmbal_service_port_id_list_u8 *this, bcmbal_buf *buf, void **extra_mem)
+{
+ uint8_t i0;
+ if (!bcmbal_buf_read_u8(buf, &this->len))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if ((this->len > 0) && (this->val == NULL))
+ {
+ if (extra_mem == NULL)
+ {
+ bcmos_trace(BCMOS_TRACE_LEVEL_ERROR, "Error: list field \"val\" of struct \"bcmbal_service_port_id_list_u8\" is uninitialized (NULL). You must allocate memory for this pointer before sending/receiving the message.\n");
+ return BCMOS_FALSE;
+ }
+ else
+ {
+ this->val = (bcmbal_service_port_id *) *extra_mem;
+ *extra_mem = ((uint8_t *) *extra_mem) + BCMOS_ROUND_TO_WORD(this->len * sizeof(bcmbal_service_port_id));
+ }
+ }
+
+ for (i0 = 0; i0 < this->len; i0++)
+ {
+ if (!bcmbal_buf_read_u16(buf, (uint16_t *) &this->val[i0]))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_service_port_id_list_u8_scan(bcmbal_buf *packed, uint32_t *extra_mem)
+{
+ uint8_t len;
+ if (!bcmbal_buf_read_u8(packed, &len))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *extra_mem += BCMOS_ROUND_TO_WORD(sizeof(bcmbal_service_port_id) * len);
+ if (!bcmbal_buf_skip(packed, len * 2))
+ {
+ return BCMOS_FALSE;
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_service_port_id_list_u8_bounds_check(const bcmbal_service_port_id_list_u8 *this)
+{
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+void bcmbal_sla_set_default(bcmbal_sla *this)
+{
+ this->presence_mask = (bcmbal_sla_id) 0;
+ this->min_rate = 0;
+ this->max_rate = 0;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_sla_pack(const bcmbal_sla *this, bcmbal_buf *buf)
+{
+ if (!bcmbal_sla_id_pack(this->presence_mask, buf))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0001) == 0x0001))
+ {
+ if (!bcmbal_buf_write_u32(buf, this->min_rate))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0002) == 0x0002))
+ {
+ if (!bcmbal_buf_write_u32(buf, this->max_rate))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+uint32_t bcmbal_sla_get_packed_length(const bcmbal_sla *this)
+{
+ uint32_t count = 8;
+ if ((((uint64_t) this->presence_mask & 0x0001) == 0x0001))
+ {
+ count += 4;
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0002) == 0x0002))
+ {
+ count += 4;
+ }
+
+ return count;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_sla_unpack(bcmbal_sla *this, bcmbal_buf *buf, void **extra_mem)
+{
+ if (!bcmbal_sla_id_unpack(&this->presence_mask, buf))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0001) == 0x0001))
+ {
+ if (!bcmbal_buf_read_u32(buf, &this->min_rate))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0002) == 0x0002))
+ {
+ if (!bcmbal_buf_read_u32(buf, &this->max_rate))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_sla_scan(bcmbal_buf *packed, uint32_t *extra_mem)
+{
+ bcmbal_sla_id presence_mask;
+ if (!bcmbal_sla_id_unpack(&presence_mask, packed))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if ((((uint64_t) presence_mask & 0x0001) == 0x0001))
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) presence_mask & 0x0002) == 0x0002))
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_sla_bounds_check(const bcmbal_sla *this)
+{
+ if ((this->presence_mask & 0xFFFFFFFFFFFFFFFCULL) != 0)
+ {
+ return BCMOS_FALSE;
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+void bcmbal_sub_id_list_u16_set_default(bcmbal_sub_id_list_u16 *this)
+{
+ this->len = 0;
+ this->val = NULL;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_sub_id_list_u16_pack(const bcmbal_sub_id_list_u16 *this, bcmbal_buf *buf)
+{
+ uint16_t i0;
+ if (!bcmbal_buf_write_u16(buf, this->len))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if ((this->len > 0) && (this->val == NULL))
+ {
+ bcmos_trace(BCMOS_TRACE_LEVEL_ERROR, "Error: list field \"val\" of struct \"bcmbal_sub_id_list_u16\" is uninitialized (NULL). You must allocate memory for this pointer before sending/receiving the message.\n");
+ return BCMOS_FALSE;
+ }
+
+ for (i0 = 0; i0 < this->len; i0++)
+ {
+ if (!bcmbal_buf_write_u32(buf, (uint32_t) this->val[i0]))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+uint32_t bcmbal_sub_id_list_u16_get_packed_length(const bcmbal_sub_id_list_u16 *this)
+{
+ return 2 + (4 * this->len);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_sub_id_list_u16_unpack(bcmbal_sub_id_list_u16 *this, bcmbal_buf *buf, void **extra_mem)
+{
+ uint16_t i0;
+ if (!bcmbal_buf_read_u16(buf, &this->len))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if ((this->len > 0) && (this->val == NULL))
+ {
+ if (extra_mem == NULL)
+ {
+ bcmos_trace(BCMOS_TRACE_LEVEL_ERROR, "Error: list field \"val\" of struct \"bcmbal_sub_id_list_u16\" is uninitialized (NULL). You must allocate memory for this pointer before sending/receiving the message.\n");
+ return BCMOS_FALSE;
+ }
+ else
+ {
+ this->val = (bcmbal_sub_id *) *extra_mem;
+ *extra_mem = ((uint8_t *) *extra_mem) + BCMOS_ROUND_TO_WORD(this->len * sizeof(bcmbal_sub_id));
+ }
+ }
+
+ for (i0 = 0; i0 < this->len; i0++)
+ {
+ if (!bcmbal_buf_read_u32(buf, (uint32_t *) &this->val[i0]))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_sub_id_list_u16_scan(bcmbal_buf *packed, uint32_t *extra_mem)
+{
+ uint16_t len;
+ if (!bcmbal_buf_read_u16(packed, &len))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *extra_mem += BCMOS_ROUND_TO_WORD(sizeof(bcmbal_sub_id) * len);
+ if (!bcmbal_buf_skip(packed, len * 4))
+ {
+ return BCMOS_FALSE;
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_sub_id_list_u16_bounds_check(const bcmbal_sub_id_list_u16 *this)
+{
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+void bcmbal_tm_red_set_default(bcmbal_tm_red *this)
+{
+ this->min_threshold = (bcmbal_percent) 0;
+ this->max_threshold = (bcmbal_percent) 0;
+ this->max_probability = (bcmbal_percent) 0;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_red_pack(const bcmbal_tm_red *this, bcmbal_buf *buf)
+{
+ if (!bcmbal_buf_write_u8(buf, (uint8_t) this->min_threshold))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if (!bcmbal_buf_write_u8(buf, (uint8_t) this->max_threshold))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if (!bcmbal_buf_write_u8(buf, (uint8_t) this->max_probability))
+ {
+ return BCMOS_FALSE;
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_red_unpack(bcmbal_tm_red *this, bcmbal_buf *buf, void **extra_mem)
+{
+ if (!bcmbal_buf_read_u8(buf, (uint8_t *) &this->min_threshold))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if (!bcmbal_buf_read_u8(buf, (uint8_t *) &this->max_threshold))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if (!bcmbal_buf_read_u8(buf, (uint8_t *) &this->max_probability))
+ {
+ return BCMOS_FALSE;
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_red_scan(bcmbal_buf *packed, uint32_t *extra_mem)
+{
+ (void)extra_mem;
+ return bcmbal_buf_skip(packed, 3);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_red_bounds_check(const bcmbal_tm_red *this)
+{
+ if (this->min_threshold > (bcmbal_percent) 100)
+ {
+ return BCMOS_FALSE;
+ }
+
+ if (this->max_threshold > (bcmbal_percent) 100)
+ {
+ return BCMOS_FALSE;
+ }
+
+ if (this->max_probability > (bcmbal_percent) 100)
+ {
+ return BCMOS_FALSE;
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+void bcmbal_tm_bac_set_default(bcmbal_tm_bac *this)
+{
+ this->type = (bcmbal_tm_bac_type) 0;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_bac_pack(const bcmbal_tm_bac *this, bcmbal_buf *buf)
+{
+ if (!bcmbal_tm_bac_type_pack(this->type, buf))
+ {
+ return BCMOS_FALSE;
+ }
+
+ switch (this->type)
+ {
+ case BCMBAL_TM_BAC_TYPE_TAILDROP:
+ {
+ if (!bcmbal_buf_write_u32(buf, this->u.taildrop.max_size))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+ break;
+ case BCMBAL_TM_BAC_TYPE_RED:
+ {
+ if (!bcmbal_tm_red_pack(&this->u.red.red, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+ break;
+ case BCMBAL_TM_BAC_TYPE_WRED:
+ {
+ if (!bcmbal_tm_red_pack(&this->u.wred.green, buf))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if (!bcmbal_tm_red_pack(&this->u.wred.yellow, buf))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if (!bcmbal_tm_red_pack(&this->u.wred.red, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+ break;
+ case BCMBAL_TM_BAC_TYPE_WTAILDROP:
+ default:
+ return BCMOS_FALSE;
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+uint32_t bcmbal_tm_bac_get_packed_length(const bcmbal_tm_bac *this)
+{
+ uint32_t count = 1;
+ switch (this->type)
+ {
+ case BCMBAL_TM_BAC_TYPE_TAILDROP:
+ {
+ count += 4;
+ }
+ break;
+ case BCMBAL_TM_BAC_TYPE_RED:
+ {
+ count += 3;
+ }
+ break;
+ case BCMBAL_TM_BAC_TYPE_WRED:
+ {
+ count += 9;
+ }
+ break;
+ case BCMBAL_TM_BAC_TYPE_WTAILDROP:
+ default:
+ break;
+ }
+
+ return count;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_bac_unpack(bcmbal_tm_bac *this, bcmbal_buf *buf, void **extra_mem)
+{
+ if (!bcmbal_tm_bac_type_unpack(&this->type, buf))
+ {
+ return BCMOS_FALSE;
+ }
+
+ switch (this->type)
+ {
+ case BCMBAL_TM_BAC_TYPE_TAILDROP:
+ {
+ if (!bcmbal_buf_read_u32(buf, &this->u.taildrop.max_size))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+ break;
+ case BCMBAL_TM_BAC_TYPE_RED:
+ {
+ if (!bcmbal_tm_red_unpack(&this->u.red.red, buf, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+ break;
+ case BCMBAL_TM_BAC_TYPE_WRED:
+ {
+ if (!bcmbal_tm_red_unpack(&this->u.wred.green, buf, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if (!bcmbal_tm_red_unpack(&this->u.wred.yellow, buf, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if (!bcmbal_tm_red_unpack(&this->u.wred.red, buf, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+ break;
+ case BCMBAL_TM_BAC_TYPE_WTAILDROP:
+ default:
+ return BCMOS_FALSE;
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_bac_scan(bcmbal_buf *packed, uint32_t *extra_mem)
+{
+ bcmbal_tm_bac_type type;
+ if (!bcmbal_tm_bac_type_unpack(&type, packed))
+ {
+ return BCMOS_FALSE;
+ }
+
+ switch (type)
+ {
+ case BCMBAL_TM_BAC_TYPE_TAILDROP:
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+ break;
+ case BCMBAL_TM_BAC_TYPE_RED:
+ {
+ if (!bcmbal_buf_skip(packed, 3))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+ break;
+ case BCMBAL_TM_BAC_TYPE_WRED:
+ {
+ if (!bcmbal_buf_skip(packed, 3))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if (!bcmbal_buf_skip(packed, 3))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if (!bcmbal_buf_skip(packed, 3))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+ break;
+ case BCMBAL_TM_BAC_TYPE_WTAILDROP:
+ default:
+ return BCMOS_FALSE;
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_bac_bounds_check(const bcmbal_tm_bac *this)
+{
+ switch (this->type)
+ {
+ case BCMBAL_TM_BAC_TYPE_TAILDROP:
+ {
+ }
+ break;
+ case BCMBAL_TM_BAC_TYPE_RED:
+ {
+ if (!bcmbal_tm_red_bounds_check(&this->u.red.red))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+ break;
+ case BCMBAL_TM_BAC_TYPE_WRED:
+ {
+ if (!bcmbal_tm_red_bounds_check(&this->u.wred.green))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if (!bcmbal_tm_red_bounds_check(&this->u.wred.yellow))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if (!bcmbal_tm_red_bounds_check(&this->u.wred.red))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+ break;
+ case BCMBAL_TM_BAC_TYPE_WTAILDROP:
+ break;
+ default:
+ return BCMOS_FALSE;
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+void bcmbal_tm_queue_id_list_u8_set_default(bcmbal_tm_queue_id_list_u8 *this)
+{
+ this->len = 0;
+ this->val = NULL;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_queue_id_list_u8_pack(const bcmbal_tm_queue_id_list_u8 *this, bcmbal_buf *buf)
+{
+ uint8_t i0;
+ if (!bcmbal_buf_write_u8(buf, this->len))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if ((this->len > 0) && (this->val == NULL))
+ {
+ bcmos_trace(BCMOS_TRACE_LEVEL_ERROR, "Error: list field \"val\" of struct \"bcmbal_tm_queue_id_list_u8\" is uninitialized (NULL). You must allocate memory for this pointer before sending/receiving the message.\n");
+ return BCMOS_FALSE;
+ }
+
+ for (i0 = 0; i0 < this->len; i0++)
+ {
+ if (!bcmbal_buf_write_u8(buf, (uint8_t) this->val[i0]))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+uint32_t bcmbal_tm_queue_id_list_u8_get_packed_length(const bcmbal_tm_queue_id_list_u8 *this)
+{
+ return 1 + this->len;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_queue_id_list_u8_unpack(bcmbal_tm_queue_id_list_u8 *this, bcmbal_buf *buf, void **extra_mem)
+{
+ uint8_t i0;
+ if (!bcmbal_buf_read_u8(buf, &this->len))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if ((this->len > 0) && (this->val == NULL))
+ {
+ if (extra_mem == NULL)
+ {
+ bcmos_trace(BCMOS_TRACE_LEVEL_ERROR, "Error: list field \"val\" of struct \"bcmbal_tm_queue_id_list_u8\" is uninitialized (NULL). You must allocate memory for this pointer before sending/receiving the message.\n");
+ return BCMOS_FALSE;
+ }
+ else
+ {
+ this->val = (bcmbal_tm_queue_id *) *extra_mem;
+ *extra_mem = ((uint8_t *) *extra_mem) + BCMOS_ROUND_TO_WORD(this->len * sizeof(bcmbal_tm_queue_id));
+ }
+ }
+
+ for (i0 = 0; i0 < this->len; i0++)
+ {
+ if (!bcmbal_buf_read_u8(buf, (uint8_t *) &this->val[i0]))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_queue_id_list_u8_scan(bcmbal_buf *packed, uint32_t *extra_mem)
+{
+ uint8_t len;
+ if (!bcmbal_buf_read_u8(packed, &len))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *extra_mem += BCMOS_ROUND_TO_WORD(sizeof(bcmbal_tm_queue_id) * len);
+ if (!bcmbal_buf_skip(packed, len * 1))
+ {
+ return BCMOS_FALSE;
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_queue_id_list_u8_bounds_check(const bcmbal_tm_queue_id_list_u8 *this)
+{
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+void bcmbal_tm_sched_id_list_u8_set_default(bcmbal_tm_sched_id_list_u8 *this)
+{
+ this->len = 0;
+ this->val = NULL;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_sched_id_list_u8_pack(const bcmbal_tm_sched_id_list_u8 *this, bcmbal_buf *buf)
+{
+ uint8_t i0;
+ if (!bcmbal_buf_write_u8(buf, this->len))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if ((this->len > 0) && (this->val == NULL))
+ {
+ bcmos_trace(BCMOS_TRACE_LEVEL_ERROR, "Error: list field \"val\" of struct \"bcmbal_tm_sched_id_list_u8\" is uninitialized (NULL). You must allocate memory for this pointer before sending/receiving the message.\n");
+ return BCMOS_FALSE;
+ }
+
+ for (i0 = 0; i0 < this->len; i0++)
+ {
+ if (!bcmbal_buf_write_u32(buf, (uint32_t) this->val[i0]))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+uint32_t bcmbal_tm_sched_id_list_u8_get_packed_length(const bcmbal_tm_sched_id_list_u8 *this)
+{
+ return 1 + (4 * this->len);
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_sched_id_list_u8_unpack(bcmbal_tm_sched_id_list_u8 *this, bcmbal_buf *buf, void **extra_mem)
+{
+ uint8_t i0;
+ if (!bcmbal_buf_read_u8(buf, &this->len))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if ((this->len > 0) && (this->val == NULL))
+ {
+ if (extra_mem == NULL)
+ {
+ bcmos_trace(BCMOS_TRACE_LEVEL_ERROR, "Error: list field \"val\" of struct \"bcmbal_tm_sched_id_list_u8\" is uninitialized (NULL). You must allocate memory for this pointer before sending/receiving the message.\n");
+ return BCMOS_FALSE;
+ }
+ else
+ {
+ this->val = (bcmbal_tm_sched_id *) *extra_mem;
+ *extra_mem = ((uint8_t *) *extra_mem) + BCMOS_ROUND_TO_WORD(this->len * sizeof(bcmbal_tm_sched_id));
+ }
+ }
+
+ for (i0 = 0; i0 < this->len; i0++)
+ {
+ if (!bcmbal_buf_read_u32(buf, (uint32_t *) &this->val[i0]))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_sched_id_list_u8_scan(bcmbal_buf *packed, uint32_t *extra_mem)
+{
+ uint8_t len;
+ if (!bcmbal_buf_read_u8(packed, &len))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *extra_mem += BCMOS_ROUND_TO_WORD(sizeof(bcmbal_tm_sched_id) * len);
+ if (!bcmbal_buf_skip(packed, len * 4))
+ {
+ return BCMOS_FALSE;
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_sched_id_list_u8_bounds_check(const bcmbal_tm_sched_id_list_u8 *this)
+{
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+void bcmbal_tm_sched_owner_set_default(bcmbal_tm_sched_owner *this)
+{
+ this->type = (bcmbal_tm_sched_owner_type) 0;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_sched_owner_pack(const bcmbal_tm_sched_owner *this, bcmbal_buf *buf)
+{
+ if (!bcmbal_tm_sched_owner_type_pack(this->type, buf))
+ {
+ return BCMOS_FALSE;
+ }
+
+ switch (this->type)
+ {
+ case BCMBAL_TM_SCHED_OWNER_TYPE_INTERFACE:
+ {
+ if (!bcmbal_intf_type_pack(this->u.interface.intf_type, buf))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if (!bcmbal_buf_write_u32(buf, (uint32_t) this->u.interface.intf_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+ break;
+ case BCMBAL_TM_SCHED_OWNER_TYPE_SUB_TERM:
+ {
+ if (!bcmbal_buf_write_u32(buf, (uint32_t) this->u.sub_term.intf_id))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if (!bcmbal_buf_write_u32(buf, (uint32_t) this->u.sub_term.sub_term_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+ break;
+ case BCMBAL_TM_SCHED_OWNER_TYPE_AGG_PORT:
+ {
+ if (!bcmbal_tm_sched_owner_agg_port_id_pack(this->u.agg_port.presence_mask, buf))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if ((((uint64_t) this->u.agg_port.presence_mask & 0x0001) == 0x0001))
+ {
+ if (!bcmbal_buf_write_u8(buf, this->u.agg_port.intf_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->u.agg_port.presence_mask & 0x0002) == 0x0002))
+ {
+ if (!bcmbal_buf_write_u32(buf, (uint32_t) this->u.agg_port.sub_term_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->u.agg_port.presence_mask & 0x0004) == 0x0004))
+ {
+ if (!bcmbal_buf_write_u16(buf, (uint16_t) this->u.agg_port.agg_port_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+ }
+ break;
+ case BCMBAL_TM_SCHED_OWNER_TYPE_UNI:
+ {
+ if (!bcmbal_buf_write_u8(buf, this->u.uni.intf_id))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if (!bcmbal_buf_write_u32(buf, (uint32_t) this->u.uni.sub_term_id))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if (!bcmbal_buf_write_u8(buf, this->u.uni.idx))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+ break;
+ case BCMBAL_TM_SCHED_OWNER_TYPE_VIRTUAL:
+ {
+ if (!bcmbal_buf_write_u32(buf, this->u.virtual.idx))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+ break;
+ case BCMBAL_TM_SCHED_OWNER_TYPE_UNDEFINED:
+ default:
+ return BCMOS_FALSE;
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+uint32_t bcmbal_tm_sched_owner_get_packed_length(const bcmbal_tm_sched_owner *this)
+{
+ uint32_t count = 1;
+ switch (this->type)
+ {
+ case BCMBAL_TM_SCHED_OWNER_TYPE_INTERFACE:
+ {
+ count += 8;
+ }
+ break;
+ case BCMBAL_TM_SCHED_OWNER_TYPE_SUB_TERM:
+ {
+ count += 8;
+ }
+ break;
+ case BCMBAL_TM_SCHED_OWNER_TYPE_AGG_PORT:
+ {
+ count += 15;
+ }
+ break;
+ case BCMBAL_TM_SCHED_OWNER_TYPE_UNI:
+ {
+ count += 6;
+ }
+ break;
+ case BCMBAL_TM_SCHED_OWNER_TYPE_VIRTUAL:
+ {
+ count += 4;
+ }
+ break;
+ case BCMBAL_TM_SCHED_OWNER_TYPE_UNDEFINED:
+ default:
+ break;
+ }
+
+ return count;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_sched_owner_unpack(bcmbal_tm_sched_owner *this, bcmbal_buf *buf, void **extra_mem)
+{
+ if (!bcmbal_tm_sched_owner_type_unpack(&this->type, buf))
+ {
+ return BCMOS_FALSE;
+ }
+
+ switch (this->type)
+ {
+ case BCMBAL_TM_SCHED_OWNER_TYPE_INTERFACE:
+ {
+ if (!bcmbal_intf_type_unpack(&this->u.interface.intf_type, buf))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if (!bcmbal_buf_read_u32(buf, (uint32_t *) &this->u.interface.intf_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+ break;
+ case BCMBAL_TM_SCHED_OWNER_TYPE_SUB_TERM:
+ {
+ if (!bcmbal_buf_read_u32(buf, (uint32_t *) &this->u.sub_term.intf_id))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if (!bcmbal_buf_read_u32(buf, (uint32_t *) &this->u.sub_term.sub_term_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+ break;
+ case BCMBAL_TM_SCHED_OWNER_TYPE_AGG_PORT:
+ {
+ if (!bcmbal_tm_sched_owner_agg_port_id_unpack(&this->u.agg_port.presence_mask, buf))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if ((((uint64_t) this->u.agg_port.presence_mask & 0x0001) == 0x0001))
+ {
+ if (!bcmbal_buf_read_u8(buf, &this->u.agg_port.intf_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->u.agg_port.presence_mask & 0x0002) == 0x0002))
+ {
+ if (!bcmbal_buf_read_u32(buf, (uint32_t *) &this->u.agg_port.sub_term_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->u.agg_port.presence_mask & 0x0004) == 0x0004))
+ {
+ if (!bcmbal_buf_read_u16(buf, (uint16_t *) &this->u.agg_port.agg_port_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+ }
+ break;
+ case BCMBAL_TM_SCHED_OWNER_TYPE_UNI:
+ {
+ if (!bcmbal_buf_read_u8(buf, &this->u.uni.intf_id))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if (!bcmbal_buf_read_u32(buf, (uint32_t *) &this->u.uni.sub_term_id))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if (!bcmbal_buf_read_u8(buf, &this->u.uni.idx))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+ break;
+ case BCMBAL_TM_SCHED_OWNER_TYPE_VIRTUAL:
+ {
+ if (!bcmbal_buf_read_u32(buf, &this->u.virtual.idx))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+ break;
+ case BCMBAL_TM_SCHED_OWNER_TYPE_UNDEFINED:
+ default:
+ return BCMOS_FALSE;
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_sched_owner_scan(bcmbal_buf *packed, uint32_t *extra_mem)
+{
+ bcmbal_tm_sched_owner_type type;
+ if (!bcmbal_tm_sched_owner_type_unpack(&type, packed))
+ {
+ return BCMOS_FALSE;
+ }
+
+ switch (type)
+ {
+ case BCMBAL_TM_SCHED_OWNER_TYPE_INTERFACE:
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+ break;
+ case BCMBAL_TM_SCHED_OWNER_TYPE_SUB_TERM:
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+ break;
+ case BCMBAL_TM_SCHED_OWNER_TYPE_AGG_PORT:
+ {
+ bcmbal_tm_sched_owner_agg_port_id presence_mask;
+ if (!bcmbal_tm_sched_owner_agg_port_id_unpack(&presence_mask, packed))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if ((((uint64_t) presence_mask & 0x0001) == 0x0001))
+ {
+ if (!bcmbal_buf_skip(packed, 1))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) presence_mask & 0x0002) == 0x0002))
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) presence_mask & 0x0004) == 0x0004))
+ {
+ if (!bcmbal_buf_skip(packed, 2))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+ }
+ break;
+ case BCMBAL_TM_SCHED_OWNER_TYPE_UNI:
+ {
+ if (!bcmbal_buf_skip(packed, 1))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if (!bcmbal_buf_skip(packed, 1))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+ break;
+ case BCMBAL_TM_SCHED_OWNER_TYPE_VIRTUAL:
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+ break;
+ case BCMBAL_TM_SCHED_OWNER_TYPE_UNDEFINED:
+ default:
+ return BCMOS_FALSE;
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_sched_owner_bounds_check(const bcmbal_tm_sched_owner *this)
+{
+ switch (this->type)
+ {
+ case BCMBAL_TM_SCHED_OWNER_TYPE_INTERFACE:
+ {
+ switch (this->u.interface.intf_type)
+ {
+ case BCMBAL_INTF_TYPE_NNI:
+ break;
+ case BCMBAL_INTF_TYPE_PON:
+ break;
+ default:
+ return BCMOS_FALSE;
+ }
+ }
+ break;
+ case BCMBAL_TM_SCHED_OWNER_TYPE_SUB_TERM:
+ {
+ }
+ break;
+ case BCMBAL_TM_SCHED_OWNER_TYPE_AGG_PORT:
+ {
+ if ((this->u.agg_port.presence_mask & 0xFFFFFFFFFFFFFFF8ULL) != 0)
+ {
+ return BCMOS_FALSE;
+ }
+ }
+ break;
+ case BCMBAL_TM_SCHED_OWNER_TYPE_UNI:
+ {
+ }
+ break;
+ case BCMBAL_TM_SCHED_OWNER_TYPE_VIRTUAL:
+ {
+ }
+ break;
+ case BCMBAL_TM_SCHED_OWNER_TYPE_UNDEFINED:
+ break;
+ default:
+ return BCMOS_FALSE;
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+void bcmbal_tm_sched_parent_set_default(bcmbal_tm_sched_parent *this)
+{
+ this->presence_mask = (bcmbal_tm_sched_parent_id) 0;
+ this->sched_id = (bcmbal_tm_sched_id) 0;
+ this->priority = (bcmbal_tm_priority) 0;
+ this->weight = (bcmbal_tm_weight) 0;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_sched_parent_pack(const bcmbal_tm_sched_parent *this, bcmbal_buf *buf)
+{
+ if (!bcmbal_tm_sched_parent_id_pack(this->presence_mask, buf))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0001) == 0x0001))
+ {
+ if (!bcmbal_buf_write_u32(buf, (uint32_t) this->sched_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0002) == 0x0002))
+ {
+ if (!bcmbal_buf_write_u8(buf, (uint8_t) this->priority))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0004) == 0x0004))
+ {
+ if (!bcmbal_buf_write_u8(buf, (uint8_t) this->weight))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+uint32_t bcmbal_tm_sched_parent_get_packed_length(const bcmbal_tm_sched_parent *this)
+{
+ uint32_t count = 8;
+ if ((((uint64_t) this->presence_mask & 0x0001) == 0x0001))
+ {
+ count += 4;
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0002) == 0x0002))
+ {
+ count += 1;
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0004) == 0x0004))
+ {
+ count += 1;
+ }
+
+ return count;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_sched_parent_unpack(bcmbal_tm_sched_parent *this, bcmbal_buf *buf, void **extra_mem)
+{
+ if (!bcmbal_tm_sched_parent_id_unpack(&this->presence_mask, buf))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0001) == 0x0001))
+ {
+ if (!bcmbal_buf_read_u32(buf, (uint32_t *) &this->sched_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0002) == 0x0002))
+ {
+ if (!bcmbal_buf_read_u8(buf, (uint8_t *) &this->priority))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0004) == 0x0004))
+ {
+ if (!bcmbal_buf_read_u8(buf, (uint8_t *) &this->weight))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_sched_parent_scan(bcmbal_buf *packed, uint32_t *extra_mem)
+{
+ bcmbal_tm_sched_parent_id presence_mask;
+ if (!bcmbal_tm_sched_parent_id_unpack(&presence_mask, packed))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if ((((uint64_t) presence_mask & 0x0001) == 0x0001))
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) presence_mask & 0x0002) == 0x0002))
+ {
+ if (!bcmbal_buf_skip(packed, 1))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) presence_mask & 0x0004) == 0x0004))
+ {
+ if (!bcmbal_buf_skip(packed, 1))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_sched_parent_bounds_check(const bcmbal_tm_sched_parent *this)
+{
+ if ((this->presence_mask & 0xFFFFFFFFFFFFFFF8ULL) != 0)
+ {
+ return BCMOS_FALSE;
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+void bcmbal_tm_shaping_set_default(bcmbal_tm_shaping *this)
+{
+ this->presence_mask = (bcmbal_tm_shaping_id) 0;
+ this->sbr = 0;
+ this->pbr = 0;
+ this->burst = 0;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_shaping_pack(const bcmbal_tm_shaping *this, bcmbal_buf *buf)
+{
+ if (!bcmbal_tm_shaping_id_pack(this->presence_mask, buf))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0001) == 0x0001))
+ {
+ if (!bcmbal_buf_write_u32(buf, this->sbr))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0002) == 0x0002))
+ {
+ if (!bcmbal_buf_write_u32(buf, this->pbr))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0004) == 0x0004))
+ {
+ if (!bcmbal_buf_write_u32(buf, this->burst))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+uint32_t bcmbal_tm_shaping_get_packed_length(const bcmbal_tm_shaping *this)
+{
+ uint32_t count = 8;
+ if ((((uint64_t) this->presence_mask & 0x0001) == 0x0001))
+ {
+ count += 4;
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0002) == 0x0002))
+ {
+ count += 4;
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0004) == 0x0004))
+ {
+ count += 4;
+ }
+
+ return count;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_shaping_unpack(bcmbal_tm_shaping *this, bcmbal_buf *buf, void **extra_mem)
+{
+ if (!bcmbal_tm_shaping_id_unpack(&this->presence_mask, buf))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0001) == 0x0001))
+ {
+ if (!bcmbal_buf_read_u32(buf, &this->sbr))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0002) == 0x0002))
+ {
+ if (!bcmbal_buf_read_u32(buf, &this->pbr))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0004) == 0x0004))
+ {
+ if (!bcmbal_buf_read_u32(buf, &this->burst))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_shaping_scan(bcmbal_buf *packed, uint32_t *extra_mem)
+{
+ bcmbal_tm_shaping_id presence_mask;
+ if (!bcmbal_tm_shaping_id_unpack(&presence_mask, packed))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if ((((uint64_t) presence_mask & 0x0001) == 0x0001))
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) presence_mask & 0x0002) == 0x0002))
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) presence_mask & 0x0004) == 0x0004))
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_shaping_bounds_check(const bcmbal_tm_shaping *this)
+{
+ if ((this->presence_mask & 0xFFFFFFFFFFFFFFF8ULL) != 0)
+ {
+ return BCMOS_FALSE;
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+void bcmbal_tm_tcont_sla_set_default(bcmbal_tm_tcont_sla *this)
+{
+ this->presence_mask = (bcmbal_tm_tcont_sla_id) 0;
+ this->extra_bw_elig = BCMBAL_EXTRA_BW_ELIGIBILITY_TYPE_NONE;
+ this->nrt_cbr = 0;
+ this->rt_cbr = 0;
+ this->rt_profile = 0;
+ this->nrt_profile = 0;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_tcont_sla_pack(const bcmbal_tm_tcont_sla *this, bcmbal_buf *buf)
+{
+ if (!bcmbal_tm_tcont_sla_id_pack(this->presence_mask, buf))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0001) == 0x0001))
+ {
+ if (!bcmbal_extra_bw_eligibility_type_pack(this->extra_bw_elig, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0002) == 0x0002))
+ {
+ if (!bcmbal_buf_write_u8(buf, this->nrt_cbr))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0004) == 0x0004))
+ {
+ if (!bcmbal_buf_write_u8(buf, this->rt_cbr))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0008) == 0x0008))
+ {
+ if (!bcmbal_buf_write_u8(buf, this->rt_profile))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0010) == 0x0010))
+ {
+ if (!bcmbal_buf_write_u8(buf, this->nrt_profile))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+uint32_t bcmbal_tm_tcont_sla_get_packed_length(const bcmbal_tm_tcont_sla *this)
+{
+ uint32_t count = 8;
+ if ((((uint64_t) this->presence_mask & 0x0001) == 0x0001))
+ {
+ count += 1;
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0002) == 0x0002))
+ {
+ count += 1;
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0004) == 0x0004))
+ {
+ count += 1;
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0008) == 0x0008))
+ {
+ count += 1;
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0010) == 0x0010))
+ {
+ count += 1;
+ }
+
+ return count;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_tcont_sla_unpack(bcmbal_tm_tcont_sla *this, bcmbal_buf *buf, void **extra_mem)
+{
+ if (!bcmbal_tm_tcont_sla_id_unpack(&this->presence_mask, buf))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0001) == 0x0001))
+ {
+ if (!bcmbal_extra_bw_eligibility_type_unpack(&this->extra_bw_elig, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0002) == 0x0002))
+ {
+ if (!bcmbal_buf_read_u8(buf, &this->nrt_cbr))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0004) == 0x0004))
+ {
+ if (!bcmbal_buf_read_u8(buf, &this->rt_cbr))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0008) == 0x0008))
+ {
+ if (!bcmbal_buf_read_u8(buf, &this->rt_profile))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0010) == 0x0010))
+ {
+ if (!bcmbal_buf_read_u8(buf, &this->nrt_profile))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_tcont_sla_scan(bcmbal_buf *packed, uint32_t *extra_mem)
+{
+ bcmbal_tm_tcont_sla_id presence_mask;
+ if (!bcmbal_tm_tcont_sla_id_unpack(&presence_mask, packed))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if ((((uint64_t) presence_mask & 0x0001) == 0x0001))
+ {
+ if (!bcmbal_buf_skip(packed, 1))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) presence_mask & 0x0002) == 0x0002))
+ {
+ if (!bcmbal_buf_skip(packed, 1))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) presence_mask & 0x0004) == 0x0004))
+ {
+ if (!bcmbal_buf_skip(packed, 1))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) presence_mask & 0x0008) == 0x0008))
+ {
+ if (!bcmbal_buf_skip(packed, 1))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((((uint64_t) presence_mask & 0x0010) == 0x0010))
+ {
+ if (!bcmbal_buf_skip(packed, 1))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_tcont_sla_bounds_check(const bcmbal_tm_tcont_sla *this)
+{
+ if ((this->presence_mask & 0xFFFFFFFFFFFFFFE0ULL) != 0)
+ {
+ return BCMOS_FALSE;
+ }
+
+ if ((((uint64_t) this->presence_mask & 0x0001) == 0x0001))
+ {
+ switch (this->extra_bw_elig)
+ {
+ case BCMBAL_EXTRA_BW_ELIGIBILITY_TYPE_NONE:
+ break;
+ case BCMBAL_EXTRA_BW_ELIGIBILITY_TYPE_NOT_ASSURED:
+ break;
+ case BCMBAL_EXTRA_BW_ELIGIBILITY_TYPE_BEST_EFFORT:
+ break;
+ default:
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+void bcmbal_u8_list_u32_set_default(bcmbal_u8_list_u32 *this)
+{
+ this->len = 0;
+ this->val = NULL;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_u8_list_u32_pack(const bcmbal_u8_list_u32 *this, bcmbal_buf *buf)
+{
+ if (!bcmbal_buf_write_u32(buf, this->len))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if ((this->len > 0) && (this->val == NULL))
+ {
+ bcmos_trace(BCMOS_TRACE_LEVEL_ERROR, "Error: list field \"val\" of struct \"bcmbal_u8_list_u32\" is uninitialized (NULL). You must allocate memory for this pointer before sending/receiving the message.\n");
+ return BCMOS_FALSE;
+ }
+
+ if (!bcmbal_buf_write(buf, this->val, this->len))
+ {
+ return BCMOS_FALSE;
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+uint32_t bcmbal_u8_list_u32_get_packed_length(const bcmbal_u8_list_u32 *this)
+{
+ return 4 + this->len;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_u8_list_u32_unpack(bcmbal_u8_list_u32 *this, bcmbal_buf *buf, void **extra_mem)
+{
+ if (!bcmbal_buf_read_u32(buf, &this->len))
+ {
+ return BCMOS_FALSE;
+ }
+
+ if ((this->len > 0) && (this->val == NULL))
+ {
+ if (extra_mem == NULL)
+ {
+ bcmos_trace(BCMOS_TRACE_LEVEL_ERROR, "Error: list field \"val\" of struct \"bcmbal_u8_list_u32\" is uninitialized (NULL). You must allocate memory for this pointer before sending/receiving the message.\n");
+ return BCMOS_FALSE;
+ }
+ else
+ {
+ this->val = (uint8_t *) *extra_mem;
+ *extra_mem = ((uint8_t *) *extra_mem) + BCMOS_ROUND_TO_WORD(this->len * sizeof(uint8_t));
+ }
+ }
+
+ if (!bcmbal_buf_read(buf, this->val, this->len))
+ {
+ return BCMOS_FALSE;
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_u8_list_u32_scan(bcmbal_buf *packed, uint32_t *extra_mem)
+{
+ uint32_t len;
+ if (!bcmbal_buf_read_u32(packed, &len))
+ {
+ return BCMOS_FALSE;
+ }
+
+ *extra_mem += BCMOS_ROUND_TO_WORD(sizeof(uint8_t) * len);
+ if (!bcmbal_buf_skip(packed, len * 1))
+ {
+ return BCMOS_FALSE;
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_u8_list_u32_bounds_check(const bcmbal_u8_list_u32 *this)
+{
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+void bcmbal_access_terminal_key_set_default(bcmbal_access_terminal_key *this, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_ACCESS_TERMINAL_KEY_ID_ACCESS_TERM_ID)) != 0)
+ {
+ this->access_term_id = (bcmbal_access_id) 1;
+ }
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_access_terminal_key_pack(const bcmbal_access_terminal_key *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_ACCESS_TERMINAL_KEY_ID_ACCESS_TERM_ID)) != 0)
+ {
+ if (!bcmbal_buf_write_u32(buf, (uint32_t) this->access_term_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+uint32_t bcmbal_access_terminal_key_get_packed_length(const bcmbal_access_terminal_key *this, bcmbal_presence_mask fields_present)
+{
+ uint32_t count = 0;
+ if ((fields_present & (1ULL << BCMBAL_ACCESS_TERMINAL_KEY_ID_ACCESS_TERM_ID)) != 0)
+ {
+ count += 4;
+ }
+
+ return count;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_access_terminal_key_unpack(bcmbal_access_terminal_key *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_ACCESS_TERMINAL_KEY_ID_ACCESS_TERM_ID)) != 0)
+ {
+ if (!bcmbal_buf_read_u32(buf, (uint32_t *) &this->access_term_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_access_terminal_key_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_ACCESS_TERMINAL_KEY_ID_ACCESS_TERM_ID)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_access_terminal_key_bounds_check(const bcmbal_access_terminal_key *this, bcmbal_presence_mask fields_present, bcmbal_access_terminal_key_id *failed_prop)
+{
+ if ((fields_present & (1ULL << BCMBAL_ACCESS_TERMINAL_KEY_ID_ACCESS_TERM_ID)) != 0)
+ {
+ if (this->access_term_id < (bcmbal_access_id) 1)
+ {
+ *failed_prop = BCMBAL_ACCESS_TERMINAL_KEY_ID_ACCESS_TERM_ID;
+ return BCMOS_FALSE;
+ }
+
+ if (this->access_term_id > (bcmbal_access_id) 1)
+ {
+ *failed_prop = BCMBAL_ACCESS_TERMINAL_KEY_ID_ACCESS_TERM_ID;
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+void bcmbal_access_terminal_cfg_data_set_default(bcmbal_access_terminal_cfg_data *this, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_ACCESS_TERMINAL_CFG_ID_ADMIN_STATE)) != 0)
+ {
+ this->admin_state = (bcmbal_state) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_ACCESS_TERMINAL_CFG_ID_OPER_STATUS)) != 0)
+ {
+ this->oper_status = (bcmbal_status) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_ACCESS_TERMINAL_CFG_ID_IWF_MODE)) != 0)
+ {
+ this->iwf_mode = BCMBAL_IWF_MODE_DIRECT_MAPPING;
+ }
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_access_terminal_cfg_data_pack(const bcmbal_access_terminal_cfg_data *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_ACCESS_TERMINAL_CFG_ID_ADMIN_STATE)) != 0)
+ {
+ if (!bcmbal_state_pack(this->admin_state, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_ACCESS_TERMINAL_CFG_ID_OPER_STATUS)) != 0)
+ {
+ if (!bcmbal_status_pack(this->oper_status, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_ACCESS_TERMINAL_CFG_ID_IWF_MODE)) != 0)
+ {
+ if (!bcmbal_iwf_mode_pack(this->iwf_mode, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+uint32_t bcmbal_access_terminal_cfg_data_get_packed_length(const bcmbal_access_terminal_cfg_data *this, bcmbal_presence_mask fields_present)
+{
+ uint32_t count = 0;
+ if ((fields_present & (1ULL << BCMBAL_ACCESS_TERMINAL_CFG_ID_ADMIN_STATE)) != 0)
+ {
+ count += 4;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_ACCESS_TERMINAL_CFG_ID_OPER_STATUS)) != 0)
+ {
+ count += 4;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_ACCESS_TERMINAL_CFG_ID_IWF_MODE)) != 0)
+ {
+ count += 4;
+ }
+
+ return count;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_access_terminal_cfg_data_unpack(bcmbal_access_terminal_cfg_data *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_ACCESS_TERMINAL_CFG_ID_ADMIN_STATE)) != 0)
+ {
+ if (!bcmbal_state_unpack(&this->admin_state, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_ACCESS_TERMINAL_CFG_ID_OPER_STATUS)) != 0)
+ {
+ if (!bcmbal_status_unpack(&this->oper_status, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_ACCESS_TERMINAL_CFG_ID_IWF_MODE)) != 0)
+ {
+ if (!bcmbal_iwf_mode_unpack(&this->iwf_mode, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_access_terminal_cfg_data_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_ACCESS_TERMINAL_CFG_ID_ADMIN_STATE)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_ACCESS_TERMINAL_CFG_ID_OPER_STATUS)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_ACCESS_TERMINAL_CFG_ID_IWF_MODE)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_access_terminal_cfg_data_bounds_check(const bcmbal_access_terminal_cfg_data *this, bcmbal_presence_mask fields_present, bcmbal_access_terminal_cfg_id *failed_prop)
+{
+ if ((fields_present & (1ULL << BCMBAL_ACCESS_TERMINAL_CFG_ID_ADMIN_STATE)) != 0)
+ {
+ switch (this->admin_state)
+ {
+ case BCMBAL_STATE_UP:
+ break;
+ case BCMBAL_STATE_DOWN:
+ break;
+ case BCMBAL_STATE_TESTING:
+ break;
+ default:
+ *failed_prop = BCMBAL_ACCESS_TERMINAL_CFG_ID_ADMIN_STATE;
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_ACCESS_TERMINAL_CFG_ID_OPER_STATUS)) != 0)
+ {
+ switch (this->oper_status)
+ {
+ case BCMBAL_STATUS_UP:
+ break;
+ case BCMBAL_STATUS_DOWN:
+ break;
+ case BCMBAL_STATUS_TESTING:
+ break;
+ case BCMBAL_STATUS_NOT_PRESENT:
+ break;
+ case BCMBAL_STATUS_LOWER_LAYER_DOWN:
+ break;
+ case BCMBAL_STATUS_UNKNOWN:
+ break;
+ default:
+ *failed_prop = BCMBAL_ACCESS_TERMINAL_CFG_ID_OPER_STATUS;
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_ACCESS_TERMINAL_CFG_ID_IWF_MODE)) != 0)
+ {
+ switch (this->iwf_mode)
+ {
+ case BCMBAL_IWF_MODE_DIRECT_MAPPING:
+ break;
+ case BCMBAL_IWF_MODE_PER_FLOW:
+ break;
+ default:
+ *failed_prop = BCMBAL_ACCESS_TERMINAL_CFG_ID_IWF_MODE;
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+void bcmbal_access_terminal_ind_data_set_default(bcmbal_access_terminal_ind_data *this, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_ACCESS_TERMINAL_IND_ID_ADMIN_STATE)) != 0)
+ {
+ this->admin_state = (bcmbal_state) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_ACCESS_TERMINAL_IND_ID_OPER_STATUS)) != 0)
+ {
+ this->oper_status = (bcmbal_status) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_ACCESS_TERMINAL_IND_ID_IWF_MODE)) != 0)
+ {
+ this->iwf_mode = BCMBAL_IWF_MODE_DIRECT_MAPPING;
+ }
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_access_terminal_ind_data_pack(const bcmbal_access_terminal_ind_data *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_ACCESS_TERMINAL_IND_ID_ADMIN_STATE)) != 0)
+ {
+ if (!bcmbal_state_pack(this->admin_state, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_ACCESS_TERMINAL_IND_ID_OPER_STATUS)) != 0)
+ {
+ if (!bcmbal_status_pack(this->oper_status, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_ACCESS_TERMINAL_IND_ID_IWF_MODE)) != 0)
+ {
+ if (!bcmbal_iwf_mode_pack(this->iwf_mode, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+uint32_t bcmbal_access_terminal_ind_data_get_packed_length(const bcmbal_access_terminal_ind_data *this, bcmbal_presence_mask fields_present)
+{
+ uint32_t count = 0;
+ if ((fields_present & (1ULL << BCMBAL_ACCESS_TERMINAL_IND_ID_ADMIN_STATE)) != 0)
+ {
+ count += 4;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_ACCESS_TERMINAL_IND_ID_OPER_STATUS)) != 0)
+ {
+ count += 4;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_ACCESS_TERMINAL_IND_ID_IWF_MODE)) != 0)
+ {
+ count += 4;
+ }
+
+ return count;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_access_terminal_ind_data_unpack(bcmbal_access_terminal_ind_data *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_ACCESS_TERMINAL_IND_ID_ADMIN_STATE)) != 0)
+ {
+ if (!bcmbal_state_unpack(&this->admin_state, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_ACCESS_TERMINAL_IND_ID_OPER_STATUS)) != 0)
+ {
+ if (!bcmbal_status_unpack(&this->oper_status, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_ACCESS_TERMINAL_IND_ID_IWF_MODE)) != 0)
+ {
+ if (!bcmbal_iwf_mode_unpack(&this->iwf_mode, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_access_terminal_ind_data_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_ACCESS_TERMINAL_IND_ID_ADMIN_STATE)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_ACCESS_TERMINAL_IND_ID_OPER_STATUS)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_ACCESS_TERMINAL_IND_ID_IWF_MODE)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_access_terminal_ind_data_bounds_check(const bcmbal_access_terminal_ind_data *this, bcmbal_presence_mask fields_present, bcmbal_access_terminal_ind_id *failed_prop)
+{
+ if ((fields_present & (1ULL << BCMBAL_ACCESS_TERMINAL_IND_ID_ADMIN_STATE)) != 0)
+ {
+ switch (this->admin_state)
+ {
+ case BCMBAL_STATE_UP:
+ break;
+ case BCMBAL_STATE_DOWN:
+ break;
+ case BCMBAL_STATE_TESTING:
+ break;
+ default:
+ *failed_prop = BCMBAL_ACCESS_TERMINAL_IND_ID_ADMIN_STATE;
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_ACCESS_TERMINAL_IND_ID_OPER_STATUS)) != 0)
+ {
+ switch (this->oper_status)
+ {
+ case BCMBAL_STATUS_UP:
+ break;
+ case BCMBAL_STATUS_DOWN:
+ break;
+ case BCMBAL_STATUS_TESTING:
+ break;
+ case BCMBAL_STATUS_NOT_PRESENT:
+ break;
+ case BCMBAL_STATUS_LOWER_LAYER_DOWN:
+ break;
+ case BCMBAL_STATUS_UNKNOWN:
+ break;
+ default:
+ *failed_prop = BCMBAL_ACCESS_TERMINAL_IND_ID_OPER_STATUS;
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_ACCESS_TERMINAL_IND_ID_IWF_MODE)) != 0)
+ {
+ switch (this->iwf_mode)
+ {
+ case BCMBAL_IWF_MODE_DIRECT_MAPPING:
+ break;
+ case BCMBAL_IWF_MODE_PER_FLOW:
+ break;
+ default:
+ *failed_prop = BCMBAL_ACCESS_TERMINAL_IND_ID_IWF_MODE;
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+void bcmbal_flow_key_set_default(bcmbal_flow_key *this, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_FLOW_KEY_ID_FLOW_ID)) != 0)
+ {
+ this->flow_id = (bcmbal_flow_id) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_KEY_ID_FLOW_TYPE)) != 0)
+ {
+ this->flow_type = (bcmbal_flow_type) 0;
+ }
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_flow_key_pack(const bcmbal_flow_key *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_FLOW_KEY_ID_FLOW_ID)) != 0)
+ {
+ if (!bcmbal_buf_write_u32(buf, (uint32_t) this->flow_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_KEY_ID_FLOW_TYPE)) != 0)
+ {
+ if (!bcmbal_flow_type_pack(this->flow_type, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+uint32_t bcmbal_flow_key_get_packed_length(const bcmbal_flow_key *this, bcmbal_presence_mask fields_present)
+{
+ uint32_t count = 0;
+ if ((fields_present & (1ULL << BCMBAL_FLOW_KEY_ID_FLOW_ID)) != 0)
+ {
+ count += 4;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_KEY_ID_FLOW_TYPE)) != 0)
+ {
+ count += 4;
+ }
+
+ return count;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_flow_key_unpack(bcmbal_flow_key *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_FLOW_KEY_ID_FLOW_ID)) != 0)
+ {
+ if (!bcmbal_buf_read_u32(buf, (uint32_t *) &this->flow_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_KEY_ID_FLOW_TYPE)) != 0)
+ {
+ if (!bcmbal_flow_type_unpack(&this->flow_type, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_flow_key_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_FLOW_KEY_ID_FLOW_ID)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_KEY_ID_FLOW_TYPE)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_flow_key_bounds_check(const bcmbal_flow_key *this, bcmbal_presence_mask fields_present, bcmbal_flow_key_id *failed_prop)
+{
+ if ((fields_present & (1ULL << BCMBAL_FLOW_KEY_ID_FLOW_TYPE)) != 0)
+ {
+ switch (this->flow_type)
+ {
+ case BCMBAL_FLOW_TYPE_UPSTREAM:
+ break;
+ case BCMBAL_FLOW_TYPE_DOWNSTREAM:
+ break;
+ case BCMBAL_FLOW_TYPE_BROADCAST:
+ break;
+ case BCMBAL_FLOW_TYPE_MULTICAST:
+ break;
+ default:
+ *failed_prop = BCMBAL_FLOW_KEY_ID_FLOW_TYPE;
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+void bcmbal_flow_cfg_data_set_default(bcmbal_flow_cfg_data *this, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_ADMIN_STATE)) != 0)
+ {
+ this->admin_state = (bcmbal_state) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_OPER_STATUS)) != 0)
+ {
+ this->oper_status = (bcmbal_status) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_ACCESS_INT_ID)) != 0)
+ {
+ this->access_int_id = (bcmbal_intf_id) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_NETWORK_INT_ID)) != 0)
+ {
+ this->network_int_id = (bcmbal_intf_id) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_SUB_TERM_ID)) != 0)
+ {
+ this->sub_term_id = (bcmbal_sub_id) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_SUB_TERM_UNI_IDX)) != 0)
+ {
+ this->sub_term_uni_idx = 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_SVC_PORT_ID)) != 0)
+ {
+ this->svc_port_id = (bcmbal_service_port_id) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_AGG_PORT_ID)) != 0)
+ {
+ this->agg_port_id = (bcmbal_aggregation_port_id) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_RESOLVE_MAC)) != 0)
+ {
+ this->resolve_mac = BCMOS_FALSE;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_CLASSIFIER)) != 0)
+ {
+ this->classifier.presence_mask = (bcmbal_classifier_id) 0;
+ this->classifier.o_tpid = 0;
+ this->classifier.o_vid = 0;
+ this->classifier.i_tpid = 0;
+ this->classifier.i_vid = 0;
+ this->classifier.o_pbits = 0;
+ this->classifier.i_pbits = 0;
+ this->classifier.ether_type = 0;
+ bcmos_mac_address_init(&this->classifier.dst_mac);
+ bcmos_mac_address_init(&this->classifier.src_mac);
+ this->classifier.ip_proto = 0;
+ bcmos_ipv4_address_init(&this->classifier.dst_ip);
+ bcmos_ipv4_address_init(&this->classifier.src_ip);
+ this->classifier.src_port = 0;
+ this->classifier.dst_port = 0;
+ this->classifier.pkt_tag_type = (bcmbal_pkt_tag_type) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_ACTION)) != 0)
+ {
+ this->action.presence_mask = (bcmbal_action_id) 0;
+ this->action.cmds_bitmask = (bcmbal_action_cmd_id) 0;
+ this->action.o_vid = 0;
+ this->action.o_pbits = 0;
+ this->action.o_tpid = 0;
+ this->action.i_vid = 0;
+ this->action.i_pbits = 0;
+ this->action.i_tpid = 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_SLA)) != 0)
+ {
+ this->sla.presence_mask = (bcmbal_sla_id) 0;
+ this->sla.min_rate = 0;
+ this->sla.max_rate = 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_COOKIE)) != 0)
+ {
+ this->cookie = (bcmbal_cookie) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_PRIORITY)) != 0)
+ {
+ this->priority = 1;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_GROUP_ID)) != 0)
+ {
+ this->group_id = (bcmbal_group_id) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_QUEUE)) != 0)
+ {
+ this->queue.sched_id = (bcmbal_tm_sched_id) 0;
+ this->queue.queue_id = (bcmbal_tm_queue_id) 0;
+ }
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_flow_cfg_data_pack(const bcmbal_flow_cfg_data *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_ADMIN_STATE)) != 0)
+ {
+ if (!bcmbal_state_pack(this->admin_state, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_OPER_STATUS)) != 0)
+ {
+ if (!bcmbal_status_pack(this->oper_status, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_ACCESS_INT_ID)) != 0)
+ {
+ if (!bcmbal_buf_write_u32(buf, (uint32_t) this->access_int_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_NETWORK_INT_ID)) != 0)
+ {
+ if (!bcmbal_buf_write_u32(buf, (uint32_t) this->network_int_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_SUB_TERM_ID)) != 0)
+ {
+ if (!bcmbal_buf_write_u32(buf, (uint32_t) this->sub_term_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_SUB_TERM_UNI_IDX)) != 0)
+ {
+ if (!bcmbal_buf_write_u8(buf, this->sub_term_uni_idx))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_SVC_PORT_ID)) != 0)
+ {
+ if (!bcmbal_buf_write_u16(buf, (uint16_t) this->svc_port_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_AGG_PORT_ID)) != 0)
+ {
+ if (!bcmbal_buf_write_u16(buf, (uint16_t) this->agg_port_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_RESOLVE_MAC)) != 0)
+ {
+ if (!bcmbal_buf_write_bool(buf, this->resolve_mac))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_CLASSIFIER)) != 0)
+ {
+ if (!bcmbal_classifier_pack(&this->classifier, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_ACTION)) != 0)
+ {
+ if (!bcmbal_action_pack(&this->action, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_SLA)) != 0)
+ {
+ if (!bcmbal_sla_pack(&this->sla, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_COOKIE)) != 0)
+ {
+ if (!bcmbal_buf_write_u64(buf, (uint64_t) this->cookie))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_PRIORITY)) != 0)
+ {
+ if (!bcmbal_buf_write_u16(buf, this->priority))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_GROUP_ID)) != 0)
+ {
+ if (!bcmbal_buf_write_u32(buf, (uint32_t) this->group_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_QUEUE)) != 0)
+ {
+ if (!bcmbal_tm_queue_ref_pack(&this->queue, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+uint32_t bcmbal_flow_cfg_data_get_packed_length(const bcmbal_flow_cfg_data *this, bcmbal_presence_mask fields_present)
+{
+ uint32_t count = 0;
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_ADMIN_STATE)) != 0)
+ {
+ count += 4;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_OPER_STATUS)) != 0)
+ {
+ count += 4;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_ACCESS_INT_ID)) != 0)
+ {
+ count += 4;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_NETWORK_INT_ID)) != 0)
+ {
+ count += 4;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_SUB_TERM_ID)) != 0)
+ {
+ count += 4;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_SUB_TERM_UNI_IDX)) != 0)
+ {
+ count += 1;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_SVC_PORT_ID)) != 0)
+ {
+ count += 2;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_AGG_PORT_ID)) != 0)
+ {
+ count += 2;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_RESOLVE_MAC)) != 0)
+ {
+ count += 1;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_CLASSIFIER)) != 0)
+ {
+ count += bcmbal_classifier_get_packed_length(&this->classifier);
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_ACTION)) != 0)
+ {
+ count += bcmbal_action_get_packed_length(&this->action);
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_SLA)) != 0)
+ {
+ count += bcmbal_sla_get_packed_length(&this->sla);
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_COOKIE)) != 0)
+ {
+ count += 8;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_PRIORITY)) != 0)
+ {
+ count += 2;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_GROUP_ID)) != 0)
+ {
+ count += 4;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_QUEUE)) != 0)
+ {
+ count += 5;
+ }
+
+ return count;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_flow_cfg_data_unpack(bcmbal_flow_cfg_data *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_ADMIN_STATE)) != 0)
+ {
+ if (!bcmbal_state_unpack(&this->admin_state, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_OPER_STATUS)) != 0)
+ {
+ if (!bcmbal_status_unpack(&this->oper_status, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_ACCESS_INT_ID)) != 0)
+ {
+ if (!bcmbal_buf_read_u32(buf, (uint32_t *) &this->access_int_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_NETWORK_INT_ID)) != 0)
+ {
+ if (!bcmbal_buf_read_u32(buf, (uint32_t *) &this->network_int_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_SUB_TERM_ID)) != 0)
+ {
+ if (!bcmbal_buf_read_u32(buf, (uint32_t *) &this->sub_term_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_SUB_TERM_UNI_IDX)) != 0)
+ {
+ if (!bcmbal_buf_read_u8(buf, &this->sub_term_uni_idx))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_SVC_PORT_ID)) != 0)
+ {
+ if (!bcmbal_buf_read_u16(buf, (uint16_t *) &this->svc_port_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_AGG_PORT_ID)) != 0)
+ {
+ if (!bcmbal_buf_read_u16(buf, (uint16_t *) &this->agg_port_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_RESOLVE_MAC)) != 0)
+ {
+ if (!bcmbal_buf_read_bool(buf, &this->resolve_mac))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_CLASSIFIER)) != 0)
+ {
+ if (!bcmbal_classifier_unpack(&this->classifier, buf, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_ACTION)) != 0)
+ {
+ if (!bcmbal_action_unpack(&this->action, buf, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_SLA)) != 0)
+ {
+ if (!bcmbal_sla_unpack(&this->sla, buf, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_COOKIE)) != 0)
+ {
+ if (!bcmbal_buf_read_u64(buf, (uint64_t *) &this->cookie))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_PRIORITY)) != 0)
+ {
+ if (!bcmbal_buf_read_u16(buf, &this->priority))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_GROUP_ID)) != 0)
+ {
+ if (!bcmbal_buf_read_u32(buf, (uint32_t *) &this->group_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_QUEUE)) != 0)
+ {
+ if (!bcmbal_tm_queue_ref_unpack(&this->queue, buf, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_flow_cfg_data_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_ADMIN_STATE)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_OPER_STATUS)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_ACCESS_INT_ID)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_NETWORK_INT_ID)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_SUB_TERM_ID)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_SUB_TERM_UNI_IDX)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 1))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_SVC_PORT_ID)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 2))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_AGG_PORT_ID)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 2))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_RESOLVE_MAC)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 1))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_CLASSIFIER)) != 0)
+ {
+ if (!bcmbal_classifier_scan(packed, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_ACTION)) != 0)
+ {
+ if (!bcmbal_action_scan(packed, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_SLA)) != 0)
+ {
+ if (!bcmbal_sla_scan(packed, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_COOKIE)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 8))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_PRIORITY)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 2))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_GROUP_ID)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_QUEUE)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 5))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_flow_cfg_data_bounds_check(const bcmbal_flow_cfg_data *this, bcmbal_presence_mask fields_present, bcmbal_flow_cfg_id *failed_prop)
+{
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_ADMIN_STATE)) != 0)
+ {
+ switch (this->admin_state)
+ {
+ case BCMBAL_STATE_UP:
+ break;
+ case BCMBAL_STATE_DOWN:
+ break;
+ case BCMBAL_STATE_TESTING:
+ break;
+ default:
+ *failed_prop = BCMBAL_FLOW_CFG_ID_ADMIN_STATE;
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_OPER_STATUS)) != 0)
+ {
+ switch (this->oper_status)
+ {
+ case BCMBAL_STATUS_UP:
+ break;
+ case BCMBAL_STATUS_DOWN:
+ break;
+ case BCMBAL_STATUS_TESTING:
+ break;
+ case BCMBAL_STATUS_NOT_PRESENT:
+ break;
+ case BCMBAL_STATUS_LOWER_LAYER_DOWN:
+ break;
+ case BCMBAL_STATUS_UNKNOWN:
+ break;
+ default:
+ *failed_prop = BCMBAL_FLOW_CFG_ID_OPER_STATUS;
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_CLASSIFIER)) != 0)
+ {
+ if (!bcmbal_classifier_bounds_check(&this->classifier))
+ {
+ *failed_prop = BCMBAL_FLOW_CFG_ID_CLASSIFIER;
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_ACTION)) != 0)
+ {
+ if (!bcmbal_action_bounds_check(&this->action))
+ {
+ *failed_prop = BCMBAL_FLOW_CFG_ID_ACTION;
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_SLA)) != 0)
+ {
+ if (!bcmbal_sla_bounds_check(&this->sla))
+ {
+ *failed_prop = BCMBAL_FLOW_CFG_ID_SLA;
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_PRIORITY)) != 0)
+ {
+ if (this->priority < 1)
+ {
+ *failed_prop = BCMBAL_FLOW_CFG_ID_PRIORITY;
+ return BCMOS_FALSE;
+ }
+
+ if (this->priority > 255)
+ {
+ *failed_prop = BCMBAL_FLOW_CFG_ID_PRIORITY;
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_CFG_ID_QUEUE)) != 0)
+ {
+ if (!bcmbal_tm_queue_ref_bounds_check(&this->queue))
+ {
+ *failed_prop = BCMBAL_FLOW_CFG_ID_QUEUE;
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+void bcmbal_flow_stat_data_set_default(bcmbal_flow_stat_data *this, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_FLOW_STAT_ID_RX_PACKETS)) != 0)
+ {
+ this->rx_packets = 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_STAT_ID_RX_BYTES)) != 0)
+ {
+ this->rx_bytes = 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_STAT_ID_TX_PACKETS)) != 0)
+ {
+ this->tx_packets = 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_STAT_ID_TX_BYTES)) != 0)
+ {
+ this->tx_bytes = 0;
+ }
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_flow_stat_data_pack(const bcmbal_flow_stat_data *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_FLOW_STAT_ID_RX_PACKETS)) != 0)
+ {
+ if (!bcmbal_buf_write_u64(buf, this->rx_packets))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_STAT_ID_RX_BYTES)) != 0)
+ {
+ if (!bcmbal_buf_write_u64(buf, this->rx_bytes))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_STAT_ID_TX_PACKETS)) != 0)
+ {
+ if (!bcmbal_buf_write_u64(buf, this->tx_packets))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_STAT_ID_TX_BYTES)) != 0)
+ {
+ if (!bcmbal_buf_write_u64(buf, this->tx_bytes))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+uint32_t bcmbal_flow_stat_data_get_packed_length(const bcmbal_flow_stat_data *this, bcmbal_presence_mask fields_present)
+{
+ uint32_t count = 0;
+ if ((fields_present & (1ULL << BCMBAL_FLOW_STAT_ID_RX_PACKETS)) != 0)
+ {
+ count += 8;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_STAT_ID_RX_BYTES)) != 0)
+ {
+ count += 8;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_STAT_ID_TX_PACKETS)) != 0)
+ {
+ count += 8;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_STAT_ID_TX_BYTES)) != 0)
+ {
+ count += 8;
+ }
+
+ return count;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_flow_stat_data_unpack(bcmbal_flow_stat_data *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_FLOW_STAT_ID_RX_PACKETS)) != 0)
+ {
+ if (!bcmbal_buf_read_u64(buf, &this->rx_packets))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_STAT_ID_RX_BYTES)) != 0)
+ {
+ if (!bcmbal_buf_read_u64(buf, &this->rx_bytes))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_STAT_ID_TX_PACKETS)) != 0)
+ {
+ if (!bcmbal_buf_read_u64(buf, &this->tx_packets))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_STAT_ID_TX_BYTES)) != 0)
+ {
+ if (!bcmbal_buf_read_u64(buf, &this->tx_bytes))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_flow_stat_data_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_FLOW_STAT_ID_RX_PACKETS)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 8))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_STAT_ID_RX_BYTES)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 8))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_STAT_ID_TX_PACKETS)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 8))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_STAT_ID_TX_BYTES)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 8))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_flow_stat_data_bounds_check(const bcmbal_flow_stat_data *this, bcmbal_presence_mask fields_present, bcmbal_flow_stat_id *failed_prop)
+{
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+void bcmbal_flow_ind_data_set_default(bcmbal_flow_ind_data *this, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_ADMIN_STATE)) != 0)
+ {
+ this->admin_state = (bcmbal_state) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_OPER_STATUS)) != 0)
+ {
+ this->oper_status = (bcmbal_status) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_ACCESS_INT_ID)) != 0)
+ {
+ this->access_int_id = 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_NETWORK_INT_ID)) != 0)
+ {
+ this->network_int_id = 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_SUB_TERM_ID)) != 0)
+ {
+ this->sub_term_id = 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_SVC_PORT_ID)) != 0)
+ {
+ this->svc_port_id = 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_AGG_PORT_ID)) != 0)
+ {
+ this->agg_port_id = 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_RESOLVE_MAC)) != 0)
+ {
+ this->resolve_mac = BCMOS_FALSE;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_BASE_TC_ID)) != 0)
+ {
+ this->base_tc_id = 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_CLASSIFIER)) != 0)
+ {
+ this->classifier.presence_mask = (bcmbal_classifier_id) 0;
+ this->classifier.o_tpid = 0;
+ this->classifier.o_vid = 0;
+ this->classifier.i_tpid = 0;
+ this->classifier.i_vid = 0;
+ this->classifier.o_pbits = 0;
+ this->classifier.i_pbits = 0;
+ this->classifier.ether_type = 0;
+ bcmos_mac_address_init(&this->classifier.dst_mac);
+ bcmos_mac_address_init(&this->classifier.src_mac);
+ this->classifier.ip_proto = 0;
+ bcmos_ipv4_address_init(&this->classifier.dst_ip);
+ bcmos_ipv4_address_init(&this->classifier.src_ip);
+ this->classifier.src_port = 0;
+ this->classifier.dst_port = 0;
+ this->classifier.pkt_tag_type = (bcmbal_pkt_tag_type) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_ACTION)) != 0)
+ {
+ this->action.presence_mask = (bcmbal_action_id) 0;
+ this->action.cmds_bitmask = (bcmbal_action_cmd_id) 0;
+ this->action.o_vid = 0;
+ this->action.o_pbits = 0;
+ this->action.o_tpid = 0;
+ this->action.i_vid = 0;
+ this->action.i_pbits = 0;
+ this->action.i_tpid = 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_SLA)) != 0)
+ {
+ this->sla.presence_mask = (bcmbal_sla_id) 0;
+ this->sla.min_rate = 0;
+ this->sla.max_rate = 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_COOKIE)) != 0)
+ {
+ this->cookie = 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_PRIORITY)) != 0)
+ {
+ this->priority = 1;
+ }
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_flow_ind_data_pack(const bcmbal_flow_ind_data *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_ADMIN_STATE)) != 0)
+ {
+ if (!bcmbal_state_pack(this->admin_state, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_OPER_STATUS)) != 0)
+ {
+ if (!bcmbal_status_pack(this->oper_status, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_ACCESS_INT_ID)) != 0)
+ {
+ if (!bcmbal_buf_write_u16(buf, this->access_int_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_NETWORK_INT_ID)) != 0)
+ {
+ if (!bcmbal_buf_write_u16(buf, this->network_int_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_SUB_TERM_ID)) != 0)
+ {
+ if (!bcmbal_buf_write_u32(buf, this->sub_term_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_SVC_PORT_ID)) != 0)
+ {
+ if (!bcmbal_buf_write_u16(buf, this->svc_port_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_AGG_PORT_ID)) != 0)
+ {
+ if (!bcmbal_buf_write_u16(buf, this->agg_port_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_RESOLVE_MAC)) != 0)
+ {
+ if (!bcmbal_buf_write_bool(buf, this->resolve_mac))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_BASE_TC_ID)) != 0)
+ {
+ if (!bcmbal_buf_write_u16(buf, this->base_tc_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_CLASSIFIER)) != 0)
+ {
+ if (!bcmbal_classifier_pack(&this->classifier, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_ACTION)) != 0)
+ {
+ if (!bcmbal_action_pack(&this->action, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_SLA)) != 0)
+ {
+ if (!bcmbal_sla_pack(&this->sla, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_COOKIE)) != 0)
+ {
+ if (!bcmbal_buf_write_u32(buf, this->cookie))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_PRIORITY)) != 0)
+ {
+ if (!bcmbal_buf_write_u16(buf, this->priority))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+uint32_t bcmbal_flow_ind_data_get_packed_length(const bcmbal_flow_ind_data *this, bcmbal_presence_mask fields_present)
+{
+ uint32_t count = 0;
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_ADMIN_STATE)) != 0)
+ {
+ count += 4;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_OPER_STATUS)) != 0)
+ {
+ count += 4;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_ACCESS_INT_ID)) != 0)
+ {
+ count += 2;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_NETWORK_INT_ID)) != 0)
+ {
+ count += 2;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_SUB_TERM_ID)) != 0)
+ {
+ count += 4;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_SVC_PORT_ID)) != 0)
+ {
+ count += 2;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_AGG_PORT_ID)) != 0)
+ {
+ count += 2;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_RESOLVE_MAC)) != 0)
+ {
+ count += 1;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_BASE_TC_ID)) != 0)
+ {
+ count += 2;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_CLASSIFIER)) != 0)
+ {
+ count += bcmbal_classifier_get_packed_length(&this->classifier);
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_ACTION)) != 0)
+ {
+ count += bcmbal_action_get_packed_length(&this->action);
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_SLA)) != 0)
+ {
+ count += bcmbal_sla_get_packed_length(&this->sla);
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_COOKIE)) != 0)
+ {
+ count += 4;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_PRIORITY)) != 0)
+ {
+ count += 2;
+ }
+
+ return count;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_flow_ind_data_unpack(bcmbal_flow_ind_data *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_ADMIN_STATE)) != 0)
+ {
+ if (!bcmbal_state_unpack(&this->admin_state, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_OPER_STATUS)) != 0)
+ {
+ if (!bcmbal_status_unpack(&this->oper_status, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_ACCESS_INT_ID)) != 0)
+ {
+ if (!bcmbal_buf_read_u16(buf, &this->access_int_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_NETWORK_INT_ID)) != 0)
+ {
+ if (!bcmbal_buf_read_u16(buf, &this->network_int_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_SUB_TERM_ID)) != 0)
+ {
+ if (!bcmbal_buf_read_u32(buf, &this->sub_term_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_SVC_PORT_ID)) != 0)
+ {
+ if (!bcmbal_buf_read_u16(buf, &this->svc_port_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_AGG_PORT_ID)) != 0)
+ {
+ if (!bcmbal_buf_read_u16(buf, &this->agg_port_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_RESOLVE_MAC)) != 0)
+ {
+ if (!bcmbal_buf_read_bool(buf, &this->resolve_mac))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_BASE_TC_ID)) != 0)
+ {
+ if (!bcmbal_buf_read_u16(buf, &this->base_tc_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_CLASSIFIER)) != 0)
+ {
+ if (!bcmbal_classifier_unpack(&this->classifier, buf, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_ACTION)) != 0)
+ {
+ if (!bcmbal_action_unpack(&this->action, buf, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_SLA)) != 0)
+ {
+ if (!bcmbal_sla_unpack(&this->sla, buf, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_COOKIE)) != 0)
+ {
+ if (!bcmbal_buf_read_u32(buf, &this->cookie))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_PRIORITY)) != 0)
+ {
+ if (!bcmbal_buf_read_u16(buf, &this->priority))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_flow_ind_data_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_ADMIN_STATE)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_OPER_STATUS)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_ACCESS_INT_ID)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 2))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_NETWORK_INT_ID)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 2))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_SUB_TERM_ID)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_SVC_PORT_ID)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 2))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_AGG_PORT_ID)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 2))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_RESOLVE_MAC)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 1))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_BASE_TC_ID)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 2))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_CLASSIFIER)) != 0)
+ {
+ if (!bcmbal_classifier_scan(packed, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_ACTION)) != 0)
+ {
+ if (!bcmbal_action_scan(packed, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_SLA)) != 0)
+ {
+ if (!bcmbal_sla_scan(packed, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_COOKIE)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_PRIORITY)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 2))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_flow_ind_data_bounds_check(const bcmbal_flow_ind_data *this, bcmbal_presence_mask fields_present, bcmbal_flow_ind_id *failed_prop)
+{
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_ADMIN_STATE)) != 0)
+ {
+ switch (this->admin_state)
+ {
+ case BCMBAL_STATE_UP:
+ break;
+ case BCMBAL_STATE_DOWN:
+ break;
+ case BCMBAL_STATE_TESTING:
+ break;
+ default:
+ *failed_prop = BCMBAL_FLOW_IND_ID_ADMIN_STATE;
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_OPER_STATUS)) != 0)
+ {
+ switch (this->oper_status)
+ {
+ case BCMBAL_STATUS_UP:
+ break;
+ case BCMBAL_STATUS_DOWN:
+ break;
+ case BCMBAL_STATUS_TESTING:
+ break;
+ case BCMBAL_STATUS_NOT_PRESENT:
+ break;
+ case BCMBAL_STATUS_LOWER_LAYER_DOWN:
+ break;
+ case BCMBAL_STATUS_UNKNOWN:
+ break;
+ default:
+ *failed_prop = BCMBAL_FLOW_IND_ID_OPER_STATUS;
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_CLASSIFIER)) != 0)
+ {
+ if (!bcmbal_classifier_bounds_check(&this->classifier))
+ {
+ *failed_prop = BCMBAL_FLOW_IND_ID_CLASSIFIER;
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_ACTION)) != 0)
+ {
+ if (!bcmbal_action_bounds_check(&this->action))
+ {
+ *failed_prop = BCMBAL_FLOW_IND_ID_ACTION;
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_SLA)) != 0)
+ {
+ if (!bcmbal_sla_bounds_check(&this->sla))
+ {
+ *failed_prop = BCMBAL_FLOW_IND_ID_SLA;
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_FLOW_IND_ID_PRIORITY)) != 0)
+ {
+ if (this->priority < 1)
+ {
+ *failed_prop = BCMBAL_FLOW_IND_ID_PRIORITY;
+ return BCMOS_FALSE;
+ }
+
+ if (this->priority > 255)
+ {
+ *failed_prop = BCMBAL_FLOW_IND_ID_PRIORITY;
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+void bcmbal_group_key_set_default(bcmbal_group_key *this, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_GROUP_KEY_ID_GROUP_ID)) != 0)
+ {
+ this->group_id = (bcmbal_group_id) 0;
+ }
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_group_key_pack(const bcmbal_group_key *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_GROUP_KEY_ID_GROUP_ID)) != 0)
+ {
+ if (!bcmbal_buf_write_u32(buf, (uint32_t) this->group_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+uint32_t bcmbal_group_key_get_packed_length(const bcmbal_group_key *this, bcmbal_presence_mask fields_present)
+{
+ uint32_t count = 0;
+ if ((fields_present & (1ULL << BCMBAL_GROUP_KEY_ID_GROUP_ID)) != 0)
+ {
+ count += 4;
+ }
+
+ return count;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_group_key_unpack(bcmbal_group_key *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_GROUP_KEY_ID_GROUP_ID)) != 0)
+ {
+ if (!bcmbal_buf_read_u32(buf, (uint32_t *) &this->group_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_group_key_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_GROUP_KEY_ID_GROUP_ID)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_group_key_bounds_check(const bcmbal_group_key *this, bcmbal_presence_mask fields_present, bcmbal_group_key_id *failed_prop)
+{
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+void bcmbal_group_cfg_data_set_default(bcmbal_group_cfg_data *this, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_GROUP_CFG_ID_MEMBERS_CMD)) != 0)
+ {
+ this->members_cmd = (bcmbal_group_member_cmd) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_GROUP_CFG_ID_MEMBERS)) != 0)
+ {
+ this->members.len = 0;
+ this->members.val = NULL;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_GROUP_CFG_ID_COOKIE)) != 0)
+ {
+ this->cookie = (bcmbal_cookie) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_GROUP_CFG_ID_FLOWS)) != 0)
+ {
+ this->flows.len = 0;
+ this->flows.val = NULL;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_GROUP_CFG_ID_OWNER)) != 0)
+ {
+ this->owner = BCMBAL_GROUP_OWNER_NONE;
+ }
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_group_cfg_data_pack(const bcmbal_group_cfg_data *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_GROUP_CFG_ID_MEMBERS_CMD)) != 0)
+ {
+ if (!bcmbal_group_member_cmd_pack(this->members_cmd, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_GROUP_CFG_ID_MEMBERS)) != 0)
+ {
+ if (!bcmbal_group_member_info_list_u16_pack(&this->members, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_GROUP_CFG_ID_COOKIE)) != 0)
+ {
+ if (!bcmbal_buf_write_u64(buf, (uint64_t) this->cookie))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_GROUP_CFG_ID_FLOWS)) != 0)
+ {
+ if (!bcmbal_flow_id_list_u32_pack(&this->flows, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_GROUP_CFG_ID_OWNER)) != 0)
+ {
+ if (!bcmbal_group_owner_pack(this->owner, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+uint32_t bcmbal_group_cfg_data_get_packed_length(const bcmbal_group_cfg_data *this, bcmbal_presence_mask fields_present)
+{
+ uint32_t count = 0;
+ if ((fields_present & (1ULL << BCMBAL_GROUP_CFG_ID_MEMBERS_CMD)) != 0)
+ {
+ count += 4;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_GROUP_CFG_ID_MEMBERS)) != 0)
+ {
+ count += bcmbal_group_member_info_list_u16_get_packed_length(&this->members);
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_GROUP_CFG_ID_COOKIE)) != 0)
+ {
+ count += 8;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_GROUP_CFG_ID_FLOWS)) != 0)
+ {
+ count += bcmbal_flow_id_list_u32_get_packed_length(&this->flows);
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_GROUP_CFG_ID_OWNER)) != 0)
+ {
+ count += 1;
+ }
+
+ return count;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_group_cfg_data_unpack(bcmbal_group_cfg_data *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_GROUP_CFG_ID_MEMBERS_CMD)) != 0)
+ {
+ if (!bcmbal_group_member_cmd_unpack(&this->members_cmd, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_GROUP_CFG_ID_MEMBERS)) != 0)
+ {
+ if (!bcmbal_group_member_info_list_u16_unpack(&this->members, buf, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_GROUP_CFG_ID_COOKIE)) != 0)
+ {
+ if (!bcmbal_buf_read_u64(buf, (uint64_t *) &this->cookie))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_GROUP_CFG_ID_FLOWS)) != 0)
+ {
+ if (!bcmbal_flow_id_list_u32_unpack(&this->flows, buf, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_GROUP_CFG_ID_OWNER)) != 0)
+ {
+ if (!bcmbal_group_owner_unpack(&this->owner, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_group_cfg_data_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_GROUP_CFG_ID_MEMBERS_CMD)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_GROUP_CFG_ID_MEMBERS)) != 0)
+ {
+ if (!bcmbal_group_member_info_list_u16_scan(packed, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_GROUP_CFG_ID_COOKIE)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 8))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_GROUP_CFG_ID_FLOWS)) != 0)
+ {
+ if (!bcmbal_flow_id_list_u32_scan(packed, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_GROUP_CFG_ID_OWNER)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 1))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_group_cfg_data_bounds_check(const bcmbal_group_cfg_data *this, bcmbal_presence_mask fields_present, bcmbal_group_cfg_id *failed_prop)
+{
+ if ((fields_present & (1ULL << BCMBAL_GROUP_CFG_ID_MEMBERS_CMD)) != 0)
+ {
+ switch (this->members_cmd)
+ {
+ case BCMBAL_GROUP_MEMBER_CMD_ADD_MEMBERS:
+ break;
+ case BCMBAL_GROUP_MEMBER_CMD_REM_MEMBERS:
+ break;
+ case BCMBAL_GROUP_MEMBER_CMD_SET_MEMBERS:
+ break;
+ default:
+ *failed_prop = BCMBAL_GROUP_CFG_ID_MEMBERS_CMD;
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_GROUP_CFG_ID_MEMBERS)) != 0)
+ {
+ if (!bcmbal_group_member_info_list_u16_bounds_check(&this->members))
+ {
+ *failed_prop = BCMBAL_GROUP_CFG_ID_MEMBERS;
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_GROUP_CFG_ID_FLOWS)) != 0)
+ {
+ if (!bcmbal_flow_id_list_u32_bounds_check(&this->flows))
+ {
+ *failed_prop = BCMBAL_GROUP_CFG_ID_FLOWS;
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_GROUP_CFG_ID_OWNER)) != 0)
+ {
+ switch (this->owner)
+ {
+ case BCMBAL_GROUP_OWNER_NONE:
+ break;
+ case BCMBAL_GROUP_OWNER_MULTICAST:
+ break;
+ case BCMBAL_GROUP_OWNER_UNICAST:
+ break;
+ default:
+ *failed_prop = BCMBAL_GROUP_CFG_ID_OWNER;
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+void bcmbal_interface_key_set_default(bcmbal_interface_key *this, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_KEY_ID_INTF_ID)) != 0)
+ {
+ this->intf_id = 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_KEY_ID_INTF_TYPE)) != 0)
+ {
+ this->intf_type = BCMBAL_INTF_TYPE_NNI;
+ }
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_interface_key_pack(const bcmbal_interface_key *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_KEY_ID_INTF_ID)) != 0)
+ {
+ if (!bcmbal_buf_write_u32(buf, this->intf_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_KEY_ID_INTF_TYPE)) != 0)
+ {
+ if (!bcmbal_intf_type_pack(this->intf_type, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+uint32_t bcmbal_interface_key_get_packed_length(const bcmbal_interface_key *this, bcmbal_presence_mask fields_present)
+{
+ uint32_t count = 0;
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_KEY_ID_INTF_ID)) != 0)
+ {
+ count += 4;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_KEY_ID_INTF_TYPE)) != 0)
+ {
+ count += 4;
+ }
+
+ return count;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_interface_key_unpack(bcmbal_interface_key *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_KEY_ID_INTF_ID)) != 0)
+ {
+ if (!bcmbal_buf_read_u32(buf, &this->intf_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_KEY_ID_INTF_TYPE)) != 0)
+ {
+ if (!bcmbal_intf_type_unpack(&this->intf_type, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_interface_key_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_KEY_ID_INTF_ID)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_KEY_ID_INTF_TYPE)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_interface_key_bounds_check(const bcmbal_interface_key *this, bcmbal_presence_mask fields_present, bcmbal_interface_key_id *failed_prop)
+{
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_KEY_ID_INTF_TYPE)) != 0)
+ {
+ switch (this->intf_type)
+ {
+ case BCMBAL_INTF_TYPE_NNI:
+ break;
+ case BCMBAL_INTF_TYPE_PON:
+ break;
+ default:
+ *failed_prop = BCMBAL_INTERFACE_KEY_ID_INTF_TYPE;
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+void bcmbal_interface_cfg_data_set_default(bcmbal_interface_cfg_data *this, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_ADMIN_STATE)) != 0)
+ {
+ this->admin_state = (bcmbal_state) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_OPER_STATUS)) != 0)
+ {
+ this->oper_status = (bcmbal_status) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_MIN_DATA_AGG_PORT_ID)) != 0)
+ {
+ this->min_data_agg_port_id = (bcmbal_aggregation_port_id) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_MIN_DATA_SVC_PORT_ID)) != 0)
+ {
+ this->min_data_svc_port_id = (bcmbal_service_port_id) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_TRANSCEIVER_TYPE)) != 0)
+ {
+ this->transceiver_type = BCMBAL_TRX_TYPE_GPON_SPS_43_48;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_DS_MISS_MODE)) != 0)
+ {
+ this->ds_miss_mode = BCMBAL_DS_MISS_MODE_DISCARD;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_MTU)) != 0)
+ {
+ this->mtu = 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_FLOW_CONTROL)) != 0)
+ {
+ this->flow_control = BCMBAL_CONTROL_DISABLE;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_DS_TM)) != 0)
+ {
+ this->ds_tm = (bcmbal_tm_sched_id) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_US_TM)) != 0)
+ {
+ this->us_tm = (bcmbal_tm_sched_id) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_SUB_TERM_ID_LIST)) != 0)
+ {
+ this->sub_term_id_list.len = 0;
+ this->sub_term_id_list.val = NULL;
+ }
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_interface_cfg_data_pack(const bcmbal_interface_cfg_data *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_ADMIN_STATE)) != 0)
+ {
+ if (!bcmbal_state_pack(this->admin_state, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_OPER_STATUS)) != 0)
+ {
+ if (!bcmbal_status_pack(this->oper_status, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_MIN_DATA_AGG_PORT_ID)) != 0)
+ {
+ if (!bcmbal_buf_write_u16(buf, (uint16_t) this->min_data_agg_port_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_MIN_DATA_SVC_PORT_ID)) != 0)
+ {
+ if (!bcmbal_buf_write_u16(buf, (uint16_t) this->min_data_svc_port_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_TRANSCEIVER_TYPE)) != 0)
+ {
+ if (!bcmbal_trx_type_pack(this->transceiver_type, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_DS_MISS_MODE)) != 0)
+ {
+ if (!bcmbal_ds_miss_mode_pack(this->ds_miss_mode, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_MTU)) != 0)
+ {
+ if (!bcmbal_buf_write_u16(buf, this->mtu))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_FLOW_CONTROL)) != 0)
+ {
+ if (!bcmbal_control_pack(this->flow_control, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_DS_TM)) != 0)
+ {
+ if (!bcmbal_buf_write_u32(buf, (uint32_t) this->ds_tm))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_US_TM)) != 0)
+ {
+ if (!bcmbal_buf_write_u32(buf, (uint32_t) this->us_tm))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_SUB_TERM_ID_LIST)) != 0)
+ {
+ if (!bcmbal_sub_id_list_u16_pack(&this->sub_term_id_list, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+uint32_t bcmbal_interface_cfg_data_get_packed_length(const bcmbal_interface_cfg_data *this, bcmbal_presence_mask fields_present)
+{
+ uint32_t count = 0;
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_ADMIN_STATE)) != 0)
+ {
+ count += 4;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_OPER_STATUS)) != 0)
+ {
+ count += 4;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_MIN_DATA_AGG_PORT_ID)) != 0)
+ {
+ count += 2;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_MIN_DATA_SVC_PORT_ID)) != 0)
+ {
+ count += 2;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_TRANSCEIVER_TYPE)) != 0)
+ {
+ count += 4;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_DS_MISS_MODE)) != 0)
+ {
+ count += 4;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_MTU)) != 0)
+ {
+ count += 2;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_FLOW_CONTROL)) != 0)
+ {
+ count += 4;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_DS_TM)) != 0)
+ {
+ count += 4;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_US_TM)) != 0)
+ {
+ count += 4;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_SUB_TERM_ID_LIST)) != 0)
+ {
+ count += bcmbal_sub_id_list_u16_get_packed_length(&this->sub_term_id_list);
+ }
+
+ return count;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_interface_cfg_data_unpack(bcmbal_interface_cfg_data *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_ADMIN_STATE)) != 0)
+ {
+ if (!bcmbal_state_unpack(&this->admin_state, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_OPER_STATUS)) != 0)
+ {
+ if (!bcmbal_status_unpack(&this->oper_status, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_MIN_DATA_AGG_PORT_ID)) != 0)
+ {
+ if (!bcmbal_buf_read_u16(buf, (uint16_t *) &this->min_data_agg_port_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_MIN_DATA_SVC_PORT_ID)) != 0)
+ {
+ if (!bcmbal_buf_read_u16(buf, (uint16_t *) &this->min_data_svc_port_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_TRANSCEIVER_TYPE)) != 0)
+ {
+ if (!bcmbal_trx_type_unpack(&this->transceiver_type, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_DS_MISS_MODE)) != 0)
+ {
+ if (!bcmbal_ds_miss_mode_unpack(&this->ds_miss_mode, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_MTU)) != 0)
+ {
+ if (!bcmbal_buf_read_u16(buf, &this->mtu))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_FLOW_CONTROL)) != 0)
+ {
+ if (!bcmbal_control_unpack(&this->flow_control, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_DS_TM)) != 0)
+ {
+ if (!bcmbal_buf_read_u32(buf, (uint32_t *) &this->ds_tm))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_US_TM)) != 0)
+ {
+ if (!bcmbal_buf_read_u32(buf, (uint32_t *) &this->us_tm))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_SUB_TERM_ID_LIST)) != 0)
+ {
+ if (!bcmbal_sub_id_list_u16_unpack(&this->sub_term_id_list, buf, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_interface_cfg_data_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_ADMIN_STATE)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_OPER_STATUS)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_MIN_DATA_AGG_PORT_ID)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 2))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_MIN_DATA_SVC_PORT_ID)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 2))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_TRANSCEIVER_TYPE)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_DS_MISS_MODE)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_MTU)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 2))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_FLOW_CONTROL)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_DS_TM)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_US_TM)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_SUB_TERM_ID_LIST)) != 0)
+ {
+ if (!bcmbal_sub_id_list_u16_scan(packed, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_interface_cfg_data_bounds_check(const bcmbal_interface_cfg_data *this, bcmbal_presence_mask fields_present, bcmbal_interface_cfg_id *failed_prop)
+{
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_ADMIN_STATE)) != 0)
+ {
+ switch (this->admin_state)
+ {
+ case BCMBAL_STATE_UP:
+ break;
+ case BCMBAL_STATE_DOWN:
+ break;
+ case BCMBAL_STATE_TESTING:
+ break;
+ default:
+ *failed_prop = BCMBAL_INTERFACE_CFG_ID_ADMIN_STATE;
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_OPER_STATUS)) != 0)
+ {
+ switch (this->oper_status)
+ {
+ case BCMBAL_STATUS_UP:
+ break;
+ case BCMBAL_STATUS_DOWN:
+ break;
+ case BCMBAL_STATUS_TESTING:
+ break;
+ case BCMBAL_STATUS_NOT_PRESENT:
+ break;
+ case BCMBAL_STATUS_LOWER_LAYER_DOWN:
+ break;
+ case BCMBAL_STATUS_UNKNOWN:
+ break;
+ default:
+ *failed_prop = BCMBAL_INTERFACE_CFG_ID_OPER_STATUS;
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_TRANSCEIVER_TYPE)) != 0)
+ {
+ switch (this->transceiver_type)
+ {
+ case BCMBAL_TRX_TYPE_GPON_SPS_43_48:
+ break;
+ case BCMBAL_TRX_TYPE_GPON_SPS_SOG_4321:
+ break;
+ case BCMBAL_TRX_TYPE_GPON_LTE_3680_M:
+ break;
+ case BCMBAL_TRX_TYPE_GPON_SOURCE_PHOTONICS:
+ break;
+ case BCMBAL_TRX_TYPE_GPON_LTE_3680_P:
+ break;
+ case BCMBAL_TRX_TYPE_XGPON_LTH_7222_PC:
+ break;
+ case BCMBAL_TRX_TYPE_XGPON_LTH_7226_PC:
+ break;
+ case BCMBAL_TRX_TYPE_XGPON_LTH_5302_PC:
+ break;
+ default:
+ *failed_prop = BCMBAL_INTERFACE_CFG_ID_TRANSCEIVER_TYPE;
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_DS_MISS_MODE)) != 0)
+ {
+ switch (this->ds_miss_mode)
+ {
+ case BCMBAL_DS_MISS_MODE_DISCARD:
+ break;
+ case BCMBAL_DS_MISS_MODE_BROADCAST:
+ break;
+ case BCMBAL_DS_MISS_MODE_VID:
+ break;
+ default:
+ *failed_prop = BCMBAL_INTERFACE_CFG_ID_DS_MISS_MODE;
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_FLOW_CONTROL)) != 0)
+ {
+ switch (this->flow_control)
+ {
+ case BCMBAL_CONTROL_DISABLE:
+ break;
+ case BCMBAL_CONTROL_ENABLE:
+ break;
+ default:
+ *failed_prop = BCMBAL_INTERFACE_CFG_ID_FLOW_CONTROL;
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_CFG_ID_SUB_TERM_ID_LIST)) != 0)
+ {
+ if (!bcmbal_sub_id_list_u16_bounds_check(&this->sub_term_id_list))
+ {
+ *failed_prop = BCMBAL_INTERFACE_CFG_ID_SUB_TERM_ID_LIST;
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+void bcmbal_interface_stat_data_set_default(bcmbal_interface_stat_data *this, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_STAT_ID_RX_PACKETS)) != 0)
+ {
+ this->rx_packets = 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_STAT_ID_RX_BYTES)) != 0)
+ {
+ this->rx_bytes = 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_STAT_ID_TX_PACKETS)) != 0)
+ {
+ this->tx_packets = 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_STAT_ID_TX_BYTES)) != 0)
+ {
+ this->tx_bytes = 0;
+ }
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_interface_stat_data_pack(const bcmbal_interface_stat_data *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_STAT_ID_RX_PACKETS)) != 0)
+ {
+ if (!bcmbal_buf_write_u64(buf, this->rx_packets))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_STAT_ID_RX_BYTES)) != 0)
+ {
+ if (!bcmbal_buf_write_u64(buf, this->rx_bytes))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_STAT_ID_TX_PACKETS)) != 0)
+ {
+ if (!bcmbal_buf_write_u64(buf, this->tx_packets))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_STAT_ID_TX_BYTES)) != 0)
+ {
+ if (!bcmbal_buf_write_u64(buf, this->tx_bytes))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+uint32_t bcmbal_interface_stat_data_get_packed_length(const bcmbal_interface_stat_data *this, bcmbal_presence_mask fields_present)
+{
+ uint32_t count = 0;
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_STAT_ID_RX_PACKETS)) != 0)
+ {
+ count += 8;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_STAT_ID_RX_BYTES)) != 0)
+ {
+ count += 8;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_STAT_ID_TX_PACKETS)) != 0)
+ {
+ count += 8;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_STAT_ID_TX_BYTES)) != 0)
+ {
+ count += 8;
+ }
+
+ return count;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_interface_stat_data_unpack(bcmbal_interface_stat_data *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_STAT_ID_RX_PACKETS)) != 0)
+ {
+ if (!bcmbal_buf_read_u64(buf, &this->rx_packets))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_STAT_ID_RX_BYTES)) != 0)
+ {
+ if (!bcmbal_buf_read_u64(buf, &this->rx_bytes))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_STAT_ID_TX_PACKETS)) != 0)
+ {
+ if (!bcmbal_buf_read_u64(buf, &this->tx_packets))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_STAT_ID_TX_BYTES)) != 0)
+ {
+ if (!bcmbal_buf_read_u64(buf, &this->tx_bytes))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_interface_stat_data_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_STAT_ID_RX_PACKETS)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 8))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_STAT_ID_RX_BYTES)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 8))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_STAT_ID_TX_PACKETS)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 8))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_STAT_ID_TX_BYTES)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 8))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_interface_stat_data_bounds_check(const bcmbal_interface_stat_data *this, bcmbal_presence_mask fields_present, bcmbal_interface_stat_id *failed_prop)
+{
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+void bcmbal_interface_ind_data_set_default(bcmbal_interface_ind_data *this, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_ADMIN_STATE)) != 0)
+ {
+ this->admin_state = (bcmbal_state) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_OPER_STATUS)) != 0)
+ {
+ this->oper_status = (bcmbal_status) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_MIN_DATA_AGG_PORT_ID)) != 0)
+ {
+ this->min_data_agg_port_id = 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_MIN_DATA_SVC_PORT_ID)) != 0)
+ {
+ this->min_data_svc_port_id = 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_TRANSCEIVER_TYPE)) != 0)
+ {
+ this->transceiver_type = BCMBAL_TRX_TYPE_GPON_SPS_43_48;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_DS_MISS_MODE)) != 0)
+ {
+ this->ds_miss_mode = BCMBAL_DS_MISS_MODE_DISCARD;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_MTU)) != 0)
+ {
+ this->mtu = 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_FLOW_CONTROL)) != 0)
+ {
+ this->flow_control = BCMBAL_CONTROL_DISABLE;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_DS_TM)) != 0)
+ {
+ this->ds_tm = (bcmbal_tm_sched_id) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_US_TM)) != 0)
+ {
+ this->us_tm = (bcmbal_tm_sched_id) 0;
+ }
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_interface_ind_data_pack(const bcmbal_interface_ind_data *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_ADMIN_STATE)) != 0)
+ {
+ if (!bcmbal_state_pack(this->admin_state, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_OPER_STATUS)) != 0)
+ {
+ if (!bcmbal_status_pack(this->oper_status, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_MIN_DATA_AGG_PORT_ID)) != 0)
+ {
+ if (!bcmbal_buf_write_u16(buf, this->min_data_agg_port_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_MIN_DATA_SVC_PORT_ID)) != 0)
+ {
+ if (!bcmbal_buf_write_u16(buf, this->min_data_svc_port_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_TRANSCEIVER_TYPE)) != 0)
+ {
+ if (!bcmbal_trx_type_pack(this->transceiver_type, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_DS_MISS_MODE)) != 0)
+ {
+ if (!bcmbal_ds_miss_mode_pack(this->ds_miss_mode, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_MTU)) != 0)
+ {
+ if (!bcmbal_buf_write_u16(buf, this->mtu))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_FLOW_CONTROL)) != 0)
+ {
+ if (!bcmbal_control_pack(this->flow_control, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_DS_TM)) != 0)
+ {
+ if (!bcmbal_buf_write_u32(buf, (uint32_t) this->ds_tm))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_US_TM)) != 0)
+ {
+ if (!bcmbal_buf_write_u32(buf, (uint32_t) this->us_tm))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+uint32_t bcmbal_interface_ind_data_get_packed_length(const bcmbal_interface_ind_data *this, bcmbal_presence_mask fields_present)
+{
+ uint32_t count = 0;
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_ADMIN_STATE)) != 0)
+ {
+ count += 4;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_OPER_STATUS)) != 0)
+ {
+ count += 4;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_MIN_DATA_AGG_PORT_ID)) != 0)
+ {
+ count += 2;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_MIN_DATA_SVC_PORT_ID)) != 0)
+ {
+ count += 2;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_TRANSCEIVER_TYPE)) != 0)
+ {
+ count += 4;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_DS_MISS_MODE)) != 0)
+ {
+ count += 4;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_MTU)) != 0)
+ {
+ count += 2;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_FLOW_CONTROL)) != 0)
+ {
+ count += 4;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_DS_TM)) != 0)
+ {
+ count += 4;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_US_TM)) != 0)
+ {
+ count += 4;
+ }
+
+ return count;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_interface_ind_data_unpack(bcmbal_interface_ind_data *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_ADMIN_STATE)) != 0)
+ {
+ if (!bcmbal_state_unpack(&this->admin_state, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_OPER_STATUS)) != 0)
+ {
+ if (!bcmbal_status_unpack(&this->oper_status, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_MIN_DATA_AGG_PORT_ID)) != 0)
+ {
+ if (!bcmbal_buf_read_u16(buf, &this->min_data_agg_port_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_MIN_DATA_SVC_PORT_ID)) != 0)
+ {
+ if (!bcmbal_buf_read_u16(buf, &this->min_data_svc_port_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_TRANSCEIVER_TYPE)) != 0)
+ {
+ if (!bcmbal_trx_type_unpack(&this->transceiver_type, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_DS_MISS_MODE)) != 0)
+ {
+ if (!bcmbal_ds_miss_mode_unpack(&this->ds_miss_mode, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_MTU)) != 0)
+ {
+ if (!bcmbal_buf_read_u16(buf, &this->mtu))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_FLOW_CONTROL)) != 0)
+ {
+ if (!bcmbal_control_unpack(&this->flow_control, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_DS_TM)) != 0)
+ {
+ if (!bcmbal_buf_read_u32(buf, (uint32_t *) &this->ds_tm))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_US_TM)) != 0)
+ {
+ if (!bcmbal_buf_read_u32(buf, (uint32_t *) &this->us_tm))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_interface_ind_data_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_ADMIN_STATE)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_OPER_STATUS)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_MIN_DATA_AGG_PORT_ID)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 2))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_MIN_DATA_SVC_PORT_ID)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 2))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_TRANSCEIVER_TYPE)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_DS_MISS_MODE)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_MTU)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 2))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_FLOW_CONTROL)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_DS_TM)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_US_TM)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_interface_ind_data_bounds_check(const bcmbal_interface_ind_data *this, bcmbal_presence_mask fields_present, bcmbal_interface_ind_id *failed_prop)
+{
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_ADMIN_STATE)) != 0)
+ {
+ switch (this->admin_state)
+ {
+ case BCMBAL_STATE_UP:
+ break;
+ case BCMBAL_STATE_DOWN:
+ break;
+ case BCMBAL_STATE_TESTING:
+ break;
+ default:
+ *failed_prop = BCMBAL_INTERFACE_IND_ID_ADMIN_STATE;
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_OPER_STATUS)) != 0)
+ {
+ switch (this->oper_status)
+ {
+ case BCMBAL_STATUS_UP:
+ break;
+ case BCMBAL_STATUS_DOWN:
+ break;
+ case BCMBAL_STATUS_TESTING:
+ break;
+ case BCMBAL_STATUS_NOT_PRESENT:
+ break;
+ case BCMBAL_STATUS_LOWER_LAYER_DOWN:
+ break;
+ case BCMBAL_STATUS_UNKNOWN:
+ break;
+ default:
+ *failed_prop = BCMBAL_INTERFACE_IND_ID_OPER_STATUS;
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_TRANSCEIVER_TYPE)) != 0)
+ {
+ switch (this->transceiver_type)
+ {
+ case BCMBAL_TRX_TYPE_GPON_SPS_43_48:
+ break;
+ case BCMBAL_TRX_TYPE_GPON_SPS_SOG_4321:
+ break;
+ case BCMBAL_TRX_TYPE_GPON_LTE_3680_M:
+ break;
+ case BCMBAL_TRX_TYPE_GPON_SOURCE_PHOTONICS:
+ break;
+ case BCMBAL_TRX_TYPE_GPON_LTE_3680_P:
+ break;
+ case BCMBAL_TRX_TYPE_XGPON_LTH_7222_PC:
+ break;
+ case BCMBAL_TRX_TYPE_XGPON_LTH_7226_PC:
+ break;
+ case BCMBAL_TRX_TYPE_XGPON_LTH_5302_PC:
+ break;
+ default:
+ *failed_prop = BCMBAL_INTERFACE_IND_ID_TRANSCEIVER_TYPE;
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_DS_MISS_MODE)) != 0)
+ {
+ switch (this->ds_miss_mode)
+ {
+ case BCMBAL_DS_MISS_MODE_DISCARD:
+ break;
+ case BCMBAL_DS_MISS_MODE_BROADCAST:
+ break;
+ case BCMBAL_DS_MISS_MODE_VID:
+ break;
+ default:
+ *failed_prop = BCMBAL_INTERFACE_IND_ID_DS_MISS_MODE;
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_INTERFACE_IND_ID_FLOW_CONTROL)) != 0)
+ {
+ switch (this->flow_control)
+ {
+ case BCMBAL_CONTROL_DISABLE:
+ break;
+ case BCMBAL_CONTROL_ENABLE:
+ break;
+ default:
+ *failed_prop = BCMBAL_INTERFACE_IND_ID_FLOW_CONTROL;
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+void bcmbal_packet_key_set_default(bcmbal_packet_key *this, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_PACKET_KEY_ID_RESERVED)) != 0)
+ {
+ this->reserved = 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_KEY_ID_PACKET_SEND_DEST)) != 0)
+ {
+ this->packet_send_dest.type = (bcmbal_dest_type) 0;
+ this->packet_send_dest.u.nni.int_id = (bcmbal_intf_id) 0;
+ }
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_packet_key_pack(const bcmbal_packet_key *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_PACKET_KEY_ID_RESERVED)) != 0)
+ {
+ if (!bcmbal_buf_write_u32(buf, this->reserved))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_KEY_ID_PACKET_SEND_DEST)) != 0)
+ {
+ if (!bcmbal_dest_pack(&this->packet_send_dest, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+uint32_t bcmbal_packet_key_get_packed_length(const bcmbal_packet_key *this, bcmbal_presence_mask fields_present)
+{
+ uint32_t count = 0;
+ if ((fields_present & (1ULL << BCMBAL_PACKET_KEY_ID_RESERVED)) != 0)
+ {
+ count += 4;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_KEY_ID_PACKET_SEND_DEST)) != 0)
+ {
+ count += bcmbal_dest_get_packed_length(&this->packet_send_dest);
+ }
+
+ return count;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_packet_key_unpack(bcmbal_packet_key *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_PACKET_KEY_ID_RESERVED)) != 0)
+ {
+ if (!bcmbal_buf_read_u32(buf, &this->reserved))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_KEY_ID_PACKET_SEND_DEST)) != 0)
+ {
+ if (!bcmbal_dest_unpack(&this->packet_send_dest, buf, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_packet_key_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_PACKET_KEY_ID_RESERVED)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_KEY_ID_PACKET_SEND_DEST)) != 0)
+ {
+ if (!bcmbal_dest_scan(packed, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_packet_key_bounds_check(const bcmbal_packet_key *this, bcmbal_presence_mask fields_present, bcmbal_packet_key_id *failed_prop)
+{
+ if ((fields_present & (1ULL << BCMBAL_PACKET_KEY_ID_PACKET_SEND_DEST)) != 0)
+ {
+ if (!bcmbal_dest_bounds_check(&this->packet_send_dest))
+ {
+ *failed_prop = BCMBAL_PACKET_KEY_ID_PACKET_SEND_DEST;
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+void bcmbal_packet_cfg_data_set_default(bcmbal_packet_cfg_data *this, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_PACKET_CFG_ID_FLOW_ID)) != 0)
+ {
+ this->flow_id = (bcmbal_flow_id) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_CFG_ID_FLOW_TYPE)) != 0)
+ {
+ this->flow_type = (bcmbal_flow_type) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_CFG_ID_INTF_ID)) != 0)
+ {
+ this->intf_id = (bcmbal_intf_id) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_CFG_ID_INTF_TYPE)) != 0)
+ {
+ this->intf_type = BCMBAL_INTF_TYPE_NNI;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_CFG_ID_SVC_PORT)) != 0)
+ {
+ this->svc_port = (bcmbal_service_port_id) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_CFG_ID_FLOW_COOKIE)) != 0)
+ {
+ this->flow_cookie = (bcmbal_cookie) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_CFG_ID_PKT)) != 0)
+ {
+ this->pkt.len = 0;
+ this->pkt.val = NULL;
+ }
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_packet_cfg_data_pack(const bcmbal_packet_cfg_data *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_PACKET_CFG_ID_FLOW_ID)) != 0)
+ {
+ if (!bcmbal_buf_write_u32(buf, (uint32_t) this->flow_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_CFG_ID_FLOW_TYPE)) != 0)
+ {
+ if (!bcmbal_flow_type_pack(this->flow_type, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_CFG_ID_INTF_ID)) != 0)
+ {
+ if (!bcmbal_buf_write_u32(buf, (uint32_t) this->intf_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_CFG_ID_INTF_TYPE)) != 0)
+ {
+ if (!bcmbal_intf_type_pack(this->intf_type, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_CFG_ID_SVC_PORT)) != 0)
+ {
+ if (!bcmbal_buf_write_u16(buf, (uint16_t) this->svc_port))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_CFG_ID_FLOW_COOKIE)) != 0)
+ {
+ if (!bcmbal_buf_write_u64(buf, (uint64_t) this->flow_cookie))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_CFG_ID_PKT)) != 0)
+ {
+ if (!bcmbal_u8_list_u32_pack(&this->pkt, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+uint32_t bcmbal_packet_cfg_data_get_packed_length(const bcmbal_packet_cfg_data *this, bcmbal_presence_mask fields_present)
+{
+ uint32_t count = 0;
+ if ((fields_present & (1ULL << BCMBAL_PACKET_CFG_ID_FLOW_ID)) != 0)
+ {
+ count += 4;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_CFG_ID_FLOW_TYPE)) != 0)
+ {
+ count += 4;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_CFG_ID_INTF_ID)) != 0)
+ {
+ count += 4;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_CFG_ID_INTF_TYPE)) != 0)
+ {
+ count += 4;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_CFG_ID_SVC_PORT)) != 0)
+ {
+ count += 2;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_CFG_ID_FLOW_COOKIE)) != 0)
+ {
+ count += 8;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_CFG_ID_PKT)) != 0)
+ {
+ count += bcmbal_u8_list_u32_get_packed_length(&this->pkt);
+ }
+
+ return count;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_packet_cfg_data_unpack(bcmbal_packet_cfg_data *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_PACKET_CFG_ID_FLOW_ID)) != 0)
+ {
+ if (!bcmbal_buf_read_u32(buf, (uint32_t *) &this->flow_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_CFG_ID_FLOW_TYPE)) != 0)
+ {
+ if (!bcmbal_flow_type_unpack(&this->flow_type, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_CFG_ID_INTF_ID)) != 0)
+ {
+ if (!bcmbal_buf_read_u32(buf, (uint32_t *) &this->intf_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_CFG_ID_INTF_TYPE)) != 0)
+ {
+ if (!bcmbal_intf_type_unpack(&this->intf_type, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_CFG_ID_SVC_PORT)) != 0)
+ {
+ if (!bcmbal_buf_read_u16(buf, (uint16_t *) &this->svc_port))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_CFG_ID_FLOW_COOKIE)) != 0)
+ {
+ if (!bcmbal_buf_read_u64(buf, (uint64_t *) &this->flow_cookie))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_CFG_ID_PKT)) != 0)
+ {
+ if (!bcmbal_u8_list_u32_unpack(&this->pkt, buf, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_packet_cfg_data_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_PACKET_CFG_ID_FLOW_ID)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_CFG_ID_FLOW_TYPE)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_CFG_ID_INTF_ID)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_CFG_ID_INTF_TYPE)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_CFG_ID_SVC_PORT)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 2))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_CFG_ID_FLOW_COOKIE)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 8))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_CFG_ID_PKT)) != 0)
+ {
+ if (!bcmbal_u8_list_u32_scan(packed, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_packet_cfg_data_bounds_check(const bcmbal_packet_cfg_data *this, bcmbal_presence_mask fields_present, bcmbal_packet_cfg_id *failed_prop)
+{
+ if ((fields_present & (1ULL << BCMBAL_PACKET_CFG_ID_FLOW_TYPE)) != 0)
+ {
+ switch (this->flow_type)
+ {
+ case BCMBAL_FLOW_TYPE_UPSTREAM:
+ break;
+ case BCMBAL_FLOW_TYPE_DOWNSTREAM:
+ break;
+ case BCMBAL_FLOW_TYPE_BROADCAST:
+ break;
+ case BCMBAL_FLOW_TYPE_MULTICAST:
+ break;
+ default:
+ *failed_prop = BCMBAL_PACKET_CFG_ID_FLOW_TYPE;
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_CFG_ID_INTF_TYPE)) != 0)
+ {
+ switch (this->intf_type)
+ {
+ case BCMBAL_INTF_TYPE_NNI:
+ break;
+ case BCMBAL_INTF_TYPE_PON:
+ break;
+ default:
+ *failed_prop = BCMBAL_PACKET_CFG_ID_INTF_TYPE;
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_CFG_ID_PKT)) != 0)
+ {
+ if (!bcmbal_u8_list_u32_bounds_check(&this->pkt))
+ {
+ *failed_prop = BCMBAL_PACKET_CFG_ID_PKT;
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+void bcmbal_packet_ind_data_set_default(bcmbal_packet_ind_data *this, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_PACKET_IND_ID_FLOW_ID)) != 0)
+ {
+ this->flow_id = (bcmbal_flow_id) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_IND_ID_FLOW_TYPE)) != 0)
+ {
+ this->flow_type = (bcmbal_flow_type) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_IND_ID_INTF_ID)) != 0)
+ {
+ this->intf_id = (bcmbal_intf_id) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_IND_ID_INTF_TYPE)) != 0)
+ {
+ this->intf_type = BCMBAL_INTF_TYPE_NNI;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_IND_ID_SVC_PORT)) != 0)
+ {
+ this->svc_port = (bcmbal_service_port_id) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_IND_ID_FLOW_COOKIE)) != 0)
+ {
+ this->flow_cookie = (bcmbal_cookie) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_IND_ID_PKT)) != 0)
+ {
+ this->pkt.len = 0;
+ this->pkt.val = NULL;
+ }
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_packet_ind_data_pack(const bcmbal_packet_ind_data *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_PACKET_IND_ID_FLOW_ID)) != 0)
+ {
+ if (!bcmbal_buf_write_u32(buf, (uint32_t) this->flow_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_IND_ID_FLOW_TYPE)) != 0)
+ {
+ if (!bcmbal_flow_type_pack(this->flow_type, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_IND_ID_INTF_ID)) != 0)
+ {
+ if (!bcmbal_buf_write_u32(buf, (uint32_t) this->intf_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_IND_ID_INTF_TYPE)) != 0)
+ {
+ if (!bcmbal_intf_type_pack(this->intf_type, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_IND_ID_SVC_PORT)) != 0)
+ {
+ if (!bcmbal_buf_write_u16(buf, (uint16_t) this->svc_port))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_IND_ID_FLOW_COOKIE)) != 0)
+ {
+ if (!bcmbal_buf_write_u64(buf, (uint64_t) this->flow_cookie))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_IND_ID_PKT)) != 0)
+ {
+ if (!bcmbal_u8_list_u32_pack(&this->pkt, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+uint32_t bcmbal_packet_ind_data_get_packed_length(const bcmbal_packet_ind_data *this, bcmbal_presence_mask fields_present)
+{
+ uint32_t count = 0;
+ if ((fields_present & (1ULL << BCMBAL_PACKET_IND_ID_FLOW_ID)) != 0)
+ {
+ count += 4;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_IND_ID_FLOW_TYPE)) != 0)
+ {
+ count += 4;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_IND_ID_INTF_ID)) != 0)
+ {
+ count += 4;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_IND_ID_INTF_TYPE)) != 0)
+ {
+ count += 4;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_IND_ID_SVC_PORT)) != 0)
+ {
+ count += 2;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_IND_ID_FLOW_COOKIE)) != 0)
+ {
+ count += 8;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_IND_ID_PKT)) != 0)
+ {
+ count += bcmbal_u8_list_u32_get_packed_length(&this->pkt);
+ }
+
+ return count;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_packet_ind_data_unpack(bcmbal_packet_ind_data *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_PACKET_IND_ID_FLOW_ID)) != 0)
+ {
+ if (!bcmbal_buf_read_u32(buf, (uint32_t *) &this->flow_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_IND_ID_FLOW_TYPE)) != 0)
+ {
+ if (!bcmbal_flow_type_unpack(&this->flow_type, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_IND_ID_INTF_ID)) != 0)
+ {
+ if (!bcmbal_buf_read_u32(buf, (uint32_t *) &this->intf_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_IND_ID_INTF_TYPE)) != 0)
+ {
+ if (!bcmbal_intf_type_unpack(&this->intf_type, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_IND_ID_SVC_PORT)) != 0)
+ {
+ if (!bcmbal_buf_read_u16(buf, (uint16_t *) &this->svc_port))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_IND_ID_FLOW_COOKIE)) != 0)
+ {
+ if (!bcmbal_buf_read_u64(buf, (uint64_t *) &this->flow_cookie))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_IND_ID_PKT)) != 0)
+ {
+ if (!bcmbal_u8_list_u32_unpack(&this->pkt, buf, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_packet_ind_data_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_PACKET_IND_ID_FLOW_ID)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_IND_ID_FLOW_TYPE)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_IND_ID_INTF_ID)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_IND_ID_INTF_TYPE)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_IND_ID_SVC_PORT)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 2))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_IND_ID_FLOW_COOKIE)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 8))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_IND_ID_PKT)) != 0)
+ {
+ if (!bcmbal_u8_list_u32_scan(packed, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_packet_ind_data_bounds_check(const bcmbal_packet_ind_data *this, bcmbal_presence_mask fields_present, bcmbal_packet_ind_id *failed_prop)
+{
+ if ((fields_present & (1ULL << BCMBAL_PACKET_IND_ID_FLOW_TYPE)) != 0)
+ {
+ switch (this->flow_type)
+ {
+ case BCMBAL_FLOW_TYPE_UPSTREAM:
+ break;
+ case BCMBAL_FLOW_TYPE_DOWNSTREAM:
+ break;
+ case BCMBAL_FLOW_TYPE_BROADCAST:
+ break;
+ case BCMBAL_FLOW_TYPE_MULTICAST:
+ break;
+ default:
+ *failed_prop = BCMBAL_PACKET_IND_ID_FLOW_TYPE;
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_IND_ID_INTF_TYPE)) != 0)
+ {
+ switch (this->intf_type)
+ {
+ case BCMBAL_INTF_TYPE_NNI:
+ break;
+ case BCMBAL_INTF_TYPE_PON:
+ break;
+ default:
+ *failed_prop = BCMBAL_PACKET_IND_ID_INTF_TYPE;
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_PACKET_IND_ID_PKT)) != 0)
+ {
+ if (!bcmbal_u8_list_u32_bounds_check(&this->pkt))
+ {
+ *failed_prop = BCMBAL_PACKET_IND_ID_PKT;
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+void bcmbal_subscriber_terminal_key_set_default(bcmbal_subscriber_terminal_key *this, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_KEY_ID_SUB_TERM_ID)) != 0)
+ {
+ this->sub_term_id = (bcmbal_sub_id) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_KEY_ID_INTF_ID)) != 0)
+ {
+ this->intf_id = (bcmbal_intf_id) 0;
+ }
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_subscriber_terminal_key_pack(const bcmbal_subscriber_terminal_key *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_KEY_ID_SUB_TERM_ID)) != 0)
+ {
+ if (!bcmbal_buf_write_u32(buf, (uint32_t) this->sub_term_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_KEY_ID_INTF_ID)) != 0)
+ {
+ if (!bcmbal_buf_write_u32(buf, (uint32_t) this->intf_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+uint32_t bcmbal_subscriber_terminal_key_get_packed_length(const bcmbal_subscriber_terminal_key *this, bcmbal_presence_mask fields_present)
+{
+ uint32_t count = 0;
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_KEY_ID_SUB_TERM_ID)) != 0)
+ {
+ count += 4;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_KEY_ID_INTF_ID)) != 0)
+ {
+ count += 4;
+ }
+
+ return count;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_subscriber_terminal_key_unpack(bcmbal_subscriber_terminal_key *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_KEY_ID_SUB_TERM_ID)) != 0)
+ {
+ if (!bcmbal_buf_read_u32(buf, (uint32_t *) &this->sub_term_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_KEY_ID_INTF_ID)) != 0)
+ {
+ if (!bcmbal_buf_read_u32(buf, (uint32_t *) &this->intf_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_subscriber_terminal_key_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_KEY_ID_SUB_TERM_ID)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_KEY_ID_INTF_ID)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_subscriber_terminal_key_bounds_check(const bcmbal_subscriber_terminal_key *this, bcmbal_presence_mask fields_present, bcmbal_subscriber_terminal_key_id *failed_prop)
+{
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+void bcmbal_subscriber_terminal_cfg_data_set_default(bcmbal_subscriber_terminal_cfg_data *this, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_ADMIN_STATE)) != 0)
+ {
+ this->admin_state = (bcmbal_state) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_OPER_STATUS)) != 0)
+ {
+ this->oper_status = (bcmbal_status) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_SERIAL_NUMBER)) != 0)
+ {
+ memset(this->serial_number.vendor_id, 0, sizeof(this->serial_number.vendor_id));
+ memset(this->serial_number.vendor_specific, 0, sizeof(this->serial_number.vendor_specific));
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_PASSWORD)) != 0)
+ {
+ memset(this->password.arr, 0, sizeof(this->password.arr));
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_REGISTRATION_ID)) != 0)
+ {
+ memset(this->registration_id.arr, 0, sizeof(this->registration_id.arr));
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_SVC_PORT_ID)) != 0)
+ {
+ this->svc_port_id = (bcmbal_service_port_id) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_MAC_ADDRESS)) != 0)
+ {
+ bcmos_mac_address_init(&this->mac_address);
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_DS_TM)) != 0)
+ {
+ this->ds_tm = (bcmbal_tm_sched_id) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_US_TM)) != 0)
+ {
+ this->us_tm = (bcmbal_tm_sched_id) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_SVC_PORT_ID_LIST)) != 0)
+ {
+ this->svc_port_id_list.len = 0;
+ this->svc_port_id_list.val = NULL;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_AGG_PORT_ID_LIST)) != 0)
+ {
+ this->agg_port_id_list.len = 0;
+ this->agg_port_id_list.val = NULL;
+ }
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_subscriber_terminal_cfg_data_pack(const bcmbal_subscriber_terminal_cfg_data *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_ADMIN_STATE)) != 0)
+ {
+ if (!bcmbal_state_pack(this->admin_state, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_OPER_STATUS)) != 0)
+ {
+ if (!bcmbal_status_pack(this->oper_status, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_SERIAL_NUMBER)) != 0)
+ {
+ if (!bcmbal_serial_number_pack(&this->serial_number, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_PASSWORD)) != 0)
+ {
+ if (!bcmbal_password_pack(&this->password, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_REGISTRATION_ID)) != 0)
+ {
+ if (!bcmbal_registration_id_pack(&this->registration_id, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_SVC_PORT_ID)) != 0)
+ {
+ if (!bcmbal_buf_write_u16(buf, (uint16_t) this->svc_port_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_MAC_ADDRESS)) != 0)
+ {
+ if (!bcmbal_buf_write_mac_address(buf, this->mac_address))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_DS_TM)) != 0)
+ {
+ if (!bcmbal_buf_write_u32(buf, (uint32_t) this->ds_tm))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_US_TM)) != 0)
+ {
+ if (!bcmbal_buf_write_u32(buf, (uint32_t) this->us_tm))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_SVC_PORT_ID_LIST)) != 0)
+ {
+ if (!bcmbal_service_port_id_list_u8_pack(&this->svc_port_id_list, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_AGG_PORT_ID_LIST)) != 0)
+ {
+ if (!bcmbal_aggregation_port_id_list_u8_pack(&this->agg_port_id_list, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+uint32_t bcmbal_subscriber_terminal_cfg_data_get_packed_length(const bcmbal_subscriber_terminal_cfg_data *this, bcmbal_presence_mask fields_present)
+{
+ uint32_t count = 0;
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_ADMIN_STATE)) != 0)
+ {
+ count += 4;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_OPER_STATUS)) != 0)
+ {
+ count += 4;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_SERIAL_NUMBER)) != 0)
+ {
+ count += 8;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_PASSWORD)) != 0)
+ {
+ count += 10;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_REGISTRATION_ID)) != 0)
+ {
+ count += 36;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_SVC_PORT_ID)) != 0)
+ {
+ count += 2;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_MAC_ADDRESS)) != 0)
+ {
+ count += 6;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_DS_TM)) != 0)
+ {
+ count += 4;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_US_TM)) != 0)
+ {
+ count += 4;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_SVC_PORT_ID_LIST)) != 0)
+ {
+ count += bcmbal_service_port_id_list_u8_get_packed_length(&this->svc_port_id_list);
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_AGG_PORT_ID_LIST)) != 0)
+ {
+ count += bcmbal_aggregation_port_id_list_u8_get_packed_length(&this->agg_port_id_list);
+ }
+
+ return count;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_subscriber_terminal_cfg_data_unpack(bcmbal_subscriber_terminal_cfg_data *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_ADMIN_STATE)) != 0)
+ {
+ if (!bcmbal_state_unpack(&this->admin_state, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_OPER_STATUS)) != 0)
+ {
+ if (!bcmbal_status_unpack(&this->oper_status, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_SERIAL_NUMBER)) != 0)
+ {
+ if (!bcmbal_serial_number_unpack(&this->serial_number, buf, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_PASSWORD)) != 0)
+ {
+ if (!bcmbal_password_unpack(&this->password, buf, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_REGISTRATION_ID)) != 0)
+ {
+ if (!bcmbal_registration_id_unpack(&this->registration_id, buf, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_SVC_PORT_ID)) != 0)
+ {
+ if (!bcmbal_buf_read_u16(buf, (uint16_t *) &this->svc_port_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_MAC_ADDRESS)) != 0)
+ {
+ if (!bcmbal_buf_read_mac_address(buf, &this->mac_address))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_DS_TM)) != 0)
+ {
+ if (!bcmbal_buf_read_u32(buf, (uint32_t *) &this->ds_tm))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_US_TM)) != 0)
+ {
+ if (!bcmbal_buf_read_u32(buf, (uint32_t *) &this->us_tm))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_SVC_PORT_ID_LIST)) != 0)
+ {
+ if (!bcmbal_service_port_id_list_u8_unpack(&this->svc_port_id_list, buf, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_AGG_PORT_ID_LIST)) != 0)
+ {
+ if (!bcmbal_aggregation_port_id_list_u8_unpack(&this->agg_port_id_list, buf, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_subscriber_terminal_cfg_data_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_ADMIN_STATE)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_OPER_STATUS)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_SERIAL_NUMBER)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 8))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_PASSWORD)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 10))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_REGISTRATION_ID)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 36))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_SVC_PORT_ID)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 2))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_MAC_ADDRESS)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 6))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_DS_TM)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_US_TM)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_SVC_PORT_ID_LIST)) != 0)
+ {
+ if (!bcmbal_service_port_id_list_u8_scan(packed, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_AGG_PORT_ID_LIST)) != 0)
+ {
+ if (!bcmbal_aggregation_port_id_list_u8_scan(packed, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_subscriber_terminal_cfg_data_bounds_check(const bcmbal_subscriber_terminal_cfg_data *this, bcmbal_presence_mask fields_present, bcmbal_subscriber_terminal_cfg_id *failed_prop)
+{
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_ADMIN_STATE)) != 0)
+ {
+ switch (this->admin_state)
+ {
+ case BCMBAL_STATE_UP:
+ break;
+ case BCMBAL_STATE_DOWN:
+ break;
+ case BCMBAL_STATE_TESTING:
+ break;
+ default:
+ *failed_prop = BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_ADMIN_STATE;
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_OPER_STATUS)) != 0)
+ {
+ switch (this->oper_status)
+ {
+ case BCMBAL_STATUS_UP:
+ break;
+ case BCMBAL_STATUS_DOWN:
+ break;
+ case BCMBAL_STATUS_TESTING:
+ break;
+ case BCMBAL_STATUS_NOT_PRESENT:
+ break;
+ case BCMBAL_STATUS_LOWER_LAYER_DOWN:
+ break;
+ case BCMBAL_STATUS_UNKNOWN:
+ break;
+ default:
+ *failed_prop = BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_OPER_STATUS;
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_SERIAL_NUMBER)) != 0)
+ {
+ if (!bcmbal_serial_number_bounds_check(&this->serial_number))
+ {
+ *failed_prop = BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_SERIAL_NUMBER;
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_PASSWORD)) != 0)
+ {
+ if (!bcmbal_password_bounds_check(&this->password))
+ {
+ *failed_prop = BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_PASSWORD;
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_REGISTRATION_ID)) != 0)
+ {
+ if (!bcmbal_registration_id_bounds_check(&this->registration_id))
+ {
+ *failed_prop = BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_REGISTRATION_ID;
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_SVC_PORT_ID_LIST)) != 0)
+ {
+ if (!bcmbal_service_port_id_list_u8_bounds_check(&this->svc_port_id_list))
+ {
+ *failed_prop = BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_SVC_PORT_ID_LIST;
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_AGG_PORT_ID_LIST)) != 0)
+ {
+ if (!bcmbal_aggregation_port_id_list_u8_bounds_check(&this->agg_port_id_list))
+ {
+ *failed_prop = BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_AGG_PORT_ID_LIST;
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+void bcmbal_subscriber_terminal_stat_data_set_default(bcmbal_subscriber_terminal_stat_data *this, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_STAT_ID_RX_PACKETS)) != 0)
+ {
+ this->rx_packets = 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_STAT_ID_RX_BYTES)) != 0)
+ {
+ this->rx_bytes = 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_STAT_ID_TX_PACKETS)) != 0)
+ {
+ this->tx_packets = 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_STAT_ID_TX_BYTES)) != 0)
+ {
+ this->tx_bytes = 0;
+ }
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_subscriber_terminal_stat_data_pack(const bcmbal_subscriber_terminal_stat_data *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_STAT_ID_RX_PACKETS)) != 0)
+ {
+ if (!bcmbal_buf_write_u64(buf, this->rx_packets))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_STAT_ID_RX_BYTES)) != 0)
+ {
+ if (!bcmbal_buf_write_u64(buf, this->rx_bytes))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_STAT_ID_TX_PACKETS)) != 0)
+ {
+ if (!bcmbal_buf_write_u64(buf, this->tx_packets))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_STAT_ID_TX_BYTES)) != 0)
+ {
+ if (!bcmbal_buf_write_u64(buf, this->tx_bytes))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+uint32_t bcmbal_subscriber_terminal_stat_data_get_packed_length(const bcmbal_subscriber_terminal_stat_data *this, bcmbal_presence_mask fields_present)
+{
+ uint32_t count = 0;
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_STAT_ID_RX_PACKETS)) != 0)
+ {
+ count += 8;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_STAT_ID_RX_BYTES)) != 0)
+ {
+ count += 8;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_STAT_ID_TX_PACKETS)) != 0)
+ {
+ count += 8;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_STAT_ID_TX_BYTES)) != 0)
+ {
+ count += 8;
+ }
+
+ return count;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_subscriber_terminal_stat_data_unpack(bcmbal_subscriber_terminal_stat_data *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_STAT_ID_RX_PACKETS)) != 0)
+ {
+ if (!bcmbal_buf_read_u64(buf, &this->rx_packets))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_STAT_ID_RX_BYTES)) != 0)
+ {
+ if (!bcmbal_buf_read_u64(buf, &this->rx_bytes))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_STAT_ID_TX_PACKETS)) != 0)
+ {
+ if (!bcmbal_buf_read_u64(buf, &this->tx_packets))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_STAT_ID_TX_BYTES)) != 0)
+ {
+ if (!bcmbal_buf_read_u64(buf, &this->tx_bytes))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_subscriber_terminal_stat_data_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_STAT_ID_RX_PACKETS)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 8))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_STAT_ID_RX_BYTES)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 8))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_STAT_ID_TX_PACKETS)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 8))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_STAT_ID_TX_BYTES)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 8))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_subscriber_terminal_stat_data_bounds_check(const bcmbal_subscriber_terminal_stat_data *this, bcmbal_presence_mask fields_present, bcmbal_subscriber_terminal_stat_id *failed_prop)
+{
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+void bcmbal_subscriber_terminal_ind_data_set_default(bcmbal_subscriber_terminal_ind_data *this, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_ADMIN_STATE)) != 0)
+ {
+ this->admin_state = (bcmbal_state) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_OPER_STATUS)) != 0)
+ {
+ this->oper_status = (bcmbal_status) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_SERIAL_NUMBER)) != 0)
+ {
+ memset(this->serial_number.vendor_id, 0, sizeof(this->serial_number.vendor_id));
+ memset(this->serial_number.vendor_specific, 0, sizeof(this->serial_number.vendor_specific));
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_PASSWORD)) != 0)
+ {
+ memset(this->password.arr, 0, sizeof(this->password.arr));
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_REGISTRATION_ID)) != 0)
+ {
+ memset(this->registration_id.arr, 0, sizeof(this->registration_id.arr));
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_SVC_PORT_ID)) != 0)
+ {
+ this->svc_port_id = 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_MAC_ADDRESS)) != 0)
+ {
+ bcmos_mac_address_init(&this->mac_address);
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_DS_TM)) != 0)
+ {
+ this->ds_tm = (bcmbal_tm_sched_id) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_US_TM)) != 0)
+ {
+ this->us_tm = (bcmbal_tm_sched_id) 0;
+ }
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_subscriber_terminal_ind_data_pack(const bcmbal_subscriber_terminal_ind_data *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_ADMIN_STATE)) != 0)
+ {
+ if (!bcmbal_state_pack(this->admin_state, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_OPER_STATUS)) != 0)
+ {
+ if (!bcmbal_status_pack(this->oper_status, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_SERIAL_NUMBER)) != 0)
+ {
+ if (!bcmbal_serial_number_pack(&this->serial_number, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_PASSWORD)) != 0)
+ {
+ if (!bcmbal_password_pack(&this->password, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_REGISTRATION_ID)) != 0)
+ {
+ if (!bcmbal_registration_id_pack(&this->registration_id, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_SVC_PORT_ID)) != 0)
+ {
+ if (!bcmbal_buf_write_u16(buf, this->svc_port_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_MAC_ADDRESS)) != 0)
+ {
+ if (!bcmbal_buf_write_mac_address(buf, this->mac_address))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_DS_TM)) != 0)
+ {
+ if (!bcmbal_buf_write_u32(buf, (uint32_t) this->ds_tm))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_US_TM)) != 0)
+ {
+ if (!bcmbal_buf_write_u32(buf, (uint32_t) this->us_tm))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+uint32_t bcmbal_subscriber_terminal_ind_data_get_packed_length(const bcmbal_subscriber_terminal_ind_data *this, bcmbal_presence_mask fields_present)
+{
+ uint32_t count = 0;
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_ADMIN_STATE)) != 0)
+ {
+ count += 4;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_OPER_STATUS)) != 0)
+ {
+ count += 4;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_SERIAL_NUMBER)) != 0)
+ {
+ count += 8;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_PASSWORD)) != 0)
+ {
+ count += 10;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_REGISTRATION_ID)) != 0)
+ {
+ count += 36;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_SVC_PORT_ID)) != 0)
+ {
+ count += 2;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_MAC_ADDRESS)) != 0)
+ {
+ count += 6;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_DS_TM)) != 0)
+ {
+ count += 4;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_US_TM)) != 0)
+ {
+ count += 4;
+ }
+
+ return count;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_subscriber_terminal_ind_data_unpack(bcmbal_subscriber_terminal_ind_data *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_ADMIN_STATE)) != 0)
+ {
+ if (!bcmbal_state_unpack(&this->admin_state, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_OPER_STATUS)) != 0)
+ {
+ if (!bcmbal_status_unpack(&this->oper_status, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_SERIAL_NUMBER)) != 0)
+ {
+ if (!bcmbal_serial_number_unpack(&this->serial_number, buf, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_PASSWORD)) != 0)
+ {
+ if (!bcmbal_password_unpack(&this->password, buf, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_REGISTRATION_ID)) != 0)
+ {
+ if (!bcmbal_registration_id_unpack(&this->registration_id, buf, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_SVC_PORT_ID)) != 0)
+ {
+ if (!bcmbal_buf_read_u16(buf, &this->svc_port_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_MAC_ADDRESS)) != 0)
+ {
+ if (!bcmbal_buf_read_mac_address(buf, &this->mac_address))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_DS_TM)) != 0)
+ {
+ if (!bcmbal_buf_read_u32(buf, (uint32_t *) &this->ds_tm))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_US_TM)) != 0)
+ {
+ if (!bcmbal_buf_read_u32(buf, (uint32_t *) &this->us_tm))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_subscriber_terminal_ind_data_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_ADMIN_STATE)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_OPER_STATUS)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_SERIAL_NUMBER)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 8))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_PASSWORD)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 10))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_REGISTRATION_ID)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 36))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_SVC_PORT_ID)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 2))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_MAC_ADDRESS)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 6))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_DS_TM)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_US_TM)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_subscriber_terminal_ind_data_bounds_check(const bcmbal_subscriber_terminal_ind_data *this, bcmbal_presence_mask fields_present, bcmbal_subscriber_terminal_ind_id *failed_prop)
+{
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_ADMIN_STATE)) != 0)
+ {
+ switch (this->admin_state)
+ {
+ case BCMBAL_STATE_UP:
+ break;
+ case BCMBAL_STATE_DOWN:
+ break;
+ case BCMBAL_STATE_TESTING:
+ break;
+ default:
+ *failed_prop = BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_ADMIN_STATE;
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_OPER_STATUS)) != 0)
+ {
+ switch (this->oper_status)
+ {
+ case BCMBAL_STATUS_UP:
+ break;
+ case BCMBAL_STATUS_DOWN:
+ break;
+ case BCMBAL_STATUS_TESTING:
+ break;
+ case BCMBAL_STATUS_NOT_PRESENT:
+ break;
+ case BCMBAL_STATUS_LOWER_LAYER_DOWN:
+ break;
+ case BCMBAL_STATUS_UNKNOWN:
+ break;
+ default:
+ *failed_prop = BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_OPER_STATUS;
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_SERIAL_NUMBER)) != 0)
+ {
+ if (!bcmbal_serial_number_bounds_check(&this->serial_number))
+ {
+ *failed_prop = BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_SERIAL_NUMBER;
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_PASSWORD)) != 0)
+ {
+ if (!bcmbal_password_bounds_check(&this->password))
+ {
+ *failed_prop = BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_PASSWORD;
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_REGISTRATION_ID)) != 0)
+ {
+ if (!bcmbal_registration_id_bounds_check(&this->registration_id))
+ {
+ *failed_prop = BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_REGISTRATION_ID;
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+void bcmbal_tm_queue_key_set_default(bcmbal_tm_queue_key *this, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_KEY_ID_SCHED_ID)) != 0)
+ {
+ this->sched_id = (bcmbal_tm_sched_id) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_KEY_ID_SCHED_DIR)) != 0)
+ {
+ this->sched_dir = (bcmbal_tm_sched_dir) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_KEY_ID_ID)) != 0)
+ {
+ this->id = (bcmbal_tm_queue_id) 0;
+ }
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_queue_key_pack(const bcmbal_tm_queue_key *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_KEY_ID_SCHED_ID)) != 0)
+ {
+ if (!bcmbal_buf_write_u32(buf, (uint32_t) this->sched_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_KEY_ID_SCHED_DIR)) != 0)
+ {
+ if (!bcmbal_tm_sched_dir_pack(this->sched_dir, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_KEY_ID_ID)) != 0)
+ {
+ if (!bcmbal_buf_write_u8(buf, (uint8_t) this->id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+uint32_t bcmbal_tm_queue_key_get_packed_length(const bcmbal_tm_queue_key *this, bcmbal_presence_mask fields_present)
+{
+ uint32_t count = 0;
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_KEY_ID_SCHED_ID)) != 0)
+ {
+ count += 4;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_KEY_ID_SCHED_DIR)) != 0)
+ {
+ count += 1;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_KEY_ID_ID)) != 0)
+ {
+ count += 1;
+ }
+
+ return count;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_queue_key_unpack(bcmbal_tm_queue_key *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_KEY_ID_SCHED_ID)) != 0)
+ {
+ if (!bcmbal_buf_read_u32(buf, (uint32_t *) &this->sched_id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_KEY_ID_SCHED_DIR)) != 0)
+ {
+ if (!bcmbal_tm_sched_dir_unpack(&this->sched_dir, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_KEY_ID_ID)) != 0)
+ {
+ if (!bcmbal_buf_read_u8(buf, (uint8_t *) &this->id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_queue_key_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_KEY_ID_SCHED_ID)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_KEY_ID_SCHED_DIR)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 1))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_KEY_ID_ID)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 1))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_queue_key_bounds_check(const bcmbal_tm_queue_key *this, bcmbal_presence_mask fields_present, bcmbal_tm_queue_key_id *failed_prop)
+{
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_KEY_ID_SCHED_DIR)) != 0)
+ {
+ switch (this->sched_dir)
+ {
+ case BCMBAL_TM_SCHED_DIR_US:
+ break;
+ case BCMBAL_TM_SCHED_DIR_DS:
+ break;
+ default:
+ *failed_prop = BCMBAL_TM_QUEUE_KEY_ID_SCHED_DIR;
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+void bcmbal_tm_queue_cfg_data_set_default(bcmbal_tm_queue_cfg_data *this, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_CFG_ID_PRIORITY)) != 0)
+ {
+ this->priority = (bcmbal_tm_priority) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_CFG_ID_WEIGHT)) != 0)
+ {
+ this->weight = (bcmbal_tm_weight) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_CFG_ID_RATE)) != 0)
+ {
+ this->rate.presence_mask = (bcmbal_tm_shaping_id) 0;
+ this->rate.sbr = 0;
+ this->rate.pbr = 0;
+ this->rate.burst = 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_CFG_ID_BAC)) != 0)
+ {
+ this->bac.type = BCMBAL_TM_BAC_TYPE_TAILDROP;
+ this->bac.u.taildrop.max_size = 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_CFG_ID_CREATION_MODE)) != 0)
+ {
+ this->creation_mode = BCMBAL_TM_CREATION_MODE_MANUAL;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_CFG_ID_REF_COUNT)) != 0)
+ {
+ this->ref_count = 0;
+ }
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_queue_cfg_data_pack(const bcmbal_tm_queue_cfg_data *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_CFG_ID_PRIORITY)) != 0)
+ {
+ if (!bcmbal_buf_write_u8(buf, (uint8_t) this->priority))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_CFG_ID_WEIGHT)) != 0)
+ {
+ if (!bcmbal_buf_write_u8(buf, (uint8_t) this->weight))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_CFG_ID_RATE)) != 0)
+ {
+ if (!bcmbal_tm_shaping_pack(&this->rate, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_CFG_ID_BAC)) != 0)
+ {
+ if (!bcmbal_tm_bac_pack(&this->bac, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_CFG_ID_CREATION_MODE)) != 0)
+ {
+ if (!bcmbal_tm_creation_mode_pack(this->creation_mode, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_CFG_ID_REF_COUNT)) != 0)
+ {
+ if (!bcmbal_buf_write_u8(buf, this->ref_count))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+uint32_t bcmbal_tm_queue_cfg_data_get_packed_length(const bcmbal_tm_queue_cfg_data *this, bcmbal_presence_mask fields_present)
+{
+ uint32_t count = 0;
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_CFG_ID_PRIORITY)) != 0)
+ {
+ count += 1;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_CFG_ID_WEIGHT)) != 0)
+ {
+ count += 1;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_CFG_ID_RATE)) != 0)
+ {
+ count += bcmbal_tm_shaping_get_packed_length(&this->rate);
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_CFG_ID_BAC)) != 0)
+ {
+ count += bcmbal_tm_bac_get_packed_length(&this->bac);
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_CFG_ID_CREATION_MODE)) != 0)
+ {
+ count += 1;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_CFG_ID_REF_COUNT)) != 0)
+ {
+ count += 1;
+ }
+
+ return count;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_queue_cfg_data_unpack(bcmbal_tm_queue_cfg_data *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_CFG_ID_PRIORITY)) != 0)
+ {
+ if (!bcmbal_buf_read_u8(buf, (uint8_t *) &this->priority))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_CFG_ID_WEIGHT)) != 0)
+ {
+ if (!bcmbal_buf_read_u8(buf, (uint8_t *) &this->weight))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_CFG_ID_RATE)) != 0)
+ {
+ if (!bcmbal_tm_shaping_unpack(&this->rate, buf, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_CFG_ID_BAC)) != 0)
+ {
+ if (!bcmbal_tm_bac_unpack(&this->bac, buf, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_CFG_ID_CREATION_MODE)) != 0)
+ {
+ if (!bcmbal_tm_creation_mode_unpack(&this->creation_mode, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_CFG_ID_REF_COUNT)) != 0)
+ {
+ if (!bcmbal_buf_read_u8(buf, &this->ref_count))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_queue_cfg_data_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_CFG_ID_PRIORITY)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 1))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_CFG_ID_WEIGHT)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 1))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_CFG_ID_RATE)) != 0)
+ {
+ if (!bcmbal_tm_shaping_scan(packed, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_CFG_ID_BAC)) != 0)
+ {
+ if (!bcmbal_tm_bac_scan(packed, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_CFG_ID_CREATION_MODE)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 1))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_CFG_ID_REF_COUNT)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 1))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_queue_cfg_data_bounds_check(const bcmbal_tm_queue_cfg_data *this, bcmbal_presence_mask fields_present, bcmbal_tm_queue_cfg_id *failed_prop)
+{
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_CFG_ID_RATE)) != 0)
+ {
+ if (!bcmbal_tm_shaping_bounds_check(&this->rate))
+ {
+ *failed_prop = BCMBAL_TM_QUEUE_CFG_ID_RATE;
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_CFG_ID_BAC)) != 0)
+ {
+ if (!bcmbal_tm_bac_bounds_check(&this->bac))
+ {
+ *failed_prop = BCMBAL_TM_QUEUE_CFG_ID_BAC;
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_CFG_ID_CREATION_MODE)) != 0)
+ {
+ switch (this->creation_mode)
+ {
+ case BCMBAL_TM_CREATION_MODE_MANUAL:
+ break;
+ case BCMBAL_TM_CREATION_MODE_AUTO:
+ break;
+ default:
+ *failed_prop = BCMBAL_TM_QUEUE_CFG_ID_CREATION_MODE;
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+void bcmbal_tm_queue_stat_data_set_default(bcmbal_tm_queue_stat_data *this, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_STAT_ID_PACKETS_OK)) != 0)
+ {
+ this->packets_ok = 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_STAT_ID_BYTES_OK)) != 0)
+ {
+ this->bytes_ok = 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_STAT_ID_PACKETS_DISCARDED)) != 0)
+ {
+ this->packets_discarded = 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_STAT_ID_BYTES_DISCARDED)) != 0)
+ {
+ this->bytes_discarded = 0;
+ }
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_queue_stat_data_pack(const bcmbal_tm_queue_stat_data *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_STAT_ID_PACKETS_OK)) != 0)
+ {
+ if (!bcmbal_buf_write_u64(buf, this->packets_ok))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_STAT_ID_BYTES_OK)) != 0)
+ {
+ if (!bcmbal_buf_write_u64(buf, this->bytes_ok))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_STAT_ID_PACKETS_DISCARDED)) != 0)
+ {
+ if (!bcmbal_buf_write_u64(buf, this->packets_discarded))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_STAT_ID_BYTES_DISCARDED)) != 0)
+ {
+ if (!bcmbal_buf_write_u64(buf, this->bytes_discarded))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+uint32_t bcmbal_tm_queue_stat_data_get_packed_length(const bcmbal_tm_queue_stat_data *this, bcmbal_presence_mask fields_present)
+{
+ uint32_t count = 0;
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_STAT_ID_PACKETS_OK)) != 0)
+ {
+ count += 8;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_STAT_ID_BYTES_OK)) != 0)
+ {
+ count += 8;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_STAT_ID_PACKETS_DISCARDED)) != 0)
+ {
+ count += 8;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_STAT_ID_BYTES_DISCARDED)) != 0)
+ {
+ count += 8;
+ }
+
+ return count;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_queue_stat_data_unpack(bcmbal_tm_queue_stat_data *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_STAT_ID_PACKETS_OK)) != 0)
+ {
+ if (!bcmbal_buf_read_u64(buf, &this->packets_ok))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_STAT_ID_BYTES_OK)) != 0)
+ {
+ if (!bcmbal_buf_read_u64(buf, &this->bytes_ok))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_STAT_ID_PACKETS_DISCARDED)) != 0)
+ {
+ if (!bcmbal_buf_read_u64(buf, &this->packets_discarded))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_STAT_ID_BYTES_DISCARDED)) != 0)
+ {
+ if (!bcmbal_buf_read_u64(buf, &this->bytes_discarded))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_queue_stat_data_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_STAT_ID_PACKETS_OK)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 8))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_STAT_ID_BYTES_OK)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 8))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_STAT_ID_PACKETS_DISCARDED)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 8))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_STAT_ID_BYTES_DISCARDED)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 8))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_queue_stat_data_bounds_check(const bcmbal_tm_queue_stat_data *this, bcmbal_presence_mask fields_present, bcmbal_tm_queue_stat_id *failed_prop)
+{
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+void bcmbal_tm_queue_ind_data_set_default(bcmbal_tm_queue_ind_data *this, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_IND_ID_RET)) != 0)
+ {
+ this->ret = 0;
+ }
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_queue_ind_data_pack(const bcmbal_tm_queue_ind_data *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_IND_ID_RET)) != 0)
+ {
+ if (!bcmbal_buf_write_u32(buf, this->ret))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+uint32_t bcmbal_tm_queue_ind_data_get_packed_length(const bcmbal_tm_queue_ind_data *this, bcmbal_presence_mask fields_present)
+{
+ uint32_t count = 0;
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_IND_ID_RET)) != 0)
+ {
+ count += 4;
+ }
+
+ return count;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_queue_ind_data_unpack(bcmbal_tm_queue_ind_data *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_IND_ID_RET)) != 0)
+ {
+ if (!bcmbal_buf_read_u32(buf, &this->ret))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_queue_ind_data_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_TM_QUEUE_IND_ID_RET)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_queue_ind_data_bounds_check(const bcmbal_tm_queue_ind_data *this, bcmbal_presence_mask fields_present, bcmbal_tm_queue_ind_id *failed_prop)
+{
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+void bcmbal_tm_sched_key_set_default(bcmbal_tm_sched_key *this, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_KEY_ID_DIR)) != 0)
+ {
+ this->dir = (bcmbal_tm_sched_dir) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_KEY_ID_ID)) != 0)
+ {
+ this->id = (bcmbal_tm_sched_id) 0;
+ }
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_sched_key_pack(const bcmbal_tm_sched_key *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_KEY_ID_DIR)) != 0)
+ {
+ if (!bcmbal_tm_sched_dir_pack(this->dir, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_KEY_ID_ID)) != 0)
+ {
+ if (!bcmbal_buf_write_u32(buf, (uint32_t) this->id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+uint32_t bcmbal_tm_sched_key_get_packed_length(const bcmbal_tm_sched_key *this, bcmbal_presence_mask fields_present)
+{
+ uint32_t count = 0;
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_KEY_ID_DIR)) != 0)
+ {
+ count += 1;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_KEY_ID_ID)) != 0)
+ {
+ count += 4;
+ }
+
+ return count;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_sched_key_unpack(bcmbal_tm_sched_key *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_KEY_ID_DIR)) != 0)
+ {
+ if (!bcmbal_tm_sched_dir_unpack(&this->dir, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_KEY_ID_ID)) != 0)
+ {
+ if (!bcmbal_buf_read_u32(buf, (uint32_t *) &this->id))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_sched_key_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_KEY_ID_DIR)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 1))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_KEY_ID_ID)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_sched_key_bounds_check(const bcmbal_tm_sched_key *this, bcmbal_presence_mask fields_present, bcmbal_tm_sched_key_id *failed_prop)
+{
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_KEY_ID_DIR)) != 0)
+ {
+ switch (this->dir)
+ {
+ case BCMBAL_TM_SCHED_DIR_US:
+ break;
+ case BCMBAL_TM_SCHED_DIR_DS:
+ break;
+ default:
+ *failed_prop = BCMBAL_TM_SCHED_KEY_ID_DIR;
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+void bcmbal_tm_sched_cfg_data_set_default(bcmbal_tm_sched_cfg_data *this, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_OWNER)) != 0)
+ {
+ this->owner.type = BCMBAL_TM_SCHED_OWNER_TYPE_UNDEFINED;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_SCHED_TYPE)) != 0)
+ {
+ this->sched_type = BCMBAL_TM_SCHED_TYPE_NONE;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_SCHED_PARENT)) != 0)
+ {
+ this->sched_parent.presence_mask = (bcmbal_tm_sched_parent_id) 0;
+ this->sched_parent.sched_id = (bcmbal_tm_sched_id) 0;
+ this->sched_parent.priority = (bcmbal_tm_priority) 0;
+ this->sched_parent.weight = (bcmbal_tm_weight) 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_SCHED_CHILD_TYPE)) != 0)
+ {
+ this->sched_child_type = BCMBAL_TM_SCHED_CHILD_TYPE_QUEUE;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_RATE)) != 0)
+ {
+ this->rate.presence_mask = (bcmbal_tm_shaping_id) 0;
+ this->rate.sbr = 0;
+ this->rate.pbr = 0;
+ this->rate.burst = 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_TCONT_SLA)) != 0)
+ {
+ this->tcont_sla.presence_mask = (bcmbal_tm_tcont_sla_id) 0;
+ this->tcont_sla.extra_bw_elig = BCMBAL_EXTRA_BW_ELIGIBILITY_TYPE_NONE;
+ this->tcont_sla.nrt_cbr = 0;
+ this->tcont_sla.rt_cbr = 0;
+ this->tcont_sla.rt_profile = 0;
+ this->tcont_sla.nrt_profile = 0;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_CREATION_MODE)) != 0)
+ {
+ this->creation_mode = BCMBAL_TM_CREATION_MODE_MANUAL;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_QUEUES)) != 0)
+ {
+ this->queues.len = 0;
+ this->queues.val = NULL;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_SUB_SCHEDS)) != 0)
+ {
+ this->sub_scheds.len = 0;
+ this->sub_scheds.val = NULL;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_NUM_PRIORITIES)) != 0)
+ {
+ this->num_priorities = 0;
+ }
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_sched_cfg_data_pack(const bcmbal_tm_sched_cfg_data *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_OWNER)) != 0)
+ {
+ if (!bcmbal_tm_sched_owner_pack(&this->owner, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_SCHED_TYPE)) != 0)
+ {
+ if (!bcmbal_tm_sched_type_pack(this->sched_type, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_SCHED_PARENT)) != 0)
+ {
+ if (!bcmbal_tm_sched_parent_pack(&this->sched_parent, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_SCHED_CHILD_TYPE)) != 0)
+ {
+ if (!bcmbal_tm_sched_child_type_pack(this->sched_child_type, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_RATE)) != 0)
+ {
+ if (!bcmbal_tm_shaping_pack(&this->rate, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_TCONT_SLA)) != 0)
+ {
+ if (!bcmbal_tm_tcont_sla_pack(&this->tcont_sla, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_CREATION_MODE)) != 0)
+ {
+ if (!bcmbal_tm_creation_mode_pack(this->creation_mode, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_QUEUES)) != 0)
+ {
+ if (!bcmbal_tm_queue_id_list_u8_pack(&this->queues, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_SUB_SCHEDS)) != 0)
+ {
+ if (!bcmbal_tm_sched_id_list_u8_pack(&this->sub_scheds, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_NUM_PRIORITIES)) != 0)
+ {
+ if (!bcmbal_buf_write_u8(buf, this->num_priorities))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+uint32_t bcmbal_tm_sched_cfg_data_get_packed_length(const bcmbal_tm_sched_cfg_data *this, bcmbal_presence_mask fields_present)
+{
+ uint32_t count = 0;
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_OWNER)) != 0)
+ {
+ count += bcmbal_tm_sched_owner_get_packed_length(&this->owner);
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_SCHED_TYPE)) != 0)
+ {
+ count += 1;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_SCHED_PARENT)) != 0)
+ {
+ count += bcmbal_tm_sched_parent_get_packed_length(&this->sched_parent);
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_SCHED_CHILD_TYPE)) != 0)
+ {
+ count += 1;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_RATE)) != 0)
+ {
+ count += bcmbal_tm_shaping_get_packed_length(&this->rate);
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_TCONT_SLA)) != 0)
+ {
+ count += bcmbal_tm_tcont_sla_get_packed_length(&this->tcont_sla);
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_CREATION_MODE)) != 0)
+ {
+ count += 1;
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_QUEUES)) != 0)
+ {
+ count += bcmbal_tm_queue_id_list_u8_get_packed_length(&this->queues);
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_SUB_SCHEDS)) != 0)
+ {
+ count += bcmbal_tm_sched_id_list_u8_get_packed_length(&this->sub_scheds);
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_NUM_PRIORITIES)) != 0)
+ {
+ count += 1;
+ }
+
+ return count;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_sched_cfg_data_unpack(bcmbal_tm_sched_cfg_data *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_OWNER)) != 0)
+ {
+ if (!bcmbal_tm_sched_owner_unpack(&this->owner, buf, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_SCHED_TYPE)) != 0)
+ {
+ if (!bcmbal_tm_sched_type_unpack(&this->sched_type, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_SCHED_PARENT)) != 0)
+ {
+ if (!bcmbal_tm_sched_parent_unpack(&this->sched_parent, buf, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_SCHED_CHILD_TYPE)) != 0)
+ {
+ if (!bcmbal_tm_sched_child_type_unpack(&this->sched_child_type, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_RATE)) != 0)
+ {
+ if (!bcmbal_tm_shaping_unpack(&this->rate, buf, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_TCONT_SLA)) != 0)
+ {
+ if (!bcmbal_tm_tcont_sla_unpack(&this->tcont_sla, buf, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_CREATION_MODE)) != 0)
+ {
+ if (!bcmbal_tm_creation_mode_unpack(&this->creation_mode, buf))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_QUEUES)) != 0)
+ {
+ if (!bcmbal_tm_queue_id_list_u8_unpack(&this->queues, buf, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_SUB_SCHEDS)) != 0)
+ {
+ if (!bcmbal_tm_sched_id_list_u8_unpack(&this->sub_scheds, buf, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_NUM_PRIORITIES)) != 0)
+ {
+ if (!bcmbal_buf_read_u8(buf, &this->num_priorities))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_sched_cfg_data_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_OWNER)) != 0)
+ {
+ if (!bcmbal_tm_sched_owner_scan(packed, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_SCHED_TYPE)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 1))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_SCHED_PARENT)) != 0)
+ {
+ if (!bcmbal_tm_sched_parent_scan(packed, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_SCHED_CHILD_TYPE)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 1))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_RATE)) != 0)
+ {
+ if (!bcmbal_tm_shaping_scan(packed, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_TCONT_SLA)) != 0)
+ {
+ if (!bcmbal_tm_tcont_sla_scan(packed, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_CREATION_MODE)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 1))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_QUEUES)) != 0)
+ {
+ if (!bcmbal_tm_queue_id_list_u8_scan(packed, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_SUB_SCHEDS)) != 0)
+ {
+ if (!bcmbal_tm_sched_id_list_u8_scan(packed, extra_mem))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_NUM_PRIORITIES)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 1))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_sched_cfg_data_bounds_check(const bcmbal_tm_sched_cfg_data *this, bcmbal_presence_mask fields_present, bcmbal_tm_sched_cfg_id *failed_prop)
+{
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_OWNER)) != 0)
+ {
+ if (!bcmbal_tm_sched_owner_bounds_check(&this->owner))
+ {
+ *failed_prop = BCMBAL_TM_SCHED_CFG_ID_OWNER;
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_SCHED_TYPE)) != 0)
+ {
+ switch (this->sched_type)
+ {
+ case BCMBAL_TM_SCHED_TYPE_NONE:
+ break;
+ case BCMBAL_TM_SCHED_TYPE_WFQ:
+ break;
+ case BCMBAL_TM_SCHED_TYPE_SP:
+ break;
+ case BCMBAL_TM_SCHED_TYPE_SP_WFQ:
+ break;
+ default:
+ *failed_prop = BCMBAL_TM_SCHED_CFG_ID_SCHED_TYPE;
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_SCHED_PARENT)) != 0)
+ {
+ if (!bcmbal_tm_sched_parent_bounds_check(&this->sched_parent))
+ {
+ *failed_prop = BCMBAL_TM_SCHED_CFG_ID_SCHED_PARENT;
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_SCHED_CHILD_TYPE)) != 0)
+ {
+ switch (this->sched_child_type)
+ {
+ case BCMBAL_TM_SCHED_CHILD_TYPE_QUEUE:
+ break;
+ case BCMBAL_TM_SCHED_CHILD_TYPE_SCHED:
+ break;
+ default:
+ *failed_prop = BCMBAL_TM_SCHED_CFG_ID_SCHED_CHILD_TYPE;
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_RATE)) != 0)
+ {
+ if (!bcmbal_tm_shaping_bounds_check(&this->rate))
+ {
+ *failed_prop = BCMBAL_TM_SCHED_CFG_ID_RATE;
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_TCONT_SLA)) != 0)
+ {
+ if (!bcmbal_tm_tcont_sla_bounds_check(&this->tcont_sla))
+ {
+ *failed_prop = BCMBAL_TM_SCHED_CFG_ID_TCONT_SLA;
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_CREATION_MODE)) != 0)
+ {
+ switch (this->creation_mode)
+ {
+ case BCMBAL_TM_CREATION_MODE_MANUAL:
+ break;
+ case BCMBAL_TM_CREATION_MODE_AUTO:
+ break;
+ default:
+ *failed_prop = BCMBAL_TM_SCHED_CFG_ID_CREATION_MODE;
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_QUEUES)) != 0)
+ {
+ if (!bcmbal_tm_queue_id_list_u8_bounds_check(&this->queues))
+ {
+ *failed_prop = BCMBAL_TM_SCHED_CFG_ID_QUEUES;
+ return BCMOS_FALSE;
+ }
+ }
+
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_CFG_ID_SUB_SCHEDS)) != 0)
+ {
+ if (!bcmbal_tm_sched_id_list_u8_bounds_check(&this->sub_scheds))
+ {
+ *failed_prop = BCMBAL_TM_SCHED_CFG_ID_SUB_SCHEDS;
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+void bcmbal_tm_sched_ind_data_set_default(bcmbal_tm_sched_ind_data *this, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_IND_ID_RET)) != 0)
+ {
+ this->ret = 0;
+ }
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_sched_ind_data_pack(const bcmbal_tm_sched_ind_data *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_IND_ID_RET)) != 0)
+ {
+ if (!bcmbal_buf_write_u32(buf, this->ret))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+uint32_t bcmbal_tm_sched_ind_data_get_packed_length(const bcmbal_tm_sched_ind_data *this, bcmbal_presence_mask fields_present)
+{
+ uint32_t count = 0;
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_IND_ID_RET)) != 0)
+ {
+ count += 4;
+ }
+
+ return count;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_sched_ind_data_unpack(bcmbal_tm_sched_ind_data *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_IND_ID_RET)) != 0)
+ {
+ if (!bcmbal_buf_read_u32(buf, &this->ret))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_sched_ind_data_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present)
+{
+ if ((fields_present & (1ULL << BCMBAL_TM_SCHED_IND_ID_RET)) != 0)
+ {
+ if (!bcmbal_buf_skip(packed, 4))
+ {
+ return BCMOS_FALSE;
+ }
+ }
+
+ return BCMOS_TRUE;
+}
+
+/******************************************************************************/
+bcmos_bool bcmbal_tm_sched_ind_data_bounds_check(const bcmbal_tm_sched_ind_data *this, bcmbal_presence_mask fields_present, bcmbal_tm_sched_ind_id *failed_prop)
+{
+ return BCMOS_TRUE;
+}
+
+bcmos_bool bcmbal_obj_has_tag(bcmbal_obj_id obj, bcmbal_obj_tag tag)
+{
+ switch (obj)
+ {
+ default:
+ return BCMOS_FALSE;
+ }
+}
diff --git a/bal_release/src/lib/libobjmsg/bal_model_funcs.h b/bal_release/src/lib/libobjmsg/bal_model_funcs.h
new file mode 100644
index 0000000..a0f5dd0
--- /dev/null
+++ b/bal_release/src/lib/libobjmsg/bal_model_funcs.h
@@ -0,0 +1,3441 @@
+#ifndef BAL_MODEL_FUNCS
+#define BAL_MODEL_FUNCS
+
+#include "bcmos_system.h"
+#include "bcmos_errno.h"
+#include "bal_buf.h"
+#include "bal_model_ids.h"
+#include "bal_model_types.h"
+
+/** Packs a bcmbal_access_terminal_cfg_id to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_access_terminal_cfg_id_pack(bcmbal_access_terminal_cfg_id this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_access_terminal_cfg_id from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_access_terminal_cfg_id_unpack(bcmbal_access_terminal_cfg_id *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_access_terminal_ind_id to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_access_terminal_ind_id_pack(bcmbal_access_terminal_ind_id this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_access_terminal_ind_id from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_access_terminal_ind_id_unpack(bcmbal_access_terminal_ind_id *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_access_terminal_key_id to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_access_terminal_key_id_pack(bcmbal_access_terminal_key_id this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_access_terminal_key_id from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_access_terminal_key_id_unpack(bcmbal_access_terminal_key_id *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_action_id to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_action_id_pack(bcmbal_action_id this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_action_id from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_action_id_unpack(bcmbal_action_id *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_action_cmd_id to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_action_cmd_id_pack(bcmbal_action_cmd_id this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_action_cmd_id from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_action_cmd_id_unpack(bcmbal_action_cmd_id *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_classifier_id to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_classifier_id_pack(bcmbal_classifier_id this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_classifier_id from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_classifier_id_unpack(bcmbal_classifier_id *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_pkt_tag_type to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_pkt_tag_type_pack(bcmbal_pkt_tag_type this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_pkt_tag_type from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_pkt_tag_type_unpack(bcmbal_pkt_tag_type *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_control to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_control_pack(bcmbal_control this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_control from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_control_unpack(bcmbal_control *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_dest_type to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_dest_type_pack(bcmbal_dest_type this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_dest_type from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_dest_type_unpack(bcmbal_dest_type *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_ds_miss_mode to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_ds_miss_mode_pack(bcmbal_ds_miss_mode this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_ds_miss_mode from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_ds_miss_mode_unpack(bcmbal_ds_miss_mode *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_extra_bw_eligibility_type to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_extra_bw_eligibility_type_pack(bcmbal_extra_bw_eligibility_type this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_extra_bw_eligibility_type from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_extra_bw_eligibility_type_unpack(bcmbal_extra_bw_eligibility_type *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_flow_cfg_id to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_flow_cfg_id_pack(bcmbal_flow_cfg_id this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_flow_cfg_id from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_flow_cfg_id_unpack(bcmbal_flow_cfg_id *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_flow_ind_id to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_flow_ind_id_pack(bcmbal_flow_ind_id this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_flow_ind_id from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_flow_ind_id_unpack(bcmbal_flow_ind_id *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_flow_key_id to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_flow_key_id_pack(bcmbal_flow_key_id this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_flow_key_id from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_flow_key_id_unpack(bcmbal_flow_key_id *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_flow_stat_id to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_flow_stat_id_pack(bcmbal_flow_stat_id this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_flow_stat_id from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_flow_stat_id_unpack(bcmbal_flow_stat_id *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_flow_type to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_flow_type_pack(bcmbal_flow_type this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_flow_type from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_flow_type_unpack(bcmbal_flow_type *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_group_cfg_id to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_group_cfg_id_pack(bcmbal_group_cfg_id this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_group_cfg_id from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_group_cfg_id_unpack(bcmbal_group_cfg_id *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_group_key_id to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_group_key_id_pack(bcmbal_group_key_id this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_group_key_id from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_group_key_id_unpack(bcmbal_group_key_id *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_group_member_cmd to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_group_member_cmd_pack(bcmbal_group_member_cmd this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_group_member_cmd from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_group_member_cmd_unpack(bcmbal_group_member_cmd *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_group_owner to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_group_owner_pack(bcmbal_group_owner this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_group_owner from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_group_owner_unpack(bcmbal_group_owner *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_interface_cfg_id to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_interface_cfg_id_pack(bcmbal_interface_cfg_id this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_interface_cfg_id from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_interface_cfg_id_unpack(bcmbal_interface_cfg_id *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_interface_ind_id to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_interface_ind_id_pack(bcmbal_interface_ind_id this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_interface_ind_id from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_interface_ind_id_unpack(bcmbal_interface_ind_id *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_interface_key_id to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_interface_key_id_pack(bcmbal_interface_key_id this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_interface_key_id from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_interface_key_id_unpack(bcmbal_interface_key_id *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_interface_stat_id to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_interface_stat_id_pack(bcmbal_interface_stat_id this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_interface_stat_id from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_interface_stat_id_unpack(bcmbal_interface_stat_id *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_intf_type to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_intf_type_pack(bcmbal_intf_type this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_intf_type from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_intf_type_unpack(bcmbal_intf_type *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_iwf_mode to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_iwf_mode_pack(bcmbal_iwf_mode this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_iwf_mode from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_iwf_mode_unpack(bcmbal_iwf_mode *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_packet_cfg_id to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_packet_cfg_id_pack(bcmbal_packet_cfg_id this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_packet_cfg_id from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_packet_cfg_id_unpack(bcmbal_packet_cfg_id *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_packet_ind_id to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_packet_ind_id_pack(bcmbal_packet_ind_id this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_packet_ind_id from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_packet_ind_id_unpack(bcmbal_packet_ind_id *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_packet_key_id to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_packet_key_id_pack(bcmbal_packet_key_id this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_packet_key_id from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_packet_key_id_unpack(bcmbal_packet_key_id *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_sla_id to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_sla_id_pack(bcmbal_sla_id this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_sla_id from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_sla_id_unpack(bcmbal_sla_id *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_state to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_state_pack(bcmbal_state this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_state from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_state_unpack(bcmbal_state *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_status to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_status_pack(bcmbal_status this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_status from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_status_unpack(bcmbal_status *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_subscriber_terminal_cfg_id to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_subscriber_terminal_cfg_id_pack(bcmbal_subscriber_terminal_cfg_id this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_subscriber_terminal_cfg_id from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_subscriber_terminal_cfg_id_unpack(bcmbal_subscriber_terminal_cfg_id *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_subscriber_terminal_ind_id to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_subscriber_terminal_ind_id_pack(bcmbal_subscriber_terminal_ind_id this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_subscriber_terminal_ind_id from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_subscriber_terminal_ind_id_unpack(bcmbal_subscriber_terminal_ind_id *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_subscriber_terminal_key_id to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_subscriber_terminal_key_id_pack(bcmbal_subscriber_terminal_key_id this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_subscriber_terminal_key_id from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_subscriber_terminal_key_id_unpack(bcmbal_subscriber_terminal_key_id *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_subscriber_terminal_stat_id to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_subscriber_terminal_stat_id_pack(bcmbal_subscriber_terminal_stat_id this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_subscriber_terminal_stat_id from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_subscriber_terminal_stat_id_unpack(bcmbal_subscriber_terminal_stat_id *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_tm_bac_type to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_tm_bac_type_pack(bcmbal_tm_bac_type this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_tm_bac_type from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_tm_bac_type_unpack(bcmbal_tm_bac_type *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_tm_creation_mode to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_tm_creation_mode_pack(bcmbal_tm_creation_mode this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_tm_creation_mode from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_tm_creation_mode_unpack(bcmbal_tm_creation_mode *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_tm_queue_cfg_id to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_tm_queue_cfg_id_pack(bcmbal_tm_queue_cfg_id this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_tm_queue_cfg_id from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_tm_queue_cfg_id_unpack(bcmbal_tm_queue_cfg_id *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_tm_queue_ind_id to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_tm_queue_ind_id_pack(bcmbal_tm_queue_ind_id this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_tm_queue_ind_id from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_tm_queue_ind_id_unpack(bcmbal_tm_queue_ind_id *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_tm_queue_key_id to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_tm_queue_key_id_pack(bcmbal_tm_queue_key_id this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_tm_queue_key_id from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_tm_queue_key_id_unpack(bcmbal_tm_queue_key_id *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_tm_queue_stat_id to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_tm_queue_stat_id_pack(bcmbal_tm_queue_stat_id this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_tm_queue_stat_id from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_tm_queue_stat_id_unpack(bcmbal_tm_queue_stat_id *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_tm_sched_cfg_id to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_tm_sched_cfg_id_pack(bcmbal_tm_sched_cfg_id this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_tm_sched_cfg_id from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_tm_sched_cfg_id_unpack(bcmbal_tm_sched_cfg_id *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_tm_sched_child_type to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_tm_sched_child_type_pack(bcmbal_tm_sched_child_type this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_tm_sched_child_type from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_tm_sched_child_type_unpack(bcmbal_tm_sched_child_type *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_tm_sched_dir to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_tm_sched_dir_pack(bcmbal_tm_sched_dir this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_tm_sched_dir from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_tm_sched_dir_unpack(bcmbal_tm_sched_dir *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_tm_sched_ind_id to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_tm_sched_ind_id_pack(bcmbal_tm_sched_ind_id this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_tm_sched_ind_id from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_tm_sched_ind_id_unpack(bcmbal_tm_sched_ind_id *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_tm_sched_key_id to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_tm_sched_key_id_pack(bcmbal_tm_sched_key_id this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_tm_sched_key_id from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_tm_sched_key_id_unpack(bcmbal_tm_sched_key_id *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_tm_sched_owner_type to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_tm_sched_owner_type_pack(bcmbal_tm_sched_owner_type this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_tm_sched_owner_type from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_tm_sched_owner_type_unpack(bcmbal_tm_sched_owner_type *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_tm_sched_owner_agg_port_id to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_tm_sched_owner_agg_port_id_pack(bcmbal_tm_sched_owner_agg_port_id this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_tm_sched_owner_agg_port_id from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_tm_sched_owner_agg_port_id_unpack(bcmbal_tm_sched_owner_agg_port_id *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_tm_sched_parent_id to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_tm_sched_parent_id_pack(bcmbal_tm_sched_parent_id this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_tm_sched_parent_id from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_tm_sched_parent_id_unpack(bcmbal_tm_sched_parent_id *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_tm_sched_type to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_tm_sched_type_pack(bcmbal_tm_sched_type this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_tm_sched_type from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_tm_sched_type_unpack(bcmbal_tm_sched_type *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_tm_shaping_id to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_tm_shaping_id_pack(bcmbal_tm_shaping_id this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_tm_shaping_id from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_tm_shaping_id_unpack(bcmbal_tm_shaping_id *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_tm_tcont_sla_id to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_tm_tcont_sla_id_pack(bcmbal_tm_tcont_sla_id this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_tm_tcont_sla_id from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_tm_tcont_sla_id_unpack(bcmbal_tm_tcont_sla_id *this, bcmbal_buf *buf);
+
+/** Packs a bcmbal_trx_type to bytes
+ *
+ * \param this The enumeration to pack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the pack was successful
+ */
+bcmos_bool bcmbal_trx_type_pack(bcmbal_trx_type this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_trx_type from bytes
+ *
+ * \param this Pointer to the enumeration to unpack
+ * \param buf Pointer to the buffer to write to
+ * \return Whether or not the unpack was successful
+ */
+bcmos_bool bcmbal_trx_type_unpack(bcmbal_trx_type *this, bcmbal_buf *buf);
+
+/** Initializes a bcmbal_action struct. This sets all fields to default values.
+ *
+ * \param this Pointer to the structure
+ */
+void bcmbal_action_set_default(bcmbal_action *this);
+
+/** Packs a bcmbal_action to bytes
+ *
+ * \param this Pointer to the object to pack
+ * \param buf Pointer to the buffer to write to
+ * \return TRUE if the pack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_action_pack(const bcmbal_action *this, bcmbal_buf *buf);
+
+/** Gets the number of bytes that a bcmbal_action would occupy on the wire
+ *
+ * \return The structure size in bytes
+ */
+uint32_t bcmbal_action_get_packed_length(const bcmbal_action *this);
+
+/** Unpacks a bcmbal_action from bytes
+ *
+ * \param this Pointer to the object to unpack
+ * \param buf Pointer to the buffer to read from
+ * \param extra_mem Pointer to the first location in memory to use to store
+ * pointer fields that are NULL. Setting this to NULL will cause an error when
+ * a NULL pointer is encountered.
+ * \return TRUE if the unpack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_action_unpack(bcmbal_action *this, bcmbal_buf *buf, void **extra_mem);
+
+/** Scans past a packed bcmbal_action struct and collects memory requirements
+ * above and beyond sizeof()
+ *
+ * \param packed A stream pointing to the packed byte stream
+ * \param extra_mem Number of additional storage bytes required
+ * \return TRUE on success, FALSE on failure
+ */
+bcmos_bool bcmbal_action_scan(bcmbal_buf *packed, uint32_t *extra_mem);
+
+/** Checks if any field in the bcmbal_action is out of bounds
+ *
+ * \return TRUE if all fields are in the correct range, FALSE otherwise
+ */
+bcmos_bool bcmbal_action_bounds_check(const bcmbal_action *this);
+
+/** Initializes a bcmbal_aggregation_port_id_list_u8 struct. This sets all
+ * fields to default values.
+ *
+ * \param this Pointer to the structure
+ */
+void bcmbal_aggregation_port_id_list_u8_set_default(bcmbal_aggregation_port_id_list_u8 *this);
+
+/** Packs a bcmbal_aggregation_port_id_list_u8 to bytes
+ *
+ * \param this Pointer to the object to pack
+ * \param buf Pointer to the buffer to write to
+ * \return TRUE if the pack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_aggregation_port_id_list_u8_pack(const bcmbal_aggregation_port_id_list_u8 *this, bcmbal_buf *buf);
+
+/** Gets the number of bytes that a bcmbal_aggregation_port_id_list_u8 would
+ * occupy on the wire
+ *
+ * \return The structure size in bytes
+ */
+uint32_t bcmbal_aggregation_port_id_list_u8_get_packed_length(const bcmbal_aggregation_port_id_list_u8 *this);
+
+/** Unpacks a bcmbal_aggregation_port_id_list_u8 from bytes
+ *
+ * \param this Pointer to the object to unpack
+ * \param buf Pointer to the buffer to read from
+ * \param extra_mem Pointer to the first location in memory to use to store
+ * pointer fields that are NULL. Setting this to NULL will cause an error when
+ * a NULL pointer is encountered.
+ * \return TRUE if the unpack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_aggregation_port_id_list_u8_unpack(bcmbal_aggregation_port_id_list_u8 *this, bcmbal_buf *buf, void **extra_mem);
+
+/** Scans past a packed bcmbal_aggregation_port_id_list_u8 struct and collects
+ * memory requirements above and beyond sizeof()
+ *
+ * \param packed A stream pointing to the packed byte stream
+ * \param extra_mem Number of additional storage bytes required
+ * \return TRUE on success, FALSE on failure
+ */
+bcmos_bool bcmbal_aggregation_port_id_list_u8_scan(bcmbal_buf *packed, uint32_t *extra_mem);
+
+/** Checks if any field in the bcmbal_aggregation_port_id_list_u8 is out of
+ * bounds
+ *
+ * \return TRUE if all fields are in the correct range, FALSE otherwise
+ */
+bcmos_bool bcmbal_aggregation_port_id_list_u8_bounds_check(const bcmbal_aggregation_port_id_list_u8 *this);
+
+/** Initializes a bcmbal_classifier struct. This sets all fields to default
+ * values.
+ *
+ * \param this Pointer to the structure
+ */
+void bcmbal_classifier_set_default(bcmbal_classifier *this);
+
+/** Packs a bcmbal_classifier to bytes
+ *
+ * \param this Pointer to the object to pack
+ * \param buf Pointer to the buffer to write to
+ * \return TRUE if the pack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_classifier_pack(const bcmbal_classifier *this, bcmbal_buf *buf);
+
+/** Gets the number of bytes that a bcmbal_classifier would occupy on the wire
+ *
+ * \return The structure size in bytes
+ */
+uint32_t bcmbal_classifier_get_packed_length(const bcmbal_classifier *this);
+
+/** Unpacks a bcmbal_classifier from bytes
+ *
+ * \param this Pointer to the object to unpack
+ * \param buf Pointer to the buffer to read from
+ * \param extra_mem Pointer to the first location in memory to use to store
+ * pointer fields that are NULL. Setting this to NULL will cause an error when
+ * a NULL pointer is encountered.
+ * \return TRUE if the unpack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_classifier_unpack(bcmbal_classifier *this, bcmbal_buf *buf, void **extra_mem);
+
+/** Scans past a packed bcmbal_classifier struct and collects memory
+ * requirements above and beyond sizeof()
+ *
+ * \param packed A stream pointing to the packed byte stream
+ * \param extra_mem Number of additional storage bytes required
+ * \return TRUE on success, FALSE on failure
+ */
+bcmos_bool bcmbal_classifier_scan(bcmbal_buf *packed, uint32_t *extra_mem);
+
+/** Checks if any field in the bcmbal_classifier is out of bounds
+ *
+ * \return TRUE if all fields are in the correct range, FALSE otherwise
+ */
+bcmos_bool bcmbal_classifier_bounds_check(const bcmbal_classifier *this);
+
+/** Initializes a bcmbal_dest struct. This sets all fields to default values.
+ *
+ * \param this Pointer to the structure
+ */
+void bcmbal_dest_set_default(bcmbal_dest *this);
+
+/** Packs a bcmbal_dest to bytes
+ *
+ * \param this Pointer to the object to pack
+ * \param buf Pointer to the buffer to write to
+ * \return TRUE if the pack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_dest_pack(const bcmbal_dest *this, bcmbal_buf *buf);
+
+/** Gets the number of bytes that a bcmbal_dest would occupy on the wire
+ *
+ * \return The structure size in bytes
+ */
+uint32_t bcmbal_dest_get_packed_length(const bcmbal_dest *this);
+
+/** Unpacks a bcmbal_dest from bytes
+ *
+ * \param this Pointer to the object to unpack
+ * \param buf Pointer to the buffer to read from
+ * \param extra_mem Pointer to the first location in memory to use to store
+ * pointer fields that are NULL. Setting this to NULL will cause an error when
+ * a NULL pointer is encountered.
+ * \return TRUE if the unpack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_dest_unpack(bcmbal_dest *this, bcmbal_buf *buf, void **extra_mem);
+
+/** Scans past a packed bcmbal_dest struct and collects memory requirements
+ * above and beyond sizeof()
+ *
+ * \param packed A stream pointing to the packed byte stream
+ * \param extra_mem Number of additional storage bytes required
+ * \return TRUE on success, FALSE on failure
+ */
+bcmos_bool bcmbal_dest_scan(bcmbal_buf *packed, uint32_t *extra_mem);
+
+/** Checks if any field in the bcmbal_dest is out of bounds
+ *
+ * \return TRUE if all fields are in the correct range, FALSE otherwise
+ */
+bcmos_bool bcmbal_dest_bounds_check(const bcmbal_dest *this);
+
+/** Initializes a bcmbal_flow_id_list_u32 struct. This sets all fields to
+ * default values.
+ *
+ * \param this Pointer to the structure
+ */
+void bcmbal_flow_id_list_u32_set_default(bcmbal_flow_id_list_u32 *this);
+
+/** Packs a bcmbal_flow_id_list_u32 to bytes
+ *
+ * \param this Pointer to the object to pack
+ * \param buf Pointer to the buffer to write to
+ * \return TRUE if the pack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_flow_id_list_u32_pack(const bcmbal_flow_id_list_u32 *this, bcmbal_buf *buf);
+
+/** Gets the number of bytes that a bcmbal_flow_id_list_u32 would occupy on the
+ * wire
+ *
+ * \return The structure size in bytes
+ */
+uint32_t bcmbal_flow_id_list_u32_get_packed_length(const bcmbal_flow_id_list_u32 *this);
+
+/** Unpacks a bcmbal_flow_id_list_u32 from bytes
+ *
+ * \param this Pointer to the object to unpack
+ * \param buf Pointer to the buffer to read from
+ * \param extra_mem Pointer to the first location in memory to use to store
+ * pointer fields that are NULL. Setting this to NULL will cause an error when
+ * a NULL pointer is encountered.
+ * \return TRUE if the unpack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_flow_id_list_u32_unpack(bcmbal_flow_id_list_u32 *this, bcmbal_buf *buf, void **extra_mem);
+
+/** Scans past a packed bcmbal_flow_id_list_u32 struct and collects memory
+ * requirements above and beyond sizeof()
+ *
+ * \param packed A stream pointing to the packed byte stream
+ * \param extra_mem Number of additional storage bytes required
+ * \return TRUE on success, FALSE on failure
+ */
+bcmos_bool bcmbal_flow_id_list_u32_scan(bcmbal_buf *packed, uint32_t *extra_mem);
+
+/** Checks if any field in the bcmbal_flow_id_list_u32 is out of bounds
+ *
+ * \return TRUE if all fields are in the correct range, FALSE otherwise
+ */
+bcmos_bool bcmbal_flow_id_list_u32_bounds_check(const bcmbal_flow_id_list_u32 *this);
+
+/** Initializes a bcmbal_tm_queue_ref struct. This sets all fields to default
+ * values.
+ *
+ * \param this Pointer to the structure
+ */
+void bcmbal_tm_queue_ref_set_default(bcmbal_tm_queue_ref *this);
+
+/** Packs a bcmbal_tm_queue_ref to bytes
+ *
+ * \param this Pointer to the object to pack
+ * \param buf Pointer to the buffer to write to
+ * \return TRUE if the pack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_tm_queue_ref_pack(const bcmbal_tm_queue_ref *this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_tm_queue_ref from bytes
+ *
+ * \param this Pointer to the object to unpack
+ * \param buf Pointer to the buffer to read from
+ * \param extra_mem Pointer to the first location in memory to use to store
+ * pointer fields that are NULL. Setting this to NULL will cause an error when
+ * a NULL pointer is encountered.
+ * \return TRUE if the unpack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_tm_queue_ref_unpack(bcmbal_tm_queue_ref *this, bcmbal_buf *buf, void **extra_mem);
+
+/** Scans past a packed bcmbal_tm_queue_ref struct and collects memory
+ * requirements above and beyond sizeof()
+ *
+ * \param packed A stream pointing to the packed byte stream
+ * \param extra_mem Number of additional storage bytes required
+ * \return TRUE on success, FALSE on failure
+ */
+bcmos_bool bcmbal_tm_queue_ref_scan(bcmbal_buf *packed, uint32_t *extra_mem);
+
+/** Checks if any field in the bcmbal_tm_queue_ref is out of bounds
+ *
+ * \return TRUE if all fields are in the correct range, FALSE otherwise
+ */
+bcmos_bool bcmbal_tm_queue_ref_bounds_check(const bcmbal_tm_queue_ref *this);
+
+/** Initializes a bcmbal_group_member_info struct. This sets all fields to
+ * default values.
+ *
+ * \param this Pointer to the structure
+ */
+void bcmbal_group_member_info_set_default(bcmbal_group_member_info *this);
+
+/** Packs a bcmbal_group_member_info to bytes
+ *
+ * \param this Pointer to the object to pack
+ * \param buf Pointer to the buffer to write to
+ * \return TRUE if the pack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_group_member_info_pack(const bcmbal_group_member_info *this, bcmbal_buf *buf);
+
+/** Gets the number of bytes that a bcmbal_group_member_info would occupy on the
+ * wire
+ *
+ * \return The structure size in bytes
+ */
+uint32_t bcmbal_group_member_info_get_packed_length(const bcmbal_group_member_info *this);
+
+/** Unpacks a bcmbal_group_member_info from bytes
+ *
+ * \param this Pointer to the object to unpack
+ * \param buf Pointer to the buffer to read from
+ * \param extra_mem Pointer to the first location in memory to use to store
+ * pointer fields that are NULL. Setting this to NULL will cause an error when
+ * a NULL pointer is encountered.
+ * \return TRUE if the unpack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_group_member_info_unpack(bcmbal_group_member_info *this, bcmbal_buf *buf, void **extra_mem);
+
+/** Scans past a packed bcmbal_group_member_info struct and collects memory
+ * requirements above and beyond sizeof()
+ *
+ * \param packed A stream pointing to the packed byte stream
+ * \param extra_mem Number of additional storage bytes required
+ * \return TRUE on success, FALSE on failure
+ */
+bcmos_bool bcmbal_group_member_info_scan(bcmbal_buf *packed, uint32_t *extra_mem);
+
+/** Checks if any field in the bcmbal_group_member_info is out of bounds
+ *
+ * \return TRUE if all fields are in the correct range, FALSE otherwise
+ */
+bcmos_bool bcmbal_group_member_info_bounds_check(const bcmbal_group_member_info *this);
+
+/** Initializes a bcmbal_group_member_info_list_u16 struct. This sets all
+ * fields to default values.
+ *
+ * \param this Pointer to the structure
+ */
+void bcmbal_group_member_info_list_u16_set_default(bcmbal_group_member_info_list_u16 *this);
+
+/** Packs a bcmbal_group_member_info_list_u16 to bytes
+ *
+ * \param this Pointer to the object to pack
+ * \param buf Pointer to the buffer to write to
+ * \return TRUE if the pack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_group_member_info_list_u16_pack(const bcmbal_group_member_info_list_u16 *this, bcmbal_buf *buf);
+
+/** Gets the number of bytes that a bcmbal_group_member_info_list_u16 would
+ * occupy on the wire
+ *
+ * \return The structure size in bytes
+ */
+uint32_t bcmbal_group_member_info_list_u16_get_packed_length(const bcmbal_group_member_info_list_u16 *this);
+
+/** Unpacks a bcmbal_group_member_info_list_u16 from bytes
+ *
+ * \param this Pointer to the object to unpack
+ * \param buf Pointer to the buffer to read from
+ * \param extra_mem Pointer to the first location in memory to use to store
+ * pointer fields that are NULL. Setting this to NULL will cause an error when
+ * a NULL pointer is encountered.
+ * \return TRUE if the unpack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_group_member_info_list_u16_unpack(bcmbal_group_member_info_list_u16 *this, bcmbal_buf *buf, void **extra_mem);
+
+/** Scans past a packed bcmbal_group_member_info_list_u16 struct and collects
+ * memory requirements above and beyond sizeof()
+ *
+ * \param packed A stream pointing to the packed byte stream
+ * \param extra_mem Number of additional storage bytes required
+ * \return TRUE on success, FALSE on failure
+ */
+bcmos_bool bcmbal_group_member_info_list_u16_scan(bcmbal_buf *packed, uint32_t *extra_mem);
+
+/** Checks if any field in the bcmbal_group_member_info_list_u16 is out of
+ * bounds
+ *
+ * \return TRUE if all fields are in the correct range, FALSE otherwise
+ */
+bcmos_bool bcmbal_group_member_info_list_u16_bounds_check(const bcmbal_group_member_info_list_u16 *this);
+
+/** Initializes a bcmbal_password struct. This sets all fields to default
+ * values.
+ *
+ * \param this Pointer to the structure
+ */
+void bcmbal_password_set_default(bcmbal_password *this);
+
+/** Packs a bcmbal_password to bytes
+ *
+ * \param this Pointer to the object to pack
+ * \param buf Pointer to the buffer to write to
+ * \return TRUE if the pack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_password_pack(const bcmbal_password *this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_password from bytes
+ *
+ * \param this Pointer to the object to unpack
+ * \param buf Pointer to the buffer to read from
+ * \param extra_mem Pointer to the first location in memory to use to store
+ * pointer fields that are NULL. Setting this to NULL will cause an error when
+ * a NULL pointer is encountered.
+ * \return TRUE if the unpack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_password_unpack(bcmbal_password *this, bcmbal_buf *buf, void **extra_mem);
+
+/** Scans past a packed bcmbal_password struct and collects memory requirements
+ * above and beyond sizeof()
+ *
+ * \param packed A stream pointing to the packed byte stream
+ * \param extra_mem Number of additional storage bytes required
+ * \return TRUE on success, FALSE on failure
+ */
+bcmos_bool bcmbal_password_scan(bcmbal_buf *packed, uint32_t *extra_mem);
+
+/** Checks if any field in the bcmbal_password is out of bounds
+ *
+ * \return TRUE if all fields are in the correct range, FALSE otherwise
+ */
+bcmos_bool bcmbal_password_bounds_check(const bcmbal_password *this);
+
+/** Initializes a bcmbal_registration_id struct. This sets all fields to
+ * default values.
+ *
+ * \param this Pointer to the structure
+ */
+void bcmbal_registration_id_set_default(bcmbal_registration_id *this);
+
+/** Packs a bcmbal_registration_id to bytes
+ *
+ * \param this Pointer to the object to pack
+ * \param buf Pointer to the buffer to write to
+ * \return TRUE if the pack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_registration_id_pack(const bcmbal_registration_id *this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_registration_id from bytes
+ *
+ * \param this Pointer to the object to unpack
+ * \param buf Pointer to the buffer to read from
+ * \param extra_mem Pointer to the first location in memory to use to store
+ * pointer fields that are NULL. Setting this to NULL will cause an error when
+ * a NULL pointer is encountered.
+ * \return TRUE if the unpack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_registration_id_unpack(bcmbal_registration_id *this, bcmbal_buf *buf, void **extra_mem);
+
+/** Scans past a packed bcmbal_registration_id struct and collects memory
+ * requirements above and beyond sizeof()
+ *
+ * \param packed A stream pointing to the packed byte stream
+ * \param extra_mem Number of additional storage bytes required
+ * \return TRUE on success, FALSE on failure
+ */
+bcmos_bool bcmbal_registration_id_scan(bcmbal_buf *packed, uint32_t *extra_mem);
+
+/** Checks if any field in the bcmbal_registration_id is out of bounds
+ *
+ * \return TRUE if all fields are in the correct range, FALSE otherwise
+ */
+bcmos_bool bcmbal_registration_id_bounds_check(const bcmbal_registration_id *this);
+
+/** Initializes a bcmbal_serial_number struct. This sets all fields to default
+ * values.
+ *
+ * \param this Pointer to the structure
+ */
+void bcmbal_serial_number_set_default(bcmbal_serial_number *this);
+
+/** Packs a bcmbal_serial_number to bytes
+ *
+ * \param this Pointer to the object to pack
+ * \param buf Pointer to the buffer to write to
+ * \return TRUE if the pack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_serial_number_pack(const bcmbal_serial_number *this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_serial_number from bytes
+ *
+ * \param this Pointer to the object to unpack
+ * \param buf Pointer to the buffer to read from
+ * \param extra_mem Pointer to the first location in memory to use to store
+ * pointer fields that are NULL. Setting this to NULL will cause an error when
+ * a NULL pointer is encountered.
+ * \return TRUE if the unpack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_serial_number_unpack(bcmbal_serial_number *this, bcmbal_buf *buf, void **extra_mem);
+
+/** Scans past a packed bcmbal_serial_number struct and collects memory
+ * requirements above and beyond sizeof()
+ *
+ * \param packed A stream pointing to the packed byte stream
+ * \param extra_mem Number of additional storage bytes required
+ * \return TRUE on success, FALSE on failure
+ */
+bcmos_bool bcmbal_serial_number_scan(bcmbal_buf *packed, uint32_t *extra_mem);
+
+/** Checks if any field in the bcmbal_serial_number is out of bounds
+ *
+ * \return TRUE if all fields are in the correct range, FALSE otherwise
+ */
+bcmos_bool bcmbal_serial_number_bounds_check(const bcmbal_serial_number *this);
+
+/** Initializes a bcmbal_service_port_id_list_u8 struct. This sets all fields
+ * to default values.
+ *
+ * \param this Pointer to the structure
+ */
+void bcmbal_service_port_id_list_u8_set_default(bcmbal_service_port_id_list_u8 *this);
+
+/** Packs a bcmbal_service_port_id_list_u8 to bytes
+ *
+ * \param this Pointer to the object to pack
+ * \param buf Pointer to the buffer to write to
+ * \return TRUE if the pack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_service_port_id_list_u8_pack(const bcmbal_service_port_id_list_u8 *this, bcmbal_buf *buf);
+
+/** Gets the number of bytes that a bcmbal_service_port_id_list_u8 would occupy
+ * on the wire
+ *
+ * \return The structure size in bytes
+ */
+uint32_t bcmbal_service_port_id_list_u8_get_packed_length(const bcmbal_service_port_id_list_u8 *this);
+
+/** Unpacks a bcmbal_service_port_id_list_u8 from bytes
+ *
+ * \param this Pointer to the object to unpack
+ * \param buf Pointer to the buffer to read from
+ * \param extra_mem Pointer to the first location in memory to use to store
+ * pointer fields that are NULL. Setting this to NULL will cause an error when
+ * a NULL pointer is encountered.
+ * \return TRUE if the unpack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_service_port_id_list_u8_unpack(bcmbal_service_port_id_list_u8 *this, bcmbal_buf *buf, void **extra_mem);
+
+/** Scans past a packed bcmbal_service_port_id_list_u8 struct and collects
+ * memory requirements above and beyond sizeof()
+ *
+ * \param packed A stream pointing to the packed byte stream
+ * \param extra_mem Number of additional storage bytes required
+ * \return TRUE on success, FALSE on failure
+ */
+bcmos_bool bcmbal_service_port_id_list_u8_scan(bcmbal_buf *packed, uint32_t *extra_mem);
+
+/** Checks if any field in the bcmbal_service_port_id_list_u8 is out of bounds
+ *
+ * \return TRUE if all fields are in the correct range, FALSE otherwise
+ */
+bcmos_bool bcmbal_service_port_id_list_u8_bounds_check(const bcmbal_service_port_id_list_u8 *this);
+
+/** Initializes a bcmbal_sla struct. This sets all fields to default values.
+ *
+ * \param this Pointer to the structure
+ */
+void bcmbal_sla_set_default(bcmbal_sla *this);
+
+/** Packs a bcmbal_sla to bytes
+ *
+ * \param this Pointer to the object to pack
+ * \param buf Pointer to the buffer to write to
+ * \return TRUE if the pack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_sla_pack(const bcmbal_sla *this, bcmbal_buf *buf);
+
+/** Gets the number of bytes that a bcmbal_sla would occupy on the wire
+ *
+ * \return The structure size in bytes
+ */
+uint32_t bcmbal_sla_get_packed_length(const bcmbal_sla *this);
+
+/** Unpacks a bcmbal_sla from bytes
+ *
+ * \param this Pointer to the object to unpack
+ * \param buf Pointer to the buffer to read from
+ * \param extra_mem Pointer to the first location in memory to use to store
+ * pointer fields that are NULL. Setting this to NULL will cause an error when
+ * a NULL pointer is encountered.
+ * \return TRUE if the unpack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_sla_unpack(bcmbal_sla *this, bcmbal_buf *buf, void **extra_mem);
+
+/** Scans past a packed bcmbal_sla struct and collects memory requirements above
+ * and beyond sizeof()
+ *
+ * \param packed A stream pointing to the packed byte stream
+ * \param extra_mem Number of additional storage bytes required
+ * \return TRUE on success, FALSE on failure
+ */
+bcmos_bool bcmbal_sla_scan(bcmbal_buf *packed, uint32_t *extra_mem);
+
+/** Checks if any field in the bcmbal_sla is out of bounds
+ *
+ * \return TRUE if all fields are in the correct range, FALSE otherwise
+ */
+bcmos_bool bcmbal_sla_bounds_check(const bcmbal_sla *this);
+
+/** Initializes a bcmbal_sub_id_list_u16 struct. This sets all fields to
+ * default values.
+ *
+ * \param this Pointer to the structure
+ */
+void bcmbal_sub_id_list_u16_set_default(bcmbal_sub_id_list_u16 *this);
+
+/** Packs a bcmbal_sub_id_list_u16 to bytes
+ *
+ * \param this Pointer to the object to pack
+ * \param buf Pointer to the buffer to write to
+ * \return TRUE if the pack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_sub_id_list_u16_pack(const bcmbal_sub_id_list_u16 *this, bcmbal_buf *buf);
+
+/** Gets the number of bytes that a bcmbal_sub_id_list_u16 would occupy on the
+ * wire
+ *
+ * \return The structure size in bytes
+ */
+uint32_t bcmbal_sub_id_list_u16_get_packed_length(const bcmbal_sub_id_list_u16 *this);
+
+/** Unpacks a bcmbal_sub_id_list_u16 from bytes
+ *
+ * \param this Pointer to the object to unpack
+ * \param buf Pointer to the buffer to read from
+ * \param extra_mem Pointer to the first location in memory to use to store
+ * pointer fields that are NULL. Setting this to NULL will cause an error when
+ * a NULL pointer is encountered.
+ * \return TRUE if the unpack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_sub_id_list_u16_unpack(bcmbal_sub_id_list_u16 *this, bcmbal_buf *buf, void **extra_mem);
+
+/** Scans past a packed bcmbal_sub_id_list_u16 struct and collects memory
+ * requirements above and beyond sizeof()
+ *
+ * \param packed A stream pointing to the packed byte stream
+ * \param extra_mem Number of additional storage bytes required
+ * \return TRUE on success, FALSE on failure
+ */
+bcmos_bool bcmbal_sub_id_list_u16_scan(bcmbal_buf *packed, uint32_t *extra_mem);
+
+/** Checks if any field in the bcmbal_sub_id_list_u16 is out of bounds
+ *
+ * \return TRUE if all fields are in the correct range, FALSE otherwise
+ */
+bcmos_bool bcmbal_sub_id_list_u16_bounds_check(const bcmbal_sub_id_list_u16 *this);
+
+/** Initializes a bcmbal_tm_red struct. This sets all fields to default values.
+ *
+ * \param this Pointer to the structure
+ */
+void bcmbal_tm_red_set_default(bcmbal_tm_red *this);
+
+/** Packs a bcmbal_tm_red to bytes
+ *
+ * \param this Pointer to the object to pack
+ * \param buf Pointer to the buffer to write to
+ * \return TRUE if the pack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_tm_red_pack(const bcmbal_tm_red *this, bcmbal_buf *buf);
+
+/** Unpacks a bcmbal_tm_red from bytes
+ *
+ * \param this Pointer to the object to unpack
+ * \param buf Pointer to the buffer to read from
+ * \param extra_mem Pointer to the first location in memory to use to store
+ * pointer fields that are NULL. Setting this to NULL will cause an error when
+ * a NULL pointer is encountered.
+ * \return TRUE if the unpack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_tm_red_unpack(bcmbal_tm_red *this, bcmbal_buf *buf, void **extra_mem);
+
+/** Scans past a packed bcmbal_tm_red struct and collects memory requirements
+ * above and beyond sizeof()
+ *
+ * \param packed A stream pointing to the packed byte stream
+ * \param extra_mem Number of additional storage bytes required
+ * \return TRUE on success, FALSE on failure
+ */
+bcmos_bool bcmbal_tm_red_scan(bcmbal_buf *packed, uint32_t *extra_mem);
+
+/** Checks if any field in the bcmbal_tm_red is out of bounds
+ *
+ * \return TRUE if all fields are in the correct range, FALSE otherwise
+ */
+bcmos_bool bcmbal_tm_red_bounds_check(const bcmbal_tm_red *this);
+
+/** Initializes a bcmbal_tm_bac struct. This sets all fields to default values.
+ *
+ * \param this Pointer to the structure
+ */
+void bcmbal_tm_bac_set_default(bcmbal_tm_bac *this);
+
+/** Packs a bcmbal_tm_bac to bytes
+ *
+ * \param this Pointer to the object to pack
+ * \param buf Pointer to the buffer to write to
+ * \return TRUE if the pack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_tm_bac_pack(const bcmbal_tm_bac *this, bcmbal_buf *buf);
+
+/** Gets the number of bytes that a bcmbal_tm_bac would occupy on the wire
+ *
+ * \return The structure size in bytes
+ */
+uint32_t bcmbal_tm_bac_get_packed_length(const bcmbal_tm_bac *this);
+
+/** Unpacks a bcmbal_tm_bac from bytes
+ *
+ * \param this Pointer to the object to unpack
+ * \param buf Pointer to the buffer to read from
+ * \param extra_mem Pointer to the first location in memory to use to store
+ * pointer fields that are NULL. Setting this to NULL will cause an error when
+ * a NULL pointer is encountered.
+ * \return TRUE if the unpack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_tm_bac_unpack(bcmbal_tm_bac *this, bcmbal_buf *buf, void **extra_mem);
+
+/** Scans past a packed bcmbal_tm_bac struct and collects memory requirements
+ * above and beyond sizeof()
+ *
+ * \param packed A stream pointing to the packed byte stream
+ * \param extra_mem Number of additional storage bytes required
+ * \return TRUE on success, FALSE on failure
+ */
+bcmos_bool bcmbal_tm_bac_scan(bcmbal_buf *packed, uint32_t *extra_mem);
+
+/** Checks if any field in the bcmbal_tm_bac is out of bounds
+ *
+ * \return TRUE if all fields are in the correct range, FALSE otherwise
+ */
+bcmos_bool bcmbal_tm_bac_bounds_check(const bcmbal_tm_bac *this);
+
+/** Initializes a bcmbal_tm_queue_id_list_u8 struct. This sets all fields to
+ * default values.
+ *
+ * \param this Pointer to the structure
+ */
+void bcmbal_tm_queue_id_list_u8_set_default(bcmbal_tm_queue_id_list_u8 *this);
+
+/** Packs a bcmbal_tm_queue_id_list_u8 to bytes
+ *
+ * \param this Pointer to the object to pack
+ * \param buf Pointer to the buffer to write to
+ * \return TRUE if the pack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_tm_queue_id_list_u8_pack(const bcmbal_tm_queue_id_list_u8 *this, bcmbal_buf *buf);
+
+/** Gets the number of bytes that a bcmbal_tm_queue_id_list_u8 would occupy on
+ * the wire
+ *
+ * \return The structure size in bytes
+ */
+uint32_t bcmbal_tm_queue_id_list_u8_get_packed_length(const bcmbal_tm_queue_id_list_u8 *this);
+
+/** Unpacks a bcmbal_tm_queue_id_list_u8 from bytes
+ *
+ * \param this Pointer to the object to unpack
+ * \param buf Pointer to the buffer to read from
+ * \param extra_mem Pointer to the first location in memory to use to store
+ * pointer fields that are NULL. Setting this to NULL will cause an error when
+ * a NULL pointer is encountered.
+ * \return TRUE if the unpack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_tm_queue_id_list_u8_unpack(bcmbal_tm_queue_id_list_u8 *this, bcmbal_buf *buf, void **extra_mem);
+
+/** Scans past a packed bcmbal_tm_queue_id_list_u8 struct and collects memory
+ * requirements above and beyond sizeof()
+ *
+ * \param packed A stream pointing to the packed byte stream
+ * \param extra_mem Number of additional storage bytes required
+ * \return TRUE on success, FALSE on failure
+ */
+bcmos_bool bcmbal_tm_queue_id_list_u8_scan(bcmbal_buf *packed, uint32_t *extra_mem);
+
+/** Checks if any field in the bcmbal_tm_queue_id_list_u8 is out of bounds
+ *
+ * \return TRUE if all fields are in the correct range, FALSE otherwise
+ */
+bcmos_bool bcmbal_tm_queue_id_list_u8_bounds_check(const bcmbal_tm_queue_id_list_u8 *this);
+
+/** Initializes a bcmbal_tm_sched_id_list_u8 struct. This sets all fields to
+ * default values.
+ *
+ * \param this Pointer to the structure
+ */
+void bcmbal_tm_sched_id_list_u8_set_default(bcmbal_tm_sched_id_list_u8 *this);
+
+/** Packs a bcmbal_tm_sched_id_list_u8 to bytes
+ *
+ * \param this Pointer to the object to pack
+ * \param buf Pointer to the buffer to write to
+ * \return TRUE if the pack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_tm_sched_id_list_u8_pack(const bcmbal_tm_sched_id_list_u8 *this, bcmbal_buf *buf);
+
+/** Gets the number of bytes that a bcmbal_tm_sched_id_list_u8 would occupy on
+ * the wire
+ *
+ * \return The structure size in bytes
+ */
+uint32_t bcmbal_tm_sched_id_list_u8_get_packed_length(const bcmbal_tm_sched_id_list_u8 *this);
+
+/** Unpacks a bcmbal_tm_sched_id_list_u8 from bytes
+ *
+ * \param this Pointer to the object to unpack
+ * \param buf Pointer to the buffer to read from
+ * \param extra_mem Pointer to the first location in memory to use to store
+ * pointer fields that are NULL. Setting this to NULL will cause an error when
+ * a NULL pointer is encountered.
+ * \return TRUE if the unpack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_tm_sched_id_list_u8_unpack(bcmbal_tm_sched_id_list_u8 *this, bcmbal_buf *buf, void **extra_mem);
+
+/** Scans past a packed bcmbal_tm_sched_id_list_u8 struct and collects memory
+ * requirements above and beyond sizeof()
+ *
+ * \param packed A stream pointing to the packed byte stream
+ * \param extra_mem Number of additional storage bytes required
+ * \return TRUE on success, FALSE on failure
+ */
+bcmos_bool bcmbal_tm_sched_id_list_u8_scan(bcmbal_buf *packed, uint32_t *extra_mem);
+
+/** Checks if any field in the bcmbal_tm_sched_id_list_u8 is out of bounds
+ *
+ * \return TRUE if all fields are in the correct range, FALSE otherwise
+ */
+bcmos_bool bcmbal_tm_sched_id_list_u8_bounds_check(const bcmbal_tm_sched_id_list_u8 *this);
+
+/** Initializes a bcmbal_tm_sched_owner struct. This sets all fields to default
+ * values.
+ *
+ * \param this Pointer to the structure
+ */
+void bcmbal_tm_sched_owner_set_default(bcmbal_tm_sched_owner *this);
+
+/** Packs a bcmbal_tm_sched_owner to bytes
+ *
+ * \param this Pointer to the object to pack
+ * \param buf Pointer to the buffer to write to
+ * \return TRUE if the pack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_tm_sched_owner_pack(const bcmbal_tm_sched_owner *this, bcmbal_buf *buf);
+
+/** Gets the number of bytes that a bcmbal_tm_sched_owner would occupy on the
+ * wire
+ *
+ * \return The structure size in bytes
+ */
+uint32_t bcmbal_tm_sched_owner_get_packed_length(const bcmbal_tm_sched_owner *this);
+
+/** Unpacks a bcmbal_tm_sched_owner from bytes
+ *
+ * \param this Pointer to the object to unpack
+ * \param buf Pointer to the buffer to read from
+ * \param extra_mem Pointer to the first location in memory to use to store
+ * pointer fields that are NULL. Setting this to NULL will cause an error when
+ * a NULL pointer is encountered.
+ * \return TRUE if the unpack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_tm_sched_owner_unpack(bcmbal_tm_sched_owner *this, bcmbal_buf *buf, void **extra_mem);
+
+/** Scans past a packed bcmbal_tm_sched_owner struct and collects memory
+ * requirements above and beyond sizeof()
+ *
+ * \param packed A stream pointing to the packed byte stream
+ * \param extra_mem Number of additional storage bytes required
+ * \return TRUE on success, FALSE on failure
+ */
+bcmos_bool bcmbal_tm_sched_owner_scan(bcmbal_buf *packed, uint32_t *extra_mem);
+
+/** Checks if any field in the bcmbal_tm_sched_owner is out of bounds
+ *
+ * \return TRUE if all fields are in the correct range, FALSE otherwise
+ */
+bcmos_bool bcmbal_tm_sched_owner_bounds_check(const bcmbal_tm_sched_owner *this);
+
+/** Initializes a bcmbal_tm_sched_parent struct. This sets all fields to
+ * default values.
+ *
+ * \param this Pointer to the structure
+ */
+void bcmbal_tm_sched_parent_set_default(bcmbal_tm_sched_parent *this);
+
+/** Packs a bcmbal_tm_sched_parent to bytes
+ *
+ * \param this Pointer to the object to pack
+ * \param buf Pointer to the buffer to write to
+ * \return TRUE if the pack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_tm_sched_parent_pack(const bcmbal_tm_sched_parent *this, bcmbal_buf *buf);
+
+/** Gets the number of bytes that a bcmbal_tm_sched_parent would occupy on the
+ * wire
+ *
+ * \return The structure size in bytes
+ */
+uint32_t bcmbal_tm_sched_parent_get_packed_length(const bcmbal_tm_sched_parent *this);
+
+/** Unpacks a bcmbal_tm_sched_parent from bytes
+ *
+ * \param this Pointer to the object to unpack
+ * \param buf Pointer to the buffer to read from
+ * \param extra_mem Pointer to the first location in memory to use to store
+ * pointer fields that are NULL. Setting this to NULL will cause an error when
+ * a NULL pointer is encountered.
+ * \return TRUE if the unpack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_tm_sched_parent_unpack(bcmbal_tm_sched_parent *this, bcmbal_buf *buf, void **extra_mem);
+
+/** Scans past a packed bcmbal_tm_sched_parent struct and collects memory
+ * requirements above and beyond sizeof()
+ *
+ * \param packed A stream pointing to the packed byte stream
+ * \param extra_mem Number of additional storage bytes required
+ * \return TRUE on success, FALSE on failure
+ */
+bcmos_bool bcmbal_tm_sched_parent_scan(bcmbal_buf *packed, uint32_t *extra_mem);
+
+/** Checks if any field in the bcmbal_tm_sched_parent is out of bounds
+ *
+ * \return TRUE if all fields are in the correct range, FALSE otherwise
+ */
+bcmos_bool bcmbal_tm_sched_parent_bounds_check(const bcmbal_tm_sched_parent *this);
+
+/** Initializes a bcmbal_tm_shaping struct. This sets all fields to default
+ * values.
+ *
+ * \param this Pointer to the structure
+ */
+void bcmbal_tm_shaping_set_default(bcmbal_tm_shaping *this);
+
+/** Packs a bcmbal_tm_shaping to bytes
+ *
+ * \param this Pointer to the object to pack
+ * \param buf Pointer to the buffer to write to
+ * \return TRUE if the pack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_tm_shaping_pack(const bcmbal_tm_shaping *this, bcmbal_buf *buf);
+
+/** Gets the number of bytes that a bcmbal_tm_shaping would occupy on the wire
+ *
+ * \return The structure size in bytes
+ */
+uint32_t bcmbal_tm_shaping_get_packed_length(const bcmbal_tm_shaping *this);
+
+/** Unpacks a bcmbal_tm_shaping from bytes
+ *
+ * \param this Pointer to the object to unpack
+ * \param buf Pointer to the buffer to read from
+ * \param extra_mem Pointer to the first location in memory to use to store
+ * pointer fields that are NULL. Setting this to NULL will cause an error when
+ * a NULL pointer is encountered.
+ * \return TRUE if the unpack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_tm_shaping_unpack(bcmbal_tm_shaping *this, bcmbal_buf *buf, void **extra_mem);
+
+/** Scans past a packed bcmbal_tm_shaping struct and collects memory
+ * requirements above and beyond sizeof()
+ *
+ * \param packed A stream pointing to the packed byte stream
+ * \param extra_mem Number of additional storage bytes required
+ * \return TRUE on success, FALSE on failure
+ */
+bcmos_bool bcmbal_tm_shaping_scan(bcmbal_buf *packed, uint32_t *extra_mem);
+
+/** Checks if any field in the bcmbal_tm_shaping is out of bounds
+ *
+ * \return TRUE if all fields are in the correct range, FALSE otherwise
+ */
+bcmos_bool bcmbal_tm_shaping_bounds_check(const bcmbal_tm_shaping *this);
+
+/** Initializes a bcmbal_tm_tcont_sla struct. This sets all fields to default
+ * values.
+ *
+ * \param this Pointer to the structure
+ */
+void bcmbal_tm_tcont_sla_set_default(bcmbal_tm_tcont_sla *this);
+
+/** Packs a bcmbal_tm_tcont_sla to bytes
+ *
+ * \param this Pointer to the object to pack
+ * \param buf Pointer to the buffer to write to
+ * \return TRUE if the pack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_tm_tcont_sla_pack(const bcmbal_tm_tcont_sla *this, bcmbal_buf *buf);
+
+/** Gets the number of bytes that a bcmbal_tm_tcont_sla would occupy on the wire
+ *
+ * \return The structure size in bytes
+ */
+uint32_t bcmbal_tm_tcont_sla_get_packed_length(const bcmbal_tm_tcont_sla *this);
+
+/** Unpacks a bcmbal_tm_tcont_sla from bytes
+ *
+ * \param this Pointer to the object to unpack
+ * \param buf Pointer to the buffer to read from
+ * \param extra_mem Pointer to the first location in memory to use to store
+ * pointer fields that are NULL. Setting this to NULL will cause an error when
+ * a NULL pointer is encountered.
+ * \return TRUE if the unpack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_tm_tcont_sla_unpack(bcmbal_tm_tcont_sla *this, bcmbal_buf *buf, void **extra_mem);
+
+/** Scans past a packed bcmbal_tm_tcont_sla struct and collects memory
+ * requirements above and beyond sizeof()
+ *
+ * \param packed A stream pointing to the packed byte stream
+ * \param extra_mem Number of additional storage bytes required
+ * \return TRUE on success, FALSE on failure
+ */
+bcmos_bool bcmbal_tm_tcont_sla_scan(bcmbal_buf *packed, uint32_t *extra_mem);
+
+/** Checks if any field in the bcmbal_tm_tcont_sla is out of bounds
+ *
+ * \return TRUE if all fields are in the correct range, FALSE otherwise
+ */
+bcmos_bool bcmbal_tm_tcont_sla_bounds_check(const bcmbal_tm_tcont_sla *this);
+
+/** Initializes a bcmbal_u8_list_u32 struct. This sets all fields to default
+ * values.
+ *
+ * \param this Pointer to the structure
+ */
+void bcmbal_u8_list_u32_set_default(bcmbal_u8_list_u32 *this);
+
+/** Packs a bcmbal_u8_list_u32 to bytes
+ *
+ * \param this Pointer to the object to pack
+ * \param buf Pointer to the buffer to write to
+ * \return TRUE if the pack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_u8_list_u32_pack(const bcmbal_u8_list_u32 *this, bcmbal_buf *buf);
+
+/** Gets the number of bytes that a bcmbal_u8_list_u32 would occupy on the wire
+ *
+ * \return The structure size in bytes
+ */
+uint32_t bcmbal_u8_list_u32_get_packed_length(const bcmbal_u8_list_u32 *this);
+
+/** Unpacks a bcmbal_u8_list_u32 from bytes
+ *
+ * \param this Pointer to the object to unpack
+ * \param buf Pointer to the buffer to read from
+ * \param extra_mem Pointer to the first location in memory to use to store
+ * pointer fields that are NULL. Setting this to NULL will cause an error when
+ * a NULL pointer is encountered.
+ * \return TRUE if the unpack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_u8_list_u32_unpack(bcmbal_u8_list_u32 *this, bcmbal_buf *buf, void **extra_mem);
+
+/** Scans past a packed bcmbal_u8_list_u32 struct and collects memory
+ * requirements above and beyond sizeof()
+ *
+ * \param packed A stream pointing to the packed byte stream
+ * \param extra_mem Number of additional storage bytes required
+ * \return TRUE on success, FALSE on failure
+ */
+bcmos_bool bcmbal_u8_list_u32_scan(bcmbal_buf *packed, uint32_t *extra_mem);
+
+/** Checks if any field in the bcmbal_u8_list_u32 is out of bounds
+ *
+ * \return TRUE if all fields are in the correct range, FALSE otherwise
+ */
+bcmos_bool bcmbal_u8_list_u32_bounds_check(const bcmbal_u8_list_u32 *this);
+
+/** Initializes a bcmbal_access_terminal_key struct. This sets all fields to
+ * default values.
+ *
+ * \param this Pointer to the structure
+ * \param fields_present Bitmask of which fields are present in the structure.
+ */
+void bcmbal_access_terminal_key_set_default(bcmbal_access_terminal_key *this, bcmbal_presence_mask fields_present);
+
+/** Packs a bcmbal_access_terminal_key to bytes
+ *
+ * \param this Pointer to the object to pack
+ * \param buf Pointer to the buffer to write to
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the pack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_access_terminal_key_pack(const bcmbal_access_terminal_key *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present);
+
+/** Gets the number of bytes that a bcmbal_access_terminal_key would occupy on
+ * the wire
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return The structure size in bytes
+ */
+uint32_t bcmbal_access_terminal_key_get_packed_length(const bcmbal_access_terminal_key *this, bcmbal_presence_mask fields_present);
+
+/** Unpacks a bcmbal_access_terminal_key from bytes
+ *
+ * \param this Pointer to the object to unpack
+ * \param buf Pointer to the buffer to read from
+ * \param extra_mem Pointer to the first location in memory to use to store
+ * pointer fields that are NULL. Setting this to NULL will cause an error when
+ * a NULL pointer is encountered.
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the unpack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_access_terminal_key_unpack(bcmbal_access_terminal_key *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present);
+
+/** Scans past a packed bcmbal_access_terminal_key struct and collects memory
+ * requirements above and beyond sizeof()
+ *
+ * \param packed A stream pointing to the packed byte stream
+ * \param extra_mem Number of additional storage bytes required
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE on success, FALSE on failure
+ */
+bcmos_bool bcmbal_access_terminal_key_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present);
+
+/** Checks if any field in the bcmbal_access_terminal_key is out of bounds
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \param failed_prop Reference to the property that was out of range (only set
+ * on failure)
+ * \return TRUE if all fields are in the correct range, FALSE otherwise
+ */
+bcmos_bool bcmbal_access_terminal_key_bounds_check(const bcmbal_access_terminal_key *this, bcmbal_presence_mask fields_present, bcmbal_access_terminal_key_id *failed_prop);
+
+/** Initializes a bcmbal_access_terminal_cfg_data struct. This sets all fields
+ * to default values.
+ *
+ * \param this Pointer to the structure
+ * \param fields_present Bitmask of which fields are present in the structure.
+ */
+void bcmbal_access_terminal_cfg_data_set_default(bcmbal_access_terminal_cfg_data *this, bcmbal_presence_mask fields_present);
+
+/** Packs a bcmbal_access_terminal_cfg_data to bytes
+ *
+ * \param this Pointer to the object to pack
+ * \param buf Pointer to the buffer to write to
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the pack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_access_terminal_cfg_data_pack(const bcmbal_access_terminal_cfg_data *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present);
+
+/** Gets the number of bytes that a bcmbal_access_terminal_cfg_data would occupy
+ * on the wire
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return The structure size in bytes
+ */
+uint32_t bcmbal_access_terminal_cfg_data_get_packed_length(const bcmbal_access_terminal_cfg_data *this, bcmbal_presence_mask fields_present);
+
+/** Unpacks a bcmbal_access_terminal_cfg_data from bytes
+ *
+ * \param this Pointer to the object to unpack
+ * \param buf Pointer to the buffer to read from
+ * \param extra_mem Pointer to the first location in memory to use to store
+ * pointer fields that are NULL. Setting this to NULL will cause an error when
+ * a NULL pointer is encountered.
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the unpack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_access_terminal_cfg_data_unpack(bcmbal_access_terminal_cfg_data *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present);
+
+/** Scans past a packed bcmbal_access_terminal_cfg_data struct and collects
+ * memory requirements above and beyond sizeof()
+ *
+ * \param packed A stream pointing to the packed byte stream
+ * \param extra_mem Number of additional storage bytes required
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE on success, FALSE on failure
+ */
+bcmos_bool bcmbal_access_terminal_cfg_data_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present);
+
+/** Checks if any field in the bcmbal_access_terminal_cfg_data is out of bounds
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \param failed_prop Reference to the property that was out of range (only set
+ * on failure)
+ * \return TRUE if all fields are in the correct range, FALSE otherwise
+ */
+bcmos_bool bcmbal_access_terminal_cfg_data_bounds_check(const bcmbal_access_terminal_cfg_data *this, bcmbal_presence_mask fields_present, bcmbal_access_terminal_cfg_id *failed_prop);
+
+/** Initializes a bcmbal_access_terminal_ind_data struct. This sets all fields
+ * to default values.
+ *
+ * \param this Pointer to the structure
+ * \param fields_present Bitmask of which fields are present in the structure.
+ */
+void bcmbal_access_terminal_ind_data_set_default(bcmbal_access_terminal_ind_data *this, bcmbal_presence_mask fields_present);
+
+/** Packs a bcmbal_access_terminal_ind_data to bytes
+ *
+ * \param this Pointer to the object to pack
+ * \param buf Pointer to the buffer to write to
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the pack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_access_terminal_ind_data_pack(const bcmbal_access_terminal_ind_data *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present);
+
+/** Gets the number of bytes that a bcmbal_access_terminal_ind_data would occupy
+ * on the wire
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return The structure size in bytes
+ */
+uint32_t bcmbal_access_terminal_ind_data_get_packed_length(const bcmbal_access_terminal_ind_data *this, bcmbal_presence_mask fields_present);
+
+/** Unpacks a bcmbal_access_terminal_ind_data from bytes
+ *
+ * \param this Pointer to the object to unpack
+ * \param buf Pointer to the buffer to read from
+ * \param extra_mem Pointer to the first location in memory to use to store
+ * pointer fields that are NULL. Setting this to NULL will cause an error when
+ * a NULL pointer is encountered.
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the unpack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_access_terminal_ind_data_unpack(bcmbal_access_terminal_ind_data *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present);
+
+/** Scans past a packed bcmbal_access_terminal_ind_data struct and collects
+ * memory requirements above and beyond sizeof()
+ *
+ * \param packed A stream pointing to the packed byte stream
+ * \param extra_mem Number of additional storage bytes required
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE on success, FALSE on failure
+ */
+bcmos_bool bcmbal_access_terminal_ind_data_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present);
+
+/** Checks if any field in the bcmbal_access_terminal_ind_data is out of bounds
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \param failed_prop Reference to the property that was out of range (only set
+ * on failure)
+ * \return TRUE if all fields are in the correct range, FALSE otherwise
+ */
+bcmos_bool bcmbal_access_terminal_ind_data_bounds_check(const bcmbal_access_terminal_ind_data *this, bcmbal_presence_mask fields_present, bcmbal_access_terminal_ind_id *failed_prop);
+
+/** Initializes a bcmbal_flow_key struct. This sets all fields to default
+ * values.
+ *
+ * \param this Pointer to the structure
+ * \param fields_present Bitmask of which fields are present in the structure.
+ */
+void bcmbal_flow_key_set_default(bcmbal_flow_key *this, bcmbal_presence_mask fields_present);
+
+/** Packs a bcmbal_flow_key to bytes
+ *
+ * \param this Pointer to the object to pack
+ * \param buf Pointer to the buffer to write to
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the pack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_flow_key_pack(const bcmbal_flow_key *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present);
+
+/** Gets the number of bytes that a bcmbal_flow_key would occupy on the wire
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return The structure size in bytes
+ */
+uint32_t bcmbal_flow_key_get_packed_length(const bcmbal_flow_key *this, bcmbal_presence_mask fields_present);
+
+/** Unpacks a bcmbal_flow_key from bytes
+ *
+ * \param this Pointer to the object to unpack
+ * \param buf Pointer to the buffer to read from
+ * \param extra_mem Pointer to the first location in memory to use to store
+ * pointer fields that are NULL. Setting this to NULL will cause an error when
+ * a NULL pointer is encountered.
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the unpack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_flow_key_unpack(bcmbal_flow_key *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present);
+
+/** Scans past a packed bcmbal_flow_key struct and collects memory requirements
+ * above and beyond sizeof()
+ *
+ * \param packed A stream pointing to the packed byte stream
+ * \param extra_mem Number of additional storage bytes required
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE on success, FALSE on failure
+ */
+bcmos_bool bcmbal_flow_key_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present);
+
+/** Checks if any field in the bcmbal_flow_key is out of bounds
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \param failed_prop Reference to the property that was out of range (only set
+ * on failure)
+ * \return TRUE if all fields are in the correct range, FALSE otherwise
+ */
+bcmos_bool bcmbal_flow_key_bounds_check(const bcmbal_flow_key *this, bcmbal_presence_mask fields_present, bcmbal_flow_key_id *failed_prop);
+
+/** Initializes a bcmbal_flow_cfg_data struct. This sets all fields to default
+ * values.
+ *
+ * \param this Pointer to the structure
+ * \param fields_present Bitmask of which fields are present in the structure.
+ */
+void bcmbal_flow_cfg_data_set_default(bcmbal_flow_cfg_data *this, bcmbal_presence_mask fields_present);
+
+/** Packs a bcmbal_flow_cfg_data to bytes
+ *
+ * \param this Pointer to the object to pack
+ * \param buf Pointer to the buffer to write to
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the pack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_flow_cfg_data_pack(const bcmbal_flow_cfg_data *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present);
+
+/** Gets the number of bytes that a bcmbal_flow_cfg_data would occupy on the
+ * wire
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return The structure size in bytes
+ */
+uint32_t bcmbal_flow_cfg_data_get_packed_length(const bcmbal_flow_cfg_data *this, bcmbal_presence_mask fields_present);
+
+/** Unpacks a bcmbal_flow_cfg_data from bytes
+ *
+ * \param this Pointer to the object to unpack
+ * \param buf Pointer to the buffer to read from
+ * \param extra_mem Pointer to the first location in memory to use to store
+ * pointer fields that are NULL. Setting this to NULL will cause an error when
+ * a NULL pointer is encountered.
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the unpack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_flow_cfg_data_unpack(bcmbal_flow_cfg_data *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present);
+
+/** Scans past a packed bcmbal_flow_cfg_data struct and collects memory
+ * requirements above and beyond sizeof()
+ *
+ * \param packed A stream pointing to the packed byte stream
+ * \param extra_mem Number of additional storage bytes required
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE on success, FALSE on failure
+ */
+bcmos_bool bcmbal_flow_cfg_data_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present);
+
+/** Checks if any field in the bcmbal_flow_cfg_data is out of bounds
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \param failed_prop Reference to the property that was out of range (only set
+ * on failure)
+ * \return TRUE if all fields are in the correct range, FALSE otherwise
+ */
+bcmos_bool bcmbal_flow_cfg_data_bounds_check(const bcmbal_flow_cfg_data *this, bcmbal_presence_mask fields_present, bcmbal_flow_cfg_id *failed_prop);
+
+/** Initializes a bcmbal_flow_stat_data struct. This sets all fields to default
+ * values.
+ *
+ * \param this Pointer to the structure
+ * \param fields_present Bitmask of which fields are present in the structure.
+ */
+void bcmbal_flow_stat_data_set_default(bcmbal_flow_stat_data *this, bcmbal_presence_mask fields_present);
+
+/** Packs a bcmbal_flow_stat_data to bytes
+ *
+ * \param this Pointer to the object to pack
+ * \param buf Pointer to the buffer to write to
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the pack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_flow_stat_data_pack(const bcmbal_flow_stat_data *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present);
+
+/** Gets the number of bytes that a bcmbal_flow_stat_data would occupy on the
+ * wire
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return The structure size in bytes
+ */
+uint32_t bcmbal_flow_stat_data_get_packed_length(const bcmbal_flow_stat_data *this, bcmbal_presence_mask fields_present);
+
+/** Unpacks a bcmbal_flow_stat_data from bytes
+ *
+ * \param this Pointer to the object to unpack
+ * \param buf Pointer to the buffer to read from
+ * \param extra_mem Pointer to the first location in memory to use to store
+ * pointer fields that are NULL. Setting this to NULL will cause an error when
+ * a NULL pointer is encountered.
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the unpack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_flow_stat_data_unpack(bcmbal_flow_stat_data *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present);
+
+/** Scans past a packed bcmbal_flow_stat_data struct and collects memory
+ * requirements above and beyond sizeof()
+ *
+ * \param packed A stream pointing to the packed byte stream
+ * \param extra_mem Number of additional storage bytes required
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE on success, FALSE on failure
+ */
+bcmos_bool bcmbal_flow_stat_data_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present);
+
+/** Checks if any field in the bcmbal_flow_stat_data is out of bounds
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \param failed_prop Reference to the property that was out of range (only set
+ * on failure)
+ * \return TRUE if all fields are in the correct range, FALSE otherwise
+ */
+bcmos_bool bcmbal_flow_stat_data_bounds_check(const bcmbal_flow_stat_data *this, bcmbal_presence_mask fields_present, bcmbal_flow_stat_id *failed_prop);
+
+/** Initializes a bcmbal_flow_ind_data struct. This sets all fields to default
+ * values.
+ *
+ * \param this Pointer to the structure
+ * \param fields_present Bitmask of which fields are present in the structure.
+ */
+void bcmbal_flow_ind_data_set_default(bcmbal_flow_ind_data *this, bcmbal_presence_mask fields_present);
+
+/** Packs a bcmbal_flow_ind_data to bytes
+ *
+ * \param this Pointer to the object to pack
+ * \param buf Pointer to the buffer to write to
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the pack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_flow_ind_data_pack(const bcmbal_flow_ind_data *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present);
+
+/** Gets the number of bytes that a bcmbal_flow_ind_data would occupy on the
+ * wire
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return The structure size in bytes
+ */
+uint32_t bcmbal_flow_ind_data_get_packed_length(const bcmbal_flow_ind_data *this, bcmbal_presence_mask fields_present);
+
+/** Unpacks a bcmbal_flow_ind_data from bytes
+ *
+ * \param this Pointer to the object to unpack
+ * \param buf Pointer to the buffer to read from
+ * \param extra_mem Pointer to the first location in memory to use to store
+ * pointer fields that are NULL. Setting this to NULL will cause an error when
+ * a NULL pointer is encountered.
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the unpack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_flow_ind_data_unpack(bcmbal_flow_ind_data *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present);
+
+/** Scans past a packed bcmbal_flow_ind_data struct and collects memory
+ * requirements above and beyond sizeof()
+ *
+ * \param packed A stream pointing to the packed byte stream
+ * \param extra_mem Number of additional storage bytes required
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE on success, FALSE on failure
+ */
+bcmos_bool bcmbal_flow_ind_data_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present);
+
+/** Checks if any field in the bcmbal_flow_ind_data is out of bounds
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \param failed_prop Reference to the property that was out of range (only set
+ * on failure)
+ * \return TRUE if all fields are in the correct range, FALSE otherwise
+ */
+bcmos_bool bcmbal_flow_ind_data_bounds_check(const bcmbal_flow_ind_data *this, bcmbal_presence_mask fields_present, bcmbal_flow_ind_id *failed_prop);
+
+/** Initializes a bcmbal_group_key struct. This sets all fields to default
+ * values.
+ *
+ * \param this Pointer to the structure
+ * \param fields_present Bitmask of which fields are present in the structure.
+ */
+void bcmbal_group_key_set_default(bcmbal_group_key *this, bcmbal_presence_mask fields_present);
+
+/** Packs a bcmbal_group_key to bytes
+ *
+ * \param this Pointer to the object to pack
+ * \param buf Pointer to the buffer to write to
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the pack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_group_key_pack(const bcmbal_group_key *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present);
+
+/** Gets the number of bytes that a bcmbal_group_key would occupy on the wire
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return The structure size in bytes
+ */
+uint32_t bcmbal_group_key_get_packed_length(const bcmbal_group_key *this, bcmbal_presence_mask fields_present);
+
+/** Unpacks a bcmbal_group_key from bytes
+ *
+ * \param this Pointer to the object to unpack
+ * \param buf Pointer to the buffer to read from
+ * \param extra_mem Pointer to the first location in memory to use to store
+ * pointer fields that are NULL. Setting this to NULL will cause an error when
+ * a NULL pointer is encountered.
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the unpack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_group_key_unpack(bcmbal_group_key *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present);
+
+/** Scans past a packed bcmbal_group_key struct and collects memory requirements
+ * above and beyond sizeof()
+ *
+ * \param packed A stream pointing to the packed byte stream
+ * \param extra_mem Number of additional storage bytes required
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE on success, FALSE on failure
+ */
+bcmos_bool bcmbal_group_key_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present);
+
+/** Checks if any field in the bcmbal_group_key is out of bounds
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \param failed_prop Reference to the property that was out of range (only set
+ * on failure)
+ * \return TRUE if all fields are in the correct range, FALSE otherwise
+ */
+bcmos_bool bcmbal_group_key_bounds_check(const bcmbal_group_key *this, bcmbal_presence_mask fields_present, bcmbal_group_key_id *failed_prop);
+
+/** Initializes a bcmbal_group_cfg_data struct. This sets all fields to default
+ * values.
+ *
+ * \param this Pointer to the structure
+ * \param fields_present Bitmask of which fields are present in the structure.
+ */
+void bcmbal_group_cfg_data_set_default(bcmbal_group_cfg_data *this, bcmbal_presence_mask fields_present);
+
+/** Packs a bcmbal_group_cfg_data to bytes
+ *
+ * \param this Pointer to the object to pack
+ * \param buf Pointer to the buffer to write to
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the pack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_group_cfg_data_pack(const bcmbal_group_cfg_data *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present);
+
+/** Gets the number of bytes that a bcmbal_group_cfg_data would occupy on the
+ * wire
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return The structure size in bytes
+ */
+uint32_t bcmbal_group_cfg_data_get_packed_length(const bcmbal_group_cfg_data *this, bcmbal_presence_mask fields_present);
+
+/** Unpacks a bcmbal_group_cfg_data from bytes
+ *
+ * \param this Pointer to the object to unpack
+ * \param buf Pointer to the buffer to read from
+ * \param extra_mem Pointer to the first location in memory to use to store
+ * pointer fields that are NULL. Setting this to NULL will cause an error when
+ * a NULL pointer is encountered.
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the unpack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_group_cfg_data_unpack(bcmbal_group_cfg_data *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present);
+
+/** Scans past a packed bcmbal_group_cfg_data struct and collects memory
+ * requirements above and beyond sizeof()
+ *
+ * \param packed A stream pointing to the packed byte stream
+ * \param extra_mem Number of additional storage bytes required
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE on success, FALSE on failure
+ */
+bcmos_bool bcmbal_group_cfg_data_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present);
+
+/** Checks if any field in the bcmbal_group_cfg_data is out of bounds
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \param failed_prop Reference to the property that was out of range (only set
+ * on failure)
+ * \return TRUE if all fields are in the correct range, FALSE otherwise
+ */
+bcmos_bool bcmbal_group_cfg_data_bounds_check(const bcmbal_group_cfg_data *this, bcmbal_presence_mask fields_present, bcmbal_group_cfg_id *failed_prop);
+
+/** Initializes a bcmbal_interface_key struct. This sets all fields to default
+ * values.
+ *
+ * \param this Pointer to the structure
+ * \param fields_present Bitmask of which fields are present in the structure.
+ */
+void bcmbal_interface_key_set_default(bcmbal_interface_key *this, bcmbal_presence_mask fields_present);
+
+/** Packs a bcmbal_interface_key to bytes
+ *
+ * \param this Pointer to the object to pack
+ * \param buf Pointer to the buffer to write to
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the pack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_interface_key_pack(const bcmbal_interface_key *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present);
+
+/** Gets the number of bytes that a bcmbal_interface_key would occupy on the
+ * wire
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return The structure size in bytes
+ */
+uint32_t bcmbal_interface_key_get_packed_length(const bcmbal_interface_key *this, bcmbal_presence_mask fields_present);
+
+/** Unpacks a bcmbal_interface_key from bytes
+ *
+ * \param this Pointer to the object to unpack
+ * \param buf Pointer to the buffer to read from
+ * \param extra_mem Pointer to the first location in memory to use to store
+ * pointer fields that are NULL. Setting this to NULL will cause an error when
+ * a NULL pointer is encountered.
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the unpack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_interface_key_unpack(bcmbal_interface_key *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present);
+
+/** Scans past a packed bcmbal_interface_key struct and collects memory
+ * requirements above and beyond sizeof()
+ *
+ * \param packed A stream pointing to the packed byte stream
+ * \param extra_mem Number of additional storage bytes required
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE on success, FALSE on failure
+ */
+bcmos_bool bcmbal_interface_key_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present);
+
+/** Checks if any field in the bcmbal_interface_key is out of bounds
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \param failed_prop Reference to the property that was out of range (only set
+ * on failure)
+ * \return TRUE if all fields are in the correct range, FALSE otherwise
+ */
+bcmos_bool bcmbal_interface_key_bounds_check(const bcmbal_interface_key *this, bcmbal_presence_mask fields_present, bcmbal_interface_key_id *failed_prop);
+
+/** Initializes a bcmbal_interface_cfg_data struct. This sets all fields to
+ * default values.
+ *
+ * \param this Pointer to the structure
+ * \param fields_present Bitmask of which fields are present in the structure.
+ */
+void bcmbal_interface_cfg_data_set_default(bcmbal_interface_cfg_data *this, bcmbal_presence_mask fields_present);
+
+/** Packs a bcmbal_interface_cfg_data to bytes
+ *
+ * \param this Pointer to the object to pack
+ * \param buf Pointer to the buffer to write to
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the pack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_interface_cfg_data_pack(const bcmbal_interface_cfg_data *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present);
+
+/** Gets the number of bytes that a bcmbal_interface_cfg_data would occupy on
+ * the wire
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return The structure size in bytes
+ */
+uint32_t bcmbal_interface_cfg_data_get_packed_length(const bcmbal_interface_cfg_data *this, bcmbal_presence_mask fields_present);
+
+/** Unpacks a bcmbal_interface_cfg_data from bytes
+ *
+ * \param this Pointer to the object to unpack
+ * \param buf Pointer to the buffer to read from
+ * \param extra_mem Pointer to the first location in memory to use to store
+ * pointer fields that are NULL. Setting this to NULL will cause an error when
+ * a NULL pointer is encountered.
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the unpack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_interface_cfg_data_unpack(bcmbal_interface_cfg_data *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present);
+
+/** Scans past a packed bcmbal_interface_cfg_data struct and collects memory
+ * requirements above and beyond sizeof()
+ *
+ * \param packed A stream pointing to the packed byte stream
+ * \param extra_mem Number of additional storage bytes required
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE on success, FALSE on failure
+ */
+bcmos_bool bcmbal_interface_cfg_data_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present);
+
+/** Checks if any field in the bcmbal_interface_cfg_data is out of bounds
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \param failed_prop Reference to the property that was out of range (only set
+ * on failure)
+ * \return TRUE if all fields are in the correct range, FALSE otherwise
+ */
+bcmos_bool bcmbal_interface_cfg_data_bounds_check(const bcmbal_interface_cfg_data *this, bcmbal_presence_mask fields_present, bcmbal_interface_cfg_id *failed_prop);
+
+/** Initializes a bcmbal_interface_stat_data struct. This sets all fields to
+ * default values.
+ *
+ * \param this Pointer to the structure
+ * \param fields_present Bitmask of which fields are present in the structure.
+ */
+void bcmbal_interface_stat_data_set_default(bcmbal_interface_stat_data *this, bcmbal_presence_mask fields_present);
+
+/** Packs a bcmbal_interface_stat_data to bytes
+ *
+ * \param this Pointer to the object to pack
+ * \param buf Pointer to the buffer to write to
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the pack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_interface_stat_data_pack(const bcmbal_interface_stat_data *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present);
+
+/** Gets the number of bytes that a bcmbal_interface_stat_data would occupy on
+ * the wire
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return The structure size in bytes
+ */
+uint32_t bcmbal_interface_stat_data_get_packed_length(const bcmbal_interface_stat_data *this, bcmbal_presence_mask fields_present);
+
+/** Unpacks a bcmbal_interface_stat_data from bytes
+ *
+ * \param this Pointer to the object to unpack
+ * \param buf Pointer to the buffer to read from
+ * \param extra_mem Pointer to the first location in memory to use to store
+ * pointer fields that are NULL. Setting this to NULL will cause an error when
+ * a NULL pointer is encountered.
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the unpack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_interface_stat_data_unpack(bcmbal_interface_stat_data *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present);
+
+/** Scans past a packed bcmbal_interface_stat_data struct and collects memory
+ * requirements above and beyond sizeof()
+ *
+ * \param packed A stream pointing to the packed byte stream
+ * \param extra_mem Number of additional storage bytes required
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE on success, FALSE on failure
+ */
+bcmos_bool bcmbal_interface_stat_data_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present);
+
+/** Checks if any field in the bcmbal_interface_stat_data is out of bounds
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \param failed_prop Reference to the property that was out of range (only set
+ * on failure)
+ * \return TRUE if all fields are in the correct range, FALSE otherwise
+ */
+bcmos_bool bcmbal_interface_stat_data_bounds_check(const bcmbal_interface_stat_data *this, bcmbal_presence_mask fields_present, bcmbal_interface_stat_id *failed_prop);
+
+/** Initializes a bcmbal_interface_ind_data struct. This sets all fields to
+ * default values.
+ *
+ * \param this Pointer to the structure
+ * \param fields_present Bitmask of which fields are present in the structure.
+ */
+void bcmbal_interface_ind_data_set_default(bcmbal_interface_ind_data *this, bcmbal_presence_mask fields_present);
+
+/** Packs a bcmbal_interface_ind_data to bytes
+ *
+ * \param this Pointer to the object to pack
+ * \param buf Pointer to the buffer to write to
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the pack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_interface_ind_data_pack(const bcmbal_interface_ind_data *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present);
+
+/** Gets the number of bytes that a bcmbal_interface_ind_data would occupy on
+ * the wire
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return The structure size in bytes
+ */
+uint32_t bcmbal_interface_ind_data_get_packed_length(const bcmbal_interface_ind_data *this, bcmbal_presence_mask fields_present);
+
+/** Unpacks a bcmbal_interface_ind_data from bytes
+ *
+ * \param this Pointer to the object to unpack
+ * \param buf Pointer to the buffer to read from
+ * \param extra_mem Pointer to the first location in memory to use to store
+ * pointer fields that are NULL. Setting this to NULL will cause an error when
+ * a NULL pointer is encountered.
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the unpack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_interface_ind_data_unpack(bcmbal_interface_ind_data *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present);
+
+/** Scans past a packed bcmbal_interface_ind_data struct and collects memory
+ * requirements above and beyond sizeof()
+ *
+ * \param packed A stream pointing to the packed byte stream
+ * \param extra_mem Number of additional storage bytes required
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE on success, FALSE on failure
+ */
+bcmos_bool bcmbal_interface_ind_data_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present);
+
+/** Checks if any field in the bcmbal_interface_ind_data is out of bounds
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \param failed_prop Reference to the property that was out of range (only set
+ * on failure)
+ * \return TRUE if all fields are in the correct range, FALSE otherwise
+ */
+bcmos_bool bcmbal_interface_ind_data_bounds_check(const bcmbal_interface_ind_data *this, bcmbal_presence_mask fields_present, bcmbal_interface_ind_id *failed_prop);
+
+/** Initializes a bcmbal_packet_key struct. This sets all fields to default
+ * values.
+ *
+ * \param this Pointer to the structure
+ * \param fields_present Bitmask of which fields are present in the structure.
+ */
+void bcmbal_packet_key_set_default(bcmbal_packet_key *this, bcmbal_presence_mask fields_present);
+
+/** Packs a bcmbal_packet_key to bytes
+ *
+ * \param this Pointer to the object to pack
+ * \param buf Pointer to the buffer to write to
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the pack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_packet_key_pack(const bcmbal_packet_key *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present);
+
+/** Gets the number of bytes that a bcmbal_packet_key would occupy on the wire
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return The structure size in bytes
+ */
+uint32_t bcmbal_packet_key_get_packed_length(const bcmbal_packet_key *this, bcmbal_presence_mask fields_present);
+
+/** Unpacks a bcmbal_packet_key from bytes
+ *
+ * \param this Pointer to the object to unpack
+ * \param buf Pointer to the buffer to read from
+ * \param extra_mem Pointer to the first location in memory to use to store
+ * pointer fields that are NULL. Setting this to NULL will cause an error when
+ * a NULL pointer is encountered.
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the unpack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_packet_key_unpack(bcmbal_packet_key *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present);
+
+/** Scans past a packed bcmbal_packet_key struct and collects memory
+ * requirements above and beyond sizeof()
+ *
+ * \param packed A stream pointing to the packed byte stream
+ * \param extra_mem Number of additional storage bytes required
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE on success, FALSE on failure
+ */
+bcmos_bool bcmbal_packet_key_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present);
+
+/** Checks if any field in the bcmbal_packet_key is out of bounds
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \param failed_prop Reference to the property that was out of range (only set
+ * on failure)
+ * \return TRUE if all fields are in the correct range, FALSE otherwise
+ */
+bcmos_bool bcmbal_packet_key_bounds_check(const bcmbal_packet_key *this, bcmbal_presence_mask fields_present, bcmbal_packet_key_id *failed_prop);
+
+/** Initializes a bcmbal_packet_cfg_data struct. This sets all fields to
+ * default values.
+ *
+ * \param this Pointer to the structure
+ * \param fields_present Bitmask of which fields are present in the structure.
+ */
+void bcmbal_packet_cfg_data_set_default(bcmbal_packet_cfg_data *this, bcmbal_presence_mask fields_present);
+
+/** Packs a bcmbal_packet_cfg_data to bytes
+ *
+ * \param this Pointer to the object to pack
+ * \param buf Pointer to the buffer to write to
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the pack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_packet_cfg_data_pack(const bcmbal_packet_cfg_data *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present);
+
+/** Gets the number of bytes that a bcmbal_packet_cfg_data would occupy on the
+ * wire
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return The structure size in bytes
+ */
+uint32_t bcmbal_packet_cfg_data_get_packed_length(const bcmbal_packet_cfg_data *this, bcmbal_presence_mask fields_present);
+
+/** Unpacks a bcmbal_packet_cfg_data from bytes
+ *
+ * \param this Pointer to the object to unpack
+ * \param buf Pointer to the buffer to read from
+ * \param extra_mem Pointer to the first location in memory to use to store
+ * pointer fields that are NULL. Setting this to NULL will cause an error when
+ * a NULL pointer is encountered.
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the unpack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_packet_cfg_data_unpack(bcmbal_packet_cfg_data *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present);
+
+/** Scans past a packed bcmbal_packet_cfg_data struct and collects memory
+ * requirements above and beyond sizeof()
+ *
+ * \param packed A stream pointing to the packed byte stream
+ * \param extra_mem Number of additional storage bytes required
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE on success, FALSE on failure
+ */
+bcmos_bool bcmbal_packet_cfg_data_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present);
+
+/** Checks if any field in the bcmbal_packet_cfg_data is out of bounds
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \param failed_prop Reference to the property that was out of range (only set
+ * on failure)
+ * \return TRUE if all fields are in the correct range, FALSE otherwise
+ */
+bcmos_bool bcmbal_packet_cfg_data_bounds_check(const bcmbal_packet_cfg_data *this, bcmbal_presence_mask fields_present, bcmbal_packet_cfg_id *failed_prop);
+
+/** Initializes a bcmbal_packet_ind_data struct. This sets all fields to
+ * default values.
+ *
+ * \param this Pointer to the structure
+ * \param fields_present Bitmask of which fields are present in the structure.
+ */
+void bcmbal_packet_ind_data_set_default(bcmbal_packet_ind_data *this, bcmbal_presence_mask fields_present);
+
+/** Packs a bcmbal_packet_ind_data to bytes
+ *
+ * \param this Pointer to the object to pack
+ * \param buf Pointer to the buffer to write to
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the pack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_packet_ind_data_pack(const bcmbal_packet_ind_data *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present);
+
+/** Gets the number of bytes that a bcmbal_packet_ind_data would occupy on the
+ * wire
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return The structure size in bytes
+ */
+uint32_t bcmbal_packet_ind_data_get_packed_length(const bcmbal_packet_ind_data *this, bcmbal_presence_mask fields_present);
+
+/** Unpacks a bcmbal_packet_ind_data from bytes
+ *
+ * \param this Pointer to the object to unpack
+ * \param buf Pointer to the buffer to read from
+ * \param extra_mem Pointer to the first location in memory to use to store
+ * pointer fields that are NULL. Setting this to NULL will cause an error when
+ * a NULL pointer is encountered.
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the unpack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_packet_ind_data_unpack(bcmbal_packet_ind_data *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present);
+
+/** Scans past a packed bcmbal_packet_ind_data struct and collects memory
+ * requirements above and beyond sizeof()
+ *
+ * \param packed A stream pointing to the packed byte stream
+ * \param extra_mem Number of additional storage bytes required
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE on success, FALSE on failure
+ */
+bcmos_bool bcmbal_packet_ind_data_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present);
+
+/** Checks if any field in the bcmbal_packet_ind_data is out of bounds
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \param failed_prop Reference to the property that was out of range (only set
+ * on failure)
+ * \return TRUE if all fields are in the correct range, FALSE otherwise
+ */
+bcmos_bool bcmbal_packet_ind_data_bounds_check(const bcmbal_packet_ind_data *this, bcmbal_presence_mask fields_present, bcmbal_packet_ind_id *failed_prop);
+
+/** Initializes a bcmbal_subscriber_terminal_key struct. This sets all fields
+ * to default values.
+ *
+ * \param this Pointer to the structure
+ * \param fields_present Bitmask of which fields are present in the structure.
+ */
+void bcmbal_subscriber_terminal_key_set_default(bcmbal_subscriber_terminal_key *this, bcmbal_presence_mask fields_present);
+
+/** Packs a bcmbal_subscriber_terminal_key to bytes
+ *
+ * \param this Pointer to the object to pack
+ * \param buf Pointer to the buffer to write to
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the pack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_subscriber_terminal_key_pack(const bcmbal_subscriber_terminal_key *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present);
+
+/** Gets the number of bytes that a bcmbal_subscriber_terminal_key would occupy
+ * on the wire
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return The structure size in bytes
+ */
+uint32_t bcmbal_subscriber_terminal_key_get_packed_length(const bcmbal_subscriber_terminal_key *this, bcmbal_presence_mask fields_present);
+
+/** Unpacks a bcmbal_subscriber_terminal_key from bytes
+ *
+ * \param this Pointer to the object to unpack
+ * \param buf Pointer to the buffer to read from
+ * \param extra_mem Pointer to the first location in memory to use to store
+ * pointer fields that are NULL. Setting this to NULL will cause an error when
+ * a NULL pointer is encountered.
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the unpack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_subscriber_terminal_key_unpack(bcmbal_subscriber_terminal_key *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present);
+
+/** Scans past a packed bcmbal_subscriber_terminal_key struct and collects
+ * memory requirements above and beyond sizeof()
+ *
+ * \param packed A stream pointing to the packed byte stream
+ * \param extra_mem Number of additional storage bytes required
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE on success, FALSE on failure
+ */
+bcmos_bool bcmbal_subscriber_terminal_key_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present);
+
+/** Checks if any field in the bcmbal_subscriber_terminal_key is out of bounds
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \param failed_prop Reference to the property that was out of range (only set
+ * on failure)
+ * \return TRUE if all fields are in the correct range, FALSE otherwise
+ */
+bcmos_bool bcmbal_subscriber_terminal_key_bounds_check(const bcmbal_subscriber_terminal_key *this, bcmbal_presence_mask fields_present, bcmbal_subscriber_terminal_key_id *failed_prop);
+
+/** Initializes a bcmbal_subscriber_terminal_cfg_data struct. This sets all
+ * fields to default values.
+ *
+ * \param this Pointer to the structure
+ * \param fields_present Bitmask of which fields are present in the structure.
+ */
+void bcmbal_subscriber_terminal_cfg_data_set_default(bcmbal_subscriber_terminal_cfg_data *this, bcmbal_presence_mask fields_present);
+
+/** Packs a bcmbal_subscriber_terminal_cfg_data to bytes
+ *
+ * \param this Pointer to the object to pack
+ * \param buf Pointer to the buffer to write to
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the pack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_subscriber_terminal_cfg_data_pack(const bcmbal_subscriber_terminal_cfg_data *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present);
+
+/** Gets the number of bytes that a bcmbal_subscriber_terminal_cfg_data would
+ * occupy on the wire
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return The structure size in bytes
+ */
+uint32_t bcmbal_subscriber_terminal_cfg_data_get_packed_length(const bcmbal_subscriber_terminal_cfg_data *this, bcmbal_presence_mask fields_present);
+
+/** Unpacks a bcmbal_subscriber_terminal_cfg_data from bytes
+ *
+ * \param this Pointer to the object to unpack
+ * \param buf Pointer to the buffer to read from
+ * \param extra_mem Pointer to the first location in memory to use to store
+ * pointer fields that are NULL. Setting this to NULL will cause an error when
+ * a NULL pointer is encountered.
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the unpack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_subscriber_terminal_cfg_data_unpack(bcmbal_subscriber_terminal_cfg_data *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present);
+
+/** Scans past a packed bcmbal_subscriber_terminal_cfg_data struct and collects
+ * memory requirements above and beyond sizeof()
+ *
+ * \param packed A stream pointing to the packed byte stream
+ * \param extra_mem Number of additional storage bytes required
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE on success, FALSE on failure
+ */
+bcmos_bool bcmbal_subscriber_terminal_cfg_data_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present);
+
+/** Checks if any field in the bcmbal_subscriber_terminal_cfg_data is out of
+ * bounds
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \param failed_prop Reference to the property that was out of range (only set
+ * on failure)
+ * \return TRUE if all fields are in the correct range, FALSE otherwise
+ */
+bcmos_bool bcmbal_subscriber_terminal_cfg_data_bounds_check(const bcmbal_subscriber_terminal_cfg_data *this, bcmbal_presence_mask fields_present, bcmbal_subscriber_terminal_cfg_id *failed_prop);
+
+/** Initializes a bcmbal_subscriber_terminal_stat_data struct. This sets all
+ * fields to default values.
+ *
+ * \param this Pointer to the structure
+ * \param fields_present Bitmask of which fields are present in the structure.
+ */
+void bcmbal_subscriber_terminal_stat_data_set_default(bcmbal_subscriber_terminal_stat_data *this, bcmbal_presence_mask fields_present);
+
+/** Packs a bcmbal_subscriber_terminal_stat_data to bytes
+ *
+ * \param this Pointer to the object to pack
+ * \param buf Pointer to the buffer to write to
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the pack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_subscriber_terminal_stat_data_pack(const bcmbal_subscriber_terminal_stat_data *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present);
+
+/** Gets the number of bytes that a bcmbal_subscriber_terminal_stat_data would
+ * occupy on the wire
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return The structure size in bytes
+ */
+uint32_t bcmbal_subscriber_terminal_stat_data_get_packed_length(const bcmbal_subscriber_terminal_stat_data *this, bcmbal_presence_mask fields_present);
+
+/** Unpacks a bcmbal_subscriber_terminal_stat_data from bytes
+ *
+ * \param this Pointer to the object to unpack
+ * \param buf Pointer to the buffer to read from
+ * \param extra_mem Pointer to the first location in memory to use to store
+ * pointer fields that are NULL. Setting this to NULL will cause an error when
+ * a NULL pointer is encountered.
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the unpack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_subscriber_terminal_stat_data_unpack(bcmbal_subscriber_terminal_stat_data *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present);
+
+/** Scans past a packed bcmbal_subscriber_terminal_stat_data struct and collects
+ * memory requirements above and beyond sizeof()
+ *
+ * \param packed A stream pointing to the packed byte stream
+ * \param extra_mem Number of additional storage bytes required
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE on success, FALSE on failure
+ */
+bcmos_bool bcmbal_subscriber_terminal_stat_data_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present);
+
+/** Checks if any field in the bcmbal_subscriber_terminal_stat_data is out of
+ * bounds
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \param failed_prop Reference to the property that was out of range (only set
+ * on failure)
+ * \return TRUE if all fields are in the correct range, FALSE otherwise
+ */
+bcmos_bool bcmbal_subscriber_terminal_stat_data_bounds_check(const bcmbal_subscriber_terminal_stat_data *this, bcmbal_presence_mask fields_present, bcmbal_subscriber_terminal_stat_id *failed_prop);
+
+/** Initializes a bcmbal_subscriber_terminal_ind_data struct. This sets all
+ * fields to default values.
+ *
+ * \param this Pointer to the structure
+ * \param fields_present Bitmask of which fields are present in the structure.
+ */
+void bcmbal_subscriber_terminal_ind_data_set_default(bcmbal_subscriber_terminal_ind_data *this, bcmbal_presence_mask fields_present);
+
+/** Packs a bcmbal_subscriber_terminal_ind_data to bytes
+ *
+ * \param this Pointer to the object to pack
+ * \param buf Pointer to the buffer to write to
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the pack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_subscriber_terminal_ind_data_pack(const bcmbal_subscriber_terminal_ind_data *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present);
+
+/** Gets the number of bytes that a bcmbal_subscriber_terminal_ind_data would
+ * occupy on the wire
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return The structure size in bytes
+ */
+uint32_t bcmbal_subscriber_terminal_ind_data_get_packed_length(const bcmbal_subscriber_terminal_ind_data *this, bcmbal_presence_mask fields_present);
+
+/** Unpacks a bcmbal_subscriber_terminal_ind_data from bytes
+ *
+ * \param this Pointer to the object to unpack
+ * \param buf Pointer to the buffer to read from
+ * \param extra_mem Pointer to the first location in memory to use to store
+ * pointer fields that are NULL. Setting this to NULL will cause an error when
+ * a NULL pointer is encountered.
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the unpack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_subscriber_terminal_ind_data_unpack(bcmbal_subscriber_terminal_ind_data *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present);
+
+/** Scans past a packed bcmbal_subscriber_terminal_ind_data struct and collects
+ * memory requirements above and beyond sizeof()
+ *
+ * \param packed A stream pointing to the packed byte stream
+ * \param extra_mem Number of additional storage bytes required
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE on success, FALSE on failure
+ */
+bcmos_bool bcmbal_subscriber_terminal_ind_data_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present);
+
+/** Checks if any field in the bcmbal_subscriber_terminal_ind_data is out of
+ * bounds
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \param failed_prop Reference to the property that was out of range (only set
+ * on failure)
+ * \return TRUE if all fields are in the correct range, FALSE otherwise
+ */
+bcmos_bool bcmbal_subscriber_terminal_ind_data_bounds_check(const bcmbal_subscriber_terminal_ind_data *this, bcmbal_presence_mask fields_present, bcmbal_subscriber_terminal_ind_id *failed_prop);
+
+/** Initializes a bcmbal_tm_queue_key struct. This sets all fields to default
+ * values.
+ *
+ * \param this Pointer to the structure
+ * \param fields_present Bitmask of which fields are present in the structure.
+ */
+void bcmbal_tm_queue_key_set_default(bcmbal_tm_queue_key *this, bcmbal_presence_mask fields_present);
+
+/** Packs a bcmbal_tm_queue_key to bytes
+ *
+ * \param this Pointer to the object to pack
+ * \param buf Pointer to the buffer to write to
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the pack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_tm_queue_key_pack(const bcmbal_tm_queue_key *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present);
+
+/** Gets the number of bytes that a bcmbal_tm_queue_key would occupy on the wire
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return The structure size in bytes
+ */
+uint32_t bcmbal_tm_queue_key_get_packed_length(const bcmbal_tm_queue_key *this, bcmbal_presence_mask fields_present);
+
+/** Unpacks a bcmbal_tm_queue_key from bytes
+ *
+ * \param this Pointer to the object to unpack
+ * \param buf Pointer to the buffer to read from
+ * \param extra_mem Pointer to the first location in memory to use to store
+ * pointer fields that are NULL. Setting this to NULL will cause an error when
+ * a NULL pointer is encountered.
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the unpack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_tm_queue_key_unpack(bcmbal_tm_queue_key *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present);
+
+/** Scans past a packed bcmbal_tm_queue_key struct and collects memory
+ * requirements above and beyond sizeof()
+ *
+ * \param packed A stream pointing to the packed byte stream
+ * \param extra_mem Number of additional storage bytes required
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE on success, FALSE on failure
+ */
+bcmos_bool bcmbal_tm_queue_key_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present);
+
+/** Checks if any field in the bcmbal_tm_queue_key is out of bounds
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \param failed_prop Reference to the property that was out of range (only set
+ * on failure)
+ * \return TRUE if all fields are in the correct range, FALSE otherwise
+ */
+bcmos_bool bcmbal_tm_queue_key_bounds_check(const bcmbal_tm_queue_key *this, bcmbal_presence_mask fields_present, bcmbal_tm_queue_key_id *failed_prop);
+
+/** Initializes a bcmbal_tm_queue_cfg_data struct. This sets all fields to
+ * default values.
+ *
+ * \param this Pointer to the structure
+ * \param fields_present Bitmask of which fields are present in the structure.
+ */
+void bcmbal_tm_queue_cfg_data_set_default(bcmbal_tm_queue_cfg_data *this, bcmbal_presence_mask fields_present);
+
+/** Packs a bcmbal_tm_queue_cfg_data to bytes
+ *
+ * \param this Pointer to the object to pack
+ * \param buf Pointer to the buffer to write to
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the pack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_tm_queue_cfg_data_pack(const bcmbal_tm_queue_cfg_data *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present);
+
+/** Gets the number of bytes that a bcmbal_tm_queue_cfg_data would occupy on the
+ * wire
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return The structure size in bytes
+ */
+uint32_t bcmbal_tm_queue_cfg_data_get_packed_length(const bcmbal_tm_queue_cfg_data *this, bcmbal_presence_mask fields_present);
+
+/** Unpacks a bcmbal_tm_queue_cfg_data from bytes
+ *
+ * \param this Pointer to the object to unpack
+ * \param buf Pointer to the buffer to read from
+ * \param extra_mem Pointer to the first location in memory to use to store
+ * pointer fields that are NULL. Setting this to NULL will cause an error when
+ * a NULL pointer is encountered.
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the unpack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_tm_queue_cfg_data_unpack(bcmbal_tm_queue_cfg_data *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present);
+
+/** Scans past a packed bcmbal_tm_queue_cfg_data struct and collects memory
+ * requirements above and beyond sizeof()
+ *
+ * \param packed A stream pointing to the packed byte stream
+ * \param extra_mem Number of additional storage bytes required
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE on success, FALSE on failure
+ */
+bcmos_bool bcmbal_tm_queue_cfg_data_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present);
+
+/** Checks if any field in the bcmbal_tm_queue_cfg_data is out of bounds
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \param failed_prop Reference to the property that was out of range (only set
+ * on failure)
+ * \return TRUE if all fields are in the correct range, FALSE otherwise
+ */
+bcmos_bool bcmbal_tm_queue_cfg_data_bounds_check(const bcmbal_tm_queue_cfg_data *this, bcmbal_presence_mask fields_present, bcmbal_tm_queue_cfg_id *failed_prop);
+
+/** Initializes a bcmbal_tm_queue_stat_data struct. This sets all fields to
+ * default values.
+ *
+ * \param this Pointer to the structure
+ * \param fields_present Bitmask of which fields are present in the structure.
+ */
+void bcmbal_tm_queue_stat_data_set_default(bcmbal_tm_queue_stat_data *this, bcmbal_presence_mask fields_present);
+
+/** Packs a bcmbal_tm_queue_stat_data to bytes
+ *
+ * \param this Pointer to the object to pack
+ * \param buf Pointer to the buffer to write to
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the pack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_tm_queue_stat_data_pack(const bcmbal_tm_queue_stat_data *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present);
+
+/** Gets the number of bytes that a bcmbal_tm_queue_stat_data would occupy on
+ * the wire
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return The structure size in bytes
+ */
+uint32_t bcmbal_tm_queue_stat_data_get_packed_length(const bcmbal_tm_queue_stat_data *this, bcmbal_presence_mask fields_present);
+
+/** Unpacks a bcmbal_tm_queue_stat_data from bytes
+ *
+ * \param this Pointer to the object to unpack
+ * \param buf Pointer to the buffer to read from
+ * \param extra_mem Pointer to the first location in memory to use to store
+ * pointer fields that are NULL. Setting this to NULL will cause an error when
+ * a NULL pointer is encountered.
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the unpack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_tm_queue_stat_data_unpack(bcmbal_tm_queue_stat_data *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present);
+
+/** Scans past a packed bcmbal_tm_queue_stat_data struct and collects memory
+ * requirements above and beyond sizeof()
+ *
+ * \param packed A stream pointing to the packed byte stream
+ * \param extra_mem Number of additional storage bytes required
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE on success, FALSE on failure
+ */
+bcmos_bool bcmbal_tm_queue_stat_data_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present);
+
+/** Checks if any field in the bcmbal_tm_queue_stat_data is out of bounds
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \param failed_prop Reference to the property that was out of range (only set
+ * on failure)
+ * \return TRUE if all fields are in the correct range, FALSE otherwise
+ */
+bcmos_bool bcmbal_tm_queue_stat_data_bounds_check(const bcmbal_tm_queue_stat_data *this, bcmbal_presence_mask fields_present, bcmbal_tm_queue_stat_id *failed_prop);
+
+/** Initializes a bcmbal_tm_queue_ind_data struct. This sets all fields to
+ * default values.
+ *
+ * \param this Pointer to the structure
+ * \param fields_present Bitmask of which fields are present in the structure.
+ */
+void bcmbal_tm_queue_ind_data_set_default(bcmbal_tm_queue_ind_data *this, bcmbal_presence_mask fields_present);
+
+/** Packs a bcmbal_tm_queue_ind_data to bytes
+ *
+ * \param this Pointer to the object to pack
+ * \param buf Pointer to the buffer to write to
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the pack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_tm_queue_ind_data_pack(const bcmbal_tm_queue_ind_data *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present);
+
+/** Gets the number of bytes that a bcmbal_tm_queue_ind_data would occupy on the
+ * wire
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return The structure size in bytes
+ */
+uint32_t bcmbal_tm_queue_ind_data_get_packed_length(const bcmbal_tm_queue_ind_data *this, bcmbal_presence_mask fields_present);
+
+/** Unpacks a bcmbal_tm_queue_ind_data from bytes
+ *
+ * \param this Pointer to the object to unpack
+ * \param buf Pointer to the buffer to read from
+ * \param extra_mem Pointer to the first location in memory to use to store
+ * pointer fields that are NULL. Setting this to NULL will cause an error when
+ * a NULL pointer is encountered.
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the unpack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_tm_queue_ind_data_unpack(bcmbal_tm_queue_ind_data *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present);
+
+/** Scans past a packed bcmbal_tm_queue_ind_data struct and collects memory
+ * requirements above and beyond sizeof()
+ *
+ * \param packed A stream pointing to the packed byte stream
+ * \param extra_mem Number of additional storage bytes required
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE on success, FALSE on failure
+ */
+bcmos_bool bcmbal_tm_queue_ind_data_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present);
+
+/** Checks if any field in the bcmbal_tm_queue_ind_data is out of bounds
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \param failed_prop Reference to the property that was out of range (only set
+ * on failure)
+ * \return TRUE if all fields are in the correct range, FALSE otherwise
+ */
+bcmos_bool bcmbal_tm_queue_ind_data_bounds_check(const bcmbal_tm_queue_ind_data *this, bcmbal_presence_mask fields_present, bcmbal_tm_queue_ind_id *failed_prop);
+
+/** Initializes a bcmbal_tm_sched_key struct. This sets all fields to default
+ * values.
+ *
+ * \param this Pointer to the structure
+ * \param fields_present Bitmask of which fields are present in the structure.
+ */
+void bcmbal_tm_sched_key_set_default(bcmbal_tm_sched_key *this, bcmbal_presence_mask fields_present);
+
+/** Packs a bcmbal_tm_sched_key to bytes
+ *
+ * \param this Pointer to the object to pack
+ * \param buf Pointer to the buffer to write to
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the pack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_tm_sched_key_pack(const bcmbal_tm_sched_key *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present);
+
+/** Gets the number of bytes that a bcmbal_tm_sched_key would occupy on the wire
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return The structure size in bytes
+ */
+uint32_t bcmbal_tm_sched_key_get_packed_length(const bcmbal_tm_sched_key *this, bcmbal_presence_mask fields_present);
+
+/** Unpacks a bcmbal_tm_sched_key from bytes
+ *
+ * \param this Pointer to the object to unpack
+ * \param buf Pointer to the buffer to read from
+ * \param extra_mem Pointer to the first location in memory to use to store
+ * pointer fields that are NULL. Setting this to NULL will cause an error when
+ * a NULL pointer is encountered.
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the unpack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_tm_sched_key_unpack(bcmbal_tm_sched_key *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present);
+
+/** Scans past a packed bcmbal_tm_sched_key struct and collects memory
+ * requirements above and beyond sizeof()
+ *
+ * \param packed A stream pointing to the packed byte stream
+ * \param extra_mem Number of additional storage bytes required
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE on success, FALSE on failure
+ */
+bcmos_bool bcmbal_tm_sched_key_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present);
+
+/** Checks if any field in the bcmbal_tm_sched_key is out of bounds
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \param failed_prop Reference to the property that was out of range (only set
+ * on failure)
+ * \return TRUE if all fields are in the correct range, FALSE otherwise
+ */
+bcmos_bool bcmbal_tm_sched_key_bounds_check(const bcmbal_tm_sched_key *this, bcmbal_presence_mask fields_present, bcmbal_tm_sched_key_id *failed_prop);
+
+/** Initializes a bcmbal_tm_sched_cfg_data struct. This sets all fields to
+ * default values.
+ *
+ * \param this Pointer to the structure
+ * \param fields_present Bitmask of which fields are present in the structure.
+ */
+void bcmbal_tm_sched_cfg_data_set_default(bcmbal_tm_sched_cfg_data *this, bcmbal_presence_mask fields_present);
+
+/** Packs a bcmbal_tm_sched_cfg_data to bytes
+ *
+ * \param this Pointer to the object to pack
+ * \param buf Pointer to the buffer to write to
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the pack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_tm_sched_cfg_data_pack(const bcmbal_tm_sched_cfg_data *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present);
+
+/** Gets the number of bytes that a bcmbal_tm_sched_cfg_data would occupy on the
+ * wire
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return The structure size in bytes
+ */
+uint32_t bcmbal_tm_sched_cfg_data_get_packed_length(const bcmbal_tm_sched_cfg_data *this, bcmbal_presence_mask fields_present);
+
+/** Unpacks a bcmbal_tm_sched_cfg_data from bytes
+ *
+ * \param this Pointer to the object to unpack
+ * \param buf Pointer to the buffer to read from
+ * \param extra_mem Pointer to the first location in memory to use to store
+ * pointer fields that are NULL. Setting this to NULL will cause an error when
+ * a NULL pointer is encountered.
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the unpack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_tm_sched_cfg_data_unpack(bcmbal_tm_sched_cfg_data *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present);
+
+/** Scans past a packed bcmbal_tm_sched_cfg_data struct and collects memory
+ * requirements above and beyond sizeof()
+ *
+ * \param packed A stream pointing to the packed byte stream
+ * \param extra_mem Number of additional storage bytes required
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE on success, FALSE on failure
+ */
+bcmos_bool bcmbal_tm_sched_cfg_data_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present);
+
+/** Checks if any field in the bcmbal_tm_sched_cfg_data is out of bounds
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \param failed_prop Reference to the property that was out of range (only set
+ * on failure)
+ * \return TRUE if all fields are in the correct range, FALSE otherwise
+ */
+bcmos_bool bcmbal_tm_sched_cfg_data_bounds_check(const bcmbal_tm_sched_cfg_data *this, bcmbal_presence_mask fields_present, bcmbal_tm_sched_cfg_id *failed_prop);
+
+/** Initializes a bcmbal_tm_sched_ind_data struct. This sets all fields to
+ * default values.
+ *
+ * \param this Pointer to the structure
+ * \param fields_present Bitmask of which fields are present in the structure.
+ */
+void bcmbal_tm_sched_ind_data_set_default(bcmbal_tm_sched_ind_data *this, bcmbal_presence_mask fields_present);
+
+/** Packs a bcmbal_tm_sched_ind_data to bytes
+ *
+ * \param this Pointer to the object to pack
+ * \param buf Pointer to the buffer to write to
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the pack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_tm_sched_ind_data_pack(const bcmbal_tm_sched_ind_data *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present);
+
+/** Gets the number of bytes that a bcmbal_tm_sched_ind_data would occupy on the
+ * wire
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return The structure size in bytes
+ */
+uint32_t bcmbal_tm_sched_ind_data_get_packed_length(const bcmbal_tm_sched_ind_data *this, bcmbal_presence_mask fields_present);
+
+/** Unpacks a bcmbal_tm_sched_ind_data from bytes
+ *
+ * \param this Pointer to the object to unpack
+ * \param buf Pointer to the buffer to read from
+ * \param extra_mem Pointer to the first location in memory to use to store
+ * pointer fields that are NULL. Setting this to NULL will cause an error when
+ * a NULL pointer is encountered.
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE if the unpack was successful, FALSE otherwise
+ */
+bcmos_bool bcmbal_tm_sched_ind_data_unpack(bcmbal_tm_sched_ind_data *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present);
+
+/** Scans past a packed bcmbal_tm_sched_ind_data struct and collects memory
+ * requirements above and beyond sizeof()
+ *
+ * \param packed A stream pointing to the packed byte stream
+ * \param extra_mem Number of additional storage bytes required
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \return TRUE on success, FALSE on failure
+ */
+bcmos_bool bcmbal_tm_sched_ind_data_scan(bcmbal_buf *packed, uint32_t *extra_mem, bcmbal_presence_mask fields_present);
+
+/** Checks if any field in the bcmbal_tm_sched_ind_data is out of bounds
+ *
+ * \param fields_present Bitmask of which fields are present in the structure.
+ * \param failed_prop Reference to the property that was out of range (only set
+ * on failure)
+ * \return TRUE if all fields are in the correct range, FALSE otherwise
+ */
+bcmos_bool bcmbal_tm_sched_ind_data_bounds_check(const bcmbal_tm_sched_ind_data *this, bcmbal_presence_mask fields_present, bcmbal_tm_sched_ind_id *failed_prop);
+#endif /* BAL_MODEL_FUNCS */
diff --git a/bal_release/src/lib/libobjmsg/bal_msg.c b/bal_release/src/lib/libobjmsg/bal_msg.c
new file mode 100644
index 0000000..285be80
--- /dev/null
+++ b/bal_release/src/lib/libobjmsg/bal_msg.c
@@ -0,0 +1,220 @@
+/******************************************************************************
+ *
+ * <:copyright-BRCM:2016:DUAL/GPL:standard
+ *
+ * Copyright (c) 2016 Broadcom
+ * All Rights Reserved
+ *
+ * Unless you and Broadcom execute a separate written software license
+ * agreement governing use of this software, this software is licensed
+ * to you under the terms of the GNU General Public License version 2
+ * (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
+ * with the following added to such license:
+ *
+ * As a special exception, the copyright holders of this software give
+ * you permission to link this software with independent modules, and
+ * to copy and distribute the resulting executable under terms of your
+ * choice, provided that you also meet, for each linked independent
+ * module, the terms and conditions of the license of that module.
+ * An independent module is a module which is not derived from this
+ * software. The special exception does not apply to any modifications
+ * of the software.
+ *
+ * Not withstanding the above, under no circumstances may you combine
+ * this software in any way with any other Broadcom software provided
+ * under a license other than the GPL, without Broadcom's express prior
+ * written consent.
+ *
+ * :>
+ *
+ *****************************************************************************/
+
+/**
+ * @file bal_msg.c
+ * @brief BAL message helper functions
+ * @addtogroup ctrlr
+ */
+#include <bal_msg.h>
+#include <bal_obj_msg_pack_unpack.h>
+
+/*
+ * Clone BAL message
+ * Returns payload_ptr of the clone
+ */
+void *bcmbal_msg_clone(void *bal_obj)
+{
+ bal_comm_msg_hdr *msg_hdr = bcmbal_bal_hdr_get(bal_obj);
+ bal_comm_msg_hdr *clone_hdr = NULL;
+ bcmos_errno err = bcmbal_obj_msg_clone(&clone_hdr, msg_hdr);
+ return ((int)err >= 0) ? bcmbal_payload_ptr_get(clone_hdr) : NULL;
+}
+
+/*
+ * Send a BAL message given the payload pointer
+ */
+bcmos_errno bcmbal_msg_send(bcmos_msg_queue *queue, void *msg_payload, bcmos_msg_send_flags flags)
+{
+ bcmos_msg *packed_msg = NULL;
+ bcmos_errno err;
+
+ /* pack and send */
+ err = bcmbal_obj_msg_pack(bcmbal_bal_hdr_get(msg_payload), &packed_msg);
+ if (err != BCM_ERR_OK)
+ return err;
+
+ err = bcmos_msg_send(queue, packed_msg, flags);
+
+ if ((flags & BCMOS_MSG_SEND_NO_FREE_ON_ERROR) == 0)
+ {
+ /* Release the original message */
+ bcmbal_msg_free(msg_payload);
+ }
+ else if (err != BCM_ERR_OK)
+ {
+ /* bcmos_msg_send() failed, but packed_msg wasn't released because of the flag. */
+ bcmos_msg_free(packed_msg);
+ }
+
+ return err;
+}
+
+/*
+ * Call callback in the context of the target module and pass it the BAL message pointer
+ */
+bcmos_errno bcmbal_msg_call(void *msg_payload,
+ bcmos_module_id module, F_bcmos_msg_handler cb, bcmos_msg_send_flags flags)
+{
+ bcmos_msg *m = bcmbal_bcmos_hdr_get(msg_payload);
+ m->handler = cb;
+ return bcmos_msg_send_to_module(module, m, flags);
+}
+
+bcmos_errno bcmbal_msg_recv(bcmos_msg_queue *queue, uint32_t timeout, void **msg_payload)
+{
+ bcmos_errno ret;
+ bcmos_msg *msg;
+ bal_comm_msg_hdr *unpacked_msg = (*msg_payload) ? bcmbal_bal_hdr_get(*msg_payload) : NULL;
+
+ do {
+ ret = bcmos_msg_recv(queue, timeout, &msg);
+ if(BCM_ERR_OK != ret)
+ {
+ bcmos_printf("%s: error during bcmos_msg_recv (error:%s)\n",
+ __FUNCTION__,
+ bcmos_strerror(ret));
+ break;
+ }
+
+ /* Got a message. Now unpack it */
+ ret = bcmbal_obj_msg_unpack(msg, &unpacked_msg);
+ bcmos_msg_free(msg); /* release packed message. It is no longer needed */
+ if (BCM_ERR_OK != ret)
+ {
+ bcmos_printf("%s: bcmbal_obj_msg_unpack (error:%s)\n",
+ __FUNCTION__, bcmos_strerror(ret));
+ break;
+ }
+
+ /* If message was allocated in unpack - assign it */
+ if (! *msg_payload)
+ *msg_payload = bcmbal_payload_ptr_get(unpacked_msg);
+
+ } while (0);
+
+ return ret;
+}
+
+int32_t bcmbal_bal_msg_hdr_get_packed_length(void)
+{
+ return 21; /* See bcmbal_bal_msg_hdr_pack() */
+}
+
+static int32_t bcmbal_bal_msg_hdr_get_ex_id_offset(void)
+{
+ return 16; /* See bcmbal_bal_msg_hdr_pack() */
+}
+
+/** Pack a BAL message header to a byte stream */
+bcmos_errno bcmbal_bal_msg_hdr_pack(const bal_comm_msg_hdr *msg, bcmbal_buf *buf)
+{
+ bcmos_bool ret;
+
+ /* bcmos_msg header pack... (8 bytes post-pack) */
+ ret = bcmbal_buf_write_u32(buf, buf->len);
+
+ ret = ret && bcmbal_buf_write_u16(buf, (uint16_t)msg->m.type);
+ ret = ret && bcmbal_buf_write_u8(buf, (uint8_t)msg->m.instance);
+ ret = ret && bcmbal_buf_write_u8(buf, (uint8_t)msg->m.sender);
+
+ /* ...and then the rest of the header (15 bytes post-pack) */
+ ret = ret && bcmbal_buf_write_u8(buf, msg->version_major);
+ ret = ret && bcmbal_buf_write_u8(buf, msg->version_minor);
+ ret = ret && bcmbal_buf_write_u32(buf, msg->msg_id); /* the msg_id cannot be compressed */
+ ret = ret && bcmbal_buf_write_u16(buf, (uint16_t)msg->msg_type);
+ ret = ret && bcmbal_buf_write_u32(buf, msg->ex_id);
+ ret = ret && bcmbal_buf_write_u8(buf, msg->sender);
+
+ return ret ? BCM_ERR_OK : BCM_ERR_OVERFLOW;
+}
+
+/** Unpack a BAL message header from a byte stream */
+bcmos_errno bcmbal_bal_msg_hdr_unpack(bal_comm_msg_hdr *msg, bcmbal_buf *buf)
+{
+ uint16_t m_type;
+ uint8_t m_instance;
+ uint8_t m_sender;
+ uint32_t m_size;
+
+ uint8_t version_major;
+ uint8_t version_minor;
+ uint32_t msg_id;
+ uint16_t msg_type;
+ uint32_t ex_id;
+ uint8_t sender;
+
+ bcmos_bool ret;
+
+ ret = bcmbal_buf_read_u32(buf, &m_size);
+ ret = ret && bcmbal_buf_read_u16(buf, &m_type);
+ ret = ret && bcmbal_buf_read_u8(buf, &m_instance);
+ ret = ret && bcmbal_buf_read_u8(buf, &m_sender);
+
+ ret = ret && bcmbal_buf_read_u8(buf, &version_major);
+ ret = ret && bcmbal_buf_read_u8(buf, &version_minor);
+ ret = ret && bcmbal_buf_read_u32(buf, &msg_id);
+ ret = ret && bcmbal_buf_read_u16(buf, &msg_type);
+ ret = ret && bcmbal_buf_read_u32(buf, &ex_id);
+ ret = ret && bcmbal_buf_read_u8(buf, &sender);
+
+ if (ret)
+ {
+ msg->m.type = (bcmos_msg_id)m_type;
+ msg->m.instance = (bcmos_msg_instance)m_instance;
+ msg->m.sender = (bcmos_module_id)m_sender;
+ msg->m.size = m_size;
+
+ msg->version_major = version_major;
+ msg->version_minor = version_minor;
+ msg->msg_id = msg_id;
+ msg->msg_type = msg_type;
+ msg->ex_id = ex_id;
+ msg->sender = sender;
+ }
+
+ return ret ? BCM_ERR_OK : BCM_ERR_OVERFLOW;
+}
+
+/** Peek exchange_id in the received message without unpacking */
+bcmos_errno bcmbal_bal_msg_peek_ex_id(bcmos_msg *msg, uint32_t *ex_id)
+{
+ bcmbal_buf buf;
+ if (msg->size < bcmbal_bal_msg_hdr_get_packed_length())
+ return BCM_ERR_INTERNAL;
+ bcmbal_buf_init(&buf, msg->size, msg->data);
+ bcmolt_buf_set_pos(&buf, bcmbal_bal_msg_hdr_get_ex_id_offset());
+ bcmbal_buf_read_u32(&buf, ex_id);
+ return BCM_ERR_OK;
+}
+
+
+
diff --git a/bal_release/src/lib/libobjmsg/bal_obj_msg_pack_unpack.c b/bal_release/src/lib/libobjmsg/bal_obj_msg_pack_unpack.c
new file mode 100644
index 0000000..519af97
--- /dev/null
+++ b/bal_release/src/lib/libobjmsg/bal_obj_msg_pack_unpack.c
@@ -0,0 +1,558 @@
+#include <bcmos_system.h>
+#include <bal_msg.h>
+#include "bal_obj_msg_pack_unpack.h"
+
+typedef uint32_t (*bcmbal_func_packed_len) (void *this, bcmbal_presence_mask fields_present);
+typedef bcmos_bool (*bcmbal_func_pack) (void *this, bcmbal_buf *buf, bcmbal_presence_mask fields_present);
+typedef bcmos_bool (*bcmbal_func_unpack) (void *this, bcmbal_buf *buf, void **extra_mem, bcmbal_presence_mask fields_present);
+typedef bcmos_bool (*bcmbal_func_mem_scan) (bcmbal_buf * buf, uint32_t * extra_mem, bcmbal_presence_mask fields_present);
+
+/******************************************************************************/
+typedef struct bcmbal_group_info
+{
+ bcmbal_obj_id obj_type;
+ bcmbal_mgt_group group;
+ uint16_t subgroup;
+ uint32_t size;
+ uint32_t container_size; /* sizeof() the key/data container struct (0 for key groups) */
+ uint32_t data_offset; /* offsetof() data field within container struct (0 for key groups) */
+ bcmbal_func_packed_len get_packed_length;
+ bcmbal_func_pack pack;
+ bcmbal_func_unpack unpack;
+ bcmbal_func_mem_scan mem_scan;
+} bcmbal_group_info;
+
+/******************************************************************************/
+typedef struct bcmbal_group_ids
+{
+ uint32_t subgroup_count;
+ bcmbal_obj_group_id *subgroup_ids;
+} bcmbal_group_ids;
+
+/******************************************************************************/
+typedef struct bcmbal_instance_info
+{
+ int8_t offset;
+ int8_t size;
+} bcmbal_instance_info;
+
+/******************************************************************************/
+static bcmbal_group_info group_info_access_terminal_key = { BCMBAL_OBJ_ID_ACCESS_TERMINAL, BCMBAL_MGT_GROUP_KEY, 0, sizeof(bcmbal_access_terminal_key), 0, 0, (bcmbal_func_packed_len) bcmbal_access_terminal_key_get_packed_length, (bcmbal_func_pack) bcmbal_access_terminal_key_pack, (bcmbal_func_unpack) bcmbal_access_terminal_key_unpack, bcmbal_access_terminal_key_scan };
+static bcmbal_group_info group_info_access_terminal_cfg = { BCMBAL_OBJ_ID_ACCESS_TERMINAL, BCMBAL_MGT_GROUP_CFG, 0, sizeof(bcmbal_access_terminal_cfg_data), sizeof(bcmbal_access_terminal_cfg), offsetof(bcmbal_access_terminal_cfg, data), (bcmbal_func_packed_len) bcmbal_access_terminal_cfg_data_get_packed_length, (bcmbal_func_pack) bcmbal_access_terminal_cfg_data_pack, (bcmbal_func_unpack) bcmbal_access_terminal_cfg_data_unpack, bcmbal_access_terminal_cfg_data_scan };
+static bcmbal_group_info group_info_access_terminal_ind = { BCMBAL_OBJ_ID_ACCESS_TERMINAL, BCMBAL_MGT_GROUP_AUTO, 0, sizeof(bcmbal_access_terminal_ind_data), sizeof(bcmbal_access_terminal_ind), offsetof(bcmbal_access_terminal_ind, data), (bcmbal_func_packed_len) bcmbal_access_terminal_ind_data_get_packed_length, (bcmbal_func_pack) bcmbal_access_terminal_ind_data_pack, (bcmbal_func_unpack) bcmbal_access_terminal_ind_data_unpack, bcmbal_access_terminal_ind_data_scan };
+static bcmbal_group_info group_info_flow_key = { BCMBAL_OBJ_ID_FLOW, BCMBAL_MGT_GROUP_KEY, 0, sizeof(bcmbal_flow_key), 0, 0, (bcmbal_func_packed_len) bcmbal_flow_key_get_packed_length, (bcmbal_func_pack) bcmbal_flow_key_pack, (bcmbal_func_unpack) bcmbal_flow_key_unpack, bcmbal_flow_key_scan };
+static bcmbal_group_info group_info_flow_cfg = { BCMBAL_OBJ_ID_FLOW, BCMBAL_MGT_GROUP_CFG, 0, sizeof(bcmbal_flow_cfg_data), sizeof(bcmbal_flow_cfg), offsetof(bcmbal_flow_cfg, data), (bcmbal_func_packed_len) bcmbal_flow_cfg_data_get_packed_length, (bcmbal_func_pack) bcmbal_flow_cfg_data_pack, (bcmbal_func_unpack) bcmbal_flow_cfg_data_unpack, bcmbal_flow_cfg_data_scan };
+static bcmbal_group_info group_info_flow_stat = { BCMBAL_OBJ_ID_FLOW, BCMBAL_MGT_GROUP_STAT, 0, sizeof(bcmbal_flow_stat_data), sizeof(bcmbal_flow_stat), offsetof(bcmbal_flow_stat, data), (bcmbal_func_packed_len) bcmbal_flow_stat_data_get_packed_length, (bcmbal_func_pack) bcmbal_flow_stat_data_pack, (bcmbal_func_unpack) bcmbal_flow_stat_data_unpack, bcmbal_flow_stat_data_scan };
+static bcmbal_group_info group_info_flow_ind = { BCMBAL_OBJ_ID_FLOW, BCMBAL_MGT_GROUP_AUTO, 0, sizeof(bcmbal_flow_ind_data), sizeof(bcmbal_flow_ind), offsetof(bcmbal_flow_ind, data), (bcmbal_func_packed_len) bcmbal_flow_ind_data_get_packed_length, (bcmbal_func_pack) bcmbal_flow_ind_data_pack, (bcmbal_func_unpack) bcmbal_flow_ind_data_unpack, bcmbal_flow_ind_data_scan };
+static bcmbal_group_info group_info_group_key = { BCMBAL_OBJ_ID_GROUP, BCMBAL_MGT_GROUP_KEY, 0, sizeof(bcmbal_group_key), 0, 0, (bcmbal_func_packed_len) bcmbal_group_key_get_packed_length, (bcmbal_func_pack) bcmbal_group_key_pack, (bcmbal_func_unpack) bcmbal_group_key_unpack, bcmbal_group_key_scan };
+static bcmbal_group_info group_info_group_cfg = { BCMBAL_OBJ_ID_GROUP, BCMBAL_MGT_GROUP_CFG, 0, sizeof(bcmbal_group_cfg_data), sizeof(bcmbal_group_cfg), offsetof(bcmbal_group_cfg, data), (bcmbal_func_packed_len) bcmbal_group_cfg_data_get_packed_length, (bcmbal_func_pack) bcmbal_group_cfg_data_pack, (bcmbal_func_unpack) bcmbal_group_cfg_data_unpack, bcmbal_group_cfg_data_scan };
+static bcmbal_group_info group_info_interface_key = { BCMBAL_OBJ_ID_INTERFACE, BCMBAL_MGT_GROUP_KEY, 0, sizeof(bcmbal_interface_key), 0, 0, (bcmbal_func_packed_len) bcmbal_interface_key_get_packed_length, (bcmbal_func_pack) bcmbal_interface_key_pack, (bcmbal_func_unpack) bcmbal_interface_key_unpack, bcmbal_interface_key_scan };
+static bcmbal_group_info group_info_interface_cfg = { BCMBAL_OBJ_ID_INTERFACE, BCMBAL_MGT_GROUP_CFG, 0, sizeof(bcmbal_interface_cfg_data), sizeof(bcmbal_interface_cfg), offsetof(bcmbal_interface_cfg, data), (bcmbal_func_packed_len) bcmbal_interface_cfg_data_get_packed_length, (bcmbal_func_pack) bcmbal_interface_cfg_data_pack, (bcmbal_func_unpack) bcmbal_interface_cfg_data_unpack, bcmbal_interface_cfg_data_scan };
+static bcmbal_group_info group_info_interface_stat = { BCMBAL_OBJ_ID_INTERFACE, BCMBAL_MGT_GROUP_STAT, 0, sizeof(bcmbal_interface_stat_data), sizeof(bcmbal_interface_stat), offsetof(bcmbal_interface_stat, data), (bcmbal_func_packed_len) bcmbal_interface_stat_data_get_packed_length, (bcmbal_func_pack) bcmbal_interface_stat_data_pack, (bcmbal_func_unpack) bcmbal_interface_stat_data_unpack, bcmbal_interface_stat_data_scan };
+static bcmbal_group_info group_info_interface_ind = { BCMBAL_OBJ_ID_INTERFACE, BCMBAL_MGT_GROUP_AUTO, 0, sizeof(bcmbal_interface_ind_data), sizeof(bcmbal_interface_ind), offsetof(bcmbal_interface_ind, data), (bcmbal_func_packed_len) bcmbal_interface_ind_data_get_packed_length, (bcmbal_func_pack) bcmbal_interface_ind_data_pack, (bcmbal_func_unpack) bcmbal_interface_ind_data_unpack, bcmbal_interface_ind_data_scan };
+static bcmbal_group_info group_info_packet_key = { BCMBAL_OBJ_ID_PACKET, BCMBAL_MGT_GROUP_KEY, 0, sizeof(bcmbal_packet_key), 0, 0, (bcmbal_func_packed_len) bcmbal_packet_key_get_packed_length, (bcmbal_func_pack) bcmbal_packet_key_pack, (bcmbal_func_unpack) bcmbal_packet_key_unpack, bcmbal_packet_key_scan };
+static bcmbal_group_info group_info_packet_cfg = { BCMBAL_OBJ_ID_PACKET, BCMBAL_MGT_GROUP_CFG, 0, sizeof(bcmbal_packet_cfg_data), sizeof(bcmbal_packet_cfg), offsetof(bcmbal_packet_cfg, data), (bcmbal_func_packed_len) bcmbal_packet_cfg_data_get_packed_length, (bcmbal_func_pack) bcmbal_packet_cfg_data_pack, (bcmbal_func_unpack) bcmbal_packet_cfg_data_unpack, bcmbal_packet_cfg_data_scan };
+static bcmbal_group_info group_info_packet_ind = { BCMBAL_OBJ_ID_PACKET, BCMBAL_MGT_GROUP_AUTO, 0, sizeof(bcmbal_packet_ind_data), sizeof(bcmbal_packet_ind), offsetof(bcmbal_packet_ind, data), (bcmbal_func_packed_len) bcmbal_packet_ind_data_get_packed_length, (bcmbal_func_pack) bcmbal_packet_ind_data_pack, (bcmbal_func_unpack) bcmbal_packet_ind_data_unpack, bcmbal_packet_ind_data_scan };
+static bcmbal_group_info group_info_subscriber_terminal_key = { BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL, BCMBAL_MGT_GROUP_KEY, 0, sizeof(bcmbal_subscriber_terminal_key), 0, 0, (bcmbal_func_packed_len) bcmbal_subscriber_terminal_key_get_packed_length, (bcmbal_func_pack) bcmbal_subscriber_terminal_key_pack, (bcmbal_func_unpack) bcmbal_subscriber_terminal_key_unpack, bcmbal_subscriber_terminal_key_scan };
+static bcmbal_group_info group_info_subscriber_terminal_cfg = { BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL, BCMBAL_MGT_GROUP_CFG, 0, sizeof(bcmbal_subscriber_terminal_cfg_data), sizeof(bcmbal_subscriber_terminal_cfg), offsetof(bcmbal_subscriber_terminal_cfg, data), (bcmbal_func_packed_len) bcmbal_subscriber_terminal_cfg_data_get_packed_length, (bcmbal_func_pack) bcmbal_subscriber_terminal_cfg_data_pack, (bcmbal_func_unpack) bcmbal_subscriber_terminal_cfg_data_unpack, bcmbal_subscriber_terminal_cfg_data_scan };
+static bcmbal_group_info group_info_subscriber_terminal_stat = { BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL, BCMBAL_MGT_GROUP_STAT, 0, sizeof(bcmbal_subscriber_terminal_stat_data), sizeof(bcmbal_subscriber_terminal_stat), offsetof(bcmbal_subscriber_terminal_stat, data), (bcmbal_func_packed_len) bcmbal_subscriber_terminal_stat_data_get_packed_length, (bcmbal_func_pack) bcmbal_subscriber_terminal_stat_data_pack, (bcmbal_func_unpack) bcmbal_subscriber_terminal_stat_data_unpack, bcmbal_subscriber_terminal_stat_data_scan };
+static bcmbal_group_info group_info_subscriber_terminal_ind = { BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL, BCMBAL_MGT_GROUP_AUTO, 0, sizeof(bcmbal_subscriber_terminal_ind_data), sizeof(bcmbal_subscriber_terminal_ind), offsetof(bcmbal_subscriber_terminal_ind, data), (bcmbal_func_packed_len) bcmbal_subscriber_terminal_ind_data_get_packed_length, (bcmbal_func_pack) bcmbal_subscriber_terminal_ind_data_pack, (bcmbal_func_unpack) bcmbal_subscriber_terminal_ind_data_unpack, bcmbal_subscriber_terminal_ind_data_scan };
+static bcmbal_group_info group_info_tm_queue_key = { BCMBAL_OBJ_ID_TM_QUEUE, BCMBAL_MGT_GROUP_KEY, 0, sizeof(bcmbal_tm_queue_key), 0, 0, (bcmbal_func_packed_len) bcmbal_tm_queue_key_get_packed_length, (bcmbal_func_pack) bcmbal_tm_queue_key_pack, (bcmbal_func_unpack) bcmbal_tm_queue_key_unpack, bcmbal_tm_queue_key_scan };
+static bcmbal_group_info group_info_tm_queue_cfg = { BCMBAL_OBJ_ID_TM_QUEUE, BCMBAL_MGT_GROUP_CFG, 0, sizeof(bcmbal_tm_queue_cfg_data), sizeof(bcmbal_tm_queue_cfg), offsetof(bcmbal_tm_queue_cfg, data), (bcmbal_func_packed_len) bcmbal_tm_queue_cfg_data_get_packed_length, (bcmbal_func_pack) bcmbal_tm_queue_cfg_data_pack, (bcmbal_func_unpack) bcmbal_tm_queue_cfg_data_unpack, bcmbal_tm_queue_cfg_data_scan };
+static bcmbal_group_info group_info_tm_queue_stat = { BCMBAL_OBJ_ID_TM_QUEUE, BCMBAL_MGT_GROUP_STAT, 0, sizeof(bcmbal_tm_queue_stat_data), sizeof(bcmbal_tm_queue_stat), offsetof(bcmbal_tm_queue_stat, data), (bcmbal_func_packed_len) bcmbal_tm_queue_stat_data_get_packed_length, (bcmbal_func_pack) bcmbal_tm_queue_stat_data_pack, (bcmbal_func_unpack) bcmbal_tm_queue_stat_data_unpack, bcmbal_tm_queue_stat_data_scan };
+static bcmbal_group_info group_info_tm_queue_ind = { BCMBAL_OBJ_ID_TM_QUEUE, BCMBAL_MGT_GROUP_AUTO, 0, sizeof(bcmbal_tm_queue_ind_data), sizeof(bcmbal_tm_queue_ind), offsetof(bcmbal_tm_queue_ind, data), (bcmbal_func_packed_len) bcmbal_tm_queue_ind_data_get_packed_length, (bcmbal_func_pack) bcmbal_tm_queue_ind_data_pack, (bcmbal_func_unpack) bcmbal_tm_queue_ind_data_unpack, bcmbal_tm_queue_ind_data_scan };
+static bcmbal_group_info group_info_tm_sched_key = { BCMBAL_OBJ_ID_TM_SCHED, BCMBAL_MGT_GROUP_KEY, 0, sizeof(bcmbal_tm_sched_key), 0, 0, (bcmbal_func_packed_len) bcmbal_tm_sched_key_get_packed_length, (bcmbal_func_pack) bcmbal_tm_sched_key_pack, (bcmbal_func_unpack) bcmbal_tm_sched_key_unpack, bcmbal_tm_sched_key_scan };
+static bcmbal_group_info group_info_tm_sched_cfg = { BCMBAL_OBJ_ID_TM_SCHED, BCMBAL_MGT_GROUP_CFG, 0, sizeof(bcmbal_tm_sched_cfg_data), sizeof(bcmbal_tm_sched_cfg), offsetof(bcmbal_tm_sched_cfg, data), (bcmbal_func_packed_len) bcmbal_tm_sched_cfg_data_get_packed_length, (bcmbal_func_pack) bcmbal_tm_sched_cfg_data_pack, (bcmbal_func_unpack) bcmbal_tm_sched_cfg_data_unpack, bcmbal_tm_sched_cfg_data_scan };
+static bcmbal_group_info group_info_tm_sched_ind = { BCMBAL_OBJ_ID_TM_SCHED, BCMBAL_MGT_GROUP_AUTO, 0, sizeof(bcmbal_tm_sched_ind_data), sizeof(bcmbal_tm_sched_ind), offsetof(bcmbal_tm_sched_ind, data), (bcmbal_func_packed_len) bcmbal_tm_sched_ind_data_get_packed_length, (bcmbal_func_pack) bcmbal_tm_sched_ind_data_pack, (bcmbal_func_unpack) bcmbal_tm_sched_ind_data_unpack, bcmbal_tm_sched_ind_data_scan };
+static bcmbal_group_info *group_info[] = { &group_info_access_terminal_key, &group_info_access_terminal_cfg, &group_info_access_terminal_ind, &group_info_flow_key, &group_info_flow_cfg, &group_info_flow_stat, &group_info_flow_ind, &group_info_group_key, &group_info_group_cfg, &group_info_interface_key, &group_info_interface_cfg, &group_info_interface_stat, &group_info_interface_ind, &group_info_packet_key, &group_info_packet_cfg, &group_info_packet_ind, &group_info_subscriber_terminal_key, &group_info_subscriber_terminal_cfg, &group_info_subscriber_terminal_stat, &group_info_subscriber_terminal_ind, &group_info_tm_queue_key, &group_info_tm_queue_cfg, &group_info_tm_queue_stat, &group_info_tm_queue_ind, &group_info_tm_sched_key, &group_info_tm_sched_cfg, &group_info_tm_sched_ind };
+static bcmbal_obj_group_id group_ids_access_terminal_key[] = { BCMBAL_OBJ_GROUP_ID_ACCESS_TERMINAL_KEY };
+static bcmbal_obj_group_id group_ids_access_terminal_cfg[] = { BCMBAL_OBJ_GROUP_ID_ACCESS_TERMINAL_CFG };
+static bcmbal_obj_group_id group_ids_access_terminal_auto[] = { BCMBAL_OBJ_GROUP_ID_ACCESS_TERMINAL_IND };
+static bcmbal_obj_group_id group_ids_flow_key[] = { BCMBAL_OBJ_GROUP_ID_FLOW_KEY };
+static bcmbal_obj_group_id group_ids_flow_cfg[] = { BCMBAL_OBJ_GROUP_ID_FLOW_CFG };
+static bcmbal_obj_group_id group_ids_flow_stat[] = { BCMBAL_OBJ_GROUP_ID_FLOW_STAT };
+static bcmbal_obj_group_id group_ids_flow_auto[] = { BCMBAL_OBJ_GROUP_ID_FLOW_IND };
+static bcmbal_obj_group_id group_ids_group_key[] = { BCMBAL_OBJ_GROUP_ID_GROUP_KEY };
+static bcmbal_obj_group_id group_ids_group_cfg[] = { BCMBAL_OBJ_GROUP_ID_GROUP_CFG };
+static bcmbal_obj_group_id group_ids_interface_key[] = { BCMBAL_OBJ_GROUP_ID_INTERFACE_KEY };
+static bcmbal_obj_group_id group_ids_interface_cfg[] = { BCMBAL_OBJ_GROUP_ID_INTERFACE_CFG };
+static bcmbal_obj_group_id group_ids_interface_stat[] = { BCMBAL_OBJ_GROUP_ID_INTERFACE_STAT };
+static bcmbal_obj_group_id group_ids_interface_auto[] = { BCMBAL_OBJ_GROUP_ID_INTERFACE_IND };
+static bcmbal_obj_group_id group_ids_packet_key[] = { BCMBAL_OBJ_GROUP_ID_PACKET_KEY };
+static bcmbal_obj_group_id group_ids_packet_cfg[] = { BCMBAL_OBJ_GROUP_ID_PACKET_CFG };
+static bcmbal_obj_group_id group_ids_packet_auto[] = { BCMBAL_OBJ_GROUP_ID_PACKET_IND };
+static bcmbal_obj_group_id group_ids_subscriber_terminal_key[] = { BCMBAL_OBJ_GROUP_ID_SUBSCRIBER_TERMINAL_KEY };
+static bcmbal_obj_group_id group_ids_subscriber_terminal_cfg[] = { BCMBAL_OBJ_GROUP_ID_SUBSCRIBER_TERMINAL_CFG };
+static bcmbal_obj_group_id group_ids_subscriber_terminal_stat[] = { BCMBAL_OBJ_GROUP_ID_SUBSCRIBER_TERMINAL_STAT };
+static bcmbal_obj_group_id group_ids_subscriber_terminal_auto[] = { BCMBAL_OBJ_GROUP_ID_SUBSCRIBER_TERMINAL_IND };
+static bcmbal_obj_group_id group_ids_tm_queue_key[] = { BCMBAL_OBJ_GROUP_ID_TM_QUEUE_KEY };
+static bcmbal_obj_group_id group_ids_tm_queue_cfg[] = { BCMBAL_OBJ_GROUP_ID_TM_QUEUE_CFG };
+static bcmbal_obj_group_id group_ids_tm_queue_stat[] = { BCMBAL_OBJ_GROUP_ID_TM_QUEUE_STAT };
+static bcmbal_obj_group_id group_ids_tm_queue_auto[] = { BCMBAL_OBJ_GROUP_ID_TM_QUEUE_IND };
+static bcmbal_obj_group_id group_ids_tm_sched_key[] = { BCMBAL_OBJ_GROUP_ID_TM_SCHED_KEY };
+static bcmbal_obj_group_id group_ids_tm_sched_cfg[] = { BCMBAL_OBJ_GROUP_ID_TM_SCHED_CFG };
+static bcmbal_obj_group_id group_ids_tm_sched_auto[] = { BCMBAL_OBJ_GROUP_ID_TM_SCHED_IND };
+static bcmbal_group_ids group_ids_obj_access_terminal[] = { { 1, group_ids_access_terminal_key }, { 1, group_ids_access_terminal_cfg }, { 0, NULL }, { 1, group_ids_access_terminal_auto }, { 0, NULL } };
+static bcmbal_group_ids group_ids_obj_flow[] = { { 1, group_ids_flow_key }, { 1, group_ids_flow_cfg }, { 1, group_ids_flow_stat }, { 1, group_ids_flow_auto }, { 0, NULL } };
+static bcmbal_group_ids group_ids_obj_group[] = { { 1, group_ids_group_key }, { 1, group_ids_group_cfg }, { 0, NULL }, { 0, NULL }, { 0, NULL } };
+static bcmbal_group_ids group_ids_obj_interface[] = { { 1, group_ids_interface_key }, { 1, group_ids_interface_cfg }, { 1, group_ids_interface_stat }, { 1, group_ids_interface_auto }, { 0, NULL } };
+static bcmbal_group_ids group_ids_obj_packet[] = { { 1, group_ids_packet_key }, { 1, group_ids_packet_cfg }, { 0, NULL }, { 1, group_ids_packet_auto }, { 0, NULL } };
+static bcmbal_group_ids group_ids_obj_subscriber_terminal[] = { { 1, group_ids_subscriber_terminal_key }, { 1, group_ids_subscriber_terminal_cfg }, { 1, group_ids_subscriber_terminal_stat }, { 1, group_ids_subscriber_terminal_auto }, { 0, NULL } };
+static bcmbal_group_ids group_ids_obj_tm_queue[] = { { 1, group_ids_tm_queue_key }, { 1, group_ids_tm_queue_cfg }, { 1, group_ids_tm_queue_stat }, { 1, group_ids_tm_queue_auto }, { 0, NULL } };
+static bcmbal_group_ids group_ids_obj_tm_sched[] = { { 1, group_ids_tm_sched_key }, { 1, group_ids_tm_sched_cfg }, { 0, NULL }, { 1, group_ids_tm_sched_auto }, { 0, NULL } };
+static bcmbal_group_ids *group_ids[] = { group_ids_obj_access_terminal, group_ids_obj_flow, group_ids_obj_group, group_ids_obj_interface, group_ids_obj_packet, group_ids_obj_subscriber_terminal, group_ids_obj_tm_queue, group_ids_obj_tm_sched };
+static bcmbal_presence_mask readonly_prop_mask[] = { (1ULL << BCMBAL_ACCESS_TERMINAL_CFG_ID_OPER_STATUS) | (1ULL << BCMBAL_ACCESS_TERMINAL_CFG_ID_IWF_MODE), 1ULL << BCMBAL_FLOW_CFG_ID_OPER_STATUS, (1ULL << BCMBAL_GROUP_CFG_ID_FLOWS) | (1ULL << BCMBAL_GROUP_CFG_ID_OWNER), (1ULL << BCMBAL_INTERFACE_CFG_ID_OPER_STATUS) | (1ULL << BCMBAL_INTERFACE_CFG_ID_SUB_TERM_ID_LIST), 0, (((1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_OPER_STATUS) | (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_SVC_PORT_ID)) | (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_SVC_PORT_ID_LIST)) | (1ULL << BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_AGG_PORT_ID_LIST), (1ULL << BCMBAL_TM_QUEUE_CFG_ID_CREATION_MODE) | (1ULL << BCMBAL_TM_QUEUE_CFG_ID_REF_COUNT), ((1ULL << BCMBAL_TM_SCHED_CFG_ID_CREATION_MODE) | (1ULL << BCMBAL_TM_SCHED_CFG_ID_QUEUES)) | (1ULL << BCMBAL_TM_SCHED_CFG_ID_SUB_SCHEDS) };
+static bcmbal_instance_info instance_info[] = { { offsetof(bcmbal_access_terminal_key, access_term_id), sizeof(bcmbal_access_id) }, { offsetof(bcmbal_flow_key, flow_id), sizeof(bcmbal_flow_id) }, { offsetof(bcmbal_group_key, group_id), sizeof(bcmbal_group_id) }, { offsetof(bcmbal_interface_key, intf_id), sizeof(uint32_t) }, { offsetof(bcmbal_packet_key, reserved), sizeof(uint32_t) }, { offsetof(bcmbal_subscriber_terminal_key, sub_term_id), sizeof(bcmbal_sub_id) }, { offsetof(bcmbal_tm_queue_key, id), sizeof(bcmbal_tm_queue_id) }, { offsetof(bcmbal_tm_sched_key, id), sizeof(bcmbal_tm_sched_id) } };
+
+/** Converts a specific object type, group and subgroup into a generic group ID.
+ *
+ * \param obj The object type that corresponds to the group ID.
+ * \param group The group type that corresponds to the group ID.
+ * \param subgroup The subgroup index that corresponds to the group ID.
+ * \param group_id The generic group ID.
+ * \return An error code or BCM_ERR_OK for success.
+ */
+static bcmos_errno _bcmbal_obj_group_id_combine(bcmbal_obj_id obj, bcmbal_mgt_group group, uint16_t subgroup, bcmbal_obj_group_id *group_id)
+{
+ if ((obj >= BCMBAL_OBJ_ID__NUM_OF) || (group >= BCMBAL_MGT_GROUP__NUM_OF) || (group_ids[obj] == NULL) || (subgroup >= group_ids[obj][group].subgroup_count))
+ {
+ return BCM_ERR_RANGE;
+ }
+
+ *group_id = group_ids[obj][group].subgroup_ids[subgroup];
+ return BCM_ERR_OK;
+}
+
+/******************************************************************************/
+static bcmos_bool _bcmbal_get_group_info(const bcmbal_obj *msg, bcmbal_group_info **group, bcmbal_group_info **key)
+{
+ bcmbal_obj_group_id group_id;
+ bcmbal_obj_group_id key_id;
+ bcmos_errno err;
+
+ err = _bcmbal_obj_group_id_combine(msg->obj_type, msg->group, msg->subgroup, &group_id);
+ if (err != BCM_ERR_OK)
+ {
+ return BCMOS_FALSE;
+ }
+
+ err = _bcmbal_obj_group_id_combine(msg->obj_type, BCMBAL_MGT_GROUP_KEY, 0, &key_id);
+ if (err != BCM_ERR_OK)
+ {
+ return BCMOS_FALSE;
+ }
+
+ *group = group_info[group_id];
+ *key = group_info[key_id];
+ return BCMOS_TRUE;
+}
+
+/** Gets the number of bytes a message would occupy when packed.
+ *
+ * \param msg The message to scan.
+ * \return The size in bytes if > 0, or an error as defined in bcmos_errno.
+ */
+static int32_t _bcmbal_obj_msg_packed_length_get(bcmbal_obj *msg)
+{
+ uint8_t *key_ptr;
+ bcmbal_group_info *group;
+ bcmbal_group_info *key;
+ int32_t ret;
+
+ /* First, get the total length of the packed BAL msg header and the packed BAL object header */
+ ret = bcmbal_bal_msg_hdr_get_packed_length() + bcmbal_obj_msg_hdr_get_packed_length();
+
+ if (!_bcmbal_get_group_info(msg, &group, &key))
+ {
+ return (int32_t) BCM_ERR_MSG_ERROR;
+ }
+
+ key_ptr = (uint8_t *) (msg + 1);
+
+ /* Add the length of the packed key */
+ ret += key->get_packed_length(key_ptr, BCMBAL_PRESENCE_MASK_ALL);
+
+ /* Add the length of the packed object itself (for those attributes that have been specified, if any) */
+ if (bcmbal_obj_msg_should_pack_data(msg) && (group->get_packed_length != NULL))
+ {
+ uint8_t *data_ptr = (uint8_t *) ((long)msg + group->data_offset);
+ ret += group->get_packed_length(data_ptr, msg->presence_mask);
+ }
+
+ return ret;
+}
+
+/** Packs a message to a byte stream.
+ *
+ * \param msg The message to pack.
+ * \param buf The stream to pack into.
+ * \return An error code or BCM_ERR_OK for success.
+ */
+static bcmos_errno _bcmbal_obj_msg_pack(bal_comm_msg_hdr *msg, bcmbal_buf *buf)
+{
+ uint8_t *key_ptr;
+ bcmos_errno err;
+ bcmbal_group_info *group;
+ bcmbal_group_info *key;
+ bcmbal_obj *bal_obj = (bcmbal_obj *)bcmbal_payload_ptr_get(msg);
+
+ if (!_bcmbal_get_group_info(bal_obj, &group, &key))
+ {
+ return BCM_ERR_MSG_ERROR;
+ }
+
+ err = bcmbal_bal_msg_hdr_pack(msg, buf);
+ if (err != BCM_ERR_OK)
+ {
+ return err;
+ }
+
+ err = bcmbal_obj_msg_hdr_pack(bal_obj, buf);
+ if (err != BCM_ERR_OK)
+ {
+ return err;
+ }
+
+ key_ptr = (uint8_t *) (bal_obj + 1);
+ if (!key->pack(key_ptr, buf, BCMBAL_PRESENCE_MASK_ALL))
+ {
+ return BCM_ERR_OVERFLOW;
+ }
+
+ if (bcmbal_obj_msg_should_pack_data(bal_obj) && (group->pack != NULL))
+ {
+ uint8_t *data_ptr = (uint8_t *) ((long)bal_obj + group->data_offset);
+ if (!group->pack(data_ptr, buf, bal_obj->presence_mask))
+ {
+ return BCM_ERR_OVERFLOW;
+ }
+ }
+
+ return err;
+}
+
+/* scan the input buffer to determine how much memory will be required to unpack variable-sized lists */
+static bcmos_errno bcmbal_obj_msg_list_mem_scan(bcmbal_buf *buf, const bcmbal_obj *hdr, const bcmbal_group_info *group, const bcmbal_group_info *key, uint32_t *size)
+{
+ uint32_t pos_before_scan = bcmbal_buf_get_used(buf);
+
+ if (!key->mem_scan(buf, size, BCMBAL_PRESENCE_MASK_ALL))
+ {
+ return BCM_ERR_OVERFLOW;
+ }
+
+ if (bcmbal_obj_msg_should_pack_data(hdr) && (group->mem_scan != NULL) && !group->mem_scan(buf, size, hdr->presence_mask))
+ {
+ return BCM_ERR_OVERFLOW;
+ }
+
+ if (!bcmbal_buf_rewind(buf, bcmbal_buf_get_used(buf) - pos_before_scan))
+ {
+ return BCM_ERR_OVERFLOW;
+ }
+
+ return BCM_ERR_OK;
+}
+
+/** Unpacks a message from a byte stream.
+ *
+ * This unpacks the message from the packed form into the struct following the "unpacked" pointer. There are several
+ * special cases:
+ *
+ * if *unpacked == NULL:
+ * *unpacked will be allocated dynamically via bcmos_calloc, in a contiguous block of memory with the struct
+ * itself followed by the memory required for all variable-sized lists.
+ *
+ * if (*unpacked)->list_buf != NULL:
+ * When a variable-length list is encountered in the input stream, and the array field we're unpacking into is NULL,
+ * memory will be allocated starting from (*unpacked)->list_buf. If multiple such lists exist, they will share this
+ * buffer. If the (*unpacked)->list_buf_size is not large enough, this will return BCM_ERR_INSUFFICIENT_LIST_MEM.
+ *
+ * \param buf The stream to unpack from.
+ * \param unpacked A pointer to the resulting unpacked BAL message starting at the bal header.
+ * \return The number of bytes unpacked if > 0, or an error as defined in bcmos_errno.
+ */
+static int32_t _bcmbal_obj_msg_unpack(bcmbal_buf *buf, bal_comm_msg_hdr **unpacked)
+{
+ bcmbal_obj bal_obj_hdr;
+ bal_comm_msg_hdr *bal_msg_hdr = &bal_obj_hdr.comm_hdr;
+ bcmos_errno err;
+ bcmbal_group_info *group;
+ bcmbal_group_info *key;
+ bcmos_bool did_malloc = BCMOS_FALSE;
+ uint8_t *key_ptr;
+ void *list_mem = NULL;
+ void **list_mem_ptr = NULL;
+ uint32_t size = 0;
+ bcmbal_obj *unpacked_bal_obj;
+
+ /* Preserve header fields that are not packed */
+ if (*unpacked != NULL)
+ memcpy(&bal_obj_hdr, bcmbal_payload_ptr_get(*unpacked), sizeof(bal_obj_hdr));
+ else
+ memset(&bal_obj_hdr, 0, sizeof(bal_obj_hdr));
+
+ err = bcmbal_bal_msg_hdr_unpack(bal_msg_hdr, buf);
+ if (err != BCM_ERR_OK)
+ {
+ return err;
+ }
+
+ err = bcmbal_obj_msg_hdr_unpack(&bal_obj_hdr, buf);
+ if (err != BCM_ERR_OK)
+ {
+ return err;
+ }
+
+ if (!_bcmbal_get_group_info(&bal_obj_hdr, &group, &key))
+ {
+ return BCM_ERR_MSG_ERROR;
+ }
+
+ /* If the caller did not allocate a space to unpack into, then alloc one */
+ if (*unpacked == NULL)
+ {
+ size = group->container_size == 0 ? sizeof(bcmbal_obj) + key->size : group->container_size;
+
+ err = bcmbal_obj_msg_list_mem_scan(buf, &bal_obj_hdr, group, key, &size);
+ if (err != BCM_ERR_OK)
+ {
+ return err;
+ }
+
+ /* allocate a bal msg header, and a BAL object with data length of "size" */
+ unpacked_bal_obj = bcmbal_msg_calloc(size);
+ if (unpacked_bal_obj == NULL)
+ {
+ return BCM_ERR_NOMEM;
+ }
+
+ *unpacked = bcmbal_bal_hdr_get(unpacked_bal_obj);
+
+ list_mem = (uint8_t *)unpacked_bal_obj + group->container_size;
+ list_mem_ptr = &list_mem;
+ did_malloc = BCMOS_TRUE;
+ }
+ else
+ {
+ unpacked_bal_obj = bcmbal_payload_ptr_get(*unpacked);
+
+ if (unpacked_bal_obj->list_buf != NULL)
+ {
+ err = bcmbal_obj_msg_list_mem_scan(buf, &bal_obj_hdr, group, key, &size);
+ if (err != BCM_ERR_OK)
+ {
+ return err;
+ }
+
+ if (size > unpacked_bal_obj->list_buf_size)
+ {
+ return BCM_ERR_INSUFFICIENT_LIST_MEM;
+ }
+
+ list_mem = unpacked_bal_obj->list_buf;
+ list_mem_ptr = &list_mem;
+ }
+
+ size += group->container_size == 0 ? sizeof(bcmbal_obj) + key->size : group->container_size;
+ }
+
+ /* copy the bal message header into the unpack buffer */
+ bal_msg_hdr->m.size = size - sizeof(bcmos_msg);
+
+ /* copy the bal object header into the unpack buffer */
+ *unpacked_bal_obj = bal_obj_hdr;
+
+ key_ptr = (uint8_t *) (unpacked_bal_obj + 1);
+ if (!key->unpack(key_ptr, buf, list_mem_ptr, BCMBAL_PRESENCE_MASK_ALL))
+ {
+ if (did_malloc)
+ {
+ bcmbal_msg_free(unpacked_bal_obj);
+ *unpacked = NULL;
+ }
+
+ return BCM_ERR_OVERFLOW;
+ }
+
+ if (bcmbal_obj_msg_should_pack_data(&bal_obj_hdr))
+ {
+ uint8_t *data_ptr = (uint8_t *)unpacked_bal_obj + group->data_offset;
+ if ((group->unpack != NULL) && !group->unpack(data_ptr, buf, list_mem_ptr, unpacked_bal_obj->presence_mask))
+ {
+ if (did_malloc)
+ {
+ bcmbal_msg_free(unpacked_bal_obj);
+ *unpacked = NULL;
+ }
+
+ return BCM_ERR_OVERFLOW;
+ }
+ }
+
+ return size;
+}
+
+bcmos_errno bcmbal_obj_msg_pack(bal_comm_msg_hdr *unpacked_bal_msg, /* unpacked msg */ bcmos_msg **packed_msg) /* packed message */
+{
+ bcmbal_buf buf;
+ bcmos_errno ret;
+ bcmbal_obj *unpacked_obj;
+ int32_t packed_payload_len;
+ uint8_t *packed_payload;
+ bcmos_msg *os_msg;
+
+ *packed_msg = NULL; /* Initialization */
+
+ /* Recover a pointer to the UNPACKED bal object */
+ unpacked_obj = (bcmbal_obj *)bcmbal_payload_ptr_get(unpacked_bal_msg);
+
+ /* Calculate packed length */
+ packed_payload_len = _bcmbal_obj_msg_packed_length_get(unpacked_obj);
+ if (packed_payload_len < 0) return (bcmos_errno) packed_payload_len;
+
+ os_msg = (bcmos_msg *)bcmos_alloc(packed_payload_len + sizeof(bcmos_msg));
+
+ if (NULL == os_msg) return BCM_ERR_NORES;
+
+ memset(os_msg, 0, sizeof(bcmos_msg));
+ packed_payload = (uint8_t *) (os_msg + 1);
+ bcmbal_buf_init(&buf, packed_payload_len, packed_payload);
+ if (BCM_ERR_OK != (ret = _bcmbal_obj_msg_pack(unpacked_bal_msg, &buf)))
+ {
+ bcmos_free(os_msg);
+ return ret;
+ }
+
+ os_msg->data = packed_payload;
+ os_msg->size = packed_payload_len;
+ os_msg->type = unpacked_bal_msg->m.type;
+ os_msg->instance = unpacked_bal_msg->m.instance;
+ os_msg->sender = unpacked_bal_msg->m.sender;
+ *packed_msg = os_msg;
+
+ return BCM_ERR_OK;
+}
+
+bcmos_errno bcmbal_obj_msg_unpack(bcmos_msg *packed_msg, /* packed message */ bal_comm_msg_hdr **unpacked_bal_msg) /* the unpacked bal msg */
+{
+ bcmbal_buf buf;
+ int32_t unpacked_len;
+ bal_comm_msg_hdr *bal_msg_hdr = *unpacked_bal_msg;
+ uint8_t *packed_payload = packed_msg->data;
+ uint32_t packed_payload_len = packed_msg->size;
+
+ bcmbal_buf_init(&buf, packed_payload_len, packed_payload);
+
+ unpacked_len = _bcmbal_obj_msg_unpack(&buf, &bal_msg_hdr);
+
+ if (unpacked_len < 0)
+ {
+ return (bcmos_errno) unpacked_len;
+ }
+
+ if (((bcmbal_obj *) (bcmbal_payload_ptr_get(bal_msg_hdr)))->version != BCMBAL_OBJ_VERSION)
+ {
+ bcmos_printf("Illegal BAL object version detected. Found: %d, Should be:%d\n", ((bcmbal_obj *) (bcmbal_payload_ptr_get(bal_msg_hdr)))->version, BCMBAL_OBJ_VERSION);
+
+ return BCM_ERR_PARSE;
+ }
+
+ *unpacked_bal_msg = bal_msg_hdr;
+
+ /* NOTE: Do NOT Free the passed in original received message! */
+ return BCM_ERR_OK;
+}
+
+bcmos_errno _bcmbal_obj_group_id_split(bcmbal_obj_group_id group_id, bcmbal_obj_id *obj, bcmbal_mgt_group *group, uint16_t *subgroup)
+{
+ if ((group_id >= BCMBAL_OBJ_GROUP_ID__NUM_OF) || (group_info[group_id] == NULL))
+ {
+ return BCM_ERR_RANGE;
+ }
+
+ *obj = group_info[group_id]->obj_type;
+ *group = group_info[group_id]->group;
+ *subgroup = group_info[group_id]->subgroup;
+ return BCM_ERR_OK;
+}
+
+/******************************************************************************/
+uint8_t bcmbal_obj_msg_instance(const bcmbal_obj *msg)
+{
+ const void *val_ptr;
+
+ if (msg->obj_type >= BCMBAL_OBJ_ID__NUM_OF)
+ {
+ return 0;
+ }
+
+ if (instance_info[msg->obj_type].offset < 0)
+ {
+ return 0;
+ }
+
+ val_ptr = ((const uint8_t *)(msg + 1)) + instance_info[msg->obj_type].offset;
+
+ /** This is probably not the smartest way to do this... TODO: revisit */
+ switch (instance_info[msg->obj_type].size)
+ {
+ case 1:
+ return *((const uint8_t *)val_ptr);
+ case 2:
+ return (uint8_t) (*((const uint16_t *)val_ptr));
+ case 4:
+ return (uint8_t) (*((const uint32_t *)val_ptr));
+ case 8:
+ return (uint8_t) (*((const uint64_t *)val_ptr));
+ default:
+ return 0;
+ }
+}
+
+/******************************************************************************/
+bcmos_errno bcmbal_obj_msg_clone(bal_comm_msg_hdr **dest, bal_comm_msg_hdr *src)
+{
+ bcmos_errno err;
+ int32_t packed_obj_msg_len;
+ uint8_t *mem;
+ bcmbal_buf buf;
+
+ packed_obj_msg_len = _bcmbal_obj_msg_packed_length_get(bcmbal_payload_ptr_get(src));
+ if (packed_obj_msg_len < 0)
+ {
+ return (bcmos_errno) packed_obj_msg_len;
+ }
+
+ /* Allocate a BAL msg (this includes the BAL msg hdr PLUS the BAL object) */
+ mem = bcmos_calloc((uint32_t) packed_obj_msg_len);
+ if (mem == NULL)
+ {
+ return BCM_ERR_NOMEM;
+ }
+
+ bcmbal_buf_init(&buf, (uint32_t) packed_obj_msg_len, mem);
+ err = _bcmbal_obj_msg_pack(src, &buf);
+ if (err != BCM_ERR_OK)
+ {
+ bcmos_free(mem);
+ return err;
+ }
+
+ buf.curr = buf.start;
+ err = _bcmbal_obj_msg_unpack(&buf, dest);
+ bcmos_free(mem);
+ return err;
+}
+
+/******************************************************************************/
+bcmos_errno bcmbal_get_prop_readonly_mask(bcmbal_obj_id obj, bcmbal_presence_mask *mask)
+{
+ if (obj >= BCMBAL_OBJ_ID__NUM_OF)
+ {
+ return BCM_ERR_RANGE;
+ }
+
+ *mask = readonly_prop_mask[obj];
+ return BCM_ERR_OK;
+}
diff --git a/bal_release/src/lib/libobjmsg/bal_obj_msg_pack_unpack.h b/bal_release/src/lib/libobjmsg/bal_obj_msg_pack_unpack.h
new file mode 100644
index 0000000..1837a99
--- /dev/null
+++ b/bal_release/src/lib/libobjmsg/bal_obj_msg_pack_unpack.h
@@ -0,0 +1,51 @@
+#ifndef BAL_OBJ_MSG_PACK_UNPACK_H_
+#define BAL_OBJ_MSG_PACK_UNPACK_H_
+
+#include "bcmos_system.h"
+#include "bcmos_errno.h"
+#include "bal_model_types.h"
+#include "bal_model_funcs.h"
+
+
+bcmos_errno bcmbal_obj_msg_pack(bal_comm_msg_hdr *unpacked_bal_msg,/* unpacked msg */
+ bcmos_msg **packed_msg); /* packed message */
+
+bcmos_errno bcmbal_obj_msg_unpack(bcmos_msg *packed_msg, /* packed message */
+ bal_comm_msg_hdr **unpacked_bal_msg); /* the unpacked bal msg */
+
+/** Returns the instance number of a given message, as determined by the object key.
+ *
+ * \param msg The message to check.
+ * \return The instance number of the message.
+ */
+uint8_t bcmbal_obj_msg_instance(const bcmbal_obj *msg);
+
+/** Gets a mask of all readonly properties for an object's cfg group.
+ *
+ * \param obj The objecct to check.
+ * \param mask A mask of bits set to 1 per read-only property.
+ * \return An error code or BCM_ERR_OK for success.
+ */
+bcmos_errno bcmbal_get_prop_readonly_mask(bcmbal_obj_id obj, bcmbal_presence_mask *mask);
+
+/** Clones a message by packing it to a buffer then unpacking it into the destination message.
+ * This uses _bcmbal_obj_msg_unpack, so if *dest is NULL, memory will by allocated dynamically using bcmos_calloc.
+ *
+ * \param dest A pointer to the location in memory that will hold the cloned message.
+ * \param src The message that should be copied.
+ * \return An error code or BCM_ERR_OK for success.
+ */
+bcmos_errno bcmbal_obj_msg_clone(bal_comm_msg_hdr **dest, bal_comm_msg_hdr *src);
+
+/** Converts a generic group ID into a specific object type, group and subgroup.
+ *
+ * \param group_id The generic group ID.
+ * \param obj The object type that corresponds to the group ID.
+ * \param group The group type that corresponds to the group ID.
+ * \param subgroup The subgroup index that corresponds to the group ID.
+ * \return An error code or BCM_ERR_OK for success.
+ */
+bcmos_errno _bcmbal_obj_group_id_split(bcmbal_obj_group_id group_id, bcmbal_obj_id *obj, bcmbal_mgt_group *group, uint16_t *subgroup);
+
+
+#endif /* BAL_OBJ_MSG_PACK_UNPACK_H_ */
diff --git a/bal_release/src/lib/librscmgr/Makefile b/bal_release/src/lib/librscmgr/Makefile
new file mode 100644
index 0000000..d94cd45
--- /dev/null
+++ b/bal_release/src/lib/librscmgr/Makefile
@@ -0,0 +1,37 @@
+###############################################################################
+#
+# <:copyright-BRCM:2016:DUAL/GPL:standard
+#
+# Copyright (c) 2016 Broadcom
+# All Rights Reserved
+#
+# Unless you and Broadcom execute a separate written software license
+# agreement governing use of this software, this software is licensed
+# to you under the terms of the GNU General Public License version 2
+# (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
+# with the following added to such license:
+#
+# As a special exception, the copyright holders of this software give
+# you permission to link this software with independent modules, and
+# to copy and distribute the resulting executable under terms of your
+# choice, provided that you also meet, for each linked independent
+# module, the terms and conditions of the license of that module.
+# An independent module is a module which is not derived from this
+# software. The special exception does not apply to any modifications
+# of the software.
+#
+# Not withstanding the above, under no circumstances may you combine
+# this software in any way with any other Broadcom software provided
+# under a license other than the GPL, without Broadcom's express prior
+# written consent.
+#
+# :>
+#
+###############################################################################
+MOD_NAME = rscmgr
+MOD_TYPE = lib
+MOD_DEPS = dev_log cli os_cli bal_api
+srcs = rsc_mgr.c rsc_mgr_common.c rsc_mgr_cli.c
+
+# XXX To break a circular dependency, we should avoid adding bal_core to MOD_DEPS
+EXTRA_CFLAGS += -I$(SRC_DIR)/../../core/main
diff --git a/bal_release/src/lib/librscmgr/rsc_mgr.c b/bal_release/src/lib/librscmgr/rsc_mgr.c
new file mode 100644
index 0000000..bd8afec
--- /dev/null
+++ b/bal_release/src/lib/librscmgr/rsc_mgr.c
@@ -0,0 +1,922 @@
+/******************************************************************************
+ *
+ * <:copyright-BRCM:2016:DUAL/GPL:standard
+ *
+ * Copyright (c) 2016 Broadcom
+ * All Rights Reserved
+ *
+ * Unless you and Broadcom execute a separate written software license
+ * agreement governing use of this software, this software is licensed
+ * to you under the terms of the GNU General Public License version 2
+ * (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
+ * with the following added to such license:
+ *
+ * As a special exception, the copyright holders of this software give
+ * you permission to link this software with independent modules, and
+ * to copy and distribute the resulting executable under terms of your
+ * choice, provided that you also meet, for each linked independent
+ * module, the terms and conditions of the license of that module.
+ * An independent module is a module which is not derived from this
+ * software. The special exception does not apply to any modifications
+ * of the software.
+ *
+ * Not withstanding the above, under no circumstances may you combine
+ * this software in any way with any other Broadcom software provided
+ * under a license other than the GPL, without Broadcom's express prior
+ * written consent.
+ *
+ * :>
+ *
+ *****************************************************************************/
+
+#include <bcmolt_host_api.h>
+#include <bcm_dev_log.h>
+#include <bal_objs.h>
+#include <bal_api.h>
+#include <bal_cli.h>
+#include <bcmolt_math.h>
+#include <bcm_topo.h>
+#include "rsc_mgr_common.h"
+#include "rsc_mgr.h"
+
+#define GPON_NUM_OF_ALLOC_IDS 1024
+#define XGPON_NUM_OF_ALLOC_IDS 2048
+
+#define GPON_NUM_OF_GEM_PORT_IDS_PER_PON 4096
+#define XGPON_NUM_OF_GEM_PORT_IDS_PER_PON 8192
+
+#define RSC_MGR_ALLOC_ID_LAST_DATA(pon_id, first_data_alloc_id) \
+ ((first_data_alloc_id) + (bcmolt_pon_alloc_id)(RSC_MGR_PON_TOPO_CONTEXT(pon_id)->num_of_alloc_ids - 1))
+#define RSC_MGR_ALLOC_ID_IS_VALID_DATA(pon_id, alloc_id, first_data_alloc_id) ( \
+ ((alloc_id) >= (first_data_alloc_id) && (alloc_id) <= RSC_MGR_ALLOC_ID_LAST_DATA(pon_id, first_data_alloc_id)))
+#define RSC_MGR_ALLOC_ID_IS_VALID(pon_id, alloc_id, first_data_alloc_id) ( \
+ ((alloc_id) <= RSC_MGR_ALLOC_ID_LAST_DEFAULT(pon_id)) || \
+ RSC_MGR_ALLOC_ID_IS_VALID_DATA(pon_id, alloc_id, first_data_alloc_id))
+
+#define RSC_MGR_GEM_PORT_ID_LAST_DEFAULT(pon_id) ((bcmolt_pon_gem_port_id)(bcm_topo_pon_get_max_num_of_onus(pon_id) - 1))
+#define RSC_MGR_GEM_PORT_ID_LAST_DATA(pon_id, first_data_port_id) \
+ ((first_data_port_id) + (bcmolt_pon_gem_port_id)(RSC_MGR_PON_TOPO_CONTEXT(pon_id)->num_of_gem_ports - bcm_topo_pon_get_max_num_of_onus(pon_id) - 1))
+#define RSC_MGR_GEM_PORT_ID_IS_VALID_DATA(pon_id, gem_port_id, first_data_port_id) ( \
+ ((gem_port_id) >= (first_data_port_id) && (gem_port_id) <= RSC_MGR_GEM_PORT_ID_LAST_DATA(pon_id, first_data_port_id)))
+#define RSC_MGR_GEM_PORT_ID_IS_VALID(pon_id, gem_port_id, first_data_port_id) ( \
+ ((gem_port_id) <= RSC_MGR_GEM_PORT_ID_LAST_DEFAULT(pon_id)) || \
+ RSC_MGR_GEM_PORT_ID_IS_VALID_DATA(pon_id, gem_port_id, first_data_port_id))
+
+#define RSC_MGR_FOR_EACH_ALLOC_INDEX(pon_id, alloc_index) \
+ for (alloc_index = (bcmolt_pon_alloc_index)0; alloc_index < (bcmolt_pon_alloc_index)RSC_MGR_PON_TOPO_CONTEXT(pon_id)->num_of_alloc_ids; alloc_index++)
+
+#define RSC_MGR_FOR_EACH_GEM_INDEX(pon_id, gem_port_index) \
+ for (gem_port_index = 0; (bcmolt_pon_gem_port_index)gem_port_index < (bcmolt_pon_gem_port_index)RSC_MGR_PON_TOPO_CONTEXT(pon_id)->num_of_gem_ports; gem_port_index++)
+
+#define RSC_MGR_FOR_EACH_TM_SCHED_AUTO_INDEX(tm_sched_auto_index) \
+ for (tm_sched_auto_index = 0; (bcmbal_tm_sched_id_index)tm_sched_auto_index < (bcmbal_tm_sched_id_index)tm_context.num_of_tm_sched_auto_key_ids; tm_sched_auto_index++)
+
+/* Because GEM port 0 .. 127 are used for OMCI, we can start allocating from 128. But due to a bug in Maple A0, 128 .. 159 must not be used. So we start from 256. */
+#define MIN_BASE_GEM_PORT_ID_GPON 256
+
+#define NUM_OF_TM_SCHED_AUTO_KEY_IDS 2048
+#define MIN_BASE_TM_SCHED_AUTO_ID 2048
+
+
+rsc_mgr_context_t rsc_mgr_context;
+rsc_mgr_tm_context tm_context;
+
+
+static bcmos_errno rsc_mgr_alloc_validate_common(bcmbal_intf_id access_int_id);
+static bcmos_errno rsc_mgr_obj_get(bcmbal_intf_id access_int_id, rsc_mgr_obj_id obj_id, rsc_mgr_obj_rsc *obj_rsc, rsc_mgr_obj **obj, dev_log_id log_id);
+static bcmos_errno rsc_mgr_obj_store_user_data(rsc_mgr_obj *obj, void *user_data);
+static bcmos_errno rsc_mgr_obj_remove_user_data(rsc_mgr_obj *obj, void *user_data);
+
+
+static bcmos_bool rsc_mgr_is_valid_data_alloc_id_cb(bcmolt_pon_ni pon_id, rsc_mgr_obj_id id, rsc_mgr_obj_id min_data_obj_id)
+{
+ return (bcm_topo_pon_is_valid(pon_id) && RSC_MGR_ALLOC_ID_IS_VALID_DATA(pon_id, id, min_data_obj_id));
+}
+
+static rsc_mgr_obj_id rsc_mgr_get_last_data_alloc_id_cb(bcmolt_pon_ni pon_id, rsc_mgr_obj_id min_data_obj_id)
+{
+ return (rsc_mgr_obj_id)(bcmolt_pon_alloc_id)RSC_MGR_ALLOC_ID_LAST_DATA(pon_id, min_data_obj_id);
+}
+
+static bcmos_bool rsc_mgr_is_valid_data_gem_cb(bcmolt_pon_ni pon_id, rsc_mgr_obj_id id, rsc_mgr_obj_id min_data_obj_id)
+{
+ return (bcm_topo_pon_is_valid(pon_id) && RSC_MGR_GEM_PORT_ID_IS_VALID_DATA(pon_id, id, min_data_obj_id));
+}
+
+static rsc_mgr_obj_id rsc_mgr_get_last_data_gem_cb(bcmolt_pon_ni pon_id, rsc_mgr_obj_id min_data_obj_id)
+{
+ return (rsc_mgr_obj_id)(bcmolt_pon_gem_port_id)RSC_MGR_GEM_PORT_ID_LAST_DATA(pon_id, min_data_obj_id);
+}
+static bcmos_bool rsc_mgr_is_valid_data_tm_sched_auto_id(rsc_mgr_obj_id id)
+{
+ return (id >= MIN_BASE_TM_SCHED_AUTO_ID && id < MIN_BASE_TM_SCHED_AUTO_ID + NUM_OF_TM_SCHED_AUTO_KEY_IDS);
+}
+
+static bcmos_bool rsc_mgr_is_valid_data_tm_sched_auto_id_cb(bcmolt_pon_ni pon_id, rsc_mgr_obj_id id, rsc_mgr_obj_id min_data_obj_id)
+{
+ return rsc_mgr_is_valid_data_tm_sched_auto_id(id);
+}
+
+static rsc_mgr_obj_id rsc_mgr_get_last_data_tm_sched_auto_id_cb(bcmolt_pon_ni pon_id, rsc_mgr_obj_id min_data_obj_id)
+{
+ return (rsc_mgr_obj_id)(min_data_obj_id + NUM_OF_TM_SCHED_AUTO_KEY_IDS - 1);
+}
+
+
+static bcmos_errno rsc_mgr_obj_alloc(bcmbal_intf_id access_int_id, rsc_mgr_obj_id *obj_id, uint32_t range_size, rsc_mgr_obj_type type, rsc_mgr_obj_rsc *obj_rsc, void *user_data, dev_log_id log_id)
+{
+ rsc_mgr_obj *obj;
+ bcmos_errno rc;
+
+ if (range_size < RSC_MGR_MIN_RANGE_SIZE || range_size > RSC_MGR_MAX_RANGE_SIZE)
+ {
+ BCM_LOG(ERROR, log_id, "Range size must be in the range %u .. %u\n", RSC_MGR_MIN_RANGE_SIZE, RSC_MGR_MAX_RANGE_SIZE);
+ return BCM_ERR_PARM;
+ }
+
+ if (*obj_id)
+ {
+ rc = rsc_mgr_obj_get(access_int_id, *obj_id, obj_rsc, &obj, log_id);
+ if (rc != BCM_ERR_OK)
+ return rc;
+
+ if (obj->range_size != range_size)
+ {
+ BCM_LOG(ERROR, log_id, "When reusing a range of %ss, range size (%d) must be exactly the same as the range from creation (%u)\n",
+ obj_rsc->obj_name, range_size, obj->range_size);
+ return BCM_ERR_PARM;
+ }
+
+ if (obj->type != type)
+ {
+ BCM_LOG(ERROR, log_id, "When reusing %ss, type (%d) must be exactly the same as the type from creation (%u)\n",
+ obj_rsc->obj_name, type, obj->type);
+ return BCM_ERR_PARM;
+ }
+ }
+ else
+ {
+ rsc_mgr_obj *base_obj;
+ rsc_mgr_obj *last_obj;
+ rsc_mgr_obj *obj_iter;
+
+ /* Find the first free range that fits ("first-fit" algorithm). */
+ TAILQ_FOREACH(obj_iter, &obj_rsc->free_objs, list)
+ {
+ if (range_size <= obj_iter->range_size)
+ break;
+ }
+ if (!obj_iter)
+ {
+ BCM_LOG(ERROR, log_id, "No free %ss\n", obj_rsc->obj_name);
+ return BCM_ERR_NORES;
+ }
+ *obj_id = obj_iter->id;
+
+ if (range_size < obj_iter->range_size)
+ {
+ /* Insert a smaller range (decrease by 'range_size') to the list of free objects. It will replace the old free range. */
+ base_obj = &obj_iter[range_size];
+ last_obj = &obj_iter[obj_iter->range_size - 1];
+ TAILQ_INSERT_HEAD(&obj_rsc->free_objs, base_obj, list);
+ base_obj->range_size = obj_iter->range_size - range_size;
+ last_obj->base_obj = base_obj;
+ }
+
+ /* Move 'range_size' objects from the list of free objects to the list of allocated objects. */
+ base_obj = obj_iter;
+ last_obj = &obj_iter[range_size - 1];
+ TAILQ_REMOVE(&obj_rsc->free_objs, base_obj, list);
+ TAILQ_INSERT_HEAD(&obj_rsc->allocated_objs, base_obj, list);
+ base_obj->range_size = range_size;
+ base_obj->type = type;
+ last_obj->base_obj = base_obj;
+
+ obj = obj_iter;
+ /* since new object, initialize the user data list */
+ TAILQ_INIT(&obj->user_data_list);
+
+ }
+ obj->ref_count++;
+
+ /** store user data (flow entry pointer) in a linked list inside the object */
+ rsc_mgr_obj_store_user_data(obj, user_data);
+
+ return BCM_ERR_OK;
+}
+
+static bcmos_errno rsc_mgr_obj_free(bcmbal_intf_id access_int_id, rsc_mgr_obj_id obj_id, rsc_mgr_obj_rsc *obj_rsc, void *user_data, dev_log_id log_id)
+{
+ rsc_mgr_obj *obj;
+ rsc_mgr_obj *last_obj;
+ bcmos_errno rc;
+
+ rc = rsc_mgr_obj_get(access_int_id, obj_id, obj_rsc, &obj, log_id);
+ if (rc != BCM_ERR_OK)
+ return rc;
+
+ obj->ref_count--;
+ /** remove user data (flow entry pointer) from the linked list inside the object */
+ rsc_mgr_obj_remove_user_data(obj, user_data);
+
+ if (!obj->ref_count)
+ {
+ rsc_mgr_obj *next_obj = NULL;
+ rsc_mgr_obj *prev_obj = NULL;
+
+ /* Validate that going to the next object won't overflow the array. */
+ if (obj < &obj_rsc->objs[obj_rsc->num_of_objs - 1] && &obj[obj->range_size] <= &obj_rsc->objs[obj_rsc->num_of_objs - 1])
+ {
+ /* Check if the next ID is in the free list (according to its reference count).
+ * If true -> we can merge obj's range with the next range. */
+ if (!obj[obj->range_size].ref_count)
+ next_obj = &obj[obj->range_size];
+ }
+
+ /* Validate that going to the base of the previous range won't underflow the array. */
+ if (obj > obj_rsc->objs)
+ {
+ /* Check if the base ID of the previous range is in the free list (according to the base ID's reference count).
+ * If true -> we can merge obj's range with the previous range. */
+ if (obj[-1].base_obj && !obj[-1].base_obj->ref_count)
+ prev_obj = obj[-1].base_obj;
+ }
+
+ /* First remove the object from the allocated linked list. */
+ TAILQ_REMOVE(&obj_rsc->allocated_objs, obj, list);
+ last_obj = &obj[obj->range_size - 1];
+ obj->type = RSC_MGR_OBJ_TYPE_INVALID; /* Clear type. */
+ if (next_obj && !prev_obj)
+ {
+ /* Merge only with next range. */
+ TAILQ_INSERT_BEFORE(next_obj, obj, list);
+ TAILQ_REMOVE(&obj_rsc->free_objs, next_obj, list);
+ obj->range_size += next_obj->range_size;
+ last_obj->base_obj = NULL;
+ next_obj->range_size = 0;
+ last_obj = &obj[obj->range_size - 1];
+ last_obj->base_obj = obj;
+ }
+ else if (!next_obj && prev_obj)
+ {
+ /* Merge only with previous range. */
+ prev_obj->range_size += obj->range_size;
+ obj->range_size = 0;
+ last_obj->base_obj = prev_obj;
+ }
+ else if (next_obj && prev_obj)
+ {
+ /* Merge with both next and previous ranges. */
+ prev_obj->range_size += obj->range_size + next_obj->range_size;
+ obj->range_size = 0;
+ next_obj->range_size = 0;
+ TAILQ_REMOVE(&obj_rsc->free_objs, next_obj, list);
+ last_obj->base_obj = NULL;
+ last_obj = &prev_obj[prev_obj->range_size - 1];
+ last_obj->base_obj = prev_obj;
+ }
+ else
+ {
+ /* No merge at all. */
+ TAILQ_INSERT_TAIL(&obj_rsc->free_objs, obj, list);
+ }
+ }
+
+ return BCM_ERR_OK;
+}
+
+static bcmos_errno rsc_mgr_obj_get(bcmbal_intf_id access_int_id, rsc_mgr_obj_id obj_id, rsc_mgr_obj_rsc *obj_rsc, rsc_mgr_obj **obj, dev_log_id log_id)
+{
+ bcmos_errno rc;
+
+ rc = rsc_mgr_alloc_validate_common(access_int_id);
+ if (BCM_ERR_OK != rc)
+ return rc;
+
+ if (!obj_rsc->is_valid_data_obj_id_cb(access_int_id, obj_id, obj_rsc->min_data_obj_id))
+ {
+ BCM_LOG(ERROR, log_id, "%s must be in the range %u .. %u\n",
+ obj_rsc->obj_name, obj_rsc->min_data_obj_id, obj_rsc->get_last_data_obj_id_cb(access_int_id, obj_rsc->min_data_obj_id));
+ return BCM_ERR_PARM;
+ }
+
+ *obj = &obj_rsc->objs[obj_id - obj_rsc->min_data_obj_id];
+ /* Only base object must have its reference count > 0. */
+ if (!(*obj)->ref_count)
+ {
+ BCM_LOG(ERROR, log_id, "%s hasn't been allocated before\n", obj_rsc->obj_name);
+ return BCM_ERR_PARM;
+ }
+
+ return BCM_ERR_OK;
+}
+
+/** @brief stores user passed in data in the linked list inside the obj */
+static bcmos_errno rsc_mgr_obj_store_user_data(rsc_mgr_obj *obj, void *user_data)
+{
+ rsc_mgr_user_data_entry *user_data_entry = NULL;
+
+ if (NULL == user_data)
+ return BCM_ERR_OK;
+
+ user_data_entry = bcmos_calloc(sizeof(rsc_mgr_user_data_entry));
+ user_data_entry->user_data = user_data;
+ TAILQ_INSERT_HEAD(&obj->user_data_list, user_data_entry, next);
+
+ return BCM_ERR_OK;
+}
+
+/** @brief removes user data from the linked list inside the obj */
+static bcmos_errno rsc_mgr_obj_remove_user_data(rsc_mgr_obj *obj, void *user_data)
+{
+ rsc_mgr_user_data_entry *user_data_entry = NULL, *user_data_entry_tmp;
+
+ if (NULL == user_data)
+ return BCM_ERR_OK;
+
+ TAILQ_FOREACH_SAFE(user_data_entry, &obj->user_data_list, next, user_data_entry_tmp)
+ {
+ if (user_data == user_data_entry->user_data)
+ break;
+ }
+ TAILQ_REMOVE(&obj->user_data_list, user_data_entry, next);
+
+ user_data_entry->user_data = NULL;
+ bcmos_free(user_data_entry);
+
+ return BCM_ERR_OK;
+}
+
+/** @brief iterator to iterate through the user data list in obj
+ * @note the assumption is if a NULL is returned, then caller code stop the iteration.
+ * */
+static void *rsc_mgr_obj_get_next_user_data(rsc_mgr_obj *obj, void **curr_user_data_entry, void **next_user_data_entry)
+{
+ if (NULL == *curr_user_data_entry)
+ {
+ *curr_user_data_entry = TAILQ_FIRST(&obj->user_data_list);
+ if (*curr_user_data_entry)
+ {
+ *next_user_data_entry = TAILQ_NEXT(((rsc_mgr_user_data_entry *)*curr_user_data_entry), next);
+ return ((rsc_mgr_user_data_entry *)(*curr_user_data_entry))->user_data;
+ }
+ }
+ else
+ {
+ *curr_user_data_entry = *next_user_data_entry;
+ if (*next_user_data_entry)
+ {
+ *next_user_data_entry = TAILQ_NEXT(((rsc_mgr_user_data_entry *)*next_user_data_entry), next);
+ return ((rsc_mgr_user_data_entry *)(*curr_user_data_entry))->user_data;
+ }
+ }
+
+ return NULL;
+}
+
+
+/* Alloc ID (aggregation port ID) */
+static bcmos_errno _rsc_mgr_access_int_base_alloc_id_set(bcmbal_intf_id access_int_id, bcmbal_aggregation_port_id min_data_agg_port_id)
+{
+ bcmolt_pon_alloc_index alloc_index;
+ rsc_mgr_topo_pon_context *topo_context = RSC_MGR_PON_TOPO_CONTEXT(access_int_id);
+
+ if (bcm_topo_pon_get_pon_mode(access_int_id) == BCM_TOPO_PON_MODE_GPON)
+ {
+ bcmolt_gpon_ni_cfg gpon_ni_cfg = {};
+ bcmolt_gpon_ni_cfg_id failed_prop;
+
+ BCMOLT_CFG_PROP_SET(&gpon_ni_cfg, gpon_ni, min_data_alloc_id, min_data_agg_port_id);
+ if (!bcmolt_gpon_ni_cfg_data_bounds_check(&gpon_ni_cfg.data, (1ULL << BCMOLT_GPON_NI_CFG_ID_MIN_DATA_ALLOC_ID), &failed_prop))
+ {
+ BCM_LOG(ERROR, topo_context->log_id, "Minimal data alloc ID is not in the allowed range\n");
+ return BCM_ERR_PARM;
+ }
+ }
+ else
+ {
+ bcmolt_xgpon_ni_cfg xgpon_ni_cfg = {};
+ bcmolt_xgpon_ni_cfg_id failed_prop;
+
+ BCMOLT_CFG_PROP_SET(&xgpon_ni_cfg, xgpon_ni, min_data_alloc_id, min_data_agg_port_id);
+ if (!bcmolt_xgpon_ni_cfg_data_bounds_check(&xgpon_ni_cfg.data, (1ULL << BCMOLT_XGPON_NI_CFG_ID_MIN_DATA_ALLOC_ID), &failed_prop))
+ {
+ BCM_LOG(ERROR, topo_context->log_id, "Minimal data alloc ID is not in the allowed range\n");
+ return BCM_ERR_PARM;
+ }
+ }
+
+ if (!TAILQ_EMPTY(&topo_context->alloc_ids.allocated_objs))
+ {
+ BCM_LOG(ERROR, topo_context->log_id, "Minimal alloc ID cannot be set when there are allocated alloc IDs\n");
+ return BCM_ERR_STATE;
+ }
+
+ topo_context->alloc_ids.min_data_obj_id = (rsc_mgr_obj_id)min_data_agg_port_id;
+ RSC_MGR_FOR_EACH_ALLOC_INDEX(access_int_id, alloc_index)
+ topo_context->alloc_ids.objs[alloc_index].id = topo_context->alloc_ids.min_data_obj_id + alloc_index;
+
+ return BCM_ERR_OK;
+}
+
+bcmos_errno rsc_mgr_access_int_base_alloc_id_set(bcmbal_intf_id access_int_id, bcmbal_aggregation_port_id min_data_agg_port_id)
+{
+ bcmos_errno rc;
+
+ rc = rsc_mgr_alloc_validate_common(access_int_id);
+ if (BCM_ERR_OK != rc)
+ return rc;
+
+ return _rsc_mgr_access_int_base_alloc_id_set(access_int_id, min_data_agg_port_id);
+}
+
+
+static bcmos_errno rsc_mgr_alloc_validate_common(bcmbal_intf_id access_int_id)
+{
+ bcmos_errno rc;
+
+ rc = rsc_mgr_init_validate();
+ if (rc != BCM_ERR_OK)
+ {
+ BCM_LOG(ERROR, rsc_mgr_log_id, "Resource manager is uninitialized\n");
+ return rc;
+ }
+
+ if (!bcm_topo_pon_is_valid(access_int_id))
+ return BCM_ERR_PARM;
+
+ return BCM_ERR_OK;
+}
+
+static bcmos_errno rsc_mgr_alloc_validate_non_unicast(bcmbal_intf_id access_int_id, bcmbal_service_port_id topo_context_gem_port,
+ bcmbal_service_port_id req_gem_port, uint32_t range_size, rsc_mgr_obj_type type,
+ dev_log_id log_id)
+{
+ if (topo_context_gem_port != BCMOLT_PON_GEM_PORT_ID_INVALID && req_gem_port && req_gem_port != topo_context_gem_port)
+ {
+ BCM_LOG(ERROR, log_id, "Access interface already has %s service port ID=%u configured\n", RSC_MGR_OBJ_TYPE_STR(type), topo_context_gem_port);
+ return BCM_ERR_ALREADY;
+ }
+
+ if (range_size > 1)
+ {
+ BCM_LOG(ERROR, log_id, "Range bigger than 1 for %s GEM port is not allowed\n", RSC_MGR_OBJ_TYPE_STR(type));
+ return BCM_ERR_PARM;
+ }
+
+ return BCM_ERR_OK;
+}
+
+bcmos_errno rsc_mgr_alloc_id_alloc(bcmbal_intf_id access_int_id, bcmbal_aggregation_port_id *agg_port_id, uint32_t range_size, void *user_data)
+{
+ bcmos_errno rc;
+ rsc_mgr_obj_id obj_id = *agg_port_id;
+ rsc_mgr_topo_pon_context *topo_context = RSC_MGR_PON_TOPO_CONTEXT(access_int_id);
+
+ rc = rsc_mgr_alloc_validate_common(access_int_id);
+ if (BCM_ERR_OK != rc)
+ return rc;
+
+ rc = rsc_mgr_obj_alloc(access_int_id, &obj_id, range_size, RSC_MGR_OBJ_TYPE_ALLOC_ID, &topo_context->alloc_ids, user_data, topo_context->log_id);
+ *agg_port_id = obj_id;
+
+ return rc;
+}
+
+bcmos_errno rsc_mgr_alloc_id_free(bcmbal_intf_id access_int_id, bcmbal_aggregation_port_id agg_port_id, void *user_data)
+{
+ rsc_mgr_topo_pon_context *topo_context = RSC_MGR_PON_TOPO_CONTEXT(access_int_id);
+
+ if (!bcm_topo_pon_is_valid(access_int_id))
+ return BCM_ERR_PARM;
+
+ return rsc_mgr_obj_free(access_int_id, (rsc_mgr_obj_id)agg_port_id, &topo_context->alloc_ids, user_data, topo_context->log_id);
+}
+
+bcmos_errno rsc_mgr_alloc_id_get_ref_count(bcmbal_intf_id access_int_id, bcmbal_aggregation_port_id agg_port_id, uint32_t *ref_count)
+{
+ rsc_mgr_obj *obj;
+ bcmos_errno rc;
+ rsc_mgr_topo_pon_context *topo_context = RSC_MGR_PON_TOPO_CONTEXT(access_int_id);
+
+ rc = rsc_mgr_obj_get(access_int_id, (rsc_mgr_obj_id)agg_port_id, &topo_context->alloc_ids, &obj, topo_context->log_id);
+ if (rc != BCM_ERR_OK)
+ return rc;
+
+ *ref_count = obj->ref_count;
+
+ return BCM_ERR_OK;
+}
+
+/** @brief iterates through user data list of an alloc id object */
+void *rsc_mgr_alloc_id_get_next_user_data(bcmbal_intf_id access_int_id, bcmbal_aggregation_port_id agg_port_id, void **curr_user_data_entry, void **next_user_data_entry)
+{
+ rsc_mgr_obj *obj;
+ bcmos_errno rc;
+ rsc_mgr_topo_pon_context *topo_context = RSC_MGR_PON_TOPO_CONTEXT(access_int_id);
+
+ rc = rsc_mgr_obj_get(access_int_id, (rsc_mgr_obj_id)agg_port_id, &topo_context->alloc_ids, &obj, topo_context->log_id);
+ if (rc != BCM_ERR_OK)
+ return NULL;
+
+ return rsc_mgr_obj_get_next_user_data(obj, curr_user_data_entry, next_user_data_entry);
+}
+
+/* GEM (service port ID) */
+static bcmos_errno _rsc_mgr_access_int_base_gem_set(bcmbal_intf_id access_int_id, bcmbal_service_port_id min_data_svc_port_id)
+{
+ bcmolt_pon_gem_port_index gem_index;
+ rsc_mgr_topo_pon_context *topo_context = RSC_MGR_PON_TOPO_CONTEXT(access_int_id);
+
+ if (bcm_topo_pon_get_pon_mode(access_int_id) == BCM_TOPO_PON_MODE_GPON)
+ {
+ bcmolt_gpon_gem_port_cfg gpon_gem_port_cfg = { .key.gem_port_id = min_data_svc_port_id };
+ bcmolt_gpon_gem_port_key_id failed_prop;
+
+ if (!bcmolt_gpon_gem_port_key_bounds_check(&gpon_gem_port_cfg.key, 1ULL << BCMOLT_GPON_GEM_PORT_KEY_ID_GEM_PORT_ID, &failed_prop) ||
+ min_data_svc_port_id < MIN_BASE_GEM_PORT_ID_GPON)
+ {
+ BCM_LOG(ERROR, topo_context->log_id, "Minimal data GEM port is not in the allowed range\n");
+ return BCM_ERR_PARM;
+ }
+ }
+ else
+ {
+ bcmolt_xgpon_ni_cfg xgpon_ni_cfg = {};
+ bcmolt_xgpon_ni_cfg_id failed_prop;
+
+ BCMOLT_CFG_PROP_SET(&xgpon_ni_cfg, xgpon_ni, min_data_gem_port_id, min_data_svc_port_id);
+ if (!bcmolt_xgpon_ni_cfg_data_bounds_check(&xgpon_ni_cfg.data, 1ULL << BCMOLT_XGPON_NI_CFG_ID_MIN_DATA_GEM_PORT_ID, &failed_prop))
+ {
+ BCM_LOG(ERROR, topo_context->log_id, "Minimal data GEM port is not in the allowed range\n");
+ return BCM_ERR_PARM;
+ }
+ }
+
+ if (!TAILQ_EMPTY(&topo_context->gems.allocated_objs))
+ {
+ BCM_LOG(ERROR, topo_context->log_id, "Minimal GEM port cannot be set when there are allocated GEM ports\n");
+ return BCM_ERR_STATE;
+ }
+
+ topo_context->gems.min_data_obj_id = (rsc_mgr_obj_id)min_data_svc_port_id;
+ RSC_MGR_FOR_EACH_GEM_INDEX(access_int_id, gem_index)
+ topo_context->gems.objs[gem_index].id = topo_context->gems.min_data_obj_id + gem_index;
+
+ return BCM_ERR_OK;
+}
+
+bcmos_errno rsc_mgr_access_int_base_gem_set(bcmbal_intf_id access_int_id, bcmbal_service_port_id min_data_svc_port_id)
+{
+ bcmos_errno rc;
+
+ rc = rsc_mgr_alloc_validate_common(access_int_id);
+ if (BCM_ERR_OK != rc)
+ return rc;
+
+ return _rsc_mgr_access_int_base_gem_set(access_int_id, min_data_svc_port_id);
+}
+
+static bcmos_errno _rsc_mgr_base_tm_sched_auto_id_set (bcmbal_tm_sched_id min_tm_sched_auto_id)
+{
+ bcmbal_tm_sched_id_index i;
+
+
+ if (!TAILQ_EMPTY(&tm_context.tm_sched_auto_key_ids.allocated_objs))
+ {
+ BCM_LOG(ERROR, tm_context.log_id, "Minimal tm node auto id cannot be set when there are allocated ids \n");
+ return BCM_ERR_STATE;
+ }
+
+ tm_context.tm_sched_auto_key_ids.min_data_obj_id = (rsc_mgr_obj_id)min_tm_sched_auto_id;
+ RSC_MGR_FOR_EACH_TM_SCHED_AUTO_INDEX(i)
+ {
+ tm_context.tm_sched_auto_key_ids.objs[i].id = tm_context.tm_sched_auto_key_ids.min_data_obj_id + i;
+ }
+
+ return BCM_ERR_OK;
+}
+
+bcmos_errno rsc_mgr_gem_alloc_unicast(bcmbal_intf_id access_int_id, bcmbal_service_port_id *svc_port_id, uint32_t range_size, void *user_data)
+{
+ bcmos_errno rc;
+ rsc_mgr_topo_pon_context *topo_context = NULL;
+ rsc_mgr_obj_id obj_id = *svc_port_id;
+
+ rc = rsc_mgr_alloc_validate_common(access_int_id);
+ if (BCM_ERR_OK != rc)
+ return rc;
+
+ topo_context = RSC_MGR_PON_TOPO_CONTEXT(access_int_id);
+
+ rc = rsc_mgr_obj_alloc(access_int_id, &obj_id, range_size, RSC_MGR_OBJ_TYPE_GEM_PORT_UNICAST, &topo_context->gems, user_data, topo_context->log_id);
+ *svc_port_id = obj_id;
+
+ return rc;
+}
+
+
+bcmos_errno rsc_mgr_gem_alloc_multicast(bcmbal_intf_id access_int_id, bcmbal_service_port_id *svc_port_id, uint32_t range_size, void *user_data)
+{
+ bcmos_errno rc;
+ rsc_mgr_topo_pon_context *topo_context = NULL;
+ rsc_mgr_obj_id obj_id = *svc_port_id;
+
+ rc = rsc_mgr_alloc_validate_common(access_int_id);
+ if (BCM_ERR_OK != rc)
+ return rc;
+
+ topo_context = RSC_MGR_PON_TOPO_CONTEXT(access_int_id);
+#ifndef MULTIPLE_MULTICAST_GEM_PORTS_PER_PON
+ rc = rsc_mgr_alloc_validate_non_unicast(access_int_id, topo_context->multicast_gem_port, *svc_port_id, range_size, RSC_MGR_OBJ_TYPE_GEM_PORT_MULTICAST, topo_context->log_id);
+
+ if (topo_context->multicast_gem_port != BCMOLT_PON_GEM_PORT_ID_INVALID)
+ obj_id = topo_context->multicast_gem_port; /* This will cause the reference count of the multicast GEM to increase. */
+#endif
+
+ rc = rsc_mgr_obj_alloc(access_int_id, &obj_id, range_size, RSC_MGR_OBJ_TYPE_GEM_PORT_MULTICAST, &topo_context->gems, user_data, topo_context->log_id);
+ *svc_port_id = obj_id;
+
+#ifndef MULTIPLE_MULTICAST_GEM_PORTS_PER_PON
+ if (!rc)
+ RSC_MGR_PON_TOPO_CONTEXT(access_int_id)->multicast_gem_port = *svc_port_id;
+#endif
+
+ return rc;
+}
+
+bcmos_errno rsc_mgr_gem_alloc_broadcast(bcmbal_intf_id access_int_id, bcmbal_service_port_id *svc_port_id, uint32_t range_size, void *user_data)
+{
+ bcmos_errno rc;
+ rsc_mgr_topo_pon_context *topo_context = NULL;
+ rsc_mgr_obj_id obj_id = *svc_port_id;
+
+ rc = rsc_mgr_alloc_validate_common(access_int_id);
+ if (BCM_ERR_OK != rc)
+ return rc;
+
+ topo_context = RSC_MGR_PON_TOPO_CONTEXT(access_int_id);
+#ifndef MULTIPLE_BROADCAST_GEM_PORTS_PER_PON
+ rc = rsc_mgr_alloc_validate_non_unicast(access_int_id, topo_context->broadcast_gem_port, *svc_port_id, range_size, RSC_MGR_OBJ_TYPE_GEM_PORT_BROADCAST, topo_context->log_id);
+
+ if (topo_context->broadcast_gem_port != BCMOLT_PON_GEM_PORT_ID_INVALID)
+ obj_id = topo_context->broadcast_gem_port; /* This will cause the reference count of the broadcast GEM to increase. */
+#endif
+
+ rc = rsc_mgr_obj_alloc(access_int_id, &obj_id, range_size, RSC_MGR_OBJ_TYPE_GEM_PORT_BROADCAST, &topo_context->gems, user_data, topo_context->log_id);
+ *svc_port_id = obj_id;
+
+#ifndef MULTIPLE_BROADCAST_GEM_PORTS_PER_PON
+ if (!rc)
+ RSC_MGR_PON_TOPO_CONTEXT(access_int_id)->broadcast_gem_port = *svc_port_id;
+#endif
+
+ return rc;
+}
+
+bcmos_errno rsc_mgr_gem_free(bcmbal_intf_id access_int_id, bcmbal_service_port_id svc_port_id, void *user_data)
+{
+ bcmos_errno rc;
+#ifndef MULTIPLE_MULTICAST_GEM_PORTS_PER_PON
+ rsc_mgr_topo_pon_context *topo_context;
+#endif
+
+ if (!bcm_topo_pon_is_valid(access_int_id))
+ return BCM_ERR_PARM;
+
+#ifndef MULTIPLE_MULTICAST_GEM_PORTS_PER_PON
+ topo_context = RSC_MGR_PON_TOPO_CONTEXT(access_int_id);
+#endif
+
+ rc = rsc_mgr_obj_free(access_int_id, (rsc_mgr_obj_id)svc_port_id, &topo_context->gems, user_data, topo_context->log_id);
+
+#ifndef MULTIPLE_MULTICAST_GEM_PORTS_PER_PON
+ if (!rc && topo_context->multicast_gem_port == svc_port_id)
+ RSC_MGR_PON_TOPO_CONTEXT(access_int_id)->multicast_gem_port = BCMOLT_PON_GEM_PORT_ID_INVALID;
+#endif
+
+ return rc;
+}
+
+bcmos_errno rsc_mgr_gem_get_ref_count(bcmbal_intf_id access_int_id, bcmbal_service_port_id svc_port_id, uint32_t *ref_count)
+{
+ rsc_mgr_obj *obj;
+ bcmos_errno rc;
+ rsc_mgr_topo_pon_context *topo_context = RSC_MGR_PON_TOPO_CONTEXT(access_int_id);
+
+ rc = rsc_mgr_obj_get(access_int_id, (rsc_mgr_obj_id)svc_port_id, &topo_context->gems, &obj, topo_context->log_id);
+ if (rc != BCM_ERR_OK)
+ return rc;
+
+ *ref_count = obj->ref_count;
+
+ return BCM_ERR_OK;
+}
+
+/** @brief iterates through user data list of a gem object */
+void *rsc_mgr_gem_get_next_user_data(bcmbal_intf_id access_int_id, bcmbal_service_port_id svc_port_id, void **curr_user_data_entry, void **next_user_data_entry)
+{
+ rsc_mgr_obj *obj;
+ bcmos_errno rc;
+ rsc_mgr_topo_pon_context *topo_context = RSC_MGR_PON_TOPO_CONTEXT(access_int_id);
+
+ rc = rsc_mgr_obj_get(access_int_id, (rsc_mgr_obj_id)svc_port_id, &topo_context->gems, &obj, topo_context->log_id);
+ if (rc != BCM_ERR_OK)
+ return NULL;
+
+ return rsc_mgr_obj_get_next_user_data(obj, curr_user_data_entry, next_user_data_entry);
+}
+
+
+
+bcmos_errno _rsc_mgr_tm_sched_auto_id_alloc(bcmbal_tm_sched_id *tm_sched_id)
+{
+ bcmos_errno rc;
+ rsc_mgr_obj_id obj_id = *tm_sched_id;
+
+ rc = rsc_mgr_init_validate();
+ if (rc != BCM_ERR_OK)
+ {
+ BCM_LOG(ERROR, rsc_mgr_log_id, "Resource manager is uninitialized\n");
+ return rc;
+ }
+
+ /* Allocate a new object. */
+ rc = rsc_mgr_obj_alloc(0, &obj_id, 1, RSC_MGR_OBJ_TYPE_TM_SCHED, &tm_context.tm_sched_auto_key_ids, NULL, tm_context.log_id);
+ *tm_sched_id = obj_id;
+
+ return rc;
+}
+
+bcmos_errno _rsc_mgr_tm_sched_auto_id_free(bcmbal_tm_sched_id tm_sched_id)
+{
+ bcmos_errno rc;
+
+ rc = rsc_mgr_obj_free(0, (rsc_mgr_obj_id)tm_sched_id, &tm_context.tm_sched_auto_key_ids, NULL, tm_context.log_id);
+
+ return rc;
+}
+
+bcmos_errno _rsc_mgr_tm_sched_auto_id_get_ref_count(bcmbal_tm_sched_id tm_sched_id, uint32_t *ref_count)
+{
+ rsc_mgr_obj *obj;
+ bcmos_errno rc;
+
+ rc = rsc_mgr_obj_get(0, (rsc_mgr_obj_id)tm_sched_id, &tm_context.tm_sched_auto_key_ids, &obj, tm_context.log_id);
+ if (rc != BCM_ERR_OK)
+ return rc;
+
+ *ref_count = obj->ref_count;
+
+ return BCM_ERR_OK;
+}
+
+bcmos_bool _rsc_mgr_tm_sched_id_validate(bcmbal_tm_sched_id tm_sched_key_id)
+{
+ return (!rsc_mgr_is_valid_data_tm_sched_auto_id(tm_sched_key_id));
+}
+
+static void rsc_mgr_init_obj_rsc(rsc_mgr_obj_rsc *obj_rsc, rsc_mgr_is_valid_data_obj_id_cb_t is_valid_data_obj_id_cb,
+ rsc_mgr_get_last_data_obj_id_cb_t get_last_data_obj_id_cb, uint32_t num_of_objs, const char *obj_name)
+{
+ rsc_mgr_obj *obj;
+
+ obj_rsc->obj_name = obj_name;
+ obj_rsc->is_valid_data_obj_id_cb = is_valid_data_obj_id_cb;
+ obj_rsc->get_last_data_obj_id_cb = get_last_data_obj_id_cb;
+ TAILQ_INIT(&obj_rsc->free_objs);
+ TAILQ_INIT(&obj_rsc->allocated_objs);
+ obj_rsc->objs = bcmos_calloc(num_of_objs * sizeof(*obj_rsc->objs));
+ obj_rsc->num_of_objs = num_of_objs;
+
+ /* Insert a first entry to the list of free objects. */
+ obj = &obj_rsc->objs[0];
+ obj->range_size = num_of_objs;
+ TAILQ_INSERT_HEAD(&obj_rsc->free_objs, obj, list);
+}
+
+static void rsc_mgr_uninit_obj_rsc(rsc_mgr_obj_rsc *obj_rsc)
+{
+ bcmos_free(obj_rsc->objs);
+}
+
+bcmos_errno rsc_mgr_mac_init(void)
+{
+ bcmos_errno rc = BCM_ERR_OK;
+ bcmolt_devid device_id;
+ uint32_t pon_id;
+ rsc_mgr_topo_pon_context *topo_context, *old_topo_context;
+
+ do
+ {
+ rc = rsc_mgr_init_validate();
+ if (rc != BCM_ERR_OK)
+ {
+ BCM_LOG(INFO, rsc_mgr_log_id, "Resource Manager was not initialized");
+ break;
+ }
+ BCM_TOPO_FOR_EACH_PON(device_id, pon_id)
+ {
+ old_topo_context = bcm_topo_pon_get_context(pon_id, BCM_TOPO_PON_CONTEXT_ID_RSC_MGR);
+ if (old_topo_context)
+ {
+ bcmos_free(old_topo_context);
+ }
+ topo_context = bcmos_calloc(sizeof(*topo_context));
+ if (bcm_topo_pon_get_pon_mode(pon_id) == BCM_TOPO_PON_MODE_GPON)
+ {
+ topo_context->num_of_alloc_ids = GPON_NUM_OF_ALLOC_IDS;
+ topo_context->num_of_gem_ports = GPON_NUM_OF_GEM_PORT_IDS_PER_PON;
+ }
+ else
+ {
+ topo_context->num_of_alloc_ids = XGPON_NUM_OF_ALLOC_IDS;
+ topo_context->num_of_gem_ports = XGPON_NUM_OF_GEM_PORT_IDS_PER_PON;
+ }
+ topo_context->multicast_gem_port = BCMOLT_PON_GEM_PORT_ID_INVALID;
+ topo_context->broadcast_gem_port = BCMOLT_PON_GEM_PORT_ID_INVALID;
+ bcm_topo_pon_set_context(pon_id, BCM_TOPO_PON_CONTEXT_ID_RSC_MGR, topo_context);
+#ifdef ENABLE_LOG
+ snprintf(topo_context->log_id_name, sizeof(topo_context->log_id_name), "RSC_MGR%u", pon_id);
+ topo_context->log_id = bcm_dev_log_id_register(topo_context->log_id_name, DEV_LOG_LEVEL_INFO, DEV_LOG_ID_TYPE_BOTH);
+ BUG_ON(topo_context->log_id == DEV_LOG_INVALID_ID);
+#endif
+ rsc_mgr_init_obj_rsc(&topo_context->alloc_ids, rsc_mgr_is_valid_data_alloc_id_cb, rsc_mgr_get_last_data_alloc_id_cb,
+ RSC_MGR_PON_TOPO_CONTEXT(pon_id)->num_of_alloc_ids, "alloc ID");
+ rsc_mgr_init_obj_rsc(&topo_context->gems, rsc_mgr_is_valid_data_gem_cb, rsc_mgr_get_last_data_gem_cb,
+ RSC_MGR_PON_TOPO_CONTEXT(pon_id)->num_of_gem_ports, "GEM port");
+
+ if (bcm_topo_pon_get_pon_mode(pon_id) == BCM_TOPO_PON_MODE_GPON)
+ {
+ bcmolt_gpon_ni_cfg gpon_ni_cfg = {};
+
+ bcmolt_gpon_ni_cfg_data_set_default(&gpon_ni_cfg.data, 1 << BCMOLT_GPON_NI_CFG_ID_MIN_DATA_ALLOC_ID);
+ _rsc_mgr_access_int_base_alloc_id_set(pon_id, gpon_ni_cfg.data.min_data_alloc_id);
+
+ _rsc_mgr_access_int_base_gem_set(pon_id, MIN_BASE_GEM_PORT_ID_GPON);
+ }
+ else
+ {
+ bcmolt_xgpon_ni_cfg xgpon_ni_cfg = {};
+
+ bcmolt_xgpon_ni_cfg_data_set_default(&xgpon_ni_cfg.data, 1 << BCMOLT_XGPON_NI_CFG_ID_MIN_DATA_ALLOC_ID);
+ _rsc_mgr_access_int_base_alloc_id_set(pon_id, xgpon_ni_cfg.data.min_data_alloc_id);
+
+ bcmolt_xgpon_ni_cfg_data_set_default(&xgpon_ni_cfg.data, 1 << BCMOLT_XGPON_NI_CFG_ID_MIN_DATA_GEM_PORT_ID);
+ _rsc_mgr_access_int_base_gem_set(pon_id, xgpon_ni_cfg.data.min_data_gem_port_id);
+ }
+ }
+
+ }while(0);
+ return rc;
+}
+
+bcmos_errno rsc_mgr_init(void)
+{
+ if (rsc_mgr_init_validate() == BCM_ERR_OK)
+ {
+ BCM_LOG(INFO, rsc_mgr_log_id, "Resource Manager was already initialized");
+ return BCM_ERR_OK;
+ }
+
+#ifdef ENABLE_LOG
+ if (rsc_mgr_log_id == DEV_LOG_INVALID_ID)
+ {
+ rsc_mgr_log_id = bcm_dev_log_id_register("RSC_MGR", DEV_LOG_LEVEL_INFO, DEV_LOG_ID_TYPE_BOTH);
+ BUG_ON(rsc_mgr_log_id == DEV_LOG_INVALID_ID);
+ }
+#endif
+
+ /*Init the tm object*/
+ tm_context.num_of_tm_sched_auto_key_ids = NUM_OF_TM_SCHED_AUTO_KEY_IDS;
+ snprintf(tm_context.log_id_name , sizeof(tm_context.log_id_name) , "RSC_MGR_TM");
+ tm_context.log_id = bcm_dev_log_id_register(tm_context.log_id_name, DEV_LOG_LEVEL_INFO, DEV_LOG_ID_TYPE_BOTH);
+ BUG_ON(tm_context.log_id == DEV_LOG_INVALID_ID);
+
+ rsc_mgr_init_obj_rsc(&tm_context.tm_sched_auto_key_ids, rsc_mgr_is_valid_data_tm_sched_auto_id_cb, rsc_mgr_get_last_data_tm_sched_auto_id_cb,
+ tm_context.num_of_tm_sched_auto_key_ids, "TM node auto id");
+
+ _rsc_mgr_base_tm_sched_auto_id_set(MIN_BASE_TM_SCHED_AUTO_ID);
+
+ rsc_mgr_context.is_initialized = BCMOS_TRUE;
+ return BCM_ERR_OK;
+}
+
+void rsc_mgr_uninit(void)
+{
+ bcmolt_devid device_id;
+ uint32_t pon_id;
+
+ if (!rsc_mgr_context.is_initialized)
+ return;
+
+ BCM_TOPO_FOR_EACH_PON(device_id, pon_id)
+ {
+ rsc_mgr_topo_pon_context *topo_context = RSC_MGR_PON_TOPO_CONTEXT(pon_id);
+
+ rsc_mgr_uninit_obj_rsc(&topo_context->gems);
+ rsc_mgr_uninit_obj_rsc(&topo_context->alloc_ids);
+ }
+ rsc_mgr_context.is_initialized = BCMOS_FALSE;
+}
+
diff --git a/bal_release/src/lib/librscmgr/rsc_mgr.h b/bal_release/src/lib/librscmgr/rsc_mgr.h
new file mode 100644
index 0000000..072d37e
--- /dev/null
+++ b/bal_release/src/lib/librscmgr/rsc_mgr.h
@@ -0,0 +1,64 @@
+/******************************************************************************
+ *
+ * <:copyright-BRCM:2016:DUAL/GPL:standard
+ *
+ * Copyright (c) 2016 Broadcom
+ * All Rights Reserved
+ *
+ * Unless you and Broadcom execute a separate written software license
+ * agreement governing use of this software, this software is licensed
+ * to you under the terms of the GNU General Public License version 2
+ * (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
+ * with the following added to such license:
+ *
+ * As a special exception, the copyright holders of this software give
+ * you permission to link this software with independent modules, and
+ * to copy and distribute the resulting executable under terms of your
+ * choice, provided that you also meet, for each linked independent
+ * module, the terms and conditions of the license of that module.
+ * An independent module is a module which is not derived from this
+ * software. The special exception does not apply to any modifications
+ * of the software.
+ *
+ * Not withstanding the above, under no circumstances may you combine
+ * this software in any way with any other Broadcom software provided
+ * under a license other than the GPL, without Broadcom's express prior
+ * written consent.
+ *
+ * :>
+ *
+ *****************************************************************************/
+
+#ifndef _RSC_MGR_H_
+#define _RSC_MGR_H_
+
+#include <bal_objs.h>
+
+/* Alloc ID (aggregation port ID) */
+bcmos_errno rsc_mgr_access_int_base_alloc_id_set(bcmbal_intf_id access_int_id, bcmbal_aggregation_port_id min_data_agg_port_id);
+bcmos_errno rsc_mgr_alloc_id_alloc(bcmbal_intf_id access_int_id, bcmbal_aggregation_port_id *agg_port_id, uint32_t range_size, void *user_data);
+bcmos_errno rsc_mgr_alloc_id_free(bcmbal_intf_id access_int_id, bcmbal_aggregation_port_id agg_port_id, void *user_data);
+bcmos_errno rsc_mgr_alloc_id_get_ref_count(bcmbal_intf_id access_int_id, bcmbal_aggregation_port_id agg_port_id, uint32_t *ref_count);
+void* rsc_mgr_alloc_id_get_next_user_data(bcmbal_intf_id access_int_id, bcmbal_aggregation_port_id agg_port_id, void **curr_user_data_entry, void **next_user_data_entry);
+
+
+/* GEM (service port ID) */
+bcmos_errno rsc_mgr_access_int_base_gem_set(bcmbal_intf_id access_int_id, bcmbal_service_port_id min_data_svc_port_id);
+bcmos_errno rsc_mgr_gem_alloc_unicast(bcmbal_intf_id access_int_id, bcmbal_service_port_id *svc_port_id, uint32_t range_size, void *user_data);
+bcmos_errno rsc_mgr_gem_alloc_multicast(bcmbal_intf_id access_int_id, bcmbal_service_port_id *svc_port_id, uint32_t range_size, void *user_data);
+bcmos_errno rsc_mgr_gem_alloc_broadcast(bcmbal_intf_id access_int_id, bcmbal_service_port_id *svc_port_id, uint32_t range_size, void *user_data);
+bcmos_errno rsc_mgr_gem_free(bcmbal_intf_id access_int_id, bcmbal_service_port_id svc_port_id, void *user_data);
+bcmos_errno rsc_mgr_gem_get_ref_count(bcmbal_intf_id access_int_id, bcmbal_service_port_id svc_port_id, uint32_t *ref_count);
+void* rsc_mgr_gem_get_next_user_data(bcmbal_intf_id access_int_id, bcmbal_service_port_id svc_port_id, void **curr_user_data_entry, void **next_user_data_entry);
+
+bcmos_errno _rsc_mgr_tm_sched_auto_id_alloc(bcmbal_tm_sched_id *tm_sched_key_id);
+bcmos_errno _rsc_mgr_tm_sched_auto_id_free(bcmbal_tm_sched_id tm_sched_key_id);
+bcmos_errno _rsc_mgr_tm_sched_auto_id_get_ref_count(bcmbal_tm_sched_id tm_sched_key_id, uint32_t *ref_count);
+bcmos_bool _rsc_mgr_tm_sched_id_validate(bcmbal_tm_sched_id tm_sched_key_id);
+
+bcmos_errno rsc_mgr_mac_init(void);
+bcmos_errno rsc_mgr_init(void);
+void rsc_mgr_uninit(void);
+
+#endif
+
diff --git a/bal_release/src/lib/librscmgr/rsc_mgr_cli.c b/bal_release/src/lib/librscmgr/rsc_mgr_cli.c
new file mode 100644
index 0000000..7584741
--- /dev/null
+++ b/bal_release/src/lib/librscmgr/rsc_mgr_cli.c
@@ -0,0 +1,315 @@
+/******************************************************************************
+ *
+ * <:copyright-BRCM:2016:DUAL/GPL:standard
+ *
+ * Copyright (c) 2016 Broadcom
+ * All Rights Reserved
+ *
+ * Unless you and Broadcom execute a separate written software license
+ * agreement governing use of this software, this software is licensed
+ * to you under the terms of the GNU General Public License version 2
+ * (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
+ * with the following added to such license:
+ *
+ * As a special exception, the copyright holders of this software give
+ * you permission to link this software with independent modules, and
+ * to copy and distribute the resulting executable under terms of your
+ * choice, provided that you also meet, for each linked independent
+ * module, the terms and conditions of the license of that module.
+ * An independent module is a module which is not derived from this
+ * software. The special exception does not apply to any modifications
+ * of the software.
+ *
+ * Not withstanding the above, under no circumstances may you combine
+ * this software in any way with any other Broadcom software provided
+ * under a license other than the GPL, without Broadcom's express prior
+ * written consent.
+ *
+ * :>
+ *
+ *****************************************************************************/
+
+#include <bcm_dev_log.h>
+#include <bcmcli.h>
+#include <bal_objs.h>
+#include <bal_api.h>
+#include <bcm_topo.h>
+#include "rsc_mgr.h"
+#include "rsc_mgr_common.h"
+#include "rsc_mgr_cli.h"
+
+static bcmos_errno rsc_mgr_cli_cmd_init(bcmcli_session *session, const bcmcli_cmd_parm parm[], uint16_t n_parms)
+{
+ return rsc_mgr_init();
+}
+
+static bcmos_errno rsc_mgr_cli_cmd_base_alloc_id_set(bcmcli_session *session, const bcmcli_cmd_parm parm[], uint16_t n_parms)
+{
+ bcmbal_intf_id access_int_id = (bcmbal_intf_id)bcmcli_find_named_parm(session, "key.access_int_id")->value.unumber;
+ bcmbal_aggregation_port_id min_data_agg_port_id = (bcmbal_aggregation_port_id)bcmcli_find_named_parm(session, "min_data_agg_port_id")->value.unumber;
+
+ return rsc_mgr_access_int_base_alloc_id_set(access_int_id, min_data_agg_port_id);
+}
+
+static bcmos_errno rsc_mgr_cli_cmd_base_gem_set(bcmcli_session *session, const bcmcli_cmd_parm parm[], uint16_t n_parms)
+{
+ bcmbal_intf_id access_int_id = (bcmbal_intf_id)bcmcli_find_named_parm(session, "key.access_int_id")->value.unumber;
+ bcmbal_service_port_id min_data_svc_port_id = (bcmbal_service_port_id)bcmcli_find_named_parm(session, "min_data_svc_port_id")->value.unumber;
+
+ return rsc_mgr_access_int_base_gem_set(access_int_id, min_data_svc_port_id);
+}
+
+static bcmos_errno rsc_mgr_cli_cmd_alloc_id_alloc(bcmcli_session *session, const bcmcli_cmd_parm parm[], uint16_t n_parms)
+{
+ bcmbal_intf_id access_int_id = (bcmbal_intf_id)bcmcli_find_named_parm(session, "key.access_int_id")->value.unumber;
+ bcmcli_cmd_parm *agg_port_id_parm = bcmcli_find_named_parm(session, "agg_port_id");
+ bcmbal_aggregation_port_id agg_port_id = 0;
+ uint32_t range_size = (uint32_t)bcmcli_find_named_parm(session, "range_size")->value.unumber;
+ uint32_t ref_count;
+ bcmos_errno rc;
+
+ if (agg_port_id_parm)
+ agg_port_id = (bcmbal_aggregation_port_id)agg_port_id_parm->value.unumber;
+
+ rc = rsc_mgr_alloc_id_alloc(access_int_id, &agg_port_id, range_size, NULL);
+ if (rc != BCM_ERR_OK)
+ return rc;
+
+ rc = rsc_mgr_alloc_id_get_ref_count(access_int_id, agg_port_id, &ref_count);
+ if (rc != BCM_ERR_OK)
+ return rc;
+
+ bcmcli_session_print(session, "Allocated alloc ID=%u (ref_count=%u)\n", agg_port_id, ref_count);
+
+ return BCM_ERR_OK;
+}
+
+static bcmos_errno rsc_mgr_cli_cmd_alloc_id_free(bcmcli_session *session, const bcmcli_cmd_parm parm[], uint16_t n_parms)
+{
+ bcmbal_intf_id access_int_id = (bcmbal_intf_id)bcmcli_find_named_parm(session, "key.access_int_id")->value.unumber;
+ bcmbal_aggregation_port_id agg_port_id = (bcmbal_aggregation_port_id)bcmcli_find_named_parm(session, "agg_port_id")->value.unumber;
+ uint32_t ref_count;
+ bcmos_errno rc;
+
+ rc = rsc_mgr_alloc_id_get_ref_count(access_int_id, agg_port_id, &ref_count);
+ if (rc != BCM_ERR_OK)
+ return rc;
+
+ rc = rsc_mgr_alloc_id_free(access_int_id, agg_port_id, NULL);
+ if (rc != BCM_ERR_OK)
+ return rc;
+
+ bcmcli_session_print(session, "Freed alloc ID=%u (ref_count=%u)\n", agg_port_id, ref_count - 1);
+
+ return BCM_ERR_OK;
+}
+
+static bcmos_errno rsc_mgr_cli_cmd_gem_alloc(bcmcli_session *session, const bcmcli_cmd_parm parm[], uint16_t n_parms)
+{
+ bcmbal_intf_id access_int_id = (bcmbal_intf_id)bcmcli_find_named_parm(session, "key.access_int_id")->value.unumber;
+ bcmcli_cmd_parm *svc_port_id_parm = bcmcli_find_named_parm(session, "svc_port_id");
+ bcmbal_service_port_id svc_port_id = 0;
+ uint32_t range_size = (uint32_t)bcmcli_find_named_parm(session, "range_size")->value.unumber;
+ rsc_mgr_obj_type gem_type = (rsc_mgr_obj_type)bcmcli_find_named_parm(session, "gem_type")->value.enum_val;
+ uint32_t ref_count;
+ bcmos_errno rc;
+
+ if (svc_port_id_parm)
+ svc_port_id = (bcmbal_service_port_id)svc_port_id_parm->value.unumber;
+
+ if (RSC_MGR_OBJ_TYPE_GEM_PORT_MULTICAST == gem_type)
+ rc = rsc_mgr_gem_alloc_multicast(access_int_id, &svc_port_id, range_size, NULL);
+ else if (RSC_MGR_OBJ_TYPE_GEM_PORT_BROADCAST == gem_type)
+ rc = rsc_mgr_gem_alloc_broadcast(access_int_id, &svc_port_id, range_size, NULL);
+ else
+ rc = rsc_mgr_gem_alloc_unicast(access_int_id, &svc_port_id, range_size, NULL);
+
+ if (rc != BCM_ERR_OK)
+ return rc;
+
+ rc = rsc_mgr_gem_get_ref_count(access_int_id, svc_port_id, &ref_count);
+ if (rc != BCM_ERR_OK)
+ return rc;
+
+ bcmcli_session_print(session, "Allocated GEM port=%u (ref_count=%u)\n", svc_port_id, ref_count);
+
+ return BCM_ERR_OK;
+}
+
+static bcmos_errno rsc_mgr_cli_cmd_gem_free(bcmcli_session *session, const bcmcli_cmd_parm parm[], uint16_t n_parms)
+{
+ bcmbal_intf_id access_int_id = (bcmbal_intf_id)bcmcli_find_named_parm(session, "key.access_int_id")->value.unumber;
+ bcmbal_service_port_id svc_port_id = (bcmbal_service_port_id)bcmcli_find_named_parm(session, "svc_port_id")->value.unumber;
+ uint32_t ref_count;
+ bcmos_errno rc;
+
+ rc = rsc_mgr_gem_get_ref_count(access_int_id, svc_port_id, &ref_count);
+ if (rc != BCM_ERR_OK)
+ return rc;
+
+ rc = rsc_mgr_gem_free(access_int_id, svc_port_id, NULL);
+ if (rc != BCM_ERR_OK)
+ return rc;
+
+ bcmcli_session_print(session, "Freed GEM port=%u (ref_count=%u)\n", svc_port_id, ref_count - 1);
+
+ return BCM_ERR_OK;
+}
+/*allocates a new tm node auto id
+no inputs parameters are used */
+static bcmos_errno rsc_mgr_cli_cmd_tm_sched_auto_alloc(bcmcli_session *session, const bcmcli_cmd_parm parm[], uint16_t n_parms)
+{
+ bcmbal_tm_sched_id tm_sched_auto_id = 0;
+ bcmos_errno rc;
+
+ rc = _rsc_mgr_tm_sched_auto_id_alloc(&tm_sched_auto_id);
+ if (rc != BCM_ERR_OK)
+ return rc;
+
+
+ bcmcli_session_print(session, "Allocated TM SCHED AUTO ID %u \n", tm_sched_auto_id);
+
+ return BCM_ERR_OK;
+}
+
+static bcmos_errno rsc_mgr_cli_cmd_tm_sched_auto_free(bcmcli_session *session, const bcmcli_cmd_parm parm[], uint16_t n_parms)
+{
+ bcmbal_tm_sched_id tm_sched_auto_id = (bcmbal_tm_sched_id)bcmcli_find_named_parm(session, "tm_sched_auto_id")->value.unumber;
+ uint32_t ref_count;
+ bcmos_errno rc;
+
+ rc = _rsc_mgr_tm_sched_auto_id_get_ref_count(tm_sched_auto_id, &ref_count);
+
+ if (rc != BCM_ERR_OK)
+ return rc;
+
+ rc = _rsc_mgr_tm_sched_auto_id_free(tm_sched_auto_id);
+ if (rc != BCM_ERR_OK)
+ return rc;
+
+ bcmcli_session_print(session, "Freed TM NODE AUTO ID %u (ref_count=%u)\n", tm_sched_auto_id, ref_count - 1);
+
+ return BCM_ERR_OK;
+}
+
+static void rsc_mgr_show_objs_list(bcmcli_session *session, bcmbal_intf_id access_int_id, rsc_mgr_obj_rsc *obj_rsc,
+ rsc_mgr_obj_list *obj_list)
+{
+ rsc_mgr_obj *obj_iter;
+
+ TAILQ_FOREACH(obj_iter, obj_list, list)
+ {
+ if (obj_iter->range_size == 1)
+ {
+ bcmcli_session_print(session, "\t%s=%u (obj_type=%s, ref_count=%u)\n",
+ obj_rsc->obj_name, obj_iter->id, RSC_MGR_OBJ_TYPE_STR(obj_iter->type), obj_iter->ref_count);
+ }
+ else
+ {
+ bcmcli_session_print(session, "\t%s=%u .. %u (obj_type=%s, ref_count=%u)\n",
+ obj_rsc->obj_name, obj_iter->id, obj_iter->id + obj_iter->range_size - 1, RSC_MGR_OBJ_TYPE_STR(obj_iter->type), obj_iter->ref_count);
+ }
+ }
+}
+
+static void rsc_mgr_show_objs(bcmcli_session *session, bcmbal_intf_id access_int_id, rsc_mgr_obj_rsc *obj_rsc)
+{
+ bcmcli_session_print(session, "Base data %s=%u\n", obj_rsc->obj_name, obj_rsc->min_data_obj_id);
+ bcmcli_session_print(session, "Allocated %ss:\n", obj_rsc->obj_name);
+ rsc_mgr_show_objs_list(session, access_int_id, obj_rsc, &obj_rsc->allocated_objs);
+ bcmcli_session_print(session, "Free %ss:\n", obj_rsc->obj_name);
+ rsc_mgr_show_objs_list(session, access_int_id, obj_rsc, &obj_rsc->free_objs);
+}
+
+static bcmos_errno rsc_mgr_show(bcmcli_session *session, bcmbal_intf_id access_int_id)
+{
+ bcmos_errno rc;
+ rsc_mgr_topo_pon_context *topo_context;
+
+ rc = rsc_mgr_init_validate();
+ if (rc != BCM_ERR_OK)
+ {
+ BCM_LOG(ERROR, rsc_mgr_log_id, "Resource manager is uninitialized\n");
+ return rc;
+ }
+
+ if (!bcm_topo_pon_is_valid(access_int_id))
+ return BCM_ERR_PARM;
+
+ topo_context = RSC_MGR_PON_TOPO_CONTEXT(access_int_id);
+ rsc_mgr_show_objs(session, access_int_id, &topo_context->alloc_ids);
+ rsc_mgr_show_objs(session, access_int_id, &topo_context->gems);
+
+ return BCM_ERR_OK;
+}
+
+static bcmos_errno rsc_mgr_cli_cmd_show(bcmcli_session *session, const bcmcli_cmd_parm parm[], uint16_t n_parms)
+{
+ bcmbal_intf_id access_int_id = (bcmbal_intf_id)bcmcli_find_named_parm(session, "key.access_int_id")->value.unumber;
+
+ return rsc_mgr_show(session, access_int_id);
+}
+
+void rsc_mgr_cli_init(bcmcli_entry *cli_dir)
+{
+ bcmcli_entry *dbg_dir;
+
+ static bcmcli_enum_val rsc_mgr_cli_enum_gem_type_table[] =
+ {
+ { .name = "unicast", .val = RSC_MGR_OBJ_TYPE_GEM_PORT_UNICAST },
+ { .name = "multicast", .val = RSC_MGR_OBJ_TYPE_GEM_PORT_MULTICAST },
+ { .name = "broadcast", .val = RSC_MGR_OBJ_TYPE_GEM_PORT_BROADCAST },
+ BCMCLI_ENUM_LAST
+ };
+
+ dbg_dir = bcmcli_dir_add(cli_dir, "rsc_mgr", "BAL resource manager API access", BCMCLI_ACCESS_ADMIN, NULL);
+
+ BCMCLI_MAKE_CMD(dbg_dir, "init", "Initialize resource manager for a specific access terminal", rsc_mgr_cli_cmd_init,
+ BCMCLI_MAKE_PARM_RANGE("key.access_term_id", "access terminal identifier", BCMCLI_PARM_UNUMBER, 0, 0, MAX_SUPPORTED_OLTS));
+
+ BCMCLI_MAKE_CMD(dbg_dir, "base_alloc_id_set", "Set the base alloc ID for an access interface", rsc_mgr_cli_cmd_base_alloc_id_set,
+ BCMCLI_MAKE_PARM_RANGE("key.access_term_id", "access terminal identifier", BCMCLI_PARM_UNUMBER, 0, 0, MAX_SUPPORTED_OLTS),
+ BCMCLI_MAKE_PARM("key.access_int_id", "access interface identifier", BCMCLI_PARM_UNUMBER, 0),
+ BCMCLI_MAKE_PARM("min_data_agg_port_id", "minimal data aggregation port ID", BCMCLI_PARM_UNUMBER, 0));
+
+ BCMCLI_MAKE_CMD(dbg_dir, "base_gem_set", "Set the base GEM port for an access interface", rsc_mgr_cli_cmd_base_gem_set,
+ BCMCLI_MAKE_PARM_RANGE("key.access_term_id", "access terminal identifier", BCMCLI_PARM_UNUMBER, 0, 0, MAX_SUPPORTED_OLTS),
+ BCMCLI_MAKE_PARM("key.access_int_id", "access interface identifier", BCMCLI_PARM_UNUMBER, 0),
+ BCMCLI_MAKE_PARM("min_data_svc_port_id", "minimal data service port ID", BCMCLI_PARM_UNUMBER, 0));
+
+ BCMCLI_MAKE_CMD(dbg_dir, "alloc_id_alloc", "Allocate an alloc ID range or reuse an existing alloc ID range", rsc_mgr_cli_cmd_alloc_id_alloc,
+ BCMCLI_MAKE_PARM_RANGE("key.access_term_id", "access terminal identifier", BCMCLI_PARM_UNUMBER, 0, 0, MAX_SUPPORTED_OLTS),
+ BCMCLI_MAKE_PARM("key.access_int_id", "access interface identifier", BCMCLI_PARM_UNUMBER, 0),
+ BCMCLI_MAKE_PARM("agg_port_id", "aggregation port ID (if omitted a new alloc ID is allocated, otherwise we reuse an existing alloc ID)",
+ BCMCLI_PARM_UNUMBER, BCMCLI_PARM_FLAG_OPTIONAL),
+ BCMCLI_MAKE_PARM_RANGE("range_size", "range size", BCMCLI_PARM_UNUMBER, 0, RSC_MGR_MIN_RANGE_SIZE, RSC_MGR_MAX_RANGE_SIZE));
+
+ BCMCLI_MAKE_CMD(dbg_dir, "alloc_id_free", "Free an alloc ID range", rsc_mgr_cli_cmd_alloc_id_free,
+ BCMCLI_MAKE_PARM_RANGE("key.access_term_id", "access terminal identifier", BCMCLI_PARM_UNUMBER, 0, 0, MAX_SUPPORTED_OLTS),
+ BCMCLI_MAKE_PARM("key.access_int_id", "access interface identifier", BCMCLI_PARM_UNUMBER, 0),
+ BCMCLI_MAKE_PARM("agg_port_id", "base of alloc ID range", BCMCLI_PARM_UNUMBER, 0));
+
+ BCMCLI_MAKE_CMD(dbg_dir, "gem_alloc", "Allocate a GEM port range or reuse an existing GEM port range", rsc_mgr_cli_cmd_gem_alloc,
+ BCMCLI_MAKE_PARM_RANGE("key.access_term_id", "access terminal identifier", BCMCLI_PARM_UNUMBER, 0, 0, MAX_SUPPORTED_OLTS),
+ BCMCLI_MAKE_PARM("key.access_int_id", "access interface identifier", BCMCLI_PARM_UNUMBER, 0),
+ BCMCLI_MAKE_PARM("svc_port_id", "service port ID (if omitted a new GEM port is allocated, otherwise we reuse an existing GEM port)",
+ BCMCLI_PARM_UNUMBER, BCMCLI_PARM_FLAG_OPTIONAL),
+ BCMCLI_MAKE_PARM_RANGE("range_size", "range size", BCMCLI_PARM_UNUMBER, 0, RSC_MGR_MIN_RANGE_SIZE, RSC_MGR_MAX_RANGE_SIZE),
+ BCMCLI_MAKE_PARM_ENUM("gem_type", "GEM type", rsc_mgr_cli_enum_gem_type_table, 0));
+
+ BCMCLI_MAKE_CMD(dbg_dir, "gem_free", "Free a GEM port range", rsc_mgr_cli_cmd_gem_free,
+ BCMCLI_MAKE_PARM_RANGE("key.access_term_id", "access terminal identifier", BCMCLI_PARM_UNUMBER, 0, 0, MAX_SUPPORTED_OLTS),
+ BCMCLI_MAKE_PARM("key.access_int_id", "access interface identifier", BCMCLI_PARM_UNUMBER, 0),
+ BCMCLI_MAKE_PARM("svc_port_id", "base of GEM port range", BCMCLI_PARM_UNUMBER, 0));
+
+ BCMCLI_MAKE_CMD_NOPARM(dbg_dir, "tm_sched_auto_id_alloc", "Allocate a tm node auto id or reuse an existing id", rsc_mgr_cli_cmd_tm_sched_auto_alloc);
+
+ BCMCLI_MAKE_CMD(dbg_dir, "tm_sched_auto_id_free", "Free a tm node auto id", rsc_mgr_cli_cmd_tm_sched_auto_free,
+ BCMCLI_MAKE_PARM("tm_sched_auto_id", "tm node auto id to be free", BCMCLI_PARM_UNUMBER, 0));
+
+
+ BCMCLI_MAKE_CMD(dbg_dir, "show", "Show the database of the resource manager", rsc_mgr_cli_cmd_show,
+ BCMCLI_MAKE_PARM_RANGE("key.access_term_id", "access terminal identifier", BCMCLI_PARM_UNUMBER, 0, 0, MAX_SUPPORTED_OLTS),
+ BCMCLI_MAKE_PARM("key.access_int_id", "access interface identifier", BCMCLI_PARM_UNUMBER, 0));
+}
+
diff --git a/bal_release/src/lib/librscmgr/rsc_mgr_cli.h b/bal_release/src/lib/librscmgr/rsc_mgr_cli.h
new file mode 100644
index 0000000..7d9085c
--- /dev/null
+++ b/bal_release/src/lib/librscmgr/rsc_mgr_cli.h
@@ -0,0 +1,40 @@
+/******************************************************************************
+ *
+ * <:copyright-BRCM:2016:DUAL/GPL:standard
+ *
+ * Copyright (c) 2016 Broadcom
+ * All Rights Reserved
+ *
+ * Unless you and Broadcom execute a separate written software license
+ * agreement governing use of this software, this software is licensed
+ * to you under the terms of the GNU General Public License version 2
+ * (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
+ * with the following added to such license:
+ *
+ * As a special exception, the copyright holders of this software give
+ * you permission to link this software with independent modules, and
+ * to copy and distribute the resulting executable under terms of your
+ * choice, provided that you also meet, for each linked independent
+ * module, the terms and conditions of the license of that module.
+ * An independent module is a module which is not derived from this
+ * software. The special exception does not apply to any modifications
+ * of the software.
+ *
+ * Not withstanding the above, under no circumstances may you combine
+ * this software in any way with any other Broadcom software provided
+ * under a license other than the GPL, without Broadcom's express prior
+ * written consent.
+ *
+ * :>
+ *
+ *****************************************************************************/
+
+#ifndef _RSC_MGR_CLI_H_
+#define _RSC_MGR_CLI_H_
+
+#include <bcmcli.h>
+
+void rsc_mgr_cli_init(bcmcli_entry *cli_dir);
+
+#endif
+
diff --git a/bal_release/src/lib/librscmgr/rsc_mgr_common.c b/bal_release/src/lib/librscmgr/rsc_mgr_common.c
new file mode 100644
index 0000000..71bcee9
--- /dev/null
+++ b/bal_release/src/lib/librscmgr/rsc_mgr_common.c
@@ -0,0 +1,61 @@
+/******************************************************************************
+ *
+ * <:copyright-BRCM:2016:DUAL/GPL:standard
+ *
+ * Copyright (c) 2016 Broadcom
+ * All Rights Reserved
+ *
+ * Unless you and Broadcom execute a separate written software license
+ * agreement governing use of this software, this software is licensed
+ * to you under the terms of the GNU General Public License version 2
+ * (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
+ * with the following added to such license:
+ *
+ * As a special exception, the copyright holders of this software give
+ * you permission to link this software with independent modules, and
+ * to copy and distribute the resulting executable under terms of your
+ * choice, provided that you also meet, for each linked independent
+ * module, the terms and conditions of the license of that module.
+ * An independent module is a module which is not derived from this
+ * software. The special exception does not apply to any modifications
+ * of the software.
+ *
+ * Not withstanding the above, under no circumstances may you combine
+ * this software in any way with any other Broadcom software provided
+ * under a license other than the GPL, without Broadcom's express prior
+ * written consent.
+ *
+ * :>
+ *
+ *****************************************************************************/
+
+#include <bcm_topo.h>
+#include "rsc_mgr_common.h"
+
+#ifdef ENABLE_LOG
+dev_log_id rsc_mgr_log_id = DEV_LOG_INVALID_ID;
+#endif
+
+bcmos_errno rsc_mgr_init_validate(void)
+{
+ if (!rsc_mgr_context.is_initialized)
+ {
+#ifdef ENABLE_LOG
+ if (rsc_mgr_log_id == DEV_LOG_INVALID_ID)
+ {
+ rsc_mgr_log_id = bcm_dev_log_id_register("RSC_MGR", DEV_LOG_LEVEL_INFO, DEV_LOG_ID_TYPE_BOTH);
+ BUG_ON(rsc_mgr_log_id == DEV_LOG_INVALID_ID);
+ }
+#endif
+ return BCM_ERR_STATE;
+ }
+
+ if (!bcm_topo_is_initialized())
+ {
+ BCM_LOG(ERROR, rsc_mgr_log_id, "Resource manager cannot be called before topology is initialized\n");
+ return BCM_ERR_STATE;
+ }
+
+ return BCM_ERR_OK;
+}
+
diff --git a/bal_release/src/lib/librscmgr/rsc_mgr_common.h b/bal_release/src/lib/librscmgr/rsc_mgr_common.h
new file mode 100644
index 0000000..4d19176
--- /dev/null
+++ b/bal_release/src/lib/librscmgr/rsc_mgr_common.h
@@ -0,0 +1,147 @@
+/******************************************************************************
+ *
+ * <:copyright-BRCM:2016:DUAL/GPL:standard
+ *
+ * Copyright (c) 2016 Broadcom
+ * All Rights Reserved
+ *
+ * Unless you and Broadcom execute a separate written software license
+ * agreement governing use of this software, this software is licensed
+ * to you under the terms of the GNU General Public License version 2
+ * (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
+ * with the following added to such license:
+ *
+ * As a special exception, the copyright holders of this software give
+ * you permission to link this software with independent modules, and
+ * to copy and distribute the resulting executable under terms of your
+ * choice, provided that you also meet, for each linked independent
+ * module, the terms and conditions of the license of that module.
+ * An independent module is a module which is not derived from this
+ * software. The special exception does not apply to any modifications
+ * of the software.
+ *
+ * Not withstanding the above, under no circumstances may you combine
+ * this software in any way with any other Broadcom software provided
+ * under a license other than the GPL, without Broadcom's express prior
+ * written consent.
+ *
+ * :>
+ *
+ *****************************************************************************/
+
+#ifndef _RSC_MGR_COMMON_H_
+#define _RSC_MGR_COMMON_H_
+
+#include <bcmolt_host_api.h>
+#include <bcm_dev_log.h>
+#include <bal_objs.h>
+#include <bcmolt_math.h>
+
+#define RSC_MGR_MIN_RANGE_SIZE 1
+#define RSC_MGR_MAX_RANGE_SIZE 8
+
+#define RSC_MGR_PON_TOPO_CONTEXT(pon_id) ((rsc_mgr_topo_pon_context *)bcm_topo_pon_get_context(pon_id, BCM_TOPO_PON_CONTEXT_ID_RSC_MGR))
+
+typedef enum rsc_mgr_obj_type
+{
+ RSC_MGR_OBJ_TYPE_INVALID = 0,
+ RSC_MGR_OBJ_TYPE_GEM_PORT_UNICAST,
+ RSC_MGR_OBJ_TYPE_GEM_PORT_MULTICAST,
+ RSC_MGR_OBJ_TYPE_GEM_PORT_BROADCAST,
+ RSC_MGR_OBJ_TYPE_ALLOC_ID,
+ RSC_MGR_OBJ_TYPE_TM_SCHED,
+} rsc_mgr_obj_type;
+
+#define RSC_MGR_OBJ_TYPE_STR(_type) \
+ ((_type) == RSC_MGR_OBJ_TYPE_GEM_PORT_UNICAST ? "gem_port_unicast":\
+ (_type) == RSC_MGR_OBJ_TYPE_GEM_PORT_MULTICAST ? "gem_port_multicast":\
+ (_type) == RSC_MGR_OBJ_TYPE_GEM_PORT_BROADCAST ? "gem_port_broadcast":\
+ (_type) == RSC_MGR_OBJ_TYPE_ALLOC_ID ? "alloc_id":\
+ (_type) == RSC_MGR_OBJ_TYPE_TM_SCHED ? "tm_sched":"invalid")
+
+
+typedef struct
+{
+ bcmos_bool is_initialized;
+} rsc_mgr_context_t;
+
+extern rsc_mgr_context_t rsc_mgr_context;
+
+/** @brief container for storing user data */
+typedef struct rsc_mgr_user_data_entry
+{
+ TAILQ_ENTRY(rsc_mgr_user_data_entry) next;
+ void *user_data;
+} rsc_mgr_user_data_entry;
+
+/** @brief linked list of flow entries sharing the same GEM port or Alloc Id */
+typedef TAILQ_HEAD(, rsc_mgr_user_data_entry) shared_obj_user_data_list;
+
+/* An object ID can be either alloc ID or GEM port. */
+typedef uint32_t rsc_mgr_obj_id;
+
+/* An element for an object linked list. */
+typedef struct rsc_mgr_obj
+{
+ TAILQ_ENTRY(rsc_mgr_obj) list;
+ struct rsc_mgr_obj *base_obj; /* The last object of a range points to the base object of the range. */
+ rsc_mgr_obj_id id;
+ uint32_t ref_count;
+ uint32_t range_size;
+ rsc_mgr_obj_type type;
+ shared_obj_user_data_list user_data_list; /* this stores a list of flows sharing the same gem or alloc id object */
+} rsc_mgr_obj;
+
+typedef TAILQ_HEAD(, rsc_mgr_obj) rsc_mgr_obj_list;
+
+typedef bcmos_bool (*rsc_mgr_is_valid_data_obj_id_cb_t)(bcmolt_pon_ni pon_id, rsc_mgr_obj_id id, rsc_mgr_obj_id min_data_obj_id);
+typedef rsc_mgr_obj_id (*rsc_mgr_get_last_data_obj_id_cb_t)(bcmolt_pon_ni pon_id, rsc_mgr_obj_id min_data_obj_id);
+
+typedef struct
+{
+ const char *obj_name;
+ rsc_mgr_is_valid_data_obj_id_cb_t is_valid_data_obj_id_cb;
+ rsc_mgr_get_last_data_obj_id_cb_t get_last_data_obj_id_cb;
+ rsc_mgr_obj_list free_objs;
+ rsc_mgr_obj_list allocated_objs;
+ rsc_mgr_obj *objs; /* Dynamically allocated */
+ uint32_t num_of_objs;
+ rsc_mgr_obj_id min_data_obj_id;
+} rsc_mgr_obj_rsc;
+
+typedef struct
+{
+ rsc_mgr_obj_rsc alloc_ids;
+ rsc_mgr_obj_rsc gems;
+ uint16_t num_of_alloc_ids;
+ uint16_t num_of_gem_ports;
+#ifndef MULTIPLE_MULTICAST_GEM_PORTS_PER_PON
+ uint16_t multicast_gem_port; /* For validation purposes (validate there is no more than a single multicast GEM port per PON). */
+#endif
+#ifndef MULTIPLE_BROADCAST_GEM_PORTS_PER_PON
+ uint16_t broadcast_gem_port; /* For validation purposes (validate there is no more than a single broadcast GEM port per PON). */
+#endif
+#ifdef ENABLE_LOG
+ dev_log_id log_id;
+ char log_id_name[MAX_DEV_LOG_ID_NAME];
+#endif
+} rsc_mgr_topo_pon_context;
+
+typedef struct
+{
+ rsc_mgr_obj_rsc tm_sched_auto_key_ids;
+ uint16_t num_of_tm_sched_auto_key_ids;
+#ifdef ENABLE_LOG
+ dev_log_id log_id;
+ char log_id_name[MAX_DEV_LOG_ID_NAME];
+#endif
+
+} rsc_mgr_tm_context;
+#ifdef ENABLE_LOG
+extern dev_log_id rsc_mgr_log_id;
+#endif
+
+bcmos_errno rsc_mgr_init_validate(void);
+
+#endif
+
diff --git a/bal_release/src/lib/libtopology/Makefile b/bal_release/src/lib/libtopology/Makefile
new file mode 100644
index 0000000..7507881
--- /dev/null
+++ b/bal_release/src/lib/libtopology/Makefile
@@ -0,0 +1,36 @@
+###############################################################################
+#
+# <:copyright-BRCM:2016:DUAL/GPL:standard
+#
+# Copyright (c) 2016 Broadcom
+# All Rights Reserved
+#
+# Unless you and Broadcom execute a separate written software license
+# agreement governing use of this software, this software is licensed
+# to you under the terms of the GNU General Public License version 2
+# (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
+# with the following added to such license:
+#
+# As a special exception, the copyright holders of this software give
+# you permission to link this software with independent modules, and
+# to copy and distribute the resulting executable under terms of your
+# choice, provided that you also meet, for each linked independent
+# module, the terms and conditions of the license of that module.
+# An independent module is a module which is not derived from this
+# software. The special exception does not apply to any modifications
+# of the software.
+#
+# Not withstanding the above, under no circumstances may you combine
+# this software in any way with any other Broadcom software provided
+# under a license other than the GPL, without Broadcom's express prior
+# written consent.
+#
+# :>
+#
+###############################################################################
+MOD_NAME = topology
+MOD_TYPE = lib
+MOD_DEPS = dev_log maple_sdk
+
+srcs = bcm_topo.c
+
diff --git a/bal_release/src/lib/libtopology/bcm_topo.c b/bal_release/src/lib/libtopology/bcm_topo.c
new file mode 100644
index 0000000..4b092a0
--- /dev/null
+++ b/bal_release/src/lib/libtopology/bcm_topo.c
@@ -0,0 +1,650 @@
+/******************************************************************************
+ *
+ * <:copyright-BRCM:2016:DUAL/GPL:standard
+ *
+ * Copyright (c) 2016 Broadcom
+ * All Rights Reserved
+ *
+ * Unless you and Broadcom execute a separate written software license
+ * agreement governing use of this software, this software is licensed
+ * to you under the terms of the GNU General Public License version 2
+ * (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
+ * with the following added to such license:
+ *
+ * As a special exception, the copyright holders of this software give
+ * you permission to link this software with independent modules, and
+ * to copy and distribute the resulting executable under terms of your
+ * choice, provided that you also meet, for each linked independent
+ * module, the terms and conditions of the license of that module.
+ * An independent module is a module which is not derived from this
+ * software. The special exception does not apply to any modifications
+ * of the software.
+ *
+ * Not withstanding the above, under no circumstances may you combine
+ * this software in any way with any other Broadcom software provided
+ * under a license other than the GPL, without Broadcom's express prior
+ * written consent.
+ *
+ * :>
+ *
+ *****************************************************************************/
+
+#include <bcm_dev_log.h>
+#include <bcmolt_math.h>
+#include "bcm_topo.h"
+
+#define BCM_TOPO_MAX_LINE_SIZE 256
+#define BCM_TOPO_MAX_NNI_DEVICES 1
+
+uint32_t g_max_nni_ports[BCM_TOPO_MAX_NNI_DEVICES] = {BCM_TOPO_MAX_NNI_PORTS};
+
+typedef struct bcm_topo_dev_context_t bcm_topo_dev_context_t;
+
+typedef struct
+{
+ bcm_topo_dev_context_t *dev; /* Back pointer to the physical device this PON belongs to */
+ bcmos_bool is_initialized;
+ uint32_t pon_id;
+ uint32_t logical_pon;
+ bcm_topo_pon_mode pon_mode;
+ uint32_t max_num_of_onus;
+ void *contexts[BCM_TOPO_PON_CONTEXT_ID__NUM_OF]; /* User context - 1 entry per user */
+} bcm_topo_pon_context_t;
+
+struct bcm_topo_dev_context_t
+{
+ bcm_topo_pon_mode pon_mode; /* Currently we do not allow more than one PON mode per device (e.g: GPONx8 + XGPONx4) */
+ bcmos_bool is_initialized;
+ uint32_t device_id;
+ uint32_t max_num_of_pons;
+ bcm_topo_pon_context_t pons[BCM_TOPO_MAX_NUM_OF_PONS_PER_DEV];
+};
+
+typedef struct
+{
+ bcmos_bool is_initialized;
+ bcm_topo_dev_context_t devs[BCM_TOPO_MAX_NUM_OF_DEVS];
+ bcm_topo_pon_context_t *logical_pon2physical_pon[BCM_TOPO_MAX_NUM_OF_LOGICAL_PONS];
+} bcm_topo_context_t;
+
+static bcm_topo_context_t bcm_topo_context;
+
+#ifdef ENABLE_LOG
+static dev_log_id topo_log_id = DEV_LOG_INVALID_ID;
+#endif
+
+static int2str_t pon_mode2str[] =
+{
+ {BCM_TOPO_PON_MODE_GPON, "gpon"},
+ {BCM_TOPO_PON_MODE_XGPON, "xgpon"},
+ {BCM_TOPO_PON_MODE_XGS, "xgs"},
+ {BCM_TOPO_PON_MODE_EPON_TDMA, "epon_tdma"},
+ {BCM_TOPO_PON_MODE_EPON_1G, "epon_1g"},
+ {BCM_TOPO_PON_MODE_EPON_10G, "epon_10g"},
+ {-1},
+};
+
+static int2int_t pon_mode2max_num_of_pons[] =
+{
+ {BCM_TOPO_PON_MODE_GPON, 16},
+ {BCM_TOPO_PON_MODE_XGPON, 8},
+ {BCM_TOPO_PON_MODE_XGS, 2},
+ {BCM_TOPO_PON_MODE_EPON_TDMA, 8},
+ {BCM_TOPO_PON_MODE_EPON_1G, 16},
+ {BCM_TOPO_PON_MODE_EPON_10G, 8},
+ {-1},
+};
+
+const char *bcm_topo_dev_get_pon_mode_str(bcmolt_devid device_id)
+{
+ return int2str(pon_mode2str, bcm_topo_context.devs[device_id].pon_mode);
+}
+
+int bcm_topo_dev_get_max_pon(bcmolt_devid device_id)
+{
+ return int2int(pon_mode2max_num_of_pons, bcm_topo_context.devs[device_id].pon_mode);
+}
+
+bcm_topo_pon_mode bcm_topo_pon_get_pon_mode(uint32_t pon)
+{
+ bcmolt_devid device_id;
+ uint32_t physical_pon;
+ bcmos_errno rc;
+
+ rc = bcm_topo_pon_get_logical2physical(pon, &device_id, &physical_pon);
+ if (rc != BCM_ERR_OK)
+ return BCM_TOPO_PON_MODE_INVALID;
+
+ return bcm_topo_context.devs[device_id].pons[physical_pon].pon_mode;
+}
+
+bcm_topo_pon_family bcm_topo_pon_get_pon_family(uint32_t pon)
+{
+ switch (bcm_topo_pon_get_pon_mode(pon))
+ {
+ case BCM_TOPO_PON_MODE_GPON:
+ case BCM_TOPO_PON_MODE_XGPON:
+ case BCM_TOPO_PON_MODE_XGS:
+ return BCM_TOPO_PON_FAMILY_GPON;
+ case BCM_TOPO_PON_MODE_EPON_TDMA:
+ case BCM_TOPO_PON_MODE_EPON_1G:
+ case BCM_TOPO_PON_MODE_EPON_10G:
+ return BCM_TOPO_PON_FAMILY_EPON;
+ default:
+ return BCM_TOPO_PON_FAMILY_INVALID;
+ }
+}
+
+bcm_topo_pon_sub_family bcm_topo_pon_get_pon_sub_family(uint32_t pon)
+{
+ switch (bcm_topo_pon_get_pon_mode(pon))
+ {
+ case BCM_TOPO_PON_MODE_GPON:
+ return BCM_TOPO_PON_SUB_FAMILY_GPON;
+ case BCM_TOPO_PON_MODE_XGPON:
+ case BCM_TOPO_PON_MODE_XGS:
+ return BCM_TOPO_PON_SUB_FAMILY_XGPON;
+ case BCM_TOPO_PON_MODE_EPON_TDMA:
+ case BCM_TOPO_PON_MODE_EPON_1G:
+ case BCM_TOPO_PON_MODE_EPON_10G:
+ return BCM_TOPO_PON_SUB_FAMILY_EPON;
+ default:
+ return BCM_TOPO_PON_SUB_FAMILY_INVALID;
+ }
+}
+
+uint32_t bcm_topo_pon_get_max_num_of_onus(uint32_t pon)
+{
+ bcmolt_devid device_id;
+ uint32_t physical_pon;
+ bcmos_errno rc;
+
+ rc = bcm_topo_pon_get_logical2physical(pon, &device_id, &physical_pon);
+ if (rc != BCM_ERR_OK)
+ return BCM_TOPO_ERR_INVALID;
+
+ return bcm_topo_context.devs[device_id].pons[physical_pon].max_num_of_onus;
+}
+
+bcmos_bool bcm_topo_pon_is_valid(uint32_t pon)
+{
+ bcmolt_devid device_id;
+ uint32_t physical_pon;
+
+ if (bcm_topo_pon_get_logical2physical(pon, &device_id, &physical_pon) != BCM_ERR_OK)
+ return BCMOS_FALSE;
+
+ return BCMOS_TRUE;
+}
+
+bcmolt_devid bcm_topo_dev_get_next(bcmolt_devid device_id)
+{
+ if (device_id == BCM_TOPO_DEV_INVALID)
+ device_id = 0;
+ else
+ device_id++;
+
+ for (; device_id < BCM_TOPO_MAX_NUM_OF_DEVS && !bcm_topo_context.devs[device_id].is_initialized; device_id++);
+
+ return device_id == BCM_TOPO_MAX_NUM_OF_DEVS ? BCM_TOPO_DEV_INVALID : device_id;
+}
+
+uint32_t bcm_topo_pon_get_next(bcmolt_devid device_id, uint32_t pon)
+{
+ uint32_t physical_pon;
+ bcmos_errno rc;
+
+ if (device_id >= BCM_TOPO_MAX_NUM_OF_DEVS)
+ {
+ BCM_LOG(ERROR, topo_log_id, "Device ID must be in the range 0 .. %u\n", BCM_TOPO_MAX_NUM_OF_DEVS - 1);
+ return BCM_TOPO_PON_INVALID;
+ }
+
+ if (pon == BCM_TOPO_PON_INVALID)
+ physical_pon = 0;
+ else
+ {
+ bcmolt_devid dummy;
+
+ rc = bcm_topo_pon_get_logical2physical(pon, &dummy, &physical_pon);
+ if (rc != BCM_ERR_OK)
+ {
+ return BCM_TOPO_PON_INVALID;
+ }
+ else
+ {
+ physical_pon++;
+ }
+ }
+
+ if (physical_pon < bcm_topo_context.devs[device_id].max_num_of_pons)
+ {
+ rc = bcm_topo_pon_get_physical2logical(device_id, physical_pon, &pon);
+ if (rc != BCM_ERR_OK)
+ {
+ return BCM_TOPO_PON_INVALID;
+ }
+ else
+ {
+ return pon;
+ }
+ }
+
+ return BCM_TOPO_PON_INVALID;
+}
+
+bcmos_errno bcm_topo_pon_get_logical2physical(uint32_t logical_pon, bcmolt_devid *device_id, uint32_t *physical_pon)
+{
+ if (logical_pon >= BCM_TOPO_MAX_NUM_OF_LOGICAL_PONS)
+ {
+ BCM_LOG(ERROR, topo_log_id, "Logical PON ID must be in the range 0 .. %u\n", BCM_TOPO_MAX_NUM_OF_LOGICAL_PONS - 1);
+ return BCM_ERR_RANGE;
+ }
+
+ if (!bcm_topo_context.logical_pon2physical_pon[logical_pon])
+ {
+ BCM_LOG(ERROR, topo_log_id, "Logical PON=%u was not associated with a physical PON\n", logical_pon);
+ return BCM_ERR_RANGE;
+ }
+
+ *physical_pon = bcm_topo_context.logical_pon2physical_pon[logical_pon]->pon_id;
+ *device_id = bcm_topo_context.logical_pon2physical_pon[logical_pon]->dev->device_id;
+
+ return BCM_ERR_OK;
+}
+
+bcmos_errno bcm_topo_pon_get_physical2logical(bcmolt_devid device_id, uint32_t physical_pon, uint32_t *logical_pon)
+{
+ if (device_id >= BCM_TOPO_MAX_NUM_OF_DEVS)
+ {
+ BCM_LOG(ERROR, topo_log_id, "Device ID must be in the range 0 .. %u\n", BCM_TOPO_MAX_NUM_OF_DEVS - 1);
+ return BCM_ERR_RANGE;
+ }
+
+ if (physical_pon >= bcm_topo_context.devs[device_id].max_num_of_pons)
+ {
+ BCM_LOG(ERROR, topo_log_id, "Physical PON ID must be in the range 0 .. %u\n", bcm_topo_context.devs[device_id].max_num_of_pons - 1);
+ return BCM_ERR_RANGE;
+ }
+
+ if (bcm_topo_context.devs[device_id].pons[physical_pon].logical_pon == BCM_TOPO_PON_INVALID)
+ {
+ BCM_LOG(ERROR, topo_log_id, "Physical PON=%u on device=%u was not associated with a logical PON\n", physical_pon, device_id);
+ return BCM_ERR_RANGE;
+ }
+
+ *logical_pon = bcm_topo_context.devs[device_id].pons[physical_pon].logical_pon;
+
+ return BCM_ERR_OK;
+}
+
+bcmos_errno bcm_topo_pon_set_context(uint32_t pon, bcm_topo_pon_context_id pon_context_id, void *context)
+{
+ bcmolt_devid device_id;
+ uint32_t physical_pon;
+ bcmos_errno rc;
+
+ if (pon_context_id >= BCM_TOPO_PON_CONTEXT_ID__NUM_OF)
+ {
+ BCM_LOG(ERROR, topo_log_id, "Invalid PON context ID\n");
+ return BCM_ERR_RANGE;
+ }
+
+ rc = bcm_topo_pon_get_logical2physical(pon, &device_id, &physical_pon);
+ if (rc != BCM_ERR_OK)
+ return rc;
+
+ bcm_topo_context.devs[device_id].pons[physical_pon].contexts[pon_context_id] = context;
+
+ return BCM_ERR_OK;
+}
+
+void *bcm_topo_pon_get_context(uint32_t pon, bcm_topo_pon_context_id pon_context_id)
+{
+ bcmolt_devid device_id;
+ uint32_t physical_pon;
+ bcmos_errno rc;
+
+ if (pon_context_id >= BCM_TOPO_PON_CONTEXT_ID__NUM_OF)
+ {
+ BCM_LOG(ERROR, topo_log_id, "Invalid PON context ID\n");
+ return NULL;
+ }
+
+ rc = bcm_topo_pon_get_logical2physical(pon, &device_id, &physical_pon);
+ if (rc != BCM_ERR_OK)
+ return NULL;
+
+ return bcm_topo_context.devs[device_id].pons[physical_pon].contexts[pon_context_id];
+}
+
+static void bcm_topo_init_context(void)
+{
+ uint32_t device_id;
+
+ for (device_id = 0; device_id < BCM_TOPO_MAX_NUM_OF_DEVS; device_id++)
+ {
+ bcm_topo_dev_context_t *dev;
+ uint32_t pon_id;
+
+ dev = &bcm_topo_context.devs[device_id];
+ dev->device_id = device_id;
+ dev->pon_mode = BCM_TOPO_PON_MODE_INVALID;
+ for (pon_id = 0; pon_id < BCM_TOPO_MAX_NUM_OF_PONS_PER_DEV; pon_id++)
+ {
+ bcm_topo_pon_context_t *pon;
+
+ pon = &dev->pons[pon_id];
+ pon->dev = dev;
+ pon->pon_id = pon_id;
+ pon->pon_mode = BCM_TOPO_PON_MODE_INVALID;
+ pon->logical_pon = BCM_TOPO_PON_INVALID;
+ }
+ }
+}
+
+static bcmos_errno bcm_topo_init_line_parse(const char *line, const char *filename, uint32_t line_num, bcmos_bool *is_skipped, uint32_t *logical_pon, bcm_topo_pon_mode *pon_mode,
+ uint32_t *device_id, uint32_t *physical_pon)
+{
+ int rc;
+ char logical_pon_str[BCM_TOPO_MAX_LINE_SIZE];
+ char pon_mode_str[BCM_TOPO_MAX_LINE_SIZE];
+ char device_id_str[BCM_TOPO_MAX_LINE_SIZE];
+ char physical_pon_str[BCM_TOPO_MAX_LINE_SIZE];
+ int2str_t *p;
+
+ /* Skip blank lines and comments. */
+ if (!*line || *line == '\n' || *line == '#')
+ {
+ *is_skipped = BCMOS_TRUE;
+ return BCM_ERR_OK;
+ }
+
+ *is_skipped = BCMOS_FALSE;
+
+ /* Read the tokens separated by commas. */
+ rc = sscanf(line, "%[^,],%*[ ]%[^,],%[^,],%[^\n]", logical_pon_str, pon_mode_str, device_id_str, physical_pon_str);
+ if (rc < 4)
+ {
+ BCM_LOG(ERROR, topo_log_id, "Error parsing line %s:%u (rc=%u)\n", filename, line_num, rc);
+ return BCM_ERR_PARSE;
+ }
+
+ if (sscanf(logical_pon_str, "%u", logical_pon) < 1)
+ {
+ BCM_LOG(ERROR, topo_log_id, "Error parsing line %s:%u (rc=%u)\n", filename, line_num, rc);
+ return BCM_ERR_PARSE;
+ }
+
+ if (sscanf(device_id_str, "%u", device_id) < 1)
+ {
+ BCM_LOG(ERROR, topo_log_id, "Error parsing line %s:%u (rc=%u)\n", filename, line_num, rc);
+ return BCM_ERR_PARSE;
+ }
+
+ if (sscanf(physical_pon_str, "%u", physical_pon) < 1)
+ {
+ BCM_LOG(ERROR, topo_log_id, "Error parsing line %s:%u (rc=%u)\n", filename, line_num, rc);
+ return BCM_ERR_PARSE;
+ }
+
+ BCM_LOG(INFO, topo_log_id, "Map Logical PON ID=%u -> (Physical Device ID=%u, Physical Pon ID=%u, PON mode='%s')\n", *logical_pon, *device_id, *physical_pon, pon_mode_str);
+
+ for (p = pon_mode2str; p->from != -1 && strcmp(pon_mode_str, p->to); p++);
+
+ if (p->from == -1)
+ {
+ BCM_LOG(ERROR, topo_log_id, "Error parsing PON mode at %s:%u\n", filename, line_num);
+ return BCM_ERR_PARSE;
+ }
+
+ *pon_mode = p->from;
+
+ return BCM_ERR_OK;
+}
+
+static void bcm_topo_init_dev(bcm_topo_dev_context_t *dev, bcm_topo_pon_mode pon_mode)
+{
+ dev->pon_mode = pon_mode;
+ dev->max_num_of_pons = int2int(pon_mode2max_num_of_pons, pon_mode);
+}
+
+static void bcm_topo_init_pon(bcm_topo_pon_context_t *pon, bcm_topo_pon_mode pon_mode)
+{
+ pon->pon_mode = pon_mode;
+ switch (pon_mode)
+ {
+ case BCM_TOPO_PON_MODE_GPON:
+ pon->max_num_of_onus = 128;
+ break;
+ case BCM_TOPO_PON_MODE_XGPON:
+ case BCM_TOPO_PON_MODE_XGS:
+ pon->max_num_of_onus = 256;
+ break;
+ case BCM_TOPO_PON_MODE_EPON_TDMA:
+ case BCM_TOPO_PON_MODE_EPON_1G:
+ case BCM_TOPO_PON_MODE_EPON_10G:
+ pon->max_num_of_onus = 0; /* There is no "ONU" in EPON, but LLIDs. */
+ break;
+ default:
+ break;
+ }
+}
+
+static bcmos_errno bcm_topo_init_by_file(FILE *fp, const char *filename)
+{
+ char line[BCM_TOPO_MAX_LINE_SIZE];
+ uint32_t line_num;
+
+ /* Read next line. */
+ line_num = 1;
+ while (fgets(line, sizeof(line), fp))
+ {
+ bcmos_bool is_skipped;
+ uint32_t logical_pon, device_id, physical_pon;
+ bcm_topo_pon_mode pon_mode;
+ bcm_topo_dev_context_t *dev;
+ bcm_topo_pon_context_t *pon;
+
+ if (bcm_topo_init_line_parse(line, filename, line_num, &is_skipped, &logical_pon, &pon_mode, &device_id, &physical_pon) != BCM_ERR_OK)
+ return BCM_ERR_PARSE;
+
+ if (is_skipped)
+ {
+ line_num++;
+ continue;
+ }
+
+ if (logical_pon >= BCM_TOPO_MAX_NUM_OF_LOGICAL_PONS)
+ {
+ BCM_LOG(ERROR, topo_log_id, "Logical PON ID at %s:%u must be in the range 0 .. %u\n", filename, line_num, BCM_TOPO_MAX_NUM_OF_LOGICAL_PONS - 1);
+ return BCM_ERR_RANGE;
+ }
+
+ if (bcm_topo_context.logical_pon2physical_pon[logical_pon])
+ {
+ BCM_LOG(ERROR, topo_log_id, "Logical PON ID at %s:%u has already been set before\n", filename, line_num);
+ return BCM_ERR_ALREADY;
+ }
+
+ if (device_id >= BCM_TOPO_MAX_NUM_OF_DEVS)
+ {
+ BCM_LOG(ERROR, topo_log_id, "Physical device ID at %s:%u must be in the range 0 .. %u\n", filename, line_num, BCM_TOPO_MAX_NUM_OF_DEVS - 1);
+ return BCM_ERR_RANGE;
+ }
+
+ dev = &bcm_topo_context.devs[device_id];
+ if (!dev->is_initialized)
+ {
+ bcm_topo_init_dev(dev, pon_mode);
+ dev->is_initialized = BCMOS_TRUE;
+ }
+ else if (dev->pon_mode != pon_mode)
+ {
+ BCM_LOG(ERROR, topo_log_id, "PON mode at %s:%u conflicts with PON mode='%s' that has already been set for this device\n", filename, line_num,
+ int2str(pon_mode2str, dev->pon_mode));
+ return BCM_ERR_NOT_SUPPORTED;
+ }
+
+ if (physical_pon >= dev->max_num_of_pons)
+ {
+ BCM_LOG(ERROR, topo_log_id, "Physical PON ID at %s:%u must be in the range 0 .. %u\n", filename, line_num, dev->max_num_of_pons - 1);
+ return BCM_ERR_RANGE;
+ }
+
+ pon = &bcm_topo_context.devs[device_id].pons[physical_pon];
+ if (!pon->is_initialized)
+ {
+ bcm_topo_init_pon(pon, pon_mode);
+ pon->is_initialized = BCMOS_TRUE;
+ }
+ else
+ {
+ BCM_LOG(ERROR, topo_log_id, "Physical PON ID at %s:%u has already been set before\n", filename, line_num);
+ return BCM_ERR_ALREADY;
+ }
+
+ bcm_topo_context.logical_pon2physical_pon[logical_pon] = &bcm_topo_context.devs[device_id].pons[physical_pon];
+ bcm_topo_context.devs[device_id].pons[physical_pon].logical_pon = logical_pon;
+
+ line_num++;
+ }
+
+ return BCM_ERR_OK;
+}
+
+static bcmos_errno bcm_topo_init_by_args(bcm_topo_params *params)
+{
+ uint32_t device_id;
+ uint32_t max_num_of_pons_per_dev;
+
+ if (params->num_of_devs > BCM_TOPO_MAX_NUM_OF_DEVS)
+ {
+ BCM_LOG(ERROR, topo_log_id, "Number of devices must be in the range 0 .. %u\n", BCM_TOPO_MAX_NUM_OF_DEVS);
+ return BCM_ERR_RANGE;
+ }
+
+ max_num_of_pons_per_dev = int2int(pon_mode2max_num_of_pons, params->pon_mode);
+
+ if (params->num_of_pons_per_dev > max_num_of_pons_per_dev)
+ {
+ BCM_LOG(ERROR, topo_log_id, "Number of PONs per device for PON mode '%s' must be in the range 0 .. %u\n", int2str(pon_mode2str, params->pon_mode), BCM_TOPO_MAX_NUM_OF_DEVS);
+ return BCM_ERR_RANGE;
+ }
+
+ for (device_id = 0; device_id < params->num_of_devs; device_id++)
+ {
+ uint32_t physical_pon;
+ bcm_topo_dev_context_t *dev;
+ bcm_topo_pon_context_t *pon;
+
+ dev = &bcm_topo_context.devs[device_id];
+ bcm_topo_init_dev(dev, params->pon_mode);
+ dev->is_initialized = BCMOS_TRUE;
+
+ for (physical_pon = 0; physical_pon < params->num_of_pons_per_dev; physical_pon++)
+ {
+ uint32_t logical_pon;
+
+ logical_pon = (device_id * params->num_of_pons_per_dev) + physical_pon;
+
+ BCM_LOG(INFO, topo_log_id, "Map Logical PON ID=%u -> (Physical Device ID=%u, Physical pon ID=%u, PON mode='%s')\n", logical_pon, device_id, physical_pon,
+ int2str(pon_mode2str, params->pon_mode));
+
+ pon = &bcm_topo_context.devs[device_id].pons[physical_pon];
+ bcm_topo_init_pon(pon, params->pon_mode);
+ pon->is_initialized = BCMOS_TRUE;
+
+ bcm_topo_context.logical_pon2physical_pon[logical_pon] = &bcm_topo_context.devs[device_id].pons[physical_pon];
+ bcm_topo_context.devs[device_id].pons[physical_pon].logical_pon = logical_pon;
+ }
+ }
+
+ return BCM_ERR_OK;
+}
+
+bcmos_errno bcm_topo_init(bcm_topo_params *params, const char *topo_filename)
+{
+ bcmos_errno ret;
+ FILE *topo_fp;
+
+#ifdef ENABLE_LOG
+ if (topo_log_id == DEV_LOG_INVALID_ID)
+ {
+ topo_log_id = bcm_dev_log_id_register("TOPOLOGY", DEV_LOG_LEVEL_INFO, DEV_LOG_ID_TYPE_BOTH);
+ BUG_ON(topo_log_id == DEV_LOG_INVALID_ID);
+ }
+#endif
+
+ bcm_topo_init_context();
+
+ topo_fp = fopen(topo_filename, "r");
+ if (topo_fp)
+ {
+ BCM_LOG(INFO, topo_log_id, "Topology is taken from file\n");
+ ret = bcm_topo_init_by_file(topo_fp, topo_filename);
+ fclose(topo_fp);
+ }
+ else if (params)
+ {
+ BCM_LOG(INFO, topo_log_id, "Topology is taken from arguments\n");
+ ret = bcm_topo_init_by_args(params);
+ }
+ else
+ {
+ BCM_LOG(INFO, topo_log_id, "At least one of topo_fp and params must be specified and exist\n");
+ ret = BCM_ERR_PARM;
+ }
+
+ if (ret != BCM_ERR_OK)
+ goto exit;
+
+ bcm_topo_context.is_initialized = BCMOS_TRUE;
+
+ ret = BCM_ERR_OK;
+
+exit:
+ return ret;
+}
+
+bcmos_bool bcm_topo_is_initialized(void)
+{
+ return bcm_topo_context.is_initialized;
+}
+
+bcmos_bool bcm_topo_dev_set_max_nni(bcmolt_devid device_id, uint32_t num_nni_ports)
+{
+ if(device_id >= BCM_TOPO_MAX_NNI_DEVICES)
+ {
+ return BCM_ERR_PARM;
+ }
+ /* make sure the max number does not exceed the allocated resrouce */
+ if( num_nni_ports > BCM_TOPO_MAX_NNI_PORTS)
+ {
+ return BCM_ERR_PARM;
+ }
+ g_max_nni_ports[device_id] = num_nni_ports;
+
+ return BCMOS_TRUE;
+}
+
+bcmos_bool bcm_topo_dev_get_max_nni(bcmolt_devid device_id, uint32_t *p_num_nni_ports)
+{
+ if(device_id >= BCM_TOPO_MAX_NNI_DEVICES)
+ {
+ return BCM_ERR_PARM;
+ }
+ *p_num_nni_ports = g_max_nni_ports[device_id];
+
+ return BCMOS_TRUE;
+}
+
+bcmos_bool bcm_topo_nni_is_valid(uint32_t nni)
+{
+
+ if (nni >= g_max_nni_ports[0])
+ return BCMOS_FALSE;
+
+ return BCMOS_TRUE;
+}
+
diff --git a/bal_release/src/lib/libtopology/bcm_topo.h b/bal_release/src/lib/libtopology/bcm_topo.h
new file mode 100644
index 0000000..9c6ec1c
--- /dev/null
+++ b/bal_release/src/lib/libtopology/bcm_topo.h
@@ -0,0 +1,270 @@
+/******************************************************************************
+ *
+ * <:copyright-BRCM:2016:DUAL/GPL:standard
+ *
+ * Copyright (c) 2016 Broadcom
+ * All Rights Reserved
+ *
+ * Unless you and Broadcom execute a separate written software license
+ * agreement governing use of this software, this software is licensed
+ * to you under the terms of the GNU General Public License version 2
+ * (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
+ * with the following added to such license:
+ *
+ * As a special exception, the copyright holders of this software give
+ * you permission to link this software with independent modules, and
+ * to copy and distribute the resulting executable under terms of your
+ * choice, provided that you also meet, for each linked independent
+ * module, the terms and conditions of the license of that module.
+ * An independent module is a module which is not derived from this
+ * software. The special exception does not apply to any modifications
+ * of the software.
+ *
+ * Not withstanding the above, under no circumstances may you combine
+ * this software in any way with any other Broadcom software provided
+ * under a license other than the GPL, without Broadcom's express prior
+ * written consent.
+ *
+ * :>
+ *
+ *****************************************************************************/
+
+#ifndef _BCM_TOPO_H_
+#define _BCM_TOPO_H_
+
+#include <bcmolt_conv.h>
+#include <bcmos_system.h>
+#include <bcmolt_model_types.h>
+#include <bal_model_types.h>
+
+#define BCM_TOPO_DEV_INVALID UINT8_MAX
+#define BCM_TOPO_PON_INVALID UINT32_MAX
+#define BCM_TOPO_ERR_INVALID UINT32_MAX
+#define BCM_TOPO_MAX_NUM_OF_DEVS 8 /* Maxmimum of 8 devices per vOLT. */
+#define BCM_TOPO_MAX_NUM_OF_PONS_PER_DEV 16
+#define BCM_TOPO_MAX_NUM_OF_LOGICAL_PONS (BCM_TOPO_MAX_NUM_OF_DEVS * BCM_TOPO_MAX_NUM_OF_PONS_PER_DEV)
+
+#define BCM_TOPO_FOR_EACH_DEV(device_id) \
+ for (device_id = bcm_topo_dev_get_next(BCM_TOPO_DEV_INVALID); device_id != BCM_TOPO_DEV_INVALID; device_id = bcm_topo_dev_get_next(device_id))
+
+#define BCM_TOPO_DEV_FOR_EACH_PON(device_id, pon) \
+ for (pon = bcm_topo_pon_get_next(device_id, BCM_TOPO_PON_INVALID); pon != BCM_TOPO_PON_INVALID; pon = bcm_topo_pon_get_next(device_id, pon))
+
+#define BCM_TOPO_FOR_EACH_PON(device_id, pon) \
+ for (device_id = bcm_topo_dev_get_next(BCM_TOPO_DEV_INVALID); device_id != BCM_TOPO_DEV_INVALID; device_id = bcm_topo_dev_get_next(device_id)) \
+ BCM_TOPO_DEV_FOR_EACH_PON(device_id, pon)
+
+#define BCM_TOPO_FOR_EACH_ONU(pon, onu) \
+ for (onu = 0; onu < bcm_topo_pon_get_max_num_of_onus(pon); onu++)
+
+typedef enum
+{
+ BCM_TOPO_PON_MODE_GPON,
+ BCM_TOPO_PON_MODE_XGPON,
+ BCM_TOPO_PON_MODE_XGS,
+ BCM_TOPO_PON_MODE_EPON_TDMA,
+ BCM_TOPO_PON_MODE_EPON_1G,
+ BCM_TOPO_PON_MODE_EPON_10G,
+ BCM_TOPO_PON_MODE_INVALID,
+ BCM_TOPO_PON_MODE__NUM_OF,
+} bcm_topo_pon_mode;
+
+typedef enum
+{
+ BCM_TOPO_PON_FAMILY_GPON, /* GPON, XGPON, XGS, NGPON2 */
+ BCM_TOPO_PON_FAMILY_EPON,
+ BCM_TOPO_PON_FAMILY_INVALID,
+ BCM_TOPO_PON_FAMILY__NUM_OF,
+} bcm_topo_pon_family;
+
+typedef enum
+{
+ BCM_TOPO_PON_SUB_FAMILY_GPON, /* GPON only */
+ BCM_TOPO_PON_SUB_FAMILY_XGPON, /* XGPON, XGS, NGPON2 */
+ BCM_TOPO_PON_SUB_FAMILY_EPON,
+ BCM_TOPO_PON_SUB_FAMILY_INVALID,
+ BCM_TOPO_PON_SUB_FAMILY__NUM_OF,
+} bcm_topo_pon_sub_family;
+
+/* User context identifier - can be extended if more modules in the system use the bcm_topo.context. */
+typedef enum
+{
+ BCM_TOPO_PON_CONTEXT_ID_MAC_UTIL,
+ BCM_TOPO_PON_CONTEXT_ID_OMCI_SVC,
+ BCM_TOPO_PON_CONTEXT_ID_RSC_MGR,
+ BCM_TOPO_PON_CONTEXT_ID__NUM_OF,
+} bcm_topo_pon_context_id;
+
+typedef struct
+{
+ uint32_t num_of_devs;
+ uint32_t num_of_pons_per_dev;
+ bcm_topo_pon_mode pon_mode;
+} bcm_topo_params;
+
+/**
+ * @brief Get the PON mode of a given device ID.
+ * @param device_id device ID
+ *
+ * @returns PON mode or Null on error
+ */
+const char *bcm_topo_dev_get_pon_mode_str(bcmolt_devid device_id);
+
+
+/**
+ * @brief Get the max number of pons of a given device ID.
+ * @param device_id device ID
+ *
+ * @returns the max number of pons or -1 on error
+ */
+int bcm_topo_dev_get_max_pon(bcmolt_devid device_id);
+
+/**
+ * @brief Get the PON mode of a given logical PON ID.
+ * @param pon Logical PON ID
+ *
+ * @returns PON mode or BCM_TOPO_PON_MODE_INVALID on error
+ */
+bcm_topo_pon_mode bcm_topo_pon_get_pon_mode(uint32_t pon);
+
+/**
+ * @brief Get the PON family of a given logical PON ID.
+ * @param pon Logical PON ID
+ *
+ * @returns PON mode or BCM_TOPO_PON_FAMILY_INVALID on error
+ */
+bcm_topo_pon_family bcm_topo_pon_get_pon_family(uint32_t pon);
+
+/**
+ * @brief Get the PON sub-family of a given logical PON ID.
+ * @param pon Logical PON ID
+ *
+ * @returns PON mode or BCM_TOPO_PON_SUB_FAMILY_INVALID on error
+ */
+bcm_topo_pon_sub_family bcm_topo_pon_get_pon_sub_family(uint32_t pon);
+
+/**
+ * @brief Get the number of ONUs of a given logical PON ID.
+ * @param pon Logical PON ID
+ *
+ * @returns Number of ONUs or BCM_TOPO_ERR_INVALID on error
+ */
+uint32_t bcm_topo_pon_get_max_num_of_onus(uint32_t pon);
+
+/**
+ * @brief Return whether a given logical PON is in the valid range.
+ *
+ * @returns BCMOS_TRUE is the given logical PON is in the valid range, BCMOS_FALSE otherwise
+ */
+bcmos_bool bcm_topo_pon_is_valid(uint32_t pon);
+
+/**
+ * @brief Traverse devices
+ * @param device_id Device iterator. Should be BCM_TOPO_DEV_INVALID at the beginning.
+ *
+ * @returns Next device, or BCM_TOPO_DEV_INVALID to mark that no more devices are available.
+ */
+bcmolt_devid bcm_topo_dev_get_next(bcmolt_devid device_id);
+
+/**
+ * @brief Traverse logical PONs within a given device.
+ * @param device_id Device id
+ * @param pon Logical PON iterator. Should be BCM_TOPO_PON_INVALID at the beginning.
+ *
+ * @returns Next logical PON on this device, or BCM_TOPO_PON_INVALID to mark that no more PONs are available.
+ */
+uint32_t bcm_topo_pon_get_next(bcmolt_devid device_id, uint32_t pon);
+
+/**
+ * @brief Get device ID and physical PON ID from logical PON ID.
+ * @param logical_pon logical PON ID
+ * @param *device_id Pointer to device id
+ * @param *physical_pon Pointer to physical PON ID
+ *
+ * @returns bcmos_errno
+ * @note In general, the physical PON ID is used in the hardware directed function calls.
+ */
+bcmos_errno bcm_topo_pon_get_logical2physical(uint32_t logical_pon, bcmolt_devid *device_id, uint32_t *physical_pon);
+
+/**
+ * @brief Get logical PON ID from device ID and physical PON ID.
+ * @param device_id Device id
+ * @param physical_pon Physical PON ID
+ * @param *logical_pon Pointer to logical PON ID
+ *
+ * @returns bcmos_errno
+ * @note In general, the logical PON ID is used in the BAL core directed function calls.
+ */
+bcmos_errno bcm_topo_pon_get_physical2logical(bcmolt_devid device_id, uint32_t physical_pon, uint32_t *logical_pon);
+
+/**
+ * @brief Set user context for a given logical PON ID.
+ * @param pon Logical PON ID
+ * @param pon_context_id The identity of the module using the context
+ * @param context Pointer to user context
+ *
+ * @returns bcmos_errno
+ */
+bcmos_errno bcm_topo_pon_set_context(uint32_t pon, bcm_topo_pon_context_id pon_context_id, void *context);
+
+/**
+ * @brief Get user context for a given logical PON ID.
+ * @param pon Logical PON ID
+ * @param pon_context_id The identity of the module using the context
+ *
+ * @returns User context or NULL if there's an error
+ */
+void *bcm_topo_pon_get_context(uint32_t pon, bcm_topo_pon_context_id pon_context_id);
+
+/**
+ * @brief Initialize topology module, either by arguments (probably received from CLI) or by a topology file. The rule is at least one of them must be specified and exist. If both are
+ * specified and exist, then we rely on topology file.
+ * Pay attention that when not using a file, the user have less freedom. For example:
+ * - The user won't be able to have devices with different PON modes.
+ * - The user won't be able to have devices with different number of PONs.
+ * - The user won't be able to map logical PON to (device, physical PON). We assume that logical_pon = (device * num_of_pons_per_dev) + physical_pon.
+ * @param params Topology parameters. If NULL, we rely on topology file.
+ * @param topo_filename File containing bcm_topo.configuration in a .csv format
+ * The columns are:
+ * Logical PON ID, PON Mode, Physical Device ID, Physical PON ID
+ *
+ * @returns bcmos_errno
+ */
+bcmos_errno bcm_topo_init(bcm_topo_params *params, const char *topo_filename);
+
+/**
+ * @brief Returns whether the topology module has been initialized.
+ *
+ * @returns BCMOS_TRUE if topology module has been initialized
+ */
+bcmos_bool bcm_topo_is_initialized(void);
+
+#define BCM_TOPO_MAX_NNI_PORTS 16
+
+/**
+ * @brief Set the max number of nnis of a given device ID.
+ * @param device_id device ID
+ * @param num_nni_ports nni ports on the device
+ *
+ * @returns BCMOS_TRUE
+ */
+bcmos_bool bcm_topo_dev_set_max_nni(bcmolt_devid device_id, uint32_t num_nni_ports);
+
+/**
+ * @brief Get the max number of nnis of a given device ID.
+ * @param device_id device ID
+ * @param p_num_nni_ports pointer for the retrieved nni ports on the device
+ *
+ * @returns BCMOS_TRUE
+ */
+bcmos_bool bcm_topo_dev_get_max_nni(bcmolt_devid device_id, uint32_t *p_num_nni_ports);
+
+/**
+ * @brief Return whether a given logical NNI is in the valid range.
+ *
+ * @returns BCMOS_TRUE is the given logical NNI is in the valid range, BCMOS_FALSE otherwise
+ */
+bcmos_bool bcm_topo_nni_is_valid(uint32_t nni);
+
+#endif
+
diff --git a/bal_release/src/lib/libutils/Makefile b/bal_release/src/lib/libutils/Makefile
new file mode 100644
index 0000000..8b4dd50
--- /dev/null
+++ b/bal_release/src/lib/libutils/Makefile
@@ -0,0 +1,35 @@
+###############################################################################
+#
+# <:copyright-BRCM:2016:DUAL/GPL:standard
+#
+# Copyright (c) 2016 Broadcom
+# All Rights Reserved
+#
+# Unless you and Broadcom execute a separate written software license
+# agreement governing use of this software, this software is licensed
+# to you under the terms of the GNU General Public License version 2
+# (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
+# with the following added to such license:
+#
+# As a special exception, the copyright holders of this software give
+# you permission to link this software with independent modules, and
+# to copy and distribute the resulting executable under terms of your
+# choice, provided that you also meet, for each linked independent
+# module, the terms and conditions of the license of that module.
+# An independent module is a module which is not derived from this
+# software. The special exception does not apply to any modifications
+# of the software.
+#
+# Not withstanding the above, under no circumstances may you combine
+# this software in any way with any other Broadcom software provided
+# under a license other than the GPL, without Broadcom's express prior
+# written consent.
+#
+# :>
+#
+###############################################################################
+MOD_NAME = balutils
+MOD_TYPE = lib
+
+srcs = bal_utils.c
+
diff --git a/bal_release/src/lib/libutils/bal_utils.c b/bal_release/src/lib/libutils/bal_utils.c
new file mode 100644
index 0000000..024b3d9
--- /dev/null
+++ b/bal_release/src/lib/libutils/bal_utils.c
@@ -0,0 +1,541 @@
+/******************************************************************************
+ *
+ * <:copyright-BRCM:2016:DUAL/GPL:standard
+ *
+ * Copyright (c) 2016 Broadcom
+ * All Rights Reserved
+ *
+ * Unless you and Broadcom execute a separate written software license
+ * agreement governing use of this software, this software is licensed
+ * to you under the terms of the GNU General Public License version 2
+ * (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
+ * with the following added to such license:
+ *
+ * As a special exception, the copyright holders of this software give
+ * you permission to link this software with independent modules, and
+ * to copy and distribute the resulting executable under terms of your
+ * choice, provided that you also meet, for each linked independent
+ * module, the terms and conditions of the license of that module.
+ * An independent module is a module which is not derived from this
+ * software. The special exception does not apply to any modifications
+ * of the software.
+ *
+ * Not withstanding the above, under no circumstances may you combine
+ * this software in any way with any other Broadcom software provided
+ * under a license other than the GPL, without Broadcom's express prior
+ * written consent.
+ *
+ * :>
+ *
+ *****************************************************************************/
+
+/**
+ * @file bal_utils.c
+ * @brief BAL Utilities source
+ *
+ * This file contains the implementation of various BAL "utilities",
+ * which are provided via the libutils.a library.
+ */
+
+/*@{*/
+
+#ifdef USING_BAL_UTILS
+
+/* --- system includes ---*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <limits.h>
+#include <arpa/inet.h>
+#include <string.h>
+
+#include <bcmos_system.h>
+
+/* --- project includes ---*/
+#include "bal_utils.h"
+
+
+/*
+ * Generic helper functions
+ */
+char *mac_addr_to_str(char *buffer, bcmos_mac_address mac)
+{
+ char *fmt_str = NULL;
+
+ fmt_str = "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx";
+
+ snprintf(buffer, 20, fmt_str,
+ mac.u8[0], mac.u8[1],
+ mac.u8[2], mac.u8[3],
+ mac.u8[4], mac.u8[5]);
+
+ return buffer;
+}
+
+
+bcmos_bool mac_add_is_null(bcmos_mac_address mac)
+{
+ return ((0 != mac.u8[0]) || (0 != mac.u8[1]) || (0 != mac.u8[2]) ||
+ (0 != mac.u8[3]) || (0 != mac.u8[4]) || (0 != mac.u8[5])) ? BCMOS_FALSE : BCMOS_TRUE;
+}
+
+/**
+ * @brief Determines if string contains a valid IPv4 or IPv6 address
+ *
+ *
+ * @param ipAddrStr Pointer to string to parse
+ *
+ * @return bcmos_bool
+ * @retval TRUE String contains a valid IP address
+ * @retval FALSE String does not
+ */
+bcmos_bool BalIsValidIp(const char *ipAddrStr)
+{
+ struct sockaddr_in addr4;
+ struct in6_addr addr6;
+ bcmos_bool ret = BCMOS_FALSE;
+
+ /* Parameter checks. */
+ BUG_UNLESS(NULL != ipAddrStr, BCMOS_FALSE);
+
+ /* First look to see if it's a valid IPv4 address, then look to see if it's
+ a valid IPv6 address*/
+ if (inet_pton(AF_INET, ipAddrStr, &addr4) > 0 || inet_pton(AF_INET6, ipAddrStr, &addr6) > 0)
+ {
+ ret = TRUE;
+ }
+
+ return ret;
+}
+
+
+/**
+ * @brief Convert a string to the specified type of integer
+ *
+ * NOTE: This function uses the strtoll() function to convert the string to an
+ * integer value. U64 values greater than 0x7fffffffffffffff cannot be converted
+ * by the strtoll() function because the string value is considered out of the
+ * valid -0x8000000000000000 to 0x7fffffffffffffff 64-bit integer range.
+ *
+ * @param str String to convert
+ * @param pVal Pointer to the return value
+ *
+ * @return bcmos_errno
+ */
+static bcmos_errno BalStringToInt(char *str, BalIntStringT *pVal)
+{
+ bcmos_errno rc = BAL_OK;
+ U64 u64 = 0;
+ S64 s64 = 0;
+ char *endptr;
+
+ BUG_UNLESS(NULL != str, BAL_PARAM);
+ BUG_UNLESS(NULL != pVal, BAL_PARAM);
+ BUG_UNLESS(pVal->intType > BAL_STR2INT_INVALID, BAL_PARAM);
+ BUG_UNLESS(pVal->intType < BAL_STR2INT_MAX, BAL_PARAM);
+
+ do
+ {
+ if ((pVal->intType >= BAL_STR2INT_S8) &&
+ (pVal->intType <= BAL_STR2INT_S64))
+ {
+ /* Just assume a signed 64-bit value when converting the string to
+ * an integer. Range checking is done below. Make sure that errno
+ * is set to zero before calling strtoll().
+ */
+ errno = 0;
+ pVal->intU.s64 = 0; /* Clear all possibilities to 0 */
+ s64 = strtoll(str, &endptr, 10);
+
+ /* General range and error check */
+ if ((errno == ERANGE && (s64 == LONG_MAX || s64 == LONG_MIN))
+ || (errno != 0 && s64 == 0))
+ {
+ errno = 0;
+ rc = BCM_ERR_RANGE;
+ break;
+
+ }
+
+ /* test for no digits or mixed digits and characters */
+ if (endptr == str || '\0' != *endptr)
+ {
+ errno = 0;
+ rc = BCM_ERR_PARM;
+ break;
+ }
+
+ /* routine specific range check */
+ switch (pVal->intType)
+ {
+ case BAL_STR2INT_S8:
+ if ((s64 < -128) || (s64 > 127))
+ {
+ rc = BCM_ERR_RANGE;
+ }
+ else
+ {
+ pVal->intU.s8 = (S8)s64;
+ }
+ break;
+ case BAL_STR2INT_S16:
+ if ((s64 < -32768) || (s64 > 32767))
+ {
+ rc = BCM_ERR_RANGE;
+ }
+ else
+ {
+ pVal->intU.s16 = (S16)s64;
+ }
+ break;
+ case BAL_STR2INT_S32:
+ if ((s64 < (-2147483647L -1L)) || (s64 > 2147483647L))
+ {
+ rc = BCM_ERR_RANGE;
+ }
+ else
+ {
+ pVal->intU.s32 = (S32)s64;
+ }
+ break;
+ case BAL_STR2INT_S64:
+ /* No range checking is needed since the strtoll() function
+ * does the range checking. If the string was invalid, errno
+ * would have been non-zero.
+ */
+ pVal->intU.s64 = s64;
+ break;
+ default:
+ /* Should never make it here. */
+ rc = BCM_ERR_PARM;
+ break;
+ }
+ }
+ else {
+ /* Just assume an unsigned 64-bit value when converting the string
+ * to an integer. Range checking is done below. Make sure that errno
+ * is set to zero before calling strtoull().
+ */
+ errno = 0;
+ pVal->intU.u64 = 0;
+ u64 = strtoull(str, &endptr, 10);
+
+ /* General range and error check */
+ if ((errno == ERANGE && (s64 == LONG_MAX || s64 == LONG_MIN))
+ || (errno != 0 && s64 == 0))
+ {
+ errno = 0;
+ rc = BCM_ERR_RANGE;
+ break;
+
+ }
+
+ /* test for no digits or mixed digits and characters */
+ if (endptr == str || '\0' != *endptr)
+ {
+ errno = 0;
+ rc = BCM_ERR_PARM;
+ break;
+ }
+
+ /* routine specific range check */
+ switch(pVal->intType)
+ {
+ case BAL_STR2INT_U8:
+ if (u64 > 255)
+ {
+ rc = BCM_ERR_RANGE;
+ }
+ else
+ {
+ pVal->intU.u8 = (U8)u64;
+ }
+ break;
+ case BAL_STR2INT_U16:
+ if (u64 > 65535)
+ {
+ rc = BCM_ERR_RANGE;
+ }
+ else
+ {
+ pVal->intU.u16 = (U16)u64;
+ }
+ break;
+ case BAL_STR2INT_U32:
+ if (u64 > 4294967295UL)
+ {
+ rc = BCM_ERR_RANGE;
+ }
+ else
+ {
+ pVal->intU.u32 = (U32)u64;
+ }
+ break;
+ case BAL_STR2INT_U64:
+ /* No range checking is needed since the strtoull() function
+ * does the range checking. If the string was invalid, errno
+ * would have been non-zero.
+ */
+ pVal->intU.u64 = u64;
+ break;
+ default:
+ /* Should never make it here. */
+ rc = BCM_ERR_PARM;
+ break;
+ }
+ }
+ } while (0);
+
+ return(rc);
+}
+
+/**
+ * @brief Convert a string to an S8 type integer
+ *
+ * This function converts a string to an S8 type integer
+ *
+ * @param str String to convert
+ * @param pVal Pointer to the return value
+ *
+ * @return bcmos_errno
+ */
+bcmos_errno BalStringToS8(char *str, S8 *pVal)
+{
+ bcmos_errno rc = BAL_OK;
+ BalIntStringT intStr;
+
+ BUG_UNLESS(NULL != str, BAL_PARAM);
+ BUG_UNLESS(NULL != pVal, BAL_PARAM);
+
+ memset(&intStr, 0, sizeof(intStr));
+
+ intStr.intType = BAL_STR2INT_S8;
+
+ rc = BalStringToInt(str, &intStr);
+ if (BAL_OK == rc)
+ {
+ *pVal = intStr.intU.s8;
+ }
+
+ return(rc);
+}
+
+/**
+ * @brief Convert a string to an S16 type integer
+ *
+ * This function converts a string to an S16 type integer
+ *
+ * @param str String to convert
+ * @param pVal Pointer to the return value
+ *
+ * @return bcmos_errno
+ */
+bcmos_errno BalStringToS16(char *str, S16 *pVal)
+{
+ bcmos_errno rc = BAL_OK;
+ BalIntStringT intStr;
+
+ BUG_UNLESS(NULL != str, BAL_PARAM);
+ BUG_UNLESS(NULL != pVal, BAL_PARAM);
+
+ memset(&intStr, 0, sizeof(intStr));
+
+ intStr.intType = BAL_STR2INT_S16;
+
+ rc = BalStringToInt(str, &intStr);
+ if (BAL_OK == rc)
+ {
+ *pVal = intStr.intU.s16;
+ }
+
+ return(rc);
+}
+
+/**
+ * @brief Convert a string to an S32 type integer
+ *
+ * This function converts a string to an S32 type integer
+ *
+ * @param str String to convert
+ * @param pVal Pointer to the return value
+ *
+ * @return bcmos_errno
+ */
+bcmos_errno BalStringToS32(char *str, S32 *pVal)
+{
+ bcmos_errno rc = BAL_OK;
+ BalIntStringT intStr;
+
+ BUG_UNLESS(NULL != str, BAL_PARAM);
+ BUG_UNLESS(NULL != pVal, BAL_PARAM);
+
+ memset(&intStr, 0, sizeof(intStr));
+
+ intStr.intType = BAL_STR2INT_S32;
+
+ rc = BalStringToInt(str, &intStr);
+ if (BAL_OK == rc)
+ {
+ *pVal = intStr.intU.s32;
+ }
+
+ return(rc);
+}
+
+/**
+ * @brief Convert a string to an S64 type integer
+ *
+ * This function converts a string to an S64 type integer
+ *
+ * @param str String to convert
+ * @param pVal Pointer to the return value
+ *
+ * @return bcmos_errno
+ */
+bcmos_errno BalStringToS64(char *str, S64 *pVal)
+{
+ bcmos_errno rc = BAL_OK;
+ BalIntStringT intStr;
+
+ BUG_UNLESS(NULL != str, BAL_PARAM);
+ BUG_UNLESS(NULL != pVal, BAL_PARAM);
+
+ memset(&intStr, 0, sizeof(intStr));
+
+ intStr.intType = BAL_STR2INT_S64;
+
+ rc = BalStringToInt(str, &intStr);
+ if (BAL_OK == rc)
+ {
+ *pVal = intStr.intU.s64;
+ }
+
+ return(rc);
+}
+
+/**
+ * @brief Convert a string to a U8 type integer
+ *
+ * This function converts a string to a U8 type integer
+ *
+ * @param str String to convert
+ * @param pVal Pointer to the return value
+ *
+ * @return bcmos_errno
+ */
+bcmos_errno BalStringToU8(char *str, U8 *pVal)
+{
+ bcmos_errno rc = BAL_OK;
+ BalIntStringT intStr;
+
+ BUG_UNLESS(NULL != str, BAL_PARAM);
+ BUG_UNLESS(NULL != pVal, BAL_PARAM);
+
+ memset(&intStr, 0, sizeof(intStr));
+
+ intStr.intType = BAL_STR2INT_U8;
+
+ rc = BalStringToInt(str, &intStr);
+ if (BAL_OK == rc)
+ {
+ *pVal = intStr.intU.u8;
+ }
+
+ return(rc);
+}
+
+/**
+ * @brief Convert a string to a U16 type integer
+ *
+ * This function converts a string to a U16 type integer
+ *
+ * @param str String to convert
+ * @param pVal Pointer to the return value
+ *
+ * @return bcmos_errno
+ */
+bcmos_errno BalStringToU16(char *str, U16 *pVal)
+{
+ bcmos_errno rc = BAL_OK;
+ BalIntStringT intStr;
+
+ BUG_UNLESS(NULL != str, BAL_PARAM);
+ BUG_UNLESS(NULL != pVal, BAL_PARAM);
+
+ memset(&intStr, 0, sizeof(intStr));
+
+ intStr.intType = BAL_STR2INT_U16;
+
+ rc = BalStringToInt(str, &intStr);
+ if (BAL_OK == rc)
+ {
+ *pVal = intStr.intU.u16;
+ }
+
+ return(rc);
+}
+
+/**
+ * @brief Convert a string to a U32 type integer
+ *
+ * This function converts a string to a U32 type integer
+ *
+ * @param str String to convert
+ * @param pVal Pointer to the return value
+ *
+ * @return bcmos_errno
+ */
+bcmos_errno BalStringToU32(char *str, U32 *pVal)
+{
+ bcmos_errno rc = BAL_OK;
+ BalIntStringT intStr;
+
+ BUG_UNLESS(NULL != str, BAL_PARAM);
+ BUG_UNLESS(NULL != pVal, BAL_PARAM);
+
+ memset(&intStr, 0, sizeof(intStr));
+
+ intStr.intType = BAL_STR2INT_U32;
+
+ rc = BalStringToInt(str, &intStr);
+ if (BAL_OK == rc)
+ {
+ *pVal = intStr.intU.u32;
+ }
+
+ return(rc);
+}
+
+/**
+ * @brief Convert a string to a U64 type integer
+ *
+ * This function converts a string to a U64 type integer
+ *
+ * @param str String to convert
+ * @param pVal Pointer to the return value
+ *
+ * @return bcmos_errno
+ */
+bcmos_errno BalStringToU64(char *str, U64 *pVal)
+{
+ bcmos_errno rc = BAL_OK;
+ BalIntStringT intStr;
+
+ BUG_UNLESS(NULL != str, BAL_PARAM);
+ BUG_UNLESS(NULL != pVal, BAL_PARAM);
+
+ memset(&intStr, 0, sizeof(intStr));
+
+ intStr.intType = BAL_STR2INT_U64;
+
+ rc = BalStringToInt(str, &intStr);
+ if (BAL_OK == rc)
+ {
+ *pVal = intStr.intU.u64;
+ }
+
+ return(rc);
+}
+
+
+#endif /* USING_BAL_UTILS */
diff --git a/bal_release/src/lib/libutils/bal_utils.h b/bal_release/src/lib/libutils/bal_utils.h
new file mode 100644
index 0000000..78c6134
--- /dev/null
+++ b/bal_release/src/lib/libutils/bal_utils.h
@@ -0,0 +1,65 @@
+/******************************************************************************
+ *
+ * <:copyright-BRCM:2016:DUAL/GPL:standard
+ *
+ * Copyright (c) 2016 Broadcom
+ * All Rights Reserved
+ *
+ * Unless you and Broadcom execute a separate written software license
+ * agreement governing use of this software, this software is licensed
+ * to you under the terms of the GNU General Public License version 2
+ * (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
+ * with the following added to such license:
+ *
+ * As a special exception, the copyright holders of this software give
+ * you permission to link this software with independent modules, and
+ * to copy and distribute the resulting executable under terms of your
+ * choice, provided that you also meet, for each linked independent
+ * module, the terms and conditions of the license of that module.
+ * An independent module is a module which is not derived from this
+ * software. The special exception does not apply to any modifications
+ * of the software.
+ *
+ * Not withstanding the above, under no circumstances may you combine
+ * this software in any way with any other Broadcom software provided
+ * under a license other than the GPL, without Broadcom's express prior
+ * written consent.
+ *
+ * :>
+ *
+ *****************************************************************************/
+
+/**
+ * @file bal_utils.h
+ * @brief BAL Utilities include file
+ *
+ */
+
+#ifndef BALUTILS_H
+#define BALUTILS_H
+
+/*@{*/
+
+/**
+ * @brief General purpose BAL String structure.
+ *
+ * This is typically used for debugging or log messages.
+ */
+#define BAL_STRING_LENGTH 256
+
+#define MAC_STR_LEN 18
+
+/**
+ * @brief BAL String Structure
+ */
+typedef struct bal_string
+{
+ char str[BAL_STRING_LENGTH+1]; /**< The string */
+} bal_string;
+
+extern char *mac_addr_to_str(char *buffer, bcmos_mac_address mac);
+extern bcmos_bool mac_add_is_null(bcmos_mac_address mac);
+
+/*@}*/
+
+#endif /* BALUTILS_H */