aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/benet
diff options
context:
space:
mode:
authorsarveshwarb <sarveshwarb@serverengines.com>2009-08-05 16:05:24 -0400
committerDavid S. Miller <davem@davemloft.net>2009-08-05 16:05:24 -0400
commit14074eab8dcaa7f66d8f52612b2dcec51222bb5f (patch)
treeb385d8edcc1c6ce44ac7c58552cb0de7839ceb46 /drivers/net/benet
parent0d6038ee76f2e06b79d0465807f67e86bf4025de (diff)
be2net: Patch to perform function reset at initialization
This patch is a bug fix to avoid system going into a bad state when driver is loaded in context of kdump kernel. The patch fixes the issue by performing a soft reset of pci function at probe time. Signed-off-by: sarveshwarb <sarveshwarb@serverengines.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/benet')
-rw-r--r--drivers/net/benet/be_cmds.c21
-rw-r--r--drivers/net/benet/be_cmds.h2
-rw-r--r--drivers/net/benet/be_main.c4
3 files changed, 27 insertions, 0 deletions
diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c
index de107732dcdc..2547ee296a7d 100644
--- a/drivers/net/benet/be_cmds.c
+++ b/drivers/net/benet/be_cmds.c
@@ -1019,3 +1019,24 @@ int be_cmd_query_fw_cfg(struct be_adapter *adapter, u32 *port_num)
1019 spin_unlock(&adapter->mbox_lock); 1019 spin_unlock(&adapter->mbox_lock);
1020 return status; 1020 return status;
1021} 1021}
1022
1023int be_cmd_reset_function(struct be_adapter *adapter)
1024{
1025 struct be_mcc_wrb *wrb = wrb_from_mbox(&adapter->mbox_mem);
1026 struct be_cmd_req_hdr *req = embedded_payload(wrb);
1027 int status;
1028
1029 spin_lock(&adapter->mbox_lock);
1030
1031 memset(wrb, 0, sizeof(*wrb));
1032
1033 be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
1034
1035 be_cmd_hdr_prepare(req, CMD_SUBSYSTEM_COMMON,
1036 OPCODE_COMMON_FUNCTION_RESET, sizeof(*req));
1037
1038 status = be_mbox_notify(adapter);
1039
1040 spin_unlock(&adapter->mbox_lock);
1041 return status;
1042}
diff --git a/drivers/net/benet/be_cmds.h b/drivers/net/benet/be_cmds.h
index 5c5de3540d20..70618064ae15 100644
--- a/drivers/net/benet/be_cmds.h
+++ b/drivers/net/benet/be_cmds.h
@@ -135,6 +135,7 @@ struct be_mcc_mailbox {
135#define OPCODE_COMMON_QUERY_FIRMWARE_CONFIG 58 135#define OPCODE_COMMON_QUERY_FIRMWARE_CONFIG 58
136#define OPCODE_COMMON_NTWK_PMAC_ADD 59 136#define OPCODE_COMMON_NTWK_PMAC_ADD 59
137#define OPCODE_COMMON_NTWK_PMAC_DEL 60 137#define OPCODE_COMMON_NTWK_PMAC_DEL 60
138#define OPCODE_COMMON_FUNCTION_RESET 61
138 139
139#define OPCODE_ETH_ACPI_CONFIG 2 140#define OPCODE_ETH_ACPI_CONFIG 2
140#define OPCODE_ETH_PROMISCUOUS 3 141#define OPCODE_ETH_PROMISCUOUS 3
@@ -744,4 +745,5 @@ extern int be_cmd_set_flow_control(struct be_adapter *adapter,
744extern int be_cmd_get_flow_control(struct be_adapter *adapter, 745extern int be_cmd_get_flow_control(struct be_adapter *adapter,
745 u32 *tx_fc, u32 *rx_fc); 746 u32 *tx_fc, u32 *rx_fc);
746extern int be_cmd_query_fw_cfg(struct be_adapter *adapter, u32 *port_num); 747extern int be_cmd_query_fw_cfg(struct be_adapter *adapter, u32 *port_num);
748extern int be_cmd_reset_function(struct be_adapter *adapter);
747extern void be_process_mcc(struct be_adapter *adapter); 749extern void be_process_mcc(struct be_adapter *adapter);
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index ef82a52f3934..d20235b16800 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -1873,6 +1873,10 @@ static int __devinit be_probe(struct pci_dev *pdev,
1873 if (status) 1873 if (status)
1874 goto free_netdev; 1874 goto free_netdev;
1875 1875
1876 status = be_cmd_reset_function(adapter);
1877 if (status)
1878 goto ctrl_clean;
1879
1876 status = be_stats_init(adapter); 1880 status = be_stats_init(adapter);
1877 if (status) 1881 if (status)
1878 goto ctrl_clean; 1882 goto ctrl_clean;