Skip to content

Instantly share code, notes, and snippets.

@jevinskie
Created August 31, 2018 06:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jevinskie/945199a90858319642ded49df632554e to your computer and use it in GitHub Desktop.
Save jevinskie/945199a90858319642ded49df632554e to your computer and use it in GitHub Desktop.
Patch to create a module parameter to control the maximum MTU size on PS3 Linux
diff --git a/drivers/net/ps3_gelic_net.c b/drivers/net/ps3_gelic_net.c
index 4532bc7..8e70981 100644
--- a/drivers/net/ps3_gelic_net.c
+++ b/drivers/net/ps3_gelic_net.c
@@ -54,6 +54,9 @@ MODULE_AUTHOR("SCE Inc.");
MODULE_DESCRIPTION("Gelic Network driver");
MODULE_LICENSE("GPL");
+static int max_mtu = VLAN_ETH_FRAME_LEN;
+module_param(max_mtu, int, S_IRUGO);
+MODULE_PARM_DESC(max_mtu, "Maximum MTU");
static int disable_eurus_ctrl_iface = 0;
module_param(disable_eurus_ctrl_iface, bool, S_IRUGO);
MODULE_PARM_DESC(disable_eurus_ctrl_iface, "Disable EURUS control interface");
@@ -1127,7 +1130,7 @@ int gelic_net_change_mtu(struct net_device *netdev, int new_mtu)
/* no need to re-alloc skbs or so -- the max mtu is about 2.3k
* and mtu is outbound only anyway */
if ((new_mtu < GELIC_NET_MIN_MTU) ||
- (new_mtu > GELIC_NET_MAX_MTU)) {
+ (new_mtu > max_mtu)) {
return -EINVAL;
}
netdev->mtu = new_mtu;
diff --git a/drivers/net/ps3_gelic_net.h b/drivers/net/ps3_gelic_net.h
index fadadf9..804bed8 100644
--- a/drivers/net/ps3_gelic_net.h
+++ b/drivers/net/ps3_gelic_net.h
@@ -32,7 +32,8 @@
#define GELIC_NET_RX_DESCRIPTORS 128 /* num of descriptors */
#define GELIC_NET_TX_DESCRIPTORS 128 /* num of descriptors */
-#define GELIC_NET_MAX_MTU VLAN_ETH_FRAME_LEN
+#define GELIC_NET_MAX_MTU 10000
#define GELIC_NET_MIN_MTU VLAN_ETH_ZLEN
#define GELIC_NET_RXBUF_ALIGN 128
#define GELIC_CARD_RX_CSUM_DEFAULT 1 /* hw chksum */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment