diff options
author | Michael Chan <mchan@broadcom.com> | 2012-12-06 05:33:12 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-12-07 12:44:02 -0500 |
commit | 4bd9b0fffb193d2e288f67f81821af32df8d4349 (patch) | |
tree | b2e19d3ffeac16974eda2d396f543a1d25466f1c /drivers | |
parent | 68c64d2034faa0961ad4a38b915dc10a4581bb64 (diff) |
cnic, bnx2x, bnx2: Simplify cnic probing.
Instead of using symbol_get(), cnic can now directly call the cnic_probe
functions in struct bnx2x and struct bnx2. symbol_get() is not reliable
as it fails when the module is still initializing.
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2.c | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2.h | 1 | ||||
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2x/bnx2x.h | 1 | ||||
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 4 | ||||
-rw-r--r-- | drivers/net/ethernet/broadcom/cnic.c | 21 | ||||
-rw-r--r-- | drivers/net/ethernet/broadcom/cnic_if.h | 7 |
6 files changed, 17 insertions, 19 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c index a9b2feaf287..c16526d3046 100644 --- a/drivers/net/ethernet/broadcom/bnx2.c +++ b/drivers/net/ethernet/broadcom/bnx2.c | |||
@@ -434,7 +434,6 @@ struct cnic_eth_dev *bnx2_cnic_probe(struct net_device *dev) | |||
434 | 434 | ||
435 | return cp; | 435 | return cp; |
436 | } | 436 | } |
437 | EXPORT_SYMBOL(bnx2_cnic_probe); | ||
438 | 437 | ||
439 | static void | 438 | static void |
440 | bnx2_cnic_stop(struct bnx2 *bp) | 439 | bnx2_cnic_stop(struct bnx2 *bp) |
@@ -8422,6 +8421,7 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev) | |||
8422 | bp->cnic_eth_dev.max_iscsi_conn = | 8421 | bp->cnic_eth_dev.max_iscsi_conn = |
8423 | (bnx2_shmem_rd(bp, BNX2_ISCSI_MAX_CONN) & | 8422 | (bnx2_shmem_rd(bp, BNX2_ISCSI_MAX_CONN) & |
8424 | BNX2_ISCSI_MAX_CONN_MASK) >> BNX2_ISCSI_MAX_CONN_SHIFT; | 8423 | BNX2_ISCSI_MAX_CONN_MASK) >> BNX2_ISCSI_MAX_CONN_SHIFT; |
8424 | bp->cnic_probe = bnx2_cnic_probe; | ||
8425 | #endif | 8425 | #endif |
8426 | pci_save_state(pdev); | 8426 | pci_save_state(pdev); |
8427 | 8427 | ||
diff --git a/drivers/net/ethernet/broadcom/bnx2.h b/drivers/net/ethernet/broadcom/bnx2.h index 38a640df58f..172efbecfea 100644 --- a/drivers/net/ethernet/broadcom/bnx2.h +++ b/drivers/net/ethernet/broadcom/bnx2.h | |||
@@ -6984,6 +6984,7 @@ struct bnx2 { | |||
6984 | #ifdef BCM_CNIC | 6984 | #ifdef BCM_CNIC |
6985 | struct mutex cnic_lock; | 6985 | struct mutex cnic_lock; |
6986 | struct cnic_eth_dev cnic_eth_dev; | 6986 | struct cnic_eth_dev cnic_eth_dev; |
6987 | struct cnic_eth_dev *(*cnic_probe)(struct net_device *); | ||
6987 | #endif | 6988 | #endif |
6988 | 6989 | ||
6989 | const struct firmware *mips_firmware; | 6990 | const struct firmware *mips_firmware; |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h index 02ea644573c..defa7d64712 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h | |||
@@ -1337,6 +1337,7 @@ struct bnx2x { | |||
1337 | u8 cnic_support; | 1337 | u8 cnic_support; |
1338 | bool cnic_enabled; | 1338 | bool cnic_enabled; |
1339 | bool cnic_loaded; | 1339 | bool cnic_loaded; |
1340 | struct cnic_eth_dev *(*cnic_probe)(struct net_device *); | ||
1340 | 1341 | ||
1341 | /* Flag that indicates that we can start looking for FCoE L2 queue | 1342 | /* Flag that indicates that we can start looking for FCoE L2 queue |
1342 | * completions in the default status block. | 1343 | * completions in the default status block. |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index 75aea83ee68..f34ff59a809 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | |||
@@ -12018,6 +12018,8 @@ static int bnx2x_get_num_non_def_sbs(struct pci_dev *pdev, | |||
12018 | return control & PCI_MSIX_FLAGS_QSIZE; | 12018 | return control & PCI_MSIX_FLAGS_QSIZE; |
12019 | } | 12019 | } |
12020 | 12020 | ||
12021 | struct cnic_eth_dev *bnx2x_cnic_probe(struct net_device *); | ||
12022 | |||
12021 | static int bnx2x_init_one(struct pci_dev *pdev, | 12023 | static int bnx2x_init_one(struct pci_dev *pdev, |
12022 | const struct pci_device_id *ent) | 12024 | const struct pci_device_id *ent) |
12023 | { | 12025 | { |
@@ -12097,6 +12099,7 @@ static int bnx2x_init_one(struct pci_dev *pdev, | |||
12097 | bp->igu_sb_cnt = max_non_def_sbs; | 12099 | bp->igu_sb_cnt = max_non_def_sbs; |
12098 | bp->msg_enable = debug; | 12100 | bp->msg_enable = debug; |
12099 | bp->cnic_support = cnic_cnt; | 12101 | bp->cnic_support = cnic_cnt; |
12102 | bp->cnic_probe = bnx2x_cnic_probe; | ||
12100 | 12103 | ||
12101 | pci_set_drvdata(pdev, dev); | 12104 | pci_set_drvdata(pdev, dev); |
12102 | 12105 | ||
@@ -13038,6 +13041,5 @@ struct cnic_eth_dev *bnx2x_cnic_probe(struct net_device *dev) | |||
13038 | cp->starting_cid); | 13041 | cp->starting_cid); |
13039 | return cp; | 13042 | return cp; |
13040 | } | 13043 | } |
13041 | EXPORT_SYMBOL(bnx2x_cnic_probe); | ||
13042 | 13044 | ||
13043 | 13045 | ||
diff --git a/drivers/net/ethernet/broadcom/cnic.c b/drivers/net/ethernet/broadcom/cnic.c index b8650939a4b..df8c30d1a52 100644 --- a/drivers/net/ethernet/broadcom/cnic.c +++ b/drivers/net/ethernet/broadcom/cnic.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include <net/ip6_checksum.h> | 40 | #include <net/ip6_checksum.h> |
41 | #include <scsi/iscsi_if.h> | 41 | #include <scsi/iscsi_if.h> |
42 | 42 | ||
43 | #define BCM_CNIC 1 | ||
43 | #include "cnic_if.h" | 44 | #include "cnic_if.h" |
44 | #include "bnx2.h" | 45 | #include "bnx2.h" |
45 | #include "bnx2x/bnx2x.h" | 46 | #include "bnx2x/bnx2x.h" |
@@ -5449,14 +5450,12 @@ static struct cnic_dev *init_bnx2_cnic(struct net_device *dev) | |||
5449 | struct pci_dev *pdev; | 5450 | struct pci_dev *pdev; |
5450 | struct cnic_dev *cdev; | 5451 | struct cnic_dev *cdev; |
5451 | struct cnic_local *cp; | 5452 | struct cnic_local *cp; |
5453 | struct bnx2 *bp = netdev_priv(dev); | ||
5452 | struct cnic_eth_dev *ethdev = NULL; | 5454 | struct cnic_eth_dev *ethdev = NULL; |
5453 | struct cnic_eth_dev *(*probe)(struct net_device *) = NULL; | ||
5454 | 5455 | ||
5455 | probe = symbol_get(bnx2_cnic_probe); | 5456 | if (bp->cnic_probe) |
5456 | if (probe) { | 5457 | ethdev = (bp->cnic_probe)(dev); |
5457 | ethdev = (*probe)(dev); | 5458 | |
5458 | symbol_put(bnx2_cnic_probe); | ||
5459 | } | ||
5460 | if (!ethdev) | 5459 | if (!ethdev) |
5461 | return NULL; | 5460 | return NULL; |
5462 | 5461 | ||
@@ -5511,14 +5510,12 @@ static struct cnic_dev *init_bnx2x_cnic(struct net_device *dev) | |||
5511 | struct pci_dev *pdev; | 5510 | struct pci_dev *pdev; |
5512 | struct cnic_dev *cdev; | 5511 | struct cnic_dev *cdev; |
5513 | struct cnic_local *cp; | 5512 | struct cnic_local *cp; |
5513 | struct bnx2x *bp = netdev_priv(dev); | ||
5514 | struct cnic_eth_dev *ethdev = NULL; | 5514 | struct cnic_eth_dev *ethdev = NULL; |
5515 | struct cnic_eth_dev *(*probe)(struct net_device *) = NULL; | ||
5516 | 5515 | ||
5517 | probe = symbol_get(bnx2x_cnic_probe); | 5516 | if (bp->cnic_probe) |
5518 | if (probe) { | 5517 | ethdev = bp->cnic_probe(dev); |
5519 | ethdev = (*probe)(dev); | 5518 | |
5520 | symbol_put(bnx2x_cnic_probe); | ||
5521 | } | ||
5522 | if (!ethdev) | 5519 | if (!ethdev) |
5523 | return NULL; | 5520 | return NULL; |
5524 | 5521 | ||
diff --git a/drivers/net/ethernet/broadcom/cnic_if.h b/drivers/net/ethernet/broadcom/cnic_if.h index 502e11ef637..2a35436f909 100644 --- a/drivers/net/ethernet/broadcom/cnic_if.h +++ b/drivers/net/ethernet/broadcom/cnic_if.h | |||
@@ -14,8 +14,8 @@ | |||
14 | 14 | ||
15 | #include "bnx2x/bnx2x_mfw_req.h" | 15 | #include "bnx2x/bnx2x_mfw_req.h" |
16 | 16 | ||
17 | #define CNIC_MODULE_VERSION "2.5.15" | 17 | #define CNIC_MODULE_VERSION "2.5.16" |
18 | #define CNIC_MODULE_RELDATE "Dec 04, 2012" | 18 | #define CNIC_MODULE_RELDATE "Dec 05, 2012" |
19 | 19 | ||
20 | #define CNIC_ULP_RDMA 0 | 20 | #define CNIC_ULP_RDMA 0 |
21 | #define CNIC_ULP_ISCSI 1 | 21 | #define CNIC_ULP_ISCSI 1 |
@@ -353,7 +353,4 @@ extern int cnic_register_driver(int ulp_type, struct cnic_ulp_ops *ulp_ops); | |||
353 | 353 | ||
354 | extern int cnic_unregister_driver(int ulp_type); | 354 | extern int cnic_unregister_driver(int ulp_type); |
355 | 355 | ||
356 | extern struct cnic_eth_dev *bnx2_cnic_probe(struct net_device *dev); | ||
357 | extern struct cnic_eth_dev *bnx2x_cnic_probe(struct net_device *dev); | ||
358 | |||
359 | #endif | 356 | #endif |