Enqueue indirect action update operation. */
| 3112 | |
| 3113 | /** Enqueue indirect action update operation. */ |
| 3114 | int |
| 3115 | port_queue_action_handle_update(portid_t port_id, |
| 3116 | uint32_t queue_id, bool postpone, uint32_t id, |
| 3117 | const struct rte_flow_action *action) |
| 3118 | { |
| 3119 | const struct rte_flow_op_attr attr = { .postpone = postpone}; |
| 3120 | struct rte_port *port; |
| 3121 | struct rte_flow_error error; |
| 3122 | struct rte_flow_action_handle *action_handle; |
| 3123 | struct queue_job *job; |
| 3124 | struct port_indirect_action *pia; |
| 3125 | struct rte_flow_update_meter_mark mtr_update; |
| 3126 | const void *update; |
| 3127 | |
| 3128 | action_handle = port_action_handle_get_by_id(port_id, id); |
| 3129 | if (!action_handle) |
| 3130 | return -EINVAL; |
| 3131 | |
| 3132 | port = &ports[port_id]; |
| 3133 | if (queue_id >= port->queue_nb) { |
| 3134 | printf("Queue #%u is invalid\n", queue_id); |
| 3135 | return -EINVAL; |
| 3136 | } |
| 3137 | |
| 3138 | job = calloc(1, sizeof(*job)); |
| 3139 | if (!job) { |
| 3140 | printf("Queue action update job allocate failed\n"); |
| 3141 | return -ENOMEM; |
| 3142 | } |
| 3143 | job->type = QUEUE_JOB_TYPE_ACTION_UPDATE; |
| 3144 | |
| 3145 | pia = action_get_by_id(port_id, id); |
| 3146 | if (!pia) { |
| 3147 | free(job); |
| 3148 | return -EINVAL; |
| 3149 | } |
| 3150 | |
| 3151 | switch (pia->type) { |
| 3152 | case RTE_FLOW_ACTION_TYPE_AGE: |
| 3153 | update = action->conf; |
| 3154 | break; |
| 3155 | case RTE_FLOW_ACTION_TYPE_METER_MARK: |
| 3156 | rte_memcpy(&mtr_update.meter_mark, action->conf, |
| 3157 | sizeof(struct rte_flow_action_meter_mark)); |
| 3158 | if (mtr_update.meter_mark.profile) |
| 3159 | mtr_update.profile_valid = 1; |
| 3160 | if (mtr_update.meter_mark.policy) |
| 3161 | mtr_update.policy_valid = 1; |
| 3162 | mtr_update.color_mode_valid = 1; |
| 3163 | mtr_update.state_valid = 1; |
| 3164 | update = &mtr_update; |
| 3165 | break; |
| 3166 | default: |
| 3167 | update = action; |
| 3168 | break; |
| 3169 | } |
| 3170 | |
| 3171 | if (rte_flow_async_action_handle_update(port_id, queue_id, &attr, |
no test coverage detected