android_kernel_xiaomi_sm8350/drivers
Auke Kok 3f3dc0dd20 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);
 	}
2006-05-26 09:35:43 -07:00
..
acorn
acpi
amba
atm
base [PATCH] drivers/base/firmware_class.c: cleanups 2006-05-21 12:59:19 -07:00
block [PATCH] USB: ub oops in block_uevent 2006-05-08 23:43:55 -07:00
bluetooth
cdrom
char [PATCH] tty_insert_flip_string_flags() license fix 2006-05-23 10:35:31 -07:00
connector
cpufreq
crypto
dio
edac
eisa
fc4
firmware
hwmon
i2c [PATCH] scx200_acb: Fix for the CS5535 errata 2006-05-09 13:04:21 -07:00
ide [PATCH] powerpc: Fix ide-pmac sysfs entry 2006-05-21 12:59:16 -07:00
ieee1394 [PATCH] ohci1394, sbp2: fix "scsi_add_device failed" with PL-3507 based devices 2006-05-17 21:32:22 -07:00
infiniband IB/mthca: Fix posting lists of 256 receive requests for Tavor 2006-05-18 11:37:03 -07:00
input
isdn [PATCH] Overrun in isdn_tty.c 2006-05-21 12:59:18 -07:00
leds [PATCH] LED: Fix sysfs store function error handling 2006-05-15 11:20:56 -07:00
macintosh
mca
md [PATCH] md: fix possible oops when starting a raid0 array 2006-05-23 10:35:31 -07:00
media V4L/DVB (4041): Fix compilation on PPC 64 2006-05-23 16:08:29 -03:00
message [SCSI] mptfc: race between mptfc_register_dev and mptfc_target_alloc 2006-05-10 09:54:42 -05:00
mfd
misc
mmc [ARM] 3531/1: i.MX/MX1 SD/MMC ensure, that clock are stopped before new command and cleanups 2006-05-19 21:48:03 +01:00
mtd
net ixgb: allocate only buffersize needed 2006-05-26 09:35:43 -07:00
nubus
oprofile
parisc
parport
pci [PATCH] Revive pci_find_ext_capability 2006-05-24 00:27:31 -04:00
pcmcia [PATCH] pd6729 section fix 2006-05-21 12:59:22 -07:00
pnp
rapidio
rtc [PATCH] rtc subsystem: use ENOIOCTLCMD and ENOTTY where appropriate 2006-05-21 12:59:21 -07:00
s390 Merge branch 'master' into upstream 2006-05-20 00:03:38 -04:00
sbus [SPARC]: Fix warning on prom_getproperty in openprom.c 2006-05-12 12:53:59 -07:00
scsi [PATCH] missing newline in scsi/st.c 2006-05-21 12:59:21 -07:00
serial [SUNSU]: Fix license. 2006-05-21 20:08:56 -07:00
sh
sn
spi [PATCH] pxa2xx-spi update 2006-05-21 12:59:20 -07:00
tc
telephony
usb [PATCH] HID read busywait fix 2006-05-21 12:59:17 -07:00
video [PATCH] i810 section fix 2006-05-21 12:59:22 -07:00
w1
zorro
Kconfig
Makefile