blob: f40b45328fc8f79613ec2ec965439ae4e77905d7 [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#ifndef _BCMOLT_EON_PRIVATE_H_
31#define _BCMOLT_EON_PRIVATE_H_
32
33/* xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
34 x This file is for internal use within the EPON OAM negotiation application. x
35 x x
36 x Outside code should not refer to anything defined or declared herein! x
37 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx */
38
39#include "bcmolt_eon.h" /* the private interface extends the public interface */
40#include "bcmolt_epon_oam_types.h"
41#include "bcm_dev_log.h"
42#include "bcmolt_utils.h"
43
44typedef struct
45{
46 uint8_t* payload; /* payload bytes in [DA,FCS) */
47 uint16_t length; /* frame length from DA to just before FCS */
48} eon_frame_data;
49
50/* map containing state of all EPON links with OAM negotiation underway or completed */
51typedef struct eon_link_state eon_link_state;
52typedef struct link_state_map link_state_map;
53RB_HEAD(link_state_map, eon_link_state);
54
55struct eon_link_state
56{
57 eon_link_key link_key; /* globally unique opaque entity id */
58 bcmos_timer oam_timer; /* timer used when awaiting oam responses */
59 eon_oam_set_id oam_set; /* OAM set applicable to the link */
60 bcmolt_epon_oam_oam_flags oam_state; /* OAM link negotiation state */
61 uint16_t revision; /* Local revision */
62 uint16_t max_pdu_size; /* max PDU size */
63 bcmolt_eon_result_cb callback; /* callback when negotiation is complete */
64 void *context; /* context for the above callback function */
65 bcmolt_epon_oam_local_remote_info remote_info; /* previous TLV received from the remote */
66 bcmos_mac_address epon_ni_mac_addr; /* MAC address to use for SA of egress OAM frames */
67 eon_frame_data rx; /* Final received OAM */
68 eon_frame_data tx; /* Final sent OAM */
69 bcmos_bool is_heartbeat_autostart; /* start heartbeat upon successful negotiation completion */
70 void *org_spec_state; /* State specific to the selected OAM set */
71 RB_ENTRY(eon_link_state) rb_entry;
72};
73
74typedef struct
75{
76 bcmos_task task;
77 char task_name[MAX_TASK_NAME_SIZE];
78 char msg_queue_name[MAX_MSG_QUEUE_NAME_SIZE];
79 dev_log_id log_id;
80 link_state_map link_state_map;
81} eon_global_state;
82
83#define LINK_KEY_FMT_STR "PON %u, "BCMOS_MACADDR_FMT_STR
84#define LINK_KEY_DATA(lkey) (lkey)->link.epon_ni, BCMOS_MACADDR_PARAMS(&(lkey)->link.mac_address)
85
86#define EON_LOG(level, device, format, args...) BCM_LOG(level, eon_state[device].log_id, format, ##args)
87#define EON_LINK_LOG(level, link_key, fmt, args...) \
88 BCM_LOG(level, eon_state[(link_key)->device_id].log_id, LINK_KEY_FMT_STR": "fmt, LINK_KEY_DATA(link_key), ##args)
89
90extern eon_global_state eon_state[BCMTR_MAX_OLTS];
91
92#endif // _BCMOLT_EON_PRIVATE_H_