Lines Matching +full:pre +full:- +full:verified

1 // SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2 /* Copyright (C) 2017-2018 Netronome Systems, Inc. */
39 push_mpls->head.jump_id = NFP_FL_ACTION_OPCODE_PUSH_MPLS; in nfp_fl_push_mpls()
40 push_mpls->head.len_lw = act_size >> NFP_FL_LW_SIZ; in nfp_fl_push_mpls()
43 if (act->mpls_push.bos != ACT_MPLS_BOS_NOT_SET) { in nfp_fl_push_mpls()
44 mpls_lse |= act->mpls_push.bos << MPLS_LS_S_SHIFT; in nfp_fl_push_mpls()
47 return -EOPNOTSUPP; in nfp_fl_push_mpls()
51 if (act->mpls_push.tc != ACT_MPLS_TC_NOT_SET) in nfp_fl_push_mpls()
52 mpls_lse |= act->mpls_push.tc << MPLS_LS_TC_SHIFT; in nfp_fl_push_mpls()
54 /* Proto, label and TTL are enforced and verified for MPLS push. */ in nfp_fl_push_mpls()
55 mpls_lse |= act->mpls_push.label << MPLS_LS_LABEL_SHIFT; in nfp_fl_push_mpls()
56 mpls_lse |= act->mpls_push.ttl << MPLS_LS_TTL_SHIFT; in nfp_fl_push_mpls()
57 push_mpls->ethtype = act->mpls_push.proto; in nfp_fl_push_mpls()
58 push_mpls->lse = cpu_to_be32(mpls_lse); in nfp_fl_push_mpls()
69 pop_mpls->head.jump_id = NFP_FL_ACTION_OPCODE_POP_MPLS; in nfp_fl_pop_mpls()
70 pop_mpls->head.len_lw = act_size >> NFP_FL_LW_SIZ; in nfp_fl_pop_mpls()
71 pop_mpls->ethtype = act->mpls_pop.proto; in nfp_fl_pop_mpls()
81 set_mpls->head.jump_id = NFP_FL_ACTION_OPCODE_SET_MPLS; in nfp_fl_set_mpls()
82 set_mpls->head.len_lw = act_size >> NFP_FL_LW_SIZ; in nfp_fl_set_mpls()
84 if (act->mpls_mangle.label != ACT_MPLS_LABEL_NOT_SET) { in nfp_fl_set_mpls()
85 mpls_lse |= act->mpls_mangle.label << MPLS_LS_LABEL_SHIFT; in nfp_fl_set_mpls()
88 if (act->mpls_mangle.tc != ACT_MPLS_TC_NOT_SET) { in nfp_fl_set_mpls()
89 mpls_lse |= act->mpls_mangle.tc << MPLS_LS_TC_SHIFT; in nfp_fl_set_mpls()
92 if (act->mpls_mangle.bos != ACT_MPLS_BOS_NOT_SET) { in nfp_fl_set_mpls()
93 mpls_lse |= act->mpls_mangle.bos << MPLS_LS_S_SHIFT; in nfp_fl_set_mpls()
96 if (act->mpls_mangle.ttl) { in nfp_fl_set_mpls()
97 mpls_lse |= act->mpls_mangle.ttl << MPLS_LS_TTL_SHIFT; in nfp_fl_set_mpls()
101 set_mpls->lse = cpu_to_be32(mpls_lse); in nfp_fl_set_mpls()
102 set_mpls->lse_mask = cpu_to_be32(mpls_mask); in nfp_fl_set_mpls()
109 pop_vlan->head.jump_id = NFP_FL_ACTION_OPCODE_POP_VLAN; in nfp_fl_pop_vlan()
110 pop_vlan->head.len_lw = act_size >> NFP_FL_LW_SIZ; in nfp_fl_pop_vlan()
111 pop_vlan->reserved = 0; in nfp_fl_pop_vlan()
121 push_vlan->head.jump_id = NFP_FL_ACTION_OPCODE_PUSH_VLAN; in nfp_fl_push_vlan()
122 push_vlan->head.len_lw = act_size >> NFP_FL_LW_SIZ; in nfp_fl_push_vlan()
123 push_vlan->reserved = 0; in nfp_fl_push_vlan()
124 push_vlan->vlan_tpid = act->vlan.proto; in nfp_fl_push_vlan()
127 FIELD_PREP(NFP_FL_PUSH_VLAN_PRIO, act->vlan.prio) | in nfp_fl_push_vlan()
128 FIELD_PREP(NFP_FL_PUSH_VLAN_VID, act->vlan.vid); in nfp_fl_push_vlan()
129 push_vlan->vlan_tci = cpu_to_be16(tmp_push_vlan_tci); in nfp_fl_push_vlan()
142 out_dev = act->dev; in nfp_fl_pre_lag()
148 return -EOPNOTSUPP; in nfp_fl_pre_lag()
155 memmove(nfp_flow->action_data + act_size, in nfp_fl_pre_lag()
156 nfp_flow->action_data, act_len); in nfp_fl_pre_lag()
158 pre_lag = (struct nfp_fl_pre_lag *)nfp_flow->action_data; in nfp_fl_pre_lag()
163 pre_lag->head.jump_id = NFP_FL_ACTION_OPCODE_PRE_LAG; in nfp_fl_pre_lag()
164 pre_lag->head.len_lw = act_size >> NFP_FL_LW_SIZ; in nfp_fl_pre_lag()
166 nfp_flow->meta.shortcut = cpu_to_be32(NFP_FL_SC_ACT_NULL); in nfp_fl_pre_lag()
180 struct nfp_flower_priv *priv = app->priv; in nfp_fl_output()
184 output->head.jump_id = NFP_FL_ACTION_OPCODE_OUTPUT; in nfp_fl_output()
185 output->head.len_lw = act_size >> NFP_FL_LW_SIZ; in nfp_fl_output()
187 out_dev = act->dev; in nfp_fl_output()
190 return -EOPNOTSUPP; in nfp_fl_output()
199 return -EOPNOTSUPP; in nfp_fl_output()
204 return -EOPNOTSUPP; in nfp_fl_output()
208 output->flags = cpu_to_be16(tmp_flags | in nfp_fl_output()
210 output->port = cpu_to_be32(NFP_FL_PORT_TYPE_TUN | tun_type); in nfp_fl_output()
212 priv->flower_en_feats & NFP_FL_ENABLE_LAG) { in nfp_fl_output()
215 output->flags = cpu_to_be16(tmp_flags); in nfp_fl_output()
221 output->port = cpu_to_be32(NFP_FL_LAG_OUT | gid); in nfp_fl_output()
223 if (!(priv->flower_ext_feats & NFP_FL_FEATS_PRE_TUN_RULES) && in nfp_fl_output()
224 !(priv->flower_ext_feats & NFP_FL_FEATS_DECAP_V2)) { in nfp_fl_output()
225 …NL_SET_ERR_MSG_MOD(extack, "unsupported offload: pre-tunnel rules not supported in loaded firmware… in nfp_fl_output()
226 return -EOPNOTSUPP; in nfp_fl_output()
229 if (nfp_flow->pre_tun_rule.dev || !pkt_host) { in nfp_fl_output()
230 …NL_SET_ERR_MSG_MOD(extack, "unsupported offload: pre-tunnel rules require single egress dev and pt… in nfp_fl_output()
231 return -EOPNOTSUPP; in nfp_fl_output()
234 nfp_flow->pre_tun_rule.dev = out_dev; in nfp_fl_output()
239 output->flags = cpu_to_be16(tmp_flags); in nfp_fl_output()
245 return -EOPNOTSUPP; in nfp_fl_output()
251 return -EOPNOTSUPP; in nfp_fl_output()
254 output->port = cpu_to_be32(nfp_repr_get_port_id(out_dev)); in nfp_fl_output()
255 if (!output->port) { in nfp_fl_output()
257 return -EOPNOTSUPP; in nfp_fl_output()
260 nfp_flow->meta.shortcut = output->port; in nfp_fl_output()
268 struct flow_action_entry *act = rule->action.entries; in nfp_flower_tun_is_gre()
269 int num_act = rule->action.num_entries; in nfp_flower_tun_is_gre()
287 const struct ip_tunnel_info *tun = act->tunnel; in nfp_fl_get_tun_from_act()
288 struct nfp_flower_priv *priv = app->priv; in nfp_fl_get_tun_from_act()
296 switch (tun->key.tp_dst) { in nfp_fl_get_tun_from_act()
300 if (priv->flower_ext_feats & NFP_FL_FEATS_GENEVE) in nfp_fl_get_tun_from_act()
323 pre_tun_act->head.jump_id = NFP_FL_ACTION_OPCODE_PRE_TUNNEL; in nfp_fl_pre_tunnel()
324 pre_tun_act->head.len_lw = act_size >> NFP_FL_LW_SIZ; in nfp_fl_pre_tunnel()
334 struct ip_tunnel_info *ip_tun = (struct ip_tunnel_info *)act->tunnel; in nfp_fl_push_geneve_options()
345 opt_len = ip_tun->options_len; in nfp_fl_push_geneve_options()
352 return -EOPNOTSUPP; in nfp_fl_push_geneve_options()
356 opt->length * 4; in nfp_fl_push_geneve_options()
359 return -EOPNOTSUPP; in nfp_fl_push_geneve_options()
362 opt_len -= sizeof(struct geneve_opt) + opt->length * 4; in nfp_fl_push_geneve_options()
363 src += sizeof(struct geneve_opt) + opt->length * 4; in nfp_fl_push_geneve_options()
368 return -EOPNOTSUPP; in nfp_fl_push_geneve_options()
379 opt_cnt--; in nfp_fl_push_geneve_options()
380 act_size = sizeof(struct nfp_fl_push_geneve) + opt->length * 4; in nfp_fl_push_geneve_options()
381 tot_push_len -= act_size; in nfp_fl_push_geneve_options()
384 push = (struct nfp_fl_push_geneve *)&nfp_fl->action_data[len]; in nfp_fl_push_geneve_options()
385 push->head.jump_id = NFP_FL_ACTION_OPCODE_PUSH_GENEVE; in nfp_fl_push_geneve_options()
386 push->head.len_lw = act_size >> NFP_FL_LW_SIZ; in nfp_fl_push_geneve_options()
387 push->reserved = 0; in nfp_fl_push_geneve_options()
388 push->class = opt->opt_class; in nfp_fl_push_geneve_options()
389 push->type = opt->type; in nfp_fl_push_geneve_options()
390 push->length = opt->length; in nfp_fl_push_geneve_options()
391 memcpy(&push->opt_data, opt->opt_data, opt->length * 4); in nfp_fl_push_geneve_options()
393 src += sizeof(struct geneve_opt) + opt->length * 4; in nfp_fl_push_geneve_options()
417 const struct ip_tunnel_info *ip_tun = act->tunnel; in nfp_fl_set_tun()
420 struct nfp_flower_priv *priv = app->priv; in nfp_fl_set_tun()
422 /* Currently support one pre-tunnel so index is always 0. */ in nfp_fl_set_tun()
427 return -EOPNOTSUPP; in nfp_fl_set_tun()
429 if (ipv6 && !(priv->flower_ext_feats & NFP_FL_FEATS_IPV6_TUN)) in nfp_fl_set_tun()
430 return -EOPNOTSUPP; in nfp_fl_set_tun()
436 if (ip_tun->options_len && in nfp_fl_set_tun()
438 !(priv->flower_ext_feats & NFP_FL_FEATS_GENEVE_OPT))) { in nfp_fl_set_tun()
440 return -EOPNOTSUPP; in nfp_fl_set_tun()
443 tun_flags = ip_tunnel_flags_to_be16(ip_tun->key.tun_flags); in nfp_fl_set_tun()
444 if (!ip_tunnel_flags_is_be16_compat(ip_tun->key.tun_flags) || in nfp_fl_set_tun()
448 return -EOPNOTSUPP; in nfp_fl_set_tun()
451 set_tun->head.jump_id = NFP_FL_ACTION_OPCODE_SET_TUNNEL; in nfp_fl_set_tun()
452 set_tun->head.len_lw = act_size >> NFP_FL_LW_SIZ; in nfp_fl_set_tun()
454 /* Set tunnel type and pre-tunnel index. */ in nfp_fl_set_tun()
459 set_tun->tun_type_index = cpu_to_be32(tmp_set_ip_tun_type_index); in nfp_fl_set_tun()
461 set_tun->tun_id = ip_tun->key.tun_id; in nfp_fl_set_tun()
463 if (ip_tun->key.ttl) { in nfp_fl_set_tun()
464 set_tun->ttl = ip_tun->key.ttl; in nfp_fl_set_tun()
471 flow.daddr = ip_tun->key.u.ipv6.dst; in nfp_fl_set_tun()
473 dst = ipv6_stub->ipv6_dst_lookup_flow(net, NULL, &flow, NULL); in nfp_fl_set_tun()
475 set_tun->ttl = ip6_dst_hoplimit(dst); in nfp_fl_set_tun()
478 set_tun->ttl = READ_ONCE(net->ipv6.devconf_all->hop_limit); in nfp_fl_set_tun()
487 /* Do a route lookup to determine ttl - if fails then use in nfp_fl_set_tun()
491 flow.daddr = ip_tun->key.u.ipv4.dst; in nfp_fl_set_tun()
496 set_tun->ttl = ip4_dst_hoplimit(&rt->dst); in nfp_fl_set_tun()
499 set_tun->ttl = READ_ONCE(net->ipv4.sysctl_ip_default_ttl); in nfp_fl_set_tun()
503 set_tun->tos = ip_tun->key.tos; in nfp_fl_set_tun()
504 set_tun->tun_flags = tun_flags; in nfp_fl_set_tun()
507 set_tun->tun_proto = htons(ETH_P_TEB); in nfp_fl_set_tun()
508 set_tun->tun_len = ip_tun->options_len / 4; in nfp_fl_set_tun()
513 pre_tun->flags |= cpu_to_be16(NFP_FL_PRE_TUN_IPV6); in nfp_fl_set_tun()
514 pre_tun->ipv6_dst = ip_tun->key.u.ipv6.dst; in nfp_fl_set_tun()
516 pre_tun->ipv4_dst = ip_tun->key.u.ipv4.dst; in nfp_fl_set_tun()
542 return -EOPNOTSUPP; in nfp_fl_set_eth()
545 mask = ~act->mangle.mask; in nfp_fl_set_eth()
546 exact = act->mangle.val; in nfp_fl_set_eth()
550 return -EOPNOTSUPP; in nfp_fl_set_eth()
553 nfp_fl_set_helper32(exact, mask, &set_eth->eth_addr_val[off], in nfp_fl_set_eth()
554 &set_eth->eth_addr_mask[off]); in nfp_fl_set_eth()
556 set_eth->reserved = cpu_to_be16(0); in nfp_fl_set_eth()
557 set_eth->head.jump_id = NFP_FL_ACTION_OPCODE_SET_ETHERNET; in nfp_fl_set_eth()
558 set_eth->head.len_lw = sizeof(*set_eth) >> NFP_FL_LW_SIZ; in nfp_fl_set_eth()
582 mask = (__force __be32)~act->mangle.mask; in nfp_fl_set_ip4()
583 exact = (__force __be32)act->mangle.val; in nfp_fl_set_ip4()
587 return -EOPNOTSUPP; in nfp_fl_set_ip4()
592 set_ip_addr->ipv4_dst_mask |= mask; in nfp_fl_set_ip4()
593 set_ip_addr->ipv4_dst &= ~mask; in nfp_fl_set_ip4()
594 set_ip_addr->ipv4_dst |= exact & mask; in nfp_fl_set_ip4()
595 set_ip_addr->head.jump_id = NFP_FL_ACTION_OPCODE_SET_IPV4_ADDRS; in nfp_fl_set_ip4()
596 set_ip_addr->head.len_lw = sizeof(*set_ip_addr) >> in nfp_fl_set_ip4()
600 set_ip_addr->ipv4_src_mask |= mask; in nfp_fl_set_ip4()
601 set_ip_addr->ipv4_src &= ~mask; in nfp_fl_set_ip4()
602 set_ip_addr->ipv4_src |= exact & mask; in nfp_fl_set_ip4()
603 set_ip_addr->head.jump_id = NFP_FL_ACTION_OPCODE_SET_IPV4_ADDRS; in nfp_fl_set_ip4()
604 set_ip_addr->head.len_lw = sizeof(*set_ip_addr) >> in nfp_fl_set_ip4()
611 if (ttl_word_mask->protocol || ttl_word_mask->check) { in nfp_fl_set_ip4()
613 return -EOPNOTSUPP; in nfp_fl_set_ip4()
616 set_ip_ttl_tos->ipv4_ttl_mask |= ttl_word_mask->ttl; in nfp_fl_set_ip4()
617 set_ip_ttl_tos->ipv4_ttl &= ~ttl_word_mask->ttl; in nfp_fl_set_ip4()
618 set_ip_ttl_tos->ipv4_ttl |= ttl_word->ttl & ttl_word_mask->ttl; in nfp_fl_set_ip4()
619 set_ip_ttl_tos->head.jump_id = in nfp_fl_set_ip4()
621 set_ip_ttl_tos->head.len_lw = sizeof(*set_ip_ttl_tos) >> in nfp_fl_set_ip4()
628 if (tos_word_mask->version || tos_word_mask->ihl || in nfp_fl_set_ip4()
629 tos_word_mask->tot_len) { in nfp_fl_set_ip4()
631 return -EOPNOTSUPP; in nfp_fl_set_ip4()
634 set_ip_ttl_tos->ipv4_tos_mask |= tos_word_mask->tos; in nfp_fl_set_ip4()
635 set_ip_ttl_tos->ipv4_tos &= ~tos_word_mask->tos; in nfp_fl_set_ip4()
636 set_ip_ttl_tos->ipv4_tos |= tos_word->tos & tos_word_mask->tos; in nfp_fl_set_ip4()
637 set_ip_ttl_tos->head.jump_id = in nfp_fl_set_ip4()
639 set_ip_ttl_tos->head.len_lw = sizeof(*set_ip_ttl_tos) >> in nfp_fl_set_ip4()
644 return -EOPNOTSUPP; in nfp_fl_set_ip4()
654 ip6->ipv6[word].mask |= mask; in nfp_fl_set_ip6_helper()
655 ip6->ipv6[word].exact &= ~mask; in nfp_fl_set_ip6_helper()
656 ip6->ipv6[word].exact |= exact & mask; in nfp_fl_set_ip6_helper()
658 ip6->reserved = cpu_to_be16(0); in nfp_fl_set_ip6_helper()
659 ip6->head.jump_id = opcode_tag; in nfp_fl_set_ip6_helper()
660 ip6->head.len_lw = sizeof(*ip6) >> NFP_FL_LW_SIZ; in nfp_fl_set_ip6_helper()
682 if (fl_hl_mask->nexthdr || fl_hl_mask->payload_len) { in nfp_fl_set_ip6_hop_limit_flow_label()
684 return -EOPNOTSUPP; in nfp_fl_set_ip6_hop_limit_flow_label()
687 ip_hl_fl->ipv6_hop_limit_mask |= fl_hl_mask->hop_limit; in nfp_fl_set_ip6_hop_limit_flow_label()
688 ip_hl_fl->ipv6_hop_limit &= ~fl_hl_mask->hop_limit; in nfp_fl_set_ip6_hop_limit_flow_label()
689 ip_hl_fl->ipv6_hop_limit |= fl_hl->hop_limit & in nfp_fl_set_ip6_hop_limit_flow_label()
690 fl_hl_mask->hop_limit; in nfp_fl_set_ip6_hop_limit_flow_label()
696 return -EOPNOTSUPP; in nfp_fl_set_ip6_hop_limit_flow_label()
699 ip_hl_fl->ipv6_label_mask |= mask; in nfp_fl_set_ip6_hop_limit_flow_label()
700 ip_hl_fl->ipv6_label &= ~mask; in nfp_fl_set_ip6_hop_limit_flow_label()
701 ip_hl_fl->ipv6_label |= exact & mask; in nfp_fl_set_ip6_hop_limit_flow_label()
705 ip_hl_fl->head.jump_id = NFP_FL_ACTION_OPCODE_SET_IPV6_TC_HL_FL; in nfp_fl_set_ip6_hop_limit_flow_label()
706 ip_hl_fl->head.len_lw = sizeof(*ip_hl_fl) >> NFP_FL_LW_SIZ; in nfp_fl_set_ip6_hop_limit_flow_label()
723 mask = (__force __be32)~act->mangle.mask; in nfp_fl_set_ip6()
724 exact = (__force __be32)act->mangle.val; in nfp_fl_set_ip6()
728 return -EOPNOTSUPP; in nfp_fl_set_ip6()
735 word = (off - offsetof(struct ipv6hdr, saddr)) / sizeof(exact); in nfp_fl_set_ip6()
740 word = (off - offsetof(struct ipv6hdr, daddr)) / sizeof(exact); in nfp_fl_set_ip6()
745 return -EOPNOTSUPP; in nfp_fl_set_ip6()
760 return -EOPNOTSUPP; in nfp_fl_set_tport()
763 mask = ~act->mangle.mask; in nfp_fl_set_tport()
764 exact = act->mangle.val; in nfp_fl_set_tport()
768 return -EOPNOTSUPP; in nfp_fl_set_tport()
771 nfp_fl_set_helper32(exact, mask, set_tport->tp_port_val, in nfp_fl_set_tport()
772 set_tport->tp_port_mask); in nfp_fl_set_tport()
774 set_tport->reserved = cpu_to_be16(0); in nfp_fl_set_tport()
775 set_tport->head.jump_id = opcode; in nfp_fl_set_tport()
776 set_tport->head.len_lw = sizeof(*set_tport) >> NFP_FL_LW_SIZ; in nfp_fl_set_tport()
820 ip_proto = match.key->ip_proto; in nfp_fl_commit_mangle()
823 if (set_act->set_eth.head.len_lw) { in nfp_fl_commit_mangle()
824 act_size = sizeof(set_act->set_eth); in nfp_fl_commit_mangle()
825 memcpy(nfp_action, &set_act->set_eth, act_size); in nfp_fl_commit_mangle()
829 if (set_act->set_ip_ttl_tos.head.len_lw) { in nfp_fl_commit_mangle()
831 act_size = sizeof(set_act->set_ip_ttl_tos); in nfp_fl_commit_mangle()
832 memcpy(nfp_action, &set_act->set_ip_ttl_tos, act_size); in nfp_fl_commit_mangle()
840 if (set_act->set_ip_addr.head.len_lw) { in nfp_fl_commit_mangle()
842 act_size = sizeof(set_act->set_ip_addr); in nfp_fl_commit_mangle()
843 memcpy(nfp_action, &set_act->set_ip_addr, act_size); in nfp_fl_commit_mangle()
851 if (set_act->set_ip6_tc_hl_fl.head.len_lw) { in nfp_fl_commit_mangle()
853 act_size = sizeof(set_act->set_ip6_tc_hl_fl); in nfp_fl_commit_mangle()
854 memcpy(nfp_action, &set_act->set_ip6_tc_hl_fl, act_size); in nfp_fl_commit_mangle()
861 if (set_act->set_ip6_dst.head.len_lw && in nfp_fl_commit_mangle()
862 set_act->set_ip6_src.head.len_lw) { in nfp_fl_commit_mangle()
867 act_size = sizeof(set_act->set_ip6_src); in nfp_fl_commit_mangle()
868 memcpy(nfp_action, &set_act->set_ip6_src, act_size); in nfp_fl_commit_mangle()
871 act_size = sizeof(set_act->set_ip6_dst); in nfp_fl_commit_mangle()
872 memcpy(&nfp_action[sizeof(set_act->set_ip6_src)], in nfp_fl_commit_mangle()
873 &set_act->set_ip6_dst, act_size); in nfp_fl_commit_mangle()
878 } else if (set_act->set_ip6_dst.head.len_lw) { in nfp_fl_commit_mangle()
880 act_size = sizeof(set_act->set_ip6_dst); in nfp_fl_commit_mangle()
881 memcpy(nfp_action, &set_act->set_ip6_dst, act_size); in nfp_fl_commit_mangle()
886 } else if (set_act->set_ip6_src.head.len_lw) { in nfp_fl_commit_mangle()
888 act_size = sizeof(set_act->set_ip6_src); in nfp_fl_commit_mangle()
889 memcpy(nfp_action, &set_act->set_ip6_src, act_size); in nfp_fl_commit_mangle()
895 if (set_act->set_tport.head.len_lw) { in nfp_fl_commit_mangle()
897 act_size = sizeof(set_act->set_tport); in nfp_fl_commit_mangle()
898 memcpy(nfp_action, &set_act->set_tport, act_size); in nfp_fl_commit_mangle()
917 htype = act->mangle.htype; in nfp_fl_pedit()
918 offset = act->mangle.offset; in nfp_fl_pedit()
922 return nfp_fl_set_eth(act, offset, &set_act->set_eth, extack); in nfp_fl_pedit()
924 return nfp_fl_set_ip4(act, offset, &set_act->set_ip_addr, in nfp_fl_pedit()
925 &set_act->set_ip_ttl_tos, extack); in nfp_fl_pedit()
927 return nfp_fl_set_ip6(act, offset, &set_act->set_ip6_dst, in nfp_fl_pedit()
928 &set_act->set_ip6_src, in nfp_fl_pedit()
929 &set_act->set_ip6_tc_hl_fl, extack); in nfp_fl_pedit()
931 return nfp_fl_set_tport(act, offset, &set_act->set_tport, in nfp_fl_pedit()
934 return nfp_fl_set_tport(act, offset, &set_act->set_tport, in nfp_fl_pedit()
938 return -EOPNOTSUPP; in nfp_fl_pedit()
951 meter_act->head.jump_id = NFP_FL_ACTION_OPCODE_METER; in nfp_fl_meter()
952 meter_act->head.len_lw = act_size >> NFP_FL_LW_SIZ; in nfp_fl_meter()
970 return -EOPNOTSUPP; in nfp_flower_meter_action()
973 meter_id = action->hw_index; in nfp_flower_meter_action()
977 return -EOPNOTSUPP; in nfp_flower_meter_action()
980 fl_meter = nfp_fl_meter(&nfp_fl->action_data[*a_len]); in nfp_flower_meter_action()
982 fl_meter->meter_id = cpu_to_be32(meter_id); in nfp_flower_meter_action()
996 struct nfp_flower_priv *priv = app->priv; in nfp_flower_output_action()
1005 return -EOPNOTSUPP; in nfp_flower_output_action()
1010 return -EOPNOTSUPP; in nfp_flower_output_action()
1013 output = (struct nfp_fl_output *)&nfp_fl->action_data[*a_len]; in nfp_flower_output_action()
1021 if (priv->flower_en_feats & NFP_FL_ENABLE_LAG) { in nfp_flower_output_action()
1022 /* nfp_fl_pre_lag returns -err or size of prelag action added. in nfp_flower_output_action()
1030 return -EOPNOTSUPP; in nfp_flower_output_action()
1050 struct nfp_flower_priv *fl_priv = app->priv; in nfp_flower_loop_action()
1060 switch (act->id) { in nfp_flower_loop_action()
1062 nfp_fl->meta.shortcut = cpu_to_be32(NFP_FL_SC_ACT_DROP); in nfp_flower_loop_action()
1086 return -EOPNOTSUPP; in nfp_flower_loop_action()
1089 pop_v = (struct nfp_fl_pop_vlan *)&nfp_fl->action_data[*a_len]; in nfp_flower_loop_action()
1090 nfp_fl->meta.shortcut = cpu_to_be32(NFP_FL_SC_ACT_POPV); in nfp_flower_loop_action()
1099 return -EOPNOTSUPP; in nfp_flower_loop_action()
1102 psh_v = (struct nfp_fl_push_vlan *)&nfp_fl->action_data[*a_len]; in nfp_flower_loop_action()
1103 nfp_fl->meta.shortcut = cpu_to_be32(NFP_FL_SC_ACT_NULL); in nfp_flower_loop_action()
1109 const struct ip_tunnel_info *ip_tun = act->tunnel; in nfp_flower_loop_action()
1114 return -EOPNOTSUPP; in nfp_flower_loop_action()
1117 if (ip_tun->mode & ~NFP_FL_SUPPORTED_TUNNEL_INFO_FLAGS) { in nfp_flower_loop_action()
1119 return -EOPNOTSUPP; in nfp_flower_loop_action()
1122 /* Pre-tunnel action is required for tunnel encap. in nfp_flower_loop_action()
1129 return -EOPNOTSUPP; in nfp_flower_loop_action()
1132 pre_tun = nfp_fl_pre_tunnel(nfp_fl->action_data, *a_len); in nfp_flower_loop_action()
1133 nfp_fl->meta.shortcut = cpu_to_be32(NFP_FL_SC_ACT_NULL); in nfp_flower_loop_action()
1140 set_tun = (void *)&nfp_fl->action_data[*a_len]; in nfp_flower_loop_action()
1152 if (nfp_fl_pedit(act, &nfp_fl->action_data[*a_len], in nfp_flower_loop_action()
1154 return -EOPNOTSUPP; in nfp_flower_loop_action()
1158 if (act->csum_flags & ~*csum_updated) { in nfp_flower_loop_action()
1160 return -EOPNOTSUPP; in nfp_flower_loop_action()
1165 *csum_updated &= ~act->csum_flags; in nfp_flower_loop_action()
1171 return -EOPNOTSUPP; in nfp_flower_loop_action()
1174 psh_m = (struct nfp_fl_push_mpls *)&nfp_fl->action_data[*a_len]; in nfp_flower_loop_action()
1175 nfp_fl->meta.shortcut = cpu_to_be32(NFP_FL_SC_ACT_NULL); in nfp_flower_loop_action()
1186 return -EOPNOTSUPP; in nfp_flower_loop_action()
1189 pop_m = (struct nfp_fl_pop_mpls *)&nfp_fl->action_data[*a_len]; in nfp_flower_loop_action()
1190 nfp_fl->meta.shortcut = cpu_to_be32(NFP_FL_SC_ACT_NULL); in nfp_flower_loop_action()
1199 return -EOPNOTSUPP; in nfp_flower_loop_action()
1202 set_m = (struct nfp_fl_set_mpls *)&nfp_fl->action_data[*a_len]; in nfp_flower_loop_action()
1203 nfp_fl->meta.shortcut = cpu_to_be32(NFP_FL_SC_ACT_NULL); in nfp_flower_loop_action()
1210 if (act->ptype != PACKET_HOST) in nfp_flower_loop_action()
1211 return -EOPNOTSUPP; in nfp_flower_loop_action()
1216 if (!(fl_priv->flower_ext_feats & NFP_FL_FEATS_QOS_METER)) { in nfp_flower_loop_action()
1219 return -EOPNOTSUPP; in nfp_flower_loop_action()
1230 return -EOPNOTSUPP; in nfp_flower_loop_action()
1242 current_act = flow_act->entries[current_act_idx]; in nfp_fl_check_mangle_start()
1249 prev_act = flow_act->entries[current_act_idx - 1]; in nfp_fl_check_mangle_start()
1260 current_act = flow_act->entries[current_act_idx]; in nfp_fl_check_mangle_end()
1264 if (current_act_idx == flow_act->num_entries) in nfp_fl_check_mangle_end()
1267 next_act = flow_act->entries[current_act_idx + 1]; in nfp_fl_check_mangle_end()
1285 if (!flow_action_hw_stats_check(&rule->action, extack, in nfp_flower_compile_action()
1287 return -EOPNOTSUPP; in nfp_flower_compile_action()
1289 memset(nfp_flow->action_data, 0, NFP_FL_MAX_A_SIZ); in nfp_flower_compile_action()
1290 nfp_flow->meta.act_len = 0; in nfp_flower_compile_action()
1297 flow_action_for_each(i, act, &rule->action) { in nfp_flower_compile_action()
1298 if (nfp_fl_check_mangle_start(&rule->action, i)) in nfp_flower_compile_action()
1307 if (nfp_fl_check_mangle_end(&rule->action, i)) in nfp_flower_compile_action()
1309 &nfp_flow->action_data[act_len], in nfp_flower_compile_action()
1317 nfp_flow->meta.shortcut = cpu_to_be32(NFP_FL_SC_ACT_NULL); in nfp_flower_compile_action()
1319 nfp_flow->meta.act_len = act_len; in nfp_flower_compile_action()