From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753023AbcHOQbg (ORCPT ); Mon, 15 Aug 2016 12:31:36 -0400 Received: from mail-wm0-f44.google.com ([74.125.82.44]:34500 "EHLO mail-wm0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752881AbcHOQbe (ORCPT ); Mon, 15 Aug 2016 12:31:34 -0400 Subject: Re: [PATCH v2 1/4] net: ethernet: ti: davinci_cpdma: split descs num between all channels To: Yuval Mintz , David Miller , netdev , "mugunthanvnm@ti.com" , "grygorii.strashko@ti.com" References: <1471274181-780-1-git-send-email-ivan.khoronzhuk@linaro.org> <1471274181-780-2-git-send-email-ivan.khoronzhuk@linaro.org> Cc: linux-kernel , "linux-omap@vger.kernel.org" , "nsekhar@ti.com" From: Ivan Khoronzhuk Message-ID: <7426a9f3-a93e-5ae4-da00-48caf0dc86b8@linaro.org> Date: Mon, 15 Aug 2016 19:30:28 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 15.08.16 19:05, Yuval Mintz wrote: >> Currently the tx channels share same pool of descriptors. Thus one channel can >> block another if pool is emptied by one. But, the shaper should decide which >> channel is allowed to send packets. To avoid such impact of one channel on >> another, let every channel to have its own peace of pool. > Piece. Yep. > >> +/** >> + * cpdma_chan_split_pool - Splits ctrl pool between all channels. >> + * Has to be called under ctlr lock >> + * >> + */ > No need for the extra empty comment line. Ok. > >> + /* calculate average size of pool slice */ >> + ch_desc_num = pool->num_desc / ctlr->chan_num; >> + >> + /* split ctlr pool */ >> + for (i = 0; i < ARRAY_SIZE(ctlr->channels); i++) { >> + chan = ctlr->channels[i]; >> + if (chan) >> + chan->desc_num = ch_desc_num; > Is this 'if' needed? If there's some route where the channel can be NULL, > You're splitting the value incorrectly. If chan == NULL it's not active and pool->chan_num doesn't include it. The descriptors are split between active channels only. > -- Regards, Ivan Khoronzhuk