Lines Matching full:ocelot

2 /* Microsemi Ocelot Switch driver
49 static u32 vcap_read_update_ctrl(struct ocelot *ocelot, in vcap_read_update_ctrl() argument
52 return ocelot_target_read(ocelot, vcap->target, VCAP_CORE_UPDATE_CTRL); in vcap_read_update_ctrl()
55 static void vcap_cmd(struct ocelot *ocelot, const struct vcap_props *vcap, in vcap_cmd() argument
74 ocelot_target_write(ocelot, vcap->target, value, VCAP_CORE_UPDATE_CTRL); in vcap_cmd()
78 10, 100000, false, ocelot, vcap); in vcap_cmd()
82 static void vcap_row_cmd(struct ocelot *ocelot, const struct vcap_props *vcap, in vcap_row_cmd() argument
85 vcap_cmd(ocelot, vcap, vcap->entry_count - row - 1, cmd, sel); in vcap_row_cmd()
88 static void vcap_entry2cache(struct ocelot *ocelot, in vcap_entry2cache() argument
97 ocelot_target_write_rix(ocelot, vcap->target, data->entry[i], in vcap_entry2cache()
99 ocelot_target_write_rix(ocelot, vcap->target, ~data->mask[i], in vcap_entry2cache()
102 ocelot_target_write(ocelot, vcap->target, data->tg, VCAP_CACHE_TG_DAT); in vcap_entry2cache()
105 static void vcap_cache2entry(struct ocelot *ocelot, in vcap_cache2entry() argument
114 data->entry[i] = ocelot_target_read_rix(ocelot, vcap->target, in vcap_cache2entry()
117 data->mask[i] = ~ocelot_target_read_rix(ocelot, vcap->target, in vcap_cache2entry()
120 data->tg = ocelot_target_read(ocelot, vcap->target, VCAP_CACHE_TG_DAT); in vcap_cache2entry()
123 static void vcap_action2cache(struct ocelot *ocelot, in vcap_action2cache() argument
140 ocelot_target_write_rix(ocelot, vcap->target, data->action[i], in vcap_action2cache()
144 ocelot_target_write_rix(ocelot, vcap->target, data->counter[i], in vcap_action2cache()
148 static void vcap_cache2action(struct ocelot *ocelot, in vcap_cache2action() argument
158 data->action[i] = ocelot_target_read_rix(ocelot, vcap->target, in vcap_cache2action()
163 data->counter[i] = ocelot_target_read_rix(ocelot, vcap->target, in vcap_cache2action()
330 static void is2_action_set(struct ocelot *ocelot, struct vcap_data *data, in is2_action_set() argument
333 const struct vcap_props *vcap = &ocelot->vcap[VCAP_IS2]; in is2_action_set()
344 static void is2_entry_set(struct ocelot *ocelot, int ix, in is2_entry_set() argument
347 const struct vcap_props *vcap = &ocelot->vcap[VCAP_IS2]; in is2_entry_set()
358 vcap_row_cmd(ocelot, vcap, row, VCAP_CMD_READ, VCAP_SEL_ALL); in is2_entry_set()
359 vcap_cache2entry(ocelot, vcap, &data); in is2_entry_set()
360 vcap_cache2action(ocelot, vcap, &data); in is2_entry_set()
636 is2_action_set(ocelot, &data, filter); in is2_entry_set()
641 vcap_entry2cache(ocelot, vcap, &data); in is2_entry_set()
642 vcap_action2cache(ocelot, vcap, &data); in is2_entry_set()
643 vcap_row_cmd(ocelot, vcap, row, VCAP_CMD_WRITE, VCAP_SEL_ALL); in is2_entry_set()
646 static void is1_action_set(struct ocelot *ocelot, struct vcap_data *data, in is1_action_set() argument
649 const struct vcap_props *vcap = &ocelot->vcap[VCAP_IS1]; in is1_action_set()
669 static void is1_entry_set(struct ocelot *ocelot, int ix, in is1_entry_set() argument
672 const struct vcap_props *vcap = &ocelot->vcap[VCAP_IS1]; in is1_entry_set()
683 vcap_row_cmd(ocelot, vcap, row, VCAP_CMD_READ, VCAP_SEL_ALL); in is1_entry_set()
684 vcap_cache2entry(ocelot, vcap, &data); in is1_entry_set()
685 vcap_cache2action(ocelot, vcap, &data); in is1_entry_set()
771 is1_action_set(ocelot, &data, filter); in is1_entry_set()
776 vcap_entry2cache(ocelot, vcap, &data); in is1_entry_set()
777 vcap_action2cache(ocelot, vcap, &data); in is1_entry_set()
778 vcap_row_cmd(ocelot, vcap, row, VCAP_CMD_WRITE, VCAP_SEL_ALL); in is1_entry_set()
781 static void es0_action_set(struct ocelot *ocelot, struct vcap_data *data, in es0_action_set() argument
784 const struct vcap_props *vcap = &ocelot->vcap[VCAP_ES0]; in es0_action_set()
809 static void es0_entry_set(struct ocelot *ocelot, int ix, in es0_entry_set() argument
812 const struct vcap_props *vcap = &ocelot->vcap[VCAP_ES0]; in es0_entry_set()
822 vcap_row_cmd(ocelot, vcap, row, VCAP_CMD_READ, VCAP_SEL_ALL); in es0_entry_set()
823 vcap_cache2entry(ocelot, vcap, &data); in es0_entry_set()
824 vcap_cache2action(ocelot, vcap, &data); in es0_entry_set()
844 es0_action_set(ocelot, &data, filter); in es0_entry_set()
849 vcap_entry2cache(ocelot, vcap, &data); in es0_entry_set()
850 vcap_action2cache(ocelot, vcap, &data); in es0_entry_set()
851 vcap_row_cmd(ocelot, vcap, row, VCAP_CMD_WRITE, VCAP_SEL_ALL); in es0_entry_set()
854 static void vcap_entry_get(struct ocelot *ocelot, int ix, in vcap_entry_get() argument
857 const struct vcap_props *vcap = &ocelot->vcap[filter->block_id]; in vcap_entry_get()
869 vcap_row_cmd(ocelot, vcap, row, VCAP_CMD_READ, VCAP_SEL_COUNTER); in vcap_entry_get()
870 vcap_cache2action(ocelot, vcap, &data); in vcap_entry_get()
878 static void vcap_entry_set(struct ocelot *ocelot, int ix, in vcap_entry_set() argument
882 return is1_entry_set(ocelot, ix, filter); in vcap_entry_set()
884 return is2_entry_set(ocelot, ix, filter); in vcap_entry_set()
886 return es0_entry_set(ocelot, ix, filter); in vcap_entry_set()
889 static int ocelot_vcap_policer_add(struct ocelot *ocelot, u32 pol_ix, in ocelot_vcap_policer_add() argument
901 return qos_policer_conf_set(ocelot, 0, pol_ix, &pp); in ocelot_vcap_policer_add()
904 static void ocelot_vcap_policer_del(struct ocelot *ocelot, in ocelot_vcap_policer_del() argument
921 ocelot_vcap_policer_add(ocelot, filter->action.pol_ix, in ocelot_vcap_policer_del()
923 is2_entry_set(ocelot, index, filter); in ocelot_vcap_policer_del()
928 qos_policer_conf_set(ocelot, 0, pol_ix, &pp); in ocelot_vcap_policer_del()
933 static void ocelot_vcap_filter_add_to_block(struct ocelot *ocelot, in ocelot_vcap_filter_add_to_block() argument
943 ocelot_vcap_policer_add(ocelot, filter->action.pol_ix, in ocelot_vcap_filter_add_to_block()
1015 static void ocelot_match_all_as_mac_etype(struct ocelot *ocelot, int port, in ocelot_match_all_as_mac_etype() argument
1027 ocelot_rmw_gix(ocelot, val, in ocelot_match_all_as_mac_etype()
1075 ocelot_exclusive_mac_etype_filter_rules(struct ocelot *ocelot, in ocelot_exclusive_mac_etype_filter_rules() argument
1078 struct ocelot_vcap_block *block = &ocelot->block[filter->block_id]; in ocelot_exclusive_mac_etype_filter_rules()
1098 ocelot->num_phys_ports) in ocelot_exclusive_mac_etype_filter_rules()
1099 ocelot_match_all_as_mac_etype(ocelot, port, in ocelot_exclusive_mac_etype_filter_rules()
1112 ocelot->num_phys_ports) in ocelot_exclusive_mac_etype_filter_rules()
1113 ocelot_match_all_as_mac_etype(ocelot, port, in ocelot_exclusive_mac_etype_filter_rules()
1120 int ocelot_vcap_filter_add(struct ocelot *ocelot, in ocelot_vcap_filter_add() argument
1124 struct ocelot_vcap_block *block = &ocelot->block[filter->block_id]; in ocelot_vcap_filter_add()
1127 if (!ocelot_exclusive_mac_etype_filter_rules(ocelot, filter)) { in ocelot_vcap_filter_add()
1134 ocelot_vcap_filter_add_to_block(ocelot, block, filter); in ocelot_vcap_filter_add()
1146 vcap_entry_set(ocelot, i, tmp); in ocelot_vcap_filter_add()
1150 vcap_entry_set(ocelot, index, filter); in ocelot_vcap_filter_add()
1154 static void ocelot_vcap_block_remove_filter(struct ocelot *ocelot, in ocelot_vcap_block_remove_filter() argument
1166 ocelot_vcap_policer_del(ocelot, block, in ocelot_vcap_block_remove_filter()
1177 int ocelot_vcap_filter_del(struct ocelot *ocelot, in ocelot_vcap_filter_del() argument
1180 struct ocelot_vcap_block *block = &ocelot->block[filter->block_id]; in ocelot_vcap_filter_del()
1192 ocelot_vcap_block_remove_filter(ocelot, block, filter); in ocelot_vcap_filter_del()
1199 vcap_entry_set(ocelot, i, tmp); in ocelot_vcap_filter_del()
1203 vcap_entry_set(ocelot, block->count, &del_filter); in ocelot_vcap_filter_del()
1208 int ocelot_vcap_filter_stats_update(struct ocelot *ocelot, in ocelot_vcap_filter_stats_update() argument
1211 struct ocelot_vcap_block *block = &ocelot->block[filter->block_id]; in ocelot_vcap_filter_stats_update()
1219 vcap_entry_get(ocelot, index, filter); in ocelot_vcap_filter_stats_update()
1224 vcap_entry_set(ocelot, index, &tmp); in ocelot_vcap_filter_stats_update()
1229 static void ocelot_vcap_init_one(struct ocelot *ocelot, in ocelot_vcap_init_one() argument
1236 vcap_entry2cache(ocelot, vcap, &data); in ocelot_vcap_init_one()
1237 ocelot_target_write(ocelot, vcap->target, vcap->entry_count, in ocelot_vcap_init_one()
1239 vcap_cmd(ocelot, vcap, 0, VCAP_CMD_INITIALIZE, VCAP_SEL_ENTRY); in ocelot_vcap_init_one()
1241 vcap_action2cache(ocelot, vcap, &data); in ocelot_vcap_init_one()
1242 ocelot_target_write(ocelot, vcap->target, vcap->action_count, in ocelot_vcap_init_one()
1244 vcap_cmd(ocelot, vcap, 0, VCAP_CMD_INITIALIZE, in ocelot_vcap_init_one()
1248 static void ocelot_vcap_detect_constants(struct ocelot *ocelot, in ocelot_vcap_detect_constants() argument
1255 version = ocelot_target_read(ocelot, vcap->target, in ocelot_vcap_detect_constants()
1262 vcap->tg_width = ocelot_target_read(ocelot, vcap->target, in ocelot_vcap_detect_constants()
1265 vcap->sw_count = ocelot_target_read(ocelot, vcap->target, in ocelot_vcap_detect_constants()
1270 vcap->entry_count = ocelot_target_read(ocelot, vcap->target, in ocelot_vcap_detect_constants()
1298 vcap->entry_width = ocelot_target_read(ocelot, vcap->target, in ocelot_vcap_detect_constants()
1301 num_default_actions = ocelot_target_read(ocelot, vcap->target, in ocelot_vcap_detect_constants()
1304 vcap->action_width = ocelot_target_read(ocelot, vcap->target, in ocelot_vcap_detect_constants()
1312 counter_memory_width = ocelot_target_read(ocelot, vcap->target, in ocelot_vcap_detect_constants()
1317 int ocelot_vcap_init(struct ocelot *ocelot) in ocelot_vcap_init() argument
1325 ocelot_write_gix(ocelot, 0x299, ANA_POL_MODE_CFG, in ocelot_vcap_init()
1327 ocelot_write_gix(ocelot, 0x1, ANA_POL_PIR_CFG, in ocelot_vcap_init()
1329 ocelot_write_gix(ocelot, 0x3fffff, ANA_POL_PIR_STATE, in ocelot_vcap_init()
1331 ocelot_write_gix(ocelot, 0x0, ANA_POL_CIR_CFG, in ocelot_vcap_init()
1333 ocelot_write_gix(ocelot, 0x3fffff, ANA_POL_CIR_STATE, in ocelot_vcap_init()
1337 struct ocelot_vcap_block *block = &ocelot->block[i]; in ocelot_vcap_init()
1338 struct vcap_props *vcap = &ocelot->vcap[i]; in ocelot_vcap_init()
1343 ocelot_vcap_detect_constants(ocelot, vcap); in ocelot_vcap_init()
1344 ocelot_vcap_init_one(ocelot, vcap); in ocelot_vcap_init()
1347 INIT_LIST_HEAD(&ocelot->dummy_rules); in ocelot_vcap_init()