struct port_indirect_action *pia;
int ret;
struct rte_flow_error error;
+ struct rte_port *port;
+
+ if (port_id_is_invalid(port_id, ENABLED_WARN) ||
+ port_id == (portid_t)RTE_PORT_ALL)
+ return -EINVAL;
ret = action_alloc(port_id, id, &pia);
if (ret)
return ret;
+
+ port = &ports[port_id];
+
+ if (conf->transfer)
+ port_id = port->flow_transfer_proxy;
+
+ if (port_id_is_invalid(port_id, ENABLED_WARN) ||
+ port_id == (portid_t)RTE_PORT_ALL)
+ return -EINVAL;
+
if (action->type == RTE_FLOW_ACTION_TYPE_AGE) {
struct rte_flow_action_age *age =
(struct rte_flow_action_age *)(uintptr_t)(action->conf);
return port_flow_complain(&error);
}
pia->type = action->type;
+ pia->transfer = conf->transfer;
printf("Indirect action #%u created\n", pia->id);
return 0;
}
for (i = 0; i != n; ++i) {
struct rte_flow_error error;
struct port_indirect_action *pia = *tmp;
+ portid_t port_id_eff = port_id;
if (actions[i] != pia->id)
continue;
+
+ if (pia->transfer)
+ port_id_eff = port->flow_transfer_proxy;
+
+ if (port_id_is_invalid(port_id_eff, ENABLED_WARN) ||
+ port_id_eff == (portid_t)RTE_PORT_ALL)
+ return -EINVAL;
+
/*
* Poisoning to make sure PMDs update it in case
* of error.
memset(&error, 0x33, sizeof(error));
if (pia->handle && rte_flow_action_handle_destroy(
- port_id, pia->handle, &error)) {
+ port_id_eff, pia->handle, &error)) {
ret = port_flow_complain(&error);
continue;
}
struct rte_flow_error error;
struct rte_flow_action_handle *action_handle;
struct port_indirect_action *pia;
+ struct rte_port *port;
const void *update;
+ if (port_id_is_invalid(port_id, ENABLED_WARN) ||
+ port_id == (portid_t)RTE_PORT_ALL)
+ return -EINVAL;
+
+ port = &ports[port_id];
+
action_handle = port_action_handle_get_by_id(port_id, id);
if (!action_handle)
return -EINVAL;
update = action;
break;
}
+
+ if (pia->transfer)
+ port_id = port->flow_transfer_proxy;
+
+ if (port_id_is_invalid(port_id, ENABLED_WARN) ||
+ port_id == (portid_t)RTE_PORT_ALL)
+ return -EINVAL;
+
if (rte_flow_action_handle_update(port_id, action_handle, update,
&error)) {
return port_flow_complain(&error);
struct rte_flow_query_age age;
struct rte_flow_action_conntrack ct;
} query;
+ portid_t port_id_eff = port_id;
+ struct rte_port *port;
+
+ if (port_id_is_invalid(port_id, ENABLED_WARN) ||
+ port_id == (portid_t)RTE_PORT_ALL)
+ return -EINVAL;
+
+ port = &ports[port_id];
pia = action_get_by_id(port_id, id);
if (!pia)
id, pia->type, port_id);
return -ENOTSUP;
}
+
+ if (pia->transfer)
+ port_id_eff = port->flow_transfer_proxy;
+
+ if (port_id_is_invalid(port_id_eff, ENABLED_WARN) ||
+ port_id_eff == (portid_t)RTE_PORT_ALL)
+ return -EINVAL;
+
/* Poisoning to make sure PMDs update it in case of error. */
memset(&error, 0x55, sizeof(error));
memset(&query, 0, sizeof(query));
- if (rte_flow_action_handle_query(port_id, pia->handle, &query, &error))
+ if (rte_flow_action_handle_query(port_id_eff, pia->handle, &query,
+ &error))
return port_flow_complain(&error);
switch (pia->type) {
case RTE_FLOW_ACTION_TYPE_AGE:
{
struct rte_flow_error error;
struct port_flow_tunnel *pft = NULL;
+ struct rte_port *port;
+
+ if (port_id_is_invalid(port_id, ENABLED_WARN) ||
+ port_id == (portid_t)RTE_PORT_ALL)
+ return -EINVAL;
+
+ port = &ports[port_id];
+
+ if (attr->transfer)
+ port_id = port->flow_transfer_proxy;
+
+ if (port_id_is_invalid(port_id, ENABLED_WARN) ||
+ port_id == (portid_t)RTE_PORT_ALL)
+ return -EINVAL;
/* Poisoning to make sure PMDs update it in case of error. */
memset(&error, 0x11, sizeof(error));
struct port_flow_tunnel *pft = NULL;
struct rte_flow_action_age *age = age_action_get(actions);
+ if (port_id_is_invalid(port_id, ENABLED_WARN) ||
+ port_id == (portid_t)RTE_PORT_ALL)
+ return -EINVAL;
+
port = &ports[port_id];
+
+ if (attr->transfer)
+ port_id = port->flow_transfer_proxy;
+
+ if (port_id_is_invalid(port_id, ENABLED_WARN) ||
+ port_id == (portid_t)RTE_PORT_ALL)
+ return -EINVAL;
+
if (port->flow_list) {
if (port->flow_list->id == UINT32_MAX) {
fprintf(stderr,
uint32_t i;
for (i = 0; i != n; ++i) {
+ portid_t port_id_eff = port_id;
struct rte_flow_error error;
struct port_flow *pf = *tmp;
* of error.
*/
memset(&error, 0x33, sizeof(error));
- if (rte_flow_destroy(port_id, pf->flow, &error)) {
+
+ if (pf->rule.attr->transfer)
+ port_id_eff = port->flow_transfer_proxy;
+
+ if (port_id_is_invalid(port_id_eff, ENABLED_WARN) ||
+ port_id_eff == (portid_t)RTE_PORT_ALL)
+ return -EINVAL;
+
+ if (rte_flow_destroy(port_id_eff, pf->flow, &error)) {
ret = port_flow_complain(&error);
continue;
}
fprintf(stderr, "Flow rule #%u not found\n", rule);
return -ENOENT;
}
+
+ if (pf->rule.attr->transfer)
+ port_id = port->flow_transfer_proxy;
+
+ if (port_id_is_invalid(port_id, ENABLED_WARN) ||
+ port_id == (portid_t)RTE_PORT_ALL)
+ return -EINVAL;
+
ret = rte_flow_conv(RTE_FLOW_CONV_OP_ACTION_NAME_PTR,
&name, sizeof(name),
(void *)(uintptr_t)action->type, &error);
*
* The application should match traffic originating from precise
* locations. See items PORT_REPRESENTOR and REPRESENTED_PORT.
+ *
+ * Managing "transfer" flows requires that the user communicate them
+ * through a suitable port. @see rte_flow_pick_transfer_proxy().
*/
uint32_t transfer:1;
uint32_t reserved:29; /**< Reserved, must be zero. */
struct rte_flow_item *items,
uint32_t num_of_items,
struct rte_flow_error *error);
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Get a proxy port to manage "transfer" flows.
+ *
+ * Managing "transfer" flows requires that the user communicate them
+ * via a port which has the privilege to control the embedded switch.
+ * For some vendors, all ports in a given switching domain have
+ * this privilege. For other vendors, it's only one port.
+ *
+ * This API indicates such a privileged port (a "proxy")
+ * for a given port in the same switching domain.
+ *
+ * @note
+ * If the PMD serving @p port_id doesn't have the corresponding method
+ * implemented, the API will return @p port_id via @p proxy_port_id.
+ *
+ * @param port_id
+ * Indicates the port to get a "proxy" for
+ * @param[out] proxy_port_id
+ * Indicates the "proxy" port
+ * @param[out] error
+ * If not NULL, allows the PMD to provide verbose report in case of error
+ *
+ * @return
+ * 0 on success, a negative error code otherwise
+ */
+__rte_experimental
+int
+rte_flow_pick_transfer_proxy(uint16_t port_id, uint16_t *proxy_port_id,
+ struct rte_flow_error *error);
#ifdef __cplusplus
}
#endif