Lines Matching +full:stream +full:- +full:match +full:- +full:mask
1 // SPDX-License-Identifier: (GPL-2.0 OR MIT)
35 return -EOPNOTSUPP; in ocelot_chain_to_block()
38 /* Backwards compatibility with older, single-chain tc-flower in ocelot_chain_to_block()
56 return -EOPNOTSUPP; in ocelot_chain_to_block()
64 /* Backwards compatibility with older, single-chain tc-flower in ocelot_chain_to_lookup()
80 /* Backwards compatibility with older, single-chain tc-flower in ocelot_chain_to_pag()
89 return chain - VCAP_IS2_CHAIN(lookup, 0); in ocelot_chain_to_pag()
101 /* Non-optional GOTOs */ in ocelot_is_goto_target_valid()
117 /* Lookup 2 of VCAP IS1 can really support non-optional GOTOs, in ocelot_is_goto_target_valid()
118 * using a Policy Association Group (PAG) value, which is an 8-bit in ocelot_is_goto_target_valid()
129 /* Non-optional GOTO from VCAP IS2 lookup 0 to lookup 1. in ocelot_is_goto_target_valid()
156 block = &ocelot->block[VCAP_IS1]; in ocelot_find_vcap_filter_that_points_at()
158 list_for_each_entry(filter, &block->rules, list) in ocelot_find_vcap_filter_that_points_at()
159 if (filter->type == OCELOT_VCAP_FILTER_PAG && in ocelot_find_vcap_filter_that_points_at()
160 filter->goto_target == chain) in ocelot_find_vcap_filter_that_points_at()
164 list_for_each_entry(filter, &ocelot->dummy_rules, list) in ocelot_find_vcap_filter_that_points_at()
165 if (filter->goto_target == chain) in ocelot_find_vcap_filter_that_points_at()
177 struct ocelot_port *ocelot_port = ocelot->ports[port]; in ocelot_flower_parse_ingress_vlan_modify()
179 if (filter->goto_target != -1) { in ocelot_flower_parse_ingress_vlan_modify()
182 return -EOPNOTSUPP; in ocelot_flower_parse_ingress_vlan_modify()
185 if (!ocelot_port->vlan_aware) { in ocelot_flower_parse_ingress_vlan_modify()
188 return -EOPNOTSUPP; in ocelot_flower_parse_ingress_vlan_modify()
191 filter->action.vid_replace_ena = true; in ocelot_flower_parse_ingress_vlan_modify()
192 filter->action.pcp_dei_ena = true; in ocelot_flower_parse_ingress_vlan_modify()
193 filter->action.vid = a->vlan.vid; in ocelot_flower_parse_ingress_vlan_modify()
194 filter->action.pcp = a->vlan.prio; in ocelot_flower_parse_ingress_vlan_modify()
195 filter->type = OCELOT_VCAP_FILTER_OFFLOAD; in ocelot_flower_parse_ingress_vlan_modify()
207 switch (ntohs(a->vlan.proto)) { in ocelot_flower_parse_egress_vlan_modify()
217 return -EOPNOTSUPP; in ocelot_flower_parse_egress_vlan_modify()
220 filter->action.tag_a_tpid_sel = tpid; in ocelot_flower_parse_egress_vlan_modify()
221 filter->action.push_outer_tag = OCELOT_ES0_TAG; in ocelot_flower_parse_egress_vlan_modify()
222 filter->action.tag_a_vid_sel = OCELOT_ES0_VID_PLUS_CLASSIFIED_VID; in ocelot_flower_parse_egress_vlan_modify()
223 filter->action.vid_a_val = a->vlan.vid; in ocelot_flower_parse_egress_vlan_modify()
224 filter->action.pcp_a_val = a->vlan.prio; in ocelot_flower_parse_egress_vlan_modify()
225 filter->action.tag_a_pcp_sel = OCELOT_ES0_PCP; in ocelot_flower_parse_egress_vlan_modify()
226 filter->type = OCELOT_VCAP_FILTER_OFFLOAD; in ocelot_flower_parse_egress_vlan_modify()
237 int egress_port = ocelot->ops->netdev_to_port(a->dev); in ocelot_flower_parse_egress_port()
243 if (egress_port < 0 || a->id != offloadable_act_id) { in ocelot_flower_parse_egress_port()
244 if (f->common.skip_sw) { in ocelot_flower_parse_egress_port()
249 return -EOPNOTSUPP; in ocelot_flower_parse_egress_port()
251 egress_port = ocelot->num_phys_ports; in ocelot_flower_parse_egress_port()
261 const struct flow_action *action = &f->rule->action; in ocelot_flower_parse_action()
262 struct netlink_ext_ack *extack = f->common.extack; in ocelot_flower_parse_action()
271 if (!flow_action_basic_hw_stats_check(&f->rule->action, in ocelot_flower_parse_action()
272 f->common.extack)) in ocelot_flower_parse_action()
273 return -EOPNOTSUPP; in ocelot_flower_parse_action()
275 chain = f->common.chain_index; in ocelot_flower_parse_action()
276 filter->block_id = ocelot_chain_to_block(chain, ingress); in ocelot_flower_parse_action()
277 if (filter->block_id < 0) { in ocelot_flower_parse_action()
279 return -EOPNOTSUPP; in ocelot_flower_parse_action()
281 if (filter->block_id == VCAP_IS1 || filter->block_id == VCAP_IS2) in ocelot_flower_parse_action()
282 filter->lookup = ocelot_chain_to_lookup(chain); in ocelot_flower_parse_action()
283 if (filter->block_id == VCAP_IS2) in ocelot_flower_parse_action()
284 filter->pag = ocelot_chain_to_pag(chain); in ocelot_flower_parse_action()
286 filter->goto_target = -1; in ocelot_flower_parse_action()
287 filter->type = OCELOT_VCAP_FILTER_DUMMY; in ocelot_flower_parse_action()
290 switch (a->id) { in ocelot_flower_parse_action()
292 if (filter->block_id != VCAP_IS2) { in ocelot_flower_parse_action()
295 return -EOPNOTSUPP; in ocelot_flower_parse_action()
297 if (filter->goto_target != -1) { in ocelot_flower_parse_action()
300 return -EOPNOTSUPP; in ocelot_flower_parse_action()
302 filter->action.mask_mode = OCELOT_MASK_MODE_PERMIT_DENY; in ocelot_flower_parse_action()
303 filter->action.port_mask = 0; in ocelot_flower_parse_action()
304 filter->action.police_ena = true; in ocelot_flower_parse_action()
305 filter->action.pol_ix = OCELOT_POLICER_DISCARD; in ocelot_flower_parse_action()
306 filter->type = OCELOT_VCAP_FILTER_OFFLOAD; in ocelot_flower_parse_action()
309 if (filter->block_id != VCAP_ES0 && in ocelot_flower_parse_action()
310 filter->block_id != VCAP_IS1 && in ocelot_flower_parse_action()
311 filter->block_id != VCAP_IS2) { in ocelot_flower_parse_action()
314 return -EOPNOTSUPP; in ocelot_flower_parse_action()
316 if (filter->block_id != VCAP_ES0 && in ocelot_flower_parse_action()
317 filter->goto_target != -1) { in ocelot_flower_parse_action()
320 return -EOPNOTSUPP; in ocelot_flower_parse_action()
322 filter->type = OCELOT_VCAP_FILTER_OFFLOAD; in ocelot_flower_parse_action()
325 if (filter->block_id != VCAP_IS2 || in ocelot_flower_parse_action()
326 filter->lookup != 0) { in ocelot_flower_parse_action()
329 return -EOPNOTSUPP; in ocelot_flower_parse_action()
331 if (filter->goto_target != -1) { in ocelot_flower_parse_action()
334 return -EOPNOTSUPP; in ocelot_flower_parse_action()
336 filter->action.mask_mode = OCELOT_MASK_MODE_PERMIT_DENY; in ocelot_flower_parse_action()
337 filter->action.port_mask = 0; in ocelot_flower_parse_action()
338 filter->action.cpu_copy_ena = true; in ocelot_flower_parse_action()
339 filter->action.cpu_qu_num = 0; in ocelot_flower_parse_action()
340 filter->type = OCELOT_VCAP_FILTER_OFFLOAD; in ocelot_flower_parse_action()
341 filter->is_trap = true; in ocelot_flower_parse_action()
344 if (filter->block_id == PSFP_BLOCK_ID) { in ocelot_flower_parse_action()
345 filter->type = OCELOT_PSFP_FILTER_OFFLOAD; in ocelot_flower_parse_action()
348 if (filter->block_id != VCAP_IS2 || in ocelot_flower_parse_action()
349 filter->lookup != 0) { in ocelot_flower_parse_action()
352 return -EOPNOTSUPP; in ocelot_flower_parse_action()
354 if (filter->goto_target != -1) { in ocelot_flower_parse_action()
357 return -EOPNOTSUPP; in ocelot_flower_parse_action()
364 filter->action.police_ena = true; in ocelot_flower_parse_action()
366 pol_ix = a->hw_index + ocelot->vcap_pol.base; in ocelot_flower_parse_action()
367 pol_max = ocelot->vcap_pol.max; in ocelot_flower_parse_action()
369 if (ocelot->vcap_pol.max2 && pol_ix > pol_max) { in ocelot_flower_parse_action()
370 pol_ix += ocelot->vcap_pol.base2 - pol_max - 1; in ocelot_flower_parse_action()
371 pol_max = ocelot->vcap_pol.max2; in ocelot_flower_parse_action()
375 return -EINVAL; in ocelot_flower_parse_action()
377 filter->action.pol_ix = pol_ix; in ocelot_flower_parse_action()
379 rate = a->police.rate_bytes_ps; in ocelot_flower_parse_action()
380 filter->action.pol.rate = div_u64(rate, 1000) * 8; in ocelot_flower_parse_action()
381 filter->action.pol.burst = a->police.burst; in ocelot_flower_parse_action()
382 filter->type = OCELOT_VCAP_FILTER_OFFLOAD; in ocelot_flower_parse_action()
386 if (filter->block_id != VCAP_IS2) { in ocelot_flower_parse_action()
389 return -EOPNOTSUPP; in ocelot_flower_parse_action()
391 if (filter->goto_target != -1) { in ocelot_flower_parse_action()
394 return -EOPNOTSUPP; in ocelot_flower_parse_action()
403 filter->action.mask_mode = OCELOT_MASK_MODE_REDIRECT; in ocelot_flower_parse_action()
404 filter->action.port_mask = BIT(egress_port); in ocelot_flower_parse_action()
405 filter->type = OCELOT_VCAP_FILTER_OFFLOAD; in ocelot_flower_parse_action()
409 if (filter->block_id != VCAP_IS2) { in ocelot_flower_parse_action()
412 return -EOPNOTSUPP; in ocelot_flower_parse_action()
414 if (filter->goto_target != -1) { in ocelot_flower_parse_action()
417 return -EOPNOTSUPP; in ocelot_flower_parse_action()
426 filter->egress_port.value = egress_port; in ocelot_flower_parse_action()
427 filter->action.mirror_ena = true; in ocelot_flower_parse_action()
428 filter->type = OCELOT_VCAP_FILTER_OFFLOAD; in ocelot_flower_parse_action()
431 if (filter->block_id != VCAP_IS1) { in ocelot_flower_parse_action()
434 return -EOPNOTSUPP; in ocelot_flower_parse_action()
436 if (filter->goto_target != -1) { in ocelot_flower_parse_action()
439 return -EOPNOTSUPP; in ocelot_flower_parse_action()
441 filter->action.vlan_pop_cnt_ena = true; in ocelot_flower_parse_action()
442 filter->action.vlan_pop_cnt++; in ocelot_flower_parse_action()
443 if (filter->action.vlan_pop_cnt > 2) { in ocelot_flower_parse_action()
446 return -EOPNOTSUPP; in ocelot_flower_parse_action()
448 filter->type = OCELOT_VCAP_FILTER_OFFLOAD; in ocelot_flower_parse_action()
451 if (filter->block_id == VCAP_IS1) { in ocelot_flower_parse_action()
455 } else if (filter->block_id == VCAP_ES0) { in ocelot_flower_parse_action()
461 err = -EOPNOTSUPP; in ocelot_flower_parse_action()
467 if (filter->block_id != VCAP_IS1) { in ocelot_flower_parse_action()
470 return -EOPNOTSUPP; in ocelot_flower_parse_action()
472 if (filter->goto_target != -1) { in ocelot_flower_parse_action()
475 return -EOPNOTSUPP; in ocelot_flower_parse_action()
477 filter->action.qos_ena = true; in ocelot_flower_parse_action()
478 filter->action.qos_val = a->priority; in ocelot_flower_parse_action()
479 filter->type = OCELOT_VCAP_FILTER_OFFLOAD; in ocelot_flower_parse_action()
482 filter->goto_target = a->chain_index; in ocelot_flower_parse_action()
484 if (filter->block_id == VCAP_IS1 && filter->lookup == 2) { in ocelot_flower_parse_action()
485 int pag = ocelot_chain_to_pag(filter->goto_target); in ocelot_flower_parse_action()
487 filter->action.pag_override_mask = 0xff; in ocelot_flower_parse_action()
488 filter->action.pag_val = pag; in ocelot_flower_parse_action()
489 filter->type = OCELOT_VCAP_FILTER_PAG; in ocelot_flower_parse_action()
493 if (filter->block_id != VCAP_ES0) { in ocelot_flower_parse_action()
496 return -EOPNOTSUPP; in ocelot_flower_parse_action()
498 switch (ntohs(a->vlan.proto)) { in ocelot_flower_parse_action()
508 return -EOPNOTSUPP; in ocelot_flower_parse_action()
510 filter->action.tag_a_tpid_sel = tpid; in ocelot_flower_parse_action()
511 filter->action.push_outer_tag = OCELOT_ES0_TAG; in ocelot_flower_parse_action()
512 filter->action.tag_a_vid_sel = OCELOT_ES0_VID; in ocelot_flower_parse_action()
513 filter->action.vid_a_val = a->vlan.vid; in ocelot_flower_parse_action()
514 filter->action.pcp_a_val = a->vlan.prio; in ocelot_flower_parse_action()
515 filter->type = OCELOT_VCAP_FILTER_OFFLOAD; in ocelot_flower_parse_action()
518 if (filter->block_id != PSFP_BLOCK_ID) { in ocelot_flower_parse_action()
521 return -EOPNOTSUPP; in ocelot_flower_parse_action()
523 filter->type = OCELOT_PSFP_FILTER_OFFLOAD; in ocelot_flower_parse_action()
527 return -EOPNOTSUPP; in ocelot_flower_parse_action()
531 if (filter->goto_target == -1) { in ocelot_flower_parse_action()
532 if ((filter->block_id == VCAP_IS2 && filter->lookup == 1) || in ocelot_flower_parse_action()
533 chain == 0 || filter->block_id == PSFP_BLOCK_ID) { in ocelot_flower_parse_action()
537 return -EOPNOTSUPP; in ocelot_flower_parse_action()
541 if (!ocelot_is_goto_target_valid(filter->goto_target, chain, ingress) && in ocelot_flower_parse_action()
544 return -EOPNOTSUPP; in ocelot_flower_parse_action()
555 const struct vcap_props *vcap = &ocelot->vcap[VCAP_ES0]; in ocelot_flower_parse_indev()
556 int key_length = vcap->keys[VCAP_ES0_IGR_PORT].length; in ocelot_flower_parse_indev()
557 struct netlink_ext_ack *extack = f->common.extack; in ocelot_flower_parse_indev()
559 struct flow_match_meta match; in ocelot_flower_parse_indev() local
562 flow_rule_match_meta(rule, &match); in ocelot_flower_parse_indev()
564 if (!match.mask->ingress_ifindex) in ocelot_flower_parse_indev()
567 if (match.mask->ingress_ifindex != 0xFFFFFFFF) { in ocelot_flower_parse_indev()
568 NL_SET_ERR_MSG_MOD(extack, "Unsupported ingress ifindex mask"); in ocelot_flower_parse_indev()
569 return -EOPNOTSUPP; in ocelot_flower_parse_indev()
572 dev = ocelot->ops->port_to_netdev(ocelot, port); in ocelot_flower_parse_indev()
574 return -EINVAL; in ocelot_flower_parse_indev()
576 indev = __dev_get_by_index(dev_net(dev), match.key->ingress_ifindex); in ocelot_flower_parse_indev()
579 "Can't find the ingress port to match on"); in ocelot_flower_parse_indev()
580 return -ENOENT; in ocelot_flower_parse_indev()
583 ingress_port = ocelot->ops->netdev_to_port(indev); in ocelot_flower_parse_indev()
587 return -EOPNOTSUPP; in ocelot_flower_parse_indev()
592 return -EINVAL; in ocelot_flower_parse_indev()
595 filter->ingress_port.value = ingress_port; in ocelot_flower_parse_indev()
596 filter->ingress_port.mask = GENMASK(key_length - 1, 0); in ocelot_flower_parse_indev()
607 struct flow_dissector *dissector = rule->match.dissector; in ocelot_flower_parse_key()
608 struct netlink_ext_ack *extack = f->common.extack; in ocelot_flower_parse_key()
609 u16 proto = ntohs(f->common.protocol); in ocelot_flower_parse_key()
613 if (dissector->used_keys & in ocelot_flower_parse_key()
622 return -EOPNOTSUPP; in ocelot_flower_parse_key()
626 struct flow_match_meta match; in ocelot_flower_parse_key() local
628 flow_rule_match_meta(rule, &match); in ocelot_flower_parse_key()
629 if (match.mask->l2_miss) { in ocelot_flower_parse_key()
630 NL_SET_ERR_MSG_MOD(extack, "Can't match on \"l2_miss\""); in ocelot_flower_parse_key()
631 return -EOPNOTSUPP; in ocelot_flower_parse_key()
635 /* For VCAP ES0 (egress rewriter) we can match on the ingress port */ in ocelot_flower_parse_key()
643 return -EOPNOTSUPP; in ocelot_flower_parse_key()
646 struct flow_match_vlan match; in ocelot_flower_parse_key() local
648 flow_rule_match_vlan(rule, &match); in ocelot_flower_parse_key()
649 filter->key_type = OCELOT_VCAP_KEY_ANY; in ocelot_flower_parse_key()
650 filter->vlan.vid.value = match.key->vlan_id; in ocelot_flower_parse_key()
651 filter->vlan.vid.mask = match.mask->vlan_id; in ocelot_flower_parse_key()
652 filter->vlan.pcp.value[0] = match.key->vlan_priority; in ocelot_flower_parse_key()
653 filter->vlan.pcp.mask[0] = match.mask->vlan_priority; in ocelot_flower_parse_key()
658 struct flow_match_eth_addrs match; in ocelot_flower_parse_key() local
660 if (filter->block_id == VCAP_ES0) { in ocelot_flower_parse_key()
662 "VCAP ES0 cannot match on MAC address"); in ocelot_flower_parse_key()
663 return -EOPNOTSUPP; in ocelot_flower_parse_key()
670 if ((dissector->used_keys & in ocelot_flower_parse_key()
677 return -EOPNOTSUPP; in ocelot_flower_parse_key()
679 flow_rule_match_eth_addrs(rule, &match); in ocelot_flower_parse_key()
681 if (filter->block_id == VCAP_IS1 && in ocelot_flower_parse_key()
682 !is_zero_ether_addr(match.mask->dst)) { in ocelot_flower_parse_key()
684 "Key type S1_NORMAL cannot match on destination MAC"); in ocelot_flower_parse_key()
685 return -EOPNOTSUPP; in ocelot_flower_parse_key()
688 filter->key_type = OCELOT_VCAP_KEY_ETYPE; in ocelot_flower_parse_key()
689 ether_addr_copy(filter->key.etype.dmac.value, in ocelot_flower_parse_key()
690 match.key->dst); in ocelot_flower_parse_key()
691 ether_addr_copy(filter->key.etype.smac.value, in ocelot_flower_parse_key()
692 match.key->src); in ocelot_flower_parse_key()
693 ether_addr_copy(filter->key.etype.dmac.mask, in ocelot_flower_parse_key()
694 match.mask->dst); in ocelot_flower_parse_key()
695 ether_addr_copy(filter->key.etype.smac.mask, in ocelot_flower_parse_key()
696 match.mask->src); in ocelot_flower_parse_key()
701 struct flow_match_basic match; in ocelot_flower_parse_key() local
703 flow_rule_match_basic(rule, &match); in ocelot_flower_parse_key()
704 if (ntohs(match.key->n_proto) == ETH_P_IP) { in ocelot_flower_parse_key()
705 if (filter->block_id == VCAP_ES0) { in ocelot_flower_parse_key()
707 "VCAP ES0 cannot match on IP protocol"); in ocelot_flower_parse_key()
708 return -EOPNOTSUPP; in ocelot_flower_parse_key()
711 filter->key_type = OCELOT_VCAP_KEY_IPV4; in ocelot_flower_parse_key()
712 filter->key.ipv4.proto.value[0] = in ocelot_flower_parse_key()
713 match.key->ip_proto; in ocelot_flower_parse_key()
714 filter->key.ipv4.proto.mask[0] = in ocelot_flower_parse_key()
715 match.mask->ip_proto; in ocelot_flower_parse_key()
718 if (ntohs(match.key->n_proto) == ETH_P_IPV6) { in ocelot_flower_parse_key()
719 if (filter->block_id == VCAP_ES0) { in ocelot_flower_parse_key()
721 "VCAP ES0 cannot match on IP protocol"); in ocelot_flower_parse_key()
722 return -EOPNOTSUPP; in ocelot_flower_parse_key()
725 filter->key_type = OCELOT_VCAP_KEY_IPV6; in ocelot_flower_parse_key()
726 filter->key.ipv6.proto.value[0] = in ocelot_flower_parse_key()
727 match.key->ip_proto; in ocelot_flower_parse_key()
728 filter->key.ipv6.proto.mask[0] = in ocelot_flower_parse_key()
729 match.mask->ip_proto; in ocelot_flower_parse_key()
736 struct flow_match_ipv4_addrs match; in ocelot_flower_parse_key() local
739 if (filter->block_id == VCAP_ES0) { in ocelot_flower_parse_key()
741 "VCAP ES0 cannot match on IP address"); in ocelot_flower_parse_key()
742 return -EOPNOTSUPP; in ocelot_flower_parse_key()
745 flow_rule_match_ipv4_addrs(rule, &match); in ocelot_flower_parse_key()
747 if (filter->block_id == VCAP_IS1 && *(u32 *)&match.mask->dst) { in ocelot_flower_parse_key()
749 "Key type S1_NORMAL cannot match on destination IP"); in ocelot_flower_parse_key()
750 return -EOPNOTSUPP; in ocelot_flower_parse_key()
753 tmp = &filter->key.ipv4.sip.value.addr[0]; in ocelot_flower_parse_key()
754 memcpy(tmp, &match.key->src, 4); in ocelot_flower_parse_key()
756 tmp = &filter->key.ipv4.sip.mask.addr[0]; in ocelot_flower_parse_key()
757 memcpy(tmp, &match.mask->src, 4); in ocelot_flower_parse_key()
759 tmp = &filter->key.ipv4.dip.value.addr[0]; in ocelot_flower_parse_key()
760 memcpy(tmp, &match.key->dst, 4); in ocelot_flower_parse_key()
762 tmp = &filter->key.ipv4.dip.mask.addr[0]; in ocelot_flower_parse_key()
763 memcpy(tmp, &match.mask->dst, 4); in ocelot_flower_parse_key()
769 return -EOPNOTSUPP; in ocelot_flower_parse_key()
773 struct flow_match_ports match; in ocelot_flower_parse_key() local
775 if (filter->block_id == VCAP_ES0) { in ocelot_flower_parse_key()
777 "VCAP ES0 cannot match on L4 ports"); in ocelot_flower_parse_key()
778 return -EOPNOTSUPP; in ocelot_flower_parse_key()
781 flow_rule_match_ports(rule, &match); in ocelot_flower_parse_key()
782 filter->key.ipv4.sport.value = ntohs(match.key->src); in ocelot_flower_parse_key()
783 filter->key.ipv4.sport.mask = ntohs(match.mask->src); in ocelot_flower_parse_key()
784 filter->key.ipv4.dport.value = ntohs(match.key->dst); in ocelot_flower_parse_key()
785 filter->key.ipv4.dport.mask = ntohs(match.mask->dst); in ocelot_flower_parse_key()
791 if (filter->block_id == VCAP_ES0) { in ocelot_flower_parse_key()
793 "VCAP ES0 cannot match on L2 proto"); in ocelot_flower_parse_key()
794 return -EOPNOTSUPP; in ocelot_flower_parse_key()
799 return -EOPNOTSUPP; in ocelot_flower_parse_key()
800 filter->key_type = OCELOT_VCAP_KEY_ETYPE; in ocelot_flower_parse_key()
801 *(__be16 *)filter->key.etype.etype.value = htons(proto); in ocelot_flower_parse_key()
802 *(__be16 *)filter->key.etype.etype.mask = htons(0xffff); in ocelot_flower_parse_key()
815 filter->prio = f->common.prio; in ocelot_flower_parse()
816 filter->id.cookie = f->cookie; in ocelot_flower_parse()
817 filter->id.tc_offload = true; in ocelot_flower_parse()
823 /* PSFP filter need to parse key by stream identification function. */ in ocelot_flower_parse()
824 if (filter->type == OCELOT_PSFP_FILTER_OFFLOAD) in ocelot_flower_parse()
841 filter->ingress_port_mask = BIT(port); in ocelot_vcap_filter_create()
843 const struct vcap_props *vcap = &ocelot->vcap[VCAP_ES0]; in ocelot_vcap_filter_create()
844 int key_length = vcap->keys[VCAP_ES0_EGR_PORT].length; in ocelot_vcap_filter_create()
846 filter->egress_port.value = port; in ocelot_vcap_filter_create()
847 filter->egress_port.mask = GENMASK(key_length - 1, 0); in ocelot_vcap_filter_create()
856 list_add(&filter->list, &ocelot->dummy_rules); in ocelot_vcap_dummy_filter_add()
864 list_del(&filter->list); in ocelot_vcap_dummy_filter_del()
879 if (filter->block_id != VCAP_ES0 || in ocelot_flower_patch_es0_vlan_modify()
880 filter->action.tag_a_vid_sel != OCELOT_ES0_VID_PLUS_CLASSIFIED_VID) in ocelot_flower_patch_es0_vlan_modify()
883 if (filter->vlan.vid.mask != VLAN_VID_MASK) { in ocelot_flower_patch_es0_vlan_modify()
886 return -EOPNOTSUPP; in ocelot_flower_patch_es0_vlan_modify()
889 filter->action.vid_a_val -= filter->vlan.vid.value; in ocelot_flower_patch_es0_vlan_modify()
890 filter->action.vid_a_val &= VLAN_VID_MASK; in ocelot_flower_patch_es0_vlan_modify()
898 struct netlink_ext_ack *extack = f->common.extack; in ocelot_cls_flower_replace()
900 int chain = f->common.chain_index; in ocelot_cls_flower_replace()
905 return -EOPNOTSUPP; in ocelot_cls_flower_replace()
911 return -EOPNOTSUPP; in ocelot_cls_flower_replace()
914 filter = ocelot_vcap_block_find_filter_by_id(&ocelot->block[block_id], in ocelot_cls_flower_replace()
915 f->cookie, true); in ocelot_cls_flower_replace()
920 return -EOPNOTSUPP; in ocelot_cls_flower_replace()
923 filter->ingress_port_mask |= BIT(port); in ocelot_cls_flower_replace()
931 return -ENOMEM; in ocelot_cls_flower_replace()
945 /* The non-optional GOTOs for the TCAM skeleton don't need in ocelot_cls_flower_replace()
948 if (filter->type == OCELOT_VCAP_FILTER_DUMMY) in ocelot_cls_flower_replace()
951 if (filter->type == OCELOT_PSFP_FILTER_OFFLOAD) { in ocelot_cls_flower_replace()
953 if (ocelot->ops->psfp_filter_add) in ocelot_cls_flower_replace()
954 return ocelot->ops->psfp_filter_add(ocelot, port, f); in ocelot_cls_flower_replace()
957 return -EOPNOTSUPP; in ocelot_cls_flower_replace()
960 return ocelot_vcap_filter_add(ocelot, filter, f->common.extack); in ocelot_cls_flower_replace()
971 block_id = ocelot_chain_to_block(f->common.chain_index, ingress); in ocelot_cls_flower_destroy()
976 if (ocelot->ops->psfp_filter_del) in ocelot_cls_flower_destroy()
977 return ocelot->ops->psfp_filter_del(ocelot, f); in ocelot_cls_flower_destroy()
979 return -EOPNOTSUPP; in ocelot_cls_flower_destroy()
982 block = &ocelot->block[block_id]; in ocelot_cls_flower_destroy()
984 filter = ocelot_vcap_block_find_filter_by_id(block, f->cookie, true); in ocelot_cls_flower_destroy()
988 if (filter->type == OCELOT_VCAP_FILTER_DUMMY) in ocelot_cls_flower_destroy()
992 filter->ingress_port_mask &= ~BIT(port); in ocelot_cls_flower_destroy()
993 if (filter->ingress_port_mask) in ocelot_cls_flower_destroy()
1009 block_id = ocelot_chain_to_block(f->common.chain_index, ingress); in ocelot_cls_flower_stats()
1014 if (ocelot->ops->psfp_stats_get) { in ocelot_cls_flower_stats()
1015 ret = ocelot->ops->psfp_stats_get(ocelot, f, &stats); in ocelot_cls_flower_stats()
1022 return -EOPNOTSUPP; in ocelot_cls_flower_stats()
1025 block = &ocelot->block[block_id]; in ocelot_cls_flower_stats()
1027 filter = ocelot_vcap_block_find_filter_by_id(block, f->cookie, true); in ocelot_cls_flower_stats()
1028 if (!filter || filter->type == OCELOT_VCAP_FILTER_DUMMY) in ocelot_cls_flower_stats()
1035 stats.pkts = filter->stats.pkts; in ocelot_cls_flower_stats()
1038 flow_stats_update(&f->stats, 0x0, stats.pkts, stats.drops, 0x0, in ocelot_cls_flower_stats()