aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAurelien Jacquiot <a-jacquiot@ti.com>2016-03-22 17:25:45 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-03-22 18:36:02 -0400
commit92444bb366ab6ace213c67e7dfea20fabe14adff (patch)
treeab88e08921baaa21752a751293d63e0ba0afc217
parent36915976eca58f2eefa040ba8f9939672564df61 (diff)
rapidio/rionet: add capability to change MTU
These patches are the result of extensive collaboration within the RapidIO.org Software Task Group between Texas Instruments, Freescale, Prodrive Technologies, Nokia Networks, BAE and IDT. Additional input was received from other members of RapidIO.org. The objective was to create a character mode driver interface which exposes the capabilities of RapidIO devices directly to applications, in a manner that allows the numerous and varied RapidIO implementations to interoperate. The Software Task Group has also developed fabric management, Remote Memory Access, and sockets applications which make use of these interfaces in user space. Intensive testing with these applications prompted the RapidIO subsystem updates provided within this set of patches. This patch (of 29): 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> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/net/rionet.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/net/rionet.c b/drivers/net/rionet.c
index e7034c55e796..d3d6e35a30e0 100644
--- a/drivers/net/rionet.c
+++ b/drivers/net/rionet.c
@@ -48,6 +48,8 @@ MODULE_LICENSE("GPL");
48#define RIONET_TX_RING_SIZE CONFIG_RIONET_TX_SIZE 48#define RIONET_TX_RING_SIZE CONFIG_RIONET_TX_SIZE
49#define RIONET_RX_RING_SIZE CONFIG_RIONET_RX_SIZE 49#define RIONET_RX_RING_SIZE CONFIG_RIONET_RX_SIZE
50#define RIONET_MAX_NETS 8 50#define RIONET_MAX_NETS 8
51#define RIONET_MSG_SIZE RIO_MAX_MSG_SIZE
52#define RIONET_MAX_MTU (RIONET_MSG_SIZE - ETH_HLEN)
51 53
52struct rionet_private { 54struct rionet_private {
53 struct rio_mport *mport; 55 struct rio_mport *mport;
@@ -443,6 +445,17 @@ static void rionet_set_msglevel(struct net_device *ndev, u32 value)
443 rnet->msg_enable = value; 445 rnet->msg_enable = value;
444} 446}
445 447
448static int rionet_change_mtu(struct net_device *ndev, int new_mtu)
449{
450 if ((new_mtu < 68) || (new_mtu > RIONET_MAX_MTU)) {
451 printk(KERN_ERR "%s: Invalid MTU size %d\n",
452 ndev->name, new_mtu);
453 return -EINVAL;
454 }
455 ndev->mtu = new_mtu;
456 return 0;
457}
458
446static const struct ethtool_ops rionet_ethtool_ops = { 459static const struct ethtool_ops rionet_ethtool_ops = {
447 .get_drvinfo = rionet_get_drvinfo, 460 .get_drvinfo = rionet_get_drvinfo,
448 .get_msglevel = rionet_get_msglevel, 461 .get_msglevel = rionet_get_msglevel,
@@ -454,7 +467,7 @@ static const struct net_device_ops rionet_netdev_ops = {
454 .ndo_open = rionet_open, 467 .ndo_open = rionet_open,
455 .ndo_stop = rionet_close, 468 .ndo_stop = rionet_close,
456 .ndo_start_xmit = rionet_start_xmit, 469 .ndo_start_xmit = rionet_start_xmit,
457 .ndo_change_mtu = eth_change_mtu, 470 .ndo_change_mtu = rionet_change_mtu,
458 .ndo_validate_addr = eth_validate_addr, 471 .ndo_validate_addr = eth_validate_addr,
459 .ndo_set_mac_address = eth_mac_addr, 472 .ndo_set_mac_address = eth_mac_addr,
460}; 473};
@@ -489,7 +502,7 @@ static int rionet_setup_netdev(struct rio_mport *mport, struct net_device *ndev)
489 ndev->dev_addr[5] = device_id & 0xff; 502 ndev->dev_addr[5] = device_id & 0xff;
490 503
491 ndev->netdev_ops = &rionet_netdev_ops; 504 ndev->netdev_ops = &rionet_netdev_ops;
492 ndev->mtu = RIO_MAX_MSG_SIZE - 14; 505 ndev->mtu = RIONET_MAX_MTU;
493 ndev->features = NETIF_F_LLTX; 506 ndev->features = NETIF_F_LLTX;
494 SET_NETDEV_DEV(ndev, &mport->dev); 507 SET_NETDEV_DEV(ndev, &mport->dev);
495 ndev->ethtool_ops = &rionet_ethtool_ops; 508 ndev->ethtool_ops = &rionet_ethtool_ops;