From patchwork Thu Jun 11 00:04:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Scott Feldman X-Patchwork-Id: 482937 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 960EE140291 for ; Thu, 11 Jun 2015 10:02:58 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=PpthZq64; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752700AbbFKACx (ORCPT ); Wed, 10 Jun 2015 20:02:53 -0400 Received: from mail-pa0-f46.google.com ([209.85.220.46]:34070 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751822AbbFKACv (ORCPT ); Wed, 10 Jun 2015 20:02:51 -0400 Received: by payr10 with SMTP id r10so43318131pay.1 for ; Wed, 10 Jun 2015 17:02:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=jI07YESahWcPJ99GITktyn+SeTknvpQT+rUaWxa9vuk=; b=PpthZq64caQzbkRmC5V+U8nwpb+ccyyDLdfLCNAxhMf56abEC7B1M6Dzfv8uXf1sHU JmQgDpM/RV7derE79odu2KOMI4JAFkHpNmmaR28h3Zi0wVoQZtMTr9aTQjSTX4hbiIVP yt/Jf7ca/hxX2nuOFLHoDW4/CBw9JIY/4Y6+/wHF9V+GneCb+ut4TkAAz30UBesPFl5e 0VbadhYDhMdBACOCwCWX19o5F2fS9kVo+jB/lQVh1BH6mnJALYIBPleMN+SSUjJvhApe PIRz7ILsuFmq9RkSEQNrBJEgX+06h8lY70wQaRpsFw0dLAEWAgowV7n87oZCAQtu0ub0 /NJg== X-Received: by 10.66.199.8 with SMTP id jg8mr10068589pac.15.1433980971495; Wed, 10 Jun 2015 17:02:51 -0700 (PDT) Received: from rocker1.rocker.net ([199.58.98.143]) by mx.google.com with ESMTPSA id ho2sm9627878pbb.14.2015.06.10.17.02.50 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Jun 2015 17:02:50 -0700 (PDT) From: sfeldma@gmail.com To: netdev@vger.kernel.org Cc: jiri@resnulli.us, f.fainelli@gmail.com, andrew@lunn.ch Subject: [PATCH net-next] switchdev: fix handling for drivers not supporting IPv4 fib add/del ops Date: Wed, 10 Jun 2015 17:04:49 -0700 Message-Id: <1433981089-51216-1-git-send-email-sfeldma@gmail.com> X-Mailer: git-send-email 1.7.10.4 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Scott Feldman If CONFIG_NET_SWITCHDEV is enabled, but port driver does not implement support for IPv4 FIB add/del ops, don't fail route add/del offload operations. Route adds will not be marked as OFFLOAD. Routes will be installed in the kernel FIB, as usual. This was report/fixed by Florian when testing DSA driver with net-next on devices with L2 offload support but no L3 offload support. What he reported was an initial route installed from DHCP client would fail (route not installed to kernel FIB). This was triggering the setting of ipv4.fib_offload_disabled, which would disable route offloading after the first failure. So subsequent attempts to install the route would succeed. There is follow-on work/discussion to address the handling of route install failures, but for now, let's differentiate between no support and failed support. Reported-by: Florian Fainelli Signed-off-by: Scott Feldman Signed-off-by: Florian Fainelli --- net/switchdev/switchdev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c index 99bced4..28637e9 100644 --- a/net/switchdev/switchdev.c +++ b/net/switchdev/switchdev.c @@ -853,7 +853,7 @@ int switchdev_fib_ipv4_add(u32 dst, int dst_len, struct fib_info *fi, if (!err) fi->fib_flags |= RTNH_F_OFFLOAD; - return err; + return err == -EOPNOTSUPP ? 0 : err; } EXPORT_SYMBOL_GPL(switchdev_fib_ipv4_add); @@ -898,7 +898,7 @@ int switchdev_fib_ipv4_del(u32 dst, int dst_len, struct fib_info *fi, if (!err) fi->fib_flags &= ~RTNH_F_OFFLOAD; - return err; + return err == -EOPNOTSUPP ? 0 : err; } EXPORT_SYMBOL_GPL(switchdev_fib_ipv4_del);