diff options
author | David L Stevens <david.stevens@oracle.com> | 2014-09-29 19:48:18 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-09-30 17:10:39 -0400 |
commit | 42db672dca5b74f9c85c318b74b3b298e86cbe8e (patch) | |
tree | 01d6e63b6aca18dd889f0a3e6030028ad9ff019b /drivers/net/ethernet/sun | |
parent | 8e845f4cbbd2ef81846c2ab5dca46d88fb2717ee (diff) |
sunvnet: allow admin to set sunvnet MTU
This patch allows an admin to set the MTU on a sunvnet device to arbitrary
values between the minimum (68) and maximum (65535) IPv4 packet sizes.
Signed-off-by: David L Stevens <david.stevens@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/sun')
-rw-r--r-- | drivers/net/ethernet/sun/sunvnet.c | 7 | ||||
-rw-r--r-- | drivers/net/ethernet/sun/sunvnet.h | 6 |
2 files changed, 9 insertions, 4 deletions
diff --git a/drivers/net/ethernet/sun/sunvnet.c b/drivers/net/ethernet/sun/sunvnet.c index 8f5f4e3291a4..39804715bf22 100644 --- a/drivers/net/ethernet/sun/sunvnet.c +++ b/drivers/net/ethernet/sun/sunvnet.c | |||
@@ -913,6 +913,9 @@ static int vnet_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
913 | if (unlikely(!skb)) | 913 | if (unlikely(!skb)) |
914 | goto out_dropped; | 914 | goto out_dropped; |
915 | 915 | ||
916 | if (skb->len > port->rmtu) | ||
917 | goto out_dropped; | ||
918 | |||
916 | spin_lock_irqsave(&port->vio.lock, flags); | 919 | spin_lock_irqsave(&port->vio.lock, flags); |
917 | 920 | ||
918 | dr = &port->vio.drings[VIO_DRIVER_TX_RING]; | 921 | dr = &port->vio.drings[VIO_DRIVER_TX_RING]; |
@@ -944,7 +947,7 @@ static int vnet_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
944 | skb = NULL; | 947 | skb = NULL; |
945 | 948 | ||
946 | err = ldc_map_single(port->vio.lp, start, nlen, | 949 | err = ldc_map_single(port->vio.lp, start, nlen, |
947 | port->tx_bufs[txi].cookies, 2, | 950 | port->tx_bufs[txi].cookies, VNET_MAXCOOKIES, |
948 | (LDC_MAP_SHADOW | LDC_MAP_DIRECT | LDC_MAP_RW)); | 951 | (LDC_MAP_SHADOW | LDC_MAP_DIRECT | LDC_MAP_RW)); |
949 | if (err < 0) { | 952 | if (err < 0) { |
950 | netdev_info(dev, "tx buffer map error %d\n", err); | 953 | netdev_info(dev, "tx buffer map error %d\n", err); |
@@ -1182,7 +1185,7 @@ static void vnet_set_rx_mode(struct net_device *dev) | |||
1182 | 1185 | ||
1183 | static int vnet_change_mtu(struct net_device *dev, int new_mtu) | 1186 | static int vnet_change_mtu(struct net_device *dev, int new_mtu) |
1184 | { | 1187 | { |
1185 | if (new_mtu != ETH_DATA_LEN) | 1188 | if (new_mtu < 68 || new_mtu > 65535) |
1186 | return -EINVAL; | 1189 | return -EINVAL; |
1187 | 1190 | ||
1188 | dev->mtu = new_mtu; | 1191 | dev->mtu = new_mtu; |
diff --git a/drivers/net/ethernet/sun/sunvnet.h b/drivers/net/ethernet/sun/sunvnet.h index 02f507db9951..c91104542619 100644 --- a/drivers/net/ethernet/sun/sunvnet.h +++ b/drivers/net/ethernet/sun/sunvnet.h | |||
@@ -16,7 +16,7 @@ | |||
16 | */ | 16 | */ |
17 | #define VNET_CLEAN_TIMEOUT ((HZ/100)+1) | 17 | #define VNET_CLEAN_TIMEOUT ((HZ/100)+1) |
18 | 18 | ||
19 | #define VNET_MAXPACKET 1518ULL /* ETH_FRAMELEN + VLAN_HDR */ | 19 | #define VNET_MAXPACKET (65535ULL + ETH_HLEN + VLAN_HLEN) |
20 | #define VNET_TX_RING_SIZE 512 | 20 | #define VNET_TX_RING_SIZE 512 |
21 | #define VNET_TX_WAKEUP_THRESH(dr) ((dr)->pending / 4) | 21 | #define VNET_TX_WAKEUP_THRESH(dr) ((dr)->pending / 4) |
22 | 22 | ||
@@ -26,10 +26,12 @@ | |||
26 | */ | 26 | */ |
27 | #define VNET_PACKET_SKIP 6 | 27 | #define VNET_PACKET_SKIP 6 |
28 | 28 | ||
29 | #define VNET_MAXCOOKIES (VNET_MAXPACKET/PAGE_SIZE + 1) | ||
30 | |||
29 | struct vnet_tx_entry { | 31 | struct vnet_tx_entry { |
30 | struct sk_buff *skb; | 32 | struct sk_buff *skb; |
31 | unsigned int ncookies; | 33 | unsigned int ncookies; |
32 | struct ldc_trans_cookie cookies[2]; | 34 | struct ldc_trans_cookie cookies[VNET_MAXCOOKIES]; |
33 | }; | 35 | }; |
34 | 36 | ||
35 | struct vnet; | 37 | struct vnet; |