Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753120AbdLERLz convert rfc822-to-8bit (ORCPT ); Tue, 5 Dec 2017 12:11:55 -0500 Received: from lhrrgout.huawei.com ([194.213.3.17]:2995 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752433AbdLERLt (ORCPT ); Tue, 5 Dec 2017 12:11:49 -0500 From: Salil Mehta To: David Miller CC: "Zhuangyuzeng (Yisen)" , "lipeng (Y)" , "mehta.salil.lnk@gmail.com" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-rdma@vger.kernel.org" , Linuxarm Subject: RE: [PATCH net-next 1/8] net: hns3: Add HNS3 VF IMP(Integrated Management Proc) cmd interface Thread-Topic: [PATCH net-next 1/8] net: hns3: Add HNS3 VF IMP(Integrated Management Proc) cmd interface Thread-Index: AQHTbDMBHCVY6v6r60GYcWy1Cwxdg6M05ZYAgAAXgiA= Date: Tue, 5 Dec 2017 17:11:39 +0000 Message-ID: References: <20171203123307.19820-1-salil.mehta@huawei.com> <20171203123307.19820-2-salil.mehta@huawei.com> <20171205.113744.2040678170803031734.davem@davemloft.net> In-Reply-To: <20171205.113744.2040678170803031734.davem@davemloft.net> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.202.226.117] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2222 Lines: 79 Hi Dave, > -----Original Message----- > From: David Miller [mailto:davem@davemloft.net] > Sent: Tuesday, December 05, 2017 4:38 PM > To: Salil Mehta > Cc: Zhuangyuzeng (Yisen) ; lipeng (Y) > ; mehta.salil.lnk@gmail.com; > netdev@vger.kernel.org; linux-kernel@vger.kernel.org; linux- > rdma@vger.kernel.org; Linuxarm > Subject: Re: [PATCH net-next 1/8] net: hns3: Add HNS3 VF IMP(Integrated > Management Proc) cmd interface > > From: Salil Mehta > Date: Sun, 3 Dec 2017 12:33:00 +0000 > > > +static int hclgevf_ring_space(struct hclgevf_cmq_ring *ring) > > +{ > > + int ntu = ring->next_to_use; > > + int ntc = ring->next_to_clean; > > + int used = (ntu - ntc + ring->desc_num) % ring->desc_num; > > Order local variables from longest to shortest line, please. This one skipped my eyes. Will fix. Thanks. > > Audit your entire submission for this issue. Sure, will do. > > > +static int hclgevf_cmd_csq_done(struct hclgevf_hw *hw) > > +{ > > + u32 head = hclgevf_read_dev(hw, HCLGEVF_NIC_CSQ_HEAD_REG); > > + return head == hw->cmq.csq.next_to_use; > > +} > > Please return bool from this function. Agreed. Should have been bool here. Will fix. > > > +void hclgevf_cmd_setup_basic_desc(struct hclgevf_desc *desc, > > + enum hclgevf_opcode_type opcode, bool > is_read) > > +{ > > + memset((void *)desc, 0, sizeof(struct hclgevf_desc)); > > You never need casts like this, when the functions argument is void any > pointer can be passed in as-is. Agreed. Will remove this. > > > + > > + /* If the command is sync, wait for the firmware to write back, > > + * if multi descriptors to be sent, use the first one to check > > + */ > > + if (HCLGEVF_SEND_SYNC(le16_to_cpu(desc->flag))) { > > + do { > > + if (hclgevf_cmd_csq_done(hw)) > > + break; > > + udelay(1); > > + timeout++; > > + } while (timeout < hw->cmq.tx_timeout); > > + } > > This is potentially a long timeout with a spinlock held. Consider > using > sleeping and completions. I guess you meant 1 usec X (hw->cmq.tx_timeout = 200) times the delay is large - right? Will review it again. Thanks. Salil