net/hinic/base: modify VHD type for SDI
[dpdk.git] / drivers / net / hinic / base / hinic_pmd_mgmt.c
index addc9d2..babb93a 100644 (file)
@@ -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;