Lines Matching +full:keys +full:- +full:per +full:- +full:group

1 // SPDX-License-Identifier: (GPL-2.0 OR MIT)
40 u32 tg_sw; /* Current type-group */
45 u32 tg_value; /* Current type-group value */
46 u32 tg_mask; /* Current type-group mask */
52 return ocelot_target_read(ocelot, vcap->target, VCAP_CORE_UPDATE_CTRL); in vcap_read_update_ctrl()
62 if ((sel & VCAP_SEL_ENTRY) && ix >= vcap->entry_count) in vcap_cmd()
74 ocelot_target_write(ocelot, vcap->target, value, VCAP_CORE_UPDATE_CTRL); in vcap_cmd()
81 /* Convert from 0-based row to VCAP entry row and run command */
85 vcap_cmd(ocelot, vcap, vcap->entry_count - row - 1, cmd, sel); in vcap_row_cmd()
94 entry_words = DIV_ROUND_UP(vcap->entry_width, ENTRY_WIDTH); in vcap_entry2cache()
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()
111 entry_words = DIV_ROUND_UP(vcap->entry_width, ENTRY_WIDTH); in vcap_cache2entry()
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()
131 width = vcap->action_type_width; in vcap_action2cache()
134 data->action[0] = ((data->action[0] & ~mask) | data->type); in vcap_action2cache()
137 action_words = DIV_ROUND_UP(vcap->action_width, ENTRY_WIDTH); in vcap_action2cache()
140 ocelot_target_write_rix(ocelot, vcap->target, data->action[i], in vcap_action2cache()
143 for (i = 0; i < vcap->counter_words; i++) in vcap_action2cache()
144 ocelot_target_write_rix(ocelot, vcap->target, data->counter[i], in vcap_action2cache()
155 action_words = DIV_ROUND_UP(vcap->action_width, ENTRY_WIDTH); in vcap_cache2action()
158 data->action[i] = ocelot_target_read_rix(ocelot, vcap->target, in vcap_cache2action()
162 for (i = 0; i < vcap->counter_words; i++) in vcap_cache2action()
163 data->counter[i] = ocelot_target_read_rix(ocelot, vcap->target, in vcap_cache2action()
168 width = vcap->action_type_width; in vcap_cache2action()
169 data->type = (width ? (data->action[0] & GENMASK(width, 0)) : 0); in vcap_cache2action()
178 u32 width = vcap->tg_width; in vcap_data_offset_get()
180 switch (data->tg_sw) { in vcap_data_offset_get()
195 num_subwords_per_entry = (vcap->sw_count / num_entries_per_row); in vcap_data_offset_get()
196 base = (vcap->sw_count - col * num_subwords_per_entry - in vcap_data_offset_get()
198 data->tg_value = 0; in vcap_data_offset_get()
199 data->tg_mask = 0; in vcap_data_offset_get()
202 data->tg_value |= (data->tg_sw << offset); in vcap_data_offset_get()
203 data->tg_mask |= GENMASK(offset + width - 1, offset); in vcap_data_offset_get()
207 col = (num_entries_per_row - col - 1); in vcap_data_offset_get()
208 data->key_offset = (base * vcap->entry_width) / vcap->sw_count; in vcap_data_offset_get()
209 data->counter_offset = (num_subwords_per_entry * col * in vcap_data_offset_get()
210 vcap->counter_width); in vcap_data_offset_get()
211 i = data->type; in vcap_data_offset_get()
212 width = vcap->action_table[i].width; in vcap_data_offset_get()
213 num_subwords_per_action = vcap->action_table[i].count; in vcap_data_offset_get()
214 data->action_offset = ((num_subwords_per_action * col * width) / in vcap_data_offset_get()
216 data->action_offset += vcap->action_type_width; in vcap_data_offset_get()
250 vcap_data_set(data->entry, offset + data->key_offset, width, value); in vcap_key_field_set()
251 vcap_data_set(data->mask, offset + data->key_offset, width, mask); in vcap_key_field_set()
257 u32 offset = vcap->keys[field].offset; in vcap_key_set()
258 u32 length = vcap->keys[field].length; in vcap_key_set()
267 u32 offset = vcap->keys[field].offset; in vcap_key_bytes_set()
268 u32 count = vcap->keys[field].length; in vcap_key_bytes_set()
280 j = (count - i - 1); in vcap_key_bytes_set()
285 offset -= n; in vcap_key_bytes_set()
298 u32 offset = vcap->keys[field].offset; in vcap_key_l4_port_set()
299 u32 length = vcap->keys[field].length; in vcap_key_l4_port_set()
303 vcap_key_field_set(data, offset, length, port->value, port->mask); in vcap_key_l4_port_set()
312 u32 offset = vcap->keys[field].offset; in vcap_key_bit_set()
313 u32 length = vcap->keys[field].length; in vcap_key_bit_set()
323 int offset = vcap->actions[field].offset; in vcap_action_set()
324 int length = vcap->actions[field].length; in vcap_action_set()
326 vcap_data_set(data->action, offset + data->action_offset, length, in vcap_action_set()
333 const struct vcap_props *vcap = &ocelot->vcap[VCAP_IS2]; in is2_action_set()
334 struct ocelot_vcap_action *a = &filter->action; in is2_action_set()
336 vcap_action_set(vcap, data, VCAP_IS2_ACT_MASK_MODE, a->mask_mode); in is2_action_set()
337 vcap_action_set(vcap, data, VCAP_IS2_ACT_PORT_MASK, a->port_mask); in is2_action_set()
338 vcap_action_set(vcap, data, VCAP_IS2_ACT_MIRROR_ENA, a->mirror_ena); in is2_action_set()
339 vcap_action_set(vcap, data, VCAP_IS2_ACT_POLICE_ENA, a->police_ena); in is2_action_set()
340 vcap_action_set(vcap, data, VCAP_IS2_ACT_POLICE_IDX, a->pol_ix); in is2_action_set()
341 vcap_action_set(vcap, data, VCAP_IS2_ACT_CPU_QU_NUM, a->cpu_qu_num); in is2_action_set()
342 vcap_action_set(vcap, data, VCAP_IS2_ACT_CPU_COPY_ENA, a->cpu_copy_ena); in is2_action_set()
348 const struct vcap_props *vcap = &ocelot->vcap[VCAP_IS2]; in is2_entry_set()
349 struct ocelot_vcap_key_vlan *tag = &filter->vlan; in is2_entry_set()
366 if (filter->prio != 0) in is2_entry_set()
371 vcap_key_set(vcap, &data, VCAP_IS2_HK_PAG, filter->pag, 0xff); in is2_entry_set()
373 (filter->lookup == 0) ? OCELOT_VCAP_BIT_1 : in is2_entry_set()
376 ~filter->ingress_port_mask); in is2_entry_set()
379 vcap_key_bit_set(vcap, &data, VCAP_IS2_HK_L2_MC, filter->dmac_mc); in is2_entry_set()
380 vcap_key_bit_set(vcap, &data, VCAP_IS2_HK_L2_BC, filter->dmac_bc); in is2_entry_set()
381 vcap_key_bit_set(vcap, &data, VCAP_IS2_HK_VLAN_TAGGED, tag->tagged); in is2_entry_set()
383 tag->vid.value, tag->vid.mask); in is2_entry_set()
385 tag->pcp.value[0], tag->pcp.mask[0]); in is2_entry_set()
386 vcap_key_bit_set(vcap, &data, VCAP_IS2_HK_DEI, tag->dei); in is2_entry_set()
388 switch (filter->key_type) { in is2_entry_set()
390 struct ocelot_vcap_key_etype *etype = &filter->key.etype; in is2_entry_set()
394 etype->dmac.value, etype->dmac.mask); in is2_entry_set()
396 etype->smac.value, etype->smac.mask); in is2_entry_set()
398 etype->etype.value, etype->etype.mask); in is2_entry_set()
408 etype->data.value, etype->data.mask); in is2_entry_set()
412 struct ocelot_vcap_key_llc *llc = &filter->key.llc; in is2_entry_set()
416 llc->dmac.value, llc->dmac.mask); in is2_entry_set()
418 llc->smac.value, llc->smac.mask); in is2_entry_set()
420 payload.value[i] = llc->llc.value[i]; in is2_entry_set()
421 payload.mask[i] = llc->llc.mask[i]; in is2_entry_set()
428 struct ocelot_vcap_key_snap *snap = &filter->key.snap; in is2_entry_set()
432 snap->dmac.value, snap->dmac.mask); in is2_entry_set()
434 snap->smac.value, snap->smac.mask); in is2_entry_set()
436 filter->key.snap.snap.value, in is2_entry_set()
437 filter->key.snap.snap.mask); in is2_entry_set()
441 struct ocelot_vcap_key_arp *arp = &filter->key.arp; in is2_entry_set()
445 arp->smac.value, arp->smac.mask); in is2_entry_set()
448 arp->ethernet); in is2_entry_set()
451 arp->ip); in is2_entry_set()
454 arp->length); in is2_entry_set()
457 arp->dmac_match); in is2_entry_set()
460 arp->smac_match); in is2_entry_set()
463 arp->unknown); in is2_entry_set()
466 val = ((arp->req == OCELOT_VCAP_BIT_0 ? 1 : 0) | in is2_entry_set()
467 (arp->arp == OCELOT_VCAP_BIT_0 ? 2 : 0)); in is2_entry_set()
468 msk = ((arp->req == OCELOT_VCAP_BIT_ANY ? 0 : 1) | in is2_entry_set()
469 (arp->arp == OCELOT_VCAP_BIT_ANY ? 0 : 2)); in is2_entry_set()
474 arp->dip.value.addr, arp->dip.mask.addr); in is2_entry_set()
477 arp->sip.value.addr, arp->sip.mask.addr); in is2_entry_set()
494 if (filter->key_type == OCELOT_VCAP_KEY_IPV4) { in is2_entry_set()
495 ipv4 = &filter->key.ipv4; in is2_entry_set()
496 ttl = ipv4->ttl; in is2_entry_set()
497 fragment = ipv4->fragment; in is2_entry_set()
498 options = ipv4->options; in is2_entry_set()
499 proto = ipv4->proto; in is2_entry_set()
500 ds = ipv4->ds; in is2_entry_set()
501 ip_data = &ipv4->data; in is2_entry_set()
502 sip = ipv4->sip; in is2_entry_set()
503 dip = ipv4->dip; in is2_entry_set()
504 sport = &ipv4->sport; in is2_entry_set()
505 dport = &ipv4->dport; in is2_entry_set()
506 tcp_fin = ipv4->tcp_fin; in is2_entry_set()
507 tcp_syn = ipv4->tcp_syn; in is2_entry_set()
508 tcp_rst = ipv4->tcp_rst; in is2_entry_set()
509 tcp_psh = ipv4->tcp_psh; in is2_entry_set()
510 tcp_ack = ipv4->tcp_ack; in is2_entry_set()
511 tcp_urg = ipv4->tcp_urg; in is2_entry_set()
512 sip_eq_dip = ipv4->sip_eq_dip; in is2_entry_set()
513 sport_eq_dport = ipv4->sport_eq_dport; in is2_entry_set()
514 seq_zero = ipv4->seq_zero; in is2_entry_set()
516 ipv6 = &filter->key.ipv6; in is2_entry_set()
517 ttl = ipv6->ttl; in is2_entry_set()
520 proto = ipv6->proto; in is2_entry_set()
521 ds = ipv6->ds; in is2_entry_set()
522 ip_data = &ipv6->data; in is2_entry_set()
524 val = ipv6->sip.value[i + 8]; in is2_entry_set()
525 msk = ipv6->sip.mask[i + 8]; in is2_entry_set()
530 sip.value.addr[i - 4] = val; in is2_entry_set()
531 sip.mask.addr[i - 4] = msk; in is2_entry_set()
534 sport = &ipv6->sport; in is2_entry_set()
535 dport = &ipv6->dport; in is2_entry_set()
536 tcp_fin = ipv6->tcp_fin; in is2_entry_set()
537 tcp_syn = ipv6->tcp_syn; in is2_entry_set()
538 tcp_rst = ipv6->tcp_rst; in is2_entry_set()
539 tcp_psh = ipv6->tcp_psh; in is2_entry_set()
540 tcp_ack = ipv6->tcp_ack; in is2_entry_set()
541 tcp_urg = ipv6->tcp_urg; in is2_entry_set()
542 sip_eq_dip = ipv6->sip_eq_dip; in is2_entry_set()
543 sport_eq_dport = ipv6->sport_eq_dport; in is2_entry_set()
544 seq_zero = ipv6->seq_zero; in is2_entry_set()
604 /* Non-UDP/TCP protocol match */ in is2_entry_set()
607 payload.value[i] = ip_data->value[i]; in is2_entry_set()
608 payload.mask[i] = ip_data->mask[i]; in is2_entry_set()
624 count = vcap->entry_width / 2; in is2_entry_set()
625 /* Iterate over the non-common part of the key and in is2_entry_set()
628 for (i = vcap->keys[VCAP_IS2_HK_L2_DMAC].offset; in is2_entry_set()
630 vcap_key_field_set(&data, i, min(32u, count - i), 0, 0); in is2_entry_set()
638 vcap->counter_width, filter->stats.pkts); in is2_entry_set()
649 const struct vcap_props *vcap = &ocelot->vcap[VCAP_IS1]; in is1_action_set()
650 const struct ocelot_vcap_action *a = &filter->action; in is1_action_set()
653 a->vid_replace_ena); in is1_action_set()
654 vcap_action_set(vcap, data, VCAP_IS1_ACT_VID_ADD_VAL, a->vid); in is1_action_set()
656 a->vlan_pop_cnt_ena); in is1_action_set()
658 a->vlan_pop_cnt); in is1_action_set()
659 vcap_action_set(vcap, data, VCAP_IS1_ACT_PCP_DEI_ENA, a->pcp_dei_ena); in is1_action_set()
660 vcap_action_set(vcap, data, VCAP_IS1_ACT_PCP_VAL, a->pcp); in is1_action_set()
661 vcap_action_set(vcap, data, VCAP_IS1_ACT_DEI_VAL, a->dei); in is1_action_set()
662 vcap_action_set(vcap, data, VCAP_IS1_ACT_QOS_ENA, a->qos_ena); in is1_action_set()
663 vcap_action_set(vcap, data, VCAP_IS1_ACT_QOS_VAL, a->qos_val); in is1_action_set()
665 a->pag_override_mask); in is1_action_set()
666 vcap_action_set(vcap, data, VCAP_IS1_ACT_PAG_VAL, a->pag_val); in is1_action_set()
672 const struct vcap_props *vcap = &ocelot->vcap[VCAP_IS1]; in is1_entry_set()
673 struct ocelot_vcap_key_vlan *tag = &filter->vlan; in is1_entry_set()
689 if (filter->prio != 0) in is1_entry_set()
692 vcap_key_set(vcap, &data, VCAP_IS1_HK_LOOKUP, filter->lookup, 0x3); in is1_entry_set()
694 ~filter->ingress_port_mask); in is1_entry_set()
695 vcap_key_bit_set(vcap, &data, VCAP_IS1_HK_L2_MC, filter->dmac_mc); in is1_entry_set()
696 vcap_key_bit_set(vcap, &data, VCAP_IS1_HK_L2_BC, filter->dmac_bc); in is1_entry_set()
697 vcap_key_bit_set(vcap, &data, VCAP_IS1_HK_VLAN_TAGGED, tag->tagged); in is1_entry_set()
698 vcap_key_bit_set(vcap, &data, VCAP_IS1_HK_TPID, tag->tpid); in is1_entry_set()
700 tag->vid.value, tag->vid.mask); in is1_entry_set()
702 tag->pcp.value[0], tag->pcp.mask[0]); in is1_entry_set()
705 switch (filter->key_type) { in is1_entry_set()
707 struct ocelot_vcap_key_etype *etype = &filter->key.etype; in is1_entry_set()
710 etype->smac.value, etype->smac.mask); in is1_entry_set()
712 etype->etype.value, etype->etype.mask); in is1_entry_set()
716 struct ocelot_vcap_key_ipv4 *ipv4 = &filter->key.ipv4; in is1_entry_set()
717 struct ocelot_vcap_udp_tcp *sport = &ipv4->sport; in is1_entry_set()
718 struct ocelot_vcap_udp_tcp *dport = &ipv4->dport; in is1_entry_set()
720 struct ocelot_vcap_u8 proto = ipv4->proto; in is1_entry_set()
721 struct ocelot_vcap_ipv4 sip = ipv4->sip; in is1_entry_set()
773 vcap->counter_width, filter->stats.pkts); in is1_entry_set()
784 const struct vcap_props *vcap = &ocelot->vcap[VCAP_ES0]; in es0_action_set()
785 const struct ocelot_vcap_action *a = &filter->action; in es0_action_set()
788 a->push_outer_tag); in es0_action_set()
790 a->push_inner_tag); in es0_action_set()
792 a->tag_a_tpid_sel); in es0_action_set()
794 a->tag_a_vid_sel); in es0_action_set()
796 a->tag_a_pcp_sel); in es0_action_set()
797 vcap_action_set(vcap, data, VCAP_ES0_ACT_VID_A_VAL, a->vid_a_val); in es0_action_set()
798 vcap_action_set(vcap, data, VCAP_ES0_ACT_PCP_A_VAL, a->pcp_a_val); in es0_action_set()
800 a->tag_b_tpid_sel); in es0_action_set()
802 a->tag_b_vid_sel); in es0_action_set()
804 a->tag_b_pcp_sel); in es0_action_set()
805 vcap_action_set(vcap, data, VCAP_ES0_ACT_VID_B_VAL, a->vid_b_val); in es0_action_set()
806 vcap_action_set(vcap, data, VCAP_ES0_ACT_PCP_B_VAL, a->pcp_b_val); in es0_action_set()
812 const struct vcap_props *vcap = &ocelot->vcap[VCAP_ES0]; in es0_entry_set()
813 struct ocelot_vcap_key_vlan *tag = &filter->vlan; in es0_entry_set()
828 if (filter->prio != 0) in es0_entry_set()
831 vcap_key_set(vcap, &data, VCAP_ES0_IGR_PORT, filter->ingress_port.value, in es0_entry_set()
832 filter->ingress_port.mask); in es0_entry_set()
833 vcap_key_set(vcap, &data, VCAP_ES0_EGR_PORT, filter->egress_port.value, in es0_entry_set()
834 filter->egress_port.mask); in es0_entry_set()
835 vcap_key_bit_set(vcap, &data, VCAP_ES0_L2_MC, filter->dmac_mc); in es0_entry_set()
836 vcap_key_bit_set(vcap, &data, VCAP_ES0_L2_BC, filter->dmac_bc); in es0_entry_set()
838 tag->vid.value, tag->vid.mask); in es0_entry_set()
840 tag->pcp.value[0], tag->pcp.mask[0]); in es0_entry_set()
844 vcap->counter_width, filter->stats.pkts); in es0_entry_set()
855 const struct vcap_props *vcap = &ocelot->vcap[filter->block_id]; in vcap_entry_get()
860 if (filter->block_id == VCAP_ES0) in vcap_entry_get()
865 count = (1 << (data.tg_sw - 1)); in vcap_entry_get()
871 vcap->counter_width); in vcap_entry_get()
873 filter->stats.pkts = cnt; in vcap_entry_get()
879 if (filter->block_id == VCAP_IS1) in vcap_entry_set()
881 if (filter->block_id == VCAP_IS2) in vcap_entry_set()
883 if (filter->block_id == VCAP_ES0) in vcap_entry_set()
901 return -EINVAL; in ocelot_vcap_policer_add()
904 pp.pir = pol->rate; in ocelot_vcap_policer_add()
905 pp.pbs = pol->burst; in ocelot_vcap_policer_add()
907 list_for_each_entry(tmp, &ocelot->vcap_pol.pol_list, list) in ocelot_vcap_policer_add()
908 if (tmp->pol_ix == pol_ix) { in ocelot_vcap_policer_add()
909 refcount_inc(&tmp->refcount); in ocelot_vcap_policer_add()
915 return -ENOMEM; in ocelot_vcap_policer_add()
923 tmp->pol_ix = pol_ix; in ocelot_vcap_policer_add()
924 refcount_set(&tmp->refcount, 1); in ocelot_vcap_policer_add()
925 list_add_tail(&tmp->list, &ocelot->vcap_pol.pol_list); in ocelot_vcap_policer_add()
937 list_for_each_entry_safe(tmp, n, &ocelot->vcap_pol.pol_list, list) in ocelot_vcap_policer_del()
938 if (tmp->pol_ix == pol_ix) { in ocelot_vcap_policer_del()
939 z = refcount_dec_and_test(&tmp->refcount); in ocelot_vcap_policer_del()
941 list_del(&tmp->list); in ocelot_vcap_policer_del()
963 if (filter->block_id == VCAP_IS2 && filter->action.mirror_ena) { in ocelot_vcap_filter_add_aux_resources()
964 m = ocelot_mirror_get(ocelot, filter->egress_port.value, in ocelot_vcap_filter_add_aux_resources()
970 if (filter->block_id == VCAP_IS2 && filter->action.police_ena) { in ocelot_vcap_filter_add_aux_resources()
971 ret = ocelot_vcap_policer_add(ocelot, filter->action.pol_ix, in ocelot_vcap_filter_add_aux_resources()
972 &filter->action.pol); in ocelot_vcap_filter_add_aux_resources()
984 if (filter->block_id == VCAP_IS2 && filter->action.police_ena) in ocelot_vcap_filter_del_aux_resources()
985 ocelot_vcap_policer_del(ocelot, filter->action.pol_ix); in ocelot_vcap_filter_del_aux_resources()
987 if (filter->block_id == VCAP_IS2 && filter->action.mirror_ena) in ocelot_vcap_filter_del_aux_resources()
996 struct list_head *pos = &block->rules; in ocelot_vcap_filter_add_to_block()
1004 block->count++; in ocelot_vcap_filter_add_to_block()
1006 list_for_each_entry(tmp, &block->rules, list) { in ocelot_vcap_filter_add_to_block()
1007 if (filter->prio < tmp->prio) { in ocelot_vcap_filter_add_to_block()
1008 pos = &tmp->list; in ocelot_vcap_filter_add_to_block()
1012 list_add_tail(&filter->list, pos); in ocelot_vcap_filter_add_to_block()
1020 return !memcmp(&a->id, &b->id, sizeof(struct ocelot_vcap_id)); in ocelot_vcap_filter_equal()
1029 list_for_each_entry(tmp, &block->rules, list) { in ocelot_vcap_block_get_filter_index()
1035 return -ENOENT; in ocelot_vcap_block_get_filter_index()
1045 list_for_each_entry(tmp, &block->rules, list) { in ocelot_vcap_block_find_filter_by_index()
1060 list_for_each_entry(filter, &block->rules, list) in ocelot_vcap_block_find_filter_by_id()
1061 if (filter->id.tc_offload == tc_offload && in ocelot_vcap_block_find_filter_by_id()
1062 filter->id.cookie == cookie) in ocelot_vcap_block_find_filter_by_id()
1069 /* If @on=false, then SNAP, ARP, IP and OAM frames will not match on keys based
1070 * on destination and source MAC addresses, but only on higher-level protocol
1071 * information. The only frame types to match on keys containing MAC addresses
1072 * in this case are non-SNAP, non-ARP, non-IP and non-OAM frames.
1075 * on MAC_ETYPE keys such as destination and source MAC on this ingress port.
1077 * on any _other_ keys than MAC_ETYPE ones.
1105 if (filter->key_type != OCELOT_VCAP_KEY_ETYPE) in ocelot_vcap_is_problematic_mac_etype()
1108 proto = ntohs(*(__be16 *)filter->key.etype.etype.value); in ocelot_vcap_is_problematic_mac_etype()
1109 mask = ntohs(*(__be16 *)filter->key.etype.etype.mask); in ocelot_vcap_is_problematic_mac_etype()
1127 if (filter->key_type == OCELOT_VCAP_KEY_SNAP) in ocelot_vcap_is_problematic_non_mac_etype()
1129 if (filter->key_type == OCELOT_VCAP_KEY_ARP) in ocelot_vcap_is_problematic_non_mac_etype()
1131 if (filter->key_type == OCELOT_VCAP_KEY_IPV4) in ocelot_vcap_is_problematic_non_mac_etype()
1133 if (filter->key_type == OCELOT_VCAP_KEY_IPV6) in ocelot_vcap_is_problematic_non_mac_etype()
1142 struct ocelot_vcap_block *block = &ocelot->block[filter->block_id]; in ocelot_exclusive_mac_etype_filter_rules()
1148 if (filter->block_id != VCAP_IS2) in ocelot_exclusive_mac_etype_filter_rules()
1152 /* Search for any non-MAC_ETYPE rules on the port */ in ocelot_exclusive_mac_etype_filter_rules()
1153 for (i = 0; i < block->count; i++) { in ocelot_exclusive_mac_etype_filter_rules()
1155 if (tmp->ingress_port_mask & filter->ingress_port_mask && in ocelot_exclusive_mac_etype_filter_rules()
1156 tmp->lookup == filter->lookup && in ocelot_exclusive_mac_etype_filter_rules()
1161 for_each_set_bit(port, &filter->ingress_port_mask, in ocelot_exclusive_mac_etype_filter_rules()
1162 ocelot->num_phys_ports) in ocelot_exclusive_mac_etype_filter_rules()
1164 filter->lookup, true); in ocelot_exclusive_mac_etype_filter_rules()
1167 for (i = 0; i < block->count; i++) { in ocelot_exclusive_mac_etype_filter_rules()
1169 if (tmp->ingress_port_mask & filter->ingress_port_mask && in ocelot_exclusive_mac_etype_filter_rules()
1170 tmp->lookup == filter->lookup && in ocelot_exclusive_mac_etype_filter_rules()
1175 for_each_set_bit(port, &filter->ingress_port_mask, in ocelot_exclusive_mac_etype_filter_rules()
1176 ocelot->num_phys_ports) in ocelot_exclusive_mac_etype_filter_rules()
1178 filter->lookup, false); in ocelot_exclusive_mac_etype_filter_rules()
1188 struct ocelot_vcap_block *block = &ocelot->block[filter->block_id]; in ocelot_vcap_filter_add()
1193 "Cannot mix MAC_ETYPE with non-MAC_ETYPE rules, use the other IS2 lookup"); in ocelot_vcap_filter_add()
1194 return -EBUSY; in ocelot_vcap_filter_add()
1208 for (i = block->count - 1; i > index; i--) { in ocelot_vcap_filter_add()
1213 vcap_entry_get(ocelot, i - 1, tmp); in ocelot_vcap_filter_add()
1229 list_for_each_entry_safe(tmp, n, &block->rules, list) { in ocelot_vcap_block_remove_filter()
1232 list_del(&tmp->list); in ocelot_vcap_block_remove_filter()
1237 block->count--; in ocelot_vcap_block_remove_filter()
1243 struct ocelot_vcap_block *block = &ocelot->block[filter->block_id]; in ocelot_vcap_filter_del()
1251 del_filter.block_id = filter->block_id; in ocelot_vcap_filter_del()
1262 for (i = index; i < block->count; i++) { in ocelot_vcap_filter_del()
1272 vcap_entry_set(ocelot, block->count, &del_filter); in ocelot_vcap_filter_del()
1281 struct ocelot_vcap_block *block = &ocelot->block[filter->block_id]; in ocelot_vcap_filter_replace()
1297 struct ocelot_vcap_block *block = &ocelot->block[filter->block_id]; in ocelot_vcap_filter_stats_update()
1323 ocelot_target_write(ocelot, vcap->target, vcap->entry_count, in ocelot_vcap_init_one()
1328 ocelot_target_write(ocelot, vcap->target, vcap->action_count, in ocelot_vcap_init_one()
1341 version = ocelot_target_read(ocelot, vcap->target, in ocelot_vcap_detect_constants()
1347 /* Width in bits of type-group field */ in ocelot_vcap_detect_constants()
1348 vcap->tg_width = ocelot_target_read(ocelot, vcap->target, in ocelot_vcap_detect_constants()
1350 /* Number of subwords per TCAM row */ in ocelot_vcap_detect_constants()
1351 vcap->sw_count = ocelot_target_read(ocelot, vcap->target, in ocelot_vcap_detect_constants()
1353 /* Number of rows in TCAM. There can be this many full keys, or double in ocelot_vcap_detect_constants()
1354 * this number half keys, or 4 times this number quarter keys. in ocelot_vcap_detect_constants()
1356 vcap->entry_count = ocelot_target_read(ocelot, vcap->target, in ocelot_vcap_detect_constants()
1358 /* Assuming there are 4 subwords per TCAM row, their layout in the in ocelot_vcap_detect_constants()
1363 * (where SW=subword and TG=Type-Group). in ocelot_vcap_detect_constants()
1367 * registers, the Type-Group values are written through another set of in ocelot_vcap_detect_constants()
1370 * Important mention: regardless of the number of key entries per row in ocelot_vcap_detect_constants()
1371 * (and therefore of key size: 1 full key or 2 half keys or 4 quarter in ocelot_vcap_detect_constants()
1372 * keys), software always has to configure 4 Type-Group values. For in ocelot_vcap_detect_constants()
1374 * Type-Group to be full key. in ocelot_vcap_detect_constants()
1381 * Type-Groups, this means we need to subtract the width of the in ocelot_vcap_detect_constants()
1382 * Type-Groups when packing and unpacking key entry data in a TCAM row. in ocelot_vcap_detect_constants()
1384 vcap->entry_width = ocelot_target_read(ocelot, vcap->target, in ocelot_vcap_detect_constants()
1386 vcap->entry_width -= vcap->tg_width * vcap->sw_count; in ocelot_vcap_detect_constants()
1387 num_default_actions = ocelot_target_read(ocelot, vcap->target, in ocelot_vcap_detect_constants()
1389 vcap->action_count = vcap->entry_count + num_default_actions; in ocelot_vcap_detect_constants()
1390 vcap->action_width = ocelot_target_read(ocelot, vcap->target, in ocelot_vcap_detect_constants()
1393 * counter-fields associated with one full-word entry. There is one in ocelot_vcap_detect_constants()
1394 * counter per entry sub-word (see CAP_CORE::ENTRY_SWCNT for number of in ocelot_vcap_detect_constants()
1397 vcap->counter_words = vcap->sw_count; in ocelot_vcap_detect_constants()
1398 counter_memory_width = ocelot_target_read(ocelot, vcap->target, in ocelot_vcap_detect_constants()
1400 vcap->counter_width = counter_memory_width / vcap->counter_words; in ocelot_vcap_detect_constants()
1419 struct ocelot_vcap_block *block = &ocelot->block[i]; in ocelot_vcap_init()
1420 struct vcap_props *vcap = &ocelot->vcap[i]; in ocelot_vcap_init()
1422 INIT_LIST_HEAD(&block->rules); in ocelot_vcap_init()
1428 INIT_LIST_HEAD(&ocelot->dummy_rules); in ocelot_vcap_init()
1429 INIT_LIST_HEAD(&ocelot->traps); in ocelot_vcap_init()
1430 INIT_LIST_HEAD(&ocelot->vcap_pol.pol_list); in ocelot_vcap_init()