Commit da02b23192e8c1dc6830fc38840ea1c5e416a43c

Authored by Pekka Enberg
Committed by Jeff Garzik
1 parent 39f205854c

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>

Showing 2 changed files with 7 additions and 2 deletions Side-by-side Diff

... ... @@ -631,6 +631,7 @@
631 631  
632 632 static int ipg_io_config(struct net_device *dev)
633 633 {
  634 + struct ipg_nic_private *sp = netdev_priv(dev);
634 635 void __iomem *ioaddr = ipg_ioaddr(dev);
635 636 u32 origmacctrl;
636 637 u32 restoremacctrl;
... ... @@ -670,7 +671,7 @@
670 671 /* Set RECEIVEMODE register. */
671 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 676 ipg_w8(IPG_RXDMAPOLLPERIOD_VALUE, RX_DMA_POLL_PERIOD);
676 677 ipg_w8(IPG_RXDMAURGENTTHRESH_VALUE, RX_DMA_URGENT_THRESH);
... ... @@ -2114,6 +2115,8 @@
2114 2115  
2115 2116 static 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 2120 /* Function to accomodate changes to Maximum Transfer Unit
2118 2121 * (or MTU) of IPG NIC. Cannot use default function since
2119 2122 * the default will not allow for MTU > 1500 bytes.
... ... @@ -2125,7 +2128,7 @@
2125 2128 * byte payload, 4 byte FCS) and IPG_MAX_RXFRAME_SIZE, which
2126 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 2132 return -EINVAL;
2130 2133  
2131 2134 dev->mtu = new_mtu;
... ... @@ -2238,6 +2241,7 @@
2238 2241 sp->is_jumbo = IPG_JUMBO;
2239 2242 sp->rxfrag_size = IPG_RXFRAG_SIZE;
2240 2243 sp->rxsupport_size = IPG_RXSUPPORT_SIZE;
  2244 + sp->max_rxframe_size = IPG_MAX_RXFRAME_SIZE;
2241 2245  
2242 2246 /* Declare IPG NIC functions for Ethernet device methods.
2243 2247 */
... ... @@ -798,6 +798,7 @@
798 798 struct ipg_jumbo jumbo;
799 799 unsigned long rxfrag_size;
800 800 unsigned long rxsupport_size;
  801 + unsigned long max_rxframe_size;
801 802 unsigned int rx_buf_sz;
802 803 struct pci_dev *pdev;
803 804 struct net_device *dev;