blob: c6170f6dd47962548ec66f8c73abdb1b3a819516 [file] [log] [blame]
Shad Ansari2f7f9be2017-06-07 13:34:53 -07001/*
2<:copyright-BRCM:2016:DUAL/GPL:standard
3
4 Broadcom Proprietary and Confidential.(c) 2016 Broadcom
5 All Rights Reserved
6
7Unless you and Broadcom execute a separate written software license
8agreement governing use of this software, this software is licensed
9to you under the terms of the GNU General Public License version 2
10(the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
11with the following added to such license:
12
13 As a special exception, the copyright holders of this software give
14 you permission to link this software with independent modules, and
15 to copy and distribute the resulting executable under terms of your
16 choice, provided that you also meet, for each linked independent
17 module, the terms and conditions of the license of that module.
18 An independent module is a module which is not derived from this
19 software. The special exception does not apply to any modifications
20 of the software.
21
22Not withstanding the above, under no circumstances may you combine
23this software in any way with any other Broadcom software provided
24under a license other than the GPL, without Broadcom's express prior
25written consent.
26
27:>
28*/
29
30/* This file contains the pieces of the OAM negotiation state machine that are specific to BRCM OAM. */
31
32#include "bcmolt_eon_private.h"
33#include "../oam_common.h"
34#include "brcm.h"
35
36/* Org specific TLV to send to the ONU */
37static const bcmolt_epon_oam_organization_specific_info brcm_tx_tlv =
38{
39 .oui = BCMOLT_EPON_OAM_WELL_KNOWN_OUI_TEK,
40 .u =
41 {
42 .tek =
43 {
44 .tlvs =
45 {
46 .type = BCMOLT_EPON_OAM_TEK_INFO_TLV_TYPE_EXTENSION_SUPPORT,
47 .u =
48 {
49 .extension_support =
50 {
51 .version = 0,
52 .report_mode = BCMOLT_EPON_OAM_TEK_REPORT_MODES_TEKNOVUS,
53 .preferred_report_mode = BCMOLT_EPON_OAM_TEK_REPORT_MODES_TEKNOVUS
54 }
55 }
56 }
57 }
58 }
59};
60
61void brcm_tx_add_tlv(eon_link_state *link_state, bcmolt_epon_oam_oam_pdu_content *oam)
62{
63 if (LOCAL_STABLE_REMOTE_STABLE == link_state->oam_state)
64 {
65 oam->u.info.tlvs[oam->u.info.tlvs_count].type = BCMOLT_EPON_OAM_INFO_TLV_TYPE_ORGANIZATION_SPECIFIC;
66 oam->u.info.tlvs[oam->u.info.tlvs_count].u.organization_specific.value = brcm_tx_tlv;
67 oam->u.info.tlvs_count++;
68 }
69}
70
71void brcm_rx_tlv(
72 eon_link_state *link_state,
73 bcmolt_epon_oam_organization_specific_info *org_spec,
74 bcmos_errno *rc)
75{
76 if (link_state->oam_state == LOCAL_STABLE_REMOTE_STABLE)
77 {
78 if ((NULL == org_spec) ||
79 (BCMOLT_EPON_OAM_WELL_KNOWN_OUI_TEK != org_spec->oui) ||
80 (BCMOLT_EPON_OAM_TEK_INFO_TLV_TYPE_EXTENSION_SUPPORT != org_spec->u.tek.tlvs.type))
81 {
82 EON_LINK_LOG(INFO, &link_state->link_key, "Didn't get BRCM TLV\n");
83 *rc = BCM_ERR_ONU_ERR_RESP;
84 }
85 else
86 {
87 if ((0 != org_spec->u.tek.tlvs.u.extension_support.version) ||
88 (0 ==
89 (BCMOLT_EPON_OAM_TEK_REPORT_MODES_TEKNOVUS & org_spec->u.tek.tlvs.u.extension_support.report_mode)))
90 {
91 EON_LINK_LOG(
92 INFO, &link_state->link_key, "BRCM TLV contained bad info: version %u rpt modes %02x\n",
93 org_spec->u.tek.tlvs.u.extension_support.version,
94 org_spec->u.tek.tlvs.u.extension_support.report_mode);
95 *rc = BCM_ERR_NOT_SUPPORTED;
96 }
97 }
98 }
99 else
100 {
101 if (NULL != org_spec)
102 {
103 EON_LINK_LOG(INFO, &link_state->link_key, "Got unexpected organization specific TLV\n");
104 *rc = BCM_ERR_ONU_ERR_RESP;
105 }
106 }
107}
108