diff options
author | Pekka Enberg <penberg@cs.helsinki.fi> | 2008-06-23 07:36:00 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-07-04 08:46:52 -0400 |
commit | 18a9cdb9c7ec88f6e94cd8dcb03fb6cded067119 (patch) | |
tree | 295fd582e2b7214a2638f1c96d152a029c822976 /drivers/net/ipg.c | |
parent | 83042955210aaee70b881240fe4f5e8409235308 (diff) |
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: 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/ipg.c')
-rw-r--r-- | drivers/net/ipg.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/drivers/net/ipg.c b/drivers/net/ipg.c index 40ce90dedb02..5c5653bd48c1 100644 --- a/drivers/net/ipg.c +++ b/drivers/net/ipg.c | |||
@@ -751,7 +751,7 @@ static int ipg_get_rxbuff(struct net_device *dev, int entry) | |||
751 | sp->rx_buf_sz, PCI_DMA_FROMDEVICE)); | 751 | sp->rx_buf_sz, PCI_DMA_FROMDEVICE)); |
752 | 752 | ||
753 | /* Set the RFD fragment length. */ | 753 | /* Set the RFD fragment length. */ |
754 | rxfragsize = IPG_RXFRAG_SIZE; | 754 | rxfragsize = sp->rxfrag_size; |
755 | rxfd->frag_info |= cpu_to_le64((rxfragsize << 48) & IPG_RFI_FRAGLEN); | 755 | rxfd->frag_info |= cpu_to_le64((rxfragsize << 48) & IPG_RFI_FRAGLEN); |
756 | 756 | ||
757 | return 0; | 757 | return 0; |
@@ -1207,8 +1207,8 @@ static void ipg_nic_rx_with_start_and_end(struct net_device *dev, | |||
1207 | 1207 | ||
1208 | /* accept this frame and send to upper layer */ | 1208 | /* accept this frame and send to upper layer */ |
1209 | framelen = le64_to_cpu(rxfd->rfs) & IPG_RFS_RXFRAMELEN; | 1209 | framelen = le64_to_cpu(rxfd->rfs) & IPG_RFS_RXFRAMELEN; |
1210 | if (framelen > IPG_RXFRAG_SIZE) | 1210 | if (framelen > sp->rxfrag_size) |
1211 | framelen = IPG_RXFRAG_SIZE; | 1211 | framelen = sp->rxfrag_size; |
1212 | 1212 | ||
1213 | skb_put(skb, framelen); | 1213 | skb_put(skb, framelen); |
1214 | skb->protocol = eth_type_trans(skb, dev); | 1214 | skb->protocol = eth_type_trans(skb, dev); |
@@ -1241,10 +1241,10 @@ static void ipg_nic_rx_with_start(struct net_device *dev, | |||
1241 | pci_unmap_single(pdev, le64_to_cpu(rxfd->frag_info & ~IPG_RFI_FRAGLEN), | 1241 | pci_unmap_single(pdev, le64_to_cpu(rxfd->frag_info & ~IPG_RFI_FRAGLEN), |
1242 | sp->rx_buf_sz, PCI_DMA_FROMDEVICE); | 1242 | sp->rx_buf_sz, PCI_DMA_FROMDEVICE); |
1243 | 1243 | ||
1244 | skb_put(skb, IPG_RXFRAG_SIZE); | 1244 | skb_put(skb, sp->rxfrag_size); |
1245 | 1245 | ||
1246 | jumbo->found_start = 1; | 1246 | jumbo->found_start = 1; |
1247 | jumbo->current_size = IPG_RXFRAG_SIZE; | 1247 | jumbo->current_size = sp->rxfrag_size; |
1248 | jumbo->skb = skb; | 1248 | jumbo->skb = skb; |
1249 | 1249 | ||
1250 | sp->rx_buff[entry] = NULL; | 1250 | sp->rx_buff[entry] = NULL; |
@@ -1270,10 +1270,6 @@ static void ipg_nic_rx_with_end(struct net_device *dev, | |||
1270 | framelen = le64_to_cpu(rxfd->rfs) & IPG_RFS_RXFRAMELEN; | 1270 | framelen = le64_to_cpu(rxfd->rfs) & IPG_RFS_RXFRAMELEN; |
1271 | 1271 | ||
1272 | endframelen = framelen - jumbo->current_size; | 1272 | endframelen = framelen - jumbo->current_size; |
1273 | /* | ||
1274 | if (framelen > IPG_RXFRAG_SIZE) | ||
1275 | framelen=IPG_RXFRAG_SIZE; | ||
1276 | */ | ||
1277 | if (framelen > IPG_RXSUPPORT_SIZE) | 1273 | if (framelen > IPG_RXSUPPORT_SIZE) |
1278 | dev_kfree_skb_irq(jumbo->skb); | 1274 | dev_kfree_skb_irq(jumbo->skb); |
1279 | else { | 1275 | else { |
@@ -1314,11 +1310,11 @@ static void ipg_nic_rx_no_start_no_end(struct net_device *dev, | |||
1314 | 1310 | ||
1315 | if (skb) { | 1311 | if (skb) { |
1316 | if (jumbo->found_start) { | 1312 | if (jumbo->found_start) { |
1317 | jumbo->current_size += IPG_RXFRAG_SIZE; | 1313 | jumbo->current_size += sp->rxfrag_size; |
1318 | if (jumbo->current_size <= IPG_RXSUPPORT_SIZE) { | 1314 | if (jumbo->current_size <= IPG_RXSUPPORT_SIZE) { |
1319 | memcpy(skb_put(jumbo->skb, | 1315 | memcpy(skb_put(jumbo->skb, |
1320 | IPG_RXFRAG_SIZE), | 1316 | sp->rxfrag_size), |
1321 | skb->data, IPG_RXFRAG_SIZE); | 1317 | skb->data, sp->rxfrag_size); |
1322 | } | 1318 | } |
1323 | } | 1319 | } |
1324 | dev->last_rx = jiffies; | 1320 | dev->last_rx = jiffies; |
@@ -1410,11 +1406,11 @@ static int ipg_nic_rx(struct net_device *dev) | |||
1410 | /* Check for jumbo frame arrival with too small | 1406 | /* Check for jumbo frame arrival with too small |
1411 | * RXFRAG_SIZE. | 1407 | * RXFRAG_SIZE. |
1412 | */ | 1408 | */ |
1413 | if (framelen > IPG_RXFRAG_SIZE) { | 1409 | if (framelen > sp->rxfrag_size) { |
1414 | IPG_DEBUG_MSG | 1410 | IPG_DEBUG_MSG |
1415 | ("RFS FrameLen > allocated fragment size.\n"); | 1411 | ("RFS FrameLen > allocated fragment size.\n"); |
1416 | 1412 | ||
1417 | framelen = IPG_RXFRAG_SIZE; | 1413 | framelen = sp->rxfrag_size; |
1418 | } | 1414 | } |
1419 | 1415 | ||
1420 | if ((IPG_DROP_ON_RX_ETH_ERRORS && (le64_to_cpu(rxfd->rfs) & | 1416 | 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 | mutex_init(&sp->mii_mutex); | 2236 | mutex_init(&sp->mii_mutex); |
2241 | 2237 | ||
2242 | sp->is_jumbo = IPG_JUMBO; | 2238 | sp->is_jumbo = IPG_JUMBO; |
2239 | sp->rxfrag_size = IPG_RXFRAG_SIZE; | ||
2243 | 2240 | ||
2244 | /* Declare IPG NIC functions for Ethernet device methods. | 2241 | /* Declare IPG NIC functions for Ethernet device methods. |
2245 | */ | 2242 | */ |