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

switch_appl_sign.h (6173B)


      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-2020 Broadcom Inc. All rights reserved.
      6  *
      7  * This file contains internal definitions for
      8  * switch application signature module to the BCM library.
      9  */
     10 
     11 #ifndef _BCM_INT_SWITCH_APPL_SIGN_H_
     12 #define _BCM_INT_SWITCH_APPL_SIGN_H_
     13 
     14 #include <bcm/types.h>
     15 #include <bcm/switch.h>
     16 
     17 /* Invalid Application signature Id */
     18 #define BCMI_SWITCH_APPL_SIGNATURE_INVALID_ID           0
     19 
     20 /* Parser Stage Identifer */
     21 #define BCMI_SWITCH_PARSER1_STAGE2              0x1
     22 #define BCMI_SWITCH_PARSER1_STAGE3              0x2
     23 #define BCMI_SWITCH_PARSER1_STAGE4              0x3
     24 #define BCMI_SWITCH_PARSER2_STAGE2              0x4
     25 #define BCMI_SWITCH_PARSER2_STAGE3              0x5
     26 #define BCMI_SWITCH_PARSER2_STAGE4              0x6
     27 
     28 /* Structure for  Parser stage entry */
     29 typedef struct bcmi_switch_appl_sign_parser_stage_entry_s {
     30     int stage_id;                       /* Parser Stage */
     31     int key_size;                       /* Key size in words */
     32     uint32 *hw_key_buf;                 /* Entry Key buffer */
     33     uint32 *hw_mask_buf;                /* Entry Mask buffer */
     34     int data_size;                      /* Data size un words */
     35     uint32 *hw_data_buf;                /* Entry Data buffer */
     36 } bcmi_switch_appl_sign_parser_stage_entry_t;
     37 
     38 /* Application sign entry flags */
     39 #define BCMI_SWITCH_APPL_SIGN_ENTRY_TYPE_INNER        (1 << 0)
     40 #define BCMI_SWITCH_APPL_SIGN_ENTRY_TYPE_UDP          (1 << 1)
     41 #define BCMI_SWITCH_APPL_SIGN_ENTRY_TYPE_RESPONSE     (1 << 2)
     42 #define BCMI_SWITCH_APPL_SIGN_ENTRY_INSTALLED         (1 << 3)
     43 
     44 /* Structure for Application signature entry */
     45 typedef struct bcmi_switch_appl_sign_entry_s {
     46     uint32 flags;                       /* Flags */
     47     uint32 eid;                         /* Entry Id */
     48     uint32 prio;                        /* Priority */
     49     int hw_index;                       /* H/W index */
     50     uint32 context_id;                  /* Internal context Id */
     51     int parts;                          /* Number of stage entries */
     52     bcmi_switch_appl_sign_parser_stage_entry_t *stage_entry; /* Array of
     53                                            stage entries */
     54 } bcmi_switch_appl_sign_entry_t;
     55 
     56 /* Application signature control */
     57 typedef struct bcmi_switch_appl_sign_control_s {
     58     bcmi_switch_appl_sign_entry_t **entry_list;     /* Application sign entry list
     59                                            for outer payload */
     60     uint8 *context_id_ref;              /* Internal context Id reference
     61                                            for outer payload */
     62     bcm_switch_appl_signature_t next_alloc_eid; /* Allocated entry id
     63                                            sequecence for outer payload */
     64     bcmi_switch_appl_sign_entry_t **tnl_entry_list; /* Application sign entry list
     65                                            for inner payload */
     66     uint8 *tnl_context_id_ref;          /* Internal context Id reference
     67                                            for inner payload */
     68     bcm_switch_appl_signature_t tnl_next_alloc_eid; /* Allocated entry Id
     69                                             sequence for inner payload */
     70 } bcmi_switch_appl_sign_control_t;
     71 
     72 /* Structure for Derived/fixed field values */
     73 typedef struct bcmi_switch_appl_sign_entry_flex_field_s {
     74     uint8 type;             /* 0x0 - Fixed */
     75                             /* 0x1 - Cancun derived */
     76                             /* 0x2 - Key field */
     77                             /* 0x4 - Mask field */
     78     soc_field_t field;      /* Field */
     79     char *obj_str;          /* String if cancun */
     80     uint8 arg;              /* Field string if cancun */
     81     uint32 value;           /* Value if fixed */
     82 } bcmi_switch_appl_sign_entry_flex_field_t;
     83 
     84 /* First application entry id */
     85 #define BCMI_SWITCH_APPL_SIGN_ID_BASE                1
     86 
     87 /* Last application entry Id */
     88 #define BCMI_SWITCH_APPL_SIGN_ID_MAX                 63
     89 
     90 #define BCMI_SWITCH_APPL_SIGN_MAX_ENTRIES            63
     91 
     92 
     93 /* Initilize Application signature control */
     94 extern int bcmi_esw_switch_appl_signature_init(int unit);
     95 
     96 /* Cleanup Application signature control */
     97 extern int bcmi_esw_switch_appl_signature_detach(int unit);
     98 
     99 /* Lock */
    100 extern int bcmi_switch_appl_sign_lock(int unit);
    101 
    102 /* Unlock */
    103 extern int bcmi_switch_appl_sign_unlock(int unit);
    104 
    105 #define BCMI_SWITCH_APPL_SIGN_LOCK(_u_)                 \
    106     BCM_IF_ERROR_RETURN(bcmi_switch_appl_sign_lock((_u_)))
    107 
    108 #define BCMI_SWITCH_APPL_SIGN_UNLOCK(_u_)                 \
    109     BCM_IF_ERROR_RETURN(bcmi_switch_appl_sign_unlock((_u_)))
    110 
    111 /* Create Application Signature */
    112 extern int bcmi_esw_switch_appl_signature_create(int unit,
    113         uint32 options,
    114         bcm_switch_appl_signature_info_t *appl_signature_info,
    115         bcm_switch_appl_signature_t *appl_signature);
    116 
    117 /* Destroy Application Signature */
    118 extern int bcmi_esw_switch_appl_signature_destroy(int unit,
    119         uint32 options,
    120         bcm_switch_appl_signature_t appl_signature);
    121 
    122 /* Get Application Signature Info */
    123 extern int bcmi_esw_switch_appl_signature_get(int unit,
    124         uint32 options,
    125         bcm_switch_appl_signature_t appl_signature,
    126         bcm_switch_appl_signature_info_t *appl_signature_info);
    127 
    128 /* Get all Application Signatures */
    129 extern int bcmi_esw_switch_appl_signature_get_all(int unit,
    130         uint32 options,
    131         int size,
    132         bcm_switch_appl_signature_t *appl_signature_arr,
    133         int *actual_count);
    134 
    135 /* Set Priority to Application siganture */
    136 extern int bcmi_esw_switch_appl_signature_prio_set(int unit,
    137         uint32 options,
    138         bcm_switch_appl_signature_t appl_signature,
    139         uint32 priority);
    140 
    141 /* Show Application signature */
    142 extern int bcmi_esw_switch_appl_signature_show(int unit,
    143         uint32 options,
    144         bcm_switch_appl_signature_t appl_signature);
    145 
    146 #if defined(BCM_WARM_BOOT_SUPPORT)
    147 extern int bcmi_esw_switch_appl_signature_reinit(int unit);
    148 
    149 extern int bcmi_esw_switch_appl_signature_scache_sync(int unit);
    150 
    151 extern int bcmi_esw_switch_appl_signature_wb_alloc(int unit);
    152 #endif
    153 
    154 #endif /* _BCM_INT_SWITCH_APPL_SIGN_H_ */