openbcm

Git mirror of https://github.com/Broadcom-Network-Switching-Software/OpenBCM
git clone git://git.finwo.net/mirror/broadcom/openbcm
Log | Files | Refs | README

bhh_pack.h (5603B)


      1 /* 
      2  * 
      3  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      4  * 
      5  * Copyright 2007-2019 Broadcom Inc. All rights reserved.
      6  *
      7  * File:        bhh_pack.h
      8  * Purpose:     Interface to pack and unpack routines common to
      9  *              SDK and uKernel for:
     10  *              - BHH Control messages
     11  *              - Network Packet headers
     12  *
     13  *              This is to be shared between SDK host and uKernel.
     14  */
     15 
     16 #ifndef   _SOC_SHARED_BHH_PACK_H_
     17 #define   _SOC_SHARED_BHH_PACK_H_
     18 
     19 #ifdef BCM_UKERNEL
     20   /* Build for uKernel not SDK */
     21   #include "sdk_typedefs.h"
     22 #else
     23   #include <sal/types.h>
     24 #endif
     25 
     26 #include <soc/shared/bhh_msg.h>
     27 #include <soc/shared/bhh_pkt.h>
     28 
     29 /*
     30  * TLV Types
     31  */
     32 #define SHR_BHH_TLV_END            0x00
     33 #define SHR_BHH_TLV_TARGET_MEP     0x21
     34 #define SHR_BHH_TLV_REPLYING_MEP   0x22
     35 #define SHR_BHH_TLV_REQUESTING_MEP 0x23
     36 
     37 /*
     38  * TLV Subtypes
     39  */
     40 #define SHR_BHH_TLV_MEP_SUB_INGRESS_DISCOVERY 0x00
     41 #define SHR_BHH_TLV_MEP_SUB_EGRESS_DISCOVERY  0x01
     42 #define SHR_BHH_TLV_MEP_SUB_MEP_ICC_ID        0x02
     43 #define SHR_BHH_TLV_MEP_SUB_MIP_ICC_ID        0x03
     44 
     45 #define SHR_BHH_ID_ZERO_LEN 24
     46 
     47 
     48 typedef struct {
     49     uint8 zero[24];
     50 } bhh_discovery_id_t;
     51 
     52 typedef struct {
     53     uint16 mep_id;
     54     uint8 zero[22];
     55 } bhh_reply_icc_t;
     56 
     57 typedef struct {
     58     uint8 carrier_code[6];
     59     uint32 node_id;
     60     uint32 if_num;
     61     uint8  zero[10];
     62 } bhh_reply_mip_icc_t;
     63 
     64 typedef struct {
     65     uint16 mep_id;
     66     uint8  meg_id[48];
     67     uint16 reserved;
     68 } bhh_requesting_mep_t;
     69 
     70 #define SHR_BHH_TLV_MAX_VALUE_LEN sizeof(bhh_requesting_mep_t)
     71 
     72 typedef struct {
     73     uint8  type;
     74     uint16 length;
     75     uint8  subtype;
     76     union {
     77 	uint8 data[SHR_BHH_TLV_MAX_VALUE_LEN];
     78 	bhh_discovery_id_t   discovery;
     79 	bhh_reply_icc_t      reply_icc;
     80 	bhh_reply_mip_icc_t  reply_mip_icc;
     81 	bhh_requesting_mep_t requesting;
     82     } value;
     83 } shr_bhh_tlv_t;
     84 
     85 /* BHH Control Messages pack/unpack */
     86 extern uint8 *
     87 shr_bhh_msg_ctrl_init_pack(uint8 *buf, shr_bhh_msg_ctrl_init_t *msg);
     88 extern uint8 *
     89 shr_bhh_msg_ctrl_init_unpack(uint8 *buf, shr_bhh_msg_ctrl_init_t *msg);
     90 
     91 extern uint8 *
     92 shr_bhh_msg_ctrl_sess_set_pack(uint8 *buf,
     93                                shr_bhh_msg_ctrl_sess_set_t *msg);
     94 extern uint8 *
     95 shr_bhh_msg_ctrl_sess_set_unpack(uint8 *buf,
     96                                  shr_bhh_msg_ctrl_sess_set_t *msg);
     97 
     98 extern uint8 *
     99 shr_bhh_msg_ctrl_sess_get_pack(uint8 *buf,
    100                                shr_bhh_msg_ctrl_sess_get_t *msg);
    101 extern uint8 *
    102 shr_bhh_msg_ctrl_sess_enable_pack(uint8 *buf,
    103                                shr_bhh_msg_ctrl_sess_enable_t *msg);
    104 extern uint8 *
    105 shr_bhh_msg_ctrl_sess_enable_unpack(uint8 *buf,
    106                                  shr_bhh_msg_ctrl_sess_enable_t *msg);
    107 
    108 extern uint8 *
    109 shr_bhh_msg_ctrl_sess_delete_pack(uint8 *buf,
    110 				  shr_bhh_msg_ctrl_sess_delete_t *msg);
    111 extern uint8 *
    112 shr_bhh_msg_ctrl_sess_delete_unpack(uint8 *buf,
    113 				    shr_bhh_msg_ctrl_sess_delete_t *msg);
    114 
    115 extern uint8 *
    116 shr_bhh_msg_ctrl_stat_req_pack(uint8 *buf,
    117                                shr_bhh_msg_ctrl_stat_req_t *msg);
    118 extern uint8 *
    119 shr_bhh_msg_ctrl_stat_req_unpack(uint8 *buf,
    120                                  shr_bhh_msg_ctrl_stat_req_t *msg);
    121 
    122 extern uint8 *
    123 shr_bhh_msg_ctrl_stat_reply_pack(uint8 *buf,
    124                                  shr_bhh_msg_ctrl_stat_reply_t *msg);
    125 extern uint8 *
    126 shr_bhh_msg_ctrl_stat_reply_unpack(uint8 *buf,
    127                                    shr_bhh_msg_ctrl_stat_reply_t *msg);
    128 extern uint8 *
    129 shr_bhh_msg_ctrl_loopback_add_pack(uint8 *buf,
    130 				   shr_bhh_msg_ctrl_loopback_add_t *msg);
    131 extern uint8 *
    132 shr_bhh_msg_ctrl_loopback_add_unpack(uint8 *buf,
    133 				     shr_bhh_msg_ctrl_loopback_add_t *msg);
    134 extern uint8 *
    135 shr_bhh_msg_ctrl_loopback_delete_pack(uint8 *buf,
    136 				   shr_bhh_msg_ctrl_loopback_delete_t *msg);
    137 extern uint8 *
    138 shr_bhh_msg_ctrl_loopback_delete_unpack(uint8 *buf,
    139 				     shr_bhh_msg_ctrl_loopback_delete_t *msg);
    140 extern uint8 *
    141 shr_bhh_msg_ctrl_loopback_get_pack(uint8 *buf,
    142 				   shr_bhh_msg_ctrl_loopback_get_t *msg);
    143 extern uint8 *
    144 shr_bhh_msg_ctrl_loopback_get_unpack(uint8 *buf,
    145 				     shr_bhh_msg_ctrl_loopback_get_t *msg);
    146 extern uint8 *
    147 shr_bhh_msg_ctrl_loss_add_pack(uint8 *buf,
    148 				   shr_bhh_msg_ctrl_loss_add_t *msg);
    149 extern uint8 *
    150 shr_bhh_msg_ctrl_loss_add_unpack(uint8 *buf,
    151 				     shr_bhh_msg_ctrl_loss_add_t *msg);
    152 extern uint8 *
    153 shr_bhh_msg_ctrl_loss_delete_pack(uint8 *buf,
    154 				   shr_bhh_msg_ctrl_loss_delete_t *msg);
    155 extern uint8 *
    156 shr_bhh_msg_ctrl_loss_delete_unpack(uint8 *buf,
    157 				     shr_bhh_msg_ctrl_loss_delete_t *msg);
    158 extern uint8 *
    159 shr_bhh_msg_ctrl_loss_get_pack(uint8 *buf,
    160 				   shr_bhh_msg_ctrl_loss_get_t *msg);
    161 extern uint8 *
    162 shr_bhh_msg_ctrl_loss_get_unpack(uint8 *buf,
    163 				     shr_bhh_msg_ctrl_loss_get_t *msg);
    164 extern uint8 *
    165 shr_bhh_msg_ctrl_delay_add_pack(uint8 *buf,
    166 				   shr_bhh_msg_ctrl_delay_add_t *msg);
    167 extern uint8 *
    168 shr_bhh_msg_ctrl_delay_add_unpack(uint8 *buf,
    169 				     shr_bhh_msg_ctrl_delay_add_t *msg);
    170 extern uint8 *
    171 shr_bhh_msg_ctrl_delay_delete_pack(uint8 *buf,
    172 				   shr_bhh_msg_ctrl_delay_delete_t *msg);
    173 extern uint8 *
    174 shr_bhh_msg_ctrl_delay_delete_unpack(uint8 *buf,
    175 				     shr_bhh_msg_ctrl_delay_delete_t *msg);
    176 extern uint8 *
    177 shr_bhh_msg_ctrl_delay_get_pack(uint8 *buf,
    178 				   shr_bhh_msg_ctrl_delay_get_t *msg);
    179 extern uint8 *
    180 shr_bhh_msg_ctrl_delay_get_unpack(uint8 *buf,
    181 				     shr_bhh_msg_ctrl_delay_get_t *msg);
    182 
    183 
    184 extern uint8 *
    185 shr_bhh_tlv_unpack(uint8 *buf, shr_bhh_tlv_t *tlv);
    186 extern uint8 *
    187 shr_bhh_tlv_pack(uint8 *buf, shr_bhh_tlv_t *tlv);
    188 
    189 #endif /* _SOC_SHARED_BHH_PACK_H_ */