common/octeontx2: fix link event message size

Message ID 20210730160806.13394-1-hkalra@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series common/octeontx2: fix link event message size |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/github-robot success github build: passed
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS
ci/iol-abi-testing success Testing PASS

Commit Message

Harman Kalra July 30, 2021, 4:08 p.m. UTC
  Due to wrong size of mbox message allocated for sending link status
to the VF, incorrect link status is observed.

Fixes: cb8d769fb6fe ("common/octeontx2: send link event to VF")

Signed-off-by: Harman Kalra <hkalra@marvell.com>
---
 drivers/common/octeontx2/otx2_dev.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
  

Comments

Jerin Jacob Sept. 28, 2021, 12:25 p.m. UTC | #1
On Fri, Jul 30, 2021 at 9:38 PM Harman Kalra <hkalra@marvell.com> wrote:
>
> Due to wrong size of mbox message allocated for sending link status
> to the VF, incorrect link status is observed.
>
> Fixes: cb8d769fb6fe ("common/octeontx2: send link event to VF")
Cc: stable@dpdk.org

> Signed-off-by: Harman Kalra <hkalra@marvell.com>


Acked-by: Jerin Jacob <jerinj@marvell.com>
Applied to dpdk-next-net-mrvl/for-next-net. Thanks
> ---
>  drivers/common/octeontx2/otx2_dev.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/common/octeontx2/otx2_dev.c b/drivers/common/octeontx2/otx2_dev.c
> index 1485e2b357..ce4f0e7ca9 100644
> --- a/drivers/common/octeontx2/otx2_dev.c
> +++ b/drivers/common/octeontx2/otx2_dev.c
> @@ -172,14 +172,17 @@ af_pf_wait_msg(struct otx2_dev *dev, uint16_t vf, int num_msg)
>                         /* Send link status to VF */
>                         struct cgx_link_user_info linfo;
>                         struct mbox_msghdr *vf_msg;
> +                       size_t sz;
>
>                         /* Get the link status */
>                         if (dev->ops && dev->ops->link_status_get)
>                                 dev->ops->link_status_get(dev, &linfo);
>
> +                       sz = RTE_ALIGN(otx2_mbox_id2size(
> +                               MBOX_MSG_CGX_LINK_EVENT), MBOX_MSG_ALIGN);
>                         /* Prepare the message to be sent */
>                         vf_msg = otx2_mbox_alloc_msg(&dev->mbox_vfpf_up, vf,
> -                                                    size);
> +                                                    sz);
>                         otx2_mbox_req_init(MBOX_MSG_CGX_LINK_EVENT, vf_msg);
>                         memcpy((uint8_t *)vf_msg + sizeof(struct mbox_msghdr),
>                                &linfo, sizeof(struct cgx_link_user_info));
> --
> 2.18.0
>
  

Patch

diff --git a/drivers/common/octeontx2/otx2_dev.c b/drivers/common/octeontx2/otx2_dev.c
index 1485e2b357..ce4f0e7ca9 100644
--- a/drivers/common/octeontx2/otx2_dev.c
+++ b/drivers/common/octeontx2/otx2_dev.c
@@ -172,14 +172,17 @@  af_pf_wait_msg(struct otx2_dev *dev, uint16_t vf, int num_msg)
 			/* Send link status to VF */
 			struct cgx_link_user_info linfo;
 			struct mbox_msghdr *vf_msg;
+			size_t sz;
 
 			/* Get the link status */
 			if (dev->ops && dev->ops->link_status_get)
 				dev->ops->link_status_get(dev, &linfo);
 
+			sz = RTE_ALIGN(otx2_mbox_id2size(
+				MBOX_MSG_CGX_LINK_EVENT), MBOX_MSG_ALIGN);
 			/* Prepare the message to be sent */
 			vf_msg = otx2_mbox_alloc_msg(&dev->mbox_vfpf_up, vf,
-						     size);
+						     sz);
 			otx2_mbox_req_init(MBOX_MSG_CGX_LINK_EVENT, vf_msg);
 			memcpy((uint8_t *)vf_msg + sizeof(struct mbox_msghdr),
 			       &linfo, sizeof(struct cgx_link_user_info));