DPDK patches and discussions
 help / color / mirror / Atom feed
From: Yongseok Koh <yskoh@mellanox.com>
To: Dekel Peled <dekelp@mellanox.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	Shahaf Shuler <shahafs@mellanox.com>,
	Ori Kam <orika@mellanox.com>
Subject: Re: [dpdk-dev] [PATCH v2] net/mlx5: support metadata as flow rule criteria
Date: Wed, 3 Oct 2018 07:22:41 +0000	[thread overview]
Message-ID: <D763E38F-3EC3-4FC1-84A0-A52158582ED9@mellanox.com> (raw)
In-Reply-To: <VI1PR05MB422422867AEDED925BBE63BBB6E90@VI1PR05MB4224.eurprd05.prod.outlook.com>

> On Oct 2, 2018, at 10:22 PM, Dekel Peled <dekelp@mellanox.com> wrote:
> 
>>> @@ -137,8 +152,10 @@
>>> 		n = RTE_MIN((uint16_t)(pkts_n - nb_tx),
>> MLX5_VPMD_TX_MAX_BURST);
>>> 		if (txq->offloads & DEV_TX_OFFLOAD_MULTI_SEGS)
>>> 			n = txq_count_contig_single_seg(&pkts[nb_tx], n);
>>> -		if (txq->offloads & MLX5_VEC_TX_CKSUM_OFFLOAD_CAP)
>>> -			n = txq_calc_offload(&pkts[nb_tx], n, &cs_flags);
>>> +		if (txq->offloads & (MLX5_VEC_TX_CKSUM_OFFLOAD_CAP |
>>> +				DEV_TX_OFFLOAD_MATCH_METADATA))
>> 
>> How about writing a separate func - txq_count_contig_same_metadata()?
>> And it would be better to rename txq_calc_offload() to
>> txq_count_contig_same_csflag().
>> Then, there could be less redundant if-clause in the funcs.
> 
> It was considered during implementation but decided to handle all related logic
> In same function.

But it doesn't look efficient. Note that it is performance critical datapath.

	if (A) {
		for (n)
			do_a();
	}
	if (B) {
		for (n)
			do_b();
	}

vs.

	if (A or B) {
		for (n) {
			if (A)
				do_a();
			if (B)
				do_b();
		}
	}

In the worst case, condition A and B will be checked n times each while it can be
only once in the first case.

Thanks,
Yongseok

  reply	other threads:[~2018-10-03  7:22 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-16 13:42 [dpdk-dev] [PATCH] " Dekel Peled
2018-09-19  7:21 ` Xueming(Steven) Li
2018-09-27 14:18 ` [dpdk-dev] [PATCH v2] " Dekel Peled
2018-09-29  9:09   ` Yongseok Koh
2018-10-03  5:22     ` Dekel Peled
2018-10-03  7:22       ` Yongseok Koh [this message]
2018-10-11 11:19   ` [dpdk-dev] [PATCH v3] " Dekel Peled
2018-10-17 11:53     ` [dpdk-dev] [PATCH v4] " Dekel Peled
2018-10-18  8:00       ` Yongseok Koh
2018-10-21 13:44         ` Dekel Peled
2018-10-21 14:04       ` [dpdk-dev] [PATCH v5] " Dekel Peled
2018-10-22 18:47         ` Yongseok Koh
2018-10-23 10:48         ` [dpdk-dev] [PATCH v6] " Dekel Peled
2018-10-23 12:27           ` Shahaf Shuler
2018-10-23 19:34           ` [dpdk-dev] [PATCH v7] " Dekel Peled
2018-10-24  6:12             ` Shahaf Shuler
2018-10-24  8:49               ` Ferruh Yigit

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=D763E38F-3EC3-4FC1-84A0-A52158582ED9@mellanox.com \
    --to=yskoh@mellanox.com \
    --cc=dekelp@mellanox.com \
    --cc=dev@dpdk.org \
    --cc=orika@mellanox.com \
    --cc=shahafs@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).