diff mbox series

[for-next,03/12] RDMA/bnxt_re: Use separate response buffer for stat_ctx_free

Message ID 1631470526-22228-4-git-send-email-selvin.xavier@broadcom.com (mailing list archive)
State Superseded
Delegated to: Leon Romanovsky
Headers show
Series RDMA/bnxt_re: Driver update | expand

Commit Message

Selvin Xavier Sept. 12, 2021, 6:15 p.m. UTC
From: Edwin Peer <edwin.peer@broadcom.com>

Use separate buffers for the request and response data. Eventhough
the response data is not used, providing the correct length is
appropriate.

Signed-off-by: Edwin Peer <edwin.peer@broadcom.com>
Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
---
 drivers/infiniband/hw/bnxt_re/main.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Leon Romanovsky Sept. 13, 2021, 10:46 a.m. UTC | #1
On Sun, Sep 12, 2021 at 11:15:17AM -0700, Selvin Xavier wrote:
> From: Edwin Peer <edwin.peer@broadcom.com>
> 
> Use separate buffers for the request and response data. Eventhough
> the response data is not used, providing the correct length is
> appropriate.
> 
> Signed-off-by: Edwin Peer <edwin.peer@broadcom.com>
> Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
> ---
>  drivers/infiniband/hw/bnxt_re/main.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/bnxt_re/main.c b/drivers/infiniband/hw/bnxt_re/main.c
> index e4f39d8..4214674 100644
> --- a/drivers/infiniband/hw/bnxt_re/main.c
> +++ b/drivers/infiniband/hw/bnxt_re/main.c
> @@ -525,7 +525,8 @@ static int bnxt_re_net_stats_ctx_free(struct bnxt_re_dev *rdev,
>  				      u32 fw_stats_ctx_id)
>  {
>  	struct bnxt_en_dev *en_dev = rdev->en_dev;
> -	struct hwrm_stat_ctx_free_input req = {0};
> +	struct hwrm_stat_ctx_free_input req = {};
> +	struct hwrm_stat_ctx_free_output resp = {};
>  	struct bnxt_fw_msg fw_msg;
>  	int rc = -EINVAL;
>  
> @@ -539,8 +540,8 @@ static int bnxt_re_net_stats_ctx_free(struct bnxt_re_dev *rdev,
>  
>  	bnxt_re_init_hwrm_hdr(rdev, (void *)&req, HWRM_STAT_CTX_FREE, -1, -1);
>  	req.stat_ctx_id = cpu_to_le32(fw_stats_ctx_id);
> -	bnxt_re_fill_fw_msg(&fw_msg, (void *)&req, sizeof(req), (void *)&req,
> -			    sizeof(req), DFLT_HWRM_CMD_TIMEOUT);
> +	bnxt_re_fill_fw_msg(&fw_msg, (void *)&req, sizeof(req), (void *)&resp,
> +			    sizeof(resp), DFLT_HWRM_CMD_TIMEOUT);

As far as I remember, you don't need to cast to void.

Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/bnxt_re/main.c b/drivers/infiniband/hw/bnxt_re/main.c
index e4f39d8..4214674 100644
--- a/drivers/infiniband/hw/bnxt_re/main.c
+++ b/drivers/infiniband/hw/bnxt_re/main.c
@@ -525,7 +525,8 @@  static int bnxt_re_net_stats_ctx_free(struct bnxt_re_dev *rdev,
 				      u32 fw_stats_ctx_id)
 {
 	struct bnxt_en_dev *en_dev = rdev->en_dev;
-	struct hwrm_stat_ctx_free_input req = {0};
+	struct hwrm_stat_ctx_free_input req = {};
+	struct hwrm_stat_ctx_free_output resp = {};
 	struct bnxt_fw_msg fw_msg;
 	int rc = -EINVAL;
 
@@ -539,8 +540,8 @@  static int bnxt_re_net_stats_ctx_free(struct bnxt_re_dev *rdev,
 
 	bnxt_re_init_hwrm_hdr(rdev, (void *)&req, HWRM_STAT_CTX_FREE, -1, -1);
 	req.stat_ctx_id = cpu_to_le32(fw_stats_ctx_id);
-	bnxt_re_fill_fw_msg(&fw_msg, (void *)&req, sizeof(req), (void *)&req,
-			    sizeof(req), DFLT_HWRM_CMD_TIMEOUT);
+	bnxt_re_fill_fw_msg(&fw_msg, (void *)&req, sizeof(req), (void *)&resp,
+			    sizeof(resp), DFLT_HWRM_CMD_TIMEOUT);
 	rc = en_dev->en_ops->bnxt_send_fw_msg(en_dev, BNXT_ROCE_ULP, &fw_msg);
 	if (rc)
 		ibdev_err(&rdev->ibdev, "Failed to free HW stats context %#x",