| /* |
| <: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 DPoE OAM. */ |
| |
| #include "bcmolt_eon_private.h" |
| #include "../oam_common.h" |
| #include "dpoe.h" |
| |
| /* Org specific TLV to send to the ONU */ |
| static const bcmolt_epon_oam_organization_specific_info dpoe_tx_tlv = |
| { |
| .oui = BCMOLT_EPON_OAM_WELL_KNOWN_OUI_DPOE, |
| .u = |
| { |
| .dpoe = |
| { |
| .dpoe_info_tlv = |
| { |
| .type = BCMOLT_EPON_OAM_DPOE_INFO_TLV_TYPE_DPOE_OAM_SUPPORT, |
| .u = |
| { |
| .dpoe_oam_support = |
| { |
| .dpoe_oam_version = 0x11 |
| } |
| } |
| } |
| } |
| } |
| }; |
| |
| void dpoe_tx_add_tlv(eon_link_state *link_state, bcmolt_epon_oam_oam_pdu_content *oam) |
| { |
| if ((LOCAL_EVAL_REMOTE_EVAL == link_state->oam_state) || |
| (LOCAL_STABLE_REMOTE_EVAL == 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 = dpoe_tx_tlv; |
| oam->u.info.tlvs_count++; |
| } |
| } |
| |
| void dpoe_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) |
| { |
| EON_LINK_LOG(INFO, &link_state->link_key, "Got unexpected organization specific TLV\n"); |
| *rc = BCM_ERR_ONU_ERR_RESP; |
| } |
| } |
| else |
| { |
| if ((NULL == org_spec) || |
| (BCMOLT_EPON_OAM_WELL_KNOWN_OUI_DPOE != org_spec->oui) || |
| (BCMOLT_EPON_OAM_DPOE_INFO_TLV_TYPE_DPOE_OAM_SUPPORT != org_spec->u.dpoe.dpoe_info_tlv.type)) |
| { |
| EON_LINK_LOG(INFO, &link_state->link_key, "Didn't get DPoE TLV\n"); |
| *rc = BCM_ERR_ONU_ERR_RESP; |
| } |
| else |
| { |
| switch (org_spec->u.dpoe.dpoe_info_tlv.u.dpoe_oam_support.dpoe_oam_version) |
| { |
| case 0x22: |
| case 0x21: |
| case 0x20: |
| case 0x11: /* DPoE v1.0 I05 and higher */ |
| break; |
| case 0x01: /* backwards compatibility, same as 0x10 */ |
| case 0x02: /* pre-DPoE OAM, no Certificate Authority support */ |
| case 0x03: /* pre-DPoE OAM, with Certificate Authority support */ |
| case 0x10: /* DPoE v1.0 I04 and lower */ |
| EON_LINK_LOG( |
| WARNING, &link_state->link_key, |
| "DPoE TLV contained old version: %u (some features may not work)\n", |
| org_spec->u.dpoe.dpoe_info_tlv.u.dpoe_oam_support.dpoe_oam_version); |
| break; |
| case 0x00: /* workaround for EASW-17839 */ |
| break; |
| default: |
| EON_LINK_LOG( |
| ERROR, &link_state->link_key, "DPoE TLV contained bad version: %u\n", |
| org_spec->u.dpoe.dpoe_info_tlv.u.dpoe_oam_support.dpoe_oam_version); |
| *rc = BCM_ERR_NOT_SUPPORTED; |
| break; |
| } |
| } |
| } |
| } |
| |