net/mlx5: support flag flow action

This action is not terminal in this PMD, it must be followed by a queue
action.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
This commit is contained in:
Nélio Laranjeiro 2017-03-01 13:49:45 +01:00 committed by Ferruh Yigit
parent 63e5f0e751
commit b268a3ee3c
3 changed files with 20 additions and 11 deletions

View File

@ -146,6 +146,7 @@ static const enum rte_flow_action_type valid_actions[] = {
RTE_FLOW_ACTION_TYPE_DROP,
RTE_FLOW_ACTION_TYPE_QUEUE,
RTE_FLOW_ACTION_TYPE_MARK,
RTE_FLOW_ACTION_TYPE_FLAG,
RTE_FLOW_ACTION_TYPE_END,
};
@ -476,6 +477,8 @@ priv_flow_validate(struct priv *priv,
return -rte_errno;
}
action.mark = 1;
} else if (actions->type == RTE_FLOW_ACTION_TYPE_FLAG) {
action.mark = 1;
} else {
goto exit_action_not_supported;
}
@ -1061,6 +1064,8 @@ priv_flow_create(struct priv *priv,
if (mark)
action.mark_id = mark->id;
action.mark = !action.drop;
} else if (actions->type == RTE_FLOW_ACTION_TYPE_FLAG) {
action.mark = 1;
} else {
rte_flow_error_set(error, ENOTSUP,
RTE_FLOW_ERROR_TYPE_ACTION,

View File

@ -227,9 +227,11 @@ mlx5_flow_mark_set(uint32_t val)
/*
* Add one to the user value to differentiate un-marked flows from
* marked flows.
* marked flows, if the ID is equal to MLX5_FLOW_MARK_DEFAULT it
* remains untouched.
*/
++val;
if (val != MLX5_FLOW_MARK_DEFAULT)
++val;
#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
/*
* Mark is 24 bits (minus reserved values) but is stored on a 32 bit
@ -241,7 +243,6 @@ mlx5_flow_mark_set(uint32_t val)
#else
ret = val;
#endif
assert(ret <= MLX5_FLOW_MARK_MAX);
return ret;
}

View File

@ -1505,14 +1505,17 @@ mlx5_rx_burst(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n)
pkt->hash.rss = rss_hash_res;
pkt->ol_flags = PKT_RX_RSS_HASH;
}
if (rxq->mark &&
((cqe->sop_drop_qpn !=
htonl(MLX5_FLOW_MARK_INVALID)) &&
(cqe->sop_drop_qpn !=
htonl(MLX5_FLOW_MARK_DEFAULT)))) {
pkt->hash.fdir.hi =
mlx5_flow_mark_get(cqe->sop_drop_qpn);
pkt->ol_flags |= PKT_RX_FDIR | PKT_RX_FDIR_ID;
if (rxq->mark && (cqe->sop_drop_qpn !=
htonl(MLX5_FLOW_MARK_INVALID))) {
pkt->ol_flags |= PKT_RX_FDIR;
if (cqe->sop_drop_qpn !=
htonl(MLX5_FLOW_MARK_DEFAULT)) {
uint32_t mark = cqe->sop_drop_qpn;
pkt->ol_flags |= PKT_RX_FDIR_ID;
pkt->hash.fdir.hi =
mlx5_flow_mark_get(mark);
}
}
if (rxq->csum | rxq->csum_l2tun | rxq->vlan_strip |
rxq->crc_present) {