1/* 2 * Copyright (c) 2012, 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 17typedef struct 18{ 19 a_uint8_t status; 20 a_uint8_t list_id; 21 a_uint8_t list_pri; 22 a_uint8_t rule_nr; 23 fal_pbmp_t bind_pts; 24} isis_acl_list_t; 25 26 27typedef struct 28{ 29 a_uint32_t vlu[5]; 30 a_uint32_t msk[5]; 31 a_uint32_t act[3]; 32} hw_filter_t; 33 34 35typedef struct 36{ 37 a_uint8_t status; 38 a_uint8_t list_id; 39 a_uint8_t list_pri; 40 a_uint8_t rule_id; 41 hw_filter_t filter; 42} isis_acl_rule_t; 43 44 45#define ENT_USED 0x1 46#define ENT_TMP 0x2 47#define ENT_DEACTIVE 0x4 48 49#define FLT_START 0x0 50#define FLT_CONTINUE 0x1 51#define FLT_END 0x2 52#define FLT_STARTEND 0x3 53 54 55#define ISIS_MAC_FILTER 1 56#define ISIS_IP4_FILTER 2 57#define ISIS_IP6R1_FILTER 3 58#define ISIS_IP6R2_FILTER 4 59#define ISIS_IP6R3_FILTER 5 60#define ISIS_UDF_FILTER 6 61#define ISIS_EHMAC_FILTER 7 62 63 64#define ISIS_MAX_UDF_OFFSET 31 65#define ISIS_MAX_UDF_LENGTH 16 66 67 68#define ISIS_FILTER_VLU_OP 0x0 69#define ISIS_FILTER_MSK_OP 0x1 70#define ISIS_FILTER_ACT_OP 0x2 71 72 73 74//#define ISIS_MAX_FILTER 8 75#define ISIS_MAX_FILTER 96 76#define ISIS_RULE_FUNC_ADDR 0x0400 77#define ISIS_HW_RULE_TMP_CNT (ISIS_MAX_FILTER + 4) 78 79#define ISIS_MAX_LIST_ID 255 80#define ISIS_MAX_LIST_PRI 255 81 82#define ISIS_UDF_MAX_LENGTH 15 83#define ISIS_UDF_MAX_OFFSET 31 84 85#define WIN_RULE_CTL0_ADDR 0x218 86#define WIN_RULE_CTL1_ADDR 0x234 87 88 89#define ISIS_FILTER_VLU_ADDR 0x58000 90#define ISIS_FILTER_MSK_ADDR 0x59000 91#define ISIS_FILTER_ACT_ADDR 0x5a000 92 93 94#define FIELD_SET(reg, field, val) \ 95 SW_REG_SET_BY_FIELD_U32(hw->vlu[reg], val, reg##_##field##_BOFFSET, \ 96 reg##_##field##_BLEN) 97 98#define FIELD_GET(reg, field, val) \ 99 SW_FIELD_GET_BY_REG_U32(hw->vlu[reg], val, reg##_##field##_BOFFSET, \ 100 reg##_##field##_BLEN) 101 102#define FIELD_SET_MASK(reg, field, val) \ 103 SW_REG_SET_BY_FIELD_U32(hw->msk[reg-5], val, reg##_##field##_BOFFSET, \ 104 reg##_##field##_BLEN) 105 106#define FIELD_GET_MASK(reg, field, val) \ 107 SW_FIELD_GET_BY_REG_U32(hw->msk[reg-5], val, reg##_##field##_BOFFSET, \ 108 reg##_##field##_BLEN) 109 110#define FIELD_SET_ACTION(reg, field, val) \ 111 SW_REG_SET_BY_FIELD_U32(hw->act[reg-10], val, reg##_##field##_BOFFSET, \ 112 reg##_##field##_BLEN) 113 114#define FIELD_GET_ACTION(reg, field, val) \ 115 SW_FIELD_GET_BY_REG_U32(hw->act[reg-10], val, reg##_##field##_BOFFSET, \ 116 reg##_##field##_BLEN) 117 118sw_error_t 119_isis_acl_rule_sw_to_hw(a_uint32_t dev_id, fal_acl_rule_t * sw, isis_acl_rule_t * hw_filter_snap, a_uint32_t * idx); 120 121 122sw_error_t 123_isis_acl_rule_hw_to_sw(a_uint32_t dev_id, fal_acl_rule_t * sw, isis_acl_rule_t * hw_filter_snap, a_uint32_t idx, a_uint32_t ent_nr); 124 125 126