From: NĂ©lio Laranjeiro Date: Wed, 1 Mar 2017 12:49:45 +0000 (+0100) Subject: net/mlx5: support flag flow action X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=b268a3ee3c46833bd692aded0789b35e8d2d1a14;p=dpdk.git 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 --- diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index a885f6e9b1..39a96eaf11 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -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, diff --git a/drivers/net/mlx5/mlx5_prm.h b/drivers/net/mlx5/mlx5_prm.h index 755b5d7797..3318668e78 100644 --- a/drivers/net/mlx5/mlx5_prm.h +++ b/drivers/net/mlx5/mlx5_prm.h @@ -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; } diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c index fc75e6fa52..8399a91443 100644 --- a/drivers/net/mlx5/mlx5_rxtx.c +++ b/drivers/net/mlx5/mlx5_rxtx.c @@ -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) {