net/thunderx: support attaching from secondary
authorHarman Kalra <hkalra@marvell.com>
Tue, 24 May 2022 08:42:34 +0000 (14:12 +0530)
committerJerin Jacob <jerinj@marvell.com>
Mon, 13 Jun 2022 07:29:24 +0000 (09:29 +0200)
Adding support for device hotplugging - attach and detach from
secondary

Signed-off-by: Harman Kalra <hkalra@marvell.com>
drivers/net/thunderx/base/nicvf_mbox.c

index 352b85d..5993eec 100644 (file)
@@ -85,6 +85,17 @@ nicvf_mbox_send_msg_to_pf(struct nicvf *nic, struct nic_mbx *mbx)
                nicvf_smp_wmb();
 
                nicvf_mbox_send_msg_to_pf_raw(nic, mbx);
+
+               /* Handling case if mbox is called inside interrupt context,
+                * Eg if hotplug attach/detach request is initiated from
+                * secondary and primary handles the request in interrupt
+                * context as part of multprocess framework.
+                */
+               if (rte_thread_is_intr()) {
+                       nicvf_delay_us(NICVF_MBOX_PF_RESPONSE_DELAY_US);
+                       nicvf_reg_poll_interrupts(nic);
+               }
+
                /* Give some time to get PF response */
                nicvf_delay_us(NICVF_MBOX_PF_RESPONSE_DELAY_US);
                timeout = NIC_MBOX_MSG_TIMEOUT;
@@ -100,10 +111,10 @@ nicvf_mbox_send_msg_to_pf(struct nicvf *nic, struct nic_mbx *mbx)
                        nicvf_delay_us(NICVF_MBOX_PF_RESPONSE_DELAY_US);
                        timeout -= sleep;
                }
-               nicvf_log_error("PF didn't ack to msg 0x%02x %s VF%d (%d/%d)",
-                               mbx->msg.msg, nicvf_mbox_msg_str(mbx->msg.msg),
-                               nic->vf_id, i, retry);
        }
+       nicvf_log_error("PF didn't ack to msg 0x%02x %s VF%d (%d/%d)",
+                       mbx->msg.msg, nicvf_mbox_msg_str(mbx->msg.msg),
+                       nic->vf_id, i, retry);
        return -EBUSY;
 }