diff options
Diffstat (limited to 'drivers/net/e100.c')
-rw-r--r-- | drivers/net/e100.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/drivers/net/e100.c b/drivers/net/e100.c index d269a68ce354..839fb2b136d3 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 | ||
@@ -1817,6 +1829,7 @@ static int e100_alloc_cbs(struct nic *nic) | |||
1817 | &nic->cbs_dma_addr); | 1829 | &nic->cbs_dma_addr); |
1818 | if (!nic->cbs) | 1830 | if (!nic->cbs) |
1819 | return -ENOMEM; | 1831 | return -ENOMEM; |
1832 | memset(nic->cbs, 0, count * sizeof(struct cb)); | ||
1820 | 1833 | ||
1821 | for (cb = nic->cbs, i = 0; i < count; cb++, i++) { | 1834 | for (cb = nic->cbs, i = 0; i < count; cb++, i++) { |
1822 | cb->next = (i + 1 < count) ? cb + 1 : nic->cbs; | 1835 | cb->next = (i + 1 < count) ? cb + 1 : nic->cbs; |
@@ -1825,7 +1838,6 @@ static int e100_alloc_cbs(struct nic *nic) | |||
1825 | cb->dma_addr = nic->cbs_dma_addr + i * sizeof(struct cb); | 1838 | cb->dma_addr = nic->cbs_dma_addr + i * sizeof(struct cb); |
1826 | cb->link = cpu_to_le32(nic->cbs_dma_addr + | 1839 | cb->link = cpu_to_le32(nic->cbs_dma_addr + |
1827 | ((i+1) % count) * sizeof(struct cb)); | 1840 | ((i+1) % count) * sizeof(struct cb)); |
1828 | cb->skb = NULL; | ||
1829 | } | 1841 | } |
1830 | 1842 | ||
1831 | nic->cb_to_use = nic->cb_to_send = nic->cb_to_clean = nic->cbs; | 1843 | nic->cb_to_use = nic->cb_to_send = nic->cb_to_clean = nic->cbs; |
@@ -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); |