Skip to content

Commit

Permalink
net/iavf: annotate aq_lock
Browse files Browse the repository at this point in the history
Signed-off-by: David Marchand <david.marchand@redhat.com>
david-marchand committed Nov 18, 2024
1 parent 6b9d451 commit f9e03e9
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions drivers/net/iavf/iavf_vchnl.c
Original file line number Diff line number Diff line change
@@ -309,8 +309,8 @@ iavf_read_msg_from_pf(struct iavf_adapter *adapter, uint16_t buf_len,
}

static int
iavf_execute_vf_cmd(struct iavf_adapter *adapter, struct iavf_cmd_info *args,
int async)
iavf_execute_vf_cmd(struct iavf_adapter *adapter, struct iavf_cmd_info *args, int async)
__rte_exclusive_locks_required(&adapter->vf.aq_lock)
{
struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(adapter);
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
@@ -419,18 +419,16 @@ static int
iavf_execute_vf_cmd_safe(struct iavf_adapter *adapter,
struct iavf_cmd_info *args, int async)
{
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter);
int ret;
int is_intr_thread = rte_thread_is_intr();

if (is_intr_thread) {
if (!rte_spinlock_trylock(&vf->aq_lock))
if (rte_thread_is_intr()) {
if (!rte_spinlock_trylock(&adapter->vf.aq_lock))
return -EIO;
} else {
rte_spinlock_lock(&vf->aq_lock);
rte_spinlock_lock(&adapter->vf.aq_lock);
}
ret = iavf_execute_vf_cmd(adapter, args, async);
rte_spinlock_unlock(&vf->aq_lock);
rte_spinlock_unlock(&adapter->vf.aq_lock);

return ret;
}

0 comments on commit f9e03e9

Please sign in to comment.