DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ilya Maximets <i.maximets@samsung.com>
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>
Subject: Re: [dpdk-dev] [PATCH RFC 1/2] net/i40e: allow bulk alloc for the max size desc ring
Date: Tue, 29 Nov 2016 16:06:25 +0300	[thread overview]
Message-ID: <1ba4d257-32d7-c722-e97f-ef6085682006@samsung.com> (raw)
In-Reply-To: <2601191342CEEE43887BDE71AB9772583F0E19CD@irsmsx105.ger.corp.intel.com>

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) {
>>>
> 
> 
> 

  reply	other threads:[~2016-11-29 13:06 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20161019140725eucas1p1cb53318d974fb1152f1a7b571f328fd5@eucas1p1.samsung.com>
2016-10-19 14:07 ` [dpdk-dev] [PATCH RFC 0/2] Allow vectorized Rx with 4096 desc ring size on Intel NICs Ilya Maximets
     [not found]   ` <CGME20161019140730eucas1p2b1cf9daba45bdbf915bb69b24a0a850f@eucas1p2.samsung.com>
2016-10-19 14:07     ` [dpdk-dev] [PATCH RFC 1/2] net/i40e: allow bulk alloc for the max size desc ring Ilya Maximets
2016-11-29 10:59       ` Ilya Maximets
2016-11-29 12:50         ` Ananyev, Konstantin
2016-11-29 13:06           ` Ilya Maximets [this message]
     [not found]   ` <CGME20161019140735eucas1p267bb4aa03547e70e5f13d78e2ffedcc4@eucas1p2.samsung.com>
2016-10-19 14:07     ` [dpdk-dev] [PATCH RFC 2/2] net/ixgbe: " Ilya Maximets
2016-11-29 10:59       ` Ilya Maximets
2016-10-19 14:30   ` [dpdk-dev] [PATCH RFC 0/2] Allow vectorized Rx with 4096 desc ring size on Intel NICs Ferruh Yigit
2016-11-21 13:53     ` Ferruh Yigit
2016-12-21 12:33       ` Ilya Maximets
2016-12-27  5:03       ` Ilya Maximets
2017-01-02 15:40         ` Thomas Monjalon
2017-01-03 17:24           ` Ferruh Yigit
2017-01-06  2:29             ` Wu, Jingjing
2017-01-06 13:56               ` 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=1ba4d257-32d7-c722-e97f-ef6085682006@samsung.com \
    --to=i.maximets@samsung.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=heetae82.ahn@samsung.com \
    --cc=helin.zhang@intel.com \
    --cc=jingjing.wu@intel.com \
    --cc=konstantin.ananyev@intel.com \
    --cc=s.dyasly@samsung.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).