Skip to content

Commit

Permalink
Set target function register before checking for busy
Browse files Browse the repository at this point in the history
According to the documentation the target function register should be
set before checking o_msg_status when sending mbox message from PF.

Without this fix the wrong target fn will potentially be checked for busy.

Signed-off-by: Lars Munch <[email protected]>
  • Loading branch information
lmunch committed Jun 7, 2023
1 parent 0e8d321 commit 875020c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions QDMA/DPDK/drivers/net/qdma/qdma_access/qdma_mbox_protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -1964,14 +1964,14 @@ int qdma_mbox_send(void *dev_hndl, uint8_t is_vf, uint32_t *raw_data)
uint16_t dst_func_id = msg->hdr.dst_func_id;
uint32_t mbox_base = get_mbox_offset(dev_hndl, is_vf);

v = qdma_reg_read(dev_hndl, mbox_base + MBOX_FN_STATUS);
if (v & F_MBOX_FN_STATUS_OUT_MSG)
return -QDMA_ERR_MBOX_SEND_BUSY;

if (!is_vf)
qdma_reg_write(dev_hndl, mbox_base + MBOX_FN_TARGET,
V_MBOX_FN_TARGET_ID(dst_func_id));

v = qdma_reg_read(dev_hndl, mbox_base + MBOX_FN_STATUS);
if (v & F_MBOX_FN_STATUS_OUT_MSG)
return -QDMA_ERR_MBOX_SEND_BUSY;

for (i = 0; i < MBOX_MSG_REG_MAX; i++, reg += MBOX_MSG_STEP)
qdma_reg_write(dev_hndl, mbox_base + reg, raw_data[i]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1948,14 +1948,14 @@ int qdma_mbox_send(void *dev_hndl, uint8_t is_vf, uint32_t *raw_data)
uint16_t dst_func_id = msg->hdr.dst_func_id;
uint32_t mbox_base = get_mbox_offset(dev_hndl, is_vf);

v = qdma_reg_read(dev_hndl, mbox_base + MBOX_FN_STATUS);
if (v & F_MBOX_FN_STATUS_OUT_MSG)
return -QDMA_ERR_MBOX_SEND_BUSY;

if (!is_vf)
qdma_reg_write(dev_hndl, mbox_base + MBOX_FN_TARGET,
V_MBOX_FN_TARGET_ID(dst_func_id));

v = qdma_reg_read(dev_hndl, mbox_base + MBOX_FN_STATUS);
if (v & F_MBOX_FN_STATUS_OUT_MSG)
return -QDMA_ERR_MBOX_SEND_BUSY;

for (i = 0; i < MBOX_MSG_REG_MAX; i++, reg += MBOX_MSG_STEP)
qdma_reg_write(dev_hndl, mbox_base + reg, raw_data[i]);

Expand Down

0 comments on commit 875020c

Please sign in to comment.