blob: c5dc9ed39bb16c3ee0fcfeec69c658a953a74cc0 [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.
:>
*/
#ifndef _BCMOLT_USER_APPL_EPON_OAM_H_
#define _BCMOLT_USER_APPL_EPON_OAM_H_
#include "bcmcli.h"
#include "bcmolt_msg.h"
#include "bcmolt_epon_oam_types.h"
#define MAX_QUEUE_SETS 4
#define MAX_REPORT_THRESHOLDS 8
static const bcmos_mac_address slow_protocol_multicast_mac = {{0x01,0x80,0xc2,0x00,0x00,0x02}};
/* Typedef required for conveying a 2-dimensional array to epon_oam_dpoe_set_report_thresholds(). */
typedef uint16_t bcmolt_epon_oam_queue_sets[MAX_QUEUE_SETS][MAX_REPORT_THRESHOLDS];
typedef enum
{
BCMOLT_USER_APPL_EPON_OAM_RX_ID_LINK_FAULT,
BCMOLT_USER_APPL_EPON_OAM_RX_ID_DYING_GASP,
BCMOLT_USER_APPL_EPON_OAM_RX_ID_CRITICAL_EVENT,
BCMOLT_USER_APPL_EPON_OAM_RX_ID_DPOE_EVENT,
BCMOLT_USER_APPL_EPON_OAM_RX_ID_DPOE_GET_RESPONSE,
BCMOLT_USER_APPL_EPON_OAM_RX_ID_DPOE_SET_RESPONSE,
} bcmolt_user_appl_epon_oam_rx_id;
typedef enum
{
DPOE_RULE_VLAN_MODE_NONE,
DPOE_RULE_VLAN_MODE_ADD,
DPOE_RULE_VLAN_MODE_REMOVE,
DPOE_RULE_VLAN_MODE_COUNT
} dpoe_rule_vlan_mode;
/* During parsing of OAM indication, this optional callback may be called. */
typedef void (*bcmolt_user_appl_epon_oam_handle_rx_cb)(bcmolt_devid device_id,
bcmolt_epon_ni epon_ni,
const bcmos_mac_address *mac,
bcmolt_user_appl_epon_oam_rx_id id,
bcmos_errno rc);
/* Callback 'cb' is optional. */
void bcmolt_user_appl_epon_oam_handle_rx(bcmolt_devid device_id,
bcmolt_proxy_rx *rx,
bcmolt_user_appl_epon_oam_handle_rx_cb cb);
bcmos_errno epon_oam_pack_frame(bcmolt_epon_oam_ethernet_frame *oam_frame, uint8_t **buffer, uint16_t *length);
bcmos_errno epon_oam_pack_and_send(bcmolt_devid device_id,
bcmolt_epon_ni epon,
const bcmos_mac_address *mac,
bcmolt_epon_oam_ethernet_frame *oam_frame);
bcmolt_epon_oam_ethernet_frame *epon_oam_unpack(bcmolt_devid device_id, uint32_t len, uint8_t *bytes);
bcmos_errno epon_oam_dpoe_get_critical_info(bcmolt_devid device_id,
bcmolt_epon_ni epon,
bcmos_mac_address *mac);
bcmos_errno epon_oam_dpoe_set_oam_rate(bcmolt_devid device_id,
bcmolt_epon_ni epon,
bcmos_mac_address *mac,
uint8_t min,
uint8_t max);
bcmos_errno epon_oam_dpoe_set_report_thresholds(bcmolt_devid device_id,
bcmolt_epon_ni epon,
bcmos_mac_address *mac,
uint8_t report_values_per_queue_set,
bcmolt_epon_oam_queue_sets queue_sets,
uint8_t num_queue_sets);
bcmos_errno epon_oam_dpoe_set_encryption(
bcmolt_devid device_id,
bcmolt_epon_ni epon,
bcmos_mac_address *mac,
bcmolt_epon_oam_dpoe_encryption_mode enc_mode,
uint16_t period);
bcmos_bool epon_oam_is_dpoe(bcmolt_epon_oam_ethernet_frame *oam);
bcmos_bool epon_oam_is_dpoe_encrypt_response(bcmolt_epon_oam_dpoe_vendor_extended_base *dpoe);
bcmos_errno epon_oam_dpoe_clear_ingress_rules_network_pon(bcmolt_devid device_id,
bcmolt_epon_ni epon,
bcmos_mac_address *mac);
bcmos_errno epon_oam_dpoe_clear_ingress_rules_user_port(bcmolt_devid device_id,
bcmolt_epon_ni epon,
bcmos_mac_address *mac);
bcmos_errno epon_oam_dpoe_clear_ingress_rules(bcmolt_devid device_id,
bcmolt_epon_ni epon,
bcmos_mac_address *mac);
bcmos_errno epon_oam_dpoe_set_basic_queue_config(bcmolt_devid device_id,
bcmolt_epon_ni epon,
bcmos_mac_address *mac,
uint8_t up_queue_size,
uint8_t dn_queue_size);
bcmos_errno epon_oam_dpoe_add_ingress_rules_network_pon(bcmolt_devid device_id,
bcmolt_epon_ni epon,
bcmos_mac_address *mac,
dpoe_rule_vlan_mode vlan_mode,
uint8_t vlan_tag[4]);
bcmos_errno epon_oam_dpoe_add_ingress_rules_user_port(bcmolt_devid device_id,
bcmolt_epon_ni epon,
bcmos_mac_address *mac,
dpoe_rule_vlan_mode vlan_mode,
uint8_t vlan_tag[4]);
bcmos_errno epon_oam_dpoe_add_ingress_rules(bcmolt_devid device_id,
bcmolt_epon_ni epon,
bcmos_mac_address *mac);
bcmos_errno epon_oam_dpoe_add_ingress_rules_with_vlan(bcmolt_devid device_id,
bcmolt_epon_ni epon,
bcmos_mac_address *mac,
uint8_t vlan_tag[4]);
bcmos_errno epon_oam_dpoe_enable_user_traffic(bcmolt_devid device_id,
bcmolt_epon_ni epon,
bcmos_mac_address *mac);
bcmos_errno epon_oam_dpoe_disable_user_traffic(bcmolt_devid device_id,
bcmolt_epon_ni epon,
bcmos_mac_address *mac);
bcmos_errno epon_oam_dpoe_start_upgrade(bcmolt_devid device_id,
bcmolt_epon_ni epon,
bcmos_mac_address *mac,
const char *fw_file,
uint16_t block_size,
uint8_t timeout_sec);
bcmos_errno epon_oam_dpoe_reset_onu(bcmolt_devid device_id, bcmolt_epon_ni epon, bcmos_mac_address *mac);
void bcmolt_user_appl_epon_oam_init(void);
#endif