X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fhinic%2Fbase%2Fhinic_pmd_mgmt.c;h=babb93a204b32d71bbe9a20a6841564bdd0cd191;hb=ee2cf75e1be583f22b7614b56e1df73845e96bac;hp=addc9d2db4a26f86b530060c6324855f4d3122a2;hpb=4f1af3cb5a97638cf56bdc0273e71c62b4f0e497;p=dpdk.git diff --git a/drivers/net/hinic/base/hinic_pmd_mgmt.c b/drivers/net/hinic/base/hinic_pmd_mgmt.c index addc9d2db4..babb93a204 100644 --- a/drivers/net/hinic/base/hinic_pmd_mgmt.c +++ b/drivers/net/hinic/base/hinic_pmd_mgmt.c @@ -248,6 +248,19 @@ static void free_msg_buf(struct hinic_msg_pf_to_mgmt *pf_to_mgmt) free_recv_msg(&pf_to_mgmt->recv_msg_from_mgmt); } +static int hinic_get_mgmt_channel_status(void *hwdev) +{ + struct hinic_hwif *hwif = ((struct hinic_hwdev *)hwdev)->hwif; + u32 val; + + if (hinic_func_type((struct hinic_hwdev *)hwdev) == TYPE_VF) + return false; + + val = hinic_hwif_read_reg(hwif, HINIC_ICPL_RESERVD_ADDR); + + return HINIC_GET_MGMT_CHANNEL_STATUS(val, MGMT_CHANNEL_STATUS); +} + /** * send_msg_to_mgmt_async - send async message * @pf_to_mgmt: PF to MGMT channel @@ -309,6 +322,14 @@ static int send_msg_to_mgmt_sync(struct hinic_msg_pf_to_mgmt *pf_to_mgmt, u64 header; u16 cmd_size = mgmt_msg_len(msg_len); + /* If fw is hot active, return failed */ + if (hinic_get_mgmt_channel_status(pf_to_mgmt->hwdev)) { + if (mod == HINIC_MOD_COMM || mod == HINIC_MOD_L2NIC) + return HINIC_DEV_BUSY_ACTIVE_FW; + else + return -EBUSY; + } + if (direction == HINIC_MSG_RESPONSE) prepare_header(pf_to_mgmt, &header, msg_len, mod, ack_type, direction, cmd, resp_msg_id); @@ -462,19 +483,6 @@ unlock_sync_msg: return err; } -static int hinic_get_mgmt_channel_status(void *hwdev) -{ - struct hinic_hwif *hwif = ((struct hinic_hwdev *)hwdev)->hwif; - u32 val; - - if (hinic_func_type((struct hinic_hwdev *)hwdev) == TYPE_VF) - return false; - - val = hinic_hwif_read_reg(hwif, HINIC_ICPL_RESERVD_ADDR); - - return HINIC_GET_MGMT_CHANNEL_STATUS(val, MGMT_CHANNEL_STATUS); -} - int hinic_msg_to_mgmt_sync(void *hwdev, enum hinic_mod_type mod, u8 cmd, void *buf_in, u16 in_size, void *buf_out, u16 *out_size, u32 timeout) @@ -484,10 +492,6 @@ int hinic_msg_to_mgmt_sync(void *hwdev, enum hinic_mod_type mod, u8 cmd, if (!hwdev || in_size > HINIC_MSG_TO_MGMT_MAX_LEN) return -EINVAL; - /* If status is hot upgrading, don't send message to mgmt */ - if (hinic_get_mgmt_channel_status(hwdev)) - return -EPERM; - if (hinic_func_type(hwdev) == TYPE_VF) { rc = hinic_mbox_to_pf(hwdev, mod, cmd, buf_in, in_size, buf_out, out_size, timeout); @@ -500,8 +504,7 @@ int hinic_msg_to_mgmt_sync(void *hwdev, enum hinic_mod_type mod, u8 cmd, } int hinic_msg_to_mgmt_no_ack(void *hwdev, enum hinic_mod_type mod, u8 cmd, - void *buf_in, u16 in_size, __rte_unused void *buf_out, - __rte_unused u16 *out_size) + void *buf_in, u16 in_size) { struct hinic_msg_pf_to_mgmt *pf_to_mgmt = ((struct hinic_hwdev *)hwdev)->pf_to_mgmt;