Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1328157

[PATCH 02/30] rapidio/rionet: add capability to change MTU

From Alexandre Bounine <alexandre.bounine@idt.com>
Newsgroups linux.kernel
Subject [PATCH 02/30] rapidio/rionet: add capability to change MTU
Date 2016-02-06 00:40 +0100
Message-ID <qYY8P-75F-37@gated-at.bofh.it> (permalink)
References <qYXZ7-6YG-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Aurelien Jacquiot <a-jacquiot@ti.com>

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 <a-jacquiot@ti.com>
Signed-off-by: Alexandre Bounine <alexandre.bounine@idt.com>
Cc: Matt Porter <mporter@kernel.crashing.org>
Cc: Andre van Herk <andre.van.herk@prodrive-technologies.com>
Cc: linux-kernel@vger.kernel.org
Cc: netdev@vger.kernel.org
---
 drivers/net/rionet.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

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;
-- 
1.7.8.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/30] rapidio: mport character driver and subsystem updates Alexandre Bounine <alexandre.bounine@idt.com> - 2016-02-06 00:40 +0100
  [PATCH 23/30] rapidio/tsi721: fix locking in OB_MSG processing Alexandre Bounine <alexandre.bounine@idt.com> - 2016-02-06 00:40 +0100
  [PATCH 12/30] rapidio: rework common RIO device add/delete routines Alexandre Bounine <alexandre.bounine@idt.com> - 2016-02-06 00:40 +0100
  [PATCH 03/30] rapidio/tsi721: fix hardcoded MRRS setting Alexandre Bounine <alexandre.bounine@idt.com> - 2016-02-06 00:40 +0100
  [PATCH 17/30] rapidio/rionet: add locking into add/remove device Alexandre Bounine <alexandre.bounine@idt.com> - 2016-02-06 00:40 +0100
  [PATCH 08/30] rapidio/tsi721: add query_mport callback Alexandre Bounine <alexandre.bounine@idt.com> - 2016-02-06 00:40 +0100
  [PATCH 06/30] rapidio/tsi721_dma: fix pending transaction queue handling Alexandre Bounine <alexandre.bounine@idt.com> - 2016-02-06 00:40 +0100
  [PATCH 11/30] rapidio/rionet: add shutdown event handling Alexandre Bounine <alexandre.bounine@idt.com> - 2016-02-06 00:40 +0100
  [PATCH 02/30] rapidio/rionet: add capability to change MTU Alexandre Bounine <alexandre.bounine@idt.com> - 2016-02-06 00:40 +0100
  [PATCH 10/30] rapidio/tsi721: add shutdown notification callback Alexandre Bounine <alexandre.bounine@idt.com> - 2016-02-06 00:40 +0100
  [PATCH 04/30] rapidio/tsi721: add check for overlapped IB window mappings Alexandre Bounine <alexandre.bounine@idt.com> - 2016-02-06 00:40 +0100
  [PATCH 19/30] rapidio: add lock protection for doorbell list Alexandre Bounine <alexandre.bounine@idt.com> - 2016-02-06 00:40 +0100
  [PATCH 25/30] rapidio/tsi721: add outbound windows mapping support Alexandre Bounine <alexandre.bounine@idt.com> - 2016-02-06 00:40 +0100
  [PATCH 24/30] rapidio: add outbound window support Alexandre Bounine <alexandre.bounine@idt.com> - 2016-02-06 00:40 +0100

csiph-web