Commit bbfb86c5 authored by Ralf Baechle's avatar Ralf Baechle Committed by David S. Miller

IOC3: Switch hw checksumming to ethtool configurable.

Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
parent c54f5c24
...@@ -486,26 +486,6 @@ config SGI_IOC3_ETH ...@@ -486,26 +486,6 @@ config SGI_IOC3_ETH
the Ethernet-HOWTO, available from the Ethernet-HOWTO, available from
<http://www.tldp.org/docs.html#howto>. <http://www.tldp.org/docs.html#howto>.
config SGI_IOC3_ETH_HW_RX_CSUM
bool "Receive hardware checksums"
depends on SGI_IOC3_ETH && INET
default y
help
The SGI IOC3 network adapter supports TCP and UDP checksums in
hardware to offload processing of these checksums from the CPU. At
the moment only acceleration of IPv4 is supported. This option
enables offloading for checksums on receive. If unsure, say Y.
config SGI_IOC3_ETH_HW_TX_CSUM
bool "Transmit hardware checksums"
depends on SGI_IOC3_ETH && INET
default y
help
The SGI IOC3 network adapter supports TCP and UDP checksums in
hardware to offload processing of these checksums from the CPU. At
the moment only acceleration of IPv4 is supported. This option
enables offloading for checksums on transmit. If unsure, say Y.
config MIPS_SIM_NET config MIPS_SIM_NET
tristate "MIPS simulator Network device" tristate "MIPS simulator Network device"
depends on MIPS_SIM depends on MIPS_SIM
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* *
* Driver for SGI's IOC3 based Ethernet cards as found in the PCI card. * Driver for SGI's IOC3 based Ethernet cards as found in the PCI card.
* *
* Copyright (C) 1999, 2000, 2001, 2003 Ralf Baechle * Copyright (C) 1999, 2000, 01, 03, 06 Ralf Baechle
* Copyright (C) 1995, 1999, 2000, 2001 by Silicon Graphics, Inc. * Copyright (C) 1995, 1999, 2000, 2001 by Silicon Graphics, Inc.
* *
* References: * References:
...@@ -62,12 +62,7 @@ ...@@ -62,12 +62,7 @@
#include <asm/pgtable.h> #include <asm/pgtable.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/sn/types.h> #include <asm/sn/types.h>
#include <asm/sn/sn0/addrs.h>
#include <asm/sn/sn0/hubni.h>
#include <asm/sn/sn0/hubio.h>
#include <asm/sn/klconfig.h>
#include <asm/sn/ioc3.h> #include <asm/sn/ioc3.h>
#include <asm/sn/sn0/ip27.h>
#include <asm/pci/bridge.h> #include <asm/pci/bridge.h>
/* /*
...@@ -95,6 +90,9 @@ struct ioc3_private { ...@@ -95,6 +90,9 @@ struct ioc3_private {
u32 emcr, ehar_h, ehar_l; u32 emcr, ehar_h, ehar_l;
spinlock_t ioc3_lock; spinlock_t ioc3_lock;
struct mii_if_info mii; struct mii_if_info mii;
unsigned long flags;
#define IOC3_FLAG_RX_CHECKSUMS 1
struct pci_dev *pdev; struct pci_dev *pdev;
/* Members used by autonegotiation */ /* Members used by autonegotiation */
...@@ -521,8 +519,6 @@ static struct net_device_stats *ioc3_get_stats(struct net_device *dev) ...@@ -521,8 +519,6 @@ static struct net_device_stats *ioc3_get_stats(struct net_device *dev)
return &ip->stats; return &ip->stats;
} }
#ifdef CONFIG_SGI_IOC3_ETH_HW_RX_CSUM
static void ioc3_tcpudp_checksum(struct sk_buff *skb, uint32_t hwsum, int len) static void ioc3_tcpudp_checksum(struct sk_buff *skb, uint32_t hwsum, int len)
{ {
struct ethhdr *eh = eth_hdr(skb); struct ethhdr *eh = eth_hdr(skb);
...@@ -590,7 +586,6 @@ static void ioc3_tcpudp_checksum(struct sk_buff *skb, uint32_t hwsum, int len) ...@@ -590,7 +586,6 @@ static void ioc3_tcpudp_checksum(struct sk_buff *skb, uint32_t hwsum, int len)
if (csum == 0xffff) if (csum == 0xffff)
skb->ip_summed = CHECKSUM_UNNECESSARY; skb->ip_summed = CHECKSUM_UNNECESSARY;
} }
#endif /* CONFIG_SGI_IOC3_ETH_HW_RX_CSUM */
static inline void ioc3_rx(struct ioc3_private *ip) static inline void ioc3_rx(struct ioc3_private *ip)
{ {
...@@ -625,9 +620,9 @@ static inline void ioc3_rx(struct ioc3_private *ip) ...@@ -625,9 +620,9 @@ static inline void ioc3_rx(struct ioc3_private *ip)
goto next; goto next;
} }
#ifdef CONFIG_SGI_IOC3_ETH_HW_RX_CSUM if (likely(ip->flags & IOC3_FLAG_RX_CHECKSUMS))
ioc3_tcpudp_checksum(skb, w0 & ERXBUF_IPCKSUM_MASK,len); ioc3_tcpudp_checksum(skb,
#endif w0 & ERXBUF_IPCKSUM_MASK, len);
netif_rx(skb); netif_rx(skb);
...@@ -1338,9 +1333,7 @@ static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -1338,9 +1333,7 @@ static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
dev->set_multicast_list = ioc3_set_multicast_list; dev->set_multicast_list = ioc3_set_multicast_list;
dev->set_mac_address = ioc3_set_mac_address; dev->set_mac_address = ioc3_set_mac_address;
dev->ethtool_ops = &ioc3_ethtool_ops; dev->ethtool_ops = &ioc3_ethtool_ops;
#ifdef CONFIG_SGI_IOC3_ETH_HW_TX_CSUM
dev->features = NETIF_F_IP_CSUM; dev->features = NETIF_F_IP_CSUM;
#endif
sw_physid1 = ioc3_mdio_read(dev, ip->mii.phy_id, MII_PHYSID1); sw_physid1 = ioc3_mdio_read(dev, ip->mii.phy_id, MII_PHYSID1);
sw_physid2 = ioc3_mdio_read(dev, ip->mii.phy_id, MII_PHYSID2); sw_physid2 = ioc3_mdio_read(dev, ip->mii.phy_id, MII_PHYSID2);
...@@ -1430,7 +1423,6 @@ static int ioc3_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -1430,7 +1423,6 @@ static int ioc3_start_xmit(struct sk_buff *skb, struct net_device *dev)
uint32_t w0 = 0; uint32_t w0 = 0;
int produce; int produce;
#ifdef CONFIG_SGI_IOC3_ETH_HW_TX_CSUM
/* /*
* IOC3 has a fairly simple minded checksumming hardware which simply * IOC3 has a fairly simple minded checksumming hardware which simply
* adds up the 1's complement checksum for the entire packet and * adds up the 1's complement checksum for the entire packet and
...@@ -1478,7 +1470,6 @@ static int ioc3_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -1478,7 +1470,6 @@ static int ioc3_start_xmit(struct sk_buff *skb, struct net_device *dev)
w0 = ETXD_DOCHECKSUM | (csoff << ETXD_CHKOFF_SHIFT); w0 = ETXD_DOCHECKSUM | (csoff << ETXD_CHKOFF_SHIFT);
} }
#endif /* CONFIG_SGI_IOC3_ETH_HW_TX_CSUM */
spin_lock_irq(&ip->ioc3_lock); spin_lock_irq(&ip->ioc3_lock);
...@@ -1633,12 +1624,37 @@ static u32 ioc3_get_link(struct net_device *dev) ...@@ -1633,12 +1624,37 @@ static u32 ioc3_get_link(struct net_device *dev)
return rc; return rc;
} }
static u32 ioc3_get_rx_csum(struct net_device *dev)
{
struct ioc3_private *ip = netdev_priv(dev);
return ip->flags & IOC3_FLAG_RX_CHECKSUMS;
}
static int ioc3_set_rx_csum(struct net_device *dev, u32 data)
{
struct ioc3_private *ip = netdev_priv(dev);
spin_lock_bh(&ip->ioc3_lock);
if (data)
ip->flags |= IOC3_FLAG_RX_CHECKSUMS;
else
ip->flags &= ~IOC3_FLAG_RX_CHECKSUMS;
spin_unlock_bh(&ip->ioc3_lock);
return 0;
}
static const struct ethtool_ops ioc3_ethtool_ops = { static const struct ethtool_ops ioc3_ethtool_ops = {
.get_drvinfo = ioc3_get_drvinfo, .get_drvinfo = ioc3_get_drvinfo,
.get_settings = ioc3_get_settings, .get_settings = ioc3_get_settings,
.set_settings = ioc3_set_settings, .set_settings = ioc3_set_settings,
.nway_reset = ioc3_nway_reset, .nway_reset = ioc3_nway_reset,
.get_link = ioc3_get_link, .get_link = ioc3_get_link,
.get_rx_csum = ioc3_get_rx_csum,
.set_rx_csum = ioc3_set_rx_csum,
.get_tx_csum = ethtool_op_get_tx_csum,
.set_tx_csum = ethtool_op_set_tx_csum
}; };
static int ioc3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) static int ioc3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment