diff options
author | Auke Kok <auke-jan.h.kok@intel.com> | 2006-05-26 12:35:43 -0400 |
---|---|---|
committer | Auke Kok <juke-jan.h.kok@intel.com> | 2006-05-26 12:35:43 -0400 |
commit | 3f3dc0dd2086402b684545d66bb5ece93c76330b (patch) | |
tree | 623c09c2cfc13bfe31c15afe22ce3ab223c4763f /drivers/net/ixgb | |
parent | 989316ddfeafd0e8fb51a4d811383769ad62637a (diff) |
ixgb: allocate only buffersize needed
In order to help correct window size growth, use the MFS register
to limit the packet sizes received and allocate only the buffer
size necessary
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
Signed-off-by: John Ronciak <john.ronciak@intel.com>
index 0905a82..84a8064 100644
--- a/drivers/net/ixgb/ixgb_main.c
+++ b/drivers/net/ixgb/ixgb_main.c
@@ -574,9 +574,8 @@ ixgb_sw_init(struct ixgb_adapter *adapte
hw->subsystem_vendor_id = pdev->subsystem_vendor;
hw->subsystem_id = pdev->subsystem_device;
- adapter->rx_buffer_len = IXGB_RXBUFFER_2048;
-
hw->max_frame_size = netdev->mtu + ENET_HEADER_SIZE + ENET_FCS_LENGTH;
+ adapter->rx_buffer_len = hw->max_frame_size;
if((hw->device_id == IXGB_DEVICE_ID_82597EX)
|| (hw->device_id == IXGB_DEVICE_ID_82597EX_CX4)
@@ -820,21 +819,14 @@ ixgb_setup_rctl(struct ixgb_adapter *ada
rctl |= IXGB_RCTL_SECRC;
- switch (adapter->rx_buffer_len) {
- case IXGB_RXBUFFER_2048:
- default:
+ if (adapter->rx_buffer_len <= IXGB_RXBUFFER_2048)
rctl |= IXGB_RCTL_BSIZE_2048;
- break;
- case IXGB_RXBUFFER_4096:
+ else if (adapter->rx_buffer_len <= IXGB_RXBUFFER_4096)
rctl |= IXGB_RCTL_BSIZE_4096;
- break;
- case IXGB_RXBUFFER_8192:
+ else if (adapter->rx_buffer_len <= IXGB_RXBUFFER_8192)
rctl |= IXGB_RCTL_BSIZE_8192;
- break;
- case IXGB_RXBUFFER_16384:
+ else if (adapter->rx_buffer_len <= IXGB_RXBUFFER_16384)
rctl |= IXGB_RCTL_BSIZE_16384;
- break;
- }
IXGB_WRITE_REG(&adapter->hw, RCTL, rctl);
}
@@ -1551,25 +1543,12 @@ ixgb_change_mtu(struct net_device *netde
DPRINTK(PROBE, ERR, "Invalid MTU setting %d\n", new_mtu);
return -EINVAL;
}
-
- if((max_frame <= IXGB_MAX_ENET_FRAME_SIZE_WITHOUT_FCS + ENET_FCS_LENGTH)
- || (max_frame <= IXGB_RXBUFFER_2048)) {
- adapter->rx_buffer_len = IXGB_RXBUFFER_2048;
-
- } else if(max_frame <= IXGB_RXBUFFER_4096) {
- adapter->rx_buffer_len = IXGB_RXBUFFER_4096;
- } else if(max_frame <= IXGB_RXBUFFER_8192) {
- adapter->rx_buffer_len = IXGB_RXBUFFER_8192;
+ adapter->rx_buffer_len = max_frame;
- } else {
- adapter->rx_buffer_len = IXGB_RXBUFFER_16384;
- }
-
netdev->mtu = new_mtu;
-
- if(old_max_frame != max_frame && netif_running(netdev)) {
+ if ((old_max_frame != max_frame) && netif_running(netdev)) {
ixgb_down(adapter, TRUE);
ixgb_up(adapter);
}
Diffstat (limited to 'drivers/net/ixgb')
-rw-r--r-- | drivers/net/ixgb/ixgb_main.c | 35 |
1 files changed, 7 insertions, 28 deletions
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c index 5561ab6e9d36..b8258509f9f9 100644 --- a/drivers/net/ixgb/ixgb_main.c +++ b/drivers/net/ixgb/ixgb_main.c | |||
@@ -576,9 +576,8 @@ ixgb_sw_init(struct ixgb_adapter *adapter) | |||
576 | hw->subsystem_vendor_id = pdev->subsystem_vendor; | 576 | hw->subsystem_vendor_id = pdev->subsystem_vendor; |
577 | hw->subsystem_id = pdev->subsystem_device; | 577 | hw->subsystem_id = pdev->subsystem_device; |
578 | 578 | ||
579 | adapter->rx_buffer_len = IXGB_RXBUFFER_2048; | ||
580 | |||
581 | hw->max_frame_size = netdev->mtu + ENET_HEADER_SIZE + ENET_FCS_LENGTH; | 579 | hw->max_frame_size = netdev->mtu + ENET_HEADER_SIZE + ENET_FCS_LENGTH; |
580 | adapter->rx_buffer_len = hw->max_frame_size; | ||
582 | 581 | ||
583 | if((hw->device_id == IXGB_DEVICE_ID_82597EX) | 582 | if((hw->device_id == IXGB_DEVICE_ID_82597EX) |
584 | || (hw->device_id == IXGB_DEVICE_ID_82597EX_CX4) | 583 | || (hw->device_id == IXGB_DEVICE_ID_82597EX_CX4) |
@@ -822,21 +821,14 @@ ixgb_setup_rctl(struct ixgb_adapter *adapter) | |||
822 | 821 | ||
823 | rctl |= IXGB_RCTL_SECRC; | 822 | rctl |= IXGB_RCTL_SECRC; |
824 | 823 | ||
825 | switch (adapter->rx_buffer_len) { | 824 | if (adapter->rx_buffer_len <= IXGB_RXBUFFER_2048) |
826 | case IXGB_RXBUFFER_2048: | ||
827 | default: | ||
828 | rctl |= IXGB_RCTL_BSIZE_2048; | 825 | rctl |= IXGB_RCTL_BSIZE_2048; |
829 | break; | 826 | else if (adapter->rx_buffer_len <= IXGB_RXBUFFER_4096) |
830 | case IXGB_RXBUFFER_4096: | ||
831 | rctl |= IXGB_RCTL_BSIZE_4096; | 827 | rctl |= IXGB_RCTL_BSIZE_4096; |
832 | break; | 828 | else if (adapter->rx_buffer_len <= IXGB_RXBUFFER_8192) |
833 | case IXGB_RXBUFFER_8192: | ||
834 | rctl |= IXGB_RCTL_BSIZE_8192; | 829 | rctl |= IXGB_RCTL_BSIZE_8192; |
835 | break; | 830 | else if (adapter->rx_buffer_len <= IXGB_RXBUFFER_16384) |
836 | case IXGB_RXBUFFER_16384: | ||
837 | rctl |= IXGB_RCTL_BSIZE_16384; | 831 | rctl |= IXGB_RCTL_BSIZE_16384; |
838 | break; | ||
839 | } | ||
840 | 832 | ||
841 | IXGB_WRITE_REG(&adapter->hw, RCTL, rctl); | 833 | IXGB_WRITE_REG(&adapter->hw, RCTL, rctl); |
842 | } | 834 | } |
@@ -1546,24 +1538,11 @@ ixgb_change_mtu(struct net_device *netdev, int new_mtu) | |||
1546 | return -EINVAL; | 1538 | return -EINVAL; |
1547 | } | 1539 | } |
1548 | 1540 | ||
1549 | if((max_frame <= IXGB_MAX_ENET_FRAME_SIZE_WITHOUT_FCS + ENET_FCS_LENGTH) | 1541 | adapter->rx_buffer_len = max_frame; |
1550 | || (max_frame <= IXGB_RXBUFFER_2048)) { | ||
1551 | adapter->rx_buffer_len = IXGB_RXBUFFER_2048; | ||
1552 | |||
1553 | } else if(max_frame <= IXGB_RXBUFFER_4096) { | ||
1554 | adapter->rx_buffer_len = IXGB_RXBUFFER_4096; | ||
1555 | |||
1556 | } else if(max_frame <= IXGB_RXBUFFER_8192) { | ||
1557 | adapter->rx_buffer_len = IXGB_RXBUFFER_8192; | ||
1558 | |||
1559 | } else { | ||
1560 | adapter->rx_buffer_len = IXGB_RXBUFFER_16384; | ||
1561 | } | ||
1562 | 1542 | ||
1563 | netdev->mtu = new_mtu; | 1543 | netdev->mtu = new_mtu; |
1564 | 1544 | ||
1565 | if(old_max_frame != max_frame && netif_running(netdev)) { | 1545 | if ((old_max_frame != max_frame) && netif_running(netdev)) { |
1566 | |||
1567 | ixgb_down(adapter, TRUE); | 1546 | ixgb_down(adapter, TRUE); |
1568 | ixgb_up(adapter); | 1547 | ixgb_up(adapter); |
1569 | } | 1548 | } |