switch_match.h (4330B)
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 * Purpose: 8 * This file contains switch match definitions internal to the BCM library. 9 */ 10 11 #ifndef _BCM_INT_SWITCH_MATCH_H 12 #define _BCM_INT_SWITCH_MATCH_H 13 #include <bcm/switch.h> 14 15 #if defined(BCM_SWITCH_MATCH_SUPPORT) 16 /* 17 * Switch match's platform specific information per service 18 * This structure maintains all chip specific information 19 */ 20 typedef struct bcmi_switch_match_service_info_s { 21 char *table_name; 22 int (* switch_match_table_size_get)( 23 int unit, 24 uint32 *table_size); 25 int (* switch_match_hw_id_get)( 26 int unit, 27 uint32 sw_idx, 28 uint32 *hw_id); 29 int (* switch_match_sw_idx_get)( 30 int unit, 31 uint32 hw_id, 32 uint32 *sw_idx); 33 int (* switch_match_wb_hw_existed)( 34 int unit, 35 uint32 sw_idx); 36 int (* switch_match_config_add)( 37 int unit, 38 bcm_switch_match_config_info_t *config_info, 39 uint32 *sw_idx); 40 int (* switch_match_config_delete)( 41 int unit, 42 uint32 sw_idx); 43 int (* switch_match_config_get)( 44 int unit, 45 uint32 sw_idx, 46 bcm_switch_match_config_info_t *config_info); 47 int (* switch_match_config_set)( 48 int unit, 49 uint32 sw_idx, 50 bcm_switch_match_config_info_t *config_info); 51 int (* switch_match_control_get)( 52 int unit, 53 bcm_switch_match_control_type_t control_type, 54 bcm_gport_t gport, 55 bcm_switch_match_control_info_t *control_info); 56 int (* switch_match_control_set)( 57 int unit, 58 bcm_switch_match_control_type_t control_type, 59 bcm_gport_t gport, 60 bcm_switch_match_control_info_t *control_info); 61 } bcmi_switch_match_service_info_t; 62 63 /* Switch match platform-specific information */ 64 typedef struct bcmi_switch_match_dev_info_s { 65 const bcmi_switch_match_service_info_t 66 *service_info[bcmSwitchMatchService__Count]; 67 } bcmi_switch_match_dev_info_t; 68 69 /* Switch match initial and detach */ 70 extern int bcmi_switch_match_init(int unit); 71 72 extern int bcmi_switch_match_detach(int unit); 73 74 /* Switch match configuration operations */ 75 extern int bcmi_switch_match_config_add( 76 int unit, 77 bcm_switch_match_service_t match_service, 78 bcm_switch_match_config_info_t *config_info, 79 int *match_id); 80 81 extern int bcmi_switch_match_config_delete( 82 int unit, 83 bcm_switch_match_service_t match_service, 84 int match_id); 85 86 extern int bcmi_switch_match_config_delete_all( 87 int unit, 88 bcm_switch_match_service_t match_service); 89 90 extern int bcmi_switch_match_config_get( 91 int unit, 92 bcm_switch_match_service_t match_service, 93 int match_id, 94 bcm_switch_match_config_info_t *config_info); 95 96 extern int bcmi_switch_match_config_set( 97 int unit, 98 bcm_switch_match_service_t match_service, 99 int match_id, 100 bcm_switch_match_config_info_t *config_info); 101 102 extern int bcmi_switch_match_config_traverse( 103 int unit, 104 bcm_switch_match_service_t match_service, 105 bcm_switch_match_config_traverse_cb cb_fn, 106 void *user_data); 107 108 /* Switch match control operations */ 109 extern int bcmi_switch_match_control_get( 110 int unit, 111 bcm_switch_match_service_t match_service, 112 bcm_switch_match_control_type_t control_type, 113 bcm_gport_t gport, 114 bcm_switch_match_control_info_t *control_info); 115 116 extern int bcmi_switch_match_control_set( 117 int unit, 118 bcm_switch_match_service_t match_service, 119 bcm_switch_match_control_type_t control_type, 120 bcm_gport_t gport, 121 bcm_switch_match_control_info_t *control_info); 122 123 extern int bcmi_switch_match_control_traverse( 124 int unit, 125 bcm_switch_match_service_t match_service, 126 bcm_switch_match_control_traverse_cb cb_fn, 127 void *user_data); 128 129 /* 130 * Switch Match conversion between software Match ID and hardware ID 131 */ 132 extern int 133 bcmi_switch_match_hw_id_get( 134 int unit, 135 int match_id, 136 bcm_switch_match_service_t *match_service, 137 uint32 *hw_id); 138 139 extern int 140 bcmi_switch_match_match_id_get( 141 int unit, 142 bcm_switch_match_service_t match_service, 143 uint32 hw_id, 144 int *match_id); 145 146 #endif /* BCM_SWITCH_MATCH_SUPPORT */ 147 #endif /* !_BCM_INT_SWITCH_MATCH_H */