diff options
author | raghavendra.koushik@neterion.com <raghavendra.koushik@neterion.com> | 2005-08-03 15:33:12 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-08-11 00:10:45 -0400 |
commit | d8892c6ee39614bc6d282dbef0ff9fa461a6467c (patch) | |
tree | 676ff9cba6f3f8bff8715c7f78cf3d1cea473872 /drivers/net/s2io.c | |
parent | fe113638328995b69d8797e6466b29661b1602d1 (diff) |
[PATCH] S2io: Support for runtime MTU change
Hi,
Patch below supports MTU change on-the-fly(without bringing interface
down)
Signed-off-by: Ravinandan Arakali <ravinandan.arakali@neterion.com>
Signed-off-by: Raghavendra Koushik <raghavendra.koushik@neterion.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'drivers/net/s2io.c')
-rw-r--r-- | drivers/net/s2io.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c index 28d6d3746c80..aff1fb74e14b 100644 --- a/drivers/net/s2io.c +++ b/drivers/net/s2io.c | |||
@@ -2849,6 +2849,7 @@ int s2io_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2849 | } | 2849 | } |
2850 | 2850 | ||
2851 | txdp->Control_2 |= config->tx_intr_type; | 2851 | txdp->Control_2 |= config->tx_intr_type; |
2852 | |||
2852 | txdp->Control_1 |= (TXD_BUFFER0_SIZE(frg_len) | | 2853 | txdp->Control_1 |= (TXD_BUFFER0_SIZE(frg_len) | |
2853 | TXD_GATHER_CODE_FIRST); | 2854 | TXD_GATHER_CODE_FIRST); |
2854 | txdp->Control_1 |= TXD_LIST_OWN_XENA; | 2855 | txdp->Control_1 |= TXD_LIST_OWN_XENA; |
@@ -4246,14 +4247,6 @@ int s2io_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | |||
4246 | int s2io_change_mtu(struct net_device *dev, int new_mtu) | 4247 | int s2io_change_mtu(struct net_device *dev, int new_mtu) |
4247 | { | 4248 | { |
4248 | nic_t *sp = dev->priv; | 4249 | nic_t *sp = dev->priv; |
4249 | XENA_dev_config_t __iomem *bar0 = sp->bar0; | ||
4250 | register u64 val64; | ||
4251 | |||
4252 | if (netif_running(dev)) { | ||
4253 | DBG_PRINT(ERR_DBG, "%s: Must be stopped to ", dev->name); | ||
4254 | DBG_PRINT(ERR_DBG, "change its MTU\n"); | ||
4255 | return -EBUSY; | ||
4256 | } | ||
4257 | 4250 | ||
4258 | if ((new_mtu < MIN_MTU) || (new_mtu > S2IO_JUMBO_SIZE)) { | 4251 | if ((new_mtu < MIN_MTU) || (new_mtu > S2IO_JUMBO_SIZE)) { |
4259 | DBG_PRINT(ERR_DBG, "%s: MTU size is invalid.\n", | 4252 | DBG_PRINT(ERR_DBG, "%s: MTU size is invalid.\n", |
@@ -4261,11 +4254,22 @@ int s2io_change_mtu(struct net_device *dev, int new_mtu) | |||
4261 | return -EPERM; | 4254 | return -EPERM; |
4262 | } | 4255 | } |
4263 | 4256 | ||
4264 | /* Set the new MTU into the PYLD register of the NIC */ | ||
4265 | val64 = new_mtu; | ||
4266 | writeq(vBIT(val64, 2, 14), &bar0->rmac_max_pyld_len); | ||
4267 | |||
4268 | dev->mtu = new_mtu; | 4257 | dev->mtu = new_mtu; |
4258 | if (netif_running(dev)) { | ||
4259 | s2io_card_down(sp); | ||
4260 | netif_stop_queue(dev); | ||
4261 | if (s2io_card_up(sp)) { | ||
4262 | DBG_PRINT(ERR_DBG, "%s: Device bring up failed\n", | ||
4263 | __FUNCTION__); | ||
4264 | } | ||
4265 | if (netif_queue_stopped(dev)) | ||
4266 | netif_wake_queue(dev); | ||
4267 | } else { /* Device is down */ | ||
4268 | XENA_dev_config_t __iomem *bar0 = sp->bar0; | ||
4269 | u64 val64 = new_mtu; | ||
4270 | |||
4271 | writeq(vBIT(val64, 2, 14), &bar0->rmac_max_pyld_len); | ||
4272 | } | ||
4269 | 4273 | ||
4270 | return 0; | 4274 | return 0; |
4271 | } | 4275 | } |