Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751868AbdIVBLP (ORCPT ); Thu, 21 Sep 2017 21:11:15 -0400 Received: from shards.monkeyblade.net ([184.105.139.130]:36954 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751779AbdIVBLN (ORCPT ); Thu, 21 Sep 2017 21:11:13 -0400 Date: Thu, 21 Sep 2017 18:11:11 -0700 (PDT) Message-Id: <20170921.181111.2086501653519863373.davem@davemloft.net> To: sam@mendozajonas.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net] net/ncsi: Don't assume last available channel exists From: David Miller In-Reply-To: <1506042000.1377.21.camel@mendozajonas.com> References: <20170920041251.14635-1-sam@mendozajonas.com> <20170920.160519.764603868579556859.davem@davemloft.net> <1506042000.1377.21.camel@mendozajonas.com> X-Mailer: Mew version 6.7 on Emacs 25.2 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Thu, 21 Sep 2017 18:11:13 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 869 Lines: 20 From: Samuel Mendoza-Jonas Date: Fri, 22 Sep 2017 11:00:00 +1000 > If we haven't configured a channel yet (or are in the process of doing > so) we won't have a hot_channel - does it make more sense to > - check against the hot_channel as currently done, > - only check the filter size at configure time for /each/ channel, > - only conditionally enable the .ndo_vlan_rx_add_vid net_device callback > once we've configured a channel (eg. for ftgmac100 in the > ftgmac100_ncsi_handler() callback?) The last isn't so feasible. The device shouldn't be marked attached until a channel is available, because it seems like communication cannot occur until one is. Right? You could experiment with netif_device_detach()/netif_device_attach(). When the device is in the detached state, callbacks such as ->ndo_vlan_rx_add_vid() will not be invoked.