| 1087 | } |
| 1088 | |
| 1089 | static int |
| 1090 | action_check(struct table_rule_action *action, |
| 1091 | struct pipeline *p, |
| 1092 | uint32_t table_id) |
| 1093 | { |
| 1094 | struct table_action_profile *ap; |
| 1095 | |
| 1096 | if ((action == NULL) || |
| 1097 | (p == NULL) || |
| 1098 | (table_id >= p->n_tables)) |
| 1099 | return -1; |
| 1100 | |
| 1101 | ap = p->table[table_id].ap; |
| 1102 | if (action->action_mask != ap->params.action_mask) |
| 1103 | return -1; |
| 1104 | |
| 1105 | if (action->action_mask & (1LLU << RTE_TABLE_ACTION_FWD)) { |
| 1106 | if ((action->fwd.action == RTE_PIPELINE_ACTION_PORT) && |
| 1107 | (action->fwd.id >= p->n_ports_out)) |
| 1108 | return -1; |
| 1109 | |
| 1110 | if ((action->fwd.action == RTE_PIPELINE_ACTION_TABLE) && |
| 1111 | (action->fwd.id >= p->n_tables)) |
| 1112 | return -1; |
| 1113 | } |
| 1114 | |
| 1115 | if (action->action_mask & (1LLU << RTE_TABLE_ACTION_MTR)) { |
| 1116 | uint32_t tc_mask0 = (1 << ap->params.mtr.n_tc) - 1; |
| 1117 | uint32_t tc_mask1 = action->mtr.tc_mask; |
| 1118 | |
| 1119 | if (tc_mask1 != tc_mask0) |
| 1120 | return -1; |
| 1121 | } |
| 1122 | |
| 1123 | if (action->action_mask & (1LLU << RTE_TABLE_ACTION_TM)) { |
| 1124 | uint32_t n_subports_per_port = |
| 1125 | ap->params.tm.n_subports_per_port; |
| 1126 | uint32_t n_pipes_per_subport = |
| 1127 | ap->params.tm.n_pipes_per_subport; |
| 1128 | uint32_t subport_id = action->tm.subport_id; |
| 1129 | uint32_t pipe_id = action->tm.pipe_id; |
| 1130 | |
| 1131 | if ((subport_id >= n_subports_per_port) || |
| 1132 | (pipe_id >= n_pipes_per_subport)) |
| 1133 | return -1; |
| 1134 | } |
| 1135 | |
| 1136 | if (action->action_mask & (1LLU << RTE_TABLE_ACTION_ENCAP)) { |
| 1137 | uint64_t encap_mask = ap->params.encap.encap_mask; |
| 1138 | enum rte_table_action_encap_type type = action->encap.type; |
| 1139 | |
| 1140 | if ((encap_mask & (1LLU << type)) == 0) |
| 1141 | return -1; |
| 1142 | } |
| 1143 | |
| 1144 | if (action->action_mask & (1LLU << RTE_TABLE_ACTION_NAT)) { |
| 1145 | int ip_version0 = ap->params.common.ip_version; |
| 1146 | int ip_version1 = action->nat.ip_version; |
no outgoing calls
no test coverage detected