aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/fjes
diff options
context:
space:
mode:
authorTaku Izumi <izumi.taku@jp.fujitsu.com>2015-08-21 17:29:29 +0900
committerDavid S. Miller <davem@davemloft.net>2015-08-24 14:06:35 -0700
commitb9e23a67d52f956d75e6327a7fccbb53fbdc540b (patch)
treebc8a9e55f0bb5aa90622ef49daf09d191ced4fd5 /drivers/net/fjes
parentfjes: net_device_ops.ndo_get_stats64 (diff)
downloadlinux-dev-b9e23a67d52f956d75e6327a7fccbb53fbdc540b.tar.xz
linux-dev-b9e23a67d52f956d75e6327a7fccbb53fbdc540b.zip
fjes: net_device_ops.ndo_change_mtu
This patch adds net_device_ops.ndo_change_mtu. Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/fjes')
-rw-r--r--drivers/net/fjes/fjes_main.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/drivers/net/fjes/fjes_main.c b/drivers/net/fjes/fjes_main.c
index 20feb3e0aa64..519976cd4d9e 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 */
@@ -713,6 +715,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)
+{
+ bool running = netif_running(netdev);
+ int ret = 0;
+ int idx;
+
+ 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;