Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754343AbcC3Tkr (ORCPT ); Wed, 30 Mar 2016 15:40:47 -0400 Received: from shards.monkeyblade.net ([149.20.54.216]:37380 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751910AbcC3Tkp (ORCPT ); Wed, 30 Mar 2016 15:40:45 -0400 Date: Wed, 30 Mar 2016 15:40:43 -0400 (EDT) Message-Id: <20160330.154043.649305811904515416.davem@davemloft.net> To: yanhaishuang@cmss.chinamobile.com Cc: stephen@networkplumber.org, bridge@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] bridge: Allow set bridge ageing time when switchdev disabled From: David Miller In-Reply-To: <1459248488-25621-1-git-send-email-yanhaishuang@cmss.chinamobile.com> References: <1459248488-25621-1-git-send-email-yanhaishuang@cmss.chinamobile.com> X-Mailer: Mew version 6.6 on Emacs 24.5 / 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]); Wed, 30 Mar 2016 12:40:45 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1090 Lines: 31 From: Haishuang Yan Date: Tue, 29 Mar 2016 18:48:08 +0800 > When NET_SWITCHDEV=n, switchdev_port_attr_set will return -EOPNOTSUPP, > we should ignore this error code and continue to set the ageing time. > > Signed-off-by: Haishuang Yan Applied and queued up for -stable, thanks. > @@ -582,7 +582,7 @@ int br_set_ageing_time(struct net_bridge *br, u32 ageing_time) > int err; > > err = switchdev_port_attr_set(br->dev, &attr); > - if (err) > + if (err && err != -EOPNOTSUPP) > return err; > > br->ageing_time = t; This is at least the 5th time I've had to apply a bug fix exactly like this one. If this doesn't convince everyone that this whole -EOPNOTSUPP mechanism is extremely error prone, I don't know what will. There should be only one or two strictly controlled locations that reinterpret the return value from all of these routines that have this special way of signalling lack of switchdev support via -EOPNOTSUPP. It can't be spread all over the place like this, it simply does NOT work.