BAL and Maple Release 2.2
Signed-off-by: Shad Ansari <developer@Carbon.local>
diff --git a/bal_release/src/common/bal_app_utils/Makefile b/bal_release/src/common/bal_app_utils/Makefile
new file mode 100644
index 0000000..2551bf6
--- /dev/null
+++ b/bal_release/src/common/bal_app_utils/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.
+#
+# :>
+#
+###############################################################################
+# Common utilities
+#
+MOD_NAME = bal_app_utils
+MOD_TYPE = lib
+MOD_DEPS = dev_log maple_sdk
+srcs = bal_app_common_utils.c
diff --git a/bal_release/src/common/bal_app_utils/bal_app_common_utils.c b/bal_release/src/common/bal_app_utils/bal_app_common_utils.c
new file mode 100755
index 0000000..83894d6
--- /dev/null
+++ b/bal_release/src/common/bal_app_utils/bal_app_common_utils.c
@@ -0,0 +1,81 @@
+/******************************************************************************
+ *
+ * <: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_app_common_utils.c
+ * @brief BAL app common Utilities functionality
+ *
+ * @addtogroup util
+ */
+
+/*@{*/
+
+#include "bal_app_common_utils.h"
+
+/*****************************************************************************/
+/**
+* @brief app_util_parse_ip_port
+*
+* This routine is used to parse the user supplied IP address and port of the
+* remote MAC device.
+*
+* @param ip_port A string containing the IP:port to parse
+*
+* @param ip The IP address that results from the parsing function
+*
+* @param port The port that results from the parsing function
+*
+* @return bcmos_errno
+*/
+/*****************************************************************************/
+bcmos_errno app_util_parse_ip_port(const char *ip_port, uint32_t *ip, uint16_t *port)
+{
+ int n;
+ uint32_t ip1, ip2, ip3, ip4, pp;
+
+ if (!ip_port)
+ {
+ bcmos_printf("ERR: ip_port is not set\n");
+ return BCM_ERR_PARM;
+ }
+ n = sscanf(ip_port, "%u.%u.%u.%u:%u", &ip1, &ip2, &ip3, &ip4, &pp);
+ if (n != 5 || ip1 > 0xff || ip2 > 0xff || ip3 > 0xff || ip4 > 0xff || pp > 0xffff)
+ {
+ bcmos_printf("ERR: Can't parse %s. Must be ip_address:port\n", ip_port);
+ return BCM_ERR_PARM;
+ }
+ *ip = (ip1 << 24) | (ip2 << 16) | (ip3 << 8) | ip4;
+ *port = pp;
+ return BCM_ERR_OK;
+}
+
+/*@}*/
+
diff --git a/bal_release/src/common/bal_app_utils/bal_app_common_utils.h b/bal_release/src/common/bal_app_utils/bal_app_common_utils.h
new file mode 100755
index 0000000..1db1b9f
--- /dev/null
+++ b/bal_release/src/common/bal_app_utils/bal_app_common_utils.h
@@ -0,0 +1,56 @@
+/******************************************************************************
+ *
+ * <: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_app_common_utils.h
+ * @brief BAL Utilities include file
+ *
+ * @defgroup util Bal App Util Routines
+ * @ingroup lib
+ */
+
+#ifndef _BAL_COMMON_UTILS_H
+#define _BAL_COMMON_UTILS_H
+
+/*@{*/
+
+#include <bcmos_system.h>
+#include <bcm_dev_log.h>
+#include <bal_msg.h>
+#include <bal_utils_msg.h>
+#include <bal_msg_type.h>
+#include <bal_objs.h>
+
+bcmos_errno app_util_parse_ip_port(const char *ip_port, uint32_t *ip, uint16_t *port);
+
+/*@}*/
+
+#endif /* _BAL_COMMON_UTILS_H*/
diff --git a/bal_release/src/common/cli b/bal_release/src/common/cli
new file mode 120000
index 0000000..8573c77
--- /dev/null
+++ b/bal_release/src/common/cli
@@ -0,0 +1 @@
+../../3rdparty/maple/sdk/host_reference/cli
\ No newline at end of file
diff --git a/bal_release/src/common/config/bcm_config.h b/bal_release/src/common/config/bcm_config.h
new file mode 100644
index 0000000..9221c1a
--- /dev/null
+++ b/bal_release/src/common/config/bcm_config.h
@@ -0,0 +1,45 @@
+/******************************************************************************
+ *
+ * <: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 BCMOLT_CONFIG_H_
+#define BCMOLT_CONFIG_H_
+
+/** \defgroup config Configuration Constants
+ * Configuration constants that must be revised by customer
+ * @{
+ */
+
+#define BCMTR_MAX_OLTS 1 /**< Max number of OLTs */
+
+/** @} */
+
+
+#endif /* BCMOLT_CONFIG_H_ */
diff --git a/bal_release/src/common/db_engine/Makefile b/bal_release/src/common/db_engine/Makefile
new file mode 100644
index 0000000..23b64f6
--- /dev/null
+++ b/bal_release/src/common/db_engine/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.
+#
+# :>
+#
+###############################################################################
+# Data Base engine
+#
+MOD_NAME = db
+MOD_TYPE = lib
+
+srcs = bcm_db_engine.c
diff --git a/bal_release/src/common/db_engine/bcm_db_engine.c b/bal_release/src/common/db_engine/bcm_db_engine.c
new file mode 100644
index 0000000..dc4f19a
--- /dev/null
+++ b/bal_release/src/common/db_engine/bcm_db_engine.c
@@ -0,0 +1,1606 @@
+/******************************************************************************
+ *
+ * <: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.
+ *
+ * :>
+ *
+ *****************************************************************************/
+
+/*
+ * Data Base Engine
+ *
+ * Proprietary and confidential.
+ */
+#include <bcmos_system.h>
+#include <bcm_db_engine.h>
+
+/* DB trace level */
+bcmos_trace_level bcmdb_trace_level = BCMOS_TRACE_LEVEL_ERROR;
+
+#define BCMDB_TRACE(level, fmt, args...) \
+ do { \
+ if (level <= bcmdb_trace_level) \
+ bcmos_trace(level, "%s#%d> " fmt, __FUNCTION__, __LINE__, ## args); \
+ } while (0)
+
+/* Print error trace conditionally, depending on the current trace level */
+#define BCMDB_TRACE_ERROR(fmt, args...) \
+ BCMDB_TRACE(BCMOS_TRACE_LEVEL_ERROR, "DB ERR: %s#%d> " fmt, __FUNCTION__, __LINE__, ## args)
+
+/* Print warning trace conditionally, depending on the current trace level */
+#define BCMDB_TRACE_WARNING(fmt, args...) \
+ BCMDB_TRACE(BCMOS_TRACE_LEVEL_WARNING, "DB WARN: %s#%d> " fmt, __FUNCTION__, __LINE__, ## args)
+
+/* Print info trace conditionally, depending on the current trace level */
+#define BCMDB_TRACE_INFO(fmt, args...) \
+ BCMDB_TRACE(BCMOS_TRACE_LEVEL_INFO, "DB INFO: %s#%d> " fmt, __FUNCTION__, __LINE__, ## args)
+
+/* Enable debug prints */
+#define BCMDB_DEBUG
+
+#ifdef BCMDB_DEBUG
+
+/* Print debug trace conditionally, depending on the current trace level */
+#define BCMDB_TRACE_DEBUG(fmt, args...) \
+ BCMDB_TRACE(BCMOS_TRACE_LEVEL_DEBUG, "DB DBG: %s#%d> " fmt, __FUNCTION__, __LINE__, ## args)
+
+#else
+
+#define BCMDB_TRACE_DEBUG(fmt, args...)
+
+#endif
+
+
+
+/** Data base entry
+ * \ingroup bcmdb
+ */
+struct bcmdb_entry
+{
+ void *data; /* Set or record */
+ uint8_t flags;
+#define BCMDB_FLAG_VALID 0x01 /**< Entry is valid */
+#define BCMDB_FLAG_RECORD 0x02 /**< Record */
+#define BCMDB_FLAG_SOS 0x10 /**< Set of sets */
+ uint8_t read_count;
+ uint8_t write_pending;
+ uint8_t ffu;
+};
+
+/** Set/Record change notification
+ * \ingroup bcmdb
+ */
+typedef struct bcmdb_notify
+{
+ struct bcmdb_notify *next;
+ bcmdb_notify_cb cb;
+ long cb_priv;
+} bcmdb_notify;
+
+/** Data Base Set control block
+ * \ingroup bcmdb
+ */
+struct bcmdb_set
+{
+ bcmdb_entry entry; /**< Common fields for set and record */
+ char *name; /**< Set name */
+ bcmdb_set *parent; /**< Set parent */
+ bcmdb_key my_key; /**< Key in the parent set */
+ int max_entries; /**< Max number of elements in the set. -1=inlimited */
+ int num_entries; /**< Current number of elements in the set */
+ int entry_size; /**< Set entry size. */
+ int magic; /**< Magic number */
+#define BCMDB_MAGIC_ACTIVE_SET (('a'<<24) | ('s'<<16) | ('e'<<8) | 't')
+#define BCMDB_MAGIC_FREE_SET (('f'<<24) | ('s'<<16) | ('e'<<8) | 't')
+
+ /** Get next element */
+ bcmdb_key (*entry_get_next)(const bcmdb_set *this, bcmdb_key cur);
+
+ /** Add new entry. returns 0 if ok */
+ int (*entry_new)(bcmdb_set *this, bcmdb_key key, const void *data);
+
+ /** Delete entry */
+ int (*entry_delete)(bcmdb_set *this, bcmdb_entry *entry);
+
+ /*
+ * Handle – key mapping
+ */
+
+ /** Convert entry handle to entry key */
+ bcmdb_key (*handle_to_key)(const bcmdb_set *this, const bcmdb_entry *entry);
+
+ /** Convert entry key to entry handle */
+ bcmdb_entry *(*key_to_handle)(const bcmdb_set *this, bcmdb_key key);
+
+ /*
+ * Set/Record locking
+ * entry is handle of the set or record to be locked/unlocked
+ */
+
+ /** Lock the whole set for reading */
+ void (*lock_set_read)(bcmdb_set *set);
+
+ /** Unlock set locked for reading */
+ void (*unlock_set_read)(bcmdb_set *set);
+
+ /** Lock the whole set for update */
+ long (*lock_set_modify)(bcmdb_set *set);
+
+ /** Unlock set locked for update */
+ void (*unlock_set_modify)(bcmdb_set *set, long fastlock_flags);
+
+ /** Lock the set recursively for update (SoS only) */
+ void (*lock_set_recursively_modify)(bcmdb_set *set);
+
+ /** Unlock recursively set locked for update (SoS only) */
+ void (*unlock_set_recursively_modify)(bcmdb_set *set);
+
+ /** Lock record for reading */
+ void *(*lock_record_read)(bcmdb_set *set, bcmdb_key key);
+
+ /** Release read lock */
+ void (*unlock_record_read)(bcmdb_set *set, bcmdb_key key);
+
+ /** Lock record for modification. */
+ void *(*lock_record_write)(bcmdb_set *set, bcmdb_key key, int is_deletion);
+
+ /** Release modify lock */
+ void (*unlock_record_write)(bcmdb_set *set, int is_deletion, int is_cancellation);
+
+ /** Format function that converts record data to human-readable form */
+ bcmdb_format_cb format;
+
+ /** Update notification mechanism.\n
+ * Note that notification functions are called before the actual update of the data base, so that
+ * there is an option to abort the update if needed.
+ */
+ bcmdb_notify *notify_list_head;
+
+ /** Shadow data record */
+ void *shadow_data;
+
+ /** holds the pointer to a write-locked entry */
+ bcmdb_entry *write_locked_entry ;
+
+ /** mutex that prevents multiple simultaneous updates */
+ bcmos_mutex mutex_update;
+
+ /** semaphore that holds update while there are unfinished reads */
+ bcmos_sem sem_wait_read_to_finish;
+
+ /** fastlock */
+ bcmos_fastlock fastlock;
+};
+
+
+/**< Data base record
+ * \ingroup bcmdb
+ */
+struct bcmdb_record
+{
+ struct bcmdb_entry e; /**< Entry - common part for set and record */
+};
+
+/*
+ * DB backend callbacks
+ */
+
+/*
+ * Array-based backend
+ */
+
+/** Get next element */
+static bcmdb_key _bcmdb_array_entry_get_next(const bcmdb_set *this, bcmdb_key key)
+{
+ BUG_ON(!this->entry.data);
+
+ if (key < 0)
+ key = 0;
+ else
+ ++key;
+
+ while((unsigned)key<this->max_entries)
+ {
+ bcmdb_entry *entry = (bcmdb_entry *)this->entry.data + key;
+ if ((entry->flags & BCMDB_FLAG_VALID))
+ break;
+ ++key;
+ }
+
+ if ((unsigned)key >= this->max_entries)
+ return BCMDB_KEY_NO_MORE; /* no more */
+
+ return key;
+}
+
+/*
+ * Handle – key mapping
+ */
+
+/** Convert entry handle to entry key */
+static inline bcmdb_key _bcmdb_array_handle_to_key(const bcmdb_set *this, const bcmdb_entry *entry)
+{
+ bcmdb_key key;
+
+ BUG_ON(!this);
+ BUG_ON(!entry);
+ BUG_ON(!this->magic == BCMDB_MAGIC_ACTIVE_SET);
+ BUG_ON(!this->entry.data);
+
+ key = entry - (bcmdb_entry *)this->entry.data;
+ if ((unsigned)key >= this->max_entries)
+ return BCMDB_KEY_INVAL;
+
+ return key;
+}
+
+
+/** Convert entry key to entry handle */
+static inline bcmdb_entry *_bcmdb_array_key_to_handle(const bcmdb_set *this, bcmdb_key key)
+{
+ BUG_ON(!this);
+ BUG_ON(!this->magic == BCMDB_MAGIC_ACTIVE_SET);
+ BUG_ON(!this->entry.data);
+
+ if ((unsigned long)key >= this->max_entries)
+ return NULL;
+
+ return (bcmdb_entry *)this->entry.data + key;
+}
+
+
+/** sem-based set read-lock */
+static void bcmdb_set_lock_read_sem(bcmdb_set *set)
+{
+ bcmos_mutex_lock(&set->mutex_update, BCMOS_WAIT_FOREVER);
+}
+
+
+/** sem-based set read-unlock */
+static void bcmdb_set_unlock_read_sem(bcmdb_set *set)
+{
+ bcmos_mutex_unlock(&set->mutex_update);
+}
+
+
+/** sem-based set modify-lock */
+static long bcmdb_set_lock_modify_sem(bcmdb_set *set)
+{
+ bcmos_mutex_lock(&set->mutex_update, BCMOS_WAIT_FOREVER);
+ return 0;
+}
+
+
+/** sem-based set modify-unlock */
+static void bcmdb_set_unlock_modify_sem(bcmdb_set *set, long fastlock_flags)
+{
+ bcmos_mutex_unlock(&set->mutex_update);
+}
+
+
+/** helper function which recursively locks all subsets of SoS
+ * for modify */
+static void bcmdb_recursive_subsets_lock_modify(bcmdb_set *sos)
+{
+ int key;
+ int left_entries = sos->num_entries;
+ bcmdb_entry *entry;
+ bcmdb_set *subset;
+
+ BUG_ON(!(sos->entry.flags & BCMDB_FLAG_SOS));
+
+ for (key = 0; key < sos->max_entries; ++key)
+ {
+ entry = sos->key_to_handle(sos, key);
+
+ if ((entry->flags & BCMDB_FLAG_VALID))
+ {
+ subset = (bcmdb_set *)entry->data;
+ subset->lock_set_recursively_modify(subset);
+
+ --left_entries;
+ /* if we handled all subsets we can break the "for" */
+ if (left_entries==0)
+ {
+ break;
+ }
+ }
+ }
+}
+
+
+/** helper function which recursively unlocks all subsets of SoS
+ * for modify */
+static void bcmdb_recursive_subsets_unlock_modify(bcmdb_set *sos)
+{
+ int key;
+ int left_entries = sos->num_entries;
+ bcmdb_entry *entry;
+ bcmdb_set *subset;
+
+ BUG_ON(!(sos->entry.flags & BCMDB_FLAG_SOS));
+
+ for (key = 0; key < sos->max_entries; ++key)
+ {
+ entry = sos->key_to_handle(sos, key);
+
+ if ((entry->flags & BCMDB_FLAG_VALID))
+ {
+ subset = (bcmdb_set *)entry->data;
+ subset->unlock_set_recursively_modify(subset);
+
+ --left_entries;
+ /* if we handled all subsets we can break the "for" */
+ if (left_entries==0)
+ {
+ break;
+ }
+ }
+ }
+}
+
+
+/** sem-based set modify-lock recursively */
+static void bcmdb_set_lock_recursively_modify_sem(bcmdb_set *set)
+{
+ BCMDB_TRACE_DEBUG("lock set modify recursively: %s\n", set->name);
+ bcmos_mutex_lock(&set->mutex_update, BCMOS_WAIT_FOREVER);
+ BCMDB_TRACE_DEBUG("mutex was locked\n");
+
+ if ((set->entry.flags & BCMDB_FLAG_SOS))
+ {
+ BCMDB_TRACE_DEBUG("going to lock the subsets\n");
+ bcmdb_recursive_subsets_lock_modify(set);
+ }
+}
+
+
+/** sem-based set modify-unlock recursively */
+static void bcmdb_set_unlock_recursively_modify_sem(bcmdb_set *set)
+{
+ BCMDB_TRACE_DEBUG("unlock set modify recursively: %s\n", set->name);
+
+ if ((set->entry.flags & BCMDB_FLAG_SOS))
+ {
+ BCMDB_TRACE_DEBUG("going to unlock the subsets\n");
+ bcmdb_recursive_subsets_unlock_modify(set);
+ }
+
+ bcmos_mutex_unlock(&set->mutex_update);
+ BCMDB_TRACE_DEBUG("mutex was unlocked\n");
+}
+
+
+/** NB-read-sem-write policy: set read lock */
+static void bcmdb_set_lock_read__nb_read_sem_write(bcmdb_set *set)
+{
+ long flags;
+
+ BCMDB_TRACE_DEBUG("lock set read: %s\n", set->name);
+ flags = bcmos_fastlock_lock(&set->fastlock);
+ ++set->entry.read_count;
+ BCMDB_TRACE_DEBUG("read_count is now: %u\n", set->entry.read_count);
+ bcmos_fastlock_unlock(&set->fastlock, flags);
+}
+
+
+/** NB-read-sem-write policy: set read unlock */
+static void bcmdb_set_unlock_read__nb_read_sem_write(bcmdb_set *set)
+{
+ long flags;
+
+ BCMDB_TRACE_DEBUG("unlock set read: %s\n", set->name);
+
+ flags = bcmos_fastlock_lock(&set->fastlock);
+ BUG_ON(!set->entry.read_count);
+ if (!(--set->entry.read_count) &&
+ set->entry.write_pending)
+ {
+ BCMDB_TRACE_DEBUG("going to wake pending writer\n");
+
+ set->entry.write_pending = 0;
+ bcmos_fastlock_unlock(&set->fastlock, flags);
+ bcmos_sem_post(&set->sem_wait_read_to_finish);
+ }
+ else
+ {
+ bcmos_fastlock_unlock(&set->fastlock, flags);
+ }
+}
+
+
+/** NB-read-sem-write policy: set modify lock */
+static long bcmdb_set_lock_modify__nb_read_sem_write(bcmdb_set *set)
+{
+ long flags;
+
+ BCMDB_TRACE_DEBUG("lock set modify: %s\n", set->name);
+ bcmos_mutex_lock(&set->mutex_update, BCMOS_WAIT_FOREVER);
+ BCMDB_TRACE_DEBUG("mutex was locked\n");
+
+ while(1)
+ {
+ flags = bcmos_fastlock_lock(&set->fastlock);
+ if (!set->entry.read_count)
+ break;
+ /* Wait until read is completed */
+ set->entry.write_pending = 1;
+ bcmos_fastlock_unlock(&set->fastlock, flags);
+ bcmos_sem_wait(&set->sem_wait_read_to_finish, BCMOS_WAIT_FOREVER);
+ }
+ /* At this point fastlock is taken and there are no pending reads */
+
+ BCMDB_TRACE_DEBUG("fastlock is taken, no active reads\n");
+
+ return flags;
+}
+
+
+/** NB-read-sem-write policy: set modify unlock */
+static void bcmdb_set_unlock_modify__nb_read_sem_write(bcmdb_set *set, long fastlock_flags)
+{
+ BCMDB_TRACE_DEBUG("unlock set modify: %s\n", set->name);
+ bcmos_fastlock_unlock(&set->fastlock, fastlock_flags);
+ bcmos_mutex_unlock(&set->mutex_update);
+ BCMDB_TRACE_DEBUG("mutex was unlocked\n");
+}
+
+
+/** sem-read/sem-write policy: lock entry */
+static void *bcmdb_sem_read_sem_write_lock(bcmdb_set *set, bcmdb_key key, int is_deletion)
+{
+ bcmdb_entry *entry;
+ bcmos_mutex_lock(&set->mutex_update, BCMOS_WAIT_FOREVER);
+
+ if (is_deletion)
+ {
+ /* there is nothing to return in deletion case */
+ return NULL;
+ }
+
+ entry = set->key_to_handle(set, key);
+ if (!entry || !(entry->flags & BCMDB_FLAG_VALID))
+ {
+ bcmos_mutex_unlock(&set->mutex_update);
+ return NULL;
+ }
+ return entry->data;
+}
+
+/** sem-read/sem-write policy: unlock entry */
+static void bcmdb_sem_read_sem_write_unlock(bcmdb_set *set)
+{
+ bcmos_mutex_unlock(&set->mutex_update);
+}
+
+/** sem-read/sem-write policy: lock entry for reading */
+static void *bcmdb_sem_read_sem_write_lock_read(bcmdb_set *set, bcmdb_key key)
+{
+ return bcmdb_sem_read_sem_write_lock(set, key, 0) ;
+}
+
+/** sem-read/sem-write policy: unlock entry for reading */
+static void bcmdb_sem_read_sem_write_unlock_read(bcmdb_set *set, bcmdb_key key)
+{
+ bcmdb_sem_read_sem_write_unlock(set);
+}
+
+/** sem-read/sem-write policy: lock entry for writing */
+static void *bcmdb_sem_read_sem_write_lock_write(bcmdb_set *set, bcmdb_key key, int is_deletion)
+{
+ return bcmdb_sem_read_sem_write_lock(set, key, is_deletion) ;
+}
+
+/** sem-read/sem-write policy: unlock entry for writing */
+static void bcmdb_sem_read_sem_write_unlock_write(bcmdb_set *set, int is_deletion, int is_cancellation)
+{
+ bcmdb_sem_read_sem_write_unlock(set);
+}
+
+/** non-blocking-read/shadow write policy: Lock entry for reading */
+static void *bcmdb_nb_read_shadow_write_lock_read(bcmdb_set *set, bcmdb_key key)
+{
+ bcmdb_entry *entry;
+ long flags;
+
+ flags = bcmos_fastlock_lock(&set->fastlock);
+ entry = set->key_to_handle(set, key);
+ if (!entry || !(entry->flags & BCMDB_FLAG_VALID))
+ {
+ bcmos_fastlock_unlock(&set->fastlock, flags);
+ return NULL;
+ }
+ ++entry->read_count;
+
+ BCMDB_TRACE_DEBUG("lock record read: %s, key=%d new_read_count=%d\n", set->name, key, entry->read_count);
+
+ bcmos_fastlock_unlock(&set->fastlock, flags);
+ return entry->data;
+}
+
+
+/** non-blocking-read/shadow write policy: Unlock entry for reading */
+static void bcmdb_nb_read_shadow_write_unlock_read(bcmdb_set *set, bcmdb_key key)
+{
+ bcmdb_entry *entry=set->key_to_handle(set, key);
+ long flags;
+ BUG_ON(!entry);
+
+ BCMDB_TRACE_DEBUG("unlock record read: %s, key=%d\n", set->name, key);
+
+ flags = bcmos_fastlock_lock(&set->fastlock);
+ /* If write is pending - finish it and release write lock */
+ BUG_ON(!entry->read_count);
+ if (!(--entry->read_count) && set->entry.write_pending)
+ {
+ BCMDB_TRACE_DEBUG("going to wake pending writer\n");
+
+ /* Write was pending. Release write task */
+ set->entry.write_pending = 0;
+ bcmos_fastlock_unlock(&set->fastlock, flags);
+ bcmos_sem_post(&set->sem_wait_read_to_finish);
+ }
+ else
+ {
+ BCMDB_TRACE_DEBUG("read_count is now: %u\n", entry->read_count);
+ bcmos_fastlock_unlock(&set->fastlock, flags);
+ }
+}
+
+/** non-blocking-read/shadow write policy: Lock entry for
+ * writing/deletion.
+ * returned value of NULL means error only in case that
+ * is_deletion is 0 */
+static void *bcmdb_nb_read_shadow_write_lock_write(bcmdb_set *set, bcmdb_key key, int is_deletion)
+{
+ bcmdb_entry *entry;
+
+ BCMDB_TRACE_DEBUG("lock record write: %s, key=%d\n", set->name, key);
+
+ bcmos_mutex_lock(&set->mutex_update, BCMOS_WAIT_FOREVER);
+ BCMDB_TRACE_DEBUG("mutex was locked\n");
+
+ if (is_deletion)
+ {
+ /* there is nothing to return in deletion case */
+ return NULL;
+ }
+
+ /* this check is needed since mutex_update is task-aware.
+ it is not allowed for a task to lock for writing a 2nd record before unlocking the first one. */
+ if (set->write_locked_entry)
+ {
+ BCMDB_TRACE_ERROR("there is already an entry locked for writing\n");
+ bcmos_mutex_unlock(&set->mutex_update);
+ return NULL;
+ }
+
+ entry = set->key_to_handle(set, key);
+ if (!entry || !(entry->flags & BCMDB_FLAG_VALID))
+ {
+ bcmos_mutex_unlock(&set->mutex_update);
+ return NULL;
+ }
+ /* Copy data to shadow entry */
+ memcpy(set->shadow_data, entry->data, set->entry_size);
+ set->write_locked_entry = entry;
+ return set->shadow_data;
+}
+
+/** non-blocking-read/shadow write policy: Unlock entry for
+ * writing/deletion */
+static void bcmdb_nb_read_shadow_write_unlock_write(bcmdb_set *set, int is_deletion, int is_cancellation)
+{
+ bcmdb_entry *entry = set->write_locked_entry;
+ long flags;
+ void *old_data;
+
+ /* no entry is locked */
+ BUG_ON(!entry);
+
+ BCMDB_TRACE_DEBUG("unlock record write: %s\n", set->name);
+
+ /* cancellation: no need to update the entry from the shadow (or to delete the entry in case of deletion). */
+ if (is_cancellation)
+ {
+ set->write_locked_entry = NULL;
+ bcmos_mutex_unlock(&set->mutex_update);
+ return;
+ }
+
+ while(1)
+ {
+ flags = bcmos_fastlock_lock(&set->fastlock);
+ /* Wait until neither record nor set are locked for reading */
+ if (!entry->read_count && !set->entry.read_count)
+ break;
+
+ /* Read lock is active. wait */
+
+ BCMDB_TRACE_DEBUG("read lock is active. going to sleep.\n");
+
+ set->entry.write_pending = 1;
+ bcmos_fastlock_unlock(&set->fastlock, flags);
+ bcmos_sem_wait(&set->sem_wait_read_to_finish, BCMOS_WAIT_FOREVER);
+ }
+
+ /* At this point there is no read lock and fastlock is taken. */
+
+ BCMDB_TRACE_DEBUG("fastlock is taken, no active reads\n");
+
+ if (is_deletion)
+ {
+ /* delete the entry */
+ set->entry_delete(set, entry);
+ }
+ else
+ {
+ /* Exchange record data with shadow and release all locks. */
+ old_data = entry->data;
+ entry->data = set->shadow_data;
+ set->shadow_data = old_data;
+ set->write_locked_entry = NULL;
+ }
+
+ bcmos_fastlock_unlock(&set->fastlock, flags);
+ bcmos_mutex_unlock(&set->mutex_update);
+ BCMDB_TRACE_DEBUG("mutex was unlocked\n");
+}
+
+/** none policy: set read-lock */
+static inline void bcmdb_set_lock_read_dummy(bcmdb_set *set)
+{
+}
+
+/** none policy: set read-unlock */
+static inline void bcmdb_set_unlock_read_dummy(bcmdb_set *set)
+{
+}
+
+/** none policy: set modify-lock */
+static inline long bcmdb_set_lock_modify_dummy(bcmdb_set *set)
+{
+ return 0;
+}
+
+/** none policy: set modify-unlock */
+static inline void bcmdb_set_unlock_modify_dummy(bcmdb_set *set, long fastlock_flags)
+{
+}
+
+/** none policy: set modify-lock recursively */
+static void bcmdb_set_lock_recursively_modify_dummy(bcmdb_set *set)
+{
+}
+
+/** none policy: set modify-unlock recursively */
+static void bcmdb_set_unlock_recursively_modify_dummy(bcmdb_set *set)
+{
+}
+
+/** none policy: record lock */
+static inline void *bcmdb_dummy_lock(bcmdb_set *set, bcmdb_key key, int is_deletion)
+{
+ bcmdb_entry *entry;
+
+ /* there is nothing to return in deletion case */
+ if (is_deletion)
+ return NULL;
+
+ entry = set->key_to_handle(set, key);
+ if (!entry || !(entry->flags & BCMDB_FLAG_VALID))
+ return NULL;
+ return entry->data;
+}
+
+/** none policy: record unlock */
+static inline void bcmdb_dummy_unlock(bcmdb_set *set)
+{
+}
+
+/** none policy: record lock for reading */
+static inline void *bcmdb_dummy_lock_read(bcmdb_set *set, bcmdb_key key)
+{
+ return bcmdb_dummy_lock(set, key, 0);
+}
+
+/** none policy: record unlock for reading */
+static inline void bcmdb_dummy_unlock_read(bcmdb_set *set, bcmdb_key key)
+{
+ bcmdb_dummy_unlock(set);
+}
+
+/** none policy: record lock for writing */
+static inline void *bcmdb_dummy_lock_write(bcmdb_set *set, bcmdb_key key, int is_deletion)
+{
+ return bcmdb_dummy_lock(set, key, is_deletion);
+}
+
+/** none policy: record unlock for writing */
+static inline void bcmdb_dummy_unlock_write(bcmdb_set *set, int is_deletion, int is_cancellation)
+{
+ bcmdb_dummy_unlock(set);
+}
+
+
+
+/** Add new sub-set. returns 0 if ok
+ * data contains new set handle
+ */
+static int bcmdb_set_new(bcmdb_set *this, bcmdb_key key, const void *data)
+{
+ /* Although this callback takes "const void *" parameter,
+ * it is just for compatibility fith SoR->new_entry interface.
+ * For SoS this parameter is not constant on application level
+ * (see bcmdb_set_add())
+ */
+ bcmdb_entry *entry = this->key_to_handle(this, key);
+ bcmdb_set *new_set = (bcmdb_set *)(long)data;
+
+ if (!entry)
+ return BCM_ERR_PARM;
+ if ((entry->flags & BCMDB_FLAG_VALID))
+ return BCM_ERR_ALREADY;
+ ++this->num_entries;
+ entry->data = (void *)(long)data;
+ entry->flags |= BCMDB_FLAG_VALID;
+ new_set->my_key = key;
+ new_set->parent = this;
+ return 0;
+}
+
+/** Add new record. returns 0 if ok
+ * data contains record data pointer
+ */
+static int bcmdb_record_new(bcmdb_set *this, bcmdb_key key, const void *data)
+{
+ bcmdb_record *record = (bcmdb_record *)this->key_to_handle(this, key);
+ if (!record || !record->e.data)
+ return BCM_ERR_PARM;
+ if ((record->e.flags & BCMDB_FLAG_VALID))
+ return BCM_ERR_ALREADY;
+ ++this->num_entries;
+ memcpy(record->e.data, data, this->entry_size);
+ record->e.flags |= BCMDB_FLAG_VALID;
+ return 0;
+}
+
+/** Delete entry */
+static int bcmdb_entry_delete(bcmdb_set *this, bcmdb_entry *entry)
+{
+ if (!entry)
+ return BCM_ERR_PARM;
+ if (!(entry->flags & BCMDB_FLAG_VALID))
+ return BCM_ERR_ALREADY;
+ entry->flags &= ~BCMDB_FLAG_VALID;
+ --this->num_entries;
+ return 0;
+}
+
+
+/*
+ * External APIs
+ */
+
+
+/** Initialize data base engine
+ *
+ * \return
+ * 0 - OK\n
+ * <0 - error code
+ * \ingroup bcmdb
+ */
+int bcmdb_module_init(void)
+{
+ return 0;
+}
+
+
+/** Make set-of-sets control block.
+ *
+ * Helper function that creates a set of sets with reasonable defaults for all callbacks and fields.
+ * Once created, the set control block can be tuned before adding the new set to its parent set.
+ * \param[in] init set parameters
+ * \param[out] new_set set control block
+ * \return
+ * 0 - OK\n
+ * <0 - error code
+ */
+int bcmdb_make_set_of_sets(const bcmdb_sos_init *init, bcmdb_set **new_set)
+{
+ bcmdb_set *sos;
+ bcmdb_entry *entries;
+ int rc;
+
+ /* Parameter check */
+ if (!init || !init->name || !new_set)
+ return BCM_ERR_PARM;
+ if ((init->backend_type == BCMDB_BACKEND_ARRAY) && !init->max_entries)
+ return BCM_ERR_PARM;
+
+ /* Allocate set control block and set records */
+ sos = bcmos_calloc(sizeof(bcmdb_set) + strlen(init->name) + 1);
+ if (!sos)
+ return BCM_ERR_NOMEM;
+ sos->name = (char *)(sos + 1);
+ strcpy(sos->name, init->name);
+ sos->entry_size = sizeof(bcmdb_set);
+ sos->max_entries = init->max_entries;
+ sos->my_key = BCMDB_KEY_INVAL;
+ sos->entry.flags = BCMDB_FLAG_SOS;
+ sos->magic = BCMDB_MAGIC_ACTIVE_SET;
+
+ /* Set backend callbacks */
+ switch(init->backend_type)
+ {
+ case BCMDB_BACKEND_ARRAY:
+ entries = bcmos_calloc(sizeof(bcmdb_set)*init->max_entries);
+ if (!entries)
+ {
+ bcmos_free(sos);
+ return BCM_ERR_NOMEM;
+ }
+ sos->entry.data = entries;
+ sos->entry_get_next = _bcmdb_array_entry_get_next;
+ sos->handle_to_key = _bcmdb_array_handle_to_key;
+ sos->key_to_handle = _bcmdb_array_key_to_handle;
+ sos->entry_new = bcmdb_set_new;
+ sos->entry_delete = bcmdb_entry_delete;
+ break;
+
+ default:
+ printf("Only array-based DB backend is supported\n");
+ bcmos_free(sos);
+ return BCM_ERR_NOT_SUPPORTED;
+ }
+
+ /* Set locking callbacks. SoS locking policy is always SEMAPHORE */
+
+ /* in SoS, locking for read is same as for write (and is done recursively). */
+ sos->lock_set_read = bcmdb_set_lock_recursively_modify_sem;
+ sos->unlock_set_read = bcmdb_set_unlock_recursively_modify_sem;
+ sos->lock_set_modify = bcmdb_set_lock_modify_sem;
+ sos->unlock_set_modify = bcmdb_set_unlock_modify_sem;
+ sos->lock_set_recursively_modify = bcmdb_set_lock_recursively_modify_sem ;
+ sos->unlock_set_recursively_modify = bcmdb_set_unlock_recursively_modify_sem ;
+
+ /* create mutex_update */
+ rc = bcmos_mutex_create(&sos->mutex_update, init->os_flags);
+ if (rc)
+ {
+ bcmos_free(entries);
+ bcmos_free(sos);
+ return BCM_ERR_NOMEM;
+ }
+
+ bcmos_fastlock_init(&sos->fastlock, init->os_flags);
+
+ *new_set = sos;
+
+ return 0;
+}
+
+
+
+
+/** Make set-of-records control block.
+ *
+ * Helper function that creates a set of records with reasonable defaults for all callbacks and fields.
+ * Once created, the set control block can be tuned before adding the new set to its parent set.
+ * \param[in] init set parameters
+ * \param[in] alloc_records true (1) - allocate memory for all records.
+ * \param[out] new_set set control block
+ * \return
+ * 0 - OK\n
+ * <0 - error code
+ */
+int bcmdb_make_set_of_records(const bcmdb_sor_init *init, int alloc_records, bcmdb_set **new_set)
+{
+ bcmdb_set *sor;
+ bcmdb_entry *entries = NULL;
+ void *data = NULL;
+ int i;
+ int rc ;
+
+ /* Parameter check */
+ if (!init || !init->name)
+ return BCM_ERR_PARM;
+ if ((init->backend_type == BCMDB_BACKEND_ARRAY) && !init->max_entries)
+ return BCM_ERR_PARM;
+ if (!init->record_size)
+ return BCM_ERR_PARM;
+
+ /* Allocate set control block and set records */
+ sor = bcmos_calloc(sizeof(bcmdb_set) + strlen(init->name) + 1);
+ if (!sor)
+ return BCM_ERR_NOMEM;
+ sor->name = (char *)(sor + 1);
+ strcpy(sor->name, init->name);
+ sor->entry_size = init->record_size;
+ sor->max_entries = init->max_entries;
+ sor->my_key = BCMDB_KEY_INVAL;
+ sor->magic = BCMDB_MAGIC_ACTIVE_SET;
+ sor->format = init->format;
+
+ /* Set backend callbacks */
+ switch(init->backend_type)
+ {
+ case BCMDB_BACKEND_ARRAY:
+ entries = bcmos_calloc(sizeof(bcmdb_entry)*init->max_entries);
+ if (!entries)
+ {
+ bcmos_free(sor);
+ return BCM_ERR_NOMEM;
+ }
+ sor->entry.data = entries;
+ sor->entry_get_next = _bcmdb_array_entry_get_next;
+ sor->handle_to_key = _bcmdb_array_handle_to_key;
+ sor->key_to_handle = _bcmdb_array_key_to_handle;
+ sor->entry_new = bcmdb_record_new;
+ sor->entry_delete = bcmdb_entry_delete;
+
+ /* Preallocate data */
+ if (alloc_records)
+ {
+ int size = init->max_entries * init->record_size;
+ if (init->lock_policy == BCMDB_LOCK_NB_READ_SHADOW_WRITE)
+ size += init->record_size; /* room for shadow entry */
+ /* Allocate data + 1 extra for shadow area */
+ data = bcmos_calloc(size);
+ if (!data)
+ {
+ bcmos_free(entries);
+ bcmos_free(sor);
+ return BCM_ERR_NOMEM;
+ }
+ for(i=0; i<init->max_entries; i++)
+ {
+ bcmdb_entry *entry = (bcmdb_entry *)sor->entry.data + i;
+ entry->data = (void *)((long)data + i * init->record_size);
+ }
+ if (init->lock_policy == BCMDB_LOCK_NB_READ_SHADOW_WRITE)
+ {
+ sor->shadow_data = (void *)((long)data + i * init->record_size);
+ }
+ }
+
+ /* Initialize records */
+ for(i=0; i<init->max_entries; i++)
+ {
+ bcmdb_entry *entry = (bcmdb_entry *)sor->entry.data + i;
+ entry->flags = BCMDB_FLAG_RECORD;
+ }
+ break;
+
+ default:
+ printf("Only array-based DB backend is supported\n");
+ bcmos_free(sor);
+ return BCM_ERR_NOT_SUPPORTED;
+ }
+
+ /* Set locking callbacks based on locking policy */
+ switch(init->lock_policy)
+ {
+ case BCMDB_LOCK_SEM_READ_SEM_WRITE:
+ sor->lock_record_write = bcmdb_sem_read_sem_write_lock_write;
+ sor->lock_record_read = bcmdb_sem_read_sem_write_lock_read;
+ sor->unlock_record_write = bcmdb_sem_read_sem_write_unlock_write;
+ sor->unlock_record_read = bcmdb_sem_read_sem_write_unlock_read;
+ sor->lock_set_read = bcmdb_set_lock_read_sem;
+ sor->unlock_set_read = bcmdb_set_unlock_read_sem;
+ sor->lock_set_modify = bcmdb_set_lock_modify_sem;
+ sor->unlock_set_modify = bcmdb_set_unlock_modify_sem;
+ sor->lock_set_recursively_modify = bcmdb_set_lock_recursively_modify_sem ;
+ sor->unlock_set_recursively_modify = bcmdb_set_unlock_recursively_modify_sem ;
+ break;
+
+ case BCMDB_LOCK_NONE:
+ case BCMDB_LOCK_OTHER:
+ sor->lock_record_write = bcmdb_dummy_lock_write;
+ sor->lock_record_read = bcmdb_dummy_lock_read;
+ sor->unlock_record_write = bcmdb_dummy_unlock_write;
+ sor->unlock_record_read = bcmdb_dummy_unlock_read;
+ sor->lock_set_read = bcmdb_set_lock_read_dummy;
+ sor->unlock_set_read = bcmdb_set_unlock_read_dummy;
+ sor->lock_set_modify = bcmdb_set_lock_modify_dummy;
+ sor->unlock_set_modify = bcmdb_set_unlock_modify_dummy;
+ sor->lock_set_recursively_modify = bcmdb_set_lock_recursively_modify_dummy ;
+ sor->unlock_set_recursively_modify = bcmdb_set_unlock_recursively_modify_dummy ;
+ break;
+
+ case BCMDB_LOCK_NB_READ_SHADOW_WRITE:
+ sor->lock_record_write = bcmdb_nb_read_shadow_write_lock_write;
+ sor->lock_record_read = bcmdb_nb_read_shadow_write_lock_read;
+ sor->unlock_record_write = bcmdb_nb_read_shadow_write_unlock_write;
+ sor->unlock_record_read = bcmdb_nb_read_shadow_write_unlock_read;
+ sor->lock_set_read = bcmdb_set_lock_read__nb_read_sem_write;
+ sor->unlock_set_read = bcmdb_set_unlock_read__nb_read_sem_write;
+ sor->lock_set_modify = bcmdb_set_lock_modify__nb_read_sem_write;
+ sor->unlock_set_modify = bcmdb_set_unlock_modify__nb_read_sem_write;
+ sor->lock_set_recursively_modify = bcmdb_set_lock_recursively_modify_sem ;
+ sor->unlock_set_recursively_modify = bcmdb_set_unlock_recursively_modify_sem ;
+ break;
+
+ default:
+ printf("Lock policy %d is not supported\n", init->lock_policy);
+ if (data)
+ bcmos_free(data);
+ if (entries)
+ bcmos_free(entries);
+ bcmos_free(sor);
+ return BCM_ERR_NOT_SUPPORTED;
+ }
+
+ /* create mutex_update */
+ rc = bcmos_mutex_create(&sor->mutex_update, init->os_flags);
+ if (rc)
+ {
+ if (data)
+ bcmos_free(data);
+ if (entries)
+ bcmos_free(entries);
+ bcmos_free(sor);
+ return BCM_ERR_NOMEM;
+ }
+
+ /* create sem_wait_read_to_finish. it is initialized to be taken */
+ rc = bcmos_sem_create(&sor->sem_wait_read_to_finish, 0, init->os_flags);
+ if (rc)
+ {
+ /* no point to check here the error code of bcmos_mutex_destroy */
+ bcmos_mutex_destroy(&sor->mutex_update);
+ if (data)
+ bcmos_free(data);
+ if (entries)
+ bcmos_free(entries);
+ bcmos_free(sor);
+ return BCM_ERR_NOMEM;
+ }
+
+ bcmos_fastlock_init(&sor->fastlock, init->os_flags);
+
+ *new_set = sor;
+
+ return 0;
+}
+
+
+/** Lock data set for reading. When set is locked - it can't be
+ * modified.
+ *
+ * \param[in] set data base set to be locked
+ *
+ * \ingroup bcmdb
+ */
+void bcmdb_set_lock_read(bcmdb_set *set)
+{
+ BUG_ON(!set);
+ BUG_ON(!set->magic == BCMDB_MAGIC_ACTIVE_SET);
+ BUG_ON(!set->lock_set_read);
+ set->lock_set_read(set);
+}
+
+
+/** Release data set lock
+ *
+ * Unlock set locked by \ref bcmdb_set_lock_read
+ *
+ * \param[in] set data base set to be unlocked
+ *
+ * \ingroup bcmdb
+ */
+void bcmdb_set_unlock_read(bcmdb_set *set)
+{
+ BUG_ON(!set);
+ BUG_ON(!set->magic == BCMDB_MAGIC_ACTIVE_SET);
+ BUG_ON(!set->unlock_set_read);
+ set->unlock_set_read(set);
+}
+
+
+/** Lock data set for modify. If the set is SoS, the locking
+ * will be recursive.
+ *
+ * \param[in] set data base set to be locked
+ *
+ * \ingroup bcmdb
+ */
+void bcmdb_set_lock_modify(bcmdb_set *set)
+{
+ BUG_ON(!set);
+ BUG_ON(!set->magic == BCMDB_MAGIC_ACTIVE_SET);
+ BUG_ON(!set->lock_set_recursively_modify);
+ set->lock_set_recursively_modify(set);
+}
+
+
+/** Release data set lock
+ *
+ * Unlock set locked by \ref bcmdb_set_lock_modify
+ *
+ * \param[in] set data base set to be unlocked
+ *
+ * \ingroup bcmdb
+ */
+void bcmdb_set_unlock_modify(bcmdb_set *set)
+{
+ BUG_ON(!set);
+ BUG_ON(!set->magic == BCMDB_MAGIC_ACTIVE_SET);
+ BUG_ON(!set->unlock_set_recursively_modify);
+ set->unlock_set_recursively_modify(set);
+}
+
+
+/** Add set to the parent set with specific key.
+ *
+ * The function adds set to the parent set creating data base hierarchy.
+ * The function automatically acquires modify lock and releases it
+ * in the end of operation.
+ * \param[in] sos parent set of sets
+ * \param[in] key key to add new set at
+ * \param[in] new_set set control block
+ * \return
+ * =0 - OK\n
+ * <0 - error code
+ * \ingroup bcmdb
+ */
+int bcmdb_set_add(bcmdb_set *sos, bcmdb_key key, bcmdb_set *new_set)
+{
+ int rc;
+ long fastlock_flags;
+ BUG_ON(!sos);
+ BUG_ON(!sos->magic == BCMDB_MAGIC_ACTIVE_SET);
+ BUG_ON(!(sos->entry.flags & BCMDB_FLAG_SOS));
+ BUG_ON(!new_set);
+ BUG_ON(!new_set->magic == BCMDB_MAGIC_ACTIVE_SET);
+ BUG_ON(!new_set->my_key == BCMDB_KEY_INVAL);
+ fastlock_flags = sos->lock_set_modify(sos);
+ rc = sos->entry_new(sos, key, new_set);
+ sos->unlock_set_modify(sos, fastlock_flags);
+ return rc;
+}
+
+
+/** Get set handle given its key.
+ *
+ * \param[in] sos parent set of sets
+ * \param[in] key set key.
+ * \return
+ * !=0 - set handle
+ * NULL- doesn't exist
+ * \ingroup bcmdb
+ */
+bcmdb_set *bcmdb_set_handle(const bcmdb_set *sos, bcmdb_key key)
+{
+ bcmdb_entry *entry;
+ BUG_ON(!sos);
+ BUG_ON(!sos->magic == BCMDB_MAGIC_ACTIVE_SET);
+ BUG_ON(!(sos->entry.flags & BCMDB_FLAG_SOS));
+ entry = sos->key_to_handle(sos, key);
+ if (!entry || !(entry->flags & BCMDB_FLAG_VALID))
+ return NULL;
+ return (bcmdb_set *)entry->data;
+}
+
+
+/** Get set key given its handle.
+ *
+ * \param[in] set set handle
+ * \param[in] key set key.
+ * \return
+ * !=BCMDB_KEY_INVAL - set key
+ * BCMDB_KEY_INVAL - error
+ * \ingroup bcmdb
+ */
+bcmdb_key bcmdb_set_key(const bcmdb_set *set)
+{
+ BUG_ON(!set);
+ BUG_ON(!set->magic == BCMDB_MAGIC_ACTIVE_SET);
+ return set->my_key;
+}
+
+
+/** Get set name
+ *
+ * \param[in] set set handle
+ * \return set name
+ * \ingroup bcmdb
+ */
+const char *bcmdb_set_name(const bcmdb_set *set)
+{
+ BUG_ON(!set);
+ BUG_ON(!set->magic == BCMDB_MAGIC_ACTIVE_SET);
+ return set->name;
+}
+
+
+/** Get number of records in the set.
+ *
+ * \param[in] set set handle
+ * \return number of active records in the set
+ * \ingroup bcmdb
+ */
+int bcmdb_set_num_records(const bcmdb_set *set)
+{
+ BUG_ON(!set);
+ BUG_ON(!set->magic == BCMDB_MAGIC_ACTIVE_SET);
+ return set->num_entries;
+}
+
+
+/** Get entry size
+ *
+ * \param[in] set set handle
+ * \return set entry size
+ * \ingroup bcmdb
+ */
+int bcmdb_set_entry_size(const bcmdb_set *set)
+{
+ BUG_ON(!set);
+ BUG_ON(!set->magic == BCMDB_MAGIC_ACTIVE_SET);
+ return set->entry_size;
+}
+
+
+/** Add record to the parent set with specific key.
+ *
+ * The function creates a new record and adds it to the parent set with specific key.
+ * The function automatically acquires modify lock and releases it
+ * in the end of operation.
+ * \param[in] sor parent set of records
+ * \param[in] key key to add new set at
+ * \param[in] data record data. Data size is defined at parent SOR registration time.
+ * \param[out] p_record new record handle
+ * \return
+ * =0 - OK\n
+ * <0 - error code
+ * \ingroup bcmdb
+ */
+int bcmdb_record_add(bcmdb_set *sor, bcmdb_key key, const void *data)
+{
+ int rc;
+ long fastlock_flags;
+
+ BUG_ON(!sor);
+ BUG_ON(!data);
+ BUG_ON(!sor->magic == BCMDB_MAGIC_ACTIVE_SET);
+ BUG_ON(!(sor->entry.flags & BCMDB_FLAG_SOS)==0);
+
+ fastlock_flags = sor->lock_set_modify(sor);
+ rc=sor->entry_new(sor, key, data);
+ sor->unlock_set_modify(sor, fastlock_flags);
+ return rc;
+}
+
+
+/** Delete record from the parent SoR given the record key.
+ *
+ * The function automatically acquires modify lock and releases it
+ * in the end of operation.
+ *
+ * \param[in] sor parent set of records
+ * \param[in] key record key.
+ */
+void bcmdb_record_delete(bcmdb_set *sor, bcmdb_key key)
+{
+ BUG_ON(!sor);
+ BUG_ON(!sor->magic == BCMDB_MAGIC_ACTIVE_SET);
+ BUG_ON(!(sor->entry.flags & BCMDB_FLAG_SOS)==0);
+
+ sor->lock_record_write(sor, key, 1);
+ sor->unlock_record_write(sor, 1, 0);
+}
+
+
+/** Get record data pointer without locking.
+ *
+ * The function returns pointer to data structure stored in data base record.\n
+ * Attention! The caller is required to aquire read or write lock - as appropriate
+ * before calling this function and release the lock when processing is finished.
+ *
+ * \param[in] sor parent set of records
+ * \param[in] key record key
+ * \return
+ * data pointer. NULL if there is no record matching the key.
+ * \ingroup bcmdb
+ */
+void *bcmdb_record_getraw_nolock(bcmdb_set *sor, bcmdb_key key)
+{
+ bcmdb_entry *entry;
+ BUG_ON(!sor);
+ BUG_ON(!sor->magic == BCMDB_MAGIC_ACTIVE_SET);
+ BUG_ON(!(sor->entry.flags & BCMDB_FLAG_SOS)==0);
+ entry = sor->key_to_handle(sor, key);
+ if (!entry || !(entry->flags & BCMDB_FLAG_VALID))
+ return NULL;
+ return entry->data;
+}
+
+
+/** Lock record for reading and return record data pointer.
+ *
+ * The function aquires read-lock and returns pointer to data structure stored in data base record.\n
+ * read-lock must be released separately when the pointer is no longer in use.
+ * Note that the default record-read lock is non-blocking and counting.
+ * That means that multiple processes cam read-lock the same record without blocking.
+ * The function is low-level. It is recommended to use macro \ref bcmdb_record_get_read instead.
+ *
+ * \param[in] sor parent set of records
+ * \param[in] key record key
+ * \return
+ * data pointer. NULL if there is no record matching the key.
+ * \ingroup bcmdb
+ */
+const void *bcmdb_record_getraw_read(bcmdb_set *sor, bcmdb_key key)
+{
+ BUG_ON(!sor);
+ BUG_ON(!sor->magic == BCMDB_MAGIC_ACTIVE_SET);
+ BUG_ON(!(sor->entry.flags & BCMDB_FLAG_SOS)==0);
+ return sor->lock_record_read(sor, key);
+}
+
+
+/** Unlock record locked for reading.
+ *
+ * \param[in] sor parent set of records
+ * \param[in] key record key
+ *
+ * \ingroup bcmdb
+ */
+void bcmdb_record_unlock_read(bcmdb_set *sor, bcmdb_key key)
+{
+ BUG_ON(!sor);
+ BUG_ON(!sor->magic == BCMDB_MAGIC_ACTIVE_SET);
+ BUG_ON(!(sor->entry.flags & BCMDB_FLAG_SOS)==0);
+ sor->unlock_record_read(sor, key);
+}
+
+
+/** Read record data into user area.
+ *
+ * The function aquires read-lock, reads data into user area and releases read-lock.
+ *
+ * \param[in] sor parent set of records
+ * \param[in] key record key
+ * \param[in] offset offset in data record
+ * \param[in] size data size. Note that offset+size must be <= record_size
+ * \param[in] data data pointer.
+ * \return
+ * =0-OK\n
+ * <0-error code
+ * \ingroup bcmdb
+ */
+int bcmdb_record_read(bcmdb_set *sor, bcmdb_key key, int offset, int size, void *data)
+{
+ const void *d = bcmdb_record_getraw_read(sor, key);
+ if (!d)
+ return BCM_ERR_PARM;
+ if ((unsigned)offset + (unsigned)size > sor->entry_size)
+ {
+ bcmdb_record_unlock_read(sor, key);
+ return BCM_ERR_PARM;
+ }
+ memcpy(data, (const char *)d+(unsigned)offset, (unsigned)size);
+ bcmdb_record_unlock_read(sor, key);
+ return 0;
+}
+
+
+/** Lock record for writing and return record data pointer.
+ *
+ * The function aquires write-lock and returns pointer to data structure stored in data base record.\n
+ * write-lock must be released separately when the pointer is no longer in use.
+ * The function is low-level. It is recommended to use macro \ref bcmdb_record_get_write instead.
+ *
+ * \param[in] sor parent set of records
+ * \param[in] key record key
+ * \return
+ * data pointer. NULL if there is no record matching the key.
+ * \ingroup bcmdb
+ */
+void *bcmdb_record_getraw_write(bcmdb_set *sor, bcmdb_key key)
+{
+ BUG_ON(!sor);
+ BUG_ON(!sor->magic == BCMDB_MAGIC_ACTIVE_SET);
+ BUG_ON(!(sor->entry.flags & BCMDB_FLAG_SOS)==0);
+ return sor->lock_record_write(sor, key, 0);
+}
+
+
+/** Unlock record locked for writing.
+ *
+ * \param[in] sor parent set of records
+ * \param[in] is_cancellation TRUE=cancel transaction
+ *
+ * \ingroup bcmdb
+ */
+void bcmdb_record_unlock_write(bcmdb_set *sor, int is_cancellation)
+{
+ BUG_ON(!sor);
+ BUG_ON(!sor->magic == BCMDB_MAGIC_ACTIVE_SET);
+ BUG_ON(!(sor->entry.flags & BCMDB_FLAG_SOS)==0);
+ sor->unlock_record_write(sor, 0, is_cancellation);
+}
+
+
+/** Write record data.
+ *
+ * The function aquires modify-lock, replaces data stored in data base record
+ * and releses the lock.
+ *
+ * \param[in] sor parent set of records
+ * \param[in] key record key
+ * \param[in] offset offset in data record
+ * \param[in] size data size. Note that offset+size must be <= record_size
+ * \param[in] data data pointer.
+ * \return
+ * =0-OK\n
+ * <0-error code
+ * \ingroup bcmdb
+ */
+int bcmdb_record_write(bcmdb_set *sor, bcmdb_key key, int offset, int size, const void *data)
+{
+ void *d=bcmdb_record_getraw_write(sor, key);
+ if (!d)
+ return BCM_ERR_PARM;
+ if ((unsigned)offset + (unsigned)size > sor->entry_size)
+ {
+ bcmdb_record_unlock_write(sor, 0);
+ return BCM_ERR_PARM;
+ }
+ memcpy((char *)d+(unsigned)offset, data, (unsigned)size);
+ bcmdb_record_unlock_write(sor, 0);
+ return 0;
+}
+
+
+/** Register notification function to get informed
+ * when data base set is modified.
+ *
+ * \param[in] sor parent set of records
+ * \param[in] cb callback function pointer
+ * \param[in] cb_priv private data that should be passed to the callback
+ * \return
+ * =0 - OK\n
+ * <0 - error code
+ * \ingroup bcmdb
+ */
+int bcmdb_set_notify_register(bcmdb_set *sor, bcmdb_notify_cb cb, long cb_priv)
+{
+ bcmdb_notify *nf_new, *nf, *nf_prev = NULL;
+
+ BUG_ON(!sor);
+ BUG_ON(!sor->magic == BCMDB_MAGIC_ACTIVE_SET);
+ BUG_ON(!cb);
+
+ nf_new = bcmos_calloc(sizeof(bcmdb_notify));
+ if (!nf_new)
+ return BCM_ERR_NOMEM;
+ nf_new->cb = cb;
+ nf_new->cb_priv = cb_priv;
+
+ /* Add to set's notification list */
+ nf = sor->notify_list_head;
+ while(nf)
+ {
+ nf_prev = nf;
+ nf = nf->next;
+ }
+ if (nf_prev)
+ nf_prev->next = nf_new;
+ else
+ sor->notify_list_head = nf_new;
+
+ return 0;
+}
+
+
+/** Data base iterator
+ *
+ * \param[in] set data base set
+ * \param[in] prev last entry. BCMDB_KEY_ANY=start from the beginning
+ * \return data base entry key following prev or BCMDB_KEY_NO_MORE if end is reached.\n
+ * BCMDB_KEY_INVAL is reqturned if prev key is invalid
+ * \ingroup bcmdb
+ */
+bcmdb_key bcmdb_set_iterate(const bcmdb_set *set, bcmdb_key prev)
+{
+ BUG_ON(!set);
+ BUG_ON(!set->magic == BCMDB_MAGIC_ACTIVE_SET);
+ return set->entry_get_next(set, prev);
+}
+
+
+/* Print database structure */
+static void _bcmdb_print_structure(const bcmdb_set *set, int level)
+{
+ int i;
+
+ if (!set)
+ return;
+
+ /* Indentation */
+ for(i=0; i<level; i++)
+ printf("\t");
+
+ if ((set->entry.flags & BCMDB_FLAG_SOS))
+ {
+ bcmdb_key key = bcmdb_set_iterate(set, BCMDB_KEY_ANY);
+ printf("%-16s SoS max_entries=%d entries=%d\n", set->name, set->max_entries, set->num_entries);
+ while(key >= 0)
+ {
+ _bcmdb_print_structure(bcmdb_set_handle(set, key), level+1);
+ key = bcmdb_set_iterate(set, key);
+ }
+ }
+ else
+ {
+ printf("%-16s SoR max_entries=%d entries=%d record_size=%d total_size=%d\n",
+ set->name, set->max_entries, set->num_entries, set->entry_size,
+ set->entry_size*set->max_entries);
+ }
+}
+
+
+/** Print database structure.
+ *
+ * \param[in] set root set
+ * \ingroup bcmdb
+ */
+void bcmdb_set_print_structure(const bcmdb_set *set)
+{
+ _bcmdb_print_structure(set, 0);
+}
+
+
+/** Format record for printing.
+ *
+ * The function converts record data to human-readible format.
+ *
+ * \param[in] sor parent set of records
+ * \param[in] key record key
+ * \param[out] buffer output buffer
+ * \param[in] size buffer size
+ * \return
+ * >=0-amount of data placed in the buffer\n
+ * <0-error code
+ */
+int bcmdb_record_read_formatted(bcmdb_set *sor, bcmdb_key key, char *buffer, int size)
+{
+ const void *data;
+ int len;
+ if (!buffer || !size)
+ return BCM_ERR_PARM;
+ if (!sor->format)
+ return BCM_ERR_NOT_SUPPORTED;
+ *buffer=0;
+ data = bcmdb_record_getraw_read(sor, key);
+ if (!data)
+ return 0;
+ len = sor->format(data, buffer, size);
+ bcmdb_record_unlock_read(sor, key);
+ return len;
+}
diff --git a/bal_release/src/common/db_engine/bcm_db_engine.h b/bal_release/src/common/db_engine/bcm_db_engine.h
new file mode 100644
index 0000000..8d77022
--- /dev/null
+++ b/bal_release/src/common/db_engine/bcm_db_engine.h
@@ -0,0 +1,622 @@
+/******************************************************************************
+ *
+ * <: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.
+ *
+ * :>
+ *
+ *****************************************************************************/
+
+/*
+ * bcm_db_engine.c
+ *
+ * Data base engine
+ */
+#ifndef BCMDB_ENGINE_H
+
+#define BCMDB_ENGINE_H
+
+/** \defgroup bcmdb_e Data Base Engine Module
+Hierarchical data base is built from 3 types of objects:
+- set: consists of control info and dynamic array of other sets OR of records of the same kind.
+ - Mixing subsets and records in the same set is not supported.
+ - Sets are objects that perform operations like access, locking, adding or removing elements,
+ etc., via methods that can differ for every set.
+ - Set elements are addressed using a single key.
+ - Most sets are internally organized as arrays. However, other organizations (e.g., lists, hash tables)
+ are also possible because each set can have different set of methods for element access.
+- record: is a container for storing information.
+ - Record consists of control info and a structure containing fields.
+ - Record is the smallest DB element that has a handle and can be individually locked.
+ - Record size is fixed at time when the set containing records is created.
+- field: is a convenience element.
+ - DB API includes field access macros for convenience and traceability.
+ Apart from that, record layout is transparent to the DB engine.
+ - DB user has an option of accessing record fields directly (as C structure fields), without using DB API
+ @{
+*/
+
+#define bcmdb_error_print(rc,format,args...) BCMOS_TRACE_ERR("status:%s :" format, bcmos_strerror(rc), ##args)
+
+/** Data base backend type
+ */
+typedef enum
+{
+ BCMDB_BACKEND_ARRAY, /**< Array-based backend */
+ BCMDB_BACKEND_HASH, /**< Hash-based backend */
+ BCMDB_BACKEND_OTHER /**< User-defined backend */
+} bcmdb_backend_type;
+
+
+/** Data locking policy
+ */
+typedef enum
+{
+ BCMDB_LOCK_NONE, /**< No record-level locking. Can be used for records containing independent fields */
+ BCMDB_LOCK_NB_READ_SHADOW_WRITE,/**< Non-blocking read, write using shadow area (default) */
+ BCMDB_LOCK_SEM_READ_SEM_WRITE, /**< Strong locking. Both read and write locks use semaphores */
+ BCMDB_LOCK_OTHER /**< User-defined locking policy */
+} bcmdb_lock_policy;
+
+
+/** Data base key
+ * Valid values >= 0
+ */
+typedef int bcmdb_key;
+
+
+/** Any key
+ */
+#define BCMDB_KEY_ANY (-1)
+
+/** Invalid key
+ */
+#define BCMDB_KEY_INVAL (-2)
+
+/** No more records
+ */
+#define BCMDB_KEY_NO_MORE (-3)
+
+
+ /** Data Base Set control block */
+typedef struct bcmdb_set bcmdb_set;
+
+/** Data Base Record control block */
+typedef struct bcmdb_record bcmdb_record;
+
+/** Data Base Set or Record */
+typedef struct bcmdb_entry bcmdb_entry;
+
+
+/** Data base operations for notifications.
+ */
+typedef enum
+{
+ BCMDB_OPER_ADD, /**< Entry has been added */
+ BCMDB_OPER_DELETE, /**< Entry has been deleted */
+ BCMDB_OPER_UPDATE /**< Entry has been modified */
+} bcmdb_oper_t;
+
+
+/** Data base update notification callback.
+ */
+typedef void (*bcmdb_notify_cb)(bcmdb_set *set, bcmdb_key key, bcmdb_oper_t oper, void *new_data);
+
+
+/** Format callback. Used by bcmdb_record_read_formatted to convert record data to human-readible format */
+typedef int (*bcmdb_format_cb)(const void *data, char *buffer, int buffer_size);
+
+
+/** Set-of-Sets init structure.
+ */
+typedef struct bcmdb_sos_init
+{
+ const char *name; /**< Set name */
+ bcmdb_backend_type backend_type; /**< Backend type */
+ uint32_t max_entries; /**< Max number of entries. 0=unlimited (not supported for array backend) */
+ uint32_t os_flags; /**< OS flags. Control whether set can be accessed by multiple cores. See bcmos_mutex_create() */
+} bcmdb_sos_init;
+
+
+/** Set-of-Records init structure.
+ */
+typedef struct bcmdb_sor_init
+{
+ const char *name; /**< Set name */
+ bcmdb_backend_type backend_type; /**< Backend type */
+ bcmdb_lock_policy lock_policy; /**< Set locking policy */
+ uint32_t max_entries; /**< Max number of entries. 0=unlimited (not supported for array backend) */
+ uint32_t record_size; /**< Record size > 0 */
+ bcmdb_format_cb format; /**< callback that converts record data to human-readable form */
+ uint32_t os_flags; /**< OS flags. Control whether set can be accessed by multiple cores. See bcmos_mutex_create() */
+} bcmdb_sor_init;
+
+
+/** Initialize data base engine
+ *
+ * \return
+ * 0 - OK\n
+ * <0 - error code
+ */
+int bcmdb_module_init(void);
+
+
+/** Make set-of-sets control block.
+ *
+ * Helper function that creates a set of sets with reasonable defaults for all callbacks and fields.
+ * Once created, the set control block can be tuned before adding the new set to its parent set.
+ * \param[in] init set parameters
+ * \param[out] new_set set control block
+ * \return
+ * 0 - OK\n
+ * <0 - error code
+ */
+int bcmdb_make_set_of_sets(const bcmdb_sos_init *init, bcmdb_set **new_set);
+
+
+/** Make set-of-sets control block macro.
+ *
+ * Calls \ref bcmdb_make_set_of_sets.
+ * Prints error message and jumps to error_label in case of failure.
+ * For parameter description see \ref bcmdb_make_set_of_sets
+ */
+#define BCMDB_MAKE_SOS(_name,_backend,_max_entries,_p_handle,_rc,_error_label) \
+({\
+ bcmdb_sos_init _init = { .name=_name, .max_entries=_max_entries, .backend_type=_backend};\
+ _rc = bcmdb_make_set_of_sets(&_init, _p_handle);\
+ if (_rc)\
+ {\
+ bcmdb_error_print(_rc, "failed to create set %s.\n", _name);\
+ goto _error_label;\
+ }\
+})
+
+
+/** Make set-of-records control block.
+ *
+ * Helper function that creates a set of records with reasonable defaults for all callbacks and fields.
+ * Once created, the set control block can be tuned before adding the new set to its parent set.
+ * \param[in] init set parameters
+ * \param[in] alloc_records true (1) - allocate memory for all records.
+ * \param[out] new_set set control block
+ * \return
+ * 0 - OK\n
+ * <0 - error code
+ */
+int bcmdb_make_set_of_records(const bcmdb_sor_init *init, int alloc_records, bcmdb_set **new_set);
+
+
+/** Make set-of-records control block macro.
+ *
+ * Calls \ref bcmdb_make_set_of_records.
+ * Prints error message and jumps to error_label in case of failure.
+ * For parameter description see \ref bcmdb_make_set_of_records
+ */
+#define BCMDB_MAKE_SOR(_name,_backend,_lock,_max_entries,_rec_size,_is_alloc,_format,_p_handle,_rc,_error_label) \
+({\
+ bcmdb_sor_init _init = { .name=_name, .max_entries=_max_entries, .backend_type=_backend,\
+ .lock_policy=_lock, .record_size=_rec_size,.format=_format};\
+ _rc = bcmdb_make_set_of_records(&_init,_is_alloc,_p_handle);\
+ if (_rc)\
+ {\
+ bcmdb_error_print(_rc, "failed to create record set %s.\n", _name);\
+ goto _error_label;\
+ }\
+})
+
+
+/** Lock data set. When set is locked - it can't be modified.
+ *
+ * \param[in] set data base set to be locked
+ *
+ */
+void bcmdb_set_lock_read(bcmdb_set *set);
+
+
+/** Release data set lock
+ *
+ * Unlock set locked by \ref bcmdb_set_lock_read
+ *
+ * \param[in] set data base set to be unlocked
+ */
+void bcmdb_set_unlock_read(bcmdb_set *set);
+
+
+/** Lock data set for modify. If the set is SoS, the locking
+ * will be recursive.
+ *
+ * \param[in] set data base set to be locked
+ *
+ * \ingroup bcmdb
+ */
+void bcmdb_set_lock_modify(bcmdb_set *set);
+
+
+/** Release data set lock
+ *
+ * Unlock set locked by \ref bcmdb_set_lock_modify
+ *
+ * \param[in] set data base set to be unlocked
+ *
+ * \ingroup bcmdb
+ */
+void bcmdb_set_unlock_modify(bcmdb_set *set);
+
+
+/** Add set to the parent set.
+ *
+ * The function adds set to the parent set creating data base hierarchy.
+ * The function automatically acquires modify lock and releases it
+ * in the end of operation.
+ * \param[in] sos parent set of sets
+ * \param[in] key key to add new set at
+ * \param[in] new_set set control block
+ * \return
+ * =0 - OK\n
+ * <0 - error code
+ */
+int bcmdb_set_add(bcmdb_set *sos, bcmdb_key key, bcmdb_set *new_set);
+
+
+/** Add set to the parent set with specific key macro.
+ *
+ * Calls \ref bcmdb_set_add.
+ * Prints error message and jumps to error_label in case of failure.
+ * For parameter description see \ref bcmdb_set_add
+ */
+#define BCMDB_SET_ADD(_parent,_key,_set,_rc,_error_label) \
+({\
+ _rc = bcmdb_set_add(_parent,_key,_set);\
+ if (_rc)\
+ {\
+ bcmdb_error_print(_rc, "failed to add set %s to %s.\n", bcmdb_set_name(_set), bcmdb_set_name(_parent));\
+ goto _error_label;\
+ }\
+})
+
+
+/** Get set handle given its key.
+ *
+ * \param[in] sos parent set of sets
+ * \param[in] key set key.
+ * \return
+ * !=0 - set handle
+ * NULL- doesn't exist
+ */
+bcmdb_set *bcmdb_set_handle(const bcmdb_set *sos, bcmdb_key key);
+
+
+/** Get set key given its handle.
+ *
+ * \param[in] set set handle
+ * \return
+ * !=BCMDB_KEY_INVAL - set key\n
+ * BCMDB_KEY_INVAL - error
+ */
+bcmdb_key bcmdb_set_key(const bcmdb_set *set);
+
+
+/** Get set name
+ *
+ * \param[in] set set handle
+ * \return set name
+ */
+const char *bcmdb_set_name(const bcmdb_set *set);
+
+
+/** Get number of records in the set.
+ *
+ * \param[in] set set handle
+ * \return number of active records in the set
+ */
+int bcmdb_set_num_records(const bcmdb_set *set);
+
+
+/** Get entry size
+ *
+ * \param[in] set set handle
+ * \return set entry size
+ */
+int bcmdb_set_entry_size(const bcmdb_set *set);
+
+
+/** Add record to the parent set.
+ *
+ * The function creates a new record and adds it to the parent set with specific key.
+ * The function automatically acquires modify lock and releases it
+ * in the end of operation.
+ * \param[in] sor parent set of records
+ * \param[in] key record key
+ * \param[in] data record data. Data size is defined at parent SOR registration time.
+ * \return
+ * =0 - OK\n
+ * <0 - error code
+ */
+int bcmdb_record_add(bcmdb_set *sor, bcmdb_key key, const void *data);
+
+
+/** Delete record from the parent SoR given the record key.
+ *
+ * The function automatically acquires modify lock and releases it
+ * in the end of operation.
+ *
+ * \param[in] sor parent set of records
+ * \param[in] key record key.
+ */
+void bcmdb_record_delete(bcmdb_set *sor, bcmdb_key key);
+
+
+/** Get record data pointer without locking.
+ *
+ * The function returns pointer to data structure stored in data base record.\n
+ * Attention! The caller is required to aquire read or write lock - as appropriate
+ * before calling this function and release the lock when processing is finished.
+ * The function is low-level. It is recommended to use \ref bcmdb_record_get_nolock instead.
+ *
+ * \param[in] sor parent set of records
+ * \param[in] key record key
+ * \return
+ * data pointer. NULL if there is no record matching the key.
+ */
+void *bcmdb_record_getraw_nolock(bcmdb_set *sor, bcmdb_key key);
+
+
+/** Get record data pointer without locking.
+ *
+ * The function returns pointer to data structure stored in data base record.\n
+ * Attention! The caller is required to aquire read or write lock - as appropriate
+ * before calling this function and release the lock when processing is finished.
+ *
+ * \param[in] _sor parent set of records
+ * \param[in] _key record key
+ * \param[in] _record_type underlying data type.
+ * \return
+ * data pointer casted to the underlying data type\n
+ * NULL if there is no record matching the key.
+ */
+#define bcmdb_record_get_nolock(_sor, _key, _record_type) \
+ ({ \
+ assert(sizeof(_record_type)==bcmdb_set_entry_size(_sor)); \
+ (_record_type *)bcmdb_record_getraw_nolock(_sor, _key); \
+ })
+
+
+/** Lock record for reading and return record data pointer.
+ *
+ * The function aquires read-lock and returns pointer to data structure stored in data base record.\n
+ * read-lock must be released separately when the pointer is no longer in use.
+ * Note that the default record-read lock is non-blocking and counting.
+ * That means that multiple processes can read-lock the same record without blocking.
+ * The function is low-level. It is recommended to use macro \ref bcmdb_record_get_read instead.
+ *
+ * \param[in] sor parent set of records
+ * \param[in] key record key
+ * \return
+ * data pointer. NULL if there is no record matching the key.
+ */
+const void *bcmdb_record_getraw_read(bcmdb_set *sor, bcmdb_key key);
+
+
+/** Lock record for reading and return record data pointer.
+ *
+ * The macro returns pointer to data structure stored in data base record.\n
+ * The read-lock must be released separately when the pointer is no longer in use.
+ * Note that the default record-read lock is non-blocking and counting.
+ * That means that multiple processes can read-lock the same record without blocking.
+ *
+ * \param[in] _sor parent set of records
+ * \param[in] _key record key
+ * \param[in] _record_type underlying data type.
+ * \return
+ * data pointer casted to the underlying data type
+ */
+#define bcmdb_record_get_read(_sor, _key, _record_type) \
+ ({ \
+ assert(sizeof(_record_type)==bcmdb_set_entry_size(_sor)); \
+ (const _record_type *)bcmdb_record_getraw_read(_sor, _key);\
+ })
+
+
+/** Unlock record locked for reading.
+ *
+ * This function must be called after \ref bcmdb_record_get_read or
+ * \ref bcmdb_record_getraw_read. Following bcmdb_record_read_unlock
+ * call pointer returned by \ref bcmdb_record_get_read becomes invalid.
+ *
+ * \param[in] sor parent set of records
+ * \param[in] key record key
+ *
+ */
+void bcmdb_record_unlock_read(bcmdb_set *sor, bcmdb_key key);
+
+
+/** Read record data into user area.
+ *
+ * The function aquires read-lock, reads data into user area and releases read-lock.
+ *
+ * \param[in] sor parent set of records
+ * \param[in] key record key
+ * \param[in] offset offset in data record
+ * \param[in] size data size. Note that offset+size must be <= record_size
+ * \param[in] data data pointer.
+ * \return
+ * =0-OK\n
+ * <0-error code
+ */
+int bcmdb_record_read(bcmdb_set *sor, bcmdb_key key, int offset, int size, void *data);
+
+
+/** Get record field.
+ *
+ * The macro returns record field value.
+ *
+ * \param[in] _sor parent set of records
+ * \param[in] _key record key
+ * \param[in] _record_type type of the underlying data structure.
+ * \param[in] _field_name data structure field name
+ * \param[out] _p_field_value pointer of variable where data structure field value should be returned
+ * \return
+ * =0-OK\n
+ * <0-error code
+ */
+#define bcmdb_record_read_field(_sor, _key, _record_type, _field_name, _p_field_value) \
+ bcmdb_record_read(_sor, _key, offsetof(_record_type, _field_name), \
+ sizeof(*(_p_field_value)), _p_field_value);
+
+
+/** Lock record for writing and return record data pointer.
+ *
+ * The function aquires write-lock and returns pointer to data structure stored in data base record.\n
+ * write-lock must be released separately when the pointer is no longer in use.
+ * The function is low-level. It is recommended to use macro \ref bcmdb_record_get_write instead.
+ *
+ * \param[in] sor parent set of records
+ * \param[in] key record key
+ * \return
+ * data pointer. NULL if there is no record matching the key.
+ */
+void *bcmdb_record_getraw_write(bcmdb_set *sor, bcmdb_key key);
+
+
+/** Lock record for writing and return record data pointer.
+ *
+ * The function aquires write-lock and returns pointer to data structure stored in data base record.\n
+ * write-lock must be released separately when the pointer is no longer in use.
+ *
+ * \param[in] _sor parent set of records
+ * \param[in] _key record key
+ * \param[in] _record_type underlying data type.
+ * \return
+ * data pointer casted to the underlying data type
+ */
+#define bcmdb_record_get_write(_sor, _key, _record_type) \
+ ({ \
+ assert(sizeof(_record_type)==bcmdb_set_entry_size(_sor)); \
+ (_record_type *)bcmdb_record_getraw_write(_sor, _key);\
+ })
+
+
+/** Unlock record locked for writing.
+ *
+ * This function must be called after \ref bcmdb_record_get_write or
+ * \ref bcmdb_record_getraw_write. Following bcmdb_record_unlock_write
+ * call pointer returned by \ref bcmdb_record_get_write becomes invalid.
+ *
+ * \param[in] sor parent set of records
+ * \param[in] is_cancellation TRUE=cancel transaction
+ *
+ */
+void bcmdb_record_unlock_write(bcmdb_set *sor, int is_cancellation);
+
+
+
+/** Write record data.
+ *
+ * The function aquires modify-lock, replaces data stored in data base record
+ * and releses the lock.
+ *
+ * \param[in] sor parent set of records
+ * \param[in] key record key
+ * \param[in] offset offset in data record
+ * \param[in] size data size. Note that offset+size must be <= record_size
+ * \param[in] data data pointer.
+ * \return
+ * =0-OK\n
+ * <0-error code
+ */
+int bcmdb_record_write(bcmdb_set *sor, bcmdb_key key, int offset, int size, const void *data);
+
+
+/** Write record field.
+ *
+ * The macro updates record field value.\n
+ * The macro aquires and releases record-modify lock.
+ *
+ * \param[in] _sor parent set of records
+ * \param[in] _key record key
+ * \param[in] _record_type type of the underlying data structure.
+ * \param[in] _field_name data structure field name
+ * \param[in] _field_value field value
+ * \return
+ * =0-OK\n
+ * <0-error code
+ */
+#define bcmdb_record_write_field(_sor, _key, _record_type, _field_name, _field_value) \
+ ({ \
+ typeof(((_record_type *)0)->_field_name) _f = _field_value;\
+ bcmdb_record_write(_sor, _key, offsetof(_record_type, _field_name), sizeof(_f), &_f);\
+ });
+
+
+/** Register notification function to get informed
+ * when data base set is modified.
+ *
+ * \param[in] sor parent set of records
+ * \param[in] cb callback function pointer
+ * \param[in] cb_priv private data that should be passed to the callback
+ * \return
+ * =0 - OK\n
+ * <0 - error code
+ */
+int bcmdb_set_notify_register(bcmdb_set *sor, bcmdb_notify_cb cb, long cb_priv);
+
+
+/** Data base iterator
+ *
+ * \param[in] set data base set
+ * \param[in] prev last entry. BCMDB_KEY_ANY=start from the beginning
+ * \return data base entry key following prev or BCMDB_KEY_NO_MORE if end is reached.\n
+ * BCMDB_KEY_INVAL is reqturned if prev key is invalid
+ */
+bcmdb_key bcmdb_set_iterate(const bcmdb_set *set, bcmdb_key prev);
+
+
+/** Print database structure.
+ *
+ * \param[in] set root set
+ */
+void bcmdb_set_print_structure(const bcmdb_set *set);
+
+
+/** Format record for printing.
+ *
+ * The function converts record data to human-readable format.
+ *
+ * \param[in] sor parent set of records
+ * \param[in] key record key
+ * \param[out] buffer output buffer
+ * \param[in] size buffer size
+ * \return
+ * >=0-amount of data placed in the buffer\n
+ * <0-error code
+ */
+int bcmdb_record_read_formatted(bcmdb_set *sor, bcmdb_key key, char *buffer, int size);
+
+
+/** @} end of bcmdb_e group */
+
+
+#endif /* #ifndef BCMDB_ENGINE_H */
+
diff --git a/bal_release/src/common/db_engine/unitest.c b/bal_release/src/common/db_engine/unitest.c
new file mode 100644
index 0000000..ca638ce
--- /dev/null
+++ b/bal_release/src/common/db_engine/unitest.c
@@ -0,0 +1,490 @@
+/******************************************************************************
+ *
+ * <: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.
+ *
+ * :>
+ *
+ *****************************************************************************/
+
+/*
+ * unitest.c
+ *
+ * Created on: 2013-12-10
+ * Author: swallace
+ */
+
+#include "bcmos_system.h"
+#include "bcm_db_engine.h"
+
+/* EPON LLID data structure subset */
+typedef enum
+ {
+ /* Free entry in the LLID management table, available for assignment on an
+ MPCP register request. */
+ unassigned_llid,
+ /* Locked out waiting on a timer to release the LLID */
+ not_registered_llid,
+ /* Waiting for permission to register from host */
+ ignored_llid,
+ /* LLID has been assigned to an ONU MAC but not registered. Intermediate
+ state before the ONU returns a registration ack. */
+ wait_reg_ack_llid,
+ /* OLT link is in-service; user traffic is allowed */
+ inservice_llid,
+ wait_no_reports_llid,
+ /* The following state only applies to multicast/flood links */
+ in_service_mcast_llid,
+ /* We want a "Reserved" state for things like Optical monitoring */
+ reserved_llid,
+ /* We have detected a rogue ONU on this LLID - don't use it! */
+ quarantined_llid,
+ llid_state_count,
+ } epon_olt_llid_state;
+
+static char *get_llid_state_string(epon_olt_llid_state llid_state)
+{
+ static char *llid_state_strings[]= {
+ "unassigned",
+ "not_registered",
+ "ignored",
+ "wait_reg_ack",
+ "inservice",
+ "wait_no_reports",
+ "in_service_mcast",
+ "reserved",
+ "quarantined"
+ };
+
+ return llid_state_strings[(uint16_t)(llid_state)];
+}
+
+#define MAX_LINKS_PER_PORT 512
+#define MAX_PORTS_PER_HALF_CHIP 8
+#define MAX_LINKS_PER_HALF_CHIP ((MAX_LINKS_PER_PORT)*(MAX_PORTS_PER_HALF_CHIP))
+
+typedef uint8_t core_epon;
+typedef uint16_t hw_link_index;
+
+typedef struct epon_db_olt_llid_rec
+ {
+ epon_olt_llid_state state;
+ core_epon epon;
+ hw_link_index index;
+ } epon_db_olt_llid_rec;
+
+
+typedef struct epon_msg_olt_llid_rec
+{
+ uint16_t index;
+ epon_db_olt_llid_rec llid_rec;
+} epon_msg_olt_llid_rec;
+
+typedef enum
+ {
+ enabled,
+ disabled,
+ } epon_olt_port_state;
+
+static char *get_port_state_string(epon_olt_port_state port_state)
+{
+ static char *port_state_strings[]= {
+ "enabled",
+ "disabled",
+ };
+
+ return port_state_strings[(uint16_t)(port_state)];
+}
+
+
+typedef struct epon_db_olt_port_rec
+ {
+ epon_olt_port_state state;
+ } epon_db_olt_port_rec;
+
+typedef struct epon_msg_olt_port_rec
+{
+ uint16_t index;
+ epon_db_olt_port_rec port_rec;
+} epon_msg_olt_port_rec;
+
+typedef enum
+{
+ epon_olt_link_record,
+ epon_olt_port_record,
+ num_db_tables,
+} db_tables;
+
+
+/* Master database handle */
+static bcmdb_set *db_sos_set;
+
+static bcmdb_set* epon_get_db_handle(void)
+{
+ return db_sos_set;
+}
+
+#define LINK_REC_DB() bcmdb_set *db_set = bcmdb_set_handle(epon_get_db_handle(), epon_olt_link_record)
+
+#define PORT_REC_DB bcmdb_set *db_set = bcmdb_set_handle(epon_get_db_handle(), epon_olt_port_record)
+
+/* Database test messages - */
+typedef enum
+ {
+ update_link_db = 20,
+ update_port_db = 21,
+ dump_db = 30,
+ } dbtest_msgid;
+
+static inline const epon_db_olt_llid_rec *epon_olt_get_llid_rec_read(uint16_t index)
+ {
+ LINK_REC_DB();
+ return bcmdb_record_get_read(db_set, index, epon_db_olt_llid_rec);
+ };
+
+static inline void epon_db_olt_unlock_llid_rec(uint16_t index)
+ {
+ LINK_REC_DB();
+ bcmdb_record_unlock_read(db_set, index);
+ }
+
+
+#define OltGetLlidRecWrite(index) \
+ ({ \
+ LINK_REC_DB(); \
+ bcmdb_record_get_write(db_set, index, epon_db_olt_llid_rec);\
+ })
+
+#define OltCommitLlidRec(index) \
+ ({ \
+ LINK_REC_DB(); \
+ bcmdb_record_unlock_write(db_set, BCMOS_FALSE);\
+ })
+
+
+static void ut_dump_db(void)
+{
+ uint16_t index;
+ bcmdb_set *db_set;
+
+ db_set = bcmdb_set_handle(epon_get_db_handle(), epon_olt_port_record);
+ for (index = 0; index < MAX_PORTS_PER_HALF_CHIP; index++)
+ {
+ const epon_db_olt_port_rec *port_rec;
+ port_rec = bcmdb_record_get_read(db_set, index, epon_db_olt_port_rec);
+ BCMOS_TRACE(BCMOS_TRACE_LEVEL_INFO,
+ "Record %d, state %s\n", index,
+ get_port_state_string(port_rec->state));
+ bcmdb_record_unlock_read(db_set, index);
+ }
+
+ for (index = 0; index < MAX_LINKS_PER_HALF_CHIP; index++)
+ {
+ const epon_db_olt_llid_rec *llid_rec;
+ llid_rec = epon_olt_get_llid_rec_read(index);
+ if (llid_rec->state != unassigned_llid)
+ {
+ BCMOS_TRACE(BCMOS_TRACE_LEVEL_INFO,
+ "Record %d, port %d, state %s\n", llid_rec->index,
+ llid_rec->epon, get_llid_state_string(llid_rec->state));
+ }
+ epon_db_olt_unlock_llid_rec(index);
+ }
+
+
+}
+
+static void ut_update_link_db(epon_msg_olt_llid_rec *rec)
+{
+ epon_db_olt_llid_rec *llid_rec;
+ llid_rec=OltGetLlidRecWrite(rec->index);
+ llid_rec->state=rec->llid_rec.state;
+
+ OltCommitLlidRec(index);
+}
+
+static void ut_update_port_db(epon_msg_olt_port_rec *rec)
+{
+ bcmdb_set *db_set;
+ epon_db_olt_port_rec *port_rec;
+
+ db_set = bcmdb_set_handle(epon_get_db_handle(), epon_olt_port_record);
+ port_rec = bcmdb_record_get_write(db_set, rec->index, epon_db_olt_port_rec);
+
+ port_rec->state=rec->port_rec.state;
+
+ bcmdb_record_unlock_write(db_set, BCMOS_FALSE);
+}
+
+
+static void ut_msg_handler(dbtest_msgid id, void *data)
+ {
+ switch (id)
+ {
+ case update_link_db:
+ ut_update_link_db((epon_msg_olt_llid_rec*)data);
+ break;
+
+ case update_port_db:
+ ut_update_port_db((epon_msg_olt_port_rec*)data);
+ break;
+
+ case dump_db:
+ ut_dump_db();
+ break;
+
+ default:
+ break;
+ }
+
+ }
+
+/* Database engine unit test functions */
+static uint16_t epon_db_data_init(void)
+ {
+ uint16_t index;
+ bcmdb_set *db_set;
+ int rc = 0;
+
+ db_set = bcmdb_set_handle(epon_get_db_handle(), epon_olt_link_record);
+ for ( index = 0;
+ (index < MAX_LINKS_PER_HALF_CHIP) && (rc >= 0) && (db_set != NULL) ;
+ index++)
+ {
+ epon_db_olt_llid_rec llid_rec;
+
+ llid_rec.state = unassigned_llid;
+ llid_rec.epon = index/MAX_LINKS_PER_PORT;
+ llid_rec.index = index;
+ rc = bcmdb_record_add(db_set, index, (void *)&llid_rec);
+ }
+
+ db_set = bcmdb_set_handle(epon_get_db_handle(), epon_olt_port_record);
+ for ( index = 0;
+ (index < MAX_PORTS_PER_HALF_CHIP) && (rc >= 0) && (db_set != NULL) ;
+ index++)
+ {
+ epon_db_olt_port_rec port_rec;
+ port_rec.state = disabled;
+ rc = bcmdb_record_add(db_set, index, (void *)&port_rec);
+ }
+ return rc;
+ }
+
+static int epon_db_instance_init(void)
+ {
+ bcmdb_sos_init db_sos_inst;
+ bcmdb_sor_init db_sor_inst;
+ const char* db_name = "EPON STACK";
+ const char* db_llid_name = "EPON LINK REC";
+ const char* db_eport_name = "EPON PORT REC";
+ bcmdb_set *db_sor_set;
+ int rc;
+
+ db_sos_inst.name = db_name;
+ db_sos_inst.backend_type = BCMDB_BACKEND_ARRAY;
+ db_sos_inst.max_entries = num_db_tables;
+ rc = bcmdb_make_set_of_sets(&db_sos_inst, &db_sos_set);
+
+ if (rc >= 0)
+ {
+ db_sor_inst.name = db_llid_name;
+ db_sor_inst.backend_type = BCMDB_BACKEND_ARRAY;
+ db_sor_inst.lock_policy = BCMDB_LOCK_NB_READ_SHADOW_WRITE;
+ db_sor_inst.max_entries = MAX_LINKS_PER_HALF_CHIP;
+ db_sor_inst.record_size = sizeof(epon_db_olt_llid_rec);
+ db_sor_inst.format = NULL;
+ bcmdb_make_set_of_records(&db_sor_inst, BCMOS_TRUE, &db_sor_set);
+
+ rc = bcmdb_set_add(epon_get_db_handle(),
+ epon_olt_link_record, db_sor_set);
+ }
+ if (rc >= 0)
+ {
+ db_sor_inst.name = db_eport_name;
+ db_sor_inst.backend_type = BCMDB_BACKEND_ARRAY;
+ db_sor_inst.lock_policy = BCMDB_LOCK_NB_READ_SHADOW_WRITE;
+ db_sor_inst.max_entries = MAX_PORTS_PER_HALF_CHIP;
+ db_sor_inst.record_size = sizeof(epon_db_olt_port_rec);
+ db_sor_inst.format = NULL;
+ rc = bcmdb_make_set_of_records(&db_sor_inst, BCMOS_TRUE, &db_sor_set);
+ }
+
+ rc = bcmdb_set_add(epon_get_db_handle(), epon_olt_port_record, db_sor_set);
+
+ BCMOS_TRACE(BCMOS_TRACE_LEVEL_INFO, "database creation returnd %d\n", rc);
+
+ if (rc >= 0)
+ {
+ rc = epon_db_data_init();
+ }
+ return rc;
+ }
+
+/* Thread handlers - so that the DB accesses can be tested across multiple
+ threads. */
+static int task1_handler(long data)
+{
+ bcmos_msg_queue *q = (bcmos_msg_queue *)data;
+ bcmos_msg *msg;
+
+ BCMOS_TRACE(BCMOS_TRACE_LEVEL_INFO, "traditional task handler\n");
+
+ while (1)
+ {
+ BCMOS_TRACE(BCMOS_TRACE_LEVEL_INFO, "Waiting for message\n");
+
+ bcmos_msg_recv(q, BCMOS_WAIT_FOREVER, &msg);
+ BCMOS_TRACE(BCMOS_TRACE_LEVEL_INFO,
+ "Received message ID %d, data %p\n",
+ msg->type, msg->data);
+
+ ut_msg_handler(msg->type, msg->data);
+ bcmos_usleep(100000);
+ }
+
+ return 0;
+}
+
+
+static bcmos_errno mod1_init(long data)
+{
+ BCMOS_TRACE(BCMOS_TRACE_LEVEL_INFO, "%ld\n", data);
+ return BCM_ERR_OK;
+}
+
+static void mod_msg_handler(bcmos_module_id module_id, bcmos_msg *msg)
+{
+ BCMOS_TRACE(BCMOS_TRACE_LEVEL_INFO, "module %d msg %d data %p\n",
+ module_id, msg->type, msg->data);
+
+ ut_msg_handler(msg->type, msg->data);
+}
+
+
+
+/* Unit test function - */
+int main(int argc, char *argv[])
+{
+ bcmos_task_parm tp = {};
+ bcmos_msg_queue_parm qp = {};
+ bcmos_module_parm mp = {};
+ bcmos_msg msg1 = {};
+ bcmos_msg msg2 = {};
+
+ bcmos_task t1;
+ bcmos_task t2;
+ bcmos_msg_queue q1;
+ bcmos_errno rc;
+ epon_msg_olt_llid_rec link_rec1, link_rec2;
+ epon_msg_olt_port_rec port_msg1, port_msg2;
+
+ bcmos_init();
+ bcmos_trace_level_set(BCMOS_TRACE_LEVEL_DEBUG);
+
+ if (epon_db_instance_init() < 0)
+ {
+ BCMOS_TRACE(BCMOS_TRACE_LEVEL_ERROR,
+ "Could not instantiate a Database\n");
+ return BCM_ERR_NOMEM;
+ }
+
+ BCMOS_TRACE(BCMOS_TRACE_LEVEL_INFO, "Database set %p\n",
+ bcmdb_set_handle(db_sos_set, epon_olt_link_record));
+
+ /* Create message queue */
+ qp.name = "msg queue1";
+ qp.size = 16;
+ qp.high_wm = 14;
+ qp.low_wm = 12;
+ rc = bcmos_msg_queue_create(&q1, &qp);
+
+ /* Create a couple of threads */
+ tp.name = "task1";
+ tp.handler = task1_handler;
+ tp.data = (long)&q1;
+ rc = bcmos_task_create(&t1, &tp);
+
+ tp.name = "task2";
+ tp.handler = NULL;
+ tp.data = 0;
+ rc = bcmos_task_create(&t2, &tp);
+
+ /* Register a module */
+ mp.qparm.name = "module1";
+ mp.qparm.size = 16;
+ mp.init = mod1_init;
+ bcmos_module_create(BCMOS_MODULE_ID_TEST1, &t2, &mp);
+
+ /* Wait some */
+ bcmos_usleep(2000000);
+
+ /* Send a message to update the DB - enable a port*/
+ port_msg1.index=5;
+ port_msg1.port_rec.state=enabled;
+ msg1.type = update_port_db;
+ msg1.data = &port_msg1;
+ bcmos_msg_send(&q1, &msg1, BCMOS_MSG_SEND_NO_FREE_ON_ERROR);
+
+ /* Send a message to update the DB - enable a port*/
+ port_msg2.index=3;
+ port_msg2.port_rec.state=enabled;
+ msg2.type = update_port_db;
+ msg2.data = &port_msg2;
+ bcmos_msg_send(&q1, &msg2, BCMOS_MSG_SEND_NO_FREE_ON_ERROR);
+
+ /* Wait some */
+ bcmos_usleep(2000000);
+
+ /* Send a message to update the DB - put a link In Service*/
+ link_rec1.index=14;
+ link_rec1.llid_rec.state=inservice_llid;
+ msg1.type = update_link_db;
+ msg1.data = &link_rec1;
+ bcmos_msg_send(&q1, &msg1, BCMOS_MSG_SEND_NO_FREE_ON_ERROR);
+
+ /* Send a message to update the DB - quarantine a link */
+ link_rec2.index=22;
+ link_rec2.llid_rec.state=quarantined_llid;
+ msg2.type = update_link_db;
+ msg2.data = &link_rec2;
+ msg2.handler = mod_msg_handler;
+ bcmos_msg_send_to_module(BCMOS_MODULE_ID_TEST1, &msg2, BCMOS_MSG_SEND_NO_FREE_ON_ERROR);
+
+ /* Wait some */
+ bcmos_usleep(2000000);
+
+ /* Send a message to dump the DB */
+ msg1.type = dump_db;
+ msg1.handler = mod_msg_handler;
+ msg1.data = NULL;
+ bcmos_msg_send_to_module(BCMOS_MODULE_ID_TEST1, &msg1, BCMOS_MSG_SEND_NO_FREE_ON_ERROR);
+
+
+ /* Wait some */
+ bcmos_usleep(2000000);
+
+ return rc;
+}
diff --git a/bal_release/src/common/debug/ipc_ping/Makefile b/bal_release/src/common/debug/ipc_ping/Makefile
new file mode 100644
index 0000000..07c2b85
--- /dev/null
+++ b/bal_release/src/common/debug/ipc_ping/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.
+#
+# :>
+#
+###############################################################################
+# IPC ping debug utility
+#
+MOD_NAME = ipc_ping
+MOD_TYPE = lib
+MOD_DEPS = cli
+srcs = bal_ipc_ping.c
diff --git a/bal_release/src/common/dev_log b/bal_release/src/common/dev_log
new file mode 120000
index 0000000..0c2e71e
--- /dev/null
+++ b/bal_release/src/common/dev_log
@@ -0,0 +1 @@
+../../3rdparty/maple/sdk/host_reference/dev_log
\ No newline at end of file
diff --git a/bal_release/src/common/include/Makefile b/bal_release/src/common/include/Makefile
new file mode 100644
index 0000000..46650aa
--- /dev/null
+++ b/bal_release/src/common/include/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.
+#
+# :>
+#
+###############################################################################
+###############################################################################
+# Common headers
+#
+MOD_NAME = common_include
+MOD_TYPE = lib
+MOD_DEPS =
+gen_bal_hdrs = bal_model_ids.h bal_model_types.h
+
diff --git a/bal_release/src/common/include/bal_buf.h b/bal_release/src/common/include/bal_buf.h
new file mode 100644
index 0000000..c5e06f7
--- /dev/null
+++ b/bal_release/src/common/include/bal_buf.h
@@ -0,0 +1,43 @@
+#ifndef BAL_BUF
+#define BAL_BUF
+
+#include "bcmolt_buf.h"
+
+typedef bcmolt_buf bcmbal_buf;
+
+#define bcmbal_buf_init(buf, size, start) bcmolt_buf_init(buf, size, start, BCMOLT_BUF_ENDIAN_FIXED)
+#define bcmbal_buf_alloc(buf, size) bcmolt_buf_alloc(buf, size, BCMOLT_BUF_ENDIAN_FIXED)
+#define bcmbal_buf_free bcmolt_buf_free
+#define bcmbal_buf_skip bcmolt_buf_skip
+#define bcmbal_buf_set_pos bcmolt_buf_set_pos
+#define bcmbal_buf_get_used bcmolt_buf_get_used
+#define bcmbal_buf_get_remaining_size bcmolt_buf_get_remaining_size
+#define bcmbal_buf_write bcmolt_buf_write
+#define bcmbal_buf_read bcmolt_buf_read
+#define bcmbal_buf_rewind bcmolt_buf_rewind
+#define bcmbal_buf_write_u8 bcmolt_buf_write_u8
+#define bcmbal_buf_read_u8 bcmolt_buf_read_u8
+#define bcmbal_buf_write_u16 bcmolt_buf_write_u16
+#define bcmbal_buf_read_u16 bcmolt_buf_read_u16
+#define bcmbal_buf_write_s16 bcmolt_buf_write_s16
+#define bcmbal_buf_read_s16 bcmolt_buf_read_s16
+#define bcmbal_buf_write_u24 bcmolt_buf_write_u24
+#define bcmbal_buf_read_u24 bcmolt_buf_read_u24
+#define bcmbal_buf_write_u32 bcmolt_buf_write_u32
+#define bcmbal_buf_read_u32 bcmolt_buf_read_u32
+#define bcmbal_buf_write_s32 bcmolt_buf_write_s32
+#define bcmbal_buf_read_s32 bcmolt_buf_read_s32
+#define bcmbal_buf_write_u64 bcmolt_buf_write_u64
+#define bcmbal_buf_read_u64 bcmolt_buf_read_u64
+#define bcmbal_buf_write_bool bcmolt_buf_write_bool
+#define bcmbal_buf_read_bool bcmolt_buf_read_bool
+#define bcmbal_buf_write_mac_address bcmolt_buf_write_mac_address
+#define bcmbal_buf_read_mac_address bcmolt_buf_read_mac_address
+#define bcmbal_buf_write_ipv4_address bcmolt_buf_write_ipv4_address
+#define bcmbal_buf_read_ipv4_address bcmolt_buf_read_ipv4_address
+#define bcmbal_buf_write_ipv6_address bcmolt_buf_write_ipv6_address
+#define bcmbal_buf_read_ipv6_address bcmolt_buf_read_ipv6_address
+#define bcmbal_buf_write_vlan_tag bcmolt_buf_write_vlan_tag
+#define bcmbal_buf_read_vlan_tag bcmolt_buf_read_vlan_tag
+
+#endif /* BAL_BUF */
diff --git a/bal_release/src/common/include/bal_common.h b/bal_release/src/common/include/bal_common.h
new file mode 100644
index 0000000..c5a2558
--- /dev/null
+++ b/bal_release/src/common/include/bal_common.h
@@ -0,0 +1,317 @@
+/******************************************************************************
+ *
+ * <: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_common.h
+ *
+ * @brief Common include files and miscellaneous macros for the BAL source code.
+ *
+ */
+
+#ifndef BALCOMMON_H
+#define BALCOMMON_H
+
+/*@{*/
+
+/* --- system includes ---*/
+#include <bcmos_system.h>
+
+/* --- project includes ---*/
+
+/**
+ * @brief OUI Identifier
+ *
+ */
+typedef uint8_t oui_val_t[3];
+
+/*
+ * A max/min function
+ */
+#define max(a,b) ((a > b) ? a : b)
+#define min(a,b) ((a > b) ? b : a)
+
+/**
+ * @brief Maximum value for a VLAN ID
+ */
+#define MAX_VLAN_ID 4094
+
+/**
+ * @brief Minimum value for an 802.1ah I-SID
+ *
+ * Notes from IEEE:
+ * 0 - Reserved for use by future amendments to the standard.
+ * 1 - Default value, unassigned ISID.
+ * 2..FF - Reserved for use by future amendments to the standard.
+ */
+#define MIN_8021AH_ISID 0x00000100
+
+/**
+ * @brief Maximum value for an 802.1ah I-SID
+ *
+ * Notes from IEEE:
+ * FFFFFF is reserved by IEEE
+ */
+#define MAX_8021AH_ISID 0x00FFFFFE
+
+/**
+ * @brief VLAN TPID definitions
+ */
+typedef enum vlan_tpid_type
+{
+ VLAN_TPID_TYPE_DEFAULT = 0x0000, /**< Simple Bridge - i.e. VID 0, no tagging */
+ VLAN_TPID_TYPE_8021Q = 0x8100, /**< C-VLAN */
+ VLAN_TPID_TYPE_8021AD = 0x88A8, /**< S-VLAN */
+ VLAN_TPID_TYPE_9100 = 0x9100, /**< Legacy TPID */
+ VLAN_TPID_TYPE_9200 = 0x9200, /**< Legacy TPID */
+ VLAN_TPID_TYPE_9300 = 0x9300, /**< Legacy TPID */
+ VLAN_TPID_TYPE_8021AH_ITAG = 0x88E7 /**< 802.1ah I-Tag TPID */
+} vlan_tpid_type;
+
+/**
+ * @brief VLAN type definitions
+ */
+typedef enum vlan_mode_type
+{
+ VLAN_MODE_NONE, /**< Neither Shared or L2VPN */
+ VLAN_MODE_SHARED, /**< IP-based shared vlan */
+ VLAN_MODE_8021AD_EN, /**< DPoE 802.1ad (or .1q) encapsulation mode */
+ VLAN_MODE_8021AD_TP, /**< DPoE 802.1ad (or .1q) transport mode */
+ VLAN_MODE_8021AH_EN, /**< DPoE 802.1ah encapsulation mode */
+ VLAN_MODE_8021AH_TP, /**< DPoE 802.1ah transport mode */
+ VLAN_MODE_DAC /**< DPoE DEMARC Auto Configuration */
+} vlan_mode;
+
+/**
+ * @brief Macro to test if a VLAN is 802.1ad
+ */
+#define VLAN_IS_8021AD(_vlan_) (((_vlan_)->type == VLAN_MODE_8021AD_EN) || ((_vlan_)->type == VLAN_MODE_8021AD_TP))
+
+/**
+ * @brief Macro to test if a VLAN is 802.1ah
+ */
+#define VLAN_IS_8021AH(_vlan_) (((_vlan_)->type == VLAN_MODE_8021AH_EN) || ((_vlan_)->type == VLAN_MODE_8021AH_TP))
+
+/**
+ * @brief Macro to test if a VLAN is L2VPN (as opposed to 'None' or "Shared')
+ */
+#define VLAN_IS_L2VPN(_vlan_) (VLAN_IS_8021AD(_vlan_) || VLAN_IS_8021AH(_vlan_))
+
+/**
+ * @brief Macro to test if a VLAN is DPoE IP-HSD
+ */
+#define VLAN_IS_DPOE_IPHSD(_vlan_) (((_vlan_)->type == VlanType_None) && ((_vlan_)->dpoeIp.svid != 0) && ((_vlan_)->dpoeIp.cvid != 0))
+
+/**
+ * @brief Macro to test if a VLAN is Legacy IP-HSD
+ */
+#define VLAN_IS_LEGACY_IPHSD(_vlan_) (((_vlan_)->type == VlanType_None) && ((_vlan_)->dpoeIp.svid == 0))
+
+/**
+ * @brief Macro to test if a VLAN is DPoE IP-HSD with PON-NNI style tagging
+ */
+#define VLAN_IS_DPOE_IPHSD_PON_NNI(_vlan_) (VLAN_IS_DPOE_IPHSD(_vlan_) && ((_vlan_)->dot1ad[VLAN_TAG_OUTER].nniTpid != 0))
+
+/**
+ * @brief Macro to test if a VLAN is Shared
+ */
+#define VLAN_IS_SHARED(_vlan_) ((_vlan_)->type == VLAN_MODE_SHARED)
+
+/**
+ * @brief 802.1ad VLAN Tag index
+ *
+ * This enum is used in the VlanT structure to address the outer vs. the inner
+ * 802.1ad tag.
+ */
+typedef enum vlan_tag_index
+{
+ VLAN_TAG_INDEX_OUTER = 0, /**< Outer tag, typically the S-VLAN tag */
+ VLAN_TAG_INDEX_INNER = 1, /**< Inner tag, typically the C-VLAN tag */
+ VLAN_TAG_INDEX_MAX = 2
+} vlan_tag_index;
+
+/**
+ * @brief VlanT structure
+ */
+typedef struct bcmbal_vlan
+{
+ vlan_mode type; /**< Type of VLAN */
+
+ /** Intra-Chassis Tagging */
+ struct
+ {
+ uint16_t tpid; /**< ICT TPID */
+ uint16_t vid; /**< ICT VLAN ID */
+ } ict;
+
+ /** DPoE IP HSD Tagging */
+ struct
+ {
+ uint16_t svid; /**< S-TAG VID */
+ uint16_t cvid; /**< C-TAG VID */
+ } dpoe_ip;
+
+ /** 802.1ad (and 802.1q) tagging */
+ struct
+ {
+ uint16_t nni_tpid; /**< VLAN Tag TPID used on the NNI */
+ uint16_t uni_tpid; /**< VLAN Tag TPID used on the UNI */
+ uint8_t cos; /**< CoS bits used in this VLAN Tag */
+ uint16_t vid; /**< VLAN ID */
+ } dot_1ad[VLAN_TAG_INDEX_MAX];
+
+ /** 802.1ah encapsulation info */
+ struct
+ {
+ /** 802.1ah B-MACs */
+ bcmos_mac_address bda; /**< 802.1ah Destination B-MAC */
+ bcmos_mac_address bsa; /**< 802.1ah Source B-MAC */
+
+ /** 802.1ah B-Tag */
+ struct
+ {
+ uint16_t nni_tpid; /**< B-Tag TPID used on the NNI */
+ uint16_t uni_tpid; /**< B-Tag TPID used on the UNI */
+ uint16_t vid; /**< B-Tag VLAN ID */
+ } btag;
+
+ /** 802.1ah I-Tag */
+ struct
+ {
+ uint16_t nni_tpid; /**< I-Tag TPID used on the NNI */
+ uint16_t uni_tpid; /**< I-Tag TPID used on the UNI */
+ uint32_t isid; /**< I-Tag Service ID */
+ } itag;
+ } dot_1ah;
+
+ /** L2VPN specific VLAN configuration */
+ uint32_t vpn_idx; /**< Index of L2VPN that link is associated with. */
+} bcmbal_vlan;
+
+/**
+ * @brief MAC Address key structure.
+ *
+ * This structure effectively adds a length field to the MacAddressT structure
+ * which helps when handling GetNext requests that don't contain a full MAC
+ * Address.
+ */
+typedef struct mac_address_key
+{
+ bcmos_mac_address mac_addr; /**< The MAC address */
+ uint16_t len; /**< The length of the MAC address in the field above */
+} mac_address_key;
+
+/**
+ * @brief MAC Address length
+ */
+#define MAC_ADDRESS_LEN 6
+
+/**
+ * @brief Converts a MacAddressT structure into a MacAddressKeyT structure.
+ */
+#define MAC_ADDR_TO_KEY(A, K, L) { \
+ (K)->mac_addr = *(A); \
+ (K)->len = (L); \
+ }
+
+/**
+ * @brief Compares the 802.1ad (or q) fields of two VlanT objects
+ *
+ * This macro returns '1' if all fields match, and '0' otherwise.
+ *
+ * Note, this macro looks at the nniTpid only. This macro is used to determine
+ * whether or not an OLT Domain already exists for a given VLAN (which prevents
+ * configuring duplicate/overlapping OLT domain selectors).
+ *
+ */
+#define VLANS_MATCH_AD(_vlan1_, _vlan2_) (((_vlan1_)->dot1ad[VLAN_TAG_OUTER].vid == (_vlan2_)->dot1ad[VLAN_TAG_OUTER].vid) && \
+ ((_vlan1_)->dot1ad[VLAN_TAG_OUTER].nniTpid == (_vlan2_)->dot1ad[VLAN_TAG_OUTER].nniTpid) && \
+ ((_vlan1_)->dot1ad[VLAN_TAG_INNER].vid == (_vlan2_)->dot1ad[VLAN_TAG_INNER].vid) && \
+ ((_vlan1_)->dot1ad[VLAN_TAG_INNER].nniTpid == (_vlan2_)->dot1ad[VLAN_TAG_INNER].nniTpid))
+
+/**
+ * @brief Compares the 802.1ah (mac-in-mac) fields of two VlanT objects
+ *
+ * This macro returns '1' if all fields match, and '0' otherwise.
+ *
+ * Note, this macro looks at the nniTpid's only. This macro is used to
+ * determine whether or not an OLT Domain already exists for a given VLAN
+ * (which prevents configuring duplicate/overlapping OLT domain selectors).
+ *
+ */
+#define VLANS_MATCH_AH(_vlan1_, _vlan2_) (((_vlan1_)->dot1ah.btag.nniTpid == (_vlan2_)->dot1ah.btag.nniTpid) && \
+ ((_vlan1_)->dot1ah.btag.vid == (_vlan2_)->dot1ah.btag.vid) && \
+ ((_vlan1_)->dot1ah.itag.nniTpid == (_vlan2_)->dot1ah.itag.nniTpid) && \
+ ((_vlan1_)->dot1ah.itag.isid == (_vlan2_)->dot1ah.itag.isid))
+
+/**
+ * @brief Compares the ICT fields of two VlanT objects
+ *
+ * This macro returns '1' if all fields match, and '0' otherwise.
+ *
+ * Note, this macro looks at the ICT fields only. This macro is
+ * used to determine whether or not an OLT Domain already
+ * exists for a given VLAN (which prevents configuring
+ * duplicate/overlapping OLT domain selectors).
+ *
+ */
+#define VLANS_MATCH_ICT(_vlan1_, _vlan2_) (((_vlan1_)->ict.tpid == (_vlan2_)->ict.tpid) && \
+ ((_vlan1_)->ict.vid == (_vlan2_)->ict.vid))
+/**
+ * @brief Compares the 802.1ad (or q) and 802.1ah (mac-in-mac)
+ * fields of two VlanT objects
+ *
+ * This macro returns '1' if all fields match, and '0' otherwise.
+ *
+ */
+#define VLANS_MATCH(_vlan1_, _vlan2_) (VLANS_MATCH_AD(_vlan1_, _vlan2_) && VLANS_MATCH_AH(_vlan1_, _vlan2_))
+
+/**
+ * @brief Macros for setting/clearing bits inside of an integer
+ */
+#define SET_BIT(x,n) ((x) |= (1L << (n)))
+#define CLR_BIT(x,n) ((x) &= (~(1L << (n))))
+#define BIT_IS_SET(x,n) (((x) >> (n)) & 1)
+
+
+
+/**
+ * Static compile time assert used to ensure that enums and associated
+ * character arrays are equal.
+ *
+ * Use the BAL_STATIC_ASSERT function in your code to check array sizes
+ */
+#define _BAL_STATIC_ASSERT_HELPER(expr, msg) (sizeof (struct {unsigned int STATIC_ASSERT__##msg: (expr) ? 1 : -1;} ))
+
+#define BAL_STATIC_ASSERT(expr, msg) extern int (*assert_function__##msg(void)) [_BAL_STATIC_ASSERT_HELPER(expr, msg) ]
+
+/*@}*/
+
+#endif /* #ifndef BALCOMMON_H */
diff --git a/bal_release/src/common/include/bal_ids.h b/bal_release/src/common/include/bal_ids.h
new file mode 100644
index 0000000..e4239e6
--- /dev/null
+++ b/bal_release/src/common/include/bal_ids.h
@@ -0,0 +1,46 @@
+/******************************************************************************
+ *
+ * <: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_ids.h
+ * @brief BAL IDs used in the system
+ *
+ * This file contains all of the BAL IDs used in the system
+ *
+ */
+#ifndef BALIDS_H
+#define BALIDS_H
+
+/*@{*/
+
+/*@}*/
+
+#endif /* #ifndef BALIDS_H */
diff --git a/bal_release/src/common/include/bal_model_ids.h b/bal_release/src/common/include/bal_model_ids.h
new file mode 100644
index 0000000..218b74e
--- /dev/null
+++ b/bal_release/src/common/include/bal_model_ids.h
@@ -0,0 +1,714 @@
+#ifndef BAL_MODEL_IDS_H_
+#define BAL_MODEL_IDS_H_
+
+/** \ingroup object_model_data_types
+ * \defgroup object_model_enums BAL Object Model Enumerations
+ */
+
+/** \addtogroup object_model_enums
+ * @{
+ */
+#include <bcmos_system.h>
+
+/** Identifiers for all properties contained in the access_terminal_cfg group.
+ */
+typedef enum bcmbal_access_terminal_cfg_id
+{
+ BCMBAL_ACCESS_TERMINAL_CFG_ID_ADMIN_STATE = 0, /**< Administrative state. */
+ BCMBAL_ACCESS_TERMINAL_CFG_ID_OPER_STATUS = 1, /**< Operational status. */
+ BCMBAL_ACCESS_TERMINAL_CFG_ID_IWF_MODE = 2, /**< Interworking function mode. */
+ BCMBAL_ACCESS_TERMINAL_CFG_ID__NUM_OF /**< Number of enum entries, not an entry itself. */
+} bcmbal_access_terminal_cfg_id;
+
+/** Identifiers for all properties contained in the access_terminal_ind group.
+ */
+typedef enum bcmbal_access_terminal_ind_id
+{
+ BCMBAL_ACCESS_TERMINAL_IND_ID_ADMIN_STATE = 0, /**< Administrative state. */
+ BCMBAL_ACCESS_TERMINAL_IND_ID_OPER_STATUS = 1, /**< Operational status. */
+ BCMBAL_ACCESS_TERMINAL_IND_ID_IWF_MODE = 2, /**< Interworking function mode. */
+ BCMBAL_ACCESS_TERMINAL_IND_ID__NUM_OF /**< Number of enum entries, not an entry itself. */
+} bcmbal_access_terminal_ind_id;
+
+/** Identifiers for all properties contained in the access_terminal_key group.
+ */
+typedef enum bcmbal_access_terminal_key_id
+{
+ BCMBAL_ACCESS_TERMINAL_KEY_ID_ACCESS_TERM_ID= 0, /**< access_term_id. */
+ BCMBAL_ACCESS_TERMINAL_KEY_ID__NUM_OF /**< Number of enum entries, not an entry itself. */
+} bcmbal_access_terminal_key_id;
+
+/** Identifiers for all properties contained in the flow_cfg group.
+ */
+typedef enum bcmbal_flow_cfg_id
+{
+ BCMBAL_FLOW_CFG_ID_ADMIN_STATE = 0, /**< Administrative state. */
+ BCMBAL_FLOW_CFG_ID_OPER_STATUS = 1, /**< Operational status. */
+ BCMBAL_FLOW_CFG_ID_ACCESS_INT_ID = 2, /**< Access Interface ID. */
+ BCMBAL_FLOW_CFG_ID_NETWORK_INT_ID = 3, /**< Network Interface ID. */
+ BCMBAL_FLOW_CFG_ID_SUB_TERM_ID = 4, /**< Subscriber Terminal ID. */
+ BCMBAL_FLOW_CFG_ID_SUB_TERM_UNI_IDX = 5, /**< Subscriber Terminal uni port index. */
+ BCMBAL_FLOW_CFG_ID_SVC_PORT_ID = 6, /**< Service Port ID. */
+ BCMBAL_FLOW_CFG_ID_AGG_PORT_ID = 7, /**< Aggregate port ID. */
+ BCMBAL_FLOW_CFG_ID_RESOLVE_MAC = 8, /**< Resolve mac. */
+ BCMBAL_FLOW_CFG_ID_CLASSIFIER = 9, /**< Classifier. */
+ BCMBAL_FLOW_CFG_ID_ACTION = 10, /**< Action. */
+ BCMBAL_FLOW_CFG_ID_SLA = 11, /**< SLA. */
+ BCMBAL_FLOW_CFG_ID_COOKIE = 12, /**< Cookie. */
+ BCMBAL_FLOW_CFG_ID_PRIORITY = 13, /**< Priority. */
+ BCMBAL_FLOW_CFG_ID_GROUP_ID = 14, /**< Group ID. */
+ BCMBAL_FLOW_CFG_ID_QUEUE = 15, /**< Egress queue. */
+ BCMBAL_FLOW_CFG_ID__NUM_OF /**< Number of enum entries, not an entry itself. */
+} bcmbal_flow_cfg_id;
+
+/** Identifiers for all properties contained in the flow_ind group.
+ */
+typedef enum bcmbal_flow_ind_id
+{
+ BCMBAL_FLOW_IND_ID_ADMIN_STATE = 0, /**< Administrative state. */
+ BCMBAL_FLOW_IND_ID_OPER_STATUS = 1, /**< Operational status. */
+ BCMBAL_FLOW_IND_ID_ACCESS_INT_ID = 2, /**< Access interface ID. */
+ BCMBAL_FLOW_IND_ID_NETWORK_INT_ID = 3, /**< Network Interface ID. */
+ BCMBAL_FLOW_IND_ID_SUB_TERM_ID = 4, /**< Subscriber terminal ID. */
+ BCMBAL_FLOW_IND_ID_SVC_PORT_ID = 5, /**< Service port ID. */
+ BCMBAL_FLOW_IND_ID_AGG_PORT_ID = 6, /**< Aggregate port ID. */
+ BCMBAL_FLOW_IND_ID_RESOLVE_MAC = 7, /**< Resolve mac. */
+ BCMBAL_FLOW_IND_ID_BASE_TC_ID = 8, /**< Base TCONT ID. */
+ BCMBAL_FLOW_IND_ID_CLASSIFIER = 9, /**< Classifier. */
+ BCMBAL_FLOW_IND_ID_ACTION = 10, /**< Action. */
+ BCMBAL_FLOW_IND_ID_SLA = 11, /**< SLA. */
+ BCMBAL_FLOW_IND_ID_COOKIE = 12, /**< Cookie. */
+ BCMBAL_FLOW_IND_ID_PRIORITY = 13, /**< Priority. */
+ BCMBAL_FLOW_IND_ID__NUM_OF /**< Number of enum entries, not an entry itself. */
+} bcmbal_flow_ind_id;
+
+/** Identifiers for all properties contained in the flow_key group.
+ */
+typedef enum bcmbal_flow_key_id
+{
+ BCMBAL_FLOW_KEY_ID_FLOW_ID = 0, /**< Flow ID. */
+ BCMBAL_FLOW_KEY_ID_FLOW_TYPE = 1, /**< Flow type. */
+ BCMBAL_FLOW_KEY_ID__NUM_OF /**< Number of enum entries, not an entry itself. */
+} bcmbal_flow_key_id;
+
+/** Identifiers for all properties contained in the flow_stat group.
+ */
+typedef enum bcmbal_flow_stat_id
+{
+ BCMBAL_FLOW_STAT_ID_RX_PACKETS = 0, /**< Received packets. */
+ BCMBAL_FLOW_STAT_ID_RX_BYTES = 1, /**< Received bytes. */
+ BCMBAL_FLOW_STAT_ID_TX_PACKETS = 2, /**< Transmitted packets. */
+ BCMBAL_FLOW_STAT_ID_TX_BYTES = 3, /**< Transmitted bytes. */
+ BCMBAL_FLOW_STAT_ID__NUM_OF /**< Number of enum entries, not an entry itself. */
+} bcmbal_flow_stat_id;
+
+/** Identifiers for all properties contained in the group_cfg group.
+ */
+typedef enum bcmbal_group_cfg_id
+{
+ BCMBAL_GROUP_CFG_ID_MEMBERS_CMD = 0, /**< Membership operation commands. */
+ BCMBAL_GROUP_CFG_ID_MEMBERS = 1, /**< Member. */
+ BCMBAL_GROUP_CFG_ID_COOKIE = 2, /**< Application cookie. */
+ BCMBAL_GROUP_CFG_ID_FLOWS = 3, /**< List of flows associated with the group . */
+ BCMBAL_GROUP_CFG_ID_OWNER = 4, /**< Owner of the group. */
+ BCMBAL_GROUP_CFG_ID__NUM_OF /**< Number of enum entries, not an entry itself. */
+} bcmbal_group_cfg_id;
+
+/** Identifiers for all properties contained in the group_key group.
+ */
+typedef enum bcmbal_group_key_id
+{
+ BCMBAL_GROUP_KEY_ID_GROUP_ID = 0, /**< Group ID. */
+ BCMBAL_GROUP_KEY_ID__NUM_OF /**< Number of enum entries, not an entry itself. */
+} bcmbal_group_key_id;
+
+/** Identifiers for all properties contained in the interface_cfg group.
+ */
+typedef enum bcmbal_interface_cfg_id
+{
+ BCMBAL_INTERFACE_CFG_ID_ADMIN_STATE = 0, /**< Administrative state. */
+ BCMBAL_INTERFACE_CFG_ID_OPER_STATUS = 1, /**< Operational status. */
+ BCMBAL_INTERFACE_CFG_ID_MIN_DATA_AGG_PORT_ID= 2, /**< Minimum aggregate port ID. */
+ BCMBAL_INTERFACE_CFG_ID_MIN_DATA_SVC_PORT_ID= 3, /**< Minimum service port ID. */
+ BCMBAL_INTERFACE_CFG_ID_TRANSCEIVER_TYPE = 4, /**< Transceiver type. */
+ BCMBAL_INTERFACE_CFG_ID_DS_MISS_MODE = 5, /**< Downstream unknown packet action. */
+ BCMBAL_INTERFACE_CFG_ID_MTU = 6, /**< MTU. */
+ BCMBAL_INTERFACE_CFG_ID_FLOW_CONTROL = 7, /**< Flow control. */
+ BCMBAL_INTERFACE_CFG_ID_DS_TM = 8, /**< Downstream scheduler and shaper. */
+ BCMBAL_INTERFACE_CFG_ID_US_TM = 9, /**< Upstream scheduler and shaper. */
+ BCMBAL_INTERFACE_CFG_ID_SUB_TERM_ID_LIST = 10, /**< Sub-term id list. */
+ BCMBAL_INTERFACE_CFG_ID__NUM_OF /**< Number of enum entries, not an entry itself. */
+} bcmbal_interface_cfg_id;
+
+/** Identifiers for all properties contained in the interface_ind group.
+ */
+typedef enum bcmbal_interface_ind_id
+{
+ BCMBAL_INTERFACE_IND_ID_ADMIN_STATE = 0, /**< Administrative state. */
+ BCMBAL_INTERFACE_IND_ID_OPER_STATUS = 1, /**< Operational status. */
+ BCMBAL_INTERFACE_IND_ID_MIN_DATA_AGG_PORT_ID= 2, /**< Minimum aggregate port ID. */
+ BCMBAL_INTERFACE_IND_ID_MIN_DATA_SVC_PORT_ID= 3, /**< Minimum service port ID. */
+ BCMBAL_INTERFACE_IND_ID_TRANSCEIVER_TYPE = 4, /**< Transceiver type. */
+ BCMBAL_INTERFACE_IND_ID_DS_MISS_MODE = 5, /**< Downstream unknown packet action. */
+ BCMBAL_INTERFACE_IND_ID_MTU = 6, /**< MTU. */
+ BCMBAL_INTERFACE_IND_ID_FLOW_CONTROL = 7, /**< Flow control. */
+ BCMBAL_INTERFACE_IND_ID_DS_TM = 8, /**< Downstream scheduler and shaper. */
+ BCMBAL_INTERFACE_IND_ID_US_TM = 9, /**< Upstream scheduler and shaper. */
+ BCMBAL_INTERFACE_IND_ID__NUM_OF /**< Number of enum entries, not an entry itself. */
+} bcmbal_interface_ind_id;
+
+/** Identifiers for all properties contained in the interface_key group.
+ */
+typedef enum bcmbal_interface_key_id
+{
+ BCMBAL_INTERFACE_KEY_ID_INTF_ID = 0, /**< intf_id. */
+ BCMBAL_INTERFACE_KEY_ID_INTF_TYPE = 1, /**< intf_type. */
+ BCMBAL_INTERFACE_KEY_ID__NUM_OF /**< Number of enum entries, not an entry itself. */
+} bcmbal_interface_key_id;
+
+/** Identifiers for all properties contained in the interface_stat group.
+ */
+typedef enum bcmbal_interface_stat_id
+{
+ BCMBAL_INTERFACE_STAT_ID_RX_PACKETS = 0, /**< Recieved packets. */
+ BCMBAL_INTERFACE_STAT_ID_RX_BYTES = 1, /**< Received bytes. */
+ BCMBAL_INTERFACE_STAT_ID_TX_PACKETS = 2, /**< Transmitted packets. */
+ BCMBAL_INTERFACE_STAT_ID_TX_BYTES = 3, /**< Transmitted bytes. */
+ BCMBAL_INTERFACE_STAT_ID__NUM_OF /**< Number of enum entries, not an entry itself. */
+} bcmbal_interface_stat_id;
+
+/** Identifiers for all properties contained in the packet_cfg group.
+ */
+typedef enum bcmbal_packet_cfg_id
+{
+ BCMBAL_PACKET_CFG_ID_FLOW_ID = 0, /**< Flow Id. */
+ BCMBAL_PACKET_CFG_ID_FLOW_TYPE = 1, /**< Flow Type. */
+ BCMBAL_PACKET_CFG_ID_INTF_ID = 2, /**< Interface ID. */
+ BCMBAL_PACKET_CFG_ID_INTF_TYPE = 3, /**< Interface Type. */
+ BCMBAL_PACKET_CFG_ID_SVC_PORT = 4, /**< Service Port. */
+ BCMBAL_PACKET_CFG_ID_FLOW_COOKIE = 5, /**< Flow Cookie. */
+ BCMBAL_PACKET_CFG_ID_PKT = 6, /**< Packet Data. */
+ BCMBAL_PACKET_CFG_ID__NUM_OF /**< Number of enum entries, not an entry itself. */
+} bcmbal_packet_cfg_id;
+
+/** Identifiers for all properties contained in the packet_ind group.
+ */
+typedef enum bcmbal_packet_ind_id
+{
+ BCMBAL_PACKET_IND_ID_FLOW_ID = 0, /**< Flow Id. */
+ BCMBAL_PACKET_IND_ID_FLOW_TYPE = 1, /**< Flow Type. */
+ BCMBAL_PACKET_IND_ID_INTF_ID = 2, /**< Interface ID. */
+ BCMBAL_PACKET_IND_ID_INTF_TYPE = 3, /**< Interface Type. */
+ BCMBAL_PACKET_IND_ID_SVC_PORT = 4, /**< Service Port. */
+ BCMBAL_PACKET_IND_ID_FLOW_COOKIE = 5, /**< Flow Cookie. */
+ BCMBAL_PACKET_IND_ID_PKT = 6, /**< Packet Data. */
+ BCMBAL_PACKET_IND_ID__NUM_OF /**< Number of enum entries, not an entry itself. */
+} bcmbal_packet_ind_id;
+
+/** Identifiers for all properties contained in the packet_key group.
+ */
+typedef enum bcmbal_packet_key_id
+{
+ BCMBAL_PACKET_KEY_ID_RESERVED = 0, /**< Reserved key field. */
+ BCMBAL_PACKET_KEY_ID_PACKET_SEND_DEST = 1, /**< Packet destination. */
+ BCMBAL_PACKET_KEY_ID__NUM_OF /**< Number of enum entries, not an entry itself. */
+} bcmbal_packet_key_id;
+
+/** Identifiers for all properties contained in the subscriber_terminal_cfg
+ * group.
+ */
+typedef enum bcmbal_subscriber_terminal_cfg_id
+{
+ BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_ADMIN_STATE = 0, /**< Administrative state. */
+ BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_OPER_STATUS = 1, /**< Operational status. */
+ BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_SERIAL_NUMBER = 2, /**< Serial number. */
+ BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_PASSWORD = 3, /**< Password. */
+ BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_REGISTRATION_ID = 4, /**< Registration id. */
+ BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_SVC_PORT_ID = 5, /**< Service port ID. */
+ BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_MAC_ADDRESS = 6, /**< MAC address. */
+ BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_DS_TM = 7, /**< Downstream scheduler and shaper. */
+ BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_US_TM = 8, /**< Upstream scheduler and shaper. */
+ BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_SVC_PORT_ID_LIST = 9, /**< svc_port_id list. */
+ BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_AGG_PORT_ID_LIST = 10, /**< agg_port_id list. */
+ BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID__NUM_OF /**< Number of enum entries, not an entry itself. */
+} bcmbal_subscriber_terminal_cfg_id;
+
+/** Identifiers for all properties contained in the subscriber_terminal_ind
+ * group.
+ */
+typedef enum bcmbal_subscriber_terminal_ind_id
+{
+ BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_ADMIN_STATE = 0, /**< Administrative state. */
+ BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_OPER_STATUS = 1, /**< Operational status. */
+ BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_SERIAL_NUMBER = 2, /**< Serial number. */
+ BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_PASSWORD = 3, /**< Password. */
+ BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_REGISTRATION_ID = 4, /**< Registration id. */
+ BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_SVC_PORT_ID = 5, /**< Service port ID. */
+ BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_MAC_ADDRESS = 6, /**< MAC address. */
+ BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_DS_TM = 7, /**< Downstream scheduler and shaper. */
+ BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_US_TM = 8, /**< Upstream scheduler and shaper. */
+ BCMBAL_SUBSCRIBER_TERMINAL_IND_ID__NUM_OF /**< Number of enum entries, not an entry itself. */
+} bcmbal_subscriber_terminal_ind_id;
+
+/** Identifiers for all properties contained in the subscriber_terminal_key
+ * group.
+ */
+typedef enum bcmbal_subscriber_terminal_key_id
+{
+ BCMBAL_SUBSCRIBER_TERMINAL_KEY_ID_SUB_TERM_ID = 0, /**< sub_term_id. */
+ BCMBAL_SUBSCRIBER_TERMINAL_KEY_ID_INTF_ID = 1, /**< intf_id. */
+ BCMBAL_SUBSCRIBER_TERMINAL_KEY_ID__NUM_OF /**< Number of enum entries, not an entry itself. */
+} bcmbal_subscriber_terminal_key_id;
+
+/** Identifiers for all properties contained in the subscriber_terminal_stat
+ * group.
+ */
+typedef enum bcmbal_subscriber_terminal_stat_id
+{
+ BCMBAL_SUBSCRIBER_TERMINAL_STAT_ID_RX_PACKETS = 0, /**< Received packets. */
+ BCMBAL_SUBSCRIBER_TERMINAL_STAT_ID_RX_BYTES = 1, /**< Received bytes. */
+ BCMBAL_SUBSCRIBER_TERMINAL_STAT_ID_TX_PACKETS = 2, /**< Transmitted packets. */
+ BCMBAL_SUBSCRIBER_TERMINAL_STAT_ID_TX_BYTES = 3, /**< Transmitted bytes. */
+ BCMBAL_SUBSCRIBER_TERMINAL_STAT_ID__NUM_OF /**< Number of enum entries, not an entry itself. */
+} bcmbal_subscriber_terminal_stat_id;
+
+/** Identifiers for all properties contained in the tm_queue_cfg group.
+ */
+typedef enum bcmbal_tm_queue_cfg_id
+{
+ BCMBAL_TM_QUEUE_CFG_ID_PRIORITY = 0, /**< priority. */
+ BCMBAL_TM_QUEUE_CFG_ID_WEIGHT = 1, /**< weight. */
+ BCMBAL_TM_QUEUE_CFG_ID_RATE = 2, /**< rate. */
+ BCMBAL_TM_QUEUE_CFG_ID_BAC = 3, /**< bac. */
+ BCMBAL_TM_QUEUE_CFG_ID_CREATION_MODE = 4, /**< creation_mode. */
+ BCMBAL_TM_QUEUE_CFG_ID_REF_COUNT = 5, /**< ref_count. */
+ BCMBAL_TM_QUEUE_CFG_ID__NUM_OF /**< Number of enum entries, not an entry itself. */
+} bcmbal_tm_queue_cfg_id;
+
+/** Identifiers for all properties contained in the tm_queue_ind group.
+ */
+typedef enum bcmbal_tm_queue_ind_id
+{
+ BCMBAL_TM_QUEUE_IND_ID_RET = 0, /**< ret. */
+ BCMBAL_TM_QUEUE_IND_ID__NUM_OF /**< Number of enum entries, not an entry itself. */
+} bcmbal_tm_queue_ind_id;
+
+/** Identifiers for all properties contained in the tm_queue_key group.
+ */
+typedef enum bcmbal_tm_queue_key_id
+{
+ BCMBAL_TM_QUEUE_KEY_ID_SCHED_ID = 0, /**< sched_id. */
+ BCMBAL_TM_QUEUE_KEY_ID_SCHED_DIR = 1, /**< sched dir. */
+ BCMBAL_TM_QUEUE_KEY_ID_ID = 2, /**< id. */
+ BCMBAL_TM_QUEUE_KEY_ID__NUM_OF /**< Number of enum entries, not an entry itself. */
+} bcmbal_tm_queue_key_id;
+
+/** Identifiers for all properties contained in the tm_queue_stat group.
+ */
+typedef enum bcmbal_tm_queue_stat_id
+{
+ BCMBAL_TM_QUEUE_STAT_ID_PACKETS_OK = 0, /**< packets_ok. */
+ BCMBAL_TM_QUEUE_STAT_ID_BYTES_OK = 1, /**< bytes_ok. */
+ BCMBAL_TM_QUEUE_STAT_ID_PACKETS_DISCARDED = 2, /**< packets_discarded. */
+ BCMBAL_TM_QUEUE_STAT_ID_BYTES_DISCARDED = 3, /**< bytes_discarded. */
+ BCMBAL_TM_QUEUE_STAT_ID__NUM_OF /**< Number of enum entries, not an entry itself. */
+} bcmbal_tm_queue_stat_id;
+
+/** Identifiers for all properties contained in the tm_sched_cfg group.
+ */
+typedef enum bcmbal_tm_sched_cfg_id
+{
+ BCMBAL_TM_SCHED_CFG_ID_OWNER = 0, /**< owner. */
+ BCMBAL_TM_SCHED_CFG_ID_SCHED_TYPE = 1, /**< type. */
+ BCMBAL_TM_SCHED_CFG_ID_SCHED_PARENT = 2, /**< parent. */
+ BCMBAL_TM_SCHED_CFG_ID_SCHED_CHILD_TYPE = 3, /**< child_type. */
+ BCMBAL_TM_SCHED_CFG_ID_RATE = 4, /**< rate. */
+ BCMBAL_TM_SCHED_CFG_ID_TCONT_SLA = 5, /**< tcont_sla. */
+ BCMBAL_TM_SCHED_CFG_ID_CREATION_MODE = 6, /**< creation_mode. */
+ BCMBAL_TM_SCHED_CFG_ID_QUEUES = 7, /**< queues. */
+ BCMBAL_TM_SCHED_CFG_ID_SUB_SCHEDS = 8, /**< sub_scheds. */
+ BCMBAL_TM_SCHED_CFG_ID_NUM_PRIORITIES = 9, /**< num_priorities. */
+ BCMBAL_TM_SCHED_CFG_ID__NUM_OF /**< Number of enum entries, not an entry itself. */
+} bcmbal_tm_sched_cfg_id;
+
+/** Identifiers for all properties contained in the tm_sched_ind group.
+ */
+typedef enum bcmbal_tm_sched_ind_id
+{
+ BCMBAL_TM_SCHED_IND_ID_RET = 0, /**< ret. */
+ BCMBAL_TM_SCHED_IND_ID__NUM_OF /**< Number of enum entries, not an entry itself. */
+} bcmbal_tm_sched_ind_id;
+
+/** Identifiers for all properties contained in the tm_sched_key group.
+ */
+typedef enum bcmbal_tm_sched_key_id
+{
+ BCMBAL_TM_SCHED_KEY_ID_DIR = 0, /**< dir. */
+ BCMBAL_TM_SCHED_KEY_ID_ID = 1, /**< id. */
+ BCMBAL_TM_SCHED_KEY_ID__NUM_OF /**< Number of enum entries, not an entry itself. */
+} bcmbal_tm_sched_key_id;
+
+/** All object tags for all objects in the system.
+ */
+typedef enum bcmbal_obj_tag
+{
+ BCMBAL_OBJ_TAG__NUM_OF /**< Number of enum entries, not an entry itself. */
+} bcmbal_obj_tag;
+
+/** Identifiers for all objects in the system.
+ */
+typedef enum bcmbal_obj_id
+{
+ BCMBAL_OBJ_ID__BEGIN,
+ BCMBAL_OBJ_ID_ACCESS_TERMINAL = 0, /**< BAL Access Terminal */
+ BCMBAL_OBJ_ID_FLOW = 1, /**< BAL Flow */
+ BCMBAL_OBJ_ID_GROUP = 2, /**< BAL Group */
+ BCMBAL_OBJ_ID_INTERFACE = 3, /**< BAL Interface */
+ BCMBAL_OBJ_ID_PACKET = 4, /**< packet */
+ BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL = 5, /**< BAL Subscriber Terminal */
+ BCMBAL_OBJ_ID_TM_QUEUE = 6, /**< tm_queue */
+ BCMBAL_OBJ_ID_TM_SCHED = 7, /**< tm_sched */
+ BCMBAL_OBJ_ID__NUM_OF /**< Number of enum entries, not an entry itself. */
+} bcmbal_obj_id;
+
+/** Identifiers for all possible groups under all objects in the system.
+ */
+typedef enum bcmbal_obj_group_id
+{
+ BCMBAL_OBJ_GROUP_ID__BEGIN,
+ BCMBAL_OBJ_GROUP_ID_ACCESS_TERMINAL_KEY = 0, /**< BAL Access Terminal - key */
+ BCMBAL_OBJ_GROUP_ID_ACCESS_TERMINAL_CFG = 1, /**< BAL Access Terminal - cfg */
+ BCMBAL_OBJ_GROUP_ID_ACCESS_TERMINAL_IND = 2, /**< BAL Access Terminal - Access Terminal Indication */
+ BCMBAL_OBJ_GROUP_ID_FLOW_KEY = 3, /**< BAL Flow - key */
+ BCMBAL_OBJ_GROUP_ID_FLOW_CFG = 4, /**< BAL Flow - cfg */
+ BCMBAL_OBJ_GROUP_ID_FLOW_STAT = 5, /**< BAL Flow - stat */
+ BCMBAL_OBJ_GROUP_ID_FLOW_IND = 6, /**< BAL Flow - Flow Indication */
+ BCMBAL_OBJ_GROUP_ID_GROUP_KEY = 7, /**< BAL Group - key */
+ BCMBAL_OBJ_GROUP_ID_GROUP_CFG = 8, /**< BAL Group - cfg */
+ BCMBAL_OBJ_GROUP_ID_INTERFACE_KEY = 9, /**< BAL Interface - key */
+ BCMBAL_OBJ_GROUP_ID_INTERFACE_CFG = 10, /**< BAL Interface - cfg */
+ BCMBAL_OBJ_GROUP_ID_INTERFACE_STAT = 11, /**< BAL Interface - stat */
+ BCMBAL_OBJ_GROUP_ID_INTERFACE_IND = 12, /**< BAL Interface - Interface Indication */
+ BCMBAL_OBJ_GROUP_ID_PACKET_KEY = 13, /**< packet - key */
+ BCMBAL_OBJ_GROUP_ID_PACKET_CFG = 14, /**< packet - cfg */
+ BCMBAL_OBJ_GROUP_ID_PACKET_IND = 15, /**< packet - Packet indication */
+ BCMBAL_OBJ_GROUP_ID_SUBSCRIBER_TERMINAL_KEY = 16, /**< BAL Subscriber Terminal - key */
+ BCMBAL_OBJ_GROUP_ID_SUBSCRIBER_TERMINAL_CFG = 17, /**< BAL Subscriber Terminal - cfg */
+ BCMBAL_OBJ_GROUP_ID_SUBSCRIBER_TERMINAL_STAT = 18, /**< BAL Subscriber Terminal - stat */
+ BCMBAL_OBJ_GROUP_ID_SUBSCRIBER_TERMINAL_IND = 19, /**< BAL Subscriber Terminal - Subscriber Terminal Indication */
+ BCMBAL_OBJ_GROUP_ID_TM_QUEUE_KEY = 20, /**< tm_queue - key */
+ BCMBAL_OBJ_GROUP_ID_TM_QUEUE_CFG = 21, /**< tm_queue - cfg */
+ BCMBAL_OBJ_GROUP_ID_TM_QUEUE_STAT = 22, /**< tm_queue - stat */
+ BCMBAL_OBJ_GROUP_ID_TM_QUEUE_IND = 23, /**< tm_queue - Tm Queue Indication */
+ BCMBAL_OBJ_GROUP_ID_TM_SCHED_KEY = 24, /**< tm_sched - key */
+ BCMBAL_OBJ_GROUP_ID_TM_SCHED_CFG = 25, /**< tm_sched - cfg */
+ BCMBAL_OBJ_GROUP_ID_TM_SCHED_IND = 26, /**< tm_sched - Tm Sched Indication */
+ BCMBAL_OBJ_GROUP_ID__NUM_OF /**< Number of enum entries, not an entry itself. */
+} bcmbal_obj_group_id;
+
+/** List of all access_terminal groups of type auto.
+ */
+typedef enum bcmbal_access_terminal_auto_id
+{
+ BCMBAL_ACCESS_TERMINAL_AUTO_ID__BEGIN,
+ BCMBAL_ACCESS_TERMINAL_AUTO_ID_IND = 0, /**< Access Terminal Indication. */
+ BCMBAL_ACCESS_TERMINAL_AUTO_ID__NUM_OF /**< Number of enum entries, not an entry itself. */
+} bcmbal_access_terminal_auto_id;
+
+/** List of all flow groups of type auto.
+ */
+typedef enum bcmbal_flow_auto_id
+{
+ BCMBAL_FLOW_AUTO_ID__BEGIN,
+ BCMBAL_FLOW_AUTO_ID_IND = 0, /**< Flow Indication. */
+ BCMBAL_FLOW_AUTO_ID__NUM_OF /**< Number of enum entries, not an entry itself. */
+} bcmbal_flow_auto_id;
+
+/** List of all interface groups of type auto.
+ */
+typedef enum bcmbal_interface_auto_id
+{
+ BCMBAL_INTERFACE_AUTO_ID__BEGIN,
+ BCMBAL_INTERFACE_AUTO_ID_IND = 0, /**< Interface Indication. */
+ BCMBAL_INTERFACE_AUTO_ID__NUM_OF /**< Number of enum entries, not an entry itself. */
+} bcmbal_interface_auto_id;
+
+/** List of all packet groups of type auto.
+ */
+typedef enum bcmbal_packet_auto_id
+{
+ BCMBAL_PACKET_AUTO_ID__BEGIN,
+ BCMBAL_PACKET_AUTO_ID_IND = 0, /**< Packet indication. */
+ BCMBAL_PACKET_AUTO_ID__NUM_OF /**< Number of enum entries, not an entry itself. */
+} bcmbal_packet_auto_id;
+
+/** List of all subscriber_terminal groups of type auto.
+ */
+typedef enum bcmbal_subscriber_terminal_auto_id
+{
+ BCMBAL_SUBSCRIBER_TERMINAL_AUTO_ID__BEGIN,
+ BCMBAL_SUBSCRIBER_TERMINAL_AUTO_ID_IND = 0, /**< Subscriber Terminal Indication. */
+ BCMBAL_SUBSCRIBER_TERMINAL_AUTO_ID__NUM_OF /**< Number of enum entries, not an entry itself. */
+} bcmbal_subscriber_terminal_auto_id;
+
+/** List of all tm_queue groups of type auto.
+ */
+typedef enum bcmbal_tm_queue_auto_id
+{
+ BCMBAL_TM_QUEUE_AUTO_ID__BEGIN,
+ BCMBAL_TM_QUEUE_AUTO_ID_IND = 0, /**< Tm Queue Indication. */
+ BCMBAL_TM_QUEUE_AUTO_ID__NUM_OF /**< Number of enum entries, not an entry itself. */
+} bcmbal_tm_queue_auto_id;
+
+/** List of all tm_sched groups of type auto.
+ */
+typedef enum bcmbal_tm_sched_auto_id
+{
+ BCMBAL_TM_SCHED_AUTO_ID__BEGIN,
+ BCMBAL_TM_SCHED_AUTO_ID_IND = 0, /**< Tm Sched Indication. */
+ BCMBAL_TM_SCHED_AUTO_ID__NUM_OF /**< Number of enum entries, not an entry itself. */
+} bcmbal_tm_sched_auto_id;
+
+#define bcmbal_access_terminal_key_id_all_properties BCMBAL_ACCESS_TERMINAL_KEY_ID__NUM_OF
+#define bcmbal_access_terminal_cfg_id_all_properties BCMBAL_ACCESS_TERMINAL_CFG_ID__NUM_OF
+#define bcmbal_access_terminal_ind_id_all_properties BCMBAL_ACCESS_TERMINAL_IND_ID__NUM_OF
+#define bcmbal_flow_cfg_id_all_properties BCMBAL_FLOW_CFG_ID__NUM_OF
+#define bcmbal_flow_key_id_all_properties BCMBAL_FLOW_KEY_ID__NUM_OF
+#define bcmbal_flow_stat_id_all_properties BCMBAL_FLOW_STAT_ID__NUM_OF
+#define bcmbal_flow_ind_id_all_properties BCMBAL_FLOW_IND_ID__NUM_OF
+#define bcmbal_group_cfg_id_all_properties BCMBAL_GROUP_CFG_ID__NUM_OF
+#define bcmbal_group_key_id_all_properties BCMBAL_GROUP_KEY_ID__NUM_OF
+#define bcmbal_interface_key_id_all_properties BCMBAL_INTERFACE_KEY_ID__NUM_OF
+#define bcmbal_interface_cfg_id_all_properties BCMBAL_INTERFACE_CFG_ID__NUM_OF
+#define bcmbal_interface_stat_id_all_properties BCMBAL_INTERFACE_STAT_ID__NUM_OF
+#define bcmbal_interface_ind_id_all_properties BCMBAL_INTERFACE_IND_ID__NUM_OF
+#define bcmbal_packet_cfg_id_all_properties BCMBAL_PACKET_CFG_ID__NUM_OF
+#define bcmbal_packet_key_id_all_properties BCMBAL_PACKET_KEY_ID__NUM_OF
+#define bcmbal_packet_ind_id_all_properties BCMBAL_PACKET_IND_ID__NUM_OF
+#define bcmbal_subscriber_terminal_key_id_all_properties BCMBAL_SUBSCRIBER_TERMINAL_KEY_ID__NUM_OF
+#define bcmbal_subscriber_terminal_cfg_id_all_properties BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID__NUM_OF
+#define bcmbal_subscriber_terminal_stat_id_all_properties BCMBAL_SUBSCRIBER_TERMINAL_STAT_ID__NUM_OF
+#define bcmbal_subscriber_terminal_ind_id_all_properties BCMBAL_SUBSCRIBER_TERMINAL_IND_ID__NUM_OF
+#define bcmbal_tm_queue_key_id_all_properties BCMBAL_TM_QUEUE_KEY_ID__NUM_OF
+#define bcmbal_tm_queue_cfg_id_all_properties BCMBAL_TM_QUEUE_CFG_ID__NUM_OF
+#define bcmbal_tm_queue_stat_id_all_properties BCMBAL_TM_QUEUE_STAT_ID__NUM_OF
+#define bcmbal_tm_queue_ind_id_all_properties BCMBAL_TM_QUEUE_IND_ID__NUM_OF
+#define bcmbal_tm_sched_key_id_all_properties BCMBAL_TM_SCHED_KEY_ID__NUM_OF
+#define bcmbal_tm_sched_cfg_id_all_properties BCMBAL_TM_SCHED_CFG_ID__NUM_OF
+#define bcmbal_tm_sched_ind_id_all_properties BCMBAL_TM_SCHED_IND_ID__NUM_OF
+
+/* The following are required for the API Init/Set/etc macros */
+#define bcmbal_obj_id__begin BCMBAL_OBJ_ID__BEGIN
+#define bcmbal_obj_id_access_terminal BCMBAL_OBJ_ID_ACCESS_TERMINAL
+#define bcmbal_obj_id_flow BCMBAL_OBJ_ID_FLOW
+#define bcmbal_obj_id_group BCMBAL_OBJ_ID_GROUP
+#define bcmbal_obj_id_interface BCMBAL_OBJ_ID_INTERFACE
+#define bcmbal_obj_id_packet BCMBAL_OBJ_ID_PACKET
+#define bcmbal_obj_id_subscriber_terminal BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL
+#define bcmbal_obj_id_tm_queue BCMBAL_OBJ_ID_TM_QUEUE
+#define bcmbal_obj_id_tm_sched BCMBAL_OBJ_ID_TM_SCHED
+#define bcmbal_obj_id__num_of BCMBAL_OBJ_ID__NUM_OF
+#define bcmbal_access_terminal_auto_id__begin BCMBAL_ACCESS_TERMINAL_AUTO_ID__BEGIN
+#define bcmbal_access_terminal_auto_id_ind BCMBAL_ACCESS_TERMINAL_AUTO_ID_IND
+#define bcmbal_access_terminal_auto_id__num_of BCMBAL_ACCESS_TERMINAL_AUTO_ID__NUM_OF
+#define bcmbal_flow_auto_id__begin BCMBAL_FLOW_AUTO_ID__BEGIN
+#define bcmbal_flow_auto_id_ind BCMBAL_FLOW_AUTO_ID_IND
+#define bcmbal_flow_auto_id__num_of BCMBAL_FLOW_AUTO_ID__NUM_OF
+#define bcmbal_interface_auto_id__begin BCMBAL_INTERFACE_AUTO_ID__BEGIN
+#define bcmbal_interface_auto_id_ind BCMBAL_INTERFACE_AUTO_ID_IND
+#define bcmbal_interface_auto_id__num_of BCMBAL_INTERFACE_AUTO_ID__NUM_OF
+#define bcmbal_packet_auto_id__begin BCMBAL_PACKET_AUTO_ID__BEGIN
+#define bcmbal_packet_auto_id_ind BCMBAL_PACKET_AUTO_ID_IND
+#define bcmbal_packet_auto_id__num_of BCMBAL_PACKET_AUTO_ID__NUM_OF
+#define bcmbal_subscriber_terminal_auto_id__begin BCMBAL_SUBSCRIBER_TERMINAL_AUTO_ID__BEGIN
+#define bcmbal_subscriber_terminal_auto_id_ind BCMBAL_SUBSCRIBER_TERMINAL_AUTO_ID_IND
+#define bcmbal_subscriber_terminal_auto_id__num_of BCMBAL_SUBSCRIBER_TERMINAL_AUTO_ID__NUM_OF
+#define bcmbal_tm_queue_auto_id__begin BCMBAL_TM_QUEUE_AUTO_ID__BEGIN
+#define bcmbal_tm_queue_auto_id_ind BCMBAL_TM_QUEUE_AUTO_ID_IND
+#define bcmbal_tm_queue_auto_id__num_of BCMBAL_TM_QUEUE_AUTO_ID__NUM_OF
+#define bcmbal_tm_sched_auto_id__begin BCMBAL_TM_SCHED_AUTO_ID__BEGIN
+#define bcmbal_tm_sched_auto_id_ind BCMBAL_TM_SCHED_AUTO_ID_IND
+#define bcmbal_tm_sched_auto_id__num_of BCMBAL_TM_SCHED_AUTO_ID__NUM_OF
+#define bcmbal_access_terminal_key_id_access_term_id BCMBAL_ACCESS_TERMINAL_KEY_ID_ACCESS_TERM_ID
+#define bcmbal_access_terminal_key_id__num_of BCMBAL_ACCESS_TERMINAL_KEY_ID__NUM_OF
+#define bcmbal_access_terminal_cfg_id_admin_state BCMBAL_ACCESS_TERMINAL_CFG_ID_ADMIN_STATE
+#define bcmbal_access_terminal_cfg_id_oper_status BCMBAL_ACCESS_TERMINAL_CFG_ID_OPER_STATUS
+#define bcmbal_access_terminal_cfg_id_iwf_mode BCMBAL_ACCESS_TERMINAL_CFG_ID_IWF_MODE
+#define bcmbal_access_terminal_cfg_id__num_of BCMBAL_ACCESS_TERMINAL_CFG_ID__NUM_OF
+#define bcmbal_access_terminal_ind_id_admin_state BCMBAL_ACCESS_TERMINAL_IND_ID_ADMIN_STATE
+#define bcmbal_access_terminal_ind_id_oper_status BCMBAL_ACCESS_TERMINAL_IND_ID_OPER_STATUS
+#define bcmbal_access_terminal_ind_id_iwf_mode BCMBAL_ACCESS_TERMINAL_IND_ID_IWF_MODE
+#define bcmbal_access_terminal_ind_id__num_of BCMBAL_ACCESS_TERMINAL_IND_ID__NUM_OF
+#define bcmbal_flow_key_id_flow_id BCMBAL_FLOW_KEY_ID_FLOW_ID
+#define bcmbal_flow_key_id_flow_type BCMBAL_FLOW_KEY_ID_FLOW_TYPE
+#define bcmbal_flow_key_id__num_of BCMBAL_FLOW_KEY_ID__NUM_OF
+#define bcmbal_flow_cfg_id_admin_state BCMBAL_FLOW_CFG_ID_ADMIN_STATE
+#define bcmbal_flow_cfg_id_oper_status BCMBAL_FLOW_CFG_ID_OPER_STATUS
+#define bcmbal_flow_cfg_id_access_int_id BCMBAL_FLOW_CFG_ID_ACCESS_INT_ID
+#define bcmbal_flow_cfg_id_network_int_id BCMBAL_FLOW_CFG_ID_NETWORK_INT_ID
+#define bcmbal_flow_cfg_id_sub_term_id BCMBAL_FLOW_CFG_ID_SUB_TERM_ID
+#define bcmbal_flow_cfg_id_sub_term_uni_idx BCMBAL_FLOW_CFG_ID_SUB_TERM_UNI_IDX
+#define bcmbal_flow_cfg_id_svc_port_id BCMBAL_FLOW_CFG_ID_SVC_PORT_ID
+#define bcmbal_flow_cfg_id_agg_port_id BCMBAL_FLOW_CFG_ID_AGG_PORT_ID
+#define bcmbal_flow_cfg_id_resolve_mac BCMBAL_FLOW_CFG_ID_RESOLVE_MAC
+#define bcmbal_flow_cfg_id_classifier BCMBAL_FLOW_CFG_ID_CLASSIFIER
+#define bcmbal_flow_cfg_id_action BCMBAL_FLOW_CFG_ID_ACTION
+#define bcmbal_flow_cfg_id_sla BCMBAL_FLOW_CFG_ID_SLA
+#define bcmbal_flow_cfg_id_cookie BCMBAL_FLOW_CFG_ID_COOKIE
+#define bcmbal_flow_cfg_id_priority BCMBAL_FLOW_CFG_ID_PRIORITY
+#define bcmbal_flow_cfg_id_group_id BCMBAL_FLOW_CFG_ID_GROUP_ID
+#define bcmbal_flow_cfg_id_queue BCMBAL_FLOW_CFG_ID_QUEUE
+#define bcmbal_flow_cfg_id__num_of BCMBAL_FLOW_CFG_ID__NUM_OF
+#define bcmbal_flow_stat_id_rx_packets BCMBAL_FLOW_STAT_ID_RX_PACKETS
+#define bcmbal_flow_stat_id_rx_bytes BCMBAL_FLOW_STAT_ID_RX_BYTES
+#define bcmbal_flow_stat_id_tx_packets BCMBAL_FLOW_STAT_ID_TX_PACKETS
+#define bcmbal_flow_stat_id_tx_bytes BCMBAL_FLOW_STAT_ID_TX_BYTES
+#define bcmbal_flow_stat_id__num_of BCMBAL_FLOW_STAT_ID__NUM_OF
+#define bcmbal_flow_ind_id_admin_state BCMBAL_FLOW_IND_ID_ADMIN_STATE
+#define bcmbal_flow_ind_id_oper_status BCMBAL_FLOW_IND_ID_OPER_STATUS
+#define bcmbal_flow_ind_id_access_int_id BCMBAL_FLOW_IND_ID_ACCESS_INT_ID
+#define bcmbal_flow_ind_id_network_int_id BCMBAL_FLOW_IND_ID_NETWORK_INT_ID
+#define bcmbal_flow_ind_id_sub_term_id BCMBAL_FLOW_IND_ID_SUB_TERM_ID
+#define bcmbal_flow_ind_id_svc_port_id BCMBAL_FLOW_IND_ID_SVC_PORT_ID
+#define bcmbal_flow_ind_id_agg_port_id BCMBAL_FLOW_IND_ID_AGG_PORT_ID
+#define bcmbal_flow_ind_id_resolve_mac BCMBAL_FLOW_IND_ID_RESOLVE_MAC
+#define bcmbal_flow_ind_id_base_tc_id BCMBAL_FLOW_IND_ID_BASE_TC_ID
+#define bcmbal_flow_ind_id_classifier BCMBAL_FLOW_IND_ID_CLASSIFIER
+#define bcmbal_flow_ind_id_action BCMBAL_FLOW_IND_ID_ACTION
+#define bcmbal_flow_ind_id_sla BCMBAL_FLOW_IND_ID_SLA
+#define bcmbal_flow_ind_id_cookie BCMBAL_FLOW_IND_ID_COOKIE
+#define bcmbal_flow_ind_id_priority BCMBAL_FLOW_IND_ID_PRIORITY
+#define bcmbal_flow_ind_id__num_of BCMBAL_FLOW_IND_ID__NUM_OF
+#define bcmbal_group_key_id_group_id BCMBAL_GROUP_KEY_ID_GROUP_ID
+#define bcmbal_group_key_id__num_of BCMBAL_GROUP_KEY_ID__NUM_OF
+#define bcmbal_group_cfg_id_members_cmd BCMBAL_GROUP_CFG_ID_MEMBERS_CMD
+#define bcmbal_group_cfg_id_members BCMBAL_GROUP_CFG_ID_MEMBERS
+#define bcmbal_group_cfg_id_cookie BCMBAL_GROUP_CFG_ID_COOKIE
+#define bcmbal_group_cfg_id_flows BCMBAL_GROUP_CFG_ID_FLOWS
+#define bcmbal_group_cfg_id_owner BCMBAL_GROUP_CFG_ID_OWNER
+#define bcmbal_group_cfg_id__num_of BCMBAL_GROUP_CFG_ID__NUM_OF
+#define bcmbal_interface_key_id_intf_id BCMBAL_INTERFACE_KEY_ID_INTF_ID
+#define bcmbal_interface_key_id_intf_type BCMBAL_INTERFACE_KEY_ID_INTF_TYPE
+#define bcmbal_interface_key_id__num_of BCMBAL_INTERFACE_KEY_ID__NUM_OF
+#define bcmbal_interface_cfg_id_admin_state BCMBAL_INTERFACE_CFG_ID_ADMIN_STATE
+#define bcmbal_interface_cfg_id_oper_status BCMBAL_INTERFACE_CFG_ID_OPER_STATUS
+#define bcmbal_interface_cfg_id_min_data_agg_port_id BCMBAL_INTERFACE_CFG_ID_MIN_DATA_AGG_PORT_ID
+#define bcmbal_interface_cfg_id_min_data_svc_port_id BCMBAL_INTERFACE_CFG_ID_MIN_DATA_SVC_PORT_ID
+#define bcmbal_interface_cfg_id_transceiver_type BCMBAL_INTERFACE_CFG_ID_TRANSCEIVER_TYPE
+#define bcmbal_interface_cfg_id_ds_miss_mode BCMBAL_INTERFACE_CFG_ID_DS_MISS_MODE
+#define bcmbal_interface_cfg_id_mtu BCMBAL_INTERFACE_CFG_ID_MTU
+#define bcmbal_interface_cfg_id_flow_control BCMBAL_INTERFACE_CFG_ID_FLOW_CONTROL
+#define bcmbal_interface_cfg_id_ds_tm BCMBAL_INTERFACE_CFG_ID_DS_TM
+#define bcmbal_interface_cfg_id_us_tm BCMBAL_INTERFACE_CFG_ID_US_TM
+#define bcmbal_interface_cfg_id_sub_term_id_list BCMBAL_INTERFACE_CFG_ID_SUB_TERM_ID_LIST
+#define bcmbal_interface_cfg_id__num_of BCMBAL_INTERFACE_CFG_ID__NUM_OF
+#define bcmbal_interface_stat_id_rx_packets BCMBAL_INTERFACE_STAT_ID_RX_PACKETS
+#define bcmbal_interface_stat_id_rx_bytes BCMBAL_INTERFACE_STAT_ID_RX_BYTES
+#define bcmbal_interface_stat_id_tx_packets BCMBAL_INTERFACE_STAT_ID_TX_PACKETS
+#define bcmbal_interface_stat_id_tx_bytes BCMBAL_INTERFACE_STAT_ID_TX_BYTES
+#define bcmbal_interface_stat_id__num_of BCMBAL_INTERFACE_STAT_ID__NUM_OF
+#define bcmbal_interface_ind_id_admin_state BCMBAL_INTERFACE_IND_ID_ADMIN_STATE
+#define bcmbal_interface_ind_id_oper_status BCMBAL_INTERFACE_IND_ID_OPER_STATUS
+#define bcmbal_interface_ind_id_min_data_agg_port_id BCMBAL_INTERFACE_IND_ID_MIN_DATA_AGG_PORT_ID
+#define bcmbal_interface_ind_id_min_data_svc_port_id BCMBAL_INTERFACE_IND_ID_MIN_DATA_SVC_PORT_ID
+#define bcmbal_interface_ind_id_transceiver_type BCMBAL_INTERFACE_IND_ID_TRANSCEIVER_TYPE
+#define bcmbal_interface_ind_id_ds_miss_mode BCMBAL_INTERFACE_IND_ID_DS_MISS_MODE
+#define bcmbal_interface_ind_id_mtu BCMBAL_INTERFACE_IND_ID_MTU
+#define bcmbal_interface_ind_id_flow_control BCMBAL_INTERFACE_IND_ID_FLOW_CONTROL
+#define bcmbal_interface_ind_id_ds_tm BCMBAL_INTERFACE_IND_ID_DS_TM
+#define bcmbal_interface_ind_id_us_tm BCMBAL_INTERFACE_IND_ID_US_TM
+#define bcmbal_interface_ind_id__num_of BCMBAL_INTERFACE_IND_ID__NUM_OF
+#define bcmbal_packet_key_id_reserved BCMBAL_PACKET_KEY_ID_RESERVED
+#define bcmbal_packet_key_id_packet_send_dest BCMBAL_PACKET_KEY_ID_PACKET_SEND_DEST
+#define bcmbal_packet_key_id__num_of BCMBAL_PACKET_KEY_ID__NUM_OF
+#define bcmbal_packet_cfg_id_flow_id BCMBAL_PACKET_CFG_ID_FLOW_ID
+#define bcmbal_packet_cfg_id_flow_type BCMBAL_PACKET_CFG_ID_FLOW_TYPE
+#define bcmbal_packet_cfg_id_intf_id BCMBAL_PACKET_CFG_ID_INTF_ID
+#define bcmbal_packet_cfg_id_intf_type BCMBAL_PACKET_CFG_ID_INTF_TYPE
+#define bcmbal_packet_cfg_id_svc_port BCMBAL_PACKET_CFG_ID_SVC_PORT
+#define bcmbal_packet_cfg_id_flow_cookie BCMBAL_PACKET_CFG_ID_FLOW_COOKIE
+#define bcmbal_packet_cfg_id_pkt BCMBAL_PACKET_CFG_ID_PKT
+#define bcmbal_packet_cfg_id__num_of BCMBAL_PACKET_CFG_ID__NUM_OF
+#define bcmbal_packet_ind_id_flow_id BCMBAL_PACKET_IND_ID_FLOW_ID
+#define bcmbal_packet_ind_id_flow_type BCMBAL_PACKET_IND_ID_FLOW_TYPE
+#define bcmbal_packet_ind_id_intf_id BCMBAL_PACKET_IND_ID_INTF_ID
+#define bcmbal_packet_ind_id_intf_type BCMBAL_PACKET_IND_ID_INTF_TYPE
+#define bcmbal_packet_ind_id_svc_port BCMBAL_PACKET_IND_ID_SVC_PORT
+#define bcmbal_packet_ind_id_flow_cookie BCMBAL_PACKET_IND_ID_FLOW_COOKIE
+#define bcmbal_packet_ind_id_pkt BCMBAL_PACKET_IND_ID_PKT
+#define bcmbal_packet_ind_id__num_of BCMBAL_PACKET_IND_ID__NUM_OF
+#define bcmbal_subscriber_terminal_key_id_sub_term_id BCMBAL_SUBSCRIBER_TERMINAL_KEY_ID_SUB_TERM_ID
+#define bcmbal_subscriber_terminal_key_id_intf_id BCMBAL_SUBSCRIBER_TERMINAL_KEY_ID_INTF_ID
+#define bcmbal_subscriber_terminal_key_id__num_of BCMBAL_SUBSCRIBER_TERMINAL_KEY_ID__NUM_OF
+#define bcmbal_subscriber_terminal_cfg_id_admin_state BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_ADMIN_STATE
+#define bcmbal_subscriber_terminal_cfg_id_oper_status BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_OPER_STATUS
+#define bcmbal_subscriber_terminal_cfg_id_serial_number BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_SERIAL_NUMBER
+#define bcmbal_subscriber_terminal_cfg_id_password BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_PASSWORD
+#define bcmbal_subscriber_terminal_cfg_id_registration_id BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_REGISTRATION_ID
+#define bcmbal_subscriber_terminal_cfg_id_svc_port_id BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_SVC_PORT_ID
+#define bcmbal_subscriber_terminal_cfg_id_mac_address BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_MAC_ADDRESS
+#define bcmbal_subscriber_terminal_cfg_id_ds_tm BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_DS_TM
+#define bcmbal_subscriber_terminal_cfg_id_us_tm BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_US_TM
+#define bcmbal_subscriber_terminal_cfg_id_svc_port_id_list BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_SVC_PORT_ID_LIST
+#define bcmbal_subscriber_terminal_cfg_id_agg_port_id_list BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID_AGG_PORT_ID_LIST
+#define bcmbal_subscriber_terminal_cfg_id__num_of BCMBAL_SUBSCRIBER_TERMINAL_CFG_ID__NUM_OF
+#define bcmbal_subscriber_terminal_stat_id_rx_packets BCMBAL_SUBSCRIBER_TERMINAL_STAT_ID_RX_PACKETS
+#define bcmbal_subscriber_terminal_stat_id_rx_bytes BCMBAL_SUBSCRIBER_TERMINAL_STAT_ID_RX_BYTES
+#define bcmbal_subscriber_terminal_stat_id_tx_packets BCMBAL_SUBSCRIBER_TERMINAL_STAT_ID_TX_PACKETS
+#define bcmbal_subscriber_terminal_stat_id_tx_bytes BCMBAL_SUBSCRIBER_TERMINAL_STAT_ID_TX_BYTES
+#define bcmbal_subscriber_terminal_stat_id__num_of BCMBAL_SUBSCRIBER_TERMINAL_STAT_ID__NUM_OF
+#define bcmbal_subscriber_terminal_ind_id_admin_state BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_ADMIN_STATE
+#define bcmbal_subscriber_terminal_ind_id_oper_status BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_OPER_STATUS
+#define bcmbal_subscriber_terminal_ind_id_serial_number BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_SERIAL_NUMBER
+#define bcmbal_subscriber_terminal_ind_id_password BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_PASSWORD
+#define bcmbal_subscriber_terminal_ind_id_registration_id BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_REGISTRATION_ID
+#define bcmbal_subscriber_terminal_ind_id_svc_port_id BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_SVC_PORT_ID
+#define bcmbal_subscriber_terminal_ind_id_mac_address BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_MAC_ADDRESS
+#define bcmbal_subscriber_terminal_ind_id_ds_tm BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_DS_TM
+#define bcmbal_subscriber_terminal_ind_id_us_tm BCMBAL_SUBSCRIBER_TERMINAL_IND_ID_US_TM
+#define bcmbal_subscriber_terminal_ind_id__num_of BCMBAL_SUBSCRIBER_TERMINAL_IND_ID__NUM_OF
+#define bcmbal_tm_queue_key_id_sched_id BCMBAL_TM_QUEUE_KEY_ID_SCHED_ID
+#define bcmbal_tm_queue_key_id_sched_dir BCMBAL_TM_QUEUE_KEY_ID_SCHED_DIR
+#define bcmbal_tm_queue_key_id_id BCMBAL_TM_QUEUE_KEY_ID_ID
+#define bcmbal_tm_queue_key_id__num_of BCMBAL_TM_QUEUE_KEY_ID__NUM_OF
+#define bcmbal_tm_queue_cfg_id_priority BCMBAL_TM_QUEUE_CFG_ID_PRIORITY
+#define bcmbal_tm_queue_cfg_id_weight BCMBAL_TM_QUEUE_CFG_ID_WEIGHT
+#define bcmbal_tm_queue_cfg_id_rate BCMBAL_TM_QUEUE_CFG_ID_RATE
+#define bcmbal_tm_queue_cfg_id_bac BCMBAL_TM_QUEUE_CFG_ID_BAC
+#define bcmbal_tm_queue_cfg_id_creation_mode BCMBAL_TM_QUEUE_CFG_ID_CREATION_MODE
+#define bcmbal_tm_queue_cfg_id_ref_count BCMBAL_TM_QUEUE_CFG_ID_REF_COUNT
+#define bcmbal_tm_queue_cfg_id__num_of BCMBAL_TM_QUEUE_CFG_ID__NUM_OF
+#define bcmbal_tm_queue_stat_id_packets_ok BCMBAL_TM_QUEUE_STAT_ID_PACKETS_OK
+#define bcmbal_tm_queue_stat_id_bytes_ok BCMBAL_TM_QUEUE_STAT_ID_BYTES_OK
+#define bcmbal_tm_queue_stat_id_packets_discarded BCMBAL_TM_QUEUE_STAT_ID_PACKETS_DISCARDED
+#define bcmbal_tm_queue_stat_id_bytes_discarded BCMBAL_TM_QUEUE_STAT_ID_BYTES_DISCARDED
+#define bcmbal_tm_queue_stat_id__num_of BCMBAL_TM_QUEUE_STAT_ID__NUM_OF
+#define bcmbal_tm_queue_ind_id_ret BCMBAL_TM_QUEUE_IND_ID_RET
+#define bcmbal_tm_queue_ind_id__num_of BCMBAL_TM_QUEUE_IND_ID__NUM_OF
+#define bcmbal_tm_sched_key_id_dir BCMBAL_TM_SCHED_KEY_ID_DIR
+#define bcmbal_tm_sched_key_id_id BCMBAL_TM_SCHED_KEY_ID_ID
+#define bcmbal_tm_sched_key_id__num_of BCMBAL_TM_SCHED_KEY_ID__NUM_OF
+#define bcmbal_tm_sched_cfg_id_owner BCMBAL_TM_SCHED_CFG_ID_OWNER
+#define bcmbal_tm_sched_cfg_id_sched_type BCMBAL_TM_SCHED_CFG_ID_SCHED_TYPE
+#define bcmbal_tm_sched_cfg_id_sched_parent BCMBAL_TM_SCHED_CFG_ID_SCHED_PARENT
+#define bcmbal_tm_sched_cfg_id_sched_child_type BCMBAL_TM_SCHED_CFG_ID_SCHED_CHILD_TYPE
+#define bcmbal_tm_sched_cfg_id_rate BCMBAL_TM_SCHED_CFG_ID_RATE
+#define bcmbal_tm_sched_cfg_id_tcont_sla BCMBAL_TM_SCHED_CFG_ID_TCONT_SLA
+#define bcmbal_tm_sched_cfg_id_creation_mode BCMBAL_TM_SCHED_CFG_ID_CREATION_MODE
+#define bcmbal_tm_sched_cfg_id_queues BCMBAL_TM_SCHED_CFG_ID_QUEUES
+#define bcmbal_tm_sched_cfg_id_sub_scheds BCMBAL_TM_SCHED_CFG_ID_SUB_SCHEDS
+#define bcmbal_tm_sched_cfg_id_num_priorities BCMBAL_TM_SCHED_CFG_ID_NUM_PRIORITIES
+#define bcmbal_tm_sched_cfg_id__num_of BCMBAL_TM_SCHED_CFG_ID__NUM_OF
+#define bcmbal_tm_sched_ind_id_ret BCMBAL_TM_SCHED_IND_ID_RET
+#define bcmbal_tm_sched_ind_id__num_of BCMBAL_TM_SCHED_IND_ID__NUM_OF
+
+/** Checks whether the given object type has the given tag.
+ *
+ * \return true if the given object has the given tag, false otherwise
+ */
+bcmos_bool bcmbal_obj_has_tag(bcmbal_obj_id obj, bcmbal_obj_tag tag);
+
+#define BCMBAL_OBJ_ID_ANY ((bcmbal_obj_id) UINT16_MAX)
+
+/** @} */
+#endif /* BAL_MODEL_IDS_H_ */
diff --git a/bal_release/src/common/include/bal_model_types.h b/bal_release/src/common/include/bal_model_types.h
new file mode 100644
index 0000000..af683fc
--- /dev/null
+++ b/bal_release/src/common/include/bal_model_types.h
@@ -0,0 +1,1154 @@
+#ifndef BAL_MODEL_TYPES
+#define BAL_MODEL_TYPES
+
+#include <bcmos_system.h>
+#include "bal_obj.h"
+
+/** \defgroup object_model_data_types BAL Object Model Data Types
+ * @{
+ */
+typedef uint32_t bcmbal_access_id; /**< bcmbal_access_id: typed alias for a 32-bit unsigned integer. */
+typedef uint16_t bcmbal_aggregation_port_id; /**< bcmbal_aggregation_port_id: typed alias for a 16-bit unsigned integer. */
+typedef uint64_t bcmbal_cookie; /**< bcmbal_cookie: typed alias for a 64-bit unsigned integer. */
+typedef uint32_t bcmbal_intf_id; /**< bcmbal_intf_id: typed alias for a 32-bit unsigned integer. */
+typedef uint32_t bcmbal_sub_id; /**< bcmbal_sub_id: typed alias for a 32-bit unsigned integer. */
+#define BCMBAL_SUB_ID_UNKNOWN ((bcmbal_sub_id) 65535UL)
+typedef uint32_t bcmbal_flow_id; /**< bcmbal_flow_id: typed alias for a 32-bit unsigned integer. */
+typedef uint32_t bcmbal_group_id; /**< bcmbal_group_id: typed alias for a 32-bit unsigned integer. */
+typedef uint16_t bcmbal_service_port_id; /**< bcmbal_service_port_id: typed alias for a 16-bit unsigned integer. */
+typedef uint32_t bcmbal_tm_sched_id; /**< bcmbal_tm_sched_id: typed alias for a 32-bit unsigned integer. */
+#define BCMBAL_TM_SCHED_ID_UNKNOWN ((bcmbal_tm_sched_id) 65535UL)
+typedef uint8_t bcmbal_tm_queue_id; /**< bcmbal_tm_queue_id: typed alias for a 8-bit unsigned integer. */
+typedef uint8_t bcmbal_percent; /**< bcmbal_percent: typed alias for a 8-bit unsigned integer. */
+typedef uint8_t bcmbal_tm_priority; /**< bcmbal_tm_priority: typed alias for a 8-bit unsigned integer. */
+typedef uint16_t bcmbal_tm_sched_id_index; /**< bcmbal_tm_sched_id_index: typed alias for a 16-bit unsigned integer. */
+typedef uint8_t bcmbal_tm_weight; /**< bcmbal_tm_weight: typed alias for a 8-bit unsigned integer. */
+
+/** action ID.
+ */
+typedef enum bcmbal_action_id
+{
+ BCMBAL_ACTION_ID_NONE = 0,
+ BCMBAL_ACTION_ID_CMDS_BITMASK = 0x0001, /**< Commands bitmask. */
+ BCMBAL_ACTION_ID_O_VID = 0x0002, /**< Outer vid. */
+ BCMBAL_ACTION_ID_O_PBITS = 0x0004, /**< Outer pbits. */
+ BCMBAL_ACTION_ID_O_TPID = 0x0008, /**< Outer tpid. */
+ BCMBAL_ACTION_ID_I_VID = 0x0010, /**< Inner vid. */
+ BCMBAL_ACTION_ID_I_PBITS = 0x0020, /**< Inner pbits. */
+ BCMBAL_ACTION_ID_I_TPID = 0x0040, /**< Inner tpid. */
+ BCMBAL_ACTION_ID_ALL = 0x007F /**< All fields */
+} bcmbal_action_id;
+
+/** action_cmd_id.
+ */
+typedef enum bcmbal_action_cmd_id
+{
+ BCMBAL_ACTION_CMD_ID_NONE = 0,
+ BCMBAL_ACTION_CMD_ID_ADD_OUTER_TAG = 0x0001, /**< Add outer tag. */
+ BCMBAL_ACTION_CMD_ID_REMOVE_OUTER_TAG = 0x0002, /**< Remove outer tag. */
+ BCMBAL_ACTION_CMD_ID_XLATE_OUTER_TAG = 0x0004, /**< Translate outer tag. */
+ BCMBAL_ACTION_CMD_ID_XLATE_TWO_TAGS = 0x0008, /**< Translate two tags. */
+ BCMBAL_ACTION_CMD_ID_DISCARD_DS_BCAST = 0x0010, /**< Used to satisfy TR-156 Issue 3 R-111 */
+ BCMBAL_ACTION_CMD_ID_DISCARD_DS_UNKNOWN = 0x0020, /**< Used to satisfy TR-156 Issue 3 R-109 */
+ BCMBAL_ACTION_CMD_ID_ADD_TWO_TAGS = 0x0040, /**< Add two tags. */
+ BCMBAL_ACTION_CMD_ID_REMOVE_TWO_TAGS = 0x0080, /**< Remove two tags. */
+ BCMBAL_ACTION_CMD_ID_REMARK_PBITS = 0x0100, /**< Set the outer tag pbits */
+ BCMBAL_ACTION_CMD_ID_COPY_PBITS = 0x0200, /**< Copy the inner pbits to outer pbits */
+ BCMBAL_ACTION_CMD_ID_REVERSE_COPY_PBITS = 0x0400, /**< Copy the outer pbits to inner pbits */
+ BCMBAL_ACTION_CMD_ID_DSCP_TO_PBITS = 0x0800, /**< Copy the L4 DSCP to outer pbits */
+ BCMBAL_ACTION_CMD_ID_TRAP_TO_HOST = 0x1000 /**< Not a valid action for a group object member */
+} bcmbal_action_cmd_id;
+
+/** classifier ID.
+ */
+typedef enum bcmbal_classifier_id
+{
+ BCMBAL_CLASSIFIER_ID_NONE = 0,
+ BCMBAL_CLASSIFIER_ID_O_TPID = 0x0001, /**< Outer TPID of the packet to be classified */
+ BCMBAL_CLASSIFIER_ID_O_VID = 0x0002, /**< Outer VID of the packet to be classified */
+ BCMBAL_CLASSIFIER_ID_I_TPID = 0x0004, /**< Inner TPID of the packet to be classified */
+ BCMBAL_CLASSIFIER_ID_I_VID = 0x0008, /**< Inner VID of the packet to be classified */
+ BCMBAL_CLASSIFIER_ID_O_PBITS = 0x0010, /**< Outer PBITS of the packet to be classified */
+ BCMBAL_CLASSIFIER_ID_I_PBITS = 0x0020, /**< Inner PBITS of the packet to be classified */
+ BCMBAL_CLASSIFIER_ID_ETHER_TYPE = 0x0040, /**< Ethertype of the packet to be classified */
+ BCMBAL_CLASSIFIER_ID_DST_MAC = 0x0080, /**< Destination MAC address of the packet to be classified */
+ BCMBAL_CLASSIFIER_ID_SRC_MAC = 0x0100, /**< Source MAC address of the packet to be classified */
+ BCMBAL_CLASSIFIER_ID_IP_PROTO = 0x0200, /**< IP protocol of the packet to be classified */
+ BCMBAL_CLASSIFIER_ID_DST_IP = 0x0400, /**< Destination IP address of the packet to be classified */
+ BCMBAL_CLASSIFIER_ID_SRC_IP = 0x0800, /**< Source IP address of the packet to be classified */
+ BCMBAL_CLASSIFIER_ID_SRC_PORT = 0x1000, /**< Source port of the packet to be classified */
+ BCMBAL_CLASSIFIER_ID_DST_PORT = 0x2000, /**< Destination port of the packet to be classified */
+ BCMBAL_CLASSIFIER_ID_PKT_TAG_TYPE = 0x4000, /**< The tag type of the ingress packets */
+ BCMBAL_CLASSIFIER_ID_ALL = 0x7FFF /**< All fields */
+} bcmbal_classifier_id;
+
+/** Packet tag type.
+ */
+typedef enum bcmbal_pkt_tag_type
+{
+ BCMBAL_PKT_TAG_TYPE_NONE = 0,
+ BCMBAL_PKT_TAG_TYPE_UNTAGGED = 0x0001, /**< Untagged. */
+ BCMBAL_PKT_TAG_TYPE_SINGLE_TAG = 0x0002, /**< Single tag. */
+ BCMBAL_PKT_TAG_TYPE_DOUBLE_TAG = 0x0004 /**< Double tag. */
+} bcmbal_pkt_tag_type;
+
+/** Generic enable/disable enumeration
+ */
+typedef enum bcmbal_control
+{
+ BCMBAL_CONTROL_DISABLE = 0, /**< disable. */
+ BCMBAL_CONTROL_ENABLE = 1, /**< enable. */
+ BCMBAL_CONTROL__NUM_OF /**< Number of enum entries, not an entry itself. */
+} bcmbal_control;
+
+/** Destination type.
+ */
+typedef enum bcmbal_dest_type
+{
+ BCMBAL_DEST_TYPE_NNI = 1, /**< for packets being sent to the NNI */
+ BCMBAL_DEST_TYPE_SUB_TERM = 2, /**< for packets being sent to a subscriber terminal */
+ BCMBAL_DEST_TYPE_HOST = 3 /**< for packet indications received from NNI or SUB_TERM and being sent to the host */
+} bcmbal_dest_type;
+
+/** Downstrean action for unknown packets.
+ */
+typedef enum bcmbal_ds_miss_mode
+{
+ BCMBAL_DS_MISS_MODE_DISCARD = 0, /**< Discard. */
+ BCMBAL_DS_MISS_MODE_BROADCAST = 1, /**< Broadcast. */
+ BCMBAL_DS_MISS_MODE_VID = 2, /**< Vid. */
+ BCMBAL_DS_MISS_MODE__NUM_OF /**< Number of enum entries, not an entry itself. */
+} bcmbal_ds_miss_mode;
+
+/** Extra BW Eligibility Type
+ */
+typedef enum bcmbal_extra_bw_eligibility_type
+{
+ BCMBAL_EXTRA_BW_ELIGIBILITY_TYPE_NONE = 0, /**< None */
+ BCMBAL_EXTRA_BW_ELIGIBILITY_TYPE_NOT_ASSURED= 1, /**< Not assured */
+ BCMBAL_EXTRA_BW_ELIGIBILITY_TYPE_BEST_EFFORT= 2, /**< Best effort */
+ BCMBAL_EXTRA_BW_ELIGIBILITY_TYPE__NUM_OF /**< Number of enum entries, not an entry itself. */
+} bcmbal_extra_bw_eligibility_type;
+
+/** Flow Type.
+ */
+typedef enum bcmbal_flow_type
+{
+ BCMBAL_FLOW_TYPE_UPSTREAM = 1, /**< Upstream flow */
+ BCMBAL_FLOW_TYPE_DOWNSTREAM = 2, /**< Downstream Flow */
+ BCMBAL_FLOW_TYPE_BROADCAST = 3, /**< Broadcast Flow */
+ BCMBAL_FLOW_TYPE_MULTICAST = 4 /**< Multicast Flow */
+} bcmbal_flow_type;
+
+/** Member operation type.
+ */
+typedef enum bcmbal_group_member_cmd
+{
+ BCMBAL_GROUP_MEMBER_CMD_ADD_MEMBERS = 1, /**< Add new members. */
+ BCMBAL_GROUP_MEMBER_CMD_REM_MEMBERS = 2, /**< Remove existing members. */
+ BCMBAL_GROUP_MEMBER_CMD_SET_MEMBERS = 3 /**< Replace members with new set. */
+} bcmbal_group_member_cmd;
+
+/** owner of the group
+ */
+typedef enum bcmbal_group_owner
+{
+ BCMBAL_GROUP_OWNER_NONE = 0, /**< no owner */
+ BCMBAL_GROUP_OWNER_MULTICAST = 1, /**< used as multicast group */
+ BCMBAL_GROUP_OWNER_UNICAST = 2, /**< used as unicast group */
+ BCMBAL_GROUP_OWNER__NUM_OF /**< Number of enum entries, not an entry itself. */
+} bcmbal_group_owner;
+
+/** Interface type.
+ */
+typedef enum bcmbal_intf_type
+{
+ BCMBAL_INTF_TYPE_NNI = 0, /**< NNI Interface. */
+ BCMBAL_INTF_TYPE_PON = 1, /**< POIN Interface. */
+ BCMBAL_INTF_TYPE__NUM_OF /**< Number of enum entries, not an entry itself. */
+} bcmbal_intf_type;
+
+/** Interworking Function Mode.
+ */
+typedef enum bcmbal_iwf_mode
+{
+ BCMBAL_IWF_MODE_DIRECT_MAPPING = 0, /**< Direct mapping. */
+ BCMBAL_IWF_MODE_PER_FLOW = 1, /**< Per flow . */
+ BCMBAL_IWF_MODE__NUM_OF /**< Number of enum entries, not an entry itself. */
+} bcmbal_iwf_mode;
+
+/** SLA ID.
+ */
+typedef enum bcmbal_sla_id
+{
+ BCMBAL_SLA_ID_NONE = 0,
+ BCMBAL_SLA_ID_MIN_RATE = 0x0001, /**< The minimal rate for this flow, in kilobits per second (optional) */
+ BCMBAL_SLA_ID_MAX_RATE = 0x0002, /**< The maximum rate for this flow, in kilobits per second (optional) */
+ BCMBAL_SLA_ID_ALL = 0x0003 /**< All fields */
+} bcmbal_sla_id;
+
+/** Admin state values for access terminal object
+ */
+typedef enum bcmbal_state
+{
+ BCMBAL_STATE_UP = 1, /**< Admin state up */
+ BCMBAL_STATE_DOWN = 2, /**< Admin state down */
+ BCMBAL_STATE_TESTING = 3 /**< Admin state testing */
+} bcmbal_state;
+
+/** Oper status values
+ */
+typedef enum bcmbal_status
+{
+ BCMBAL_STATUS_UP = 1, /**< Oper status up */
+ BCMBAL_STATUS_DOWN = 2, /**< Oper status down */
+ BCMBAL_STATUS_TESTING = 3, /**< Oper status testing */
+ BCMBAL_STATUS_NOT_PRESENT = 4, /**< Oper status not present */
+ BCMBAL_STATUS_LOWER_LAYER_DOWN = 5, /**< Oper status lower layer down */
+ BCMBAL_STATUS_UNKNOWN = 6 /**< Oper status unknown */
+} bcmbal_status;
+
+/** Buffer Admission Control Type
+ */
+typedef enum bcmbal_tm_bac_type
+{
+ BCMBAL_TM_BAC_TYPE_TAILDROP = 0, /**< Taildrop */
+ BCMBAL_TM_BAC_TYPE_WTAILDROP = 1, /**< Weighted taildrop */
+ BCMBAL_TM_BAC_TYPE_RED = 2, /**< Random Early Discard */
+ BCMBAL_TM_BAC_TYPE_WRED = 3, /**< Weighted Random Early Discard */
+ BCMBAL_TM_BAC_TYPE__NUM_OF /**< Number of enum entries, not an entry itself. */
+} bcmbal_tm_bac_type;
+
+/** TM Creation Mode
+ */
+typedef enum bcmbal_tm_creation_mode
+{
+ BCMBAL_TM_CREATION_MODE_MANUAL = 0, /**< tm object created manually */
+ BCMBAL_TM_CREATION_MODE_AUTO = 1, /**< tm object created automatically */
+ BCMBAL_TM_CREATION_MODE__NUM_OF /**< Number of enum entries, not an entry itself. */
+} bcmbal_tm_creation_mode;
+
+/** Scheduling Level for the Children TM
+ */
+typedef enum bcmbal_tm_sched_child_type
+{
+ BCMBAL_TM_SCHED_CHILD_TYPE_QUEUE = 0, /**< Queue-level scheduler */
+ BCMBAL_TM_SCHED_CHILD_TYPE_SCHED = 1, /**< Scheduler-level scheduler */
+ BCMBAL_TM_SCHED_CHILD_TYPE__NUM_OF /**< Number of enum entries, not an entry itself. */
+} bcmbal_tm_sched_child_type;
+
+/** Traffic Direction
+ */
+typedef enum bcmbal_tm_sched_dir
+{
+ BCMBAL_TM_SCHED_DIR_US = 1, /**< Upstream */
+ BCMBAL_TM_SCHED_DIR_DS = 2 /**< Downstream */
+} bcmbal_tm_sched_dir;
+
+/** TM Scheduler Owner Type
+ */
+typedef enum bcmbal_tm_sched_owner_type
+{
+ BCMBAL_TM_SCHED_OWNER_TYPE_UNDEFINED = 0, /**< Undefined */
+ BCMBAL_TM_SCHED_OWNER_TYPE_INTERFACE = 1, /**< Interface */
+ BCMBAL_TM_SCHED_OWNER_TYPE_SUB_TERM = 2, /**< Subscriber terminal */
+ BCMBAL_TM_SCHED_OWNER_TYPE_AGG_PORT = 3, /**< TM scheduler is owned by aggregation port */
+ BCMBAL_TM_SCHED_OWNER_TYPE_UNI = 4, /**< TM scheduler is owned by UNI port */
+ BCMBAL_TM_SCHED_OWNER_TYPE_VIRTUAL = 5, /**< Other unspecified owner */
+ BCMBAL_TM_SCHED_OWNER_TYPE__NUM_OF /**< Number of enum entries, not an entry itself. */
+} bcmbal_tm_sched_owner_type;
+
+/** tm_sched_owner agg_port ID.
+ */
+typedef enum bcmbal_tm_sched_owner_agg_port_id
+{
+ BCMBAL_TM_SCHED_OWNER_AGG_PORT_ID_NONE = 0,
+ BCMBAL_TM_SCHED_OWNER_AGG_PORT_ID_INTF_ID = 0x0001, /**< PON interface id */
+ BCMBAL_TM_SCHED_OWNER_AGG_PORT_ID_SUB_TERM_ID = 0x0002, /**< Subscriber terminal id */
+ BCMBAL_TM_SCHED_OWNER_AGG_PORT_ID_AGG_PORT_ID = 0x0004, /**< Aggregation port id */
+ BCMBAL_TM_SCHED_OWNER_AGG_PORT_ID_ALL = 0x0007 /**< All fields */
+} bcmbal_tm_sched_owner_agg_port_id;
+
+/** tm_sched_parent ID.
+ */
+typedef enum bcmbal_tm_sched_parent_id
+{
+ BCMBAL_TM_SCHED_PARENT_ID_NONE = 0,
+ BCMBAL_TM_SCHED_PARENT_ID_SCHED_ID = 0x0001, /**< Parent scheduler id */
+ BCMBAL_TM_SCHED_PARENT_ID_PRIORITY = 0x0002, /**< Priority */
+ BCMBAL_TM_SCHED_PARENT_ID_WEIGHT = 0x0004, /**< Weight */
+ BCMBAL_TM_SCHED_PARENT_ID_ALL = 0x0007 /**< All fields */
+} bcmbal_tm_sched_parent_id;
+
+/** Scheduler Type
+ */
+typedef enum bcmbal_tm_sched_type
+{
+ BCMBAL_TM_SCHED_TYPE_NONE = 0, /**< NO scheduling */
+ BCMBAL_TM_SCHED_TYPE_WFQ = 1, /**< Weighted Fair Queue */
+ BCMBAL_TM_SCHED_TYPE_SP = 2, /**< Strict Priority */
+ BCMBAL_TM_SCHED_TYPE_SP_WFQ = 3, /**< Hybrid SP + WFQ */
+ BCMBAL_TM_SCHED_TYPE__NUM_OF /**< Number of enum entries, not an entry itself. */
+} bcmbal_tm_sched_type;
+
+/** tm_shaping ID.
+ */
+typedef enum bcmbal_tm_shaping_id
+{
+ BCMBAL_TM_SHAPING_ID_NONE = 0,
+ BCMBAL_TM_SHAPING_ID_SBR = 0x0001, /**< Sustained Bit Rate (kbps) */
+ BCMBAL_TM_SHAPING_ID_PBR = 0x0002, /**< Peak Bit Rate (kbps) */
+ BCMBAL_TM_SHAPING_ID_BURST = 0x0004, /**< Max Burst Bytes at Peak Bit Rate */
+ BCMBAL_TM_SHAPING_ID_ALL = 0x0007 /**< All fields */
+} bcmbal_tm_shaping_id;
+
+/** tm_tcont_sla ID.
+ */
+typedef enum bcmbal_tm_tcont_sla_id
+{
+ BCMBAL_TM_TCONT_SLA_ID_NONE = 0,
+ BCMBAL_TM_TCONT_SLA_ID_EXTRA_BW_ELIG = 0x0001, /**< Extra BW eligibility type */
+ BCMBAL_TM_TCONT_SLA_ID_NRT_CBR = 0x0002, /**< NRT CBR */
+ BCMBAL_TM_TCONT_SLA_ID_RT_CBR = 0x0004, /**< RT_CBR */
+ BCMBAL_TM_TCONT_SLA_ID_RT_PROFILE = 0x0008, /**< RT Profile */
+ BCMBAL_TM_TCONT_SLA_ID_NRT_PROFILE = 0x0010, /**< NRT Profile */
+ BCMBAL_TM_TCONT_SLA_ID_ALL = 0x001F /**< All fields */
+} bcmbal_tm_tcont_sla_id;
+
+/** Transceiver types
+ */
+typedef enum bcmbal_trx_type
+{
+ BCMBAL_TRX_TYPE_GPON_SPS_43_48 = 0, /**< gpon_sps_43_48. */
+ BCMBAL_TRX_TYPE_GPON_SPS_SOG_4321 = 1, /**< gpon_sps_sog_4321. */
+ BCMBAL_TRX_TYPE_GPON_LTE_3680_M = 2, /**< gpon_lte_3680_m. */
+ BCMBAL_TRX_TYPE_GPON_SOURCE_PHOTONICS = 3, /**< gpon_source_photonics. */
+ BCMBAL_TRX_TYPE_GPON_LTE_3680_P = 4, /**< gpon_lte_3680_p. */
+ BCMBAL_TRX_TYPE_XGPON_LTH_7222_PC = 5, /**< xgpon_lth_7222_pc. */
+ BCMBAL_TRX_TYPE_XGPON_LTH_7226_PC = 6, /**< xgpon_lth_7226_pc. */
+ BCMBAL_TRX_TYPE_XGPON_LTH_5302_PC = 7, /**< xgpon_lth_5302_pc. */
+ BCMBAL_TRX_TYPE__NUM_OF /**< Number of enum entries, not an entry itself. */
+} bcmbal_trx_type;
+
+#define bcmbal_action_id_none BCMBAL_ACTION_ID_NONE
+#define bcmbal_action_id_cmds_bitmask BCMBAL_ACTION_ID_CMDS_BITMASK
+#define bcmbal_action_id_o_vid BCMBAL_ACTION_ID_O_VID
+#define bcmbal_action_id_o_pbits BCMBAL_ACTION_ID_O_PBITS
+#define bcmbal_action_id_o_tpid BCMBAL_ACTION_ID_O_TPID
+#define bcmbal_action_id_i_vid BCMBAL_ACTION_ID_I_VID
+#define bcmbal_action_id_i_pbits BCMBAL_ACTION_ID_I_PBITS
+#define bcmbal_action_id_i_tpid BCMBAL_ACTION_ID_I_TPID
+#define bcmbal_action_id_all BCMBAL_ACTION_ID_ALL
+#define bcmbal_classifier_id_none BCMBAL_CLASSIFIER_ID_NONE
+#define bcmbal_classifier_id_o_tpid BCMBAL_CLASSIFIER_ID_O_TPID
+#define bcmbal_classifier_id_o_vid BCMBAL_CLASSIFIER_ID_O_VID
+#define bcmbal_classifier_id_i_tpid BCMBAL_CLASSIFIER_ID_I_TPID
+#define bcmbal_classifier_id_i_vid BCMBAL_CLASSIFIER_ID_I_VID
+#define bcmbal_classifier_id_o_pbits BCMBAL_CLASSIFIER_ID_O_PBITS
+#define bcmbal_classifier_id_i_pbits BCMBAL_CLASSIFIER_ID_I_PBITS
+#define bcmbal_classifier_id_ether_type BCMBAL_CLASSIFIER_ID_ETHER_TYPE
+#define bcmbal_classifier_id_dst_mac BCMBAL_CLASSIFIER_ID_DST_MAC
+#define bcmbal_classifier_id_src_mac BCMBAL_CLASSIFIER_ID_SRC_MAC
+#define bcmbal_classifier_id_ip_proto BCMBAL_CLASSIFIER_ID_IP_PROTO
+#define bcmbal_classifier_id_dst_ip BCMBAL_CLASSIFIER_ID_DST_IP
+#define bcmbal_classifier_id_src_ip BCMBAL_CLASSIFIER_ID_SRC_IP
+#define bcmbal_classifier_id_src_port BCMBAL_CLASSIFIER_ID_SRC_PORT
+#define bcmbal_classifier_id_dst_port BCMBAL_CLASSIFIER_ID_DST_PORT
+#define bcmbal_classifier_id_pkt_tag_type BCMBAL_CLASSIFIER_ID_PKT_TAG_TYPE
+#define bcmbal_classifier_id_all BCMBAL_CLASSIFIER_ID_ALL
+#define bcmbal_sla_id_none BCMBAL_SLA_ID_NONE
+#define bcmbal_sla_id_min_rate BCMBAL_SLA_ID_MIN_RATE
+#define bcmbal_sla_id_max_rate BCMBAL_SLA_ID_MAX_RATE
+#define bcmbal_sla_id_all BCMBAL_SLA_ID_ALL
+#define bcmbal_tm_sched_owner_agg_port_id_none BCMBAL_TM_SCHED_OWNER_AGG_PORT_ID_NONE
+#define bcmbal_tm_sched_owner_agg_port_id_intf_id BCMBAL_TM_SCHED_OWNER_AGG_PORT_ID_INTF_ID
+#define bcmbal_tm_sched_owner_agg_port_id_sub_term_id BCMBAL_TM_SCHED_OWNER_AGG_PORT_ID_SUB_TERM_ID
+#define bcmbal_tm_sched_owner_agg_port_id_agg_port_id BCMBAL_TM_SCHED_OWNER_AGG_PORT_ID_AGG_PORT_ID
+#define bcmbal_tm_sched_owner_agg_port_id_all BCMBAL_TM_SCHED_OWNER_AGG_PORT_ID_ALL
+#define bcmbal_tm_sched_parent_id_none BCMBAL_TM_SCHED_PARENT_ID_NONE
+#define bcmbal_tm_sched_parent_id_sched_id BCMBAL_TM_SCHED_PARENT_ID_SCHED_ID
+#define bcmbal_tm_sched_parent_id_priority BCMBAL_TM_SCHED_PARENT_ID_PRIORITY
+#define bcmbal_tm_sched_parent_id_weight BCMBAL_TM_SCHED_PARENT_ID_WEIGHT
+#define bcmbal_tm_sched_parent_id_all BCMBAL_TM_SCHED_PARENT_ID_ALL
+#define bcmbal_tm_shaping_id_none BCMBAL_TM_SHAPING_ID_NONE
+#define bcmbal_tm_shaping_id_sbr BCMBAL_TM_SHAPING_ID_SBR
+#define bcmbal_tm_shaping_id_pbr BCMBAL_TM_SHAPING_ID_PBR
+#define bcmbal_tm_shaping_id_burst BCMBAL_TM_SHAPING_ID_BURST
+#define bcmbal_tm_shaping_id_all BCMBAL_TM_SHAPING_ID_ALL
+#define bcmbal_tm_tcont_sla_id_none BCMBAL_TM_TCONT_SLA_ID_NONE
+#define bcmbal_tm_tcont_sla_id_extra_bw_elig BCMBAL_TM_TCONT_SLA_ID_EXTRA_BW_ELIG
+#define bcmbal_tm_tcont_sla_id_nrt_cbr BCMBAL_TM_TCONT_SLA_ID_NRT_CBR
+#define bcmbal_tm_tcont_sla_id_rt_cbr BCMBAL_TM_TCONT_SLA_ID_RT_CBR
+#define bcmbal_tm_tcont_sla_id_rt_profile BCMBAL_TM_TCONT_SLA_ID_RT_PROFILE
+#define bcmbal_tm_tcont_sla_id_nrt_profile BCMBAL_TM_TCONT_SLA_ID_NRT_PROFILE
+#define bcmbal_tm_tcont_sla_id_all BCMBAL_TM_TCONT_SLA_ID_ALL
+
+/** action.
+ */
+typedef struct bcmbal_action
+{
+ bcmbal_action_id presence_mask; /**< Presence Mask. */
+ bcmbal_action_cmd_id cmds_bitmask; /**< Commands bitmask. */
+ uint16_t o_vid; /**< Outer vid. */
+ uint8_t o_pbits; /**< Outer pbits. */
+ uint16_t o_tpid; /**< Outer tpid. */
+ uint16_t i_vid; /**< Inner vid. */
+ uint8_t i_pbits; /**< Inner pbits. */
+ uint16_t i_tpid; /**< Inner tpid. */
+} bcmbal_action;
+
+/** Variable-length list of aggregation_port_id.
+ */
+typedef struct bcmbal_aggregation_port_id_list_u8
+{
+ uint8_t len; /**< List length. */
+ bcmbal_aggregation_port_id *val; /**< List contents. */
+} bcmbal_aggregation_port_id_list_u8;
+
+/** classifier.
+ */
+typedef struct bcmbal_classifier
+{
+ bcmbal_classifier_id presence_mask; /**< Presence Mask. */
+ uint16_t o_tpid; /**< Outer TPID of the packet to be classified */
+ uint16_t o_vid; /**< Outer VID of the packet to be classified */
+ uint16_t i_tpid; /**< Inner TPID of the packet to be classified */
+ uint16_t i_vid; /**< Inner VID of the packet to be classified */
+ uint8_t o_pbits; /**< Outer PBITS of the packet to be classified */
+ uint8_t i_pbits; /**< Inner PBITS of the packet to be classified */
+ uint16_t ether_type; /**< Ethertype of the packet to be classified */
+ bcmos_mac_address dst_mac; /**< Destination MAC address of the packet to be classified */
+ bcmos_mac_address src_mac; /**< Source MAC address of the packet to be classified */
+ uint8_t ip_proto; /**< IP protocol of the packet to be classified */
+ bcmos_ipv4_address dst_ip; /**< Destination IP address of the packet to be classified */
+ bcmos_ipv4_address src_ip; /**< Source IP address of the packet to be classified */
+ uint16_t src_port; /**< Source port of the packet to be classified */
+ uint16_t dst_port; /**< Destination port of the packet to be classified */
+ bcmbal_pkt_tag_type pkt_tag_type; /**< The tag type of the ingress packets */
+} bcmbal_classifier;
+
+/** Packet destination.
+ */
+typedef struct bcmbal_dest
+{
+ bcmbal_dest_type type; /**< packet destination. */
+ union
+ {
+ struct
+ {
+ bcmbal_intf_id int_id; /**< Interface ID. */
+ } nni;
+
+ struct
+ {
+ bcmbal_sub_id sub_term_id; /**< Subscriber terminal ID. */
+ uint16_t sub_term_uni; /**< Subscriber terminal UNI. */
+ uint16_t int_id; /**< Interface ID. */
+ } sub_term;
+ } u;
+} bcmbal_dest;
+
+/** Variable-length list of flow_id.
+ */
+typedef struct bcmbal_flow_id_list_u32
+{
+ uint32_t len; /**< List length. */
+ bcmbal_flow_id *val; /**< List contents. */
+} bcmbal_flow_id_list_u32;
+
+/** Queue Reference
+ */
+typedef struct bcmbal_tm_queue_ref
+{
+ bcmbal_tm_sched_id sched_id; /**< Scheduler (tm_sched) ID */
+ bcmbal_tm_queue_id queue_id; /**< Queue ID */
+} bcmbal_tm_queue_ref;
+
+/** Group Member Info.
+ */
+typedef struct bcmbal_group_member_info
+{
+ bcmbal_intf_id intf_id; /**< Access interface id for this member */
+ bcmbal_service_port_id svc_port_id; /**< The multicast "GEM" for this member */
+ bcmbal_action action; /**< VLAN actions */
+ bcmbal_tm_queue_ref queue; /**< Egress queue */
+} bcmbal_group_member_info;
+
+/** Variable-length list of group_member_info.
+ */
+typedef struct bcmbal_group_member_info_list_u16
+{
+ uint16_t len; /**< List length. */
+ bcmbal_group_member_info *val; /**< List contents. */
+} bcmbal_group_member_info_list_u16;
+
+/** Password.
+ */
+typedef struct bcmbal_password
+{
+ uint8_t arr[10]; /**< Array. */
+} bcmbal_password;
+
+/** Registration id.
+ */
+typedef struct bcmbal_registration_id
+{
+ uint8_t arr[36]; /**< ONU registration ID */
+} bcmbal_registration_id;
+
+/** Serial number.
+ */
+typedef struct bcmbal_serial_number
+{
+ uint8_t vendor_id[4]; /**< vendor id. */
+ uint8_t vendor_specific[4]; /**< vendor specific. */
+} bcmbal_serial_number;
+
+/** Variable-length list of service_port_id.
+ */
+typedef struct bcmbal_service_port_id_list_u8
+{
+ uint8_t len; /**< List length. */
+ bcmbal_service_port_id *val; /**< List contents. */
+} bcmbal_service_port_id_list_u8;
+
+/** SLA.
+ */
+typedef struct bcmbal_sla
+{
+ bcmbal_sla_id presence_mask; /**< Presence Mask. */
+ uint32_t min_rate; /**< The minimal rate for this flow, in kilobits per second (optional) */
+ uint32_t max_rate; /**< The maximum rate for this flow, in kilobits per second (optional) */
+} bcmbal_sla;
+
+/** Variable-length list of sub_id.
+ */
+typedef struct bcmbal_sub_id_list_u16
+{
+ uint16_t len; /**< List length. */
+ bcmbal_sub_id *val; /**< List contents. */
+} bcmbal_sub_id_list_u16;
+
+/** Random Early Discard Configuration
+ */
+typedef struct bcmbal_tm_red
+{
+ bcmbal_percent min_threshold; /**< Min threshold in percent of max queue size */
+ bcmbal_percent max_threshold; /**< Max threshold in percent of max queue size */
+ bcmbal_percent max_probability; /**< Discard probability for occupancy between min_threshold and max_threshold */
+} bcmbal_tm_red;
+
+/** Queue Buffer Admission Control
+ */
+typedef struct bcmbal_tm_bac
+{
+ bcmbal_tm_bac_type type; /**< Buffer Admission Control Type */
+ union
+ {
+ struct
+ {
+ uint32_t max_size; /**< max number of packets in the queue */
+ } taildrop;
+
+ struct
+ {
+ bcmbal_tm_red red; /**< Random Early Discard configuration */
+ } red;
+
+ struct
+ {
+ bcmbal_tm_red green; /**< Green Random Early Discard Configuration */
+ bcmbal_tm_red yellow; /**< Yellow Random Early Discard Configuration */
+ bcmbal_tm_red red; /**< Red Random Early Discard Configuration */
+ } wred;
+ } u;
+} bcmbal_tm_bac;
+
+/** Variable-length list of tm_queue_id.
+ */
+typedef struct bcmbal_tm_queue_id_list_u8
+{
+ uint8_t len; /**< List length. */
+ bcmbal_tm_queue_id *val; /**< List contents. */
+} bcmbal_tm_queue_id_list_u8;
+
+/** Variable-length list of tm_sched_id.
+ */
+typedef struct bcmbal_tm_sched_id_list_u8
+{
+ uint8_t len; /**< List length. */
+ bcmbal_tm_sched_id *val; /**< List contents. */
+} bcmbal_tm_sched_id_list_u8;
+
+/** TM Scheduler Owner
+ */
+typedef struct bcmbal_tm_sched_owner
+{
+ bcmbal_tm_sched_owner_type type; /**< Owner type */
+ union
+ {
+ struct
+ {
+ bcmbal_intf_type intf_type; /**< Interface Type */
+ bcmbal_intf_id intf_id; /**< Interface ID */
+ } interface;
+
+ struct
+ {
+ bcmbal_intf_id intf_id; /**< PON interface id */
+ bcmbal_sub_id sub_term_id; /**< Subscriber terminal ID */
+ } sub_term;
+
+ struct
+ {
+ bcmbal_tm_sched_owner_agg_port_id presence_mask; /**< Presence Mask. */
+ uint8_t intf_id; /**< PON interface id */
+ bcmbal_sub_id sub_term_id; /**< Subscriber terminal id */
+ bcmbal_aggregation_port_id agg_port_id; /**< Aggregation port id */
+ } agg_port;
+
+ struct
+ {
+ uint8_t intf_id; /**< PON interface id */
+ bcmbal_sub_id sub_term_id; /**< Subscriber terminal id */
+ uint8_t idx; /**< Index at subscriber terminal */
+ } uni;
+
+ struct
+ {
+ uint32_t idx; /**< Owner index */
+ } virtual;
+ } u;
+} bcmbal_tm_sched_owner;
+
+/** Scheduling Parent Connect Point
+ */
+typedef struct bcmbal_tm_sched_parent
+{
+ bcmbal_tm_sched_parent_id presence_mask; /**< Presence Mask. */
+ bcmbal_tm_sched_id sched_id; /**< Parent scheduler id */
+ bcmbal_tm_priority priority; /**< Priority */
+ bcmbal_tm_weight weight; /**< Weight */
+} bcmbal_tm_sched_parent;
+
+/** Shaping Parameters
+ */
+typedef struct bcmbal_tm_shaping
+{
+ bcmbal_tm_shaping_id presence_mask; /**< Presence Mask. */
+ uint32_t sbr; /**< Sustained Bit Rate (kbps) */
+ uint32_t pbr; /**< Peak Bit Rate (kbps) */
+ uint32_t burst; /**< Max Burst Bytes at Peak Bit Rate */
+} bcmbal_tm_shaping;
+
+/** ITU-PON Extended SLA Parameters
+ */
+typedef struct bcmbal_tm_tcont_sla
+{
+ bcmbal_tm_tcont_sla_id presence_mask; /**< Presence Mask. */
+ bcmbal_extra_bw_eligibility_type extra_bw_elig; /**< Extra BW eligibility type */
+ uint8_t nrt_cbr; /**< NRT CBR */
+ uint8_t rt_cbr; /**< RT_CBR */
+ uint8_t rt_profile; /**< RT Profile */
+ uint8_t nrt_profile; /**< NRT Profile */
+} bcmbal_tm_tcont_sla;
+
+/** Variable-length list of U8.
+ */
+typedef struct bcmbal_u8_list_u32
+{
+ uint32_t len; /**< List length. */
+ uint8_t *val; /**< List contents. */
+} bcmbal_u8_list_u32;
+
+/** Structure definition for the "key" group of the "access_terminal" object.
+ */
+typedef struct bcmbal_access_terminal_key
+{
+ bcmbal_access_id access_term_id; /**< Reserved (set to 0) */
+} bcmbal_access_terminal_key;
+
+/** Structure definition for the "cfg" group of the "access_terminal" object.
+ */
+typedef struct bcmbal_access_terminal_cfg_data
+{
+ bcmbal_state admin_state; /**< Administrative state */
+ bcmbal_status oper_status; /**< Operational status */
+ bcmbal_iwf_mode iwf_mode; /**< The interworking mode */
+} bcmbal_access_terminal_cfg_data;
+
+/** Transport message definition for "cfg" group of "access_terminal" object.
+ */
+typedef struct bcmbal_access_terminal_cfg
+{
+ bcmbal_cfg hdr; /**< Transport header. */
+ bcmbal_access_terminal_key key; /**< Object key. */
+ bcmbal_access_terminal_cfg_data data; /**< All properties that must be set by the user. */
+} bcmbal_access_terminal_cfg;
+
+/** Structure definition for the "ind" group of the "access_terminal" object.
+ */
+typedef struct bcmbal_access_terminal_ind_data
+{
+ bcmbal_state admin_state; /**< Current administrative state */
+ bcmbal_status oper_status; /**< Current operational status */
+ bcmbal_iwf_mode iwf_mode; /**< The interworking mode */
+} bcmbal_access_terminal_ind_data;
+
+/** Transport message definition for "ind" group of "access_terminal" object.
+ */
+typedef struct bcmbal_access_terminal_ind
+{
+ bcmbal_auto hdr; /**< Transport header. */
+ bcmbal_access_terminal_key key; /**< Object key. */
+ bcmbal_access_terminal_ind_data data; /**< All properties that must be set by the user. */
+} bcmbal_access_terminal_ind;
+
+/** Structure definition for the "key" group of the "flow" object.
+ */
+typedef struct bcmbal_flow_key
+{
+ bcmbal_flow_id flow_id; /**< The ID of the flow object instance being referenced */
+ bcmbal_flow_type flow_type; /**< The type of the flow, Upstream, Downstream, Broadcast or Multicast */
+} bcmbal_flow_key;
+
+/** Structure definition for the "cfg" group of the "flow" object.
+ */
+typedef struct bcmbal_flow_cfg_data
+{
+ bcmbal_state admin_state; /**< Administrative state */
+ bcmbal_status oper_status; /**< Operational status */
+ bcmbal_intf_id access_int_id; /**< The ID of the subscriber side interface; i.e. PON */
+ bcmbal_intf_id network_int_id; /**< The ID of the network side interface; i.e. NNI */
+ bcmbal_sub_id sub_term_id; /**< The ID of the subsccriber terminal device */
+ uint8_t sub_term_uni_idx; /**< The index of the subsccriber terminal uni port the flow is related to */
+ bcmbal_service_port_id svc_port_id; /**< The ID of the service port (for GPON/XGPON - GEM ID) */
+ bcmbal_aggregation_port_id agg_port_id; /**< The ID of the aggregate port (for GPON/XGPON - ALLOC ID) */
+ bcmos_bool resolve_mac; /**< A flag indicating if the MAC address table should be used in DS GEM resolution */
+ bcmbal_classifier classifier; /**< The classifier for this flow */
+ bcmbal_action action; /**< The action associated with the flow */
+ bcmbal_sla sla; /**< SLA parameters for this flow */
+ bcmbal_cookie cookie; /**< Application cookie */
+ uint16_t priority; /**< Priority for this flow in case of multiple match. */
+ bcmbal_group_id group_id; /**< RW - The multicast group associated with this flow, valid for type MULTICAST only */
+ bcmbal_tm_queue_ref queue; /**< Egress queue */
+} bcmbal_flow_cfg_data;
+
+/** Transport message definition for "cfg" group of "flow" object.
+ */
+typedef struct bcmbal_flow_cfg
+{
+ bcmbal_cfg hdr; /**< Transport header. */
+ bcmbal_flow_key key; /**< Object key. */
+ bcmbal_flow_cfg_data data; /**< All properties that must be set by the user. */
+} bcmbal_flow_cfg;
+
+/** Structure definition for the "stat" group of the "flow" object.
+ */
+typedef struct bcmbal_flow_stat_data
+{
+ uint64_t rx_packets; /**< Received packets. */
+ uint64_t rx_bytes; /**< Received bytes. */
+ uint64_t tx_packets; /**< Transmitted packets. */
+ uint64_t tx_bytes; /**< Transmitted bytes. */
+} bcmbal_flow_stat_data;
+
+/** Transport message definition for "stat" group of "flow" object.
+ */
+typedef struct bcmbal_flow_stat
+{
+ bcmbal_stat hdr; /**< Transport header. */
+ bcmbal_flow_key key; /**< Object key. */
+ bcmbal_flow_stat_data data; /**< All properties that must be set by the user. */
+} bcmbal_flow_stat;
+
+/** Structure definition for the "ind" group of the "flow" object.
+ */
+typedef struct bcmbal_flow_ind_data
+{
+ bcmbal_state admin_state; /**< Administrative state */
+ bcmbal_status oper_status; /**< Operational Status */
+ uint16_t access_int_id; /**< The ID of the subscriber side interface; i.e. PON */
+ uint16_t network_int_id; /**< The ID of the network side interface; i.e. NNI */
+ uint32_t sub_term_id; /**< The ID of the subsccriber terminal device */
+ uint16_t svc_port_id; /**< The ID of the service port (for GPON/XGPON - GEM ID) */
+ uint16_t agg_port_id; /**< The ID of the aggregate port (for GPON/XGPON - ALLOC ID) */
+ bcmos_bool resolve_mac; /**< A flag indicating if the MAC address table should be used in DS GEM resolution */
+ uint16_t base_tc_id; /**< The base index of the TC object(s) to be used for this flow */
+ bcmbal_classifier classifier; /**< The classifier for this flow */
+ bcmbal_action action; /**< The action associated with the flow */
+ bcmbal_sla sla; /**< SLA parameters for this flow */
+ uint32_t cookie; /**< Application cookie */
+ uint16_t priority; /**< Priority for this flow in case of multiple match. */
+} bcmbal_flow_ind_data;
+
+/** Transport message definition for "ind" group of "flow" object.
+ */
+typedef struct bcmbal_flow_ind
+{
+ bcmbal_auto hdr; /**< Transport header. */
+ bcmbal_flow_key key; /**< Object key. */
+ bcmbal_flow_ind_data data; /**< All properties that must be set by the user. */
+} bcmbal_flow_ind;
+
+/** Structure definition for the "key" group of the "group" object.
+ */
+typedef struct bcmbal_group_key
+{
+ bcmbal_group_id group_id; /**< The ID of the group object instance being referenced */
+} bcmbal_group_key;
+
+/** Structure definition for the "cfg" group of the "group" object.
+ */
+typedef struct bcmbal_group_cfg_data
+{
+ bcmbal_group_member_cmd members_cmd; /**< Membership operation commands. */
+ bcmbal_group_member_info_list_u16 members; /**< The list of members associated with this group */
+ bcmbal_cookie cookie; /**< Application cookie */
+ bcmbal_flow_id_list_u32 flows; /**< List of flows associated with this group */
+ bcmbal_group_owner owner; /**< Owner of the group. */
+} bcmbal_group_cfg_data;
+
+/** Transport message definition for "cfg" group of "group" object.
+ */
+typedef struct bcmbal_group_cfg
+{
+ bcmbal_cfg hdr; /**< Transport header. */
+ bcmbal_group_key key; /**< Object key. */
+ bcmbal_group_cfg_data data; /**< All properties that must be set by the user. */
+} bcmbal_group_cfg;
+
+/** Structure definition for the "key" group of the "interface" object.
+ */
+typedef struct bcmbal_interface_key
+{
+ uint32_t intf_id; /**< intf_id. */
+ bcmbal_intf_type intf_type; /**< intf_type. */
+} bcmbal_interface_key;
+
+/** Structure definition for the "cfg" group of the "interface" object.
+ */
+typedef struct bcmbal_interface_cfg_data
+{
+ bcmbal_state admin_state; /**< Administrative state */
+ bcmbal_status oper_status; /**< Operational status */
+ bcmbal_aggregation_port_id min_data_agg_port_id; /**< The minimum agg_port_id that is allowed in the system */
+ bcmbal_service_port_id min_data_svc_port_id; /**< The minimum svc_port_id that is allowed in the system */
+ bcmbal_trx_type transceiver_type; /**< The transceiver type used on an interface */
+ bcmbal_ds_miss_mode ds_miss_mode; /**< Defines the action to take for unknown downstream packets */
+ uint16_t mtu; /**< The MTU for an interface */
+ bcmbal_control flow_control; /**< Flow control enable or disable */
+ bcmbal_tm_sched_id ds_tm; /**< Downstream scheduler and shaper */
+ bcmbal_tm_sched_id us_tm; /**< Upstream scheduler and shaper */
+ bcmbal_sub_id_list_u16 sub_term_id_list; /**< A list of subscriber terminal ids configured on this interface */
+} bcmbal_interface_cfg_data;
+
+/** Transport message definition for "cfg" group of "interface" object.
+ */
+typedef struct bcmbal_interface_cfg
+{
+ bcmbal_cfg hdr; /**< Transport header. */
+ bcmbal_interface_key key; /**< Object key. */
+ bcmbal_interface_cfg_data data; /**< All properties that must be set by the user. */
+} bcmbal_interface_cfg;
+
+/** Structure definition for the "stat" group of the "interface" object.
+ */
+typedef struct bcmbal_interface_stat_data
+{
+ uint64_t rx_packets; /**< Recieved packets. */
+ uint64_t rx_bytes; /**< Received bytes. */
+ uint64_t tx_packets; /**< Transmitted packets. */
+ uint64_t tx_bytes; /**< Transmitted bytes. */
+} bcmbal_interface_stat_data;
+
+/** Transport message definition for "stat" group of "interface" object.
+ */
+typedef struct bcmbal_interface_stat
+{
+ bcmbal_stat hdr; /**< Transport header. */
+ bcmbal_interface_key key; /**< Object key. */
+ bcmbal_interface_stat_data data; /**< All properties that must be set by the user. */
+} bcmbal_interface_stat;
+
+/** Structure definition for the "ind" group of the "interface" object.
+ */
+typedef struct bcmbal_interface_ind_data
+{
+ bcmbal_state admin_state; /**< Current administrative state */
+ bcmbal_status oper_status; /**< Current operational state */
+ uint16_t min_data_agg_port_id; /**< The minimum agg_port_id that is allowed in the system */
+ uint16_t min_data_svc_port_id; /**< The minimum svc_port_id that is allowed in the system */
+ bcmbal_trx_type transceiver_type; /**< The transceiver type used on an interface */
+ bcmbal_ds_miss_mode ds_miss_mode; /**< Defines the action to take for DS unknown packets */
+ uint16_t mtu; /**< The MTU for an interface */
+ bcmbal_control flow_control; /**< Flow control enable or disable */
+ bcmbal_tm_sched_id ds_tm; /**< Downstream scheduler and shaper */
+ bcmbal_tm_sched_id us_tm; /**< Upstream scheduler and shaper */
+} bcmbal_interface_ind_data;
+
+/** Transport message definition for "ind" group of "interface" object.
+ */
+typedef struct bcmbal_interface_ind
+{
+ bcmbal_auto hdr; /**< Transport header. */
+ bcmbal_interface_key key; /**< Object key. */
+ bcmbal_interface_ind_data data; /**< All properties that must be set by the user. */
+} bcmbal_interface_ind;
+
+/** Structure definition for the "key" group of the "packet" object.
+ */
+typedef struct bcmbal_packet_key
+{
+ uint32_t reserved; /**< Reserved key field. */
+ bcmbal_dest packet_send_dest; /**< Packet destination. */
+} bcmbal_packet_key;
+
+/** Structure definition for the "cfg" group of the "packet" object.
+ */
+typedef struct bcmbal_packet_cfg_data
+{
+ bcmbal_flow_id flow_id; /**< N/A for sending a packet */
+ bcmbal_flow_type flow_type; /**< Flow Type. */
+ bcmbal_intf_id intf_id; /**< Interface ID. */
+ bcmbal_intf_type intf_type; /**< Interface Type. */
+ bcmbal_service_port_id svc_port; /**< N/A for sending a packet */
+ bcmbal_cookie flow_cookie; /**< N/A for sending a packet */
+ bcmbal_u8_list_u32 pkt; /**< Packet Data. */
+} bcmbal_packet_cfg_data;
+
+/** Transport message definition for "cfg" group of "packet" object.
+ */
+typedef struct bcmbal_packet_cfg
+{
+ bcmbal_cfg hdr; /**< Transport header. */
+ bcmbal_packet_key key; /**< Object key. */
+ bcmbal_packet_cfg_data data; /**< All properties that must be set by the user. */
+} bcmbal_packet_cfg;
+
+/** Structure definition for the "ind" group of the "packet" object.
+ */
+typedef struct bcmbal_packet_ind_data
+{
+ bcmbal_flow_id flow_id; /**< N/A for sending a packet */
+ bcmbal_flow_type flow_type; /**< Flow Type. */
+ bcmbal_intf_id intf_id; /**< Interface ID. */
+ bcmbal_intf_type intf_type; /**< Interface Type. */
+ bcmbal_service_port_id svc_port; /**< N/A for sending a packet */
+ bcmbal_cookie flow_cookie; /**< N/A for sending a packet */
+ bcmbal_u8_list_u32 pkt; /**< Packet Data. */
+} bcmbal_packet_ind_data;
+
+/** Transport message definition for "ind" group of "packet" object.
+ */
+typedef struct bcmbal_packet_ind
+{
+ bcmbal_auto hdr; /**< Transport header. */
+ bcmbal_packet_key key; /**< Object key. */
+ bcmbal_packet_ind_data data; /**< All properties that must be set by the user. */
+} bcmbal_packet_ind;
+
+/** Structure definition for the "key" group of the "subscriber_terminal"
+ * object.
+ */
+typedef struct bcmbal_subscriber_terminal_key
+{
+ bcmbal_sub_id sub_term_id; /**< sub_term_id. */
+ bcmbal_intf_id intf_id; /**< intf_id. */
+} bcmbal_subscriber_terminal_key;
+
+/** Structure definition for the "cfg" group of the "subscriber_terminal"
+ * object.
+ */
+typedef struct bcmbal_subscriber_terminal_cfg_data
+{
+ bcmbal_state admin_state; /**< Administrative state */
+ bcmbal_status oper_status; /**< Operational status */
+ bcmbal_serial_number serial_number; /**< The serial number of an ITU PON (GPON/XG-PON1/XGS-PON/NG-PON2) subscriber terminal */
+ bcmbal_password password; /**< The password of a GPON subscriber terminal */
+ bcmbal_registration_id registration_id; /**< ONU registration ID of an ITU PON (XG-PON1/XGS-PON/NG-PON2) subscriber terminal */
+ bcmbal_service_port_id svc_port_id; /**< The management service port ID (for PON, the ONU ID) */
+ bcmos_mac_address mac_address; /**< The Ethernet MAC address of an EPON subscriber terminal */
+ bcmbal_tm_sched_id ds_tm; /**< Downstream scheduler and shaper */
+ bcmbal_tm_sched_id us_tm; /**< Upstream scheduler and shaper */
+ bcmbal_service_port_id_list_u8 svc_port_id_list; /**< A list of bearer traffic svc_port_ids associated with this subscriber terminal */
+ bcmbal_aggregation_port_id_list_u8 agg_port_id_list; /**< A list of aggr_port_ids associated with this subscriber terminal */
+} bcmbal_subscriber_terminal_cfg_data;
+
+/** Transport message definition for "cfg" group of "subscriber_terminal"
+ * object.
+ */
+typedef struct bcmbal_subscriber_terminal_cfg
+{
+ bcmbal_cfg hdr; /**< Transport header. */
+ bcmbal_subscriber_terminal_key key; /**< Object key. */
+ bcmbal_subscriber_terminal_cfg_data data; /**< All properties that must be set by the user. */
+} bcmbal_subscriber_terminal_cfg;
+
+/** Structure definition for the "stat" group of the "subscriber_terminal"
+ * object.
+ */
+typedef struct bcmbal_subscriber_terminal_stat_data
+{
+ uint64_t rx_packets; /**< Received packets on specified object */
+ uint64_t rx_bytes; /**< Received bytes on specified object */
+ uint64_t tx_packets; /**< Transmitted packets on specified object */
+ uint64_t tx_bytes; /**< Transmittted bytes on specified object */
+} bcmbal_subscriber_terminal_stat_data;
+
+/** Transport message definition for "stat" group of "subscriber_terminal"
+ * object.
+ */
+typedef struct bcmbal_subscriber_terminal_stat
+{
+ bcmbal_stat hdr; /**< Transport header. */
+ bcmbal_subscriber_terminal_key key; /**< Object key. */
+ bcmbal_subscriber_terminal_stat_data data; /**< All properties that must be set by the user. */
+} bcmbal_subscriber_terminal_stat;
+
+/** Structure definition for the "ind" group of the "subscriber_terminal"
+ * object.
+ */
+typedef struct bcmbal_subscriber_terminal_ind_data
+{
+ bcmbal_state admin_state; /**< Current administrative state */
+ bcmbal_status oper_status; /**< Current operational status */
+ bcmbal_serial_number serial_number; /**< The serial number of an ITU PON (GPON/XG-PON1/XGS-PON/NG-PON2) subscriber terminal */
+ bcmbal_password password; /**< The password of a GPON subscriber terminal */
+ bcmbal_registration_id registration_id; /**< ONU registration ID of an ITU PON (XG-PON1/XGS-PON/NG-PON2) subscriber terminal */
+ uint16_t svc_port_id; /**< The service port ID (for PON, the ONU ID) */
+ bcmos_mac_address mac_address; /**< The Ethernet MAC address of an epon subscriber terminal */
+ bcmbal_tm_sched_id ds_tm; /**< Downstream scheduler and shaper */
+ bcmbal_tm_sched_id us_tm; /**< Upstream scheduler and shaper */
+} bcmbal_subscriber_terminal_ind_data;
+
+/** Transport message definition for "ind" group of "subscriber_terminal"
+ * object.
+ */
+typedef struct bcmbal_subscriber_terminal_ind
+{
+ bcmbal_auto hdr; /**< Transport header. */
+ bcmbal_subscriber_terminal_key key; /**< Object key. */
+ bcmbal_subscriber_terminal_ind_data data; /**< All properties that must be set by the user. */
+} bcmbal_subscriber_terminal_ind;
+
+/** Structure definition for the "key" group of the "tm_queue" object.
+ */
+typedef struct bcmbal_tm_queue_key
+{
+ bcmbal_tm_sched_id sched_id; /**< Scheduler that owns the queue */
+ bcmbal_tm_sched_dir sched_dir; /**< sched dir. */
+ bcmbal_tm_queue_id id; /**< Queue id */
+} bcmbal_tm_queue_key;
+
+/** Structure definition for the "cfg" group of the "tm_queue" object.
+ */
+typedef struct bcmbal_tm_queue_cfg_data
+{
+ bcmbal_tm_priority priority; /**< Scheduling priority */
+ bcmbal_tm_weight weight; /**< Scheduling weight */
+ bcmbal_tm_shaping rate; /**< Rate shaping parameters */
+ bcmbal_tm_bac bac; /**< Buffer admission control */
+ bcmbal_tm_creation_mode creation_mode; /**< Creation mode */
+ uint8_t ref_count; /**< reference count (flows) */
+} bcmbal_tm_queue_cfg_data;
+
+/** Transport message definition for "cfg" group of "tm_queue" object.
+ */
+typedef struct bcmbal_tm_queue_cfg
+{
+ bcmbal_cfg hdr; /**< Transport header. */
+ bcmbal_tm_queue_key key; /**< Object key. */
+ bcmbal_tm_queue_cfg_data data; /**< All properties that must be set by the user. */
+} bcmbal_tm_queue_cfg;
+
+/** Structure definition for the "stat" group of the "tm_queue" object.
+ */
+typedef struct bcmbal_tm_queue_stat_data
+{
+ uint64_t packets_ok; /**< Packets transmitted succewssfully */
+ uint64_t bytes_ok; /**< Bytes transmitted successfully */
+ uint64_t packets_discarded; /**< Packets discarded */
+ uint64_t bytes_discarded; /**< Bytes discarded */
+} bcmbal_tm_queue_stat_data;
+
+/** Transport message definition for "stat" group of "tm_queue" object.
+ */
+typedef struct bcmbal_tm_queue_stat
+{
+ bcmbal_stat hdr; /**< Transport header. */
+ bcmbal_tm_queue_key key; /**< Object key. */
+ bcmbal_tm_queue_stat_data data; /**< All properties that must be set by the user. */
+} bcmbal_tm_queue_stat;
+
+/** Structure definition for the "ind" group of the "tm_queue" object.
+ *
+ * Tm Queue Indication
+ */
+typedef struct bcmbal_tm_queue_ind_data
+{
+ uint32_t ret; /**< ret */
+} bcmbal_tm_queue_ind_data;
+
+/** Transport message definition for "ind" group of "tm_queue" object.
+ */
+typedef struct bcmbal_tm_queue_ind
+{
+ bcmbal_auto hdr; /**< Transport header. */
+ bcmbal_tm_queue_key key; /**< Object key. */
+ bcmbal_tm_queue_ind_data data; /**< All properties that must be set by the user. */
+} bcmbal_tm_queue_ind;
+
+/** Structure definition for the "key" group of the "tm_sched" object.
+ */
+typedef struct bcmbal_tm_sched_key
+{
+ bcmbal_tm_sched_dir dir; /**< Traffic direction */
+ bcmbal_tm_sched_id id; /**< ID */
+} bcmbal_tm_sched_key;
+
+/** Structure definition for the "cfg" group of the "tm_sched" object.
+ */
+typedef struct bcmbal_tm_sched_cfg_data
+{
+ bcmbal_tm_sched_owner owner; /**< owner. */
+ bcmbal_tm_sched_type sched_type; /**< Scheduler type */
+ bcmbal_tm_sched_parent sched_parent; /**< Scheduling parameters for parent scheduler */
+ bcmbal_tm_sched_child_type sched_child_type; /**< Scheduling level for children tm */
+ bcmbal_tm_shaping rate; /**< Rate shaping parameters */
+ bcmbal_tm_tcont_sla tcont_sla; /**< Additional SLA parameters for agg_port owner */
+ bcmbal_tm_creation_mode creation_mode; /**< Creation mode */
+ bcmbal_tm_queue_id_list_u8 queues; /**< Subsidiary queues */
+ bcmbal_tm_sched_id_list_u8 sub_scheds; /**< Subsidiary schedulers */
+ uint8_t num_priorities; /**< Max number of strict priority scheduling elements */
+} bcmbal_tm_sched_cfg_data;
+
+/** Transport message definition for "cfg" group of "tm_sched" object.
+ */
+typedef struct bcmbal_tm_sched_cfg
+{
+ bcmbal_cfg hdr; /**< Transport header. */
+ bcmbal_tm_sched_key key; /**< Object key. */
+ bcmbal_tm_sched_cfg_data data; /**< All properties that must be set by the user. */
+} bcmbal_tm_sched_cfg;
+
+/** Structure definition for the "ind" group of the "tm_sched" object.
+ *
+ * Tm Sched Indication
+ */
+typedef struct bcmbal_tm_sched_ind_data
+{
+ uint32_t ret; /**< ret */
+} bcmbal_tm_sched_ind_data;
+
+/** Transport message definition for "ind" group of "tm_sched" object.
+ */
+typedef struct bcmbal_tm_sched_ind
+{
+ bcmbal_auto hdr; /**< Transport header. */
+ bcmbal_tm_sched_key key; /**< Object key. */
+ bcmbal_tm_sched_ind_data data; /**< All properties that must be set by the user. */
+} bcmbal_tm_sched_ind;
+
+/** @} */
+#endif /* BAL_MODEL_TYPES */
diff --git a/bal_release/src/common/include/bal_msg.h b/bal_release/src/common/include/bal_msg.h
new file mode 100644
index 0000000..4ea85c5
--- /dev/null
+++ b/bal_release/src/common/include/bal_msg.h
@@ -0,0 +1,349 @@
+/******************************************************************************
+ *
+ * <: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.
+ *
+ * :>
+ *
+ *****************************************************************************/
+
+/* Define the top level Doxygen groups. */
+
+/**
+ * @defgroup core BAL Core Engine
+ *
+ * @defgroup apps BAL Utils
+ *
+ * @defgroup lib BAL Libraries
+ *
+ */
+
+/**
+ * @file bal_msg.h
+ *
+ * @brief Include files and miscellaneous macros for the BAL messaging
+ *
+ */
+
+#ifndef BALMSG_H
+#define BALMSG_H
+
+#include <bal_objs.h>
+#include <bal_msg_type.h>
+
+
+/*******************************************************************
+ **
+ ** BAL message header helpers
+ **
+ *******************************************************************
+ */
+
+/*
+ * Underlying msg_send timeout units in uS (micro seconds)
+ */
+#define BCMBAL_MSG_TIMEOUT_1_SEC (1000000)
+
+/*
+ * Get a pointer to the message payload given the bcmos_msg pointer
+ */
+static inline void *bcmbal_payload_ptr_get(bal_comm_msg_hdr *_m)
+{
+ /* payload starts from BAL communication header */
+ return (void *)_m;
+}
+
+/*
+ * Get a pointer to the BAL header given the message payload pointer
+ */
+static inline bal_comm_msg_hdr *bcmbal_bal_hdr_get(void *_msg_payload_ptr)
+{
+ /* payload starts from BAL communication header */
+ return (bal_comm_msg_hdr *)_msg_payload_ptr;
+}
+
+/*
+ * Get a pointer to the BAL header given the bcmos header pointer
+ */
+static inline bal_comm_msg_hdr *bcmbal_bal_hdr_get_by_bcmos_hdr(bcmos_msg *m)
+{
+ return container_of(m, bal_comm_msg_hdr, m);
+}
+
+/*
+ * Get a pointer to the BCMOS header given the message payload pointer
+ */
+static inline bcmos_msg *bcmbal_bcmos_hdr_get(void *_msg_payload_ptr)
+{
+ return &(bcmbal_bal_hdr_get(_msg_payload_ptr)->m);
+}
+
+/*
+ * Set the BAL header parameters given the message payload pointer
+ */
+static inline void bcmbal_msg_hdr_set(void *_msg_payload_ptr,
+ bcmos_msg_id _type_major,
+ bcmbal_msg_type _type_minor,
+ bal_subsystem _sender_subsys,
+ bcmbal_obj_id _msg_id_obj,
+ uint16_t _msg_id_oper,
+ uint32_t _ex_id)
+{
+ bcmos_msg *os_msg = bcmbal_bcmos_hdr_get(_msg_payload_ptr);
+ bal_comm_msg_hdr *bal_hdr = bcmbal_bal_hdr_get(_msg_payload_ptr);
+
+ /*
+ * set up the bcmos_msg header fields
+ */
+ os_msg->data = (void *)((char *)(bcmbal_bcmos_hdr_get(_msg_payload_ptr)) + sizeof(bcmos_msg));
+ os_msg->start = os_msg->data;
+ os_msg->type = _type_major;
+ os_msg->instance = 0;
+ os_msg->sender = BCMOS_MODULE_ID_NONE; /* doesn't matter */
+
+ /*
+ * set up the bal msg header fields
+ */
+ bal_hdr->version_major = BAL_HDR_VERSION_MAJOR;
+ bal_hdr->version_minor = BAL_HDR_VERSION_MINOR;
+ bal_hdr->msg_type = _type_minor;
+ bal_hdr->msg_id = ((bal_hdr->msg_id & 0x0000FFFF) | ((_msg_id_oper & 0x0000FFFF) << 16));
+ bal_hdr->msg_id = ((bal_hdr->msg_id & 0xFFFF0000) | (_msg_id_obj & 0x0000FFFF));
+ bal_hdr->ex_id = _ex_id;
+ bal_hdr->sender = _sender_subsys;
+ bal_hdr->timestamp = bcmos_timestamp();
+}
+
+/*
+ * Get the sender field in the BAL header given the message pointer
+ */
+static inline bal_subsystem bcmbal_sender_get(void *_msg_payload_ptr)
+{
+ return bcmbal_bal_hdr_get(_msg_payload_ptr)->sender;
+}
+
+/*
+ * Set the sender field in the BAL header given the message pointer
+ */
+static inline void bcmbal_sender_set(void *_msg_payload_ptr, bal_subsystem _sender_subsys)
+{
+ bcmbal_bal_hdr_get(_msg_payload_ptr)->sender = _sender_subsys;
+}
+
+/*
+ * Get the top level type field in the BAL header given the message pointer
+ */
+static inline bcmos_msg_id bcmbal_type_major_get(void *_msg_payload_ptr)
+{
+ return bcmbal_bcmos_hdr_get(_msg_payload_ptr)->type;
+}
+
+/*
+ * Set the top level type field in the BAL header given the message pointer
+ */
+static inline void bcmbal_type_major_set(void *_msg_payload_ptr, bcmos_msg_id _type_major)
+{
+ bcmbal_bcmos_hdr_get(_msg_payload_ptr)->type = _type_major;
+}
+
+/*
+ * Get the inner type field in the BAL header given the message pointer
+ */
+static inline bcmbal_msg_type bcmbal_type_minor_get(void *_msg_payload_ptr)
+{
+ return bcmbal_bal_hdr_get(_msg_payload_ptr)->msg_type;
+}
+
+/*
+ * Set the inner type field in the BAL header given the message pointer
+ */
+static inline void bcmbal_type_minor_set(void *_msg_payload_ptr, bcmbal_msg_type _type_minor)
+{
+ bcmbal_bal_hdr_get(_msg_payload_ptr)->msg_type = _type_minor;
+}
+
+
+/*
+ * Get the msg_id_oper field in the BAL header given the message pointer
+ */
+static inline uint16_t bcmbal_msg_id_oper_get(void *_msg_payload_ptr)
+{
+ return ((bcmbal_bal_hdr_get(_msg_payload_ptr)->msg_id & 0xFFFF0000) >> 16);
+}
+
+/*
+ * Set the msg_id_oper field in the BAL header given the message pointer
+ */
+static inline void bcmbal_msg_id_oper_set(void *_msg_payload_ptr, uint16_t _msg_id_oper)
+{
+ bcmbal_bal_hdr_get(_msg_payload_ptr)->msg_id =
+ ((bcmbal_bal_hdr_get(_msg_payload_ptr)->msg_id & 0x0000FFFF) | ((_msg_id_oper & 0x0000FFFF) << 16));
+}
+
+/*
+ * Get the msg_id_obj field in the BAL header given the message pointer
+ */
+static inline bcmbal_obj_id bcmbal_msg_id_obj_get(void *_msg_payload_ptr)
+{
+ return (bcmbal_bal_hdr_get(_msg_payload_ptr)->msg_id & 0x0000FFFF );
+}
+
+/*
+ * Set the msg_id_obj field in the BAL header given the message pointer
+ */
+static inline void bcmbal_msg_id_obj_set(void *_msg_payload_ptr, bcmbal_obj_id _msg_id_obj)
+{
+ bcmbal_bal_hdr_get(_msg_payload_ptr)->msg_id =
+ ((bcmbal_bal_hdr_get(_msg_payload_ptr)->msg_id & 0xFFFF0000) | (_msg_id_obj & 0x0000FFFF));
+}
+
+/*
+ * Get the ex_id field in the BAL header given the message pointer
+ */
+static inline uint32_t bcmbal_ex_id_get(void *_msg_payload_ptr)
+{
+ return bcmbal_bal_hdr_get(_msg_payload_ptr)->ex_id;
+}
+
+/*
+ * Set the ex_id field in the BAL header given the message pointer
+ */
+static inline void bcmbal_ex_id_set(void *_msg_payload_ptr, uint32_t _ex_id)
+{
+ bcmbal_bal_hdr_get(_msg_payload_ptr)->ex_id = _ex_id;
+}
+
+/*
+ * Get the major version field in the BAL header given the message pointer
+ */
+static inline uint16_t bcmbal_major_version_get(void *_msg_payload_ptr)
+{
+ return bcmbal_bal_hdr_get(_msg_payload_ptr)->version_major;
+}
+
+/*
+ * Set the major version field in the BAL header given the message pointer
+ */
+static inline void bcmbal_major_version_set(void *_msg_payload_ptr, uint16_t _version_major)
+{
+ bcmbal_bal_hdr_get(_msg_payload_ptr)->version_major = _version_major;
+}
+
+/*
+ * Get the minor version field in the BAL header given the message pointer
+ */
+static inline uint16_t bcmbal_minor_version_get(void *_msg_payload_ptr)
+{
+ return bcmbal_bal_hdr_get(_msg_payload_ptr)->version_minor;
+}
+
+/*
+ * Set the minor version field in the BAL header given the message pointer
+ */
+static inline void bcmbal_minor_version_set(void *_msg_payload_ptr, uint16_t _version_major)
+{
+ bcmbal_bal_hdr_get(_msg_payload_ptr)->version_major = _version_major;
+}
+
+/*
+ * Get the scratchpad field in the BAL header given the message pointer
+ */
+static inline void *bcmbal_scratchpad_get(void *_msg_payload_ptr)
+{
+ return bcmbal_bal_hdr_get(_msg_payload_ptr)->scratchpad;
+}
+
+/*
+ * Set the scratchpad field in the BAL header given the message pointer
+ */
+static inline void bcmbal_scratchpad_set(void *_msg_payload_ptr, void *_scratchpad)
+{
+ bcmbal_bal_hdr_get(_msg_payload_ptr)->scratchpad = _scratchpad;
+}
+
+/*
+ * Allocate a BAL message given the payload pointer
+ */
+static inline void *bcmbal_msg_calloc(uint32_t _msg_payload_size)
+{
+ /* Payload includes comm header */
+ bal_comm_msg_hdr *m = bcmos_calloc(_msg_payload_size);
+ if (NULL == m)
+ return NULL;
+ return bcmbal_payload_ptr_get(m);
+}
+
+/*
+ * Free a BAL message given the payload pointer
+ */
+static inline void bcmbal_msg_free(void *msg)
+{
+ return bcmos_msg_free(bcmbal_bcmos_hdr_get(msg));
+}
+
+/*
+ * External functions implemented in bal_msg.c
+ */
+
+/*
+ * Clone BAL message
+ * Returns payload_ptr of the clone
+ */
+void *bcmbal_msg_clone(void *bal_obj);
+
+/*
+ * 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);
+
+/*
+ * 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);
+
+/*
+ * Receive a BAL message given the payload pointer
+ *
+ * NOTE: The timeout argument is in units of uS (micro seconds). Use the #defined timeout values above.
+ *
+ */
+bcmos_errno bcmbal_msg_recv(bcmos_msg_queue *queue, uint32_t timeout, void **msg_payload);
+
+/** Get packed bal_comm_msg_hdr length */
+int32_t bcmbal_bal_msg_hdr_get_packed_length(void);
+
+/** 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);
+
+/** Unpack a BAL message header from a byte stream */
+bcmos_errno bcmbal_bal_msg_hdr_unpack(bal_comm_msg_hdr *msg, bcmbal_buf *buf);
+
+/** Peek exchange_id in the received message without unpacking */
+bcmos_errno bcmbal_bal_msg_peek_ex_id(bcmos_msg *msg, uint32_t *ex_id);
+
+#endif /* #ifndef BALMSG_H */
+
+
+
diff --git a/bal_release/src/common/include/bal_msg_type.h b/bal_release/src/common/include/bal_msg_type.h
new file mode 100644
index 0000000..38e98c6
--- /dev/null
+++ b/bal_release/src/common/include/bal_msg_type.h
@@ -0,0 +1,57 @@
+/******************************************************************************
+ *
+ * <: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 _BAL_MSG_TYPE_H_
+#define _BAL_MSG_TYPE_H_
+
+/*
+ * * The BAL message subtype
+ * */
+typedef enum
+{
+ BAL_MSG_TYPE_REQ,
+ BAL_MSG_TYPE_RSP,
+ BAL_MSG_TYPE_ACK,
+ BAL_MSG_TYPE_IND, /**< An INDication message generated as a part of a protocol exchange */
+ BAL_MSG_TYPE_AUTO_IND, /**< An asynchronous autonomous INDication message */
+} bcmbal_msg_type;
+
+static __attribute__ ((unused)) char *bcmbal_msg_t_str[] =
+{
+ "BAL_MSG_REQ",
+ "BAL_MSG_RSP",
+ "BAL_MSG_ACK",
+ "BAL_MSG_IND", /**< An INDication message generated as a part of a protocol exchange */
+ "BAL_MSG_AUTO_IND" /**< An asynchronous autonomous INDication message */
+};
+
+
+#endif
diff --git a/bal_release/src/common/include/bal_obj.h b/bal_release/src/common/include/bal_obj.h
new file mode 100644
index 0000000..24e8ec2
--- /dev/null
+++ b/bal_release/src/common/include/bal_obj.h
@@ -0,0 +1,205 @@
+#ifndef BAL_OBJ
+#define BAL_OBJ
+
+#include <bcmos_system.h>
+#include <bcmos_errno.h>
+#include "bal_model_ids.h"
+#include "bal_buf.h"
+#include "bal_msg_type.h"
+
+/*
+ * The current BAL header version
+ */
+#define BAL_HDR_VERSION_MAJOR (1)
+#define BAL_HDR_VERSION_MINOR (1)
+
+/*
+ * The BAL common message header
+ */
+typedef struct bal_comm_msg_hdr
+{
+ bcmos_msg m; /**< bcmos message header */
+ uint16_t version_major; /**< Header Major version number */
+ uint16_t version_minor; /**< Header Minor version number */
+ bcmbal_msg_type msg_type; /**< Request / Response / Ack / Indication */
+ uint32_t msg_id; /**< Message ID – the ID of the message (subID under the message type) */
+ uint32_t ex_id; /**< Exchange ID for message tracking between endpoints */
+ bal_subsystem sender; /**< Sender subsystem - used for additional validation */
+ uint32_t timestamp; /**< Timestamp when the message was sent */
+ bcmos_sem sem; /**< Semaphore used for inter-thread communication */
+ void* scratchpad; /**< Scratchpad used for inter-thread communication */
+ uint8_t payload[]; /**< Payload follows the header */
+} bal_comm_msg_hdr;
+
+/** Version of Object definitions */
+#define BCMBAL_OBJ_VERSION 2 /**< The current version number */
+typedef uint32_t bcmbal_object_ver; /**< The attribute type in the object info structure */
+
+/** Bitmask of object attributes that are specified in an object (1 = specified, 0 = not specified) */
+typedef uint64_t bcmbal_presence_mask;
+
+/** Presence mask indicating all fields present */
+#define BCMBAL_PRESENCE_MASK_ALL ((bcmbal_presence_mask)0xFFFFFFFFFFFFFFFF)
+
+/** Helper type to determine what the data format of a message should look like */
+typedef enum bcmbal_mgt_group
+{
+ BCMBAL_MGT_GROUP_KEY, /**< Key that uniquely identifies object instance */
+ BCMBAL_MGT_GROUP_CFG, /**< Configuration (get/set/clear) */
+ BCMBAL_MGT_GROUP_STAT, /**< Statistics */
+ BCMBAL_MGT_GROUP_AUTO, /**< Autonomous indications */
+ BCMBAL_MGT_GROUP_AUTO_CFG, /**< Autonomous indication configuration */
+ BCMBAL_MGT_GROUP__NUM_OF
+} bcmbal_mgt_group;
+
+/** Object message type. Can be a combination of flags. */
+typedef enum bcmbal_obj_msg_type
+{
+ BCMBAL_OBJ_MSG_TYPE_GET = 0x01, /**< Get configuration parameters */
+ BCMBAL_OBJ_MSG_TYPE_SET = 0x02, /**< Set configuration parameters */
+ BCMBAL_OBJ_MSG_TYPE_CLEAR = 0x04, /**< Clear configuration parameters */
+} bcmbal_obj_msg_type;
+
+/** Object message direction - request or response. */
+typedef enum bcmbal_obj_msg_dir
+{
+ BCMBAL_OBJ_MSG_DIR_REQUEST,
+ BCMBAL_OBJ_MSG_DIR_RESPONSE
+} bcmbal_obj_msg_dir;
+
+#define BCMBAL_OBJ_INIT_VAL 0xdeadbeef /**< The value of the obj_init_val after macro initialization */
+
+/** Information common to all BAL objects */
+typedef struct bcmbal_obj
+{
+ bal_comm_msg_hdr comm_hdr; /**< Communication header */
+ bcmbal_object_ver version; /**< Version of the Object definition/structure */
+ bcmbal_obj_id obj_type; /**< An enumerated ID associated with the object being specified */
+ bcmbal_mgt_group group; /**< Management group */
+ uint16_t subgroup; /**< Subgroup for indications */
+ bcmbal_obj_msg_type type; /**< Type (e.g. get / set / clear) */
+ bcmbal_obj_msg_dir dir; /**< Direction - request / response */
+ bcmos_errno status; /**< BAL status code (BCM_ERR_OK–success, error code otherwise) */
+ bcmbal_presence_mask presence_mask; /**< Indicates which attribute parameters are present */
+
+ /* The following fields are internal. They are not sent on the line */
+ bcmos_bool is_inprogress; /**< RO - When set to TRUE: Object is changing state internally */
+ void *list_buf; /**< Memory buffer in which to store variable-sized lists when unpacking */
+ uint32_t list_buf_size; /**< Number of bytes in the variable-sized list buffer */
+ uint32_t obj_init_val; /**< An field that is set on INIT macro call, and checked by the API */
+} bcmbal_obj;
+
+/** Information structure for use with BAL configuration API (get/set/clear) */
+typedef struct bcmbal_cfg
+{
+ bcmbal_obj hdr;
+} bcmbal_cfg;
+
+/** Information structure for BAL statistics API */
+typedef struct bcmbal_stat
+{
+ bcmbal_obj hdr;
+} bcmbal_stat;
+
+/** Information structure for BAL indications */
+typedef struct bcmbal_auto
+{
+ bcmbal_obj hdr;
+} bcmbal_auto;
+
+/** Information structure for BAL indication configuration API */
+typedef struct bcmbal_auto_cfg
+{
+ bcmbal_obj hdr;
+} bcmbal_auto_cfg;
+
+/** Whether we pack the entire structure of a message */
+static inline bcmos_bool bcmbal_obj_msg_should_pack_data(const bcmbal_obj *msg)
+{
+ switch (msg->group)
+ {
+ case BCMBAL_MGT_GROUP_CFG:
+ case BCMBAL_MGT_GROUP_STAT:
+ case BCMBAL_MGT_GROUP_AUTO_CFG:
+ if ((msg->type & BCMBAL_OBJ_MSG_TYPE_GET))
+ {
+ return (msg->dir == BCMBAL_OBJ_MSG_DIR_RESPONSE);
+ }
+ else if ((msg->type & BCMBAL_OBJ_MSG_TYPE_SET))
+ {
+ return (msg->dir == BCMBAL_OBJ_MSG_DIR_REQUEST);
+ }
+ else
+ {
+ return BCMOS_FALSE;
+ }
+
+ default:
+ return BCMOS_TRUE;
+ }
+}
+
+/** Get the packed length of the header portion of an object message */
+static inline int32_t bcmbal_obj_msg_hdr_get_packed_length(void)
+{
+ return 24;
+}
+
+/** Pack a message header to a byte stream */
+static inline bcmos_errno bcmbal_obj_msg_hdr_pack(const bcmbal_obj *msg, bcmbal_buf *buf)
+{
+ bcmos_bool ret;
+
+ ret = bcmbal_buf_write_u32(buf, (uint32_t)msg->version);
+ ret = ret && bcmbal_buf_write_u8(buf, (uint32_t)msg->obj_type);
+ ret = ret && bcmbal_buf_write_u8(buf, (uint8_t)msg->group);
+ ret = ret && bcmbal_buf_write_u16(buf, msg->subgroup);
+ ret = ret && bcmbal_buf_write_u8(buf, (uint8_t)msg->type);
+ ret = ret && bcmbal_buf_write_u8(buf, (uint8_t)msg->dir);
+ ret = ret && bcmbal_buf_write_s16(buf, (int16_t)msg->status);
+ ret = ret && bcmbal_buf_write_u32(buf, (int32_t)msg->is_inprogress);
+ ret = ret && bcmbal_buf_write_u64(buf, (uint64_t)msg->presence_mask);
+
+ return ret ? BCM_ERR_OK : BCM_ERR_OVERFLOW;
+}
+
+/** Unpack a message header from a byte stream */
+static inline bcmos_errno bcmbal_obj_msg_hdr_unpack(bcmbal_obj *msg, bcmbal_buf *buf)
+{
+ uint32_t version;
+ uint8_t obj_type;
+ uint8_t group;
+ uint16_t subgroup;
+ uint8_t type;
+ uint8_t dir;
+ int16_t status;
+ uint32_t is_inprogress;
+ uint64_t presence_mask;
+ bcmos_bool ret;
+
+ ret = bcmbal_buf_read_u32(buf, &version);
+ ret = ret && bcmbal_buf_read_u8(buf, &obj_type);
+ ret = ret && bcmbal_buf_read_u8(buf, &group);
+ ret = ret && bcmbal_buf_read_u16(buf, &subgroup);
+ ret = ret && bcmbal_buf_read_u8(buf, &type);
+ ret = ret && bcmbal_buf_read_u8(buf, &dir);
+ ret = ret && bcmbal_buf_read_s16(buf, &status);
+ ret = ret && bcmbal_buf_read_u32(buf, &is_inprogress);
+ ret = ret && bcmbal_buf_read_u64(buf, &presence_mask);
+ if (ret)
+ {
+ msg->version = (bcmbal_object_ver)version;
+ msg->obj_type = (bcmbal_obj_id)obj_type;
+ msg->group = (bcmbal_mgt_group)group;
+ msg->subgroup = subgroup;
+ msg->type = (bcmbal_obj_msg_type)type;
+ msg->dir = (bcmbal_obj_msg_dir)dir;
+ msg->status = (bcmos_errno)status;
+ msg->is_inprogress = (bcmos_bool)is_inprogress;
+ msg->presence_mask = (bcmbal_presence_mask)presence_mask;
+ }
+
+ return ret ? BCM_ERR_OK : BCM_ERR_OVERFLOW;
+}
+
+#endif /* BAL_OBJ */
diff --git a/bal_release/src/common/include/bal_objs.h b/bal_release/src/common/include/bal_objs.h
new file mode 100644
index 0000000..6a13cce
--- /dev/null
+++ b/bal_release/src/common/include/bal_objs.h
@@ -0,0 +1,985 @@
+/******************************************************************************
+ *
+ * <: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_objs.h
+ * @brief The file provides an enumeration of all BAL objects
+ *
+ */
+#ifndef BALOBJS_H
+#define BALOBJS_H
+
+#include <bcmolt_host_api.h>
+#include "bal_common.h"
+#include "bal_model_ids.h"
+#include "bal_model_types.h"
+
+/** \ingroup api
+ * @{
+ */
+
+static char *bal_obj_str[] =
+{
+ [bcmbal_obj_id_access_terminal] = "access_terminal object",
+ [bcmbal_obj_id_interface] = "interface object",
+ [bcmbal_obj_id_subscriber_terminal] = "subscriber_terminal object",
+ [bcmbal_obj_id_flow] = "flow object",
+ [bcmbal_obj_id_packet] = "packet object",
+ [bcmbal_obj_id_group] = "group object",
+ [bcmbal_obj_id_tm_sched] = "scheduler object",
+ [bcmbal_obj_id_tm_queue] = "queue object",
+};
+
+/* Ensure that the name array size matches the associated enum */
+BAL_STATIC_ASSERT (BCMBAL_OBJ_ID__NUM_OF == (sizeof (bal_obj_str) / sizeof (char *)), bcmbal_obj_id);
+
+static inline char *bcmbal_objtype_str(bcmbal_obj_id obj)
+{
+ return (BCMBAL_OBJ_ID__NUM_OF >= obj) ? bal_obj_str[obj] : "unknown";
+}
+
+#define BCMBAL_FLOW_PRIORITY_MAX 65535
+#define BCMBAL_FLOW_PRIORITY_MIN 0
+#define BAL_FLOW_DEFAULT_PRIORITY 10
+
+/*
+ * ------------------------------------------------------------------
+ *
+ * Internal BCMBAL macros used to manipulate the BAL object elements
+ *
+ * ------------------------------------------------------------------
+ */
+
+/* Initialize request. Internal macro
+ * \ingroup api
+ * \param[in] _h Message header
+ * \param[in] _obj Object name (i.e. flow)
+ * \param[in] _grp message type
+ * \param[in] _subgrp message subgroup
+ */
+#define _BCMBAL_REQ_INIT(_h, _obj, _grp, _subgrp) \
+ (_h)->obj_init_val = BCMBAL_OBJ_INIT_VAL; \
+ (_h)->version = BCMBAL_OBJ_VERSION; \
+ (_h)->status = BCM_ERR_OK; \
+ (_h)->presence_mask = 0; \
+ (_h)->obj_type = bcmbal_obj_id_ ## _obj; \
+ (_h)->group = _grp; \
+ (_h)->subgroup = _subgrp;
+
+/** Initialize set structure
+ * \ingroup api
+ * \param[in] _s Set structure
+ * \param[in] _obj Object name (i.e. flow)
+ * \param[in] _key Object key
+ */
+#define BCMBAL_CFG_INIT(_s, _obj, _key) \
+ do { \
+ bcmbal_ ## _obj ## _cfg *_x_ = _s; \
+ memset(_x_, 0, sizeof(*_x_)); \
+ _BCMBAL_REQ_INIT(&((_x_)->hdr.hdr), _obj, BCMBAL_MGT_GROUP_CFG, 0); \
+ (_x_)->key = _key; \
+ } while (0)
+
+/** Initialize statistics structure
+ * \ingroup api
+ * \param[in] _s Statistics structure
+ * \param[in] _obj Object name (i.e. flow)
+ * \param[in] _key Object key
+ */
+#define BCMBAL_STAT_INIT(_s, _obj, _key) \
+ do { \
+ bcmbal_ ## _obj ## _stat *_x_ = _s; \
+ memset(_x_, 0, sizeof(*_x_)); \
+ _BCMBAL_REQ_INIT(&((_x_)->hdr.hdr), _obj, BCMBAL_MGT_GROUP_STAT, 0); \
+ (_x_)->key = _key; \
+ } while (0)
+
+/** Set the memory buffer to use for variable-sized lists within a cfg get
+ * \ingroup api
+ * \param[in] _s Configuration structure
+ * \param[in] _obj Object type
+ * \param[in] _buf Pointer to a location in memory in which to store the lists
+ * \param[in] _len Length of the buffer pointed to by _buf
+ */
+#define BCMBAL_CFG_LIST_BUF_SET(_s, _obj, _buf, _len) \
+ do { \
+ bcmbal_ ## _obj ## _cfg *_x_ = _s; \
+ _x_->hdr.hdr.list_buf = _buf; \
+ _x_->hdr.hdr.list_buf_size = _len; \
+ } while (0)
+
+/* Set the object progress state
+ * \ingroup api
+ * \param[in] _s Object structure
+ * \param[in] _p New object in-progress state: BCMOS_TRUE, or BCMOS_FALSE
+ */
+#define BCMBAL_OBJ_IN_PROGRESS_SET(_s, _p) ((_s)->hdr.hdr.is_inprogress = _p )
+
+/* Return the object progress state
+ * \ingroup api
+ * \param[in] _s Object structure
+ */
+#define BCMBAL_OBJ_IN_PROGRESS_GET(_s) ((_s)->hdr.hdr.is_inprogress)
+
+/* Internal macro: Get a bitmask given a property ID enum */
+#define BCMBAL_PROP_MASK_GET(_obj, _grp, _p) \
+ (bcmbal_ ## _obj ## _grp ## _id_ ## _p == bcmbal_ ## _obj ## _grp ## _id_all_properties ? \
+ ((1ULL << (uint64_t)bcmbal_ ## _obj ## _grp ## _id_ ## _p) - 1) : \
+ (1ULL << (uint64_t)bcmbal_ ## _obj ## _grp ## _id_ ## _p))
+
+
+/* Macro: Indicate that configuration property is present - USE WITH CAUTION */
+#define BCMBAL_PROP_SET_PRESENT(_m, _obj, _grp, _p) \
+ do { \
+ (_m)->hdr.hdr.presence_mask |= BCMBAL_PROP_MASK_GET(_obj, _grp, _p); \
+ } while (0)
+
+/* Internal macro: Indicate that configuration property is not present */
+#define BCMBAL_PROP_CLEAR_PRESENT(_m, _obj, _grp, _p) \
+ do { \
+ (_m)->hdr.hdr.presence_mask &= ~(BCMBAL_PROP_MASK_GET(_obj, _grp, _p));\
+ } while (0)
+
+/* Internal macro: check if property is present */
+#define _BCMBAL_PROP_IS_PRESENT(_m, _obj, _grp, _p) \
+ (((_m)->hdr.hdr.presence_mask & BCMBAL_PROP_MASK_GET(_obj, _grp, _p)) ? \
+ BCMOS_TRUE : BCMOS_FALSE)
+
+/** Set configuration property in message structure
+ * \ingroup api
+ * \param[in] _m Configuration structure
+ * \param[in] _obj Object type
+ * \param[in] _p Property name
+ * \param[in] _v Property value
+ */
+#define BCMBAL_CFG_PROP_SET(_m, _obj, _p, _v) \
+ do { \
+ BCMBAL_PROP_SET_PRESENT(_m, _obj, _cfg, _p);\
+ (_m)->data._p = (_v);\
+ } while (0)
+
+/** Indicate that configuration property should be read
+ * \ingroup api
+ * \param[in] _m Configuration structure
+ * \param[in] _obj Object type
+ * \param[in] _p Property name
+ */
+#define BCMBAL_CFG_PROP_GET(_m, _obj, _p) BCMBAL_PROP_SET_PRESENT(_m, _obj, _cfg, _p)
+
+/** clear object property in message structure
+ * \ingroup api
+ * \param[in] _m Object structure pointer
+ * \param[in] _obj Object name (i.e. flow)
+ * \param[in] _p Attribute name (i.e. admin_state)
+ */
+#define BCMBAL_CFG_PROP_CLEAR(_m, _obj, _p) \
+ do { \
+ BCMBAL_PROP_CLEAR_PRESENT(_m, _obj, _cfg, _p); \
+ memset(&((_m)->data._p), 0, sizeof((_m)->data._p)); \
+ } while (0)
+
+/** Check if configuration property is set in message structure
+ * \ingroup api
+ * \param[in] _m Configuration structure
+ * \param[in] _obj Object type
+ * \param[in] _p Property name
+ */
+#define BCMBAL_CFG_PROP_IS_SET(_m, _obj, _p) _BCMBAL_PROP_IS_PRESENT(_m, _obj, _cfg, _p)
+
+/** Indicate that statistic property should be read
+ * \ingroup api
+ * \param[in] _m Configuration structure
+ * \param[in] _obj Object type
+ * \param[in] _p Property name
+ */
+#define BCMBAL_STAT_PROP_GET(_m, _obj, _p) BCMBAL_PROP_SET_PRESENT(_m, _obj, _stat, _p)
+
+/** Check if statistic property is set in message structure
+ * \ingroup api
+ * \param[in] _m Statistic structure
+ * \param[in] _obj Object type
+ * \param[in] _p Property name
+ */
+#define BCMBAL_STAT_PROP_IS_SET(_m, _obj, _p) _BCMBAL_PROP_IS_PRESENT(_m, _obj, _stat, _p)
+
+
+/***********************************************************************************
+ **
+ ** Macros for setting attribute values where an attribute supports a presence_mask
+ **
+ ***********************************************************************************
+ **/
+
+/* Internal macro: Get a bitmask given a attribute element property ID enum */
+#define BCMBAL_ATTRIBUTE_PROP_MASK_GET(_attr, _p) bcmbal_ ## _attr ## _id_ ## _p
+
+/* Internal macro: Indicate that configuration property is present */
+#define _BCMBAL_ATTRIBUTE_PROP_SET_PRESENT(p_attr, _attr,_p) \
+ do { \
+ (p_attr)->presence_mask |= BCMBAL_ATTRIBUTE_PROP_MASK_GET(_attr, _p); \
+ } while (0)
+
+/* Internal macro: Indicate that configuration property is not present */
+#define _BCMBAL_ATTRIBUTE_PROP_CLEAR_PRESENT(p_attr, _attr,_p) \
+ do { \
+ (p_attr)->presence_mask &= ~(BCMBAL_ATTRIBUTE_PROP_MASK_GET(_attr, _p)); \
+ } while (0)
+
+/** Set attribute element property in message structure
+ * \param[in] _p_attr Attribute structure pointer
+ * \param[in] _attr Attribute name
+ * \param[in] _p Element name (i.e. o_tpid)
+ * \param[in] _v Element value
+ */
+#define BCMBAL_ATTRIBUTE_PROP_SET(_p_attr, _attr, _p, _v) \
+ do { \
+ _BCMBAL_ATTRIBUTE_PROP_SET_PRESENT(_p_attr, _attr, _p); \
+ (_p_attr)->_p = (_v); \
+ } while (0)
+
+/** Clear attribute element property in message structure
+ * \param[in] _p_attr Attribute structure pointer
+ * \param[in] _attr Attribute name
+ * \param[in] _p Element name (i.e. o_tpid)
+ */
+#define BCMBAL_ATTRIBUTE_PROP_CLEAR(_p_attr, _attr, _p) \
+ do { \
+ _BCMBAL_ATTRIBUTE_PROP_CLEAR_PRESENT(_p_attr, _attr, _p); \
+ memset(&((_p_attr)->_p), 0, sizeof((_p_attr)->_p)); \
+ } while (0)
+
+
+/* Internal macro: check if an attribute element is present */
+#define _BCMBAL_ATTRIBUTE_PROP_IS_PRESENT(_p_attr, _attr, _p) \
+ (((_p_attr)->presence_mask & BCMBAL_ATTRIBUTE_PROP_MASK_GET(_attr, _p)) ? \
+ BCMOS_TRUE : BCMOS_FALSE)
+
+/** Check if attribute element property is set in message structure
+ * \param[in] _p_attr Attribute structure pointer
+ * \param[in] _attr Attribute name
+ * \param[in] _p Element name (i.e. o_tpid)
+ */
+#define BCMBAL_ATTRIBUTE_PROP_IS_SET(_p_attr, _attr, _p) _BCMBAL_ATTRIBUTE_PROP_IS_PRESENT(_p_attr, _attr, _p)
+
+
+/*
+ * ------------------------------------------------------------------
+ *
+ * Internal BCMBAL macros used to manipulate cmds_bitmask of action parameters
+ *
+ * ------------------------------------------------------------------
+ */
+
+/** Check if action cmd id is set in action structure
+ * \param[in] _m Object structure pointer
+ * \param[in] _b cmd Id bitmask
+ */
+#define BCMBAL_ACTION_CMD_ID_IS_SET(_m, _b) \
+ (((_m)->cmds_bitmask & (_b)) ? \
+ BCMOS_TRUE : BCMOS_FALSE)
+
+/** Set action cmd id in action structure
+ * \param[in] _m Object structure pointer
+ * \param[in] _b cmd Id bitmask
+ */
+#define BCMBAL_ACTION_CMD_ID_SET(_m, _b) \
+ do { \
+ (_m)->cmds_bitmask |= (_b);\
+ } while (0)
+
+
+/** Clear action cmd id in action structure
+ * \param[in] _m Object structure pointer
+ * \param[in] _b cmd Id bitmask
+ */
+#define BCMBAL_ACTION_CMD_ID_CLEAR(_m, _b) \
+ do { \
+ (_m)->cmds_bitmask &= ~(_b);\
+ } while (0)
+
+
+
+static inline void bcmbal_flow_object_overlay_w_src_priority(bcmbal_flow_cfg *dstobj, bcmbal_flow_cfg *srcobj)
+{
+ BUG_ON(NULL == dstobj);
+ BUG_ON(NULL == srcobj);
+
+ bcmbal_presence_mask dest_presence_mask;
+
+ /* First, copy the common object and keys in their entirety, except for preserving the presence_mask */
+ dest_presence_mask = dstobj->hdr.hdr.presence_mask;
+ dstobj->hdr = srcobj->hdr;
+ dstobj->key = srcobj->key;
+ dstobj->hdr.hdr.presence_mask = dest_presence_mask;
+
+ /* Now copy only the fields that have been specified in the source object */
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, flow, admin_state))
+ {
+ BCMBAL_CFG_PROP_SET(dstobj, flow, admin_state, srcobj->data.admin_state);
+ }
+
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, flow, access_int_id))
+ {
+ BCMBAL_CFG_PROP_SET(dstobj, flow, access_int_id, srcobj->data.access_int_id);
+ }
+
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, flow, network_int_id))
+ {
+ BCMBAL_CFG_PROP_SET(dstobj, flow, network_int_id, srcobj->data.network_int_id);
+ }
+
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, flow, sub_term_id))
+ {
+ BCMBAL_CFG_PROP_SET(dstobj, flow, sub_term_id, srcobj->data.sub_term_id);
+ }
+
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, flow, svc_port_id))
+ {
+ BCMBAL_CFG_PROP_SET(dstobj, flow, svc_port_id, srcobj->data.svc_port_id);
+ }
+
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, flow, agg_port_id))
+ {
+ BCMBAL_CFG_PROP_SET(dstobj, flow, agg_port_id, srcobj->data.agg_port_id);
+ }
+
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, flow, resolve_mac))
+ {
+ BCMBAL_CFG_PROP_SET(dstobj, flow, resolve_mac, srcobj->data.resolve_mac);
+ }
+
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, flow, queue))
+ {
+ BCMBAL_CFG_PROP_SET(dstobj, flow, queue, srcobj->data.queue);
+ }
+
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, flow, action))
+ {
+ BCMBAL_CFG_PROP_SET(dstobj, flow, action, srcobj->data.action);
+ }
+
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, flow, classifier))
+ {
+ BCMBAL_CFG_PROP_SET(dstobj, flow, classifier, srcobj->data.classifier);
+ }
+
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, flow, sla))
+ {
+ BCMBAL_CFG_PROP_SET(dstobj, flow, sla, srcobj->data.sla);
+ }
+
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, flow, group_id))
+ {
+ BCMBAL_CFG_PROP_SET(dstobj, flow, group_id, srcobj->data.group_id);
+ }
+
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, flow, cookie))
+ {
+ BCMBAL_CFG_PROP_SET(dstobj, flow, cookie, srcobj->data.cookie);
+ }
+}
+
+static inline void bcmbal_flow_object_overlay_w_dst_priority(bcmbal_flow_cfg *dstobj, bcmbal_flow_cfg *srcobj)
+{
+ BUG_ON(NULL == dstobj);
+ BUG_ON(NULL == srcobj);
+
+ bcmbal_presence_mask dest_presence_mask;
+
+ /* First, copy the common object and keys in their entirety,
+ * except for preserving the presence_mask */
+ dest_presence_mask = dstobj->hdr.hdr.presence_mask;
+ dstobj->hdr = srcobj->hdr;
+ dstobj->key = srcobj->key;
+ dstobj->hdr.hdr.presence_mask = dest_presence_mask;
+
+ /* Now copy only the fields that have been specified in the source and are not already set in the dst object */
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, flow, admin_state))
+ {
+ if(!BCMBAL_CFG_PROP_IS_SET(dstobj, flow, admin_state))
+ BCMBAL_CFG_PROP_SET(dstobj, flow, admin_state, srcobj->data.admin_state);
+ }
+
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, flow, access_int_id))
+ {
+ if(!BCMBAL_CFG_PROP_IS_SET(dstobj, flow, access_int_id))
+ BCMBAL_CFG_PROP_SET(dstobj, flow, access_int_id, srcobj->data.access_int_id);
+ }
+
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, flow, network_int_id))
+ {
+ if(!BCMBAL_CFG_PROP_IS_SET(dstobj, flow, network_int_id))
+ BCMBAL_CFG_PROP_SET(dstobj, flow, network_int_id, srcobj->data.network_int_id);
+ }
+
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, flow, sub_term_id))
+ {
+ if(!BCMBAL_CFG_PROP_IS_SET(dstobj, flow, sub_term_id))
+ BCMBAL_CFG_PROP_SET(dstobj, flow, sub_term_id, srcobj->data.sub_term_id);
+ }
+
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, flow, svc_port_id))
+ {
+ if(!BCMBAL_CFG_PROP_IS_SET(dstobj, flow, svc_port_id))
+ BCMBAL_CFG_PROP_SET(dstobj, flow, svc_port_id, srcobj->data.svc_port_id);
+ }
+
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, flow, agg_port_id))
+ {
+ if(!BCMBAL_CFG_PROP_IS_SET(dstobj, flow, agg_port_id))
+ BCMBAL_CFG_PROP_SET(dstobj, flow, agg_port_id, srcobj->data.agg_port_id);
+ }
+
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, flow, resolve_mac))
+ {
+ if(!BCMBAL_CFG_PROP_IS_SET(dstobj, flow, resolve_mac))
+ BCMBAL_CFG_PROP_SET(dstobj, flow, resolve_mac, srcobj->data.resolve_mac);
+ }
+
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, flow, queue))
+ {
+ if(!BCMBAL_CFG_PROP_IS_SET(dstobj, flow, queue))
+ BCMBAL_CFG_PROP_SET(dstobj, flow, queue, srcobj->data.queue);
+ }
+
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, flow, action))
+ {
+ if(!BCMBAL_CFG_PROP_IS_SET(dstobj, flow, action))
+ BCMBAL_CFG_PROP_SET(dstobj, flow, action, srcobj->data.action);
+ }
+
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, flow, classifier))
+ {
+ if(!BCMBAL_CFG_PROP_IS_SET(dstobj, flow, classifier))
+ BCMBAL_CFG_PROP_SET(dstobj, flow, classifier, srcobj->data.classifier);
+ }
+
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, flow, sla))
+ {
+ if(!BCMBAL_CFG_PROP_IS_SET(dstobj, flow, sla))
+ BCMBAL_CFG_PROP_SET(dstobj, flow, sla, srcobj->data.sla);
+ }
+
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, flow, group_id))
+ {
+ if(!BCMBAL_CFG_PROP_IS_SET(dstobj, flow, group_id))
+ BCMBAL_CFG_PROP_SET(dstobj, flow, group_id, srcobj->data.group_id);
+ }
+
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, flow, cookie))
+ {
+ if(!BCMBAL_CFG_PROP_IS_SET(dstobj, flow, cookie))
+ BCMBAL_CFG_PROP_SET(dstobj, flow, cookie, srcobj->data.cookie);
+ }
+}
+
+static inline void bcmbal_sub_term_object_overlay_w_src_priority(bcmbal_subscriber_terminal_cfg *dstobj,
+ bcmbal_subscriber_terminal_cfg *srcobj)
+{
+ BUG_ON(NULL == dstobj);
+ BUG_ON(NULL == srcobj);
+
+ bcmbal_presence_mask dest_presence_mask;
+
+ /* First, copy the common object and keys in their entirety, except for preserving the presence_mask */
+ dest_presence_mask = dstobj->hdr.hdr.presence_mask;
+ dstobj->hdr = srcobj->hdr;
+ dstobj->key = srcobj->key;
+ dstobj->hdr.hdr.presence_mask = dest_presence_mask;
+
+ /* Now copy only the fields that have been specified in the source object */
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, subscriber_terminal, admin_state))
+ {
+ BCMBAL_CFG_PROP_SET(dstobj, subscriber_terminal, admin_state, srcobj->data.admin_state);
+ }
+
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, subscriber_terminal, serial_number))
+ {
+ BCMBAL_CFG_PROP_SET(dstobj, subscriber_terminal, serial_number, srcobj->data.serial_number);
+ }
+
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, subscriber_terminal, password))
+ {
+ BCMBAL_CFG_PROP_SET(dstobj, subscriber_terminal, password, srcobj->data.password);
+ }
+
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, subscriber_terminal, registration_id))
+ {
+ BCMBAL_CFG_PROP_SET(dstobj, subscriber_terminal, registration_id, srcobj->data.registration_id);
+ }
+
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, subscriber_terminal, svc_port_id))
+ {
+ BCMBAL_CFG_PROP_SET(dstobj, subscriber_terminal, svc_port_id, srcobj->data.svc_port_id);
+ }
+
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, subscriber_terminal, ds_tm))
+ {
+ BCMBAL_CFG_PROP_SET(dstobj, subscriber_terminal, ds_tm, srcobj->data.ds_tm);
+ }
+
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, subscriber_terminal, us_tm))
+ {
+ BCMBAL_CFG_PROP_SET(dstobj, subscriber_terminal, us_tm, srcobj->data.us_tm);
+ }
+
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, subscriber_terminal, mac_address))
+ {
+ BCMBAL_CFG_PROP_SET(dstobj, subscriber_terminal, mac_address, srcobj->data.mac_address);
+ }
+}
+
+static inline void bcmbal_sub_term_object_overlay_w_dst_priority(bcmbal_subscriber_terminal_cfg *dstobj,
+ bcmbal_subscriber_terminal_cfg *srcobj)
+{
+ BUG_ON(NULL == dstobj);
+ BUG_ON(NULL == srcobj);
+
+ bcmbal_presence_mask dest_presence_mask;
+
+ /* First, copy the common object and keys in their entirety, except for preserving the presence_mask */
+ dest_presence_mask = dstobj->hdr.hdr.presence_mask;
+ dstobj->hdr = srcobj->hdr;
+ dstobj->key = srcobj->key;
+ dstobj->hdr.hdr.presence_mask = dest_presence_mask;
+
+ /* Now copy only the fields that have been specified in the source object */
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, subscriber_terminal, admin_state))
+ {
+ if(!BCMBAL_CFG_PROP_IS_SET(dstobj, subscriber_terminal, admin_state))
+ BCMBAL_CFG_PROP_SET(dstobj, subscriber_terminal, admin_state, srcobj->data.admin_state);
+ }
+
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, subscriber_terminal, serial_number))
+ {
+ if(!BCMBAL_CFG_PROP_IS_SET(dstobj, subscriber_terminal, serial_number))
+ BCMBAL_CFG_PROP_SET(dstobj, subscriber_terminal, serial_number, srcobj->data.serial_number);
+ }
+
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, subscriber_terminal, password))
+ {
+ if(!BCMBAL_CFG_PROP_IS_SET(dstobj, subscriber_terminal, password))
+ BCMBAL_CFG_PROP_SET(dstobj, subscriber_terminal, password, srcobj->data.password);
+ }
+
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, subscriber_terminal, registration_id))
+ {
+ if(!BCMBAL_CFG_PROP_IS_SET(dstobj, subscriber_terminal, registration_id))
+ BCMBAL_CFG_PROP_SET(dstobj, subscriber_terminal, registration_id, srcobj->data.registration_id);
+ }
+
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, subscriber_terminal, svc_port_id))
+ {
+ if(!BCMBAL_CFG_PROP_IS_SET(dstobj, subscriber_terminal, svc_port_id))
+ BCMBAL_CFG_PROP_SET(dstobj, subscriber_terminal, svc_port_id, srcobj->data.svc_port_id);
+ }
+
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, subscriber_terminal, ds_tm))
+ {
+ if(!BCMBAL_CFG_PROP_IS_SET(dstobj, subscriber_terminal, ds_tm))
+ BCMBAL_CFG_PROP_SET(dstobj, subscriber_terminal, ds_tm, srcobj->data.ds_tm);
+ }
+
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, subscriber_terminal, us_tm))
+ {
+ if(!BCMBAL_CFG_PROP_IS_SET(dstobj, subscriber_terminal, us_tm))
+ BCMBAL_CFG_PROP_SET(dstobj, subscriber_terminal, us_tm, srcobj->data.us_tm);
+ }
+
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, subscriber_terminal, mac_address))
+ {
+ if(!BCMBAL_CFG_PROP_IS_SET(dstobj, subscriber_terminal, mac_address))
+ BCMBAL_CFG_PROP_SET(dstobj, subscriber_terminal, mac_address, srcobj->data.mac_address);
+ }
+}
+
+static inline void bcmbal_tm_sched_object_overlay_w_src_priority(bcmbal_tm_sched_cfg *dstobj, bcmbal_tm_sched_cfg *srcobj)
+{
+ BUG_ON(NULL == dstobj);
+ BUG_ON(NULL == srcobj);
+
+ bcmbal_presence_mask dest_presence_mask;
+
+ /* First, copy the common object and keys in their entirety, except for preserving the presence_mask */
+ dest_presence_mask = dstobj->hdr.hdr.presence_mask;
+ dstobj->hdr = srcobj->hdr;
+ dstobj->key = srcobj->key;
+ dstobj->hdr.hdr.presence_mask = dest_presence_mask;
+
+ /* Now copy only the fields that have been specified in the source object */
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, tm_sched, owner))
+ {
+ BCMBAL_CFG_PROP_SET(dstobj, tm_sched, owner, srcobj->data.owner);
+ }
+
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, tm_sched, sched_type))
+ {
+ BCMBAL_CFG_PROP_SET(dstobj, tm_sched, sched_type, srcobj->data.sched_type);
+ }
+
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, tm_sched, sched_parent))
+ {
+ BCMBAL_CFG_PROP_SET(dstobj, tm_sched, sched_parent, srcobj->data.sched_parent);
+ }
+
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, tm_sched, sched_child_type))
+ {
+ BCMBAL_CFG_PROP_SET(dstobj, tm_sched, sched_child_type, srcobj->data.sched_child_type);
+ }
+
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, tm_sched, rate))
+ {
+ BCMBAL_CFG_PROP_SET(dstobj, tm_sched, rate, srcobj->data.rate);
+ }
+
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, tm_sched, tcont_sla))
+ {
+ BCMBAL_CFG_PROP_SET(dstobj, tm_sched, tcont_sla, srcobj->data.tcont_sla);
+ }
+
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, tm_sched, creation_mode))
+ {
+ BCMBAL_CFG_PROP_SET(dstobj, tm_sched, creation_mode, srcobj->data.creation_mode);
+ }
+
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, tm_sched, num_priorities))
+ {
+ BCMBAL_CFG_PROP_SET(dstobj, tm_sched, num_priorities, srcobj->data.num_priorities);
+ }
+
+}
+
+
+
+static inline void bcmbal_tm_sched_object_overlay_w_dst_priority(bcmbal_tm_sched_cfg *dstobj, bcmbal_tm_sched_cfg *srcobj)
+{
+ BUG_ON(NULL == dstobj);
+ BUG_ON(NULL == srcobj);
+
+ bcmbal_presence_mask dest_presence_mask;
+
+ /* First, copy the common object and keys in their entirety,
+ * except for preserving the presence_mask */
+ dest_presence_mask = dstobj->hdr.hdr.presence_mask;
+ dstobj->hdr = srcobj->hdr;
+ dstobj->key = srcobj->key;
+ dstobj->hdr.hdr.presence_mask = dest_presence_mask;
+
+ /* Now copy only the fields that have been specified in the source and are not already set in the dst object */
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, tm_sched, owner))
+ {
+ if(!BCMBAL_CFG_PROP_IS_SET(dstobj, tm_sched, owner))
+ BCMBAL_CFG_PROP_SET(dstobj, tm_sched, owner, srcobj->data.owner);
+ }
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, tm_sched, sched_type))
+ {
+ if(!BCMBAL_CFG_PROP_IS_SET(dstobj, tm_sched, sched_type))
+ BCMBAL_CFG_PROP_SET(dstobj, tm_sched, sched_type, srcobj->data.sched_type);
+ }
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, tm_sched, sched_parent))
+ {
+ if(!BCMBAL_CFG_PROP_IS_SET(dstobj, tm_sched, sched_parent))
+ BCMBAL_CFG_PROP_SET(dstobj, tm_sched, sched_parent, srcobj->data.sched_parent);
+ }
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, tm_sched, sched_child_type))
+ {
+ if(!BCMBAL_CFG_PROP_IS_SET(dstobj, tm_sched, sched_child_type))
+ BCMBAL_CFG_PROP_SET(dstobj, tm_sched, sched_child_type, srcobj->data.sched_child_type);
+ }
+
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, tm_sched, rate))
+ {
+ if(!BCMBAL_CFG_PROP_IS_SET(dstobj, tm_sched, rate))
+ BCMBAL_CFG_PROP_SET(dstobj, tm_sched, rate, srcobj->data.rate);
+ }
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, tm_sched, tcont_sla))
+ {
+ if(!BCMBAL_CFG_PROP_IS_SET(dstobj, tm_sched, tcont_sla))
+ BCMBAL_CFG_PROP_SET(dstobj, tm_sched, tcont_sla, srcobj->data.tcont_sla);
+ }
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, tm_sched, creation_mode))
+ {
+ if(!BCMBAL_CFG_PROP_IS_SET(dstobj, tm_sched, creation_mode))
+ BCMBAL_CFG_PROP_SET(dstobj, tm_sched, creation_mode, srcobj->data.creation_mode);
+ }
+
+}
+
+
+static inline void bcmbal_tm_queue_object_overlay(bcmbal_tm_queue_cfg *dstobj, bcmbal_tm_queue_cfg *srcobj)
+{
+ BUG_ON(NULL == dstobj);
+ BUG_ON(NULL == srcobj);
+
+ bcmbal_presence_mask dest_presence_mask;
+
+ /* First, copy the common object and keys in their entirety, except for preserving the presence_mask */
+ dest_presence_mask = dstobj->hdr.hdr.presence_mask;
+ dstobj->hdr = srcobj->hdr;
+ dstobj->key = srcobj->key;
+ dstobj->hdr.hdr.presence_mask = dest_presence_mask;
+
+ /* Now copy only the fields that have been specified in the source object */
+
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, tm_queue, priority))
+ {
+ BCMBAL_CFG_PROP_SET(dstobj, tm_queue, priority, srcobj->data.priority);
+ }
+
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, tm_queue, weight))
+ {
+ BCMBAL_CFG_PROP_SET(dstobj, tm_queue, weight, srcobj->data.weight);
+ }
+
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, tm_queue, rate))
+ {
+ BCMBAL_CFG_PROP_SET(dstobj, tm_queue, rate, srcobj->data.rate);
+ }
+
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, tm_queue, bac))
+ {
+ BCMBAL_CFG_PROP_SET(dstobj, tm_queue, bac, srcobj->data.bac);
+ }
+}
+
+static inline bcmos_errno bal_obj_key_str_get(bcmbal_obj *obj, char *p_obj_key_str)
+{
+ BUG_ON(NULL == p_obj_key_str);
+
+ bcmos_errno ret = BCM_ERR_OK;
+
+ switch (obj->obj_type)
+ {
+
+ case (BCMBAL_OBJ_ID_ACCESS_TERMINAL):
+ {
+ sprintf(p_obj_key_str, "unit:%d",
+ ((bcmbal_access_terminal_cfg *)obj)->key.access_term_id);
+ break;
+ }
+
+ case (BCMBAL_OBJ_ID_INTERFACE):
+ {
+ sprintf(p_obj_key_str, "intf_id:%d, type:%s",
+ ((bcmbal_interface_cfg *)obj)->key.intf_id,
+ ((bcmbal_interface_cfg *)obj)->key.intf_type == BCMBAL_INTF_TYPE_NNI ? "NNI" :
+ ((bcmbal_interface_cfg *)obj)->key.intf_type == BCMBAL_INTF_TYPE_PON ? "PON" :
+ "???"
+ );
+ break;
+ }
+
+ case (BCMBAL_OBJ_ID_SUBSCRIBER_TERMINAL):
+ {
+ sprintf(p_obj_key_str, "sub_term_id:%d, intf_id:%d",
+ ((bcmbal_subscriber_terminal_cfg *)obj)->key.sub_term_id,
+ ((bcmbal_subscriber_terminal_cfg *)obj)->key.intf_id);
+ break;
+ }
+
+ case (BCMBAL_OBJ_ID_FLOW):
+ {
+ sprintf(p_obj_key_str, "flow_id:%d, type:%s",
+ ((bcmbal_flow_cfg *)obj)->key.flow_id,
+ ((bcmbal_flow_cfg *)obj)->key.flow_type == BCMBAL_FLOW_TYPE_UPSTREAM ? "upstream" :
+ ((bcmbal_flow_cfg *)obj)->key.flow_type == BCMBAL_FLOW_TYPE_DOWNSTREAM ? "downstream" :
+ ((bcmbal_flow_cfg *)obj)->key.flow_type == BCMBAL_FLOW_TYPE_BROADCAST ? "broadcast" :
+ ((bcmbal_flow_cfg *)obj)->key.flow_type == BCMBAL_FLOW_TYPE_MULTICAST ? "multicast" :
+ "???"
+ );
+ break;
+ }
+
+ case (BCMBAL_OBJ_ID_GROUP):
+ {
+ sprintf(p_obj_key_str, "group_id:%d",
+ ((bcmbal_group_cfg *)obj)->key.group_id);
+ break;
+ }
+
+ case (BCMBAL_OBJ_ID_TM_SCHED):
+ {
+ sprintf(p_obj_key_str, "dir:%s, id:%d",
+ ((bcmbal_tm_sched_cfg *)obj)->key.dir == BCMBAL_TM_SCHED_DIR_US ? "upstream" :
+ ((bcmbal_tm_sched_cfg *)obj)->key.dir == BCMBAL_TM_SCHED_DIR_DS ? "downstream" :
+ "???",
+ ((bcmbal_tm_sched_cfg *)obj)->key.id
+ );
+ break;
+ }
+
+ case (BCMBAL_OBJ_ID_TM_QUEUE):
+ {
+ sprintf(p_obj_key_str, "sched_id:%d, sched_dir:%s, id:%d",
+ ((bcmbal_tm_queue_cfg *)obj)->key.sched_id,
+ ((bcmbal_tm_queue_cfg *)obj)->key.sched_dir == BCMBAL_TM_SCHED_DIR_US ? "upstream" :
+ ((bcmbal_tm_queue_cfg *)obj)->key.sched_dir == BCMBAL_TM_SCHED_DIR_DS ? "downstream" :
+ "???",
+ ((bcmbal_tm_queue_cfg *)obj)->key.id
+ );
+ break;
+ }
+
+ case (BCMBAL_OBJ_ID_PACKET):
+ {
+ sprintf(p_obj_key_str, " ");
+ break;
+ }
+
+ default:
+ sprintf(p_obj_key_str, " ");
+ ret = BCM_ERR_PARM;
+ break;
+ }
+
+ return ret;
+}
+
+static inline void bcmbal_interface_object_overlay_w_dst_priority(bcmbal_interface_cfg *dstobj, bcmbal_interface_cfg *srcobj)
+{
+ BUG_ON(NULL == dstobj);
+ BUG_ON(NULL == srcobj);
+
+ bcmbal_presence_mask dest_presence_mask;
+
+ /* First, copy the common object and keys in their entirety,
+ * except for preserving the presence_mask */
+ dest_presence_mask = dstobj->hdr.hdr.presence_mask;
+ dstobj->hdr = srcobj->hdr;
+ dstobj->key = srcobj->key;
+ dstobj->hdr.hdr.presence_mask = dest_presence_mask;
+
+ /* Now copy only the fields that have been specified in the source and are not already set in the dst object */
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, interface, admin_state))
+ {
+ if(!BCMBAL_CFG_PROP_IS_SET(dstobj, interface, admin_state))
+ BCMBAL_CFG_PROP_SET(dstobj, interface, admin_state, srcobj->data.admin_state);
+ }
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, interface, min_data_agg_port_id))
+ {
+ if(!BCMBAL_CFG_PROP_IS_SET(dstobj, interface, min_data_agg_port_id))
+ BCMBAL_CFG_PROP_SET(dstobj, interface, min_data_agg_port_id, srcobj->data.min_data_agg_port_id);
+ }
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, interface, min_data_svc_port_id))
+ {
+ if(!BCMBAL_CFG_PROP_IS_SET(dstobj, interface, min_data_svc_port_id))
+ BCMBAL_CFG_PROP_SET(dstobj, interface, min_data_svc_port_id, srcobj->data.min_data_svc_port_id);
+ }
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, interface, transceiver_type))
+ {
+ if(!BCMBAL_CFG_PROP_IS_SET(dstobj, interface, transceiver_type))
+ BCMBAL_CFG_PROP_SET(dstobj, interface, transceiver_type, srcobj->data.transceiver_type);
+ }
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, interface, ds_miss_mode))
+ {
+ if(!BCMBAL_CFG_PROP_IS_SET(dstobj, interface, ds_miss_mode))
+ BCMBAL_CFG_PROP_SET(dstobj, interface, ds_miss_mode, srcobj->data.ds_miss_mode);
+ }
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, interface, mtu))
+ {
+ if(!BCMBAL_CFG_PROP_IS_SET(dstobj, interface, mtu))
+ BCMBAL_CFG_PROP_SET(dstobj, interface, mtu, srcobj->data.mtu);
+ }
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, interface, flow_control))
+ {
+ if(!BCMBAL_CFG_PROP_IS_SET(dstobj, interface, flow_control))
+ BCMBAL_CFG_PROP_SET(dstobj, interface, flow_control, srcobj->data.flow_control);
+ }
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, interface, ds_tm))
+ {
+ if(!BCMBAL_CFG_PROP_IS_SET(dstobj, interface, ds_tm))
+ BCMBAL_CFG_PROP_SET(dstobj, interface, ds_tm, srcobj->data.ds_tm);
+ }
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, interface, us_tm))
+ {
+ if(!BCMBAL_CFG_PROP_IS_SET(dstobj, interface, us_tm))
+ BCMBAL_CFG_PROP_SET(dstobj, interface, us_tm, srcobj->data.us_tm);
+ }
+}
+
+
+static inline void bcmbal_interface_object_overlay_w_src_priority(bcmbal_interface_cfg *dstobj,
+ bcmbal_interface_cfg *srcobj)
+{
+ BUG_ON(NULL == dstobj);
+ BUG_ON(NULL == srcobj);
+
+ bcmbal_presence_mask dest_presence_mask;
+
+ /* First, copy the common object and keys in their entirety, except for preserving the presence_mask */
+ dest_presence_mask = dstobj->hdr.hdr.presence_mask;
+ dstobj->hdr = srcobj->hdr;
+ dstobj->key = srcobj->key;
+ dstobj->hdr.hdr.presence_mask = dest_presence_mask;
+
+ /* Now copy only the fields that have been specified in the source object */
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, interface, admin_state))
+ {
+ BCMBAL_CFG_PROP_SET(dstobj, interface, admin_state, srcobj->data.admin_state);
+ }
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, interface, min_data_agg_port_id))
+ {
+ BCMBAL_CFG_PROP_SET(dstobj, interface, min_data_agg_port_id, srcobj->data.min_data_agg_port_id);
+ }
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, interface, min_data_svc_port_id))
+ {
+ BCMBAL_CFG_PROP_SET(dstobj, interface, min_data_svc_port_id, srcobj->data.min_data_svc_port_id);
+ }
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, interface, transceiver_type))
+ {
+ BCMBAL_CFG_PROP_SET(dstobj, interface, transceiver_type, srcobj->data.transceiver_type);
+ }
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, interface, ds_miss_mode))
+ {
+ BCMBAL_CFG_PROP_SET(dstobj, interface, ds_miss_mode, srcobj->data.ds_miss_mode);
+ }
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, interface, mtu))
+ {
+ BCMBAL_CFG_PROP_SET(dstobj, interface, mtu, srcobj->data.mtu);
+ }
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, interface, flow_control))
+ {
+ BCMBAL_CFG_PROP_SET(dstobj, interface, flow_control, srcobj->data.flow_control);
+ }
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, interface, ds_tm))
+ {
+ BCMBAL_CFG_PROP_SET(dstobj, interface, ds_tm, srcobj->data.ds_tm);
+ }
+ if(BCMBAL_CFG_PROP_IS_SET(srcobj, interface, us_tm))
+ {
+ BCMBAL_CFG_PROP_SET(dstobj, interface, us_tm, srcobj->data.us_tm);
+ }
+
+}
+/*@}*/
+
+
+#endif /* BALOBJS_H */
diff --git a/bal_release/src/common/include/bal_osmsg.h b/bal_release/src/common/include/bal_osmsg.h
new file mode 100644
index 0000000..e5caf85
--- /dev/null
+++ b/bal_release/src/common/include/bal_osmsg.h
@@ -0,0 +1,104 @@
+/******************************************************************************
+ *
+ * <: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_osmsg.h
+ * @brief BAL Message data structure definitions
+ *
+ */
+#ifndef BAL_OSMSG_H_
+#define BAL_OSMSG_H_
+/*
+ * Message structures.
+ * Going to be generated from object model and moved elsewhere
+ */
+
+/* BAL subsystem */
+typedef enum
+{
+ BAL_SUBSYSTEM_CORE,
+ BAL_SUBSYSTEM_MAC_UTIL,
+ BAL_SUBSYSTEM_SWITCH_UTIL,
+ BAL_SUBSYSTEM_PUBLIC_API,
+
+ BAL_SUBSYSTEM__NUM_OF
+} bal_subsystem;
+
+
+__attribute__ ((unused)) static const char *subsystem_str[] =
+{
+ "BAL Core",
+ "BAL Mac Util",
+ "BAL Switch Util",
+ "BAL Public API"
+};
+
+/** BAL OS message
+ * \ingroup system_msg
+ */
+typedef enum
+{
+ BCMOS_MSG_ID__BEGIN,
+
+ /* Messages used internally by OS abstraction. Do not touch */
+ BCMOS_MSG_ID_INTERNAL_TIMER, /**< Internal "timer message" type */
+ BCMOS_MSG_ID_INTERNAL_EVENT, /**< Internal "event message" type */
+ BCMOS_MSG_ID_INTERNAL_IPC,
+
+ /* Application messages */
+ BCMOS_MSG_ID_IPC_PING, /*** Inter-process communication ping */
+
+ /* Core/Switch util messages */
+ BCMBAL_SWITCH_UTIL_MSG,
+
+ /* Core/Mac util messages */
+ BCMBAL_MAC_UTIL_MSG,
+
+ /* Core<->Public API messages */
+ BCMBAL_MGMT_MSG,
+
+ /* Core->Public API indication messages (both auto and "normal") */
+ BCMBAL_MGMT_API_IND_MSG,
+
+ BCMOS_MSG_ID_EON_PROXY_RX,
+ BCMOS_MSG_ID_EON_DESTROY_STATE,
+
+ BCMOS_MSG_ID_EPON_OAM_PROXY_RX,
+ BCMOS_MSG_ID_EPON_OAM_TIMEOUT,
+
+ BCMOS_MSG_ID_OMCI_TRANSPORT_SEND,
+
+ BCMOS_MSG_ID__END,
+ BCMOS_MSG_ID__FORCE16 = 0x7fff
+} bcmos_msg_id;
+
+
+#endif /* BAL_OSMSG_H_ */
diff --git a/bal_release/src/common/include/bal_utils_msg.h b/bal_release/src/common/include/bal_utils_msg.h
new file mode 100644
index 0000000..d6721fc
--- /dev/null
+++ b/bal_release/src/common/include/bal_utils_msg.h
@@ -0,0 +1,180 @@
+/******************************************************************************
+ *
+ * <: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.
+ *
+ * :>
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+The message format will look like the following
+
+ -----------------------------------------------------------------------------------
+ | BAL Header | | Payload Data |
+ ----------------------------------|------------------------------------------------
+ | *bcmos_header | | App Header | |
+ -----------------------------------------------------------------------------------
+ | | | version | |
+ | type | msg_type | obj_key | bal_util_ind_flow_t |
+ | | msg_id | status | |
+ -----------------------------------------------------------------------------------
+
+ *The bcmos Header is actually the first field of BAL Header structure (bal_comm_msg_hdr_t)
+
+ type can be:
+ BCMBAL_SWITCH_UTIL_MSG
+ BCMBAL_MAC_UTIL_MSG
+
+ msg_type can be:
+ BAL_MSG_IND,
+ BAL_MSG_AUTO_IND
+
+ msg_id is module specific, but contains two 16 bits fields (OBJECT_ID, OPERATION_ID)
+ see bal_objs.h for OBJECT_ID details
+ The OPERATION_ID should be unique within the OBJECT - see example below
+ bal_msg.h
+
+ status is for indication message to show general results. The value is bcmos_errno.
+
+*********************************************************************************/
+
+/**
+ * @file bal_utils_msg.h
+ *
+ * @brief Common header for messages sent between Utils and Core
+ *
+ * @ingroup apps
+ */
+
+#ifndef _BAL_UTIL_MSG_H_
+#define _BAL_UTIL_MSG_H_
+
+/*@{*/
+
+#include <bal_msg.h>
+#include <stdint.h>
+
+#define BAL_UTIL_MSG_VERSION 1
+
+/* access terminal request list,
+ */
+typedef enum
+{
+ BAL_UTIL_OPER_ACC_TERM_CONNECT,
+ BAL_UTIL_OPER_ACC_TERM_DISCONNECT
+} bal_util_oper_acc_term;
+
+/* subscriber terminal request list,
+ */
+typedef enum
+{
+ BAL_UTIL_OPER_SUB_TERM_ADD,
+ BAL_UTIL_OPER_SUB_TERM_REMOVE,
+ BAL_UTIL_OPER_SUB_TERM_CLEAR,
+ BAL_UTIL_OPER_SUB_TERM_DISCOVERY
+} bal_util_oper_sub_term;
+
+/* interface request list,
+ */
+typedef enum
+{
+ BAL_UTIL_OPER_IF_UP,
+ BAL_UTIL_OPER_IF_DOWN
+} bal_util_oper_if;
+
+/* flow request list,
+ */
+typedef enum
+{
+ BAL_UTIL_OPER_FLOW_ADD,
+ BAL_UTIL_OPER_FLOW_REMOVE,
+ BAL_UTIL_OPER_FLOW_CLEAR
+} bal_util_oper_flow;
+
+typedef enum
+{
+ BAL_UTIL_FLOW_IND_SEND_NONE,
+ BAL_UTIL_FLOW_IND_SEND_SUCCESS,
+ BAL_UTIL_FLOW_IND_SEND_FAIL
+} bal_util_flow_ind;
+
+/* group request list,
+ */
+typedef enum
+{
+ BAL_UTIL_OPER_GROUP_CREATE,
+ BAL_UTIL_OPER_GROUP_ADD,
+ BAL_UTIL_OPER_GROUP_REMOVE,
+ BAL_UTIL_OPER_GROUP_SET,
+ BAL_UTIL_OPER_GROUP_DESTROY
+} bal_util_oper_group;
+
+typedef enum
+{
+ BAL_UTIL_OPER_AGG_PORT_ADD,
+ BAL_UTIL_OPER_AGG_PORT_REMOVE,
+ BAL_UTIL_OPER_AGG_PORT_CLEAR
+} bal_util_oper_agg_port;
+
+/* Macro to retrieve the name string of the GROUP oper */
+#define BCMBAL_UTIL_GROUP_OPER_STR_GET(__op_type__) \
+ ( BAL_UTIL_OPER_GROUP_CREATE == __op_type__ ) ? "create" : \
+ ( BAL_UTIL_OPER_GROUP_ADD == __op_type__ ) ? "add" : \
+ ( BAL_UTIL_OPER_GROUP_REMOVE == __op_type__ ) ? "remove" : \
+ ( BAL_UTIL_OPER_GROUP_SET == __op_type__ ) ? "set" : \
+ ( BAL_UTIL_OPER_GROUP_DESTROY == __op_type__ ) ? "destroy" : \
+ "unknown"
+
+/* bal_app_msg_obj_key_t allow applications to id which instance of object
+ * this message should be processed
+ */
+typedef union bal_util_msg_obj_key
+{
+ bcmbal_access_terminal_key acc_term_key;
+ bcmbal_interface_key if_key;
+ bcmbal_subscriber_terminal_key sub_term_key;
+ bcmbal_flow_key flow_key;
+ bcmbal_group_key group_key;
+ bcmbal_tm_sched_key tm_sched_key;
+} bal_util_msg_obj_key;
+
+#define BCMBAL_INVALID_TUNNEL_ID 0xffffffff
+
+ /* indication message header */
+ typedef struct bal_util_msg_ind
+ {
+ bal_comm_msg_hdr comm_hdr; /* Communication header */
+ uint32_t version; /* version of the app message format */
+ bal_util_msg_obj_key obj_key;
+ int32_t status; /* bcmos_errno */
+ /* Optional custom BAL MAC/SWITCH UTIL indication data follows */
+ char data[0];
+ } bal_util_msg_ind;
+
+ /* auto indication message header */
+ typedef bal_util_msg_ind bal_util_msg_auto_ind;
+
+#endif /* _BAL_UTIL_MSG_H */
diff --git a/bal_release/src/common/include/bal_version.h b/bal_release/src/common/include/bal_version.h
new file mode 100644
index 0000000..533ff6b
--- /dev/null
+++ b/bal_release/src/common/include/bal_version.h
@@ -0,0 +1,44 @@
+/*************************************************************
+ * DO NOT EDIT! THIS FILE WAS AUTO GENERATED. DO NOT EDIT! *
+ *************************************************************/
+/******************************************************************************
+ *
+ * <:copyright-BRCM:2017:DUAL/GPL:standard
+ *
+ * Copyright (c) 2017 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.
+ *
+ * :>
+ *
+ *****************************************************************************/
+
+#if !defined(BAL_VERSION_H)
+#define BAL_VERSION_H
+
+#define BAL_VERSION "R02.02.01.139177"
+#define BAL_VERSION_STR_LEN (17)
+
+#define BAL_BUILD_DATE "Thu Mar 30 18:15:35 IDT 2017"
+#define BAL_BUILD_INFO ""
+
+#endif /* BAL_VERSION_H */
diff --git a/bal_release/src/common/os_abstraction/Makefile b/bal_release/src/common/os_abstraction/Makefile
new file mode 120000
index 0000000..823d78c
--- /dev/null
+++ b/bal_release/src/common/os_abstraction/Makefile
@@ -0,0 +1 @@
+../../../3rdparty/maple/sdk/host_customized/os_abstraction/Makefile
\ No newline at end of file
diff --git a/bal_release/src/common/os_abstraction/bcmos_common.c b/bal_release/src/common/os_abstraction/bcmos_common.c
new file mode 120000
index 0000000..eccb2aa
--- /dev/null
+++ b/bal_release/src/common/os_abstraction/bcmos_common.c
@@ -0,0 +1 @@
+../../../3rdparty/maple/sdk/host_customized/os_abstraction/bcmos_common.c
\ No newline at end of file
diff --git a/bal_release/src/common/os_abstraction/bcmos_common.h b/bal_release/src/common/os_abstraction/bcmos_common.h
new file mode 120000
index 0000000..a31747a
--- /dev/null
+++ b/bal_release/src/common/os_abstraction/bcmos_common.h
@@ -0,0 +1 @@
+../../../3rdparty/maple/sdk/host_customized/os_abstraction/bcmos_common.h
\ No newline at end of file
diff --git a/bal_release/src/common/os_abstraction/bcmos_common2.h b/bal_release/src/common/os_abstraction/bcmos_common2.h
new file mode 120000
index 0000000..b5d6f8f
--- /dev/null
+++ b/bal_release/src/common/os_abstraction/bcmos_common2.h
@@ -0,0 +1 @@
+../../../3rdparty/maple/sdk/host_customized/os_abstraction/bcmos_common2.h
\ No newline at end of file
diff --git a/bal_release/src/common/os_abstraction/bcmos_endian.h b/bal_release/src/common/os_abstraction/bcmos_endian.h
new file mode 120000
index 0000000..3c1036d
--- /dev/null
+++ b/bal_release/src/common/os_abstraction/bcmos_endian.h
@@ -0,0 +1 @@
+../../../3rdparty/maple/sdk/host_customized/os_abstraction/bcmos_endian.h
\ No newline at end of file
diff --git a/bal_release/src/common/os_abstraction/bcmos_errno.c b/bal_release/src/common/os_abstraction/bcmos_errno.c
new file mode 120000
index 0000000..240256f
--- /dev/null
+++ b/bal_release/src/common/os_abstraction/bcmos_errno.c
@@ -0,0 +1 @@
+../../../3rdparty/maple/sdk/host_customized/os_abstraction/bcmos_errno.c
\ No newline at end of file
diff --git a/bal_release/src/common/os_abstraction/bcmos_errno.h b/bal_release/src/common/os_abstraction/bcmos_errno.h
new file mode 120000
index 0000000..9bac886
--- /dev/null
+++ b/bal_release/src/common/os_abstraction/bcmos_errno.h
@@ -0,0 +1 @@
+../../../3rdparty/maple/sdk/host_customized/os_abstraction/bcmos_errno.h
\ No newline at end of file
diff --git a/bal_release/src/common/os_abstraction/bcmos_hash_table.c b/bal_release/src/common/os_abstraction/bcmos_hash_table.c
new file mode 120000
index 0000000..81cb3c0
--- /dev/null
+++ b/bal_release/src/common/os_abstraction/bcmos_hash_table.c
@@ -0,0 +1 @@
+../../../3rdparty/maple/sdk/host_customized/os_abstraction/bcmos_hash_table.c
\ No newline at end of file
diff --git a/bal_release/src/common/os_abstraction/bcmos_hash_table.h b/bal_release/src/common/os_abstraction/bcmos_hash_table.h
new file mode 120000
index 0000000..c0111be
--- /dev/null
+++ b/bal_release/src/common/os_abstraction/bcmos_hash_table.h
@@ -0,0 +1 @@
+../../../3rdparty/maple/sdk/host_customized/os_abstraction/bcmos_hash_table.h
\ No newline at end of file
diff --git a/bal_release/src/common/os_abstraction/bcmos_pack.h b/bal_release/src/common/os_abstraction/bcmos_pack.h
new file mode 120000
index 0000000..7582ed1
--- /dev/null
+++ b/bal_release/src/common/os_abstraction/bcmos_pack.h
@@ -0,0 +1 @@
+../../../3rdparty/maple/sdk/host_customized/os_abstraction/bcmos_pack.h
\ No newline at end of file
diff --git a/bal_release/src/common/os_abstraction/bcmos_queue.h b/bal_release/src/common/os_abstraction/bcmos_queue.h
new file mode 120000
index 0000000..cf2d81d
--- /dev/null
+++ b/bal_release/src/common/os_abstraction/bcmos_queue.h
@@ -0,0 +1 @@
+../../../3rdparty/maple/sdk/host_customized/os_abstraction/bcmos_queue.h
\ No newline at end of file
diff --git a/bal_release/src/common/os_abstraction/bcmos_rw_lock.c b/bal_release/src/common/os_abstraction/bcmos_rw_lock.c
new file mode 120000
index 0000000..bee8c23
--- /dev/null
+++ b/bal_release/src/common/os_abstraction/bcmos_rw_lock.c
@@ -0,0 +1 @@
+../../../3rdparty/maple/sdk/host_customized/os_abstraction/bcmos_rw_lock.c
\ No newline at end of file
diff --git a/bal_release/src/common/os_abstraction/bcmos_rw_lock.h b/bal_release/src/common/os_abstraction/bcmos_rw_lock.h
new file mode 120000
index 0000000..cd9e84d
--- /dev/null
+++ b/bal_release/src/common/os_abstraction/bcmos_rw_lock.h
@@ -0,0 +1 @@
+../../../3rdparty/maple/sdk/host_customized/os_abstraction/bcmos_rw_lock.h
\ No newline at end of file
diff --git a/bal_release/src/common/os_abstraction/bcmos_sysif.h b/bal_release/src/common/os_abstraction/bcmos_sysif.h
new file mode 120000
index 0000000..a9c8db8
--- /dev/null
+++ b/bal_release/src/common/os_abstraction/bcmos_sysif.h
@@ -0,0 +1 @@
+../../../3rdparty/maple/sdk/host_customized/os_abstraction/bcmos_sysif.h
\ No newline at end of file
diff --git a/bal_release/src/common/os_abstraction/bcmos_tree.h b/bal_release/src/common/os_abstraction/bcmos_tree.h
new file mode 120000
index 0000000..62433e7
--- /dev/null
+++ b/bal_release/src/common/os_abstraction/bcmos_tree.h
@@ -0,0 +1 @@
+../../../3rdparty/maple/sdk/host_customized/os_abstraction/bcmos_tree.h
\ No newline at end of file
diff --git a/bal_release/src/common/os_abstraction/bcmos_types.h b/bal_release/src/common/os_abstraction/bcmos_types.h
new file mode 120000
index 0000000..5e43582
--- /dev/null
+++ b/bal_release/src/common/os_abstraction/bcmos_types.h
@@ -0,0 +1 @@
+../../../3rdparty/maple/sdk/host_customized/os_abstraction/bcmos_types.h
\ No newline at end of file
diff --git a/bal_release/src/common/os_abstraction/cfe b/bal_release/src/common/os_abstraction/cfe
new file mode 120000
index 0000000..5dba27e
--- /dev/null
+++ b/bal_release/src/common/os_abstraction/cfe
@@ -0,0 +1 @@
+../../../3rdparty/maple/sdk/host_customized/os_abstraction/cfe
\ No newline at end of file
diff --git a/bal_release/src/common/os_abstraction/linux b/bal_release/src/common/os_abstraction/linux
new file mode 120000
index 0000000..ee2249d
--- /dev/null
+++ b/bal_release/src/common/os_abstraction/linux
@@ -0,0 +1 @@
+../../../3rdparty/maple/sdk/host_customized/os_abstraction/linux
\ No newline at end of file
diff --git a/bal_release/src/common/os_abstraction/os_cli b/bal_release/src/common/os_abstraction/os_cli
new file mode 120000
index 0000000..075f9b4
--- /dev/null
+++ b/bal_release/src/common/os_abstraction/os_cli
@@ -0,0 +1 @@
+../../../3rdparty/maple/sdk/host_customized/os_abstraction/os_cli
\ No newline at end of file
diff --git a/bal_release/src/common/os_abstraction/posix b/bal_release/src/common/os_abstraction/posix
new file mode 120000
index 0000000..9f04fee
--- /dev/null
+++ b/bal_release/src/common/os_abstraction/posix
@@ -0,0 +1 @@
+../../../3rdparty/maple/sdk/host_customized/os_abstraction/posix
\ No newline at end of file
diff --git a/bal_release/src/common/os_abstraction/vxworks55 b/bal_release/src/common/os_abstraction/vxworks55
new file mode 120000
index 0000000..5a3b0c5
--- /dev/null
+++ b/bal_release/src/common/os_abstraction/vxworks55
@@ -0,0 +1 @@
+../../../3rdparty/maple/sdk/host_customized/os_abstraction/vxworks55
\ No newline at end of file
diff --git a/bal_release/src/common/utils b/bal_release/src/common/utils
new file mode 120000
index 0000000..1d7a58c
--- /dev/null
+++ b/bal_release/src/common/utils
@@ -0,0 +1 @@
+../../3rdparty/maple/sdk/host_driver/utils
\ No newline at end of file