Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1826344imm; Mon, 3 Sep 2018 10:26:06 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZUYHxEtNrs9BzZBNRNDst8eRWT1kkqUeOp93A2cvttP/za3+8YF0gDGbysBxXHlqqLVT8a X-Received: by 2002:a17:902:6f16:: with SMTP id w22-v6mr29940683plk.127.1535995566673; Mon, 03 Sep 2018 10:26:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535995566; cv=none; d=google.com; s=arc-20160816; b=RtQAh1jNrDaoeW19p8Dv/mdEy8DGWRXHQFSeAJThzSPaJqzjW0PVPxAZW2oDcI6dAl TNkaB8aHRSUtrlrhv63TB6eeEPYPkatrFy0SUrqY0ytZH7YN2oFzfMfS9JxI4bTYml2T OzXJO0kgLrIny/3PmBPeLX4W8qNmFDfRIy8xAVMwbFf8jlMXoU/P7uLwzs7+m2r07mO9 DKM603ne1sPkHK//lLcjmFnx7mtYDRtHLXy3OggmfekLAvVvd94N7DIkVJG1NrBTtl9B 6yeqiQ9htgYlF555FTB+P3uGBJTC3T1vTDn5y6zGPRzB5SFQTWwznbEr6Vcul0ClVVH2 b4aA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=vGfaD6DFqtit3lq+g2Am3FVrJgY7obY6zYu7kNmF04c=; b=m4RcVTGXOhkGNj6IOECKm3WYZbJRsnql5BRqG1VA35vzeJiid9R5hOlz7S0XLcnLee 8N6xOmHMejQ/dFLooGmEuFODHiq0HYHEm0hODqB6wjnm25bq+K8diUjN7upx7sj7WJ8N 9qASDdwhh2MPr3S4068Au7DfcLZH6KnNLySwnstzyMBEFPJW0KDZXOP2c4cYroaL7GMK TcdRWQH7zFPU6htoKNEVfeW9HEh9Rcpheo5fWlVOkPHiby6Ee7lWhxa94aSMASpa4Nxg c0h1xEo2bYDG4lqlMSMgE9USeMMMfcSzvRFsuXcCODCNge+pJfq1wizy+j9KltvPK4xM dX4A== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l15-v6si17981940pgh.593.2018.09.03.10.25.51; Mon, 03 Sep 2018 10:26:06 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730202AbeICVpF (ORCPT + 99 others); Mon, 3 Sep 2018 17:45:05 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:45448 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727516AbeICVpE (ORCPT ); Mon, 3 Sep 2018 17:45:04 -0400 Received: from localhost (ip-213-127-74-90.ip.prioritytelecom.net [213.127.74.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 74AB0D24; Mon, 3 Sep 2018 17:23:57 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Govindarajulu Varadarajan , "David S. Miller" , Sasha Levin Subject: [PATCH 4.14 063/165] enic: handle mtu change for vf properly Date: Mon, 3 Sep 2018 18:55:49 +0200 Message-Id: <20180903165658.285199004@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180903165655.003605184@linuxfoundation.org> References: <20180903165655.003605184@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Govindarajulu Varadarajan [ Upstream commit ab123fe071c9aa9680ecd62eb080eb26cff4892c ] When driver gets notification for mtu change, driver does not handle it for all RQs. It handles only RQ[0]. Fix is to use enic_change_mtu() interface to change mtu for vf. Signed-off-by: Govindarajulu Varadarajan Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/cisco/enic/enic_main.c | 78 +++++++++------------------- 1 file changed, 27 insertions(+), 51 deletions(-) --- a/drivers/net/ethernet/cisco/enic/enic_main.c +++ b/drivers/net/ethernet/cisco/enic/enic_main.c @@ -2007,28 +2007,42 @@ static int enic_stop(struct net_device * return 0; } +static int _enic_change_mtu(struct net_device *netdev, int new_mtu) +{ + bool running = netif_running(netdev); + int err = 0; + + ASSERT_RTNL(); + if (running) { + err = enic_stop(netdev); + if (err) + return err; + } + + netdev->mtu = new_mtu; + + if (running) { + err = enic_open(netdev); + if (err) + return err; + } + + return 0; +} + static int enic_change_mtu(struct net_device *netdev, int new_mtu) { struct enic *enic = netdev_priv(netdev); - int running = netif_running(netdev); if (enic_is_dynamic(enic) || enic_is_sriov_vf(enic)) return -EOPNOTSUPP; - if (running) - enic_stop(netdev); - - netdev->mtu = new_mtu; - if (netdev->mtu > enic->port_mtu) netdev_warn(netdev, - "interface MTU (%d) set higher than port MTU (%d)\n", - netdev->mtu, enic->port_mtu); - - if (running) - enic_open(netdev); + "interface MTU (%d) set higher than port MTU (%d)\n", + netdev->mtu, enic->port_mtu); - return 0; + return _enic_change_mtu(netdev, new_mtu); } static void enic_change_mtu_work(struct work_struct *work) @@ -2036,47 +2050,9 @@ static void enic_change_mtu_work(struct struct enic *enic = container_of(work, struct enic, change_mtu_work); struct net_device *netdev = enic->netdev; int new_mtu = vnic_dev_mtu(enic->vdev); - int err; - unsigned int i; - - new_mtu = max_t(int, ENIC_MIN_MTU, min_t(int, ENIC_MAX_MTU, new_mtu)); rtnl_lock(); - - /* Stop RQ */ - del_timer_sync(&enic->notify_timer); - - for (i = 0; i < enic->rq_count; i++) - napi_disable(&enic->napi[i]); - - vnic_intr_mask(&enic->intr[0]); - enic_synchronize_irqs(enic); - err = vnic_rq_disable(&enic->rq[0]); - if (err) { - rtnl_unlock(); - netdev_err(netdev, "Unable to disable RQ.\n"); - return; - } - vnic_rq_clean(&enic->rq[0], enic_free_rq_buf); - vnic_cq_clean(&enic->cq[0]); - vnic_intr_clean(&enic->intr[0]); - - /* Fill RQ with new_mtu-sized buffers */ - netdev->mtu = new_mtu; - vnic_rq_fill(&enic->rq[0], enic_rq_alloc_buf); - /* Need at least one buffer on ring to get going */ - if (vnic_rq_desc_used(&enic->rq[0]) == 0) { - rtnl_unlock(); - netdev_err(netdev, "Unable to alloc receive buffers.\n"); - return; - } - - /* Start RQ */ - vnic_rq_enable(&enic->rq[0]); - napi_enable(&enic->napi[0]); - vnic_intr_unmask(&enic->intr[0]); - enic_notify_timer_start(enic); - + (void)_enic_change_mtu(netdev, new_mtu); rtnl_unlock(); netdev_info(netdev, "interface MTU set as %d\n", netdev->mtu);