aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPekka Enberg <penberg@cs.helsinki.fi>2008-06-23 07:36:35 -0400
committerJeff Garzik <jgarzik@redhat.com>2008-07-04 08:46:53 -0400
commitda02b23192e8c1dc6830fc38840ea1c5e416a43c (patch)
tree0acd2e21d63a08a3cd8f639cf8484d0511144c7f
parent39f205854c829294f9b4db65100d3abdf9c9c145 (diff)
ipg: per-device max_rxframe_size
Add a ->max_rxframe member to struct ipg_nic_private and convert the users of IPG_MAX_RXFRAME_SIZE to use it instead to enable per-device jumbo frame configuration. Tested-by: Andrew Savchenko <Bircoph@list.ru> Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
-rw-r--r--drivers/net/ipg.c8
-rw-r--r--drivers/net/ipg.h1
2 files changed, 7 insertions, 2 deletions
diff --git a/drivers/net/ipg.c b/drivers/net/ipg.c
index 51d5f30e0afe..57395b9587dc 100644
--- a/drivers/net/ipg.c
+++ b/drivers/net/ipg.c
@@ -631,6 +631,7 @@ static void ipg_nic_set_multicast_list(struct net_device *dev)
631 631
632static int ipg_io_config(struct net_device *dev) 632static int ipg_io_config(struct net_device *dev)
633{ 633{
634 struct ipg_nic_private *sp = netdev_priv(dev);
634 void __iomem *ioaddr = ipg_ioaddr(dev); 635 void __iomem *ioaddr = ipg_ioaddr(dev);
635 u32 origmacctrl; 636 u32 origmacctrl;
636 u32 restoremacctrl; 637 u32 restoremacctrl;
@@ -670,7 +671,7 @@ static int ipg_io_config(struct net_device *dev)
670 /* Set RECEIVEMODE register. */ 671 /* Set RECEIVEMODE register. */
671 ipg_nic_set_multicast_list(dev); 672 ipg_nic_set_multicast_list(dev);
672 673
673 ipg_w16(IPG_MAX_RXFRAME_SIZE, MAX_FRAME_SIZE); 674 ipg_w16(sp->max_rxframe_size, MAX_FRAME_SIZE);
674 675
675 ipg_w8(IPG_RXDMAPOLLPERIOD_VALUE, RX_DMA_POLL_PERIOD); 676 ipg_w8(IPG_RXDMAPOLLPERIOD_VALUE, RX_DMA_POLL_PERIOD);
676 ipg_w8(IPG_RXDMAURGENTTHRESH_VALUE, RX_DMA_URGENT_THRESH); 677 ipg_w8(IPG_RXDMAURGENTTHRESH_VALUE, RX_DMA_URGENT_THRESH);
@@ -2114,6 +2115,8 @@ static int ipg_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
2114 2115
2115static int ipg_nic_change_mtu(struct net_device *dev, int new_mtu) 2116static int ipg_nic_change_mtu(struct net_device *dev, int new_mtu)
2116{ 2117{
2118 struct ipg_nic_private *sp = netdev_priv(dev);
2119
2117 /* Function to accomodate changes to Maximum Transfer Unit 2120 /* Function to accomodate changes to Maximum Transfer Unit
2118 * (or MTU) of IPG NIC. Cannot use default function since 2121 * (or MTU) of IPG NIC. Cannot use default function since
2119 * the default will not allow for MTU > 1500 bytes. 2122 * the default will not allow for MTU > 1500 bytes.
@@ -2125,7 +2128,7 @@ static int ipg_nic_change_mtu(struct net_device *dev, int new_mtu)
2125 * byte payload, 4 byte FCS) and IPG_MAX_RXFRAME_SIZE, which 2128 * byte payload, 4 byte FCS) and IPG_MAX_RXFRAME_SIZE, which
2126 * corresponds to the MAXFRAMESIZE register in the IPG. 2129 * corresponds to the MAXFRAMESIZE register in the IPG.
2127 */ 2130 */
2128 if ((new_mtu < 68) || (new_mtu > IPG_MAX_RXFRAME_SIZE)) 2131 if ((new_mtu < 68) || (new_mtu > sp->max_rxframe_size))
2129 return -EINVAL; 2132 return -EINVAL;
2130 2133
2131 dev->mtu = new_mtu; 2134 dev->mtu = new_mtu;
@@ -2238,6 +2241,7 @@ static int __devinit ipg_probe(struct pci_dev *pdev,
2238 sp->is_jumbo = IPG_JUMBO; 2241 sp->is_jumbo = IPG_JUMBO;
2239 sp->rxfrag_size = IPG_RXFRAG_SIZE; 2242 sp->rxfrag_size = IPG_RXFRAG_SIZE;
2240 sp->rxsupport_size = IPG_RXSUPPORT_SIZE; 2243 sp->rxsupport_size = IPG_RXSUPPORT_SIZE;
2244 sp->max_rxframe_size = IPG_MAX_RXFRAME_SIZE;
2241 2245
2242 /* Declare IPG NIC functions for Ethernet device methods. 2246 /* Declare IPG NIC functions for Ethernet device methods.
2243 */ 2247 */
diff --git a/drivers/net/ipg.h b/drivers/net/ipg.h
index 9ff4511d21cb..c84902d845fc 100644
--- a/drivers/net/ipg.h
+++ b/drivers/net/ipg.h
@@ -798,6 +798,7 @@ struct ipg_nic_private {
798 struct ipg_jumbo jumbo; 798 struct ipg_jumbo jumbo;
799 unsigned long rxfrag_size; 799 unsigned long rxfrag_size;
800 unsigned long rxsupport_size; 800 unsigned long rxsupport_size;
801 unsigned long max_rxframe_size;
801 unsigned int rx_buf_sz; 802 unsigned int rx_buf_sz;
802 struct pci_dev *pdev; 803 struct pci_dev *pdev;
803 struct net_device *dev; 804 struct net_device *dev;