/*
 * DO NOT EDIT THIS FILE!
 * This file is auto-generated.
 * Edits to this file will be lost when it is regenerated.
 *
 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
 * 
 * Copyright 2007-2020 Broadcom Inc. All rights reserved.
 */

#include <bcm/types.h>

#include <bcm_int/ltsw/mbcm/ecn.h>
#include <bcm_int/ltsw/mbcm/mbcm.h>

#include <shr/shr_debug.h>

/******************************************************************************
 * Local definitions
 */

#define BSL_LOG_MODULE BSL_LS_BCM_COSQ

/*!
 * \brief The Ecn mbcm drivers.
 */
static mbcm_ltsw_ecn_drv_t mbcm_ltsw_ecn_drv[BCM_MAX_NUM_UNITS];

/******************************************************************************
 * Private functions
 */

/******************************************************************************
 * Public functions
 */

int
mbcm_ltsw_ecn_drv_set(
    int unit,
    mbcm_ltsw_ecn_drv_t *drv)
{
    mbcm_ltsw_ecn_drv_t *local = &mbcm_ltsw_ecn_drv[unit];

    SHR_FUNC_ENTER(unit);


    mbcm_ltsw_drv_init((mbcm_ltsw_drv_t *)local,
                       (mbcm_ltsw_drv_t *)drv,
                       sizeof(*local)/MBCM_LTSW_FNPTR_SZ);

    SHR_EXIT();

exit:
    SHR_FUNC_EXIT();
}

int
mbcm_ltsw_ecn_deinit(int unit)
{
    SHR_FUNC_ENTER(unit);

    SHR_IF_ERR_VERBOSE_EXIT
        (mbcm_ltsw_ecn_drv[unit].ecn_deinit(unit));

exit:
    SHR_FUNC_EXIT();
}

int
mbcm_ltsw_ecn_init(int unit)
{
    SHR_FUNC_ENTER(unit);

    SHR_IF_ERR_VERBOSE_EXIT
        (mbcm_ltsw_ecn_drv[unit].ecn_init(unit));

exit:
    SHR_FUNC_EXIT();
}

int
mbcm_ltsw_ecn_map_create(
    int unit,
    uint32_t flags,
    int *ecn_map_id)
{
    SHR_FUNC_ENTER(unit);

    SHR_IF_ERR_VERBOSE_EXIT
        (mbcm_ltsw_ecn_drv[unit].ecn_map_create(unit, flags, ecn_map_id));

exit:
    SHR_FUNC_EXIT();
}

int
mbcm_ltsw_ecn_map_destroy(
    int unit,
    int ecn_map_id)
{
    SHR_FUNC_ENTER(unit);

    SHR_IF_ERR_VERBOSE_EXIT
        (mbcm_ltsw_ecn_drv[unit].ecn_map_destroy(unit, ecn_map_id));

exit:
    SHR_FUNC_EXIT();
}

int
mbcm_ltsw_ecn_map_set(
    int unit,
    uint32_t options,
    int ecn_map_id,
    bcm_ecn_map_t *ecn_map)
{
    SHR_FUNC_ENTER(unit);

    SHR_IF_ERR_VERBOSE_EXIT
        (mbcm_ltsw_ecn_drv[unit].ecn_map_set(unit, options, ecn_map_id, ecn_map));

exit:
    SHR_FUNC_EXIT();
}

int
mbcm_ltsw_ecn_map_get(
    int unit,
    int ecn_map_id,
    bcm_ecn_map_t *ecn_map)
{
    SHR_FUNC_ENTER(unit);

    SHR_IF_ERR_VERBOSE_EXIT
        (mbcm_ltsw_ecn_drv[unit].ecn_map_get(unit, ecn_map_id, ecn_map));

exit:
    SHR_FUNC_EXIT();
}

int
mbcm_ltsw_ecn_responsive_protocol_set(
    int unit,
    uint8 ip_proto,
    int responsive)
{
    SHR_FUNC_ENTER(unit);

    SHR_IF_ERR_VERBOSE_EXIT
        (mbcm_ltsw_ecn_drv[unit].ecn_responsive_protocol_set(unit, ip_proto, responsive));

exit:
    SHR_FUNC_EXIT();
}

int
mbcm_ltsw_ecn_responsive_protocol_get(
    int unit,
    uint8 ip_proto,
    int *responsive)
{
    SHR_FUNC_ENTER(unit);

    SHR_IF_ERR_VERBOSE_EXIT
        (mbcm_ltsw_ecn_drv[unit].ecn_responsive_protocol_get(unit, ip_proto, responsive));

exit:
    SHR_FUNC_EXIT();
}

int
mbcm_ltsw_ecn_port_map_get(
    int unit,
    bcm_gport_t port,
    bcm_ecn_port_map_t *ecn_map)
{
    SHR_FUNC_ENTER(unit);

    SHR_IF_ERR_VERBOSE_EXIT
        (mbcm_ltsw_ecn_drv[unit].ecn_port_map_get(unit, port, ecn_map));

exit:
    SHR_FUNC_EXIT();
}

int
mbcm_ltsw_ecn_port_map_set(
    int unit,
    bcm_gport_t port,
    bcm_ecn_port_map_t *ecn_map)
{
    SHR_FUNC_ENTER(unit);

    SHR_IF_ERR_VERBOSE_EXIT
        (mbcm_ltsw_ecn_drv[unit].ecn_port_map_set(unit, port, ecn_map));

exit:
    SHR_FUNC_EXIT();
}

int
mbcm_ltsw_ecn_type_map_get(
    int unit,
    uint32_t flags,
    bcm_ecn_type_map_t *map)
{
    SHR_FUNC_ENTER(unit);

    SHR_IF_ERR_VERBOSE_EXIT
        (mbcm_ltsw_ecn_drv[unit].ecn_type_map_get(unit, flags, map));

exit:
    SHR_FUNC_EXIT();
}

int
mbcm_ltsw_ecn_type_map_set(
    int unit,
    uint32_t flags,
    bcm_ecn_type_map_t *map)
{
    SHR_FUNC_ENTER(unit);

    SHR_IF_ERR_VERBOSE_EXIT
        (mbcm_ltsw_ecn_drv[unit].ecn_type_map_set(unit, flags, map));

exit:
    SHR_FUNC_EXIT();
}

int
mbcm_ltsw_ecn_latency_based_mode_set(
    int unit,
    bcm_switch_latency_ecn_mark_mode_t mode)
{
    SHR_FUNC_ENTER(unit);

    SHR_IF_ERR_VERBOSE_EXIT
        (mbcm_ltsw_ecn_drv[unit].ecn_latency_based_mode_set(unit, mode));

exit:
    SHR_FUNC_EXIT();
}

int
mbcm_ltsw_ecn_latency_based_mode_get(
    int unit,
    bcm_switch_latency_ecn_mark_mode_t *mode)
{
    SHR_FUNC_ENTER(unit);

    SHR_IF_ERR_VERBOSE_EXIT
        (mbcm_ltsw_ecn_drv[unit].ecn_latency_based_mode_get(unit, mode));

exit:
    SHR_FUNC_EXIT();
}

int
mbcm_ltsw_ecn_latency_based_threshold_set(
    int unit,
    bcm_gport_t gport,
    bcm_cos_queue_t cosq,
    bcm_switch_latency_ecn_mark_mode_t mode,
    uint32_t threshold)
{
    SHR_FUNC_ENTER(unit);

    SHR_IF_ERR_VERBOSE_EXIT
        (mbcm_ltsw_ecn_drv[unit].ecn_latency_based_threshold_set(unit, gport, cosq, mode, threshold));

exit:
    SHR_FUNC_EXIT();
}

int
mbcm_ltsw_ecn_latency_based_threshold_get(
    int unit,
    bcm_gport_t gport,
    bcm_cos_queue_t cosq,
    bcm_switch_latency_ecn_mark_mode_t mode,
    uint32_t *threshold)
{
    SHR_FUNC_ENTER(unit);

    SHR_IF_ERR_VERBOSE_EXIT
        (mbcm_ltsw_ecn_drv[unit].ecn_latency_based_threshold_get(unit, gport, cosq, mode, threshold));

exit:
    SHR_FUNC_EXIT();
}

int
mbcm_ltsw_ecn_map_id_resolve(
    int unit,
    int ecn_map_id,
    int *ecn_map_type,
    uint32_t *prof_id)
{
    SHR_FUNC_ENTER(unit);

    SHR_IF_ERR_VERBOSE_EXIT
        (mbcm_ltsw_ecn_drv[unit].ecn_map_id_resolve(unit, ecn_map_id, ecn_map_type, prof_id));

exit:
    SHR_FUNC_EXIT();
}

int
mbcm_ltsw_ecn_map_id_construct(
    int unit,
    int ecn_map_type,
    uint32_t prof_id,
    int *ecn_map_id)
{
    SHR_FUNC_ENTER(unit);

    SHR_IF_ERR_VERBOSE_EXIT
        (mbcm_ltsw_ecn_drv[unit].ecn_map_id_construct(unit, ecn_map_type, prof_id, ecn_map_id));

exit:
    SHR_FUNC_EXIT();
}

int
mbcm_ltsw_ecn_traffic_map_set(
    int unit,
    bcm_ecn_traffic_map_info_t *map)
{
    SHR_FUNC_ENTER(unit);

    SHR_IF_ERR_VERBOSE_EXIT
        (mbcm_ltsw_ecn_drv[unit].ecn_traffic_map_set(unit, map));

exit:
    SHR_FUNC_EXIT();
}

int
mbcm_ltsw_ecn_traffic_map_get(
    int unit,
    bcm_ecn_traffic_map_info_t *map)
{
    SHR_FUNC_ENTER(unit);

    SHR_IF_ERR_VERBOSE_EXIT
        (mbcm_ltsw_ecn_drv[unit].ecn_traffic_map_get(unit, map));

exit:
    SHR_FUNC_EXIT();
}

int
mbcm_ltsw_ecn_action_enqueue_set(
    int unit,
    bcm_ecn_traffic_action_config_t *ecn_config)
{
    SHR_FUNC_ENTER(unit);

    SHR_IF_ERR_VERBOSE_EXIT
        (mbcm_ltsw_ecn_drv[unit].ecn_action_enqueue_set(unit, ecn_config));

exit:
    SHR_FUNC_EXIT();
}

int
mbcm_ltsw_ecn_action_enqueue_get(
    int unit,
    bcm_ecn_traffic_action_config_t *ecn_config)
{
    SHR_FUNC_ENTER(unit);

    SHR_IF_ERR_VERBOSE_EXIT
        (mbcm_ltsw_ecn_drv[unit].ecn_action_enqueue_get(unit, ecn_config));

exit:
    SHR_FUNC_EXIT();
}

int
mbcm_ltsw_ecn_action_dequeue_set(
    int unit,
    bcm_ecn_traffic_action_config_t *ecn_config)
{
    SHR_FUNC_ENTER(unit);

    SHR_IF_ERR_VERBOSE_EXIT
        (mbcm_ltsw_ecn_drv[unit].ecn_action_dequeue_set(unit, ecn_config));

exit:
    SHR_FUNC_EXIT();
}

int
mbcm_ltsw_ecn_action_dequeue_get(
    int unit,
    bcm_ecn_traffic_action_config_t *ecn_config)
{
    SHR_FUNC_ENTER(unit);

    SHR_IF_ERR_VERBOSE_EXIT
        (mbcm_ltsw_ecn_drv[unit].ecn_action_dequeue_get(unit, ecn_config));

exit:
    SHR_FUNC_EXIT();
}

int
mbcm_ltsw_ecn_action_egress_set(
    int unit,
    bcm_ecn_traffic_action_config_t *ecn_config)
{
    SHR_FUNC_ENTER(unit);

    SHR_IF_ERR_VERBOSE_EXIT
        (mbcm_ltsw_ecn_drv[unit].ecn_action_egress_set(unit, ecn_config));

exit:
    SHR_FUNC_EXIT();
}

int
mbcm_ltsw_ecn_action_egress_get(
    int unit,
    bcm_ecn_traffic_action_config_t *ecn_config)
{
    SHR_FUNC_ENTER(unit);

    SHR_IF_ERR_VERBOSE_EXIT
        (mbcm_ltsw_ecn_drv[unit].ecn_action_egress_get(unit, ecn_config));

exit:
    SHR_FUNC_EXIT();
}

int
mbcm_ltsw_ecn_action_latency_dequeue_set(
    int unit,
    bcm_ecn_traffic_action_config_t *ecn_config)
{
    SHR_FUNC_ENTER(unit);

    SHR_IF_ERR_VERBOSE_EXIT
        (mbcm_ltsw_ecn_drv[unit].ecn_action_latency_dequeue_set(unit, ecn_config));

exit:
    SHR_FUNC_EXIT();
}

int
mbcm_ltsw_ecn_action_latency_dequeue_get(
    int unit,
    bcm_ecn_traffic_action_config_t *ecn_config)
{
    SHR_FUNC_ENTER(unit);

    SHR_IF_ERR_VERBOSE_EXIT
        (mbcm_ltsw_ecn_drv[unit].ecn_action_latency_dequeue_get(unit, ecn_config));

exit:
    SHR_FUNC_EXIT();
}

int
mbcm_ltsw_ecn_responsive_default_set(
    int unit,
    int value)
{
    SHR_FUNC_ENTER(unit);

    SHR_IF_ERR_VERBOSE_EXIT
        (mbcm_ltsw_ecn_drv[unit].ecn_responsive_default_set(unit, value));

exit:
    SHR_FUNC_EXIT();
}

int
mbcm_ltsw_ecn_responsive_default_get(
    int unit,
    int *value)
{
    SHR_FUNC_ENTER(unit);

    SHR_IF_ERR_VERBOSE_EXIT
        (mbcm_ltsw_ecn_drv[unit].ecn_responsive_default_get(unit, value));

exit:
    SHR_FUNC_EXIT();
}

int
mbcm_ltsw_ecn_ctrl_set(
    int unit,
    const char *lt_name,
    const char *lt_fld_name,
    int val)
{
    SHR_FUNC_ENTER(unit);

    SHR_IF_ERR_VERBOSE_EXIT
        (mbcm_ltsw_ecn_drv[unit].ecn_ctrl_set(unit, lt_name, lt_fld_name, val));

exit:
    SHR_FUNC_EXIT();
}

int
mbcm_ltsw_ecn_ctrl_get(
    int unit,
    const char *lt_name,
    const char *lt_fld_name,
    int *val)
{
    SHR_FUNC_ENTER(unit);

    SHR_IF_ERR_VERBOSE_EXIT
        (mbcm_ltsw_ecn_drv[unit].ecn_ctrl_get(unit, lt_name, lt_fld_name, val));

exit:
    SHR_FUNC_EXIT();
}

int
mbcm_ltsw_ecn_type_map_traverse(
    int unit,
    uint32_t flags,
    bcm_ecn_type_map_traverse_cb cb,
    void *user_data)
{
    SHR_FUNC_ENTER(unit);

    SHR_IF_ERR_VERBOSE_EXIT
        (mbcm_ltsw_ecn_drv[unit].ecn_type_map_traverse(unit, flags, cb, user_data));

exit:
    SHR_FUNC_EXIT();
}

int
mbcm_ltsw_ecn_sfc_qos_phb_setup(int unit)
{
    SHR_FUNC_ENTER(unit);

    SHR_IF_ERR_VERBOSE_EXIT
        (mbcm_ltsw_ecn_drv[unit].ecn_sfc_qos_phb_setup(unit));

exit:
    SHR_FUNC_EXIT();
}

