Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 35224
b: refs/heads/master
c: f2ad2d9
h: refs/heads/master
v: v3
  • Loading branch information
Ayaz Abdulla authored and Jeff Garzik committed Sep 6, 2006
1 parent df3d7dd commit 8a24eb3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: edf7e5ec99c2e24cea3951f7961958fc7edbfdd1
refs/heads/master: f2ad2d9b65963322186a8af2bd2965c734a7badb
23 changes: 9 additions & 14 deletions trunk/drivers/net/forcedeth.c
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,7 @@ struct fe_priv {
u32 vlanctl_bits;
u32 driver_data;
u32 register_size;
int rx_csum;

void __iomem *base;

Expand Down Expand Up @@ -1897,7 +1898,7 @@ static int nv_rx_process(struct net_device *dev, int limit)
}
}
}
if (np->txrxctl_bits & NVREG_TXRXCTL_RXCHECK) {
if (np->rx_csum) {
flags &= NV_RX2_CHECKSUMMASK;
if (flags == NV_RX2_CHECKSUMOK1 ||
flags == NV_RX2_CHECKSUMOK2 ||
Expand Down Expand Up @@ -3557,7 +3558,7 @@ static int nv_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam*
static u32 nv_get_rx_csum(struct net_device *dev)
{
struct fe_priv *np = netdev_priv(dev);
return (np->txrxctl_bits & NVREG_TXRXCTL_RXCHECK) != 0;
return (np->rx_csum) != 0;
}

static int nv_set_rx_csum(struct net_device *dev, u32 data)
Expand All @@ -3567,22 +3568,15 @@ static int nv_set_rx_csum(struct net_device *dev, u32 data)
int retcode = 0;

if (np->driver_data & DEV_HAS_CHECKSUM) {

if (((np->txrxctl_bits & NVREG_TXRXCTL_RXCHECK) && data) ||
(!(np->txrxctl_bits & NVREG_TXRXCTL_RXCHECK) && !data)) {
/* already set or unset */
return 0;
}

if (data) {
np->rx_csum = 1;
np->txrxctl_bits |= NVREG_TXRXCTL_RXCHECK;
} else if (!(np->vlanctl_bits & NVREG_VLANCONTROL_ENABLE)) {
np->txrxctl_bits &= ~NVREG_TXRXCTL_RXCHECK;
} else {
printk(KERN_INFO "Can not disable rx checksum if vlan is enabled\n");
return -EINVAL;
np->rx_csum = 0;
/* vlan is dependent on rx checksum offload */
if (!(np->vlanctl_bits & NVREG_VLANCONTROL_ENABLE))
np->txrxctl_bits &= ~NVREG_TXRXCTL_RXCHECK;
}

if (netif_running(dev)) {
spin_lock_irq(&np->lock);
writel(np->txrxctl_bits, base + NvRegTxRxControl);
Expand Down Expand Up @@ -4322,6 +4316,7 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
np->pkt_limit = NV_PKTLIMIT_2;

if (id->driver_data & DEV_HAS_CHECKSUM) {
np->rx_csum = 1;
np->txrxctl_bits |= NVREG_TXRXCTL_RXCHECK;
dev->features |= NETIF_F_HW_CSUM | NETIF_F_SG;
#ifdef NETIF_F_TSO
Expand Down

0 comments on commit 8a24eb3

Please sign in to comment.