Lines Matching refs:ocelot
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()
345 static void is2_entry_set(struct ocelot *ocelot, int ix, in is2_entry_set() argument
348 const struct vcap_props *vcap = &ocelot->vcap[VCAP_IS2]; in is2_entry_set()
359 vcap_row_cmd(ocelot, vcap, row, VCAP_CMD_READ, VCAP_SEL_ALL); in is2_entry_set()
360 vcap_cache2entry(ocelot, vcap, &data); in is2_entry_set()
361 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()
681 vcap_row_cmd(ocelot, vcap, row, VCAP_CMD_READ, VCAP_SEL_ALL); in is1_entry_set()
682 vcap_cache2entry(ocelot, vcap, &data); in is1_entry_set()
683 vcap_cache2action(ocelot, vcap, &data); in is1_entry_set()
770 is1_action_set(ocelot, &data, filter); in is1_entry_set()
775 vcap_entry2cache(ocelot, vcap, &data); in is1_entry_set()
776 vcap_action2cache(ocelot, vcap, &data); in is1_entry_set()
777 vcap_row_cmd(ocelot, vcap, row, VCAP_CMD_WRITE, VCAP_SEL_ALL); in is1_entry_set()
780 static void es0_action_set(struct ocelot *ocelot, struct vcap_data *data, in es0_action_set() argument
783 const struct vcap_props *vcap = &ocelot->vcap[VCAP_ES0]; in es0_action_set()
808 static void es0_entry_set(struct ocelot *ocelot, int ix, in es0_entry_set() argument
811 const struct vcap_props *vcap = &ocelot->vcap[VCAP_ES0]; in es0_entry_set()
819 vcap_row_cmd(ocelot, vcap, row, VCAP_CMD_READ, VCAP_SEL_ALL); in es0_entry_set()
820 vcap_cache2entry(ocelot, vcap, &data); in es0_entry_set()
821 vcap_cache2action(ocelot, vcap, &data); in es0_entry_set()
841 es0_action_set(ocelot, &data, filter); in es0_entry_set()
846 vcap_entry2cache(ocelot, vcap, &data); in es0_entry_set()
847 vcap_action2cache(ocelot, vcap, &data); in es0_entry_set()
848 vcap_row_cmd(ocelot, vcap, row, VCAP_CMD_WRITE, VCAP_SEL_ALL); in es0_entry_set()
851 static void vcap_entry_get(struct ocelot *ocelot, int ix, in vcap_entry_get() argument
854 const struct vcap_props *vcap = &ocelot->vcap[filter->block_id]; in vcap_entry_get()
866 vcap_row_cmd(ocelot, vcap, row, VCAP_CMD_READ, VCAP_SEL_COUNTER); in vcap_entry_get()
867 vcap_cache2action(ocelot, vcap, &data); in vcap_entry_get()
875 static void vcap_entry_set(struct ocelot *ocelot, int ix, in vcap_entry_set() argument
879 return is1_entry_set(ocelot, ix, filter); in vcap_entry_set()
881 return is2_entry_set(ocelot, ix, filter); in vcap_entry_set()
883 return es0_entry_set(ocelot, ix, filter); in vcap_entry_set()
892 int ocelot_vcap_policer_add(struct ocelot *ocelot, u32 pol_ix, in ocelot_vcap_policer_add() argument
906 list_for_each_entry(tmp, &ocelot->vcap_pol.pol_list, list) in ocelot_vcap_policer_add()
916 ret = qos_policer_conf_set(ocelot, pol_ix, &pp); in ocelot_vcap_policer_add()
924 list_add_tail(&tmp->list, &ocelot->vcap_pol.pol_list); in ocelot_vcap_policer_add()
930 int ocelot_vcap_policer_del(struct ocelot *ocelot, u32 pol_ix) in ocelot_vcap_policer_del() argument
936 list_for_each_entry_safe(tmp, n, &ocelot->vcap_pol.pol_list, list) in ocelot_vcap_policer_del()
947 return qos_policer_conf_set(ocelot, pol_ix, &pp); in ocelot_vcap_policer_del()
955 ocelot_vcap_filter_add_aux_resources(struct ocelot *ocelot, in ocelot_vcap_filter_add_aux_resources() argument
963 m = ocelot_mirror_get(ocelot, filter->egress_port.value, in ocelot_vcap_filter_add_aux_resources()
970 ret = ocelot_vcap_policer_add(ocelot, filter->action.pol_ix, in ocelot_vcap_filter_add_aux_resources()
980 ocelot_vcap_filter_del_aux_resources(struct ocelot *ocelot, in ocelot_vcap_filter_del_aux_resources() argument
984 ocelot_vcap_policer_del(ocelot, filter->action.pol_ix); in ocelot_vcap_filter_del_aux_resources()
987 ocelot_mirror_put(ocelot); in ocelot_vcap_filter_del_aux_resources()
990 static int ocelot_vcap_filter_add_to_block(struct ocelot *ocelot, in ocelot_vcap_filter_add_to_block() argument
999 ret = ocelot_vcap_filter_add_aux_resources(ocelot, filter, extack); in ocelot_vcap_filter_add_to_block()
1078 static void ocelot_match_all_as_mac_etype(struct ocelot *ocelot, int port, in ocelot_match_all_as_mac_etype() argument
1090 ocelot_rmw_gix(ocelot, val, in ocelot_match_all_as_mac_etype()
1138 ocelot_exclusive_mac_etype_filter_rules(struct ocelot *ocelot, in ocelot_exclusive_mac_etype_filter_rules() argument
1141 struct ocelot_vcap_block *block = &ocelot->block[filter->block_id]; in ocelot_exclusive_mac_etype_filter_rules()
1161 ocelot->num_phys_ports) in ocelot_exclusive_mac_etype_filter_rules()
1162 ocelot_match_all_as_mac_etype(ocelot, port, in ocelot_exclusive_mac_etype_filter_rules()
1175 ocelot->num_phys_ports) in ocelot_exclusive_mac_etype_filter_rules()
1176 ocelot_match_all_as_mac_etype(ocelot, port, in ocelot_exclusive_mac_etype_filter_rules()
1183 int ocelot_vcap_filter_add(struct ocelot *ocelot, in ocelot_vcap_filter_add() argument
1187 struct ocelot_vcap_block *block = &ocelot->block[filter->block_id]; in ocelot_vcap_filter_add()
1190 if (!ocelot_exclusive_mac_etype_filter_rules(ocelot, filter)) { in ocelot_vcap_filter_add()
1197 ret = ocelot_vcap_filter_add_to_block(ocelot, block, filter, extack); in ocelot_vcap_filter_add()
1212 vcap_entry_get(ocelot, i - 1, tmp); in ocelot_vcap_filter_add()
1213 vcap_entry_set(ocelot, i, tmp); in ocelot_vcap_filter_add()
1217 vcap_entry_set(ocelot, index, filter); in ocelot_vcap_filter_add()
1222 static void ocelot_vcap_block_remove_filter(struct ocelot *ocelot, in ocelot_vcap_block_remove_filter() argument
1230 ocelot_vcap_filter_del_aux_resources(ocelot, tmp); in ocelot_vcap_block_remove_filter()
1239 int ocelot_vcap_filter_del(struct ocelot *ocelot, in ocelot_vcap_filter_del() argument
1242 struct ocelot_vcap_block *block = &ocelot->block[filter->block_id]; in ocelot_vcap_filter_del()
1258 ocelot_vcap_block_remove_filter(ocelot, block, filter); in ocelot_vcap_filter_del()
1266 vcap_entry_get(ocelot, i + 1, tmp); in ocelot_vcap_filter_del()
1267 vcap_entry_set(ocelot, i, tmp); in ocelot_vcap_filter_del()
1271 vcap_entry_set(ocelot, block->count, &del_filter); in ocelot_vcap_filter_del()
1277 int ocelot_vcap_filter_replace(struct ocelot *ocelot, in ocelot_vcap_filter_replace() argument
1280 struct ocelot_vcap_block *block = &ocelot->block[filter->block_id]; in ocelot_vcap_filter_replace()
1287 vcap_entry_set(ocelot, index, filter); in ocelot_vcap_filter_replace()
1293 int ocelot_vcap_filter_stats_update(struct ocelot *ocelot, in ocelot_vcap_filter_stats_update() argument
1296 struct ocelot_vcap_block *block = &ocelot->block[filter->block_id]; in ocelot_vcap_filter_stats_update()
1304 vcap_entry_get(ocelot, index, filter); in ocelot_vcap_filter_stats_update()
1309 vcap_entry_set(ocelot, index, &tmp); in ocelot_vcap_filter_stats_update()
1314 static void ocelot_vcap_init_one(struct ocelot *ocelot, in ocelot_vcap_init_one() argument
1321 vcap_entry2cache(ocelot, vcap, &data); in ocelot_vcap_init_one()
1322 ocelot_target_write(ocelot, vcap->target, vcap->entry_count, in ocelot_vcap_init_one()
1324 vcap_cmd(ocelot, vcap, 0, VCAP_CMD_INITIALIZE, VCAP_SEL_ENTRY); in ocelot_vcap_init_one()
1326 vcap_action2cache(ocelot, vcap, &data); in ocelot_vcap_init_one()
1327 ocelot_target_write(ocelot, vcap->target, vcap->action_count, in ocelot_vcap_init_one()
1329 vcap_cmd(ocelot, vcap, 0, VCAP_CMD_INITIALIZE, in ocelot_vcap_init_one()
1333 static void ocelot_vcap_detect_constants(struct ocelot *ocelot, in ocelot_vcap_detect_constants() argument
1340 version = ocelot_target_read(ocelot, vcap->target, in ocelot_vcap_detect_constants()
1347 vcap->tg_width = ocelot_target_read(ocelot, vcap->target, in ocelot_vcap_detect_constants()
1350 vcap->sw_count = ocelot_target_read(ocelot, vcap->target, in ocelot_vcap_detect_constants()
1355 vcap->entry_count = ocelot_target_read(ocelot, vcap->target, in ocelot_vcap_detect_constants()
1383 vcap->entry_width = ocelot_target_read(ocelot, vcap->target, in ocelot_vcap_detect_constants()
1386 num_default_actions = ocelot_target_read(ocelot, vcap->target, in ocelot_vcap_detect_constants()
1389 vcap->action_width = ocelot_target_read(ocelot, vcap->target, in ocelot_vcap_detect_constants()
1397 counter_memory_width = ocelot_target_read(ocelot, vcap->target, in ocelot_vcap_detect_constants()
1402 int ocelot_vcap_init(struct ocelot *ocelot) in ocelot_vcap_init() argument
1413 ret = qos_policer_conf_set(ocelot, OCELOT_POLICER_DISCARD, &cpu_drop); in ocelot_vcap_init()
1418 struct ocelot_vcap_block *block = &ocelot->block[i]; in ocelot_vcap_init()
1419 struct vcap_props *vcap = &ocelot->vcap[i]; in ocelot_vcap_init()
1423 ocelot_vcap_detect_constants(ocelot, vcap); in ocelot_vcap_init()
1424 ocelot_vcap_init_one(ocelot, vcap); in ocelot_vcap_init()
1427 INIT_LIST_HEAD(&ocelot->dummy_rules); in ocelot_vcap_init()
1428 INIT_LIST_HEAD(&ocelot->traps); in ocelot_vcap_init()
1429 INIT_LIST_HEAD(&ocelot->vcap_pol.pol_list); in ocelot_vcap_init()