Commit 18a9cdb9 authored by Pekka Enberg's avatar Pekka Enberg Committed by Jeff Garzik

ipg: per-device rxfrag_size

Add a ->max_rxframe member to struct ipg_nic_private and convert the users of
IPG_RXFRAG_SIZE to use it instead to enable per-device jumbo frame
configuration.
Tested-by: default avatarAndrew Savchenko <Bircoph@list.ru>
Signed-off-by: default avatarPekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
parent 83042955
...@@ -751,7 +751,7 @@ static int ipg_get_rxbuff(struct net_device *dev, int entry) ...@@ -751,7 +751,7 @@ static int ipg_get_rxbuff(struct net_device *dev, int entry)
sp->rx_buf_sz, PCI_DMA_FROMDEVICE)); sp->rx_buf_sz, PCI_DMA_FROMDEVICE));
/* Set the RFD fragment length. */ /* Set the RFD fragment length. */
rxfragsize = IPG_RXFRAG_SIZE; rxfragsize = sp->rxfrag_size;
rxfd->frag_info |= cpu_to_le64((rxfragsize << 48) & IPG_RFI_FRAGLEN); rxfd->frag_info |= cpu_to_le64((rxfragsize << 48) & IPG_RFI_FRAGLEN);
return 0; return 0;
...@@ -1207,8 +1207,8 @@ static void ipg_nic_rx_with_start_and_end(struct net_device *dev, ...@@ -1207,8 +1207,8 @@ static void ipg_nic_rx_with_start_and_end(struct net_device *dev,
/* accept this frame and send to upper layer */ /* accept this frame and send to upper layer */
framelen = le64_to_cpu(rxfd->rfs) & IPG_RFS_RXFRAMELEN; framelen = le64_to_cpu(rxfd->rfs) & IPG_RFS_RXFRAMELEN;
if (framelen > IPG_RXFRAG_SIZE) if (framelen > sp->rxfrag_size)
framelen = IPG_RXFRAG_SIZE; framelen = sp->rxfrag_size;
skb_put(skb, framelen); skb_put(skb, framelen);
skb->protocol = eth_type_trans(skb, dev); skb->protocol = eth_type_trans(skb, dev);
...@@ -1241,10 +1241,10 @@ static void ipg_nic_rx_with_start(struct net_device *dev, ...@@ -1241,10 +1241,10 @@ static void ipg_nic_rx_with_start(struct net_device *dev,
pci_unmap_single(pdev, le64_to_cpu(rxfd->frag_info & ~IPG_RFI_FRAGLEN), pci_unmap_single(pdev, le64_to_cpu(rxfd->frag_info & ~IPG_RFI_FRAGLEN),
sp->rx_buf_sz, PCI_DMA_FROMDEVICE); sp->rx_buf_sz, PCI_DMA_FROMDEVICE);
skb_put(skb, IPG_RXFRAG_SIZE); skb_put(skb, sp->rxfrag_size);
jumbo->found_start = 1; jumbo->found_start = 1;
jumbo->current_size = IPG_RXFRAG_SIZE; jumbo->current_size = sp->rxfrag_size;
jumbo->skb = skb; jumbo->skb = skb;
sp->rx_buff[entry] = NULL; sp->rx_buff[entry] = NULL;
...@@ -1270,10 +1270,6 @@ static void ipg_nic_rx_with_end(struct net_device *dev, ...@@ -1270,10 +1270,6 @@ static void ipg_nic_rx_with_end(struct net_device *dev,
framelen = le64_to_cpu(rxfd->rfs) & IPG_RFS_RXFRAMELEN; framelen = le64_to_cpu(rxfd->rfs) & IPG_RFS_RXFRAMELEN;
endframelen = framelen - jumbo->current_size; endframelen = framelen - jumbo->current_size;
/*
if (framelen > IPG_RXFRAG_SIZE)
framelen=IPG_RXFRAG_SIZE;
*/
if (framelen > IPG_RXSUPPORT_SIZE) if (framelen > IPG_RXSUPPORT_SIZE)
dev_kfree_skb_irq(jumbo->skb); dev_kfree_skb_irq(jumbo->skb);
else { else {
...@@ -1314,11 +1310,11 @@ static void ipg_nic_rx_no_start_no_end(struct net_device *dev, ...@@ -1314,11 +1310,11 @@ static void ipg_nic_rx_no_start_no_end(struct net_device *dev,
if (skb) { if (skb) {
if (jumbo->found_start) { if (jumbo->found_start) {
jumbo->current_size += IPG_RXFRAG_SIZE; jumbo->current_size += sp->rxfrag_size;
if (jumbo->current_size <= IPG_RXSUPPORT_SIZE) { if (jumbo->current_size <= IPG_RXSUPPORT_SIZE) {
memcpy(skb_put(jumbo->skb, memcpy(skb_put(jumbo->skb,
IPG_RXFRAG_SIZE), sp->rxfrag_size),
skb->data, IPG_RXFRAG_SIZE); skb->data, sp->rxfrag_size);
} }
} }
dev->last_rx = jiffies; dev->last_rx = jiffies;
...@@ -1410,11 +1406,11 @@ static int ipg_nic_rx(struct net_device *dev) ...@@ -1410,11 +1406,11 @@ static int ipg_nic_rx(struct net_device *dev)
/* Check for jumbo frame arrival with too small /* Check for jumbo frame arrival with too small
* RXFRAG_SIZE. * RXFRAG_SIZE.
*/ */
if (framelen > IPG_RXFRAG_SIZE) { if (framelen > sp->rxfrag_size) {
IPG_DEBUG_MSG IPG_DEBUG_MSG
("RFS FrameLen > allocated fragment size.\n"); ("RFS FrameLen > allocated fragment size.\n");
framelen = IPG_RXFRAG_SIZE; framelen = sp->rxfrag_size;
} }
if ((IPG_DROP_ON_RX_ETH_ERRORS && (le64_to_cpu(rxfd->rfs) & if ((IPG_DROP_ON_RX_ETH_ERRORS && (le64_to_cpu(rxfd->rfs) &
...@@ -2240,6 +2236,7 @@ static int __devinit ipg_probe(struct pci_dev *pdev, ...@@ -2240,6 +2236,7 @@ static int __devinit ipg_probe(struct pci_dev *pdev,
mutex_init(&sp->mii_mutex); mutex_init(&sp->mii_mutex);
sp->is_jumbo = IPG_JUMBO; sp->is_jumbo = IPG_JUMBO;
sp->rxfrag_size = IPG_RXFRAG_SIZE;
/* Declare IPG NIC functions for Ethernet device methods. /* Declare IPG NIC functions for Ethernet device methods.
*/ */
......
...@@ -796,6 +796,7 @@ struct ipg_nic_private { ...@@ -796,6 +796,7 @@ struct ipg_nic_private {
unsigned int rx_dirty; unsigned int rx_dirty;
bool is_jumbo; bool is_jumbo;
struct ipg_jumbo jumbo; struct ipg_jumbo jumbo;
unsigned long rxfrag_size;
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%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment