diff options
author | Dmitry Kravkov <dmitry@broadcom.com> | 2010-08-03 17:49:40 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-08-17 00:06:18 -0400 |
commit | 6891dd25d3f82e50979b27fde1980aa96320b975 (patch) | |
tree | 8e1b1b74726f6ff6590864c648caa846b6734ea0 /drivers/net/bnx2x/bnx2x_cmn.c | |
parent | eca6fc7836af8eec9ba7e029b604690451bb44a0 (diff) |
bnx2x: Load firmware in open() instead of probe()
Loading firmware when actually bringing eth device up.
This also will allow driver to be insmoded when filesystem with
firmware files is not available yet.
Suggested by Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bnx2x/bnx2x_cmn.c')
-rw-r--r-- | drivers/net/bnx2x/bnx2x_cmn.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/net/bnx2x/bnx2x_cmn.c b/drivers/net/bnx2x/bnx2x_cmn.c index 02bf710629a3..da96d1a18c20 100644 --- a/drivers/net/bnx2x/bnx2x_cmn.c +++ b/drivers/net/bnx2x/bnx2x_cmn.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/ip.h> | 20 | #include <linux/ip.h> |
21 | #include <linux/ipv6.h> | 21 | #include <linux/ipv6.h> |
22 | #include <net/ip6_checksum.h> | 22 | #include <net/ip6_checksum.h> |
23 | #include <linux/firmware.h> | ||
23 | #include "bnx2x_cmn.h" | 24 | #include "bnx2x_cmn.h" |
24 | 25 | ||
25 | #ifdef BCM_VLAN | 26 | #ifdef BCM_VLAN |
@@ -1206,12 +1207,27 @@ static int bnx2x_set_num_queues(struct bnx2x *bp) | |||
1206 | return rc; | 1207 | return rc; |
1207 | } | 1208 | } |
1208 | 1209 | ||
1210 | static void bnx2x_release_firmware(struct bnx2x *bp) | ||
1211 | { | ||
1212 | kfree(bp->init_ops_offsets); | ||
1213 | kfree(bp->init_ops); | ||
1214 | kfree(bp->init_data); | ||
1215 | release_firmware(bp->firmware); | ||
1216 | } | ||
1217 | |||
1209 | /* must be called with rtnl_lock */ | 1218 | /* must be called with rtnl_lock */ |
1210 | int bnx2x_nic_load(struct bnx2x *bp, int load_mode) | 1219 | int bnx2x_nic_load(struct bnx2x *bp, int load_mode) |
1211 | { | 1220 | { |
1212 | u32 load_code; | 1221 | u32 load_code; |
1213 | int i, rc; | 1222 | int i, rc; |
1214 | 1223 | ||
1224 | /* Set init arrays */ | ||
1225 | rc = bnx2x_init_firmware(bp); | ||
1226 | if (rc) { | ||
1227 | BNX2X_ERR("Error loading firmware\n"); | ||
1228 | return rc; | ||
1229 | } | ||
1230 | |||
1215 | #ifdef BNX2X_STOP_ON_ERROR | 1231 | #ifdef BNX2X_STOP_ON_ERROR |
1216 | if (unlikely(bp->panic)) | 1232 | if (unlikely(bp->panic)) |
1217 | return -EPERM; | 1233 | return -EPERM; |
@@ -1427,6 +1443,8 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode) | |||
1427 | #endif | 1443 | #endif |
1428 | bnx2x_inc_load_cnt(bp); | 1444 | bnx2x_inc_load_cnt(bp); |
1429 | 1445 | ||
1446 | bnx2x_release_firmware(bp); | ||
1447 | |||
1430 | return 0; | 1448 | return 0; |
1431 | 1449 | ||
1432 | #ifdef BCM_CNIC | 1450 | #ifdef BCM_CNIC |
@@ -1454,6 +1472,8 @@ load_error1: | |||
1454 | netif_napi_del(&bnx2x_fp(bp, i, napi)); | 1472 | netif_napi_del(&bnx2x_fp(bp, i, napi)); |
1455 | bnx2x_free_mem(bp); | 1473 | bnx2x_free_mem(bp); |
1456 | 1474 | ||
1475 | bnx2x_release_firmware(bp); | ||
1476 | |||
1457 | return rc; | 1477 | return rc; |
1458 | } | 1478 | } |
1459 | 1479 | ||