Skip to content

Commit 390784c

Browse files
lmunchlmu-silicom
authored andcommitted
Set target function register before checking for busy
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]>
1 parent 0e8d321 commit 390784c

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

QDMA/DPDK/drivers/net/qdma/qdma_access/qdma_mbox_protocol.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1964,14 +1964,14 @@ int qdma_mbox_send(void *dev_hndl, uint8_t is_vf, uint32_t *raw_data)
19641964
uint16_t dst_func_id = msg->hdr.dst_func_id;
19651965
uint32_t mbox_base = get_mbox_offset(dev_hndl, is_vf);
19661966

1967-
v = qdma_reg_read(dev_hndl, mbox_base + MBOX_FN_STATUS);
1968-
if (v & F_MBOX_FN_STATUS_OUT_MSG)
1969-
return -QDMA_ERR_MBOX_SEND_BUSY;
1970-
19711967
if (!is_vf)
19721968
qdma_reg_write(dev_hndl, mbox_base + MBOX_FN_TARGET,
19731969
V_MBOX_FN_TARGET_ID(dst_func_id));
19741970

1971+
v = qdma_reg_read(dev_hndl, mbox_base + MBOX_FN_STATUS);
1972+
if (v & F_MBOX_FN_STATUS_OUT_MSG)
1973+
return -QDMA_ERR_MBOX_SEND_BUSY;
1974+
19751975
for (i = 0; i < MBOX_MSG_REG_MAX; i++, reg += MBOX_MSG_STEP)
19761976
qdma_reg_write(dev_hndl, mbox_base + reg, raw_data[i]);
19771977

QDMA/linux-kernel/driver/libqdma/qdma_access/qdma_mbox_protocol.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1948,14 +1948,14 @@ int qdma_mbox_send(void *dev_hndl, uint8_t is_vf, uint32_t *raw_data)
19481948
uint16_t dst_func_id = msg->hdr.dst_func_id;
19491949
uint32_t mbox_base = get_mbox_offset(dev_hndl, is_vf);
19501950

1951-
v = qdma_reg_read(dev_hndl, mbox_base + MBOX_FN_STATUS);
1952-
if (v & F_MBOX_FN_STATUS_OUT_MSG)
1953-
return -QDMA_ERR_MBOX_SEND_BUSY;
1954-
19551951
if (!is_vf)
19561952
qdma_reg_write(dev_hndl, mbox_base + MBOX_FN_TARGET,
19571953
V_MBOX_FN_TARGET_ID(dst_func_id));
19581954

1955+
v = qdma_reg_read(dev_hndl, mbox_base + MBOX_FN_STATUS);
1956+
if (v & F_MBOX_FN_STATUS_OUT_MSG)
1957+
return -QDMA_ERR_MBOX_SEND_BUSY;
1958+
19591959
for (i = 0; i < MBOX_MSG_REG_MAX; i++, reg += MBOX_MSG_STEP)
19601960
qdma_reg_write(dev_hndl, mbox_base + reg, raw_data[i]);
19611961

0 commit comments

Comments
 (0)