From patchwork Thu Jul 23 00:10:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taku Izumi X-Patchwork-Id: 6848301 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3938D9F38C for ; Thu, 23 Jul 2015 00:15:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 57589206D4 for ; Thu, 23 Jul 2015 00:15:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1CDB2206D7 for ; Thu, 23 Jul 2015 00:15:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753651AbbGWAPW (ORCPT ); Wed, 22 Jul 2015 20:15:22 -0400 Received: from mgwym04.jp.fujitsu.com ([211.128.242.43]:14677 "EHLO mgwym04.jp.fujitsu.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753628AbbGWAPU (ORCPT ); Wed, 22 Jul 2015 20:15:20 -0400 Received: from yt-mxoi2.gw.nic.fujitsu.com (unknown [192.168.229.69]) by mgwym04.jp.fujitsu.com with smtp id 7534_3f76_dda6f45a_ccd2_447e_90b3_3e3a9c8150bd; Thu, 23 Jul 2015 09:15:18 +0900 Received: from m3051.s.css.fujitsu.com (m3051.s.css.fujitsu.com [10.134.21.209]) by yt-mxoi2.gw.nic.fujitsu.com (Postfix) with ESMTP id E0D07AC02E1; Thu, 23 Jul 2015 09:15:17 +0900 (JST) Received: from RX300S6 (unknown [10.124.196.197]) by m3051.s.css.fujitsu.com (Postfix) with SMTP id 9FE9A1F2; Thu, 23 Jul 2015 09:15:16 +0900 (JST) Received: by RX300S6 (sSMTP sendmail emulation); Thu, 23 Jul 2015 09:11:18 +0900 From: Taku Izumi To: netdev@vger.kernel.org, davem@davemloft.net Cc: platform-driver-x86@vger.kernel.org, dvhart@infradead.org, rkhan@redhat.com, alexander.h.duyck@redhat.com, linux-acpi@vger.kernel.org, joe@perches.com, sergei.shtylyov@cogentembedded.com, stephen@networkplumber.org, yasu.isimatu@gmail.com, Taku Izumi Subject: [PATCH v2.1 13/22] fjes: net_device_ops.ndo_change_mtu Date: Thu, 23 Jul 2015 09:10:27 +0900 Message-Id: <1437610236-12490-13-git-send-email-izumi.taku@jp.fujitsu.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1437610236-12490-1-git-send-email-izumi.taku@jp.fujitsu.com> References: <1437610142-12439-1-git-send-email-izumi.taku@jp.fujitsu.com> <1437610236-12490-1-git-send-email-izumi.taku@jp.fujitsu.com> X-TM-AS-MML: disable Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds net_device_ops.ndo_change_mtu. Signed-off-by: Taku Izumi --- drivers/net/fjes/fjes_main.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/drivers/net/fjes/fjes_main.c b/drivers/net/fjes/fjes_main.c index 842edbb..bb94890 100644 --- a/drivers/net/fjes/fjes_main.c +++ b/drivers/net/fjes/fjes_main.c @@ -57,6 +57,7 @@ static void fjes_tx_stall_task(struct work_struct *); static irqreturn_t fjes_intr(int, void*); static struct rtnl_link_stats64 * fjes_get_stats64(struct net_device *, struct rtnl_link_stats64 *); +static int fjes_change_mtu(struct net_device *, int); static int fjes_acpi_add(struct acpi_device *); static int fjes_acpi_remove(struct acpi_device *); @@ -222,6 +223,7 @@ static const struct net_device_ops fjes_netdev_ops = { .ndo_stop = fjes_close, .ndo_start_xmit = fjes_xmit_frame, .ndo_get_stats64 = fjes_get_stats64, + .ndo_change_mtu = fjes_change_mtu, }; /* fjes_open - Called when a network interface is made active */ @@ -715,6 +717,33 @@ fjes_get_stats64(struct net_device *netdev, struct rtnl_link_stats64 *stats) return stats; } +static int fjes_change_mtu(struct net_device *netdev, int new_mtu) +{ + int idx; + bool running = netif_running(netdev); + int ret = 0; + + for (idx = 0; fjes_support_mtu[idx] != 0; idx++) { + if (new_mtu <= fjes_support_mtu[idx]) { + new_mtu = fjes_support_mtu[idx]; + if (new_mtu == netdev->mtu) + return 0; + + if (running) + fjes_close(netdev); + + netdev->mtu = new_mtu; + + if (running) + ret = fjes_open(netdev); + + return ret; + } + } + + return -EINVAL; +} + static irqreturn_t fjes_intr(int irq, void *data) { struct fjes_adapter *adapter = data;