Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp7946115ybn; Tue, 1 Oct 2019 00:16:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqwYb9LjtZoe79qLkcymp8JyiNoWR2ht1rkO2R2T6PI8p5PEo3+cg5U8/WOkyGpxwM77ltf8 X-Received: by 2002:a17:906:41a:: with SMTP id d26mr22731201eja.17.1569914179476; Tue, 01 Oct 2019 00:16:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569914179; cv=none; d=google.com; s=arc-20160816; b=BzgCfPq9PzHPHOZPMqboMb7TtskOih89HmCGEJcNMasUxglIrRqntxMGt5P2JR1gpF TT7oXpm1mNWwQbo4ZMZ7mOsU71x75SIjUJ3b2AdRJRGnDOIC1qeZRGrJrYytqElbhmbe jBlOxJY9zZm1CbuMri+h+UDF8Gu0EvK2yg5bo4rFZNWx+yldhOcmREa5Xa1x+uUeYh9n mwCGOO3C2+i9HPUWXd3WgcsC1Crjhy1fJKZTaksT8WoNrERRV1fH7/FFwx0MGdWI83oh ILi4XbotkghirHITR5ty6eOt3JTaAUxOQFaYySlYrD4KDVdac3enWX/n1Hf039LU9r6w VEBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=+0CrXZu9EwF68oQv8Lix3vEIg4Y+mSev4QPC79qcr80=; b=CB+wU21q2KKFUd9OleOWKZCmPSsj1LAqVUfc17kzCzF/OF12m5p0Izbf6p+CMvehv8 28kABZi7MUdFn9ZJqjuiyUvJpguqExwPExxkO8HMYo+7JC6kaXOtrqo4E7nkmTNFdo/p gNoFpkf3tEmhoLjHFjslLO8fJmhV0dylS5f/EGXVXuEVxvtM77Ig69O33Qpy8scVEaRq MWGJTTkgYJiz6HpLGVN5tiTkyRl/GC0k/fd2VqOPdgExBahoLwevspGRHsbJHKYC4KYk EjYRPpDrE6DC4efMlwfSB2AeR9o145cnl1a3ia02rF+6IWuJKNty+IjEUf6/Z7wQbe3s u8IA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 29si8765177eje.235.2019.10.01.00.15.48; Tue, 01 Oct 2019 00:16:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732848AbfJAHLV (ORCPT + 99 others); Tue, 1 Oct 2019 03:11:21 -0400 Received: from s3.sipsolutions.net ([144.76.43.62]:55602 "EHLO sipsolutions.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726157AbfJAHLV (ORCPT ); Tue, 1 Oct 2019 03:11:21 -0400 Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.92.2) (envelope-from ) id 1iFCJU-0000Pp-PN; Tue, 01 Oct 2019 09:11:12 +0200 Message-ID: <39e879f59ad3b219901839d1511fc96886bf94fb.camel@sipsolutions.net> Subject: Re: [PATCH net v4 01/12] net: core: limit nested device depth From: Johannes Berg To: Taehee Yoo Cc: David Miller , Netdev , linux-wireless@vger.kernel.org, Jakub Kicinski , j.vosburgh@gmail.com, vfalico@gmail.com, Andy Gospodarek , =?UTF-8?Q?Ji=C5=99=C3=AD_P=C3=ADrko?= , sd@queasysnail.net, Roopa Prabhu , saeedm@mellanox.com, manishc@marvell.com, rahulv@marvell.com, kys@microsoft.com, haiyangz@microsoft.com, Stephen Hemminger , sashal@kernel.org, hare@suse.de, varun@chelsio.com, ubraun@linux.ibm.com, kgraul@linux.ibm.com, Jay Vosburgh , Cody Schuffelen , bjorn@mork.no Date: Tue, 01 Oct 2019 09:11:10 +0200 In-Reply-To: (sfid-20190929_130604_910614_D6042236) References: <20190928164843.31800-1-ap420073@gmail.com> <20190928164843.31800-2-ap420073@gmail.com> (sfid-20190929_130604_910614_D6042236) Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.5 (3.30.5-1.fc29) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Hi, Sorry for the delay. > These functions are used as a callback function of > netdev_walk_all_{upper/lower}_dev(). So these return types are needed. Ah yes, I missed that, sorry. > Without storing level storing, a walking graph routine is needed only > once. The routine would work as a nesting depth validator. > So that the detach routine doesn't need to walk the graph. > Whereas, in this patch, both attach and detach routine need to > walk graph. So, storing nesting variable way is slower than without > storing nesting variable way because of the detach routine's updating > upper and lower level routine. Right, that's what I thought. > But I'm sure that storing nesting variables is useful because other > modules already using nesting level values. > Please look at vlan_get_encap_level() and usecases. Indeed, I noticed that later. > If we don't provide nesting level variables, they should calculate > every time when they need it and this way is easier way to get a > nesting level. There are use-cases of lower_level variable > in the 11th patch. Yes, makes sense, agree. One could argue that you only ever need the "lower_level" stored, not the "upper_level", but I guess that doesn't really make a difference. Placing these in a better position in the struct might make sense - a cursory look suggested that they weren't filling any of the many holes there, did you pay attention to that or was the placement more or less random? johannes