Skip to content

Commit

Permalink
be2net: Activate new FW after FW download for Lancer
Browse files Browse the repository at this point in the history
After FW download, activate new FW by invoking FW reset.
Recreate rings once new FW is operational.

Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Padmanabh Ratnakar authored and David S. Miller committed Jul 12, 2012
1 parent bf99e50 commit f67ef7b
Show file tree
Hide file tree
Showing 5 changed files with 180 additions and 78 deletions.
20 changes: 17 additions & 3 deletions drivers/net/ethernet/emulex/benet/be.h
Original file line number Diff line number Diff line change
Expand Up @@ -389,16 +389,18 @@ struct be_adapter {
struct delayed_work work;
u16 work_counter;

struct delayed_work func_recovery_work;
u32 flags;
/* Ethtool knobs and info */
char fw_ver[FW_VER_LEN];
int if_handle; /* Used to configure filtering */
u32 *pmac_id; /* MAC addr handle used by BE card */
u32 beacon_state; /* for set_phys_id */

bool eeh_err;
bool ue_detected;
bool eeh_error;
bool fw_timeout;
bool hw_error;

u32 port_num;
bool promiscuous;
u32 function_mode;
Expand Down Expand Up @@ -599,7 +601,19 @@ static inline bool be_multi_rxq(const struct be_adapter *adapter)

static inline bool be_error(struct be_adapter *adapter)
{
return adapter->eeh_err || adapter->ue_detected || adapter->fw_timeout;
return adapter->eeh_error || adapter->hw_error || adapter->fw_timeout;
}

static inline bool be_crit_error(struct be_adapter *adapter)
{
return adapter->eeh_error || adapter->hw_error;
}

static inline void be_clear_all_error(struct be_adapter *adapter)
{
adapter->eeh_error = false;
adapter->hw_error = false;
adapter->fw_timeout = false;
}

static inline bool be_is_wol_excluded(struct be_adapter *adapter)
Expand Down
13 changes: 8 additions & 5 deletions drivers/net/ethernet/emulex/benet/be_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ static int be_mbox_db_ready_wait(struct be_adapter *adapter, void __iomem *db)
if (msecs > 4000) {
dev_err(&adapter->pdev->dev, "FW not responding\n");
adapter->fw_timeout = true;
be_detect_dump_ue(adapter);
be_detect_error(adapter);
return -1;
}

Expand Down Expand Up @@ -1869,8 +1869,9 @@ int be_cmd_get_beacon_state(struct be_adapter *adapter, u8 port_num, u32 *state)
}

int lancer_cmd_write_object(struct be_adapter *adapter, struct be_dma_mem *cmd,
u32 data_size, u32 data_offset, const char *obj_name,
u32 *data_written, u8 *addn_status)
u32 data_size, u32 data_offset,
const char *obj_name, u32 *data_written,
u8 *change_status, u8 *addn_status)
{
struct be_mcc_wrb *wrb;
struct lancer_cmd_req_write_object *req;
Expand Down Expand Up @@ -1926,10 +1927,12 @@ int lancer_cmd_write_object(struct be_adapter *adapter, struct be_dma_mem *cmd,
status = adapter->flash_status;

resp = embedded_payload(wrb);
if (!status)
if (!status) {
*data_written = le32_to_cpu(resp->actual_write_len);
else
*change_status = resp->change_status;
} else {
*addn_status = resp->additional_status;
}

return status;

Expand Down
15 changes: 10 additions & 5 deletions drivers/net/ethernet/emulex/benet/be_cmds.h
Original file line number Diff line number Diff line change
Expand Up @@ -1163,6 +1163,8 @@ struct lancer_cmd_req_write_object {
u32 addr_high;
};

#define LANCER_NO_RESET_NEEDED 0x00
#define LANCER_FW_RESET_NEEDED 0x02
struct lancer_cmd_resp_write_object {
u8 opcode;
u8 subsystem;
Expand All @@ -1173,6 +1175,8 @@ struct lancer_cmd_resp_write_object {
u32 resp_len;
u32 actual_resp_len;
u32 actual_write_len;
u8 change_status;
u8 rsvd3[3];
};

/************************ Lancer Read FW info **************/
Expand Down Expand Up @@ -1718,10 +1722,11 @@ extern int be_cmd_write_flashrom(struct be_adapter *adapter,
struct be_dma_mem *cmd, u32 flash_oper,
u32 flash_opcode, u32 buf_size);
extern int lancer_cmd_write_object(struct be_adapter *adapter,
struct be_dma_mem *cmd,
u32 data_size, u32 data_offset,
const char *obj_name,
u32 *data_written, u8 *addn_status);
struct be_dma_mem *cmd,
u32 data_size, u32 data_offset,
const char *obj_name,
u32 *data_written, u8 *change_status,
u8 *addn_status);
int lancer_cmd_read_object(struct be_adapter *adapter, struct be_dma_mem *cmd,
u32 data_size, u32 data_offset, const char *obj_name,
u32 *data_read, u32 *eof, u8 *addn_status);
Expand All @@ -1744,7 +1749,7 @@ extern int be_cmd_set_loopback(struct be_adapter *adapter, u8 port_num,
u8 loopback_type, u8 enable);
extern int be_cmd_get_phy_info(struct be_adapter *adapter);
extern int be_cmd_set_qos(struct be_adapter *adapter, u32 bps, u32 domain);
extern void be_detect_dump_ue(struct be_adapter *adapter);
extern void be_detect_error(struct be_adapter *adapter);
extern int be_cmd_get_die_temperature(struct be_adapter *adapter);
extern int be_cmd_get_cntl_attributes(struct be_adapter *adapter);
extern int be_cmd_req_native_mode(struct be_adapter *adapter);
Expand Down
7 changes: 4 additions & 3 deletions drivers/net/ethernet/emulex/benet/be_hw.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,19 @@
#define POST_STAGE_ARMFW_RDY 0xc000 /* FW is done with POST */


/* Lancer SLIPORT_CONTROL SLIPORT_STATUS registers */
/* Lancer SLIPORT registers */
#define SLIPORT_STATUS_OFFSET 0x404
#define SLIPORT_CONTROL_OFFSET 0x408
#define SLIPORT_ERROR1_OFFSET 0x40C
#define SLIPORT_ERROR2_OFFSET 0x410
#define PHYSDEV_CONTROL_OFFSET 0x414

#define SLIPORT_STATUS_ERR_MASK 0x80000000
#define SLIPORT_STATUS_RN_MASK 0x01000000
#define SLIPORT_STATUS_RDY_MASK 0x00800000


#define SLI_PORT_CONTROL_IP_MASK 0x08000000
#define PHYSDEV_CONTROL_FW_RESET_MASK 0x00000002
#define PHYSDEV_CONTROL_INP_MASK 0x40000000

/********* Memory BAR register ************/
#define PCICFG_MEMBAR_CTRL_INT_CTRL_OFFSET 0xfc
Expand Down
Loading

0 comments on commit f67ef7b

Please sign in to comment.