net/mlx5: support mark flow action
[dpdk.git] / drivers / net / mlx5 / mlx5_rxtx.c
index a0092b1..d8fc7ed 100644 (file)
@@ -84,7 +84,7 @@ static inline int
 check_cqe_seen(volatile struct mlx5_cqe *cqe)
 {
        static const uint8_t magic[] = "seen";
-       volatile uint8_t (*buf)[sizeof(cqe->rsvd3)] = &cqe->rsvd3;
+       volatile uint8_t (*buf)[sizeof(cqe->rsvd0)] = &cqe->rsvd0;
        int ret = 1;
        unsigned int i;
 
@@ -1342,6 +1342,16 @@ 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_RSS_HASH;
+                               pkt->ol_flags |= PKT_RX_FDIR | PKT_RX_FDIR_ID;
+                       }
                        if (rxq->csum | rxq->csum_l2tun | rxq->vlan_strip |
                            rxq->crc_present) {
                                if (rxq->csum) {