blob: f40b45328fc8f79613ec2ec965439ae4e77905d7 [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_EON_PRIVATE_H_
#define _BCMOLT_EON_PRIVATE_H_
/* xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
x This file is for internal use within the EPON OAM negotiation application. x
x x
x Outside code should not refer to anything defined or declared herein! x
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx */
#include "bcmolt_eon.h" /* the private interface extends the public interface */
#include "bcmolt_epon_oam_types.h"
#include "bcm_dev_log.h"
#include "bcmolt_utils.h"
typedef struct
{
uint8_t* payload; /* payload bytes in [DA,FCS) */
uint16_t length; /* frame length from DA to just before FCS */
} eon_frame_data;
/* map containing state of all EPON links with OAM negotiation underway or completed */
typedef struct eon_link_state eon_link_state;
typedef struct link_state_map link_state_map;
RB_HEAD(link_state_map, eon_link_state);
struct eon_link_state
{
eon_link_key link_key; /* globally unique opaque entity id */
bcmos_timer oam_timer; /* timer used when awaiting oam responses */
eon_oam_set_id oam_set; /* OAM set applicable to the link */
bcmolt_epon_oam_oam_flags oam_state; /* OAM link negotiation state */
uint16_t revision; /* Local revision */
uint16_t max_pdu_size; /* max PDU size */
bcmolt_eon_result_cb callback; /* callback when negotiation is complete */
void *context; /* context for the above callback function */
bcmolt_epon_oam_local_remote_info remote_info; /* previous TLV received from the remote */
bcmos_mac_address epon_ni_mac_addr; /* MAC address to use for SA of egress OAM frames */
eon_frame_data rx; /* Final received OAM */
eon_frame_data tx; /* Final sent OAM */
bcmos_bool is_heartbeat_autostart; /* start heartbeat upon successful negotiation completion */
void *org_spec_state; /* State specific to the selected OAM set */
RB_ENTRY(eon_link_state) rb_entry;
};
typedef struct
{
bcmos_task task;
char task_name[MAX_TASK_NAME_SIZE];
char msg_queue_name[MAX_MSG_QUEUE_NAME_SIZE];
dev_log_id log_id;
link_state_map link_state_map;
} eon_global_state;
#define LINK_KEY_FMT_STR "PON %u, "BCMOS_MACADDR_FMT_STR
#define LINK_KEY_DATA(lkey) (lkey)->link.epon_ni, BCMOS_MACADDR_PARAMS(&(lkey)->link.mac_address)
#define EON_LOG(level, device, format, args...) BCM_LOG(level, eon_state[device].log_id, format, ##args)
#define EON_LINK_LOG(level, link_key, fmt, args...) \
BCM_LOG(level, eon_state[(link_key)->device_id].log_id, LINK_KEY_FMT_STR": "fmt, LINK_KEY_DATA(link_key), ##args)
extern eon_global_state eon_state[BCMTR_MAX_OLTS];
#endif // _BCMOLT_EON_PRIVATE_H_