* Validate a flow supported by TC. * If flow param is not NULL, then also fill the netlink message inside. * * @param pmd * Pointer to private structure. * @param[in] attr * Flow rule attributes. * @param[in] pattern * Pattern specification (list terminated by the END pattern item). * @param[in] actions * Associated actions (list terminated by the END action). * @param[out] erro
| 1026 | * 0 on success, a negative errno value otherwise and rte_errno is set. |
| 1027 | */ |
| 1028 | static int |
| 1029 | priv_flow_process(struct pmd_internals *pmd, |
| 1030 | const struct rte_flow_attr *attr, |
| 1031 | const struct rte_flow_item items[], |
| 1032 | const struct rte_flow_action actions[], |
| 1033 | struct rte_flow_error *error, |
| 1034 | struct rte_flow *flow, |
| 1035 | int mirred) |
| 1036 | { |
| 1037 | const struct tap_flow_items *cur_item = tap_flow_items; |
| 1038 | struct convert_data data = { |
| 1039 | .eth_type = 0, |
| 1040 | .ip_proto = 0, |
| 1041 | .flow = flow, |
| 1042 | }; |
| 1043 | int action = 0; /* Only one action authorized for now */ |
| 1044 | |
| 1045 | if (attr->transfer) { |
| 1046 | rte_flow_error_set( |
| 1047 | error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ATTR_TRANSFER, |
| 1048 | NULL, "transfer is not supported"); |
| 1049 | return -rte_errno; |
| 1050 | } |
| 1051 | if (attr->group > MAX_GROUP) { |
| 1052 | rte_flow_error_set( |
| 1053 | error, EINVAL, RTE_FLOW_ERROR_TYPE_ATTR_GROUP, |
| 1054 | NULL, "group value too big: cannot exceed 15"); |
| 1055 | return -rte_errno; |
| 1056 | } |
| 1057 | if (attr->priority > MAX_PRIORITY) { |
| 1058 | rte_flow_error_set( |
| 1059 | error, EINVAL, RTE_FLOW_ERROR_TYPE_ATTR_PRIORITY, |
| 1060 | NULL, "priority value too big"); |
| 1061 | return -rte_errno; |
| 1062 | } else if (flow) { |
| 1063 | uint16_t group = attr->group << GROUP_SHIFT; |
| 1064 | uint16_t prio = group | (attr->priority + |
| 1065 | RSS_PRIORITY_OFFSET + PRIORITY_OFFSET); |
| 1066 | flow->msg.t.tcm_info = TC_H_MAKE(prio << 16, |
| 1067 | flow->msg.t.tcm_info); |
| 1068 | } |
| 1069 | if (flow) { |
| 1070 | if (mirred) { |
| 1071 | /* |
| 1072 | * If attr->ingress, the rule applies on remote ingress |
| 1073 | * to match incoming packets |
| 1074 | * If attr->egress, the rule applies on tap ingress (as |
| 1075 | * seen from the kernel) to deal with packets going out |
| 1076 | * from the DPDK app. |
| 1077 | */ |
| 1078 | flow->msg.t.tcm_parent = TC_H_MAKE(TC_H_INGRESS, 0); |
| 1079 | } else { |
| 1080 | /* Standard rule on tap egress (kernel standpoint). */ |
| 1081 | flow->msg.t.tcm_parent = |
| 1082 | TC_H_MAKE(MULTIQ_MAJOR_HANDLE, 0); |
| 1083 | } |
| 1084 | /* use flower filter type */ |
| 1085 | tap_nlattr_add(&flow->msg.nh, TCA_KIND, sizeof("flower"), "flower"); |
no test coverage detected