diff options
author | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2007-04-03 17:55:40 -0400 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2007-04-29 18:00:31 -0400 |
commit | 17bab407d54ba1320d71a45641ecffc33bd331c1 (patch) | |
tree | f22e2a2cf6daaee3d5461d12f162083ba11d38da /drivers | |
parent | f982e5ffcfa9d0a2480d0b8261bd11521f3a1994 (diff) |
ieee1394: eth1394: allow MTU bigger than 1500
RFC 2734 says: "IP-capable nodes may operate with an MTU size larger
than the default [1500 octets], but the means by which a larger MTU is
configured are beyond the scope of this document."
Allow users to set an MTU bigger than 1500.
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ieee1394/eth1394.c | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/drivers/ieee1394/eth1394.c b/drivers/ieee1394/eth1394.c index 8f19f5b77a59..aee82922e6b7 100644 --- a/drivers/ieee1394/eth1394.c +++ b/drivers/ieee1394/eth1394.c | |||
@@ -136,9 +136,6 @@ static const int hdr_type_len[] = { | |||
136 | sizeof(struct eth1394_sf_hdr) | 136 | sizeof(struct eth1394_sf_hdr) |
137 | }; | 137 | }; |
138 | 138 | ||
139 | /* For now, this needs to be 1500, so that XP works with us */ | ||
140 | #define ETH1394_DATA_LEN ETH_DATA_LEN | ||
141 | |||
142 | static const u16 eth1394_speedto_maxpayload[] = { | 139 | static const u16 eth1394_speedto_maxpayload[] = { |
143 | /* S100, S200, S400, S800, S1600, S3200 */ | 140 | /* S100, S200, S400, S800, S1600, S3200 */ |
144 | 512, 1024, 2048, 4096, 4096, 4096 | 141 | 512, 1024, 2048, 4096, 4096, 4096 |
@@ -262,17 +259,27 @@ static void ether1394_tx_timeout(struct net_device *dev) | |||
262 | ether1394_host_reset(host); | 259 | ether1394_host_reset(host); |
263 | } | 260 | } |
264 | 261 | ||
262 | static inline int ether1394_max_mtu(struct hpsb_host* host) | ||
263 | { | ||
264 | return (1 << (host->csr.max_rec + 1)) | ||
265 | - sizeof(union eth1394_hdr) - ETHER1394_GASP_OVERHEAD; | ||
266 | } | ||
267 | |||
265 | static int ether1394_change_mtu(struct net_device *dev, int new_mtu) | 268 | static int ether1394_change_mtu(struct net_device *dev, int new_mtu) |
266 | { | 269 | { |
267 | int max_rec = | 270 | int max_mtu; |
268 | ((struct eth1394_priv *)netdev_priv(dev))->host->csr.max_rec; | ||
269 | 271 | ||
270 | if (new_mtu < 68 || | 272 | if (new_mtu < 68) |
271 | new_mtu > ETH1394_DATA_LEN || | ||
272 | new_mtu > (1 << (max_rec + 1)) - sizeof(union eth1394_hdr) - | ||
273 | ETHER1394_GASP_OVERHEAD) | ||
274 | return -EINVAL; | 273 | return -EINVAL; |
275 | 274 | ||
275 | max_mtu = ether1394_max_mtu( | ||
276 | ((struct eth1394_priv *)netdev_priv(dev))->host); | ||
277 | if (new_mtu > max_mtu) { | ||
278 | ETH1394_PRINT(KERN_INFO, dev->name, | ||
279 | "Local node constrains MTU to %d\n", max_mtu); | ||
280 | return -ERANGE; | ||
281 | } | ||
282 | |||
276 | dev->mtu = new_mtu; | 283 | dev->mtu = new_mtu; |
277 | return 0; | 284 | return 0; |
278 | } | 285 | } |
@@ -476,13 +483,10 @@ static void ether1394_reset_priv(struct net_device *dev, int set_mtu) | |||
476 | max_speed = host->speed[i]; | 483 | max_speed = host->speed[i]; |
477 | priv->bc_sspd = max_speed; | 484 | priv->bc_sspd = max_speed; |
478 | 485 | ||
479 | /* We'll use our maximum payload as the default MTU */ | ||
480 | if (set_mtu) { | 486 | if (set_mtu) { |
481 | int max_payload = 1 << (host->csr.max_rec + 1); | 487 | /* Use the RFC 2734 default 1500 octets or the maximum payload |
482 | 488 | * as initial MTU */ | |
483 | dev->mtu = min(ETH1394_DATA_LEN, | 489 | dev->mtu = min(1500, ether1394_max_mtu(host)); |
484 | (int)(max_payload - sizeof(union eth1394_hdr) - | ||
485 | ETHER1394_GASP_OVERHEAD)); | ||
486 | 490 | ||
487 | /* Set our hardware address while we're at it */ | 491 | /* Set our hardware address while we're at it */ |
488 | memcpy(dev->dev_addr, &guid, sizeof(u64)); | 492 | memcpy(dev->dev_addr, &guid, sizeof(u64)); |