1/* 2 * Copyright (c) 2014, 2015, The Linux Foundation. All rights reserved. 3 * Permission to use, copy, modify, and/or distribute this software for 4 * any purpose with or without fee is hereby granted, provided that the 5 * above copyright notice and this permission notice appear in all copies. 6 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 7 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 8 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 9 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 10 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 11 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT 12 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 13 */ 14 15 16/** 17 * @defgroup fal_fdb FAL_FDB 18 * @{ 19 */ 20#ifndef _FAL_FDB_H_ 21#define _FAL_FDB_H_ 22 23#ifdef __cplusplus 24extern "C" { 25#endif /* __cplusplus */ 26 27#include "common/sw.h" 28#include "fal/fal_type.h" 29 30 /** 31 @details Fields description: 32 33 portmap_en - If value of portmap_en is A_TRUE then port.map is valid 34 otherwise port.id is valid. 35 36 37 leaky_en - If value of leaky_en is A_TRUE then packets which 38 destination address equals addr in this entry would be leaky. 39 40 41 mirror_en - If value of mirror_en is A_TRUE then packets which 42 destination address equals addr in this entry would be mirrored. 43 44 45 clone_en - If value of clone_en is A_TRUE which means this address is 46 a mac clone address. 47 @brief This structure defines the Fdb entry. 48 49 */ 50 typedef struct 51 { 52 fal_mac_addr_t addr; 53 a_uint16_t fid; 54 fal_fwd_cmd_t dacmd; 55 fal_fwd_cmd_t sacmd; 56 union 57 { 58 a_uint32_t id; 59 fal_pbmp_t map; 60 } port; 61 a_bool_t portmap_en; 62 a_bool_t is_multicast; 63 a_bool_t static_en; 64 a_bool_t leaky_en; 65 a_bool_t mirror_en; 66 a_bool_t clone_en; 67 a_bool_t cross_pt_state; 68 a_bool_t da_pri_en; 69 a_uint8_t da_queue; 70 a_bool_t white_list_en; 71 a_bool_t load_balance_en; 72 a_uint8_t load_balance; 73 } fal_fdb_entry_t; 74 75#define FAL_FDB_DEL_STATIC 0x1 76 77 typedef struct 78 { 79 a_bool_t port_en; 80 a_bool_t fid_en; 81 a_bool_t multicast_en; 82 } fal_fdb_op_t; 83 84 typedef enum 85 { 86 INVALID_VLAN_SVL=0, 87 INVALID_VLAN_IVL 88 } fal_fdb_smode; 89 90 typedef struct 91 { 92 fal_mac_addr_t addr; 93 a_uint16_t fid; 94 a_uint8_t load_balance; 95 } fal_fdb_rfs_t; 96 97 sw_error_t 98 fal_fdb_rfs_set(a_uint32_t dev_id, fal_fdb_rfs_t * entry); 99 100 sw_error_t 101 fal_fdb_rfs_del(a_uint32_t dev_id, fal_fdb_rfs_t * entry); 102 103 sw_error_t 104 fal_fdb_add(a_uint32_t dev_id, const fal_fdb_entry_t * entry); 105 106 107 108 sw_error_t 109 fal_fdb_del_all(a_uint32_t dev_id, a_uint32_t flag); 110 111 112 113 sw_error_t 114 fal_fdb_del_by_port(a_uint32_t dev_id, a_uint32_t port_id, a_uint32_t flag); 115 116 117 118 sw_error_t 119 fal_fdb_del_by_mac(a_uint32_t dev_id, const fal_fdb_entry_t *entry); 120 121 122 123 sw_error_t 124 fal_fdb_first(a_uint32_t dev_id, fal_fdb_entry_t * entry); 125 126 127 128 sw_error_t 129 fal_fdb_next(a_uint32_t dev_id, fal_fdb_entry_t * entry); 130 131 132 133 sw_error_t 134 fal_fdb_find(a_uint32_t dev_id, fal_fdb_entry_t * entry); 135 136 137 138 sw_error_t 139 fal_fdb_port_learn_set(a_uint32_t dev_id, fal_port_t port_id, a_bool_t enable); 140 141 142 143 sw_error_t 144 fal_fdb_port_learn_get(a_uint32_t dev_id, fal_port_t port_id, a_bool_t *enable); 145 146 147 148 sw_error_t 149 fal_fdb_age_ctrl_set(a_uint32_t dev_id, a_bool_t enable); 150 151 152 153 sw_error_t 154 fal_fdb_age_ctrl_get(a_uint32_t dev_id, a_bool_t * enable); 155 156 157 sw_error_t 158 fal_fdb_vlan_ivl_svl_set(a_uint32_t dev_id, fal_fdb_smode smode); 159 160 161 sw_error_t 162 fal_fdb_vlan_ivl_svl_get(a_uint32_t dev_id, fal_fdb_smode * smode); 163 164 165 sw_error_t 166 fal_fdb_age_time_set(a_uint32_t dev_id, a_uint32_t * time); 167 168 169 170 sw_error_t 171 fal_fdb_age_time_get(a_uint32_t dev_id, a_uint32_t * time); 172 173 174 sw_error_t 175 fal_fdb_iterate(a_uint32_t dev_id, a_uint32_t * iterator, fal_fdb_entry_t * entry); 176 177 178 sw_error_t 179 fal_fdb_extend_next(a_uint32_t dev_id, fal_fdb_op_t * option, 180 fal_fdb_entry_t * entry); 181 182 183 sw_error_t 184 fal_fdb_extend_first(a_uint32_t dev_id, fal_fdb_op_t * option, 185 fal_fdb_entry_t * entry); 186 187 188 sw_error_t 189 fal_fdb_transfer(a_uint32_t dev_id, fal_port_t old_port, fal_port_t new_port, 190 a_uint32_t fid, fal_fdb_op_t * option); 191 192 193 sw_error_t 194 fal_port_fdb_learn_limit_set(a_uint32_t dev_id, fal_port_t port_id, 195 a_bool_t enable, a_uint32_t cnt); 196 197 198 sw_error_t 199 fal_port_fdb_learn_limit_get(a_uint32_t dev_id, fal_port_t port_id, 200 a_bool_t * enable, a_uint32_t * cnt); 201 202 203 sw_error_t 204 fal_port_fdb_learn_exceed_cmd_set(a_uint32_t dev_id, fal_port_t port_id, 205 fal_fwd_cmd_t cmd); 206 207 208 sw_error_t 209 fal_port_fdb_learn_exceed_cmd_get(a_uint32_t dev_id, fal_port_t port_id, 210 fal_fwd_cmd_t * cmd); 211 212 213 sw_error_t 214 fal_fdb_learn_limit_set(a_uint32_t dev_id, a_bool_t enable, a_uint32_t cnt); 215 216 217 sw_error_t 218 fal_fdb_learn_limit_get(a_uint32_t dev_id, a_bool_t * enable, a_uint32_t * cnt); 219 220 221 sw_error_t 222 fal_fdb_learn_exceed_cmd_set(a_uint32_t dev_id, fal_fwd_cmd_t cmd); 223 224 225 sw_error_t 226 fal_fdb_learn_exceed_cmd_get(a_uint32_t dev_id, fal_fwd_cmd_t * cmd); 227 228 229 sw_error_t 230 fal_fdb_resv_add(a_uint32_t dev_id, fal_fdb_entry_t * entry); 231 232 sw_error_t 233 fal_fdb_resv_del(a_uint32_t dev_id, fal_fdb_entry_t * entry); 234 235 236 sw_error_t 237 fal_fdb_resv_find(a_uint32_t dev_id, fal_fdb_entry_t * entry); 238 239 240 sw_error_t 241 fal_fdb_resv_iterate(a_uint32_t dev_id, a_uint32_t * iterator, fal_fdb_entry_t * entry); 242 243 244 sw_error_t 245 fal_fdb_port_learn_static_set(a_uint32_t dev_id, fal_port_t port_id, a_bool_t enable); 246 247 248 sw_error_t 249 fal_fdb_port_learn_static_get(a_uint32_t dev_id, fal_port_t port_id, 250 a_bool_t * enable); 251 252 sw_error_t 253 fal_fdb_port_add(a_uint32_t dev_id, a_uint32_t fid, fal_mac_addr_t * addr, fal_port_t port_id); 254 255 sw_error_t 256 fal_fdb_port_del(a_uint32_t dev_id, a_uint32_t fid, fal_mac_addr_t * addr, fal_port_t port_id); 257 258#ifdef __cplusplus 259} 260#endif /* __cplusplus */ 261#endif /* _FAL_FDB_H_ */ 262/** 263 * @} 264 */ 265