be2net: Patch to perform function reset at initialization
authorsarveshwarb <sarveshwarb@serverengines.com>
Wed, 5 Aug 2009 20:05:24 +0000 (13:05 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 5 Aug 2009 20:05:24 +0000 (13:05 -0700)
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>
drivers/net/benet/be_cmds.c
drivers/net/benet/be_cmds.h
drivers/net/benet/be_main.c

index de107732dcdc3507202da2ce3a67653efbc4a3f3..2547ee296a7db21213a3aa595dc2c91da7633192 100644 (file)
@@ -1019,3 +1019,24 @@ int be_cmd_query_fw_cfg(struct be_adapter *adapter, u32 *port_num)
        spin_unlock(&adapter->mbox_lock);
        return status;
 }
+
+int be_cmd_reset_function(struct be_adapter *adapter)
+{
+       struct be_mcc_wrb *wrb = wrb_from_mbox(&adapter->mbox_mem);
+       struct be_cmd_req_hdr *req = embedded_payload(wrb);
+       int status;
+
+       spin_lock(&adapter->mbox_lock);
+
+       memset(wrb, 0, sizeof(*wrb));
+
+       be_wrb_hdr_prepare(wrb, sizeof(*req), true, 0);
+
+       be_cmd_hdr_prepare(req, CMD_SUBSYSTEM_COMMON,
+               OPCODE_COMMON_FUNCTION_RESET, sizeof(*req));
+
+       status = be_mbox_notify(adapter);
+
+       spin_unlock(&adapter->mbox_lock);
+       return status;
+}
index 5c5de3540d201c1b76db299a410eadb2caf54ccd..70618064ae15e813c78402a1449a45af3dea1be8 100644 (file)
@@ -135,6 +135,7 @@ struct be_mcc_mailbox {
 #define OPCODE_COMMON_QUERY_FIRMWARE_CONFIG            58
 #define OPCODE_COMMON_NTWK_PMAC_ADD                    59
 #define OPCODE_COMMON_NTWK_PMAC_DEL                    60
+#define OPCODE_COMMON_FUNCTION_RESET                   61
 
 #define OPCODE_ETH_ACPI_CONFIG                         2
 #define OPCODE_ETH_PROMISCUOUS                         3
@@ -744,4 +745,5 @@ extern int be_cmd_set_flow_control(struct be_adapter *adapter,
 extern int be_cmd_get_flow_control(struct be_adapter *adapter,
                        u32 *tx_fc, u32 *rx_fc);
 extern int be_cmd_query_fw_cfg(struct be_adapter *adapter, u32 *port_num);
+extern int be_cmd_reset_function(struct be_adapter *adapter);
 extern void be_process_mcc(struct be_adapter *adapter);
index ef82a52f3934435addc115cefd2c9de987b6a1c8..d20235b1680015a20315616c25c1d5c2aa41a519 100644 (file)
@@ -1873,6 +1873,10 @@ static int __devinit be_probe(struct pci_dev *pdev,
        if (status)
                goto free_netdev;
 
+       status = be_cmd_reset_function(adapter);
+       if (status)
+               goto ctrl_clean;
+
        status = be_stats_init(adapter);
        if (status)
                goto ctrl_clean;