DPDK patches and discussions
 help / color / mirror / Atom feed
From: Shahaf Shuler <shahafs@mellanox.com>
To: "Yongseok Koh" <yskoh@mellanox.com>,
	"Adrien Mazarguil" <adrien.mazarguil@6wind.com>,
	"Nélio Laranjeiro" <nelio.laranjeiro@6wind.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>, Yongseok Koh <yskoh@mellanox.com>
Subject: Re: [dpdk-dev] [PATCH 1/3] net/mlx5: separate filling Rx flags
Date: Mon, 7 May 2018 05:41:01 +0000	[thread overview]
Message-ID: <DB7PR05MB4426E91DB899AE9424E26278C39B0@DB7PR05MB4426.eurprd05.prod.outlook.com> (raw)
In-Reply-To: <20180502232054.7852-2-yskoh@mellanox.com>

Thursday, May 3, 2018 2:21 AM, Yongseok Koh:
> Subject: [dpdk-dev] [PATCH 1/3] net/mlx5: separate filling Rx flags
> 
> Filling in fields of mbuf becomes a separate inline function so that this can be
> reused.
> 
> Signed-off-by: Yongseok Koh <yskoh@mellanox.com>

Acked-by: Shahaf Shuler <shahafs@mellanox.com>

> ---
>  drivers/net/mlx5/mlx5_rxtx.c | 84 +++++++++++++++++++++++++++--------
> ---------
>  1 file changed, 51 insertions(+), 33 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c
> index 8a863c157..299408b31 100644
> --- a/drivers/net/mlx5/mlx5_rxtx.c
> +++ b/drivers/net/mlx5/mlx5_rxtx.c
> @@ -43,6 +43,10 @@ mlx5_rx_poll_len(struct mlx5_rxq_data *rxq, volatile
> struct mlx5_cqe *cqe,  static __rte_always_inline uint32_t
> rxq_cq_to_ol_flags(volatile struct mlx5_cqe *cqe);
> 
> +static __rte_always_inline void
> +rxq_cq_to_mbuf(struct mlx5_rxq_data *rxq, struct rte_mbuf *pkt,
> +	       volatile struct mlx5_cqe *cqe, uint32_t rss_hash_res);
> +
>  uint32_t mlx5_ptype_table[] __rte_cache_aligned = {
>  	[0xff] = RTE_PTYPE_ALL_MASK, /* Last entry for errored packet. */
> }; @@ -1841,6 +1845,52 @@ rxq_cq_to_ol_flags(volatile struct mlx5_cqe
> *cqe)  }
> 
>  /**
> + * Fill in mbuf fields from RX completion flags.
> + * Note that pkt->ol_flags should be initialized outside of this function.
> + *
> + * @param rxq
> + *   Pointer to RX queue.
> + * @param pkt
> + *   mbuf to fill.
> + * @param cqe
> + *   CQE to process.
> + * @param rss_hash_res
> + *   Packet RSS Hash result.
> + */
> +static inline void
> +rxq_cq_to_mbuf(struct mlx5_rxq_data *rxq, struct rte_mbuf *pkt,
> +	       volatile struct mlx5_cqe *cqe, uint32_t rss_hash_res) {
> +	/* Update packet information. */
> +	pkt->packet_type = rxq_cq_to_pkt_type(rxq, cqe);
> +	if (rss_hash_res && rxq->rss_hash) {
> +		pkt->hash.rss = rss_hash_res;
> +		pkt->ol_flags |= PKT_RX_RSS_HASH;
> +	}
> +	if (rxq->mark && MLX5_FLOW_MARK_IS_VALID(cqe-
> >sop_drop_qpn)) {
> +		pkt->ol_flags |= PKT_RX_FDIR;
> +		if (cqe->sop_drop_qpn !=
> +		    rte_cpu_to_be_32(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)
> +		pkt->ol_flags |= rxq_cq_to_ol_flags(cqe);
> +	if (rxq->vlan_strip &&
> +	    (cqe->hdr_type_etc &
> rte_cpu_to_be_16(MLX5_CQE_VLAN_STRIPPED))) {
> +		pkt->ol_flags |= PKT_RX_VLAN | PKT_RX_VLAN_STRIPPED;
> +		pkt->vlan_tci = rte_be_to_cpu_16(cqe->vlan_info);
> +	}
> +	if (rxq->hw_timestamp) {
> +		pkt->timestamp = rte_be_to_cpu_64(cqe->timestamp);
> +		pkt->ol_flags |= PKT_RX_TIMESTAMP;
> +	}
> +}
> +
> +/**
>   * DPDK callback for RX.
>   *
>   * @param dpdk_rxq
> @@ -1916,40 +1966,8 @@ mlx5_rx_burst(void *dpdk_rxq, struct rte_mbuf
> **pkts, uint16_t pkts_n)
>  			}
>  			pkt = seg;
>  			assert(len >= (rxq->crc_present << 2));
> -			/* Update packet information. */
> -			pkt->packet_type = rxq_cq_to_pkt_type(rxq, cqe);
>  			pkt->ol_flags = 0;
> -			if (rss_hash_res && rxq->rss_hash) {
> -				pkt->hash.rss = rss_hash_res;
> -				pkt->ol_flags = PKT_RX_RSS_HASH;
> -			}
> -			if (rxq->mark &&
> -			    MLX5_FLOW_MARK_IS_VALID(cqe-
> >sop_drop_qpn)) {
> -				pkt->ol_flags |= PKT_RX_FDIR;
> -				if (cqe->sop_drop_qpn !=
> -
> rte_cpu_to_be_32(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)
> -				pkt->ol_flags |= rxq_cq_to_ol_flags(cqe);
> -			if (rxq->vlan_strip &&
> -			    (cqe->hdr_type_etc &
> -			     rte_cpu_to_be_16(MLX5_CQE_VLAN_STRIPPED)))
> {
> -				pkt->ol_flags |= PKT_RX_VLAN |
> -					PKT_RX_VLAN_STRIPPED;
> -				pkt->vlan_tci =
> -					rte_be_to_cpu_16(cqe->vlan_info);
> -			}
> -			if (rxq->hw_timestamp) {
> -				pkt->timestamp =
> -					rte_be_to_cpu_64(cqe->timestamp);
> -				pkt->ol_flags |= PKT_RX_TIMESTAMP;
> -			}
> +			rxq_cq_to_mbuf(rxq, pkt, cqe, rss_hash_res);
>  			if (rxq->crc_present)
>  				len -= ETHER_CRC_LEN;
>  			PKT_LEN(pkt) = len;
> --
> 2.11.0

  reply	other threads:[~2018-05-07  5:41 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-02 23:20 [dpdk-dev] [PATCH 0/3] net/mlx5: add Multi-Packet Rx support Yongseok Koh
2018-05-02 23:20 ` [dpdk-dev] [PATCH 1/3] net/mlx5: separate filling Rx flags Yongseok Koh
2018-05-07  5:41   ` Shahaf Shuler [this message]
2018-05-02 23:20 ` [dpdk-dev] [PATCH 2/3] net/mlx5: add a function to rdma-core glue Yongseok Koh
2018-05-07  5:46   ` Shahaf Shuler
2018-05-02 23:20 ` [dpdk-dev] [PATCH 3/3] net/mlx5: add Multi-Packet Rx support Yongseok Koh
2018-05-07 10:49   ` Shahaf Shuler
2018-05-09 11:01     ` Yongseok Koh
2018-05-09 11:13 ` [dpdk-dev] [PATCH v2 0/3] " Yongseok Koh
2018-05-09 11:13   ` [dpdk-dev] [PATCH v2 1/3] net/mlx5: separate filling Rx flags Yongseok Koh
2018-05-09 11:13   ` [dpdk-dev] [PATCH v2 2/3] net/mlx5: add a function to rdma-core glue Yongseok Koh
2018-05-09 11:13   ` [dpdk-dev] [PATCH v2 3/3] net/mlx5: add Multi-Packet Rx support Yongseok Koh
2018-05-09 13:57   ` [dpdk-dev] [PATCH v2 0/3] " Shahaf Shuler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DB7PR05MB4426E91DB899AE9424E26278C39B0@DB7PR05MB4426.eurprd05.prod.outlook.com \
    --to=shahafs@mellanox.com \
    --cc=adrien.mazarguil@6wind.com \
    --cc=dev@dpdk.org \
    --cc=nelio.laranjeiro@6wind.com \
    --cc=yskoh@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).