diff mbox series

[focal:linux-azure] net: mana: Add rmb after checking owner bits

Message ID 20221027160901.47802-1-tim.gardner@canonical.com
State New
Headers show
Series [focal:linux-azure] net: mana: Add rmb after checking owner bits | expand

Commit Message

Tim Gardner Oct. 27, 2022, 4:09 p.m. UTC
From: Haiyang Zhang <haiyangz@microsoft.com>

BugLink: https://bugs.launchpad.net/bugs/1994987

commit 6fd2c68da55c552f86e401ebe40c4a619025ef69 upstream.

Per GDMA spec, rmb is necessary after checking owner_bits, before
reading EQ or CQ entries.

Add rmb in these two places to comply with the specs.

Cc: stable@vger.kernel.org
Fixes: ca9c54d2d6a5 ("net: mana: Add a driver for Microsoft Azure Network Adapter (MANA)")
Reported-by: Sinan Kaya <Sinan.Kaya@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Reviewed-by: Dexuan Cui <decui@microsoft.com>
Link: https://lore.kernel.org/r/1662928805-15861-1-git-send-email-haiyangz@microsoft.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 71075d7d463281fd43cebf3a10170503a1c72995 linux-5.15.y)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
---
 drivers/net/ethernet/microsoft/mana/gdma_main.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Bartlomiej Zolnierkiewicz Nov. 10, 2022, 5:42 p.m. UTC | #1
Acked-by: Bartlomiej Zolnierkiewicz <bartlomiej.zolnierkiewicz@canonical.com>

On Thu, Oct 27, 2022 at 6:10 PM Tim Gardner <tim.gardner@canonical.com> wrote:
>
> From: Haiyang Zhang <haiyangz@microsoft.com>
>
> BugLink: https://bugs.launchpad.net/bugs/1994987
>
> commit 6fd2c68da55c552f86e401ebe40c4a619025ef69 upstream.
>
> Per GDMA spec, rmb is necessary after checking owner_bits, before
> reading EQ or CQ entries.
>
> Add rmb in these two places to comply with the specs.
>
> Cc: stable@vger.kernel.org
> Fixes: ca9c54d2d6a5 ("net: mana: Add a driver for Microsoft Azure Network Adapter (MANA)")
> Reported-by: Sinan Kaya <Sinan.Kaya@microsoft.com>
> Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
> Reviewed-by: Dexuan Cui <decui@microsoft.com>
> Link: https://lore.kernel.org/r/1662928805-15861-1-git-send-email-haiyangz@microsoft.com
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> (cherry picked from commit 71075d7d463281fd43cebf3a10170503a1c72995 linux-5.15.y)
> Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
> ---
>  drivers/net/ethernet/microsoft/mana/gdma_main.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/drivers/net/ethernet/microsoft/mana/gdma_main.c b/drivers/net/ethernet/microsoft/mana/gdma_main.c
> index 2f87bf90f8ec..6308ed90b60d 100644
> --- a/drivers/net/ethernet/microsoft/mana/gdma_main.c
> +++ b/drivers/net/ethernet/microsoft/mana/gdma_main.c
> @@ -365,6 +365,11 @@ static void mana_gd_process_eq_events(void *arg)
>                         break;
>                 }
>
> +               /* Per GDMA spec, rmb is necessary after checking owner_bits, before
> +                * reading eqe.
> +                */
> +               rmb();
> +
>                 mana_gd_process_eqe(eq);
>
>                 eq->head++;
> @@ -1131,6 +1136,11 @@ static int mana_gd_read_cqe(struct gdma_queue *cq, struct gdma_comp *comp)
>         if (owner_bits != new_bits)
>                 return -1;
>
> +       /* Per GDMA spec, rmb is necessary after checking owner_bits, before
> +        * reading completion info
> +        */
> +       rmb();
> +
>         comp->wq_num = cqe->cqe_info.wq_num;
>         comp->is_sq = cqe->cqe_info.is_sq;
>         memcpy(comp->cqe_data, cqe->cqe_data, GDMA_COMP_DATA_SIZE);
> --
> 2.34.1
Cory Todd Nov. 16, 2022, 12:18 a.m. UTC | #2
On Thu, Oct 27, 2022 at 10:09:01AM -0600, Tim Gardner wrote:
> From: Haiyang Zhang <haiyangz@microsoft.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/1994987
> 
> commit 6fd2c68da55c552f86e401ebe40c4a619025ef69 upstream.
> 
> Per GDMA spec, rmb is necessary after checking owner_bits, before
> reading EQ or CQ entries.
> 
> Add rmb in these two places to comply with the specs.
> 
> Cc: stable@vger.kernel.org
> Fixes: ca9c54d2d6a5 ("net: mana: Add a driver for Microsoft Azure Network Adapter (MANA)")
> Reported-by: Sinan Kaya <Sinan.Kaya@microsoft.com>
> Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
> Reviewed-by: Dexuan Cui <decui@microsoft.com>
> Link: https://lore.kernel.org/r/1662928805-15861-1-git-send-email-haiyangz@microsoft.com
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> (cherry picked from commit 71075d7d463281fd43cebf3a10170503a1c72995 linux-5.15.y)
> Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
> ---
>  drivers/net/ethernet/microsoft/mana/gdma_main.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/net/ethernet/microsoft/mana/gdma_main.c b/drivers/net/ethernet/microsoft/mana/gdma_main.c
> index 2f87bf90f8ec..6308ed90b60d 100644
> --- a/drivers/net/ethernet/microsoft/mana/gdma_main.c
> +++ b/drivers/net/ethernet/microsoft/mana/gdma_main.c
> @@ -365,6 +365,11 @@ static void mana_gd_process_eq_events(void *arg)
>  			break;
>  		}
>  
> +		/* Per GDMA spec, rmb is necessary after checking owner_bits, before
> +		 * reading eqe.
> +		 */
> +		rmb();
> +
>  		mana_gd_process_eqe(eq);
>  
>  		eq->head++;
> @@ -1131,6 +1136,11 @@ static int mana_gd_read_cqe(struct gdma_queue *cq, struct gdma_comp *comp)
>  	if (owner_bits != new_bits)
>  		return -1;
>  
> +	/* Per GDMA spec, rmb is necessary after checking owner_bits, before
> +	 * reading completion info
> +	 */
> +	rmb();
> +
>  	comp->wq_num = cqe->cqe_info.wq_num;
>  	comp->is_sq = cqe->cqe_info.is_sq;
>  	memcpy(comp->cqe_data, cqe->cqe_data, GDMA_COMP_DATA_SIZE);

Acked-by: Cory Todd <cory.todd@canonical.com>
Tim Gardner Nov. 29, 2022, 6:52 p.m. UTC | #3
On 10/27/22 10:09 AM, Tim Gardner wrote:
> From: Haiyang Zhang <haiyangz@microsoft.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/1994987
> 
> commit 6fd2c68da55c552f86e401ebe40c4a619025ef69 upstream.
> 
> Per GDMA spec, rmb is necessary after checking owner_bits, before
> reading EQ or CQ entries.
> 
> Add rmb in these two places to comply with the specs.
> 
> Cc: stable@vger.kernel.org
> Fixes: ca9c54d2d6a5 ("net: mana: Add a driver for Microsoft Azure Network Adapter (MANA)")
> Reported-by: Sinan Kaya <Sinan.Kaya@microsoft.com>
> Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
> Reviewed-by: Dexuan Cui <decui@microsoft.com>
> Link: https://lore.kernel.org/r/1662928805-15861-1-git-send-email-haiyangz@microsoft.com
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> (cherry picked from commit 71075d7d463281fd43cebf3a10170503a1c72995 linux-5.15.y)
> Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
> ---
>   drivers/net/ethernet/microsoft/mana/gdma_main.c | 10 ++++++++++
>   1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/net/ethernet/microsoft/mana/gdma_main.c b/drivers/net/ethernet/microsoft/mana/gdma_main.c
> index 2f87bf90f8ec..6308ed90b60d 100644
> --- a/drivers/net/ethernet/microsoft/mana/gdma_main.c
> +++ b/drivers/net/ethernet/microsoft/mana/gdma_main.c
> @@ -365,6 +365,11 @@ static void mana_gd_process_eq_events(void *arg)
>   			break;
>   		}
>   
> +		/* Per GDMA spec, rmb is necessary after checking owner_bits, before
> +		 * reading eqe.
> +		 */
> +		rmb();
> +
>   		mana_gd_process_eqe(eq);
>   
>   		eq->head++;
> @@ -1131,6 +1136,11 @@ static int mana_gd_read_cqe(struct gdma_queue *cq, struct gdma_comp *comp)
>   	if (owner_bits != new_bits)
>   		return -1;
>   
> +	/* Per GDMA spec, rmb is necessary after checking owner_bits, before
> +	 * reading completion info
> +	 */
> +	rmb();
> +
>   	comp->wq_num = cqe->cqe_info.wq_num;
>   	comp->is_sq = cqe->cqe_info.is_sq;
>   	memcpy(comp->cqe_data, cqe->cqe_data, GDMA_COMP_DATA_SIZE);
Applied to focal linux-azure:master-next. Thanks.

-rtg
diff mbox series

Patch

diff --git a/drivers/net/ethernet/microsoft/mana/gdma_main.c b/drivers/net/ethernet/microsoft/mana/gdma_main.c
index 2f87bf90f8ec..6308ed90b60d 100644
--- a/drivers/net/ethernet/microsoft/mana/gdma_main.c
+++ b/drivers/net/ethernet/microsoft/mana/gdma_main.c
@@ -365,6 +365,11 @@  static void mana_gd_process_eq_events(void *arg)
 			break;
 		}
 
+		/* Per GDMA spec, rmb is necessary after checking owner_bits, before
+		 * reading eqe.
+		 */
+		rmb();
+
 		mana_gd_process_eqe(eq);
 
 		eq->head++;
@@ -1131,6 +1136,11 @@  static int mana_gd_read_cqe(struct gdma_queue *cq, struct gdma_comp *comp)
 	if (owner_bits != new_bits)
 		return -1;
 
+	/* Per GDMA spec, rmb is necessary after checking owner_bits, before
+	 * reading completion info
+	 */
+	rmb();
+
 	comp->wq_num = cqe->cqe_info.wq_num;
 	comp->is_sq = cqe->cqe_info.is_sq;
 	memcpy(comp->cqe_data, cqe->cqe_data, GDMA_COMP_DATA_SIZE);