From patchwork Thu Jun 18 00:49:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taku Izumi X-Patchwork-Id: 6632251 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5CA44C0433 for ; Thu, 18 Jun 2015 00:53:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8D940207D1 for ; Thu, 18 Jun 2015 00:53:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 98EEF207E6 for ; Thu, 18 Jun 2015 00:53:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753321AbbFRAxe (ORCPT ); Wed, 17 Jun 2015 20:53:34 -0400 Received: from mgwkm02.jp.fujitsu.com ([202.219.69.169]:15820 "EHLO mgwkm02.jp.fujitsu.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751406AbbFRAxY (ORCPT ); Wed, 17 Jun 2015 20:53:24 -0400 Received: from kw-mxoi2.gw.nic.fujitsu.com (unknown [192.168.231.133]) by mgwkm02.jp.fujitsu.com with smtp id 0b7c_35bf_143c40d8_2d20_4cbd_941d_e6b7f581287c; Thu, 18 Jun 2015 09:53:21 +0900 Received: from m3050.s.css.fujitsu.com (msm.b.css.fujitsu.com [10.134.21.208]) by kw-mxoi2.gw.nic.fujitsu.com (Postfix) with ESMTP id 1EA16AC0414; Thu, 18 Jun 2015 09:53:21 +0900 (JST) Received: from localhost.localdomain (unknown [10.124.196.197]) by m3050.s.css.fujitsu.com (Postfix) with ESMTP id D513216F; Thu, 18 Jun 2015 09:53:20 +0900 (JST) From: Taku Izumi To: platform-driver-x86@vger.kernel.org, dvhart@infradead.org Cc: rkhan@redhat.com, alexander.h.duyck@redhat.com, netdev@vger.kernel.org, linux-acpi@vger.kernel.org, Taku Izumi Subject: [PATCH 13/22] fjes: net_device_ops.ndo_change_mtu Date: Thu, 18 Jun 2015 09:49:38 +0900 Message-Id: <1434588587-25655-13-git-send-email-izumi.taku@jp.fujitsu.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1434588587-25655-1-git-send-email-izumi.taku@jp.fujitsu.com> References: <1434588359-25589-1-git-send-email-izumi.taku@jp.fujitsu.com> <1434588587-25655-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=-7.5 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/platform/x86/fjes/fjes_main.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/drivers/platform/x86/fjes/fjes_main.c b/drivers/platform/x86/fjes/fjes_main.c index eeda824..72541a7 100644 --- a/drivers/platform/x86/fjes/fjes_main.c +++ b/drivers/platform/x86/fjes/fjes_main.c @@ -59,6 +59,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 *); @@ -226,6 +227,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, }; /* @@ -748,6 +750,34 @@ static struct rtnl_link_stats64 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;