[dpdk-dev] [PATCH v5 10/11] net/octeontx_ep: receive data path function added

Ferruh Yigit ferruh.yigit at intel.com
Thu Jan 28 17:58:39 CET 2021


On 1/28/2021 3:22 PM, Nalla Pradeep wrote:
> Function to deliver packets from DROQ to application is added. It also
> fills DROQ with receive buffers timely such that device can fill them
> with incoming packets.
> 
> Signed-off-by: Nalla Pradeep <pnalla at marvell.com>

<...>

> +/* Check for response arrival from OCTEON TX2
> + * returns number of requests completed
> + */
> +uint16_t
> +otx_ep_recv_pkts(void *rx_queue,
> +		  struct rte_mbuf **rx_pkts,
> +		  uint16_t budget)
> +{
> +	struct otx_ep_droq *droq = rx_queue;
> +	struct otx_ep_device *otx_ep;
> +	struct rte_mbuf *oq_pkt;
> +
> +	uint32_t pkts = 0;
> +	uint32_t new_pkts = 0;
> +	int next_fetch;
> +
> +	otx_ep = droq->otx_ep_dev;
> +
> +	if (droq->pkts_pending > budget) {
> +		new_pkts = budget;
> +	} else {
> +		new_pkts = droq->pkts_pending;
> +		new_pkts += otx_ep_check_droq_pkts(droq);
> +		if (new_pkts > budget)
> +			new_pkts = budget;
> +	}
> +
> +	if (!new_pkts)
> +		goto update_credit; /* No pkts at this moment */
> +
> +	for (pkts = 0; pkts < new_pkts; pkts++) {
> +		/* Push the received pkt to application */
> +		next_fetch = (pkts == new_pkts - 1) ? 0 : 1;
> +		oq_pkt = otx_ep_droq_read_packet(otx_ep, droq, next_fetch);
> +		if (!oq_pkt) {
> +			otx_ep_err("DROQ read pkt failed pending %" PRIu64
> +				    "last_pkt_count %" PRIu64 "new_pkts %d.\n",
> +				    droq->pkts_pending, droq->last_pkt_count,
> +				    new_pkts);

The format specifier seems fixed, but in a second thought, are you sure that you 
want to add logging into a fast path?
Even if it doesn't log anything it will consume cycles, and if it logs it will 
impact the datapath a lot.

There is a 'RTE_LOG_DP' macro for datapath, you may consider using it.



More information about the dev mailing list