diff options
-rw-r--r-- | drivers/net/forcedeth.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c index 74ed8bb266ec..e90d27b78121 100644 --- a/drivers/net/forcedeth.c +++ b/drivers/net/forcedeth.c | |||
@@ -718,6 +718,7 @@ struct fe_priv { | |||
718 | u32 vlanctl_bits; | 718 | u32 vlanctl_bits; |
719 | u32 driver_data; | 719 | u32 driver_data; |
720 | u32 register_size; | 720 | u32 register_size; |
721 | int rx_csum; | ||
721 | 722 | ||
722 | void __iomem *base; | 723 | void __iomem *base; |
723 | 724 | ||
@@ -1897,7 +1898,7 @@ static int nv_rx_process(struct net_device *dev, int limit) | |||
1897 | } | 1898 | } |
1898 | } | 1899 | } |
1899 | } | 1900 | } |
1900 | if (np->txrxctl_bits & NVREG_TXRXCTL_RXCHECK) { | 1901 | if (np->rx_csum) { |
1901 | flags &= NV_RX2_CHECKSUMMASK; | 1902 | flags &= NV_RX2_CHECKSUMMASK; |
1902 | if (flags == NV_RX2_CHECKSUMOK1 || | 1903 | if (flags == NV_RX2_CHECKSUMOK1 || |
1903 | flags == NV_RX2_CHECKSUMOK2 || | 1904 | flags == NV_RX2_CHECKSUMOK2 || |
@@ -3557,7 +3558,7 @@ static int nv_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam* | |||
3557 | static u32 nv_get_rx_csum(struct net_device *dev) | 3558 | static u32 nv_get_rx_csum(struct net_device *dev) |
3558 | { | 3559 | { |
3559 | struct fe_priv *np = netdev_priv(dev); | 3560 | struct fe_priv *np = netdev_priv(dev); |
3560 | return (np->txrxctl_bits & NVREG_TXRXCTL_RXCHECK) != 0; | 3561 | return (np->rx_csum) != 0; |
3561 | } | 3562 | } |
3562 | 3563 | ||
3563 | static int nv_set_rx_csum(struct net_device *dev, u32 data) | 3564 | static int nv_set_rx_csum(struct net_device *dev, u32 data) |
@@ -3567,22 +3568,15 @@ static int nv_set_rx_csum(struct net_device *dev, u32 data) | |||
3567 | int retcode = 0; | 3568 | int retcode = 0; |
3568 | 3569 | ||
3569 | if (np->driver_data & DEV_HAS_CHECKSUM) { | 3570 | if (np->driver_data & DEV_HAS_CHECKSUM) { |
3570 | |||
3571 | if (((np->txrxctl_bits & NVREG_TXRXCTL_RXCHECK) && data) || | ||
3572 | (!(np->txrxctl_bits & NVREG_TXRXCTL_RXCHECK) && !data)) { | ||
3573 | /* already set or unset */ | ||
3574 | return 0; | ||
3575 | } | ||
3576 | |||
3577 | if (data) { | 3571 | if (data) { |
3572 | np->rx_csum = 1; | ||
3578 | np->txrxctl_bits |= NVREG_TXRXCTL_RXCHECK; | 3573 | np->txrxctl_bits |= NVREG_TXRXCTL_RXCHECK; |
3579 | } else if (!(np->vlanctl_bits & NVREG_VLANCONTROL_ENABLE)) { | ||
3580 | np->txrxctl_bits &= ~NVREG_TXRXCTL_RXCHECK; | ||
3581 | } else { | 3574 | } else { |
3582 | printk(KERN_INFO "Can not disable rx checksum if vlan is enabled\n"); | 3575 | np->rx_csum = 0; |
3583 | return -EINVAL; | 3576 | /* vlan is dependent on rx checksum offload */ |
3577 | if (!(np->vlanctl_bits & NVREG_VLANCONTROL_ENABLE)) | ||
3578 | np->txrxctl_bits &= ~NVREG_TXRXCTL_RXCHECK; | ||
3584 | } | 3579 | } |
3585 | |||
3586 | if (netif_running(dev)) { | 3580 | if (netif_running(dev)) { |
3587 | spin_lock_irq(&np->lock); | 3581 | spin_lock_irq(&np->lock); |
3588 | writel(np->txrxctl_bits, base + NvRegTxRxControl); | 3582 | writel(np->txrxctl_bits, base + NvRegTxRxControl); |
@@ -4322,6 +4316,7 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i | |||
4322 | np->pkt_limit = NV_PKTLIMIT_2; | 4316 | np->pkt_limit = NV_PKTLIMIT_2; |
4323 | 4317 | ||
4324 | if (id->driver_data & DEV_HAS_CHECKSUM) { | 4318 | if (id->driver_data & DEV_HAS_CHECKSUM) { |
4319 | np->rx_csum = 1; | ||
4325 | np->txrxctl_bits |= NVREG_TXRXCTL_RXCHECK; | 4320 | np->txrxctl_bits |= NVREG_TXRXCTL_RXCHECK; |
4326 | dev->features |= NETIF_F_HW_CSUM | NETIF_F_SG; | 4321 | dev->features |= NETIF_F_HW_CSUM | NETIF_F_SG; |
4327 | #ifdef NETIF_F_TSO | 4322 | #ifdef NETIF_F_TSO |