Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp146026ybi; Fri, 26 Jul 2019 07:28:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqyy/o3irj7GYQH9Bzv7CS3xw8TJRFqyWg2BMbWSnbAKq5TgNbFlrAAb6gK6s8qSg3futjIP X-Received: by 2002:a17:902:8a87:: with SMTP id p7mr96143613plo.124.1564151315734; Fri, 26 Jul 2019 07:28:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564151315; cv=none; d=google.com; s=arc-20160816; b=DE/fCEUazEa5ZcavysUDPwJaZBZ71t0vb591kPqTwUgfgZAOgv8kPKT4LawU2zeIjH 5mHt0Uz16TDNZALtKm6vOmwsV6GDOFfLRkJ5vf4o4zvVQUXvIZl/GggT7CZGgu2xodFH bex2Jsm2amg+AkERg5SA0miwLrisUv77bEat0ZX7gHN2wK2Bcrc/2PBDN95Rh2diZ7Sy gwt27OTmQL7prZEIzNrQSmOYWGiQaRF1cRI0mmUWp71WK1XSYHiTskO2opFuqAZoVB7Y V7QZge38GGl9CwQU4TsF6Wb9QdSJ2WHw2NDeQweTUvgIndoEONXsUOlX8G5tnAJA0N3u pHqQ== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=nJFcL4rsm3JbWPrhyiwPlcL0qB6F6mQAoK5MOzJpez0=; b=FE96FXtEoaLrH6csZCAsrI98GXE9DixYWqDC4Mcgak9Y/zpG2vGmRuGPsfbBWaXC3i n2Rbp3stKJaGU0k3tiL9e8LYMy33vLFWTQcBVaYGfTEoHNs5CmgTvYJtuyoMKRZpnv9I M9ttOn5r/V3t3WhKaptdnWTrSN+5Sho0K/slIMsM8KFiOfuZYC9d/PTTKwFNeCvbn1f2 i8mjMVwA94k5etvTgcTXQNK7+gVZQZMfYYkYxe7kbN2kKzT9qD1Fi6n1s0N2FjfyrdH2 6hATL9By0heCjA7a3Z7pF9L79tyemmWa+aCaa2SA7gxkZIjU5I7zeUiZEyrfG9EPDjH3 GdvA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k73si21147072pje.10.2019.07.26.07.28.16; Fri, 26 Jul 2019 07:28:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387482AbfGZO1P convert rfc822-to-8bit (ORCPT + 99 others); Fri, 26 Jul 2019 10:27:15 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:40932 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726731AbfGZO1P (ORCPT ); Fri, 26 Jul 2019 10:27:15 -0400 Received: by mail-lj1-f196.google.com with SMTP id m8so18071514lji.7 for ; Fri, 26 Jul 2019 07:27:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=2GwRCg9i1fckl1zL5hoyucrASZN65m4kd1+MnYjmS0o=; b=MFsXm3lDCuJ9NORvB06et5hrMBGTSvnTBWXLhKJSvhjZFs7FAacwCUIpIWMf+DptDf l4+Ap3knLPYzwTP7Kc6pssy+713HoVGfthPSHryoE2CoRyiJD3EULcNyvZMizUTvCrkL A5AgoOQiqIl3D8c691Gibsaf+r7/sd7k0xwsMGx8S55n4JSB2rbRm0T5nWPutGCkivKt 6uEY/E7TuE4p47vZHmVqhls0rKPc0gHV+XUZLgtBldEdeIE8jHx2mauF7ZmSFY6YQ8uD h4xuhXpTrAwqVwW5I8wO1jnvKGUgAz2Mkm3woqI8P0SNVPq5YonAY4obiamd1fDtPhjT ursA== X-Gm-Message-State: APjAAAWL8pvw9FzUYZ5YEc0ShZxu5HrvTt0tnwfhvBLmDs4yps3W5G80 biQHN5HATlvv8eIa7c7JaJUMNFKFtQ9FDMh86EjC2g== X-Received: by 2002:a2e:8756:: with SMTP id q22mr50525884ljj.108.1564151233595; Fri, 26 Jul 2019 07:27:13 -0700 (PDT) MIME-Version: 1.0 References: <20190725231931.24073-1-mcroce@redhat.com> <20190726125053.GA5031@kwain> In-Reply-To: <20190726125053.GA5031@kwain> From: Matteo Croce Date: Fri, 26 Jul 2019 16:26:37 +0200 Message-ID: Subject: Re: [PATCH net] mvpp2: refactor MTU change code To: Antoine Tenart Cc: netdev , Maxime Chevallier , Marcin Wojtas , Stefan Chulski , LKML Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 26, 2019 at 2:50 PM Antoine Tenart wrote: > > Hi Matteo, > > On Fri, Jul 26, 2019 at 01:19:31AM +0200, Matteo Croce wrote: > > The MTU change code can call napi_disable() with the device already down, > > leading to a deadlock. Also, lot of code is duplicated unnecessarily. > > > > Rework mvpp2_change_mtu() to avoid the deadlock and remove duplicated code. > > > > Signed-off-by: Matteo Croce > > As this is a fix sent to net, you could add a Fixes: tag. > > Otherwise this looks good, > Acked-by: Antoine Tenart > > Thanks! > Antoine > > > --- > > .../net/ethernet/marvell/mvpp2/mvpp2_main.c | 41 ++++++------------- > > 1 file changed, 13 insertions(+), 28 deletions(-) > > > > diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c > > index 2f7286bd203b..60eb98f99571 100644 > > --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c > > +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c > > @@ -3612,6 +3612,7 @@ static int mvpp2_set_mac_address(struct net_device *dev, void *p) > > static int mvpp2_change_mtu(struct net_device *dev, int mtu) > > { > > struct mvpp2_port *port = netdev_priv(dev); > > + bool running = netif_running(dev); > > int err; > > > > if (!IS_ALIGNED(MVPP2_RX_PKT_SIZE(mtu), 8)) { > > @@ -3620,40 +3621,24 @@ static int mvpp2_change_mtu(struct net_device *dev, int mtu) > > mtu = ALIGN(MVPP2_RX_PKT_SIZE(mtu), 8); > > } > > > > - if (!netif_running(dev)) { > > - err = mvpp2_bm_update_mtu(dev, mtu); > > - if (!err) { > > - port->pkt_size = MVPP2_RX_PKT_SIZE(mtu); > > - return 0; > > - } > > - > > - /* Reconfigure BM to the original MTU */ > > - err = mvpp2_bm_update_mtu(dev, dev->mtu); > > - if (err) > > - goto log_error; > > - } > > - > > - mvpp2_stop_dev(port); > > + if (running) > > + mvpp2_stop_dev(port); > > > > err = mvpp2_bm_update_mtu(dev, mtu); > > - if (!err) { > > + if (err) { > > + netdev_err(dev, "failed to change MTU\n"); > > + /* Reconfigure BM to the original MTU */ > > + mvpp2_bm_update_mtu(dev, dev->mtu); > > + } else { > > port->pkt_size = MVPP2_RX_PKT_SIZE(mtu); > > - goto out_start; > > } > > > > - /* Reconfigure BM to the original MTU */ > > - err = mvpp2_bm_update_mtu(dev, dev->mtu); > > - if (err) > > - goto log_error; > > - > > -out_start: > > - mvpp2_start_dev(port); > > - mvpp2_egress_enable(port); > > - mvpp2_ingress_enable(port); > > + if (running) { > > + mvpp2_start_dev(port); > > + mvpp2_egress_enable(port); > > + mvpp2_ingress_enable(port); > > + } > > > > - return 0; > > -log_error: > > - netdev_err(dev, "failed to change MTU\n"); > > return err; > > } > > > > -- > > 2.21.0 > > > > -- > Antoine Ténart, Bootlin > Embedded Linux and Kernel engineering > https://bootlin.com It seems to me that the fixes tag should refer to the driver inclusion: Fixes: 3f518509dedc ("ethernet: Add new driver for Marvell Armada 375 network unit") -- Matteo Croce per aspera ad upstream