From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <i.maximets@samsung.com>
Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com
 [210.118.77.12]) by dpdk.org (Postfix) with ESMTP id 349C93B5
 for <dev@dpdk.org>; Tue, 29 Nov 2016 14:06:29 +0100 (CET)
Received: from eucas1p1.samsung.com (unknown [182.198.249.206])
 by mailout2.w1.samsung.com
 (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014))
 with ESMTP id <0OHE00BS7N2RQI60@mailout2.w1.samsung.com> for dev@dpdk.org;
 Tue, 29 Nov 2016 13:06:27 +0000 (GMT)
Received: from eusmges4.samsung.com (unknown [203.254.199.244])
 by	eucas1p1.samsung.com (KnoxPortal) with ESMTP
 id	20161129130627eucas1p1320644fff2e2105e2eec7ddea81e2165~LhoAh0YLU0044400444eucas1p1L;
 Tue, 29 Nov 2016 13:06:27 +0000 (GMT)
Received: from eucas1p1.samsung.com ( [182.198.249.206])
 by	eusmges4.samsung.com (EUCPMTA) with SMTP id D9.92.28332.35D7D385; Tue,
 29	Nov 2016 13:06:27 +0000 (GMT)
Received: from eusmgms1.samsung.com (unknown [182.198.249.179])
 by	eucas1p2.samsung.com (KnoxPortal) with ESMTP
 id	20161129130626eucas1p2147cfa3ca43f39b302c5a417d23a7459~Lhn-bT0LT0973609736eucas1p2U;
 Tue, 29 Nov 2016 13:06:26 +0000 (GMT)
X-AuditID: cbfec7f4-f791c6d000006eac-64-583d7d53ce9a
Received: from eusync1.samsung.com ( [203.254.199.211])
 by	eusmgms1.samsung.com (EUCPMTA) with SMTP id 3C.A3.07726.26D7D385; Tue,
 29	Nov 2016 13:06:42 +0000 (GMT)
Received: from [106.109.129.180] by eusync1.samsung.com
 (Oracle	Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014))
 with	ESMTPA id <0OHE00E2SN2PNH70@eusync1.samsung.com>; Tue,
 29 Nov 2016 13:06:26	+0000 (GMT)
To: "Ananyev, Konstantin" <konstantin.ananyev@intel.com>,
 "dev@dpdk.org" <dev@dpdk.org>, "Zhang, Helin" <helin.zhang@intel.com>,
 "Wu, Jingjing" <jingjing.wu@intel.com>
Cc: Dyasly Sergey <s.dyasly@samsung.com>,
 Heetae Ahn <heetae82.ahn@samsung.com>,
 "Richardson, Bruce" <bruce.richardson@intel.com>,
 "Yigit, Ferruh" <ferruh.yigit@intel.com>
From: Ilya Maximets <i.maximets@samsung.com>
Message-id: <1ba4d257-32d7-c722-e97f-ef6085682006@samsung.com>
Date: Tue, 29 Nov 2016 16:06:25 +0300
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.4.0
MIME-version: 1.0
In-reply-to: <2601191342CEEE43887BDE71AB9772583F0E19CD@irsmsx105.ger.corp.intel.com>
Content-type: text/plain; charset=windows-1252
Content-transfer-encoding: 7bit
X-Brightmail-Tracker: H4sIAAAAAAAAA02SWUwTURiFvTPTdtpYMpQiv4gSBow7IPIwYZXgA49ECVYTgSoTQGjBFohg
 jIQQaCESoBV13AYQFYqyyBYtUZAUAwkSRYWIWF8UDEIiRhalShlMePvuPSfn/8/NJXFFhciT
 TNNmszqtOoMWy4hO29LwgWMXw1WBI1ekzFhjJDP7owtjJnqGJEz1/AcJY37XhZjRkiUJc52f
 R8zcn1qCMd3wPCyNWebrRTF11mkspry9EcXiJ2VhyWxGWi6rC4hIkqVWNb8SZzVtPW9/wxEF
 yKYsRSQJVDAU3tpRiqSruAVGJpvFpUhGKqh6BJy5jBAO8wiWbi6LBFcwTD2Yx52soO4heN9B
 C6YpBB2zTRKn4EbFgeVTn8QpKCkLAsfd8bVcnGpG8LHGuuYSU/th0NKPnHvIqQgwmg85rwlq
 J6y09q9NcKdU0NtqQU6WU66waJoknCyl4mGhp3CNcSoQrplfYAJ7w+Om77hzFlCNEmgtG0FC
 z+3Q9hwXGhyBae4JIbAbfBtolwjsBUZDLybwBajsKJYIOUUIaioX1+tHwuD42/VhLlDVeRUX
 8uVgKFYIl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ktTs1NSC1CKYPiYOTqkGxhL+LdEqAndiOjonRwhPym6aV/D9aUDGqc+ma+dc37okI1y7
 KmhWc3HlzFXx/1s/fFUyvR41wUV4lvmXUP+M/L3M5UvWGnnWtR6YOstQdXe+5/pYr7j1RbpP
 Xi4/xCnYs7U+/b+vo8VTnaCyeTtb0k76PZjSc3hKR8AF24Uxizmm1f39a35qphJLcUaioRZz
 UXEiAFFgGb/DAgAA
X-MTR: 20000000000000000@CPGS
X-CMS-MailID: 20161129130626eucas1p2147cfa3ca43f39b302c5a417d23a7459
X-Msg-Generator: CA
X-Sender-IP: 182.198.249.179
X-Local-Sender: =?UTF-8?B?SWx5YSBNYXhpbWV0cxtTUlItVmlydHVhbGl6YXRpb24gTGFi?=
 =?UTF-8?B?G+yCvOyEseyghOyekBtFbmdpbmVlcg==?=
X-Global-Sender: =?UTF-8?B?SWx5YSBNYXhpbWV0cxtTUlItVmlydHVhbGl6YXRpb24gTGFi?=
 =?UTF-8?B?G1NhbXN1bmcgRWxlY3Ryb25pY3MbRW5naW5lZXI=?=
X-Sender-Code: =?UTF-8?B?QzEwG0NJU0hRG0MxMEdEMDFHRDAxMDE1NA==?=
CMS-TYPE: 201P
X-HopCount: 7
X-CMS-RootMailID: 20161019140730eucas1p2b1cf9daba45bdbf915bb69b24a0a850f
X-RootMTR: 20161019140730eucas1p2b1cf9daba45bdbf915bb69b24a0a850f
References: <1476886037-4586-1-git-send-email-i.maximets@samsung.com>
 <CGME20161019140730eucas1p2b1cf9daba45bdbf915bb69b24a0a850f@eucas1p2.samsung.com>
 <1476886037-4586-2-git-send-email-i.maximets@samsung.com>
 <0b31fd94-d5b2-acb8-8d55-a6fe124c9886@samsung.com>
 <2601191342CEEE43887BDE71AB9772583F0E19CD@irsmsx105.ger.corp.intel.com>
Subject: Re: [dpdk-dev] [PATCH RFC 1/2] net/i40e: allow bulk alloc for the
 max size desc ring
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Tue, 29 Nov 2016 13:06:30 -0000

On 29.11.2016 15:50, Ananyev, Konstantin wrote:
> Hi Ilya,
> 
>> Ping.
>>
>> Best regards, Ilya Maximets.
>>
>> On 19.10.2016 17:07, Ilya Maximets wrote:
>>> The only reason why bulk alloc disabled for the rings with
>>> more than (I40E_MAX_RING_DESC - RTE_PMD_I40E_RX_MAX_BURST)
>>> descriptors is the possible out-of-bound access to the dma
>>> memory. But it's the artificial limit and can be easily
>>> avoided by allocating of RTE_PMD_I40E_RX_MAX_BURST more
>>> descriptors in memory. This will not interfere the HW and,
>>> as soon as all rings' memory zeroized, Rx functions will
>>> work correctly.
>>>
>>> This change allows to use vectorized Rx functions with
>>> 4096 descriptors in Rx ring which is important to achieve
>>> zero packet drop rate in high-load installations.
>>>
>>> Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
>>> ---
>>>  drivers/net/i40e/i40e_rxtx.c | 24 +++++++++++++-----------
>>>  1 file changed, 13 insertions(+), 11 deletions(-)
>>>
>>> diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
>>> index 7ae7d9f..1f76691 100644
>>> --- a/drivers/net/i40e/i40e_rxtx.c
>>> +++ b/drivers/net/i40e/i40e_rxtx.c
>>> @@ -409,15 +409,6 @@ check_rx_burst_bulk_alloc_preconditions(__rte_unused struct i40e_rx_queue *rxq)
>>>  			     "rxq->rx_free_thresh=%d",
>>>  			     rxq->nb_rx_desc, rxq->rx_free_thresh);
>>>  		ret = -EINVAL;
>>> -	} else if (!(rxq->nb_rx_desc < (I40E_MAX_RING_DESC -
>>> -				RTE_PMD_I40E_RX_MAX_BURST))) {
>>> -		PMD_INIT_LOG(DEBUG, "Rx Burst Bulk Alloc Preconditions: "
>>> -			     "rxq->nb_rx_desc=%d, "
>>> -			     "I40E_MAX_RING_DESC=%d, "
>>> -			     "RTE_PMD_I40E_RX_MAX_BURST=%d",
>>> -			     rxq->nb_rx_desc, I40E_MAX_RING_DESC,
>>> -			     RTE_PMD_I40E_RX_MAX_BURST);
>>> -		ret = -EINVAL;
>>>  	}
>>>  #else
>>>  	ret = -EINVAL;
>>> @@ -1698,8 +1689,19 @@ i40e_dev_rx_queue_setup(struct rte_eth_dev *dev,
>>>  	rxq->rx_deferred_start = rx_conf->rx_deferred_start;
>>>
>>>  	/* Allocate the maximun number of RX ring hardware descriptor. */
>>> -	ring_size = sizeof(union i40e_rx_desc) * I40E_MAX_RING_DESC;
>>> -	ring_size = RTE_ALIGN(ring_size, I40E_DMA_MEM_ALIGN);
>>> +	len = I40E_MAX_RING_DESC;
>>> +
>>> +#ifdef RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC
>>> +	/**
>>> +	 * Allocating a little more memory because vectorized/bulk_alloc Rx
>>> +	 * functions doesn't check boundaries each time.
>>> +	 */
>>> +	len += RTE_PMD_I40E_RX_MAX_BURST;
>>> +#endif
>>> +
> 
> Looks good to me.
> One question, though do we really need '+#ifdef RTE_LIBRTE_I40E_RX_ALLOW_BULK_ALLOC' here?
> Why just not remove this ifdef here and always add allocate extra descriptors.
> Konstantin

I put it there because all other bulk_alloc related code in i40e is under this
ifdef. Just to keep the code in consistent state. Plus, it saves memory a bit.
I prefer to keep ifdef here, but maintainers are free to remove it while applying.

>>> +	ring_size = RTE_ALIGN(len * sizeof(union i40e_rx_desc),
>>> +			      I40E_DMA_MEM_ALIGN);
>>> +
>>>  	rz = rte_eth_dma_zone_reserve(dev, "rx_ring", queue_idx,
>>>  			      ring_size, I40E_RING_BASE_ALIGN, socket_id);
>>>  	if (!rz) {
>>>
> 
> 
>