From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751841AbdIVB6D (ORCPT ); Thu, 21 Sep 2017 21:58:03 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:6541 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751602AbdIVB6B (ORCPT ); Thu, 21 Sep 2017 21:58:01 -0400 Subject: Re: [PATCH net-next 01/10] net: hns3: Support for dynamically assigning tx buffer to TC To: David Miller CC: , , , , , , , , , , References: <1505992913-107256-1-git-send-email-linyunsheng@huawei.com> <1505992913-107256-2-git-send-email-linyunsheng@huawei.com> <20170921.184102.278153022575280817.davem@davemloft.net> From: Yunsheng Lin Message-ID: <8babe541-9409-7f66-e52b-922144c46fb0@huawei.com> Date: Fri, 22 Sep 2017 09:57:31 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: <20170921.184102.278153022575280817.davem@davemloft.net> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.74.191.121] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A0B0208.59C46E1D.00B9,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 31a64527706a7203c0b214a4f9e9e61f Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, David On 2017/9/22 9:41, David Miller wrote: > From: Yunsheng Lin > Date: Thu, 21 Sep 2017 19:21:44 +0800 > >> @@ -1324,23 +1324,28 @@ static int hclge_alloc_vport(struct hclge_dev *hdev) >> return 0; >> } >> >> -static int hclge_cmd_alloc_tx_buff(struct hclge_dev *hdev, u16 buf_size) >> +static int hclge_cmd_alloc_tx_buff(struct hclge_dev *hdev) >> { >> /* TX buffer size is unit by 128 byte */ >> #define HCLGE_BUF_SIZE_UNIT_SHIFT 7 >> #define HCLGE_BUF_SIZE_UPDATE_EN_MSK BIT(15) >> struct hclge_tx_buff_alloc *req; >> + struct hclge_priv_buf *priv; >> struct hclge_desc desc; >> + u32 buf_size; >> int ret; >> u8 i; >> >> req = (struct hclge_tx_buff_alloc *)desc.data; >> >> hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_TX_BUFF_ALLOC, 0); >> - for (i = 0; i < HCLGE_TC_NUM; i++) >> + for (i = 0; i < HCLGE_TC_NUM; i++) { >> + priv = &hdev->priv_buf[i]; >> + buf_size = priv->tx_buf_size; >> req->tx_pkt_buff[i] = >> cpu_to_le16((buf_size >> HCLGE_BUF_SIZE_UNIT_SHIFT) | buf_size is used here >> HCLGE_BUF_SIZE_UPDATE_EN_MSK); >> + } >> >> ret = hclge_cmd_send(&hdev->hw, &desc, 1); >> if (ret) { > > Local variable 'buf_size' is assigned but never used in this function. > And with 'buf_size' removed, 'priv' also becomes unused. > > If it gets used in a later patch, add it in that later patch. > > You can also declare the variables locally in the basic block of > the for() loop. You are right. Will do it if there is more comment coming, thanks for reviewing . > > . >