Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754993AbdGVXa0 convert rfc822-to-8bit (ORCPT ); Sat, 22 Jul 2017 19:30:26 -0400 Received: from lhrrgout.huawei.com ([194.213.3.17]:32163 "EHLO lhrrgout.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751869AbdGVXaZ (ORCPT ); Sat, 22 Jul 2017 19:30:25 -0400 From: Salil Mehta To: Andrew Lunn CC: "davem@davemloft.net" , "Zhuangyuzeng (Yisen)" , huangdaode , "lipeng (Y)" , "mehta.salil.lnk@gmail.com" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Linuxarm Subject: RE: [PATCH V3 net-next 2/8] net: hns3: Add support of the HNAE3 framework Thread-Topic: [PATCH V3 net-next 2/8] net: hns3: Add support of the HNAE3 framework Thread-Index: AQHS54643vA/EcUwgEOUAH2nIeoyE6IpU/EAgDdhecA= Date: Sat, 22 Jul 2017 23:30:11 +0000 Message-ID: References: <20170617172431.177044-1-salil.mehta@huawei.com> <20170617172431.177044-3-salil.mehta@huawei.com> <20170617194538.GD1974@lunn.ch> In-Reply-To: <20170617194538.GD1974@lunn.ch> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.47.95.3] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020204.5973E00E.010F,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=169.254.1.170, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: f639d850807265d3708fdfb1655ffac4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1552 Lines: 55 Hi Andrew, > -----Original Message----- > From: Andrew Lunn [mailto:andrew@lunn.ch] > Sent: Saturday, June 17, 2017 8:46 PM > To: Salil Mehta > Cc: davem@davemloft.net; Zhuangyuzeng (Yisen); huangdaode; lipeng (Y); > mehta.salil.lnk@gmail.com; netdev@vger.kernel.org; linux- > kernel@vger.kernel.org; Linuxarm > Subject: Re: [PATCH V3 net-next 2/8] net: hns3: Add support of the > HNAE3 framework > > > +static void hnae3_list_add(spinlock_t *lock, struct list_head *node, > > + struct list_head *head) > > +{ > > + unsigned long flags; > > + > > + spin_lock_irqsave(lock, flags); > > + list_add_tail(node, head); > > + spin_unlock_irqrestore(lock, flags); > > +} > > + > > +static void hnae3_list_del(spinlock_t *lock, struct list_head *node) > > +{ > > + unsigned long flags; > > + > > + spin_lock_irqsave(lock, flags); > > + list_del(node); > > + spin_unlock_irqrestore(lock, flags); > > +} > > + > > > +int hnae3_register_client(struct hnae3_client *client) > > +{ > > + struct hnae3_client *client_tmp; > > + struct hnae3_ae_dev *ae_dev; > > + int ret; > > + > > + /* One system should only have one client for every type */ > > + list_for_each_entry(client_tmp, &hnae3_client_list, node) { > > + if (client_tmp->type == client->type) > > + return 0; > > + } > > + > > + hnae3_list_add(&hnae3_list_client_lock, &client->node, > > + &hnae3_client_list); > > Please could you explain your locking scheme. I don't get it. > > Thanks > Andrew Locking scheme has been fixed in the V4 patch. Please review it. Thanks Salil