diff options
Diffstat (limited to 'drivers/net/e100.c')
-rw-r--r-- | drivers/net/e100.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/drivers/net/e100.c b/drivers/net/e100.c index d269a68ce354..929701ca07d3 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c | |||
@@ -624,6 +624,7 @@ struct nic { | |||
624 | u16 eeprom_wc; | 624 | u16 eeprom_wc; |
625 | __le16 eeprom[256]; | 625 | __le16 eeprom[256]; |
626 | spinlock_t mdio_lock; | 626 | spinlock_t mdio_lock; |
627 | const struct firmware *fw; | ||
627 | }; | 628 | }; |
628 | 629 | ||
629 | static inline void e100_write_flush(struct nic *nic) | 630 | static inline void e100_write_flush(struct nic *nic) |
@@ -1225,9 +1226,9 @@ static void e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb) | |||
1225 | static const struct firmware *e100_request_firmware(struct nic *nic) | 1226 | static const struct firmware *e100_request_firmware(struct nic *nic) |
1226 | { | 1227 | { |
1227 | const char *fw_name; | 1228 | const char *fw_name; |
1228 | const struct firmware *fw; | 1229 | const struct firmware *fw = nic->fw; |
1229 | u8 timer, bundle, min_size; | 1230 | u8 timer, bundle, min_size; |
1230 | int err; | 1231 | int err = 0; |
1231 | 1232 | ||
1232 | /* do not load u-code for ICH devices */ | 1233 | /* do not load u-code for ICH devices */ |
1233 | if (nic->flags & ich) | 1234 | if (nic->flags & ich) |
@@ -1243,12 +1244,20 @@ static const struct firmware *e100_request_firmware(struct nic *nic) | |||
1243 | else /* No ucode on other devices */ | 1244 | else /* No ucode on other devices */ |
1244 | return NULL; | 1245 | return NULL; |
1245 | 1246 | ||
1246 | err = request_firmware(&fw, fw_name, &nic->pdev->dev); | 1247 | /* If the firmware has not previously been loaded, request a pointer |
1248 | * to it. If it was previously loaded, we are reinitializing the | ||
1249 | * adapter, possibly in a resume from hibernate, in which case | ||
1250 | * request_firmware() cannot be used. | ||
1251 | */ | ||
1252 | if (!fw) | ||
1253 | err = request_firmware(&fw, fw_name, &nic->pdev->dev); | ||
1254 | |||
1247 | if (err) { | 1255 | if (err) { |
1248 | DPRINTK(PROBE, ERR, "Failed to load firmware \"%s\": %d\n", | 1256 | DPRINTK(PROBE, ERR, "Failed to load firmware \"%s\": %d\n", |
1249 | fw_name, err); | 1257 | fw_name, err); |
1250 | return ERR_PTR(err); | 1258 | return ERR_PTR(err); |
1251 | } | 1259 | } |
1260 | |||
1252 | /* Firmware should be precisely UCODE_SIZE (words) plus three bytes | 1261 | /* Firmware should be precisely UCODE_SIZE (words) plus three bytes |
1253 | indicating the offsets for BUNDLESMALL, BUNDLEMAX, INTDELAY */ | 1262 | indicating the offsets for BUNDLESMALL, BUNDLEMAX, INTDELAY */ |
1254 | if (fw->size != UCODE_SIZE * 4 + 3) { | 1263 | if (fw->size != UCODE_SIZE * 4 + 3) { |
@@ -1271,7 +1280,10 @@ static const struct firmware *e100_request_firmware(struct nic *nic) | |||
1271 | release_firmware(fw); | 1280 | release_firmware(fw); |
1272 | return ERR_PTR(-EINVAL); | 1281 | return ERR_PTR(-EINVAL); |
1273 | } | 1282 | } |
1274 | /* OK, firmware is validated and ready to use... */ | 1283 | |
1284 | /* OK, firmware is validated and ready to use. Save a pointer | ||
1285 | * to it in the nic */ | ||
1286 | nic->fw = fw; | ||
1275 | return fw; | 1287 | return fw; |
1276 | } | 1288 | } |
1277 | 1289 | ||
@@ -1852,11 +1864,10 @@ static inline void e100_start_receiver(struct nic *nic, struct rx *rx) | |||
1852 | #define RFD_BUF_LEN (sizeof(struct rfd) + VLAN_ETH_FRAME_LEN) | 1864 | #define RFD_BUF_LEN (sizeof(struct rfd) + VLAN_ETH_FRAME_LEN) |
1853 | static int e100_rx_alloc_skb(struct nic *nic, struct rx *rx) | 1865 | static int e100_rx_alloc_skb(struct nic *nic, struct rx *rx) |
1854 | { | 1866 | { |
1855 | if (!(rx->skb = netdev_alloc_skb(nic->netdev, RFD_BUF_LEN + NET_IP_ALIGN))) | 1867 | if (!(rx->skb = netdev_alloc_skb_ip_align(nic->netdev, RFD_BUF_LEN))) |
1856 | return -ENOMEM; | 1868 | return -ENOMEM; |
1857 | 1869 | ||
1858 | /* Align, init, and map the RFD. */ | 1870 | /* Init, and map the RFD. */ |
1859 | skb_reserve(rx->skb, NET_IP_ALIGN); | ||
1860 | skb_copy_to_linear_data(rx->skb, &nic->blank_rfd, sizeof(struct rfd)); | 1871 | skb_copy_to_linear_data(rx->skb, &nic->blank_rfd, sizeof(struct rfd)); |
1861 | rx->dma_addr = pci_map_single(nic->pdev, rx->skb->data, | 1872 | rx->dma_addr = pci_map_single(nic->pdev, rx->skb->data, |
1862 | RFD_BUF_LEN, PCI_DMA_BIDIRECTIONAL); | 1873 | RFD_BUF_LEN, PCI_DMA_BIDIRECTIONAL); |