提交 024f4d88 编写于 作者: P Pekka Enberg 提交者: Jeff Garzik

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: NAndrew Savchenko <Bircoph@list.ru>
Signed-off-by: NPekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
上级 16e605a2
...@@ -1076,8 +1076,6 @@ static int ipg_nic_rxrestore(struct net_device *dev) ...@@ -1076,8 +1076,6 @@ static int ipg_nic_rxrestore(struct net_device *dev)
return 0; return 0;
} }
#ifdef JUMBO_FRAME
/* use jumboindex and jumbosize to control jumbo frame status /* use jumboindex and jumbosize to control jumbo frame status
* initial status is jumboindex=-1 and jumbosize=0 * initial status is jumboindex=-1 and jumbosize=0
* 1. jumboindex = -1 and jumbosize=0 : previous jumbo frame has been done. * 1. jumboindex = -1 and jumbosize=0 : previous jumbo frame has been done.
...@@ -1097,7 +1095,7 @@ enum { ...@@ -1097,7 +1095,7 @@ enum {
FRAME_WITH_START_WITH_END = 11 FRAME_WITH_START_WITH_END = 11
}; };
inline void ipg_nic_rx_free_skb(struct net_device *dev) static void ipg_nic_rx_free_skb(struct net_device *dev)
{ {
struct ipg_nic_private *sp = netdev_priv(dev); struct ipg_nic_private *sp = netdev_priv(dev);
unsigned int entry = sp->rx_current % IPG_RFDLIST_LENGTH; 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,7 +1111,7 @@ inline void ipg_nic_rx_free_skb(struct net_device *dev)
} }
} }
inline int ipg_nic_rx_check_frame_type(struct net_device *dev) static int ipg_nic_rx_check_frame_type(struct net_device *dev)
{ {
struct ipg_nic_private *sp = netdev_priv(dev); struct ipg_nic_private *sp = netdev_priv(dev);
struct ipg_rx *rxfd = sp->rxd + (sp->rx_current % IPG_RFDLIST_LENGTH); 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,7 +1124,7 @@ inline int ipg_nic_rx_check_frame_type(struct net_device *dev)
return type; return type;
} }
inline int ipg_nic_rx_check_error(struct net_device *dev) static int ipg_nic_rx_check_error(struct net_device *dev)
{ {
struct ipg_nic_private *sp = netdev_priv(dev); struct ipg_nic_private *sp = netdev_priv(dev);
unsigned int entry = sp->rx_current % IPG_RFDLIST_LENGTH; 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,7 +1332,7 @@ static void ipg_nic_rx_no_start_no_end(struct net_device *dev,
} }
} }
static int ipg_nic_rx(struct net_device *dev) static int ipg_nic_rx_jumbo(struct net_device *dev)
{ {
struct ipg_nic_private *sp = netdev_priv(dev); struct ipg_nic_private *sp = netdev_priv(dev);
unsigned int curr = sp->rx_current; unsigned int curr = sp->rx_current;
...@@ -1382,7 +1380,6 @@ static int ipg_nic_rx(struct net_device *dev) ...@@ -1382,7 +1380,6 @@ static int ipg_nic_rx(struct net_device *dev)
return 0; return 0;
} }
#else
static int ipg_nic_rx(struct net_device *dev) static int ipg_nic_rx(struct net_device *dev)
{ {
/* Transfer received Ethernet frames to higher network layers. */ /* Transfer received Ethernet frames to higher network layers. */
...@@ -1556,7 +1553,6 @@ static int ipg_nic_rx(struct net_device *dev) ...@@ -1556,7 +1553,6 @@ static int ipg_nic_rx(struct net_device *dev)
return 0; return 0;
} }
#endif
static void ipg_reset_after_host_error(struct work_struct *work) static void ipg_reset_after_host_error(struct work_struct *work)
{ {
...@@ -1592,9 +1588,9 @@ static irqreturn_t ipg_interrupt_handler(int irq, void *dev_inst) ...@@ -1592,9 +1588,9 @@ static irqreturn_t ipg_interrupt_handler(int irq, void *dev_inst)
IPG_DEBUG_MSG("_interrupt_handler\n"); IPG_DEBUG_MSG("_interrupt_handler\n");
#ifdef JUMBO_FRAME if (sp->is_jumbo)
ipg_nic_rxrestore(dev); ipg_nic_rxrestore(dev);
#endif
spin_lock(&sp->lock); spin_lock(&sp->lock);
/* Get interrupt source information, and acknowledge /* Get interrupt source information, and acknowledge
...@@ -1650,7 +1646,10 @@ static irqreturn_t ipg_interrupt_handler(int irq, void *dev_inst) ...@@ -1650,7 +1646,10 @@ static irqreturn_t ipg_interrupt_handler(int irq, void *dev_inst)
sp->RFDListCheckedCount++; sp->RFDListCheckedCount++;
#endif #endif
ipg_nic_rx(dev); if (sp->is_jumbo)
ipg_nic_rx_jumbo(dev);
else
ipg_nic_rx(dev);
} }
/* If TxDMAComplete interrupt, free used TFDs. */ /* If TxDMAComplete interrupt, free used TFDs. */
...@@ -1804,11 +1803,11 @@ static int ipg_nic_open(struct net_device *dev) ...@@ -1804,11 +1803,11 @@ static int ipg_nic_open(struct net_device *dev)
if (ipg_config_autoneg(dev) < 0) if (ipg_config_autoneg(dev) < 0)
printk(KERN_INFO "%s: Auto-negotiation error.\n", dev->name); printk(KERN_INFO "%s: Auto-negotiation error.\n", dev->name);
#ifdef JUMBO_FRAME
/* initialize JUMBO Frame control variable */ /* initialize JUMBO Frame control variable */
sp->jumbo.found_start = 0; sp->jumbo.found_start = 0;
sp->jumbo.current_size = 0; sp->jumbo.current_size = 0;
sp->jumbo.skb = NULL; sp->jumbo.skb = NULL;
#ifdef JUMBO_FRAME
dev->mtu = IPG_TXFRAG_SIZE; dev->mtu = IPG_TXFRAG_SIZE;
#endif #endif
...@@ -2240,6 +2239,8 @@ static int __devinit ipg_probe(struct pci_dev *pdev, ...@@ -2240,6 +2239,8 @@ static int __devinit ipg_probe(struct pci_dev *pdev,
spin_lock_init(&sp->lock); spin_lock_init(&sp->lock);
mutex_init(&sp->mii_mutex); mutex_init(&sp->mii_mutex);
sp->is_jumbo = IPG_JUMBO;
/* Declare IPG NIC functions for Ethernet device methods. /* Declare IPG NIC functions for Ethernet device methods.
*/ */
dev->open = &ipg_nic_open; dev->open = &ipg_nic_open;
......
...@@ -536,6 +536,12 @@ enum ipg_regs { ...@@ -536,6 +536,12 @@ enum ipg_regs {
*/ */
#define IPG_FRAMESBETWEENTXDMACOMPLETES 0x1 #define IPG_FRAMESBETWEENTXDMACOMPLETES 0x1
#ifdef JUMBO_FRAME
# define IPG_JUMBO true
#else
# define IPG_JUMBO false
#endif
#ifdef JUMBO_FRAME #ifdef JUMBO_FRAME
# ifdef JUMBO_FRAME_SIZE_2K # ifdef JUMBO_FRAME_SIZE_2K
...@@ -786,9 +792,8 @@ struct ipg_nic_private { ...@@ -786,9 +792,8 @@ struct ipg_nic_private {
unsigned int tx_dirty; unsigned int tx_dirty;
unsigned int rx_current; unsigned int rx_current;
unsigned int rx_dirty; unsigned int rx_dirty;
#ifdef JUMBO_FRAME bool is_jumbo;
struct ipg_jumbo jumbo; struct ipg_jumbo jumbo;
#endif
unsigned int rx_buf_sz; unsigned int rx_buf_sz;
struct pci_dev *pdev; struct pci_dev *pdev;
struct net_device *dev; struct net_device *dev;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册