blob: c6170f6dd47962548ec66f8c73abdb1b3a819516 [file] [log] [blame]
/*
<:copyright-BRCM:2016:DUAL/GPL:standard
Broadcom Proprietary and Confidential.(c) 2016 Broadcom
All Rights Reserved
Unless you and Broadcom execute a separate written software license
agreement governing use of this software, this software is licensed
to you under the terms of the GNU General Public License version 2
(the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
with the following added to such license:
As a special exception, the copyright holders of this software give
you permission to link this software with independent modules, and
to copy and distribute the resulting executable under terms of your
choice, provided that you also meet, for each linked independent
module, the terms and conditions of the license of that module.
An independent module is a module which is not derived from this
software. The special exception does not apply to any modifications
of the software.
Not withstanding the above, under no circumstances may you combine
this software in any way with any other Broadcom software provided
under a license other than the GPL, without Broadcom's express prior
written consent.
:>
*/
/* This file contains the pieces of the OAM negotiation state machine that are specific to BRCM OAM. */
#include "bcmolt_eon_private.h"
#include "../oam_common.h"
#include "brcm.h"
/* Org specific TLV to send to the ONU */
static const bcmolt_epon_oam_organization_specific_info brcm_tx_tlv =
{
.oui = BCMOLT_EPON_OAM_WELL_KNOWN_OUI_TEK,
.u =
{
.tek =
{
.tlvs =
{
.type = BCMOLT_EPON_OAM_TEK_INFO_TLV_TYPE_EXTENSION_SUPPORT,
.u =
{
.extension_support =
{
.version = 0,
.report_mode = BCMOLT_EPON_OAM_TEK_REPORT_MODES_TEKNOVUS,
.preferred_report_mode = BCMOLT_EPON_OAM_TEK_REPORT_MODES_TEKNOVUS
}
}
}
}
}
};
void brcm_tx_add_tlv(eon_link_state *link_state, bcmolt_epon_oam_oam_pdu_content *oam)
{
if (LOCAL_STABLE_REMOTE_STABLE == link_state->oam_state)
{
oam->u.info.tlvs[oam->u.info.tlvs_count].type = BCMOLT_EPON_OAM_INFO_TLV_TYPE_ORGANIZATION_SPECIFIC;
oam->u.info.tlvs[oam->u.info.tlvs_count].u.organization_specific.value = brcm_tx_tlv;
oam->u.info.tlvs_count++;
}
}
void brcm_rx_tlv(
eon_link_state *link_state,
bcmolt_epon_oam_organization_specific_info *org_spec,
bcmos_errno *rc)
{
if (link_state->oam_state == LOCAL_STABLE_REMOTE_STABLE)
{
if ((NULL == org_spec) ||
(BCMOLT_EPON_OAM_WELL_KNOWN_OUI_TEK != org_spec->oui) ||
(BCMOLT_EPON_OAM_TEK_INFO_TLV_TYPE_EXTENSION_SUPPORT != org_spec->u.tek.tlvs.type))
{
EON_LINK_LOG(INFO, &link_state->link_key, "Didn't get BRCM TLV\n");
*rc = BCM_ERR_ONU_ERR_RESP;
}
else
{
if ((0 != org_spec->u.tek.tlvs.u.extension_support.version) ||
(0 ==
(BCMOLT_EPON_OAM_TEK_REPORT_MODES_TEKNOVUS & org_spec->u.tek.tlvs.u.extension_support.report_mode)))
{
EON_LINK_LOG(
INFO, &link_state->link_key, "BRCM TLV contained bad info: version %u rpt modes %02x\n",
org_spec->u.tek.tlvs.u.extension_support.version,
org_spec->u.tek.tlvs.u.extension_support.report_mode);
*rc = BCM_ERR_NOT_SUPPORTED;
}
}
}
else
{
if (NULL != org_spec)
{
EON_LINK_LOG(INFO, &link_state->link_key, "Got unexpected organization specific TLV\n");
*rc = BCM_ERR_ONU_ERR_RESP;
}
}
}