aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorPekka Enberg <penberg@cs.helsinki.fi>2008-06-23 07:35:16 -0400
committerJeff Garzik <jgarzik@redhat.com>2008-07-04 08:46:51 -0400
commit024f4d88b45003710e8e2ee937b0c56aaf2dff2d (patch)
tree3cbf3080f10e5bd3b1017c68581e3a48b8ff3b2c /drivers/net
parent16e605a2a0398bc1e693e8571bf0cbc5aa5c00c8 (diff)
ipg: always compile in jumbo frame support
Add a ->is_jumbo boolean to struct ipg_nic_private and fix up ipg_interrupt_handler() to call the jumbo frame version of ipg_nic_rx() if the boolean is set to true. Also remove the JUMBO_FRAME #ifdefs so we can always compile in support for jumbo frames. Tested-by: Andrew Savchenko <Bircoph@list.ru> Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ipg.c27
-rw-r--r--drivers/net/ipg.h9
2 files changed, 21 insertions, 15 deletions
diff --git a/drivers/net/ipg.c b/drivers/net/ipg.c
index 2c03f4e2ccc4..af7499445bb1 100644
--- a/drivers/net/ipg.c
+++ b/drivers/net/ipg.c
@@ -1076,8 +1076,6 @@ static int ipg_nic_rxrestore(struct net_device *dev)
1076 return 0; 1076 return 0;
1077} 1077}
1078 1078
1079#ifdef JUMBO_FRAME
1080
1081/* use jumboindex and jumbosize to control jumbo frame status 1079/* use jumboindex and jumbosize to control jumbo frame status
1082 * initial status is jumboindex=-1 and jumbosize=0 1080 * initial status is jumboindex=-1 and jumbosize=0
1083 * 1. jumboindex = -1 and jumbosize=0 : previous jumbo frame has been done. 1081 * 1. jumboindex = -1 and jumbosize=0 : previous jumbo frame has been done.
@@ -1097,7 +1095,7 @@ enum {
1097 FRAME_WITH_START_WITH_END = 11 1095 FRAME_WITH_START_WITH_END = 11
1098}; 1096};
1099 1097
1100inline void ipg_nic_rx_free_skb(struct net_device *dev) 1098static void ipg_nic_rx_free_skb(struct net_device *dev)
1101{ 1099{
1102 struct ipg_nic_private *sp = netdev_priv(dev); 1100 struct ipg_nic_private *sp = netdev_priv(dev);
1103 unsigned int entry = sp->rx_current % IPG_RFDLIST_LENGTH; 1101 unsigned int entry = sp->rx_current % IPG_RFDLIST_LENGTH;
@@ -1113,7 +1111,7 @@ inline void ipg_nic_rx_free_skb(struct net_device *dev)
1113 } 1111 }
1114} 1112}
1115 1113
1116inline int ipg_nic_rx_check_frame_type(struct net_device *dev) 1114static int ipg_nic_rx_check_frame_type(struct net_device *dev)
1117{ 1115{
1118 struct ipg_nic_private *sp = netdev_priv(dev); 1116 struct ipg_nic_private *sp = netdev_priv(dev);
1119 struct ipg_rx *rxfd = sp->rxd + (sp->rx_current % IPG_RFDLIST_LENGTH); 1117 struct ipg_rx *rxfd = sp->rxd + (sp->rx_current % IPG_RFDLIST_LENGTH);
@@ -1126,7 +1124,7 @@ inline int ipg_nic_rx_check_frame_type(struct net_device *dev)
1126 return type; 1124 return type;
1127} 1125}
1128 1126
1129inline int ipg_nic_rx_check_error(struct net_device *dev) 1127static int ipg_nic_rx_check_error(struct net_device *dev)
1130{ 1128{
1131 struct ipg_nic_private *sp = netdev_priv(dev); 1129 struct ipg_nic_private *sp = netdev_priv(dev);
1132 unsigned int entry = sp->rx_current % IPG_RFDLIST_LENGTH; 1130 unsigned int entry = sp->rx_current % IPG_RFDLIST_LENGTH;
@@ -1334,7 +1332,7 @@ static void ipg_nic_rx_no_start_no_end(struct net_device *dev,
1334 } 1332 }
1335} 1333}
1336 1334
1337static int ipg_nic_rx(struct net_device *dev) 1335static int ipg_nic_rx_jumbo(struct net_device *dev)
1338{ 1336{
1339 struct ipg_nic_private *sp = netdev_priv(dev); 1337 struct ipg_nic_private *sp = netdev_priv(dev);
1340 unsigned int curr = sp->rx_current; 1338 unsigned int curr = sp->rx_current;
@@ -1382,7 +1380,6 @@ static int ipg_nic_rx(struct net_device *dev)
1382 return 0; 1380 return 0;
1383} 1381}
1384 1382
1385#else
1386static int ipg_nic_rx(struct net_device *dev) 1383static int ipg_nic_rx(struct net_device *dev)
1387{ 1384{
1388 /* Transfer received Ethernet frames to higher network layers. */ 1385 /* Transfer received Ethernet frames to higher network layers. */
@@ -1556,7 +1553,6 @@ static int ipg_nic_rx(struct net_device *dev)
1556 1553
1557 return 0; 1554 return 0;
1558} 1555}
1559#endif
1560 1556
1561static void ipg_reset_after_host_error(struct work_struct *work) 1557static void ipg_reset_after_host_error(struct work_struct *work)
1562{ 1558{
@@ -1592,9 +1588,9 @@ static irqreturn_t ipg_interrupt_handler(int irq, void *dev_inst)
1592 1588
1593 IPG_DEBUG_MSG("_interrupt_handler\n"); 1589 IPG_DEBUG_MSG("_interrupt_handler\n");
1594 1590
1595#ifdef JUMBO_FRAME 1591 if (sp->is_jumbo)
1596 ipg_nic_rxrestore(dev); 1592 ipg_nic_rxrestore(dev);
1597#endif 1593
1598 spin_lock(&sp->lock); 1594 spin_lock(&sp->lock);
1599 1595
1600 /* Get interrupt source information, and acknowledge 1596 /* Get interrupt source information, and acknowledge
@@ -1650,7 +1646,10 @@ static irqreturn_t ipg_interrupt_handler(int irq, void *dev_inst)
1650 sp->RFDListCheckedCount++; 1646 sp->RFDListCheckedCount++;
1651#endif 1647#endif
1652 1648
1653 ipg_nic_rx(dev); 1649 if (sp->is_jumbo)
1650 ipg_nic_rx_jumbo(dev);
1651 else
1652 ipg_nic_rx(dev);
1654 } 1653 }
1655 1654
1656 /* If TxDMAComplete interrupt, free used TFDs. */ 1655 /* If TxDMAComplete interrupt, free used TFDs. */
@@ -1804,11 +1803,11 @@ static int ipg_nic_open(struct net_device *dev)
1804 if (ipg_config_autoneg(dev) < 0) 1803 if (ipg_config_autoneg(dev) < 0)
1805 printk(KERN_INFO "%s: Auto-negotiation error.\n", dev->name); 1804 printk(KERN_INFO "%s: Auto-negotiation error.\n", dev->name);
1806 1805
1807#ifdef JUMBO_FRAME
1808 /* initialize JUMBO Frame control variable */ 1806 /* initialize JUMBO Frame control variable */
1809 sp->jumbo.found_start = 0; 1807 sp->jumbo.found_start = 0;
1810 sp->jumbo.current_size = 0; 1808 sp->jumbo.current_size = 0;
1811 sp->jumbo.skb = NULL; 1809 sp->jumbo.skb = NULL;
1810#ifdef JUMBO_FRAME
1812 dev->mtu = IPG_TXFRAG_SIZE; 1811 dev->mtu = IPG_TXFRAG_SIZE;
1813#endif 1812#endif
1814 1813
@@ -2240,6 +2239,8 @@ static int __devinit ipg_probe(struct pci_dev *pdev,
2240 spin_lock_init(&sp->lock); 2239 spin_lock_init(&sp->lock);
2241 mutex_init(&sp->mii_mutex); 2240 mutex_init(&sp->mii_mutex);
2242 2241
2242 sp->is_jumbo = IPG_JUMBO;
2243
2243 /* Declare IPG NIC functions for Ethernet device methods. 2244 /* Declare IPG NIC functions for Ethernet device methods.
2244 */ 2245 */
2245 dev->open = &ipg_nic_open; 2246 dev->open = &ipg_nic_open;
diff --git a/drivers/net/ipg.h b/drivers/net/ipg.h
index cda53887d4db..446f3663ae6a 100644
--- a/drivers/net/ipg.h
+++ b/drivers/net/ipg.h
@@ -537,6 +537,12 @@ enum ipg_regs {
537#define IPG_FRAMESBETWEENTXDMACOMPLETES 0x1 537#define IPG_FRAMESBETWEENTXDMACOMPLETES 0x1
538 538
539#ifdef JUMBO_FRAME 539#ifdef JUMBO_FRAME
540# define IPG_JUMBO true
541#else
542# define IPG_JUMBO false
543#endif
544
545#ifdef JUMBO_FRAME
540 546
541# ifdef JUMBO_FRAME_SIZE_2K 547# ifdef JUMBO_FRAME_SIZE_2K
542# define JUMBO_FRAME_SIZE 2048 548# define JUMBO_FRAME_SIZE 2048
@@ -786,9 +792,8 @@ struct ipg_nic_private {
786 unsigned int tx_dirty; 792 unsigned int tx_dirty;
787 unsigned int rx_current; 793 unsigned int rx_current;
788 unsigned int rx_dirty; 794 unsigned int rx_dirty;
789#ifdef JUMBO_FRAME 795 bool is_jumbo;
790 struct ipg_jumbo jumbo; 796 struct ipg_jumbo jumbo;
791#endif
792 unsigned int rx_buf_sz; 797 unsigned int rx_buf_sz;
793 struct pci_dev *pdev; 798 struct pci_dev *pdev;
794 struct net_device *dev; 799 struct net_device *dev;