Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031698AbdI0ESI (ORCPT ); Wed, 27 Sep 2017 00:18:08 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:60737 "EHLO out5-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031435AbdI0ESE (ORCPT ); Wed, 27 Sep 2017 00:18:04 -0400 X-Greylist: delayed 316 seconds by postgrey-1.27 at vger.kernel.org; Wed, 27 Sep 2017 00:18:04 EDT X-ME-Sender: X-Sasl-enc: 8gguoY+XQG3vskfbRqoBIPvNrvBNn5u7kPa3nyK4KAtA 1506485564 Message-ID: <1506485560.1757.16.camel@mendozajonas.com> Subject: Re: [PATCH net] net/ncsi: Don't assume last available channel exists From: Samuel Mendoza-Jonas To: David Miller Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Benjamin Herrenschmidt Date: Wed, 27 Sep 2017 14:12:40 +1000 In-Reply-To: <20170921.181111.2086501653519863373.davem@davemloft.net> References: <20170920041251.14635-1-sam@mendozajonas.com> <20170920.160519.764603868579556859.davem@davemloft.net> <1506042000.1377.21.camel@mendozajonas.com> <20170921.181111.2086501653519863373.davem@davemloft.net> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.24.5 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1933 Lines: 45 On Thu, 2017-09-21 at 18:11 -0700, David Miller wrote: > 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? Yes that's 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. This looked like the way at first, but _detach() ceases any tx/rx on the interface right? NCSI still needs the interface to be active since the 'channels' are on a separate network controller that the interface is connected to, eg on the machines I'm using: BMC 'Host' network controller ---------------------- ---------------------------- |ftgmac100 interface | <---- NCSI Link ----> | BCM5719 interface | --> external interface ---------------------- ---------------------------- Looking at the NCSI init path I believe we're guaranteed to have an ndp struct by the time ndo_vlan_rx_add_vid() is called, making some of those checks overly cautious. It might be easiest to just track new vids as we see them (up to the NCSI spec limit), and then deal with configured channels on a case by case basis since their limits can be different. I'll work on a V2 but hopefully I haven't misinterpreted _detach()/_attach() :) Sam