From patchwork Fri Feb 5 23:19:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bounine X-Patchwork-Id: 61359 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp252806lbl; Fri, 5 Feb 2016 15:30:55 -0800 (PST) X-Received: by 10.67.30.201 with SMTP id kg9mr23850969pad.132.1454715054912; Fri, 05 Feb 2016 15:30:54 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id zd6si26749390pac.222.2016.02.05.15.30.54; Fri, 05 Feb 2016 15:30:54 -0800 (PST) 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 S1751885AbcBEXax (ORCPT + 30 others); Fri, 5 Feb 2016 18:30:53 -0500 Received: from mxout1.idt.com ([157.165.5.25]:40099 "EHLO mxout1.idt.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750911AbcBEX2g (ORCPT ); Fri, 5 Feb 2016 18:28:36 -0500 X-Greylist: delayed 506 seconds by postgrey-1.27 at vger.kernel.org; Fri, 05 Feb 2016 18:28:35 EST Received: from mail.idt.com (localhost [127.0.0.1]) by mxout1.idt.com (8.13.1/8.13.1) with ESMTP id u15NK46S018378; Fri, 5 Feb 2016 15:20:04 -0800 Received: from corpml3.corp.idt.com (corpml3.corp.idt.com [157.165.140.25]) by mail.idt.com (8.13.8/8.13.8) with ESMTP id u15NK3rn025867; Fri, 5 Feb 2016 15:20:03 -0800 (PST) Received: from kaneng03.ott.idt.com (corpimss.corp.idt.com [157.165.140.30]) by corpml3.corp.idt.com (8.11.7p1+Sun/8.11.7) with ESMTP id u15NK1v23848; Fri, 5 Feb 2016 15:20:01 -0800 (PST) Received: (from abounine@localhost) by kaneng03.ott.idt.com (8.14.4/8.13.8/Submit) id u15NK1Sd015326; Fri, 5 Feb 2016 18:20:01 -0500 From: Alexandre Bounine To: Andrew Morton Cc: Aurelien Jacquiot , Alexandre Bounine , Matt Porter , Andre van Herk , linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH 02/30] rapidio/rionet: add capability to change MTU Date: Fri, 5 Feb 2016 18:19:18 -0500 Message-Id: <1454714386-15259-3-git-send-email-alexandre.bounine@idt.com> X-Mailer: git-send-email 1.7.8.4 In-Reply-To: <1454714386-15259-1-git-send-email-alexandre.bounine@idt.com> References: <1454714386-15259-1-git-send-email-alexandre.bounine@idt.com> X-TM-AS-MML: disable X-Scanned-By: MIMEDefang 2.43 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Aurelien Jacquiot Replace default Ethernet-specific routine by the custom one to allow setting of larger MTU supported by RapidIO messaging (max RIO packet size is 4096 bytes). Signed-off-by: Aurelien Jacquiot Signed-off-by: Alexandre Bounine Cc: Matt Porter Cc: Andre van Herk Cc: linux-kernel@vger.kernel.org Cc: netdev@vger.kernel.org --- drivers/net/rionet.c | 17 +++++++++++++++-- 1 files changed, 15 insertions(+), 2 deletions(-) -- 1.7.8.4 diff --git a/drivers/net/rionet.c b/drivers/net/rionet.c index e7034c5..d3d6e35 100644 --- a/drivers/net/rionet.c +++ b/drivers/net/rionet.c @@ -48,6 +48,8 @@ MODULE_LICENSE("GPL"); #define RIONET_TX_RING_SIZE CONFIG_RIONET_TX_SIZE #define RIONET_RX_RING_SIZE CONFIG_RIONET_RX_SIZE #define RIONET_MAX_NETS 8 +#define RIONET_MSG_SIZE RIO_MAX_MSG_SIZE +#define RIONET_MAX_MTU (RIONET_MSG_SIZE - ETH_HLEN) struct rionet_private { struct rio_mport *mport; @@ -443,6 +445,17 @@ static void rionet_set_msglevel(struct net_device *ndev, u32 value) rnet->msg_enable = value; } +static int rionet_change_mtu(struct net_device *ndev, int new_mtu) +{ + if ((new_mtu < 68) || (new_mtu > RIONET_MAX_MTU)) { + printk(KERN_ERR "%s: Invalid MTU size %d\n", + ndev->name, new_mtu); + return -EINVAL; + } + ndev->mtu = new_mtu; + return 0; +} + static const struct ethtool_ops rionet_ethtool_ops = { .get_drvinfo = rionet_get_drvinfo, .get_msglevel = rionet_get_msglevel, @@ -454,7 +467,7 @@ static const struct net_device_ops rionet_netdev_ops = { .ndo_open = rionet_open, .ndo_stop = rionet_close, .ndo_start_xmit = rionet_start_xmit, - .ndo_change_mtu = eth_change_mtu, + .ndo_change_mtu = rionet_change_mtu, .ndo_validate_addr = eth_validate_addr, .ndo_set_mac_address = eth_mac_addr, }; @@ -489,7 +502,7 @@ static int rionet_setup_netdev(struct rio_mport *mport, struct net_device *ndev) ndev->dev_addr[5] = device_id & 0xff; ndev->netdev_ops = &rionet_netdev_ops; - ndev->mtu = RIO_MAX_MSG_SIZE - 14; + ndev->mtu = RIONET_MAX_MTU; ndev->features = NETIF_F_LLTX; SET_NETDEV_DEV(ndev, &mport->dev); ndev->ethtool_ops = &rionet_ethtool_ops;