bus/vmbus: remove unnecessary packed attribute

Message ID 20241022023728.451151-1-stephen@networkplumber.org (mailing list archive)
State New
Delegated to: David Marchand
Headers
Series bus/vmbus: remove unnecessary packed attribute |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/github-robot: build success github build: passed
ci/intel-Functional success Functional PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-marvell-Functional success Functional Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-unit-arm64-testing warning Testing issues
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-sample-apps-testing success Testing PASS
ci/iol-compile-amd64-testing success Testing PASS

Commit Message

Stephen Hemminger Oct. 22, 2024, 2:37 a.m. UTC
The VMBus ring structure was marked packed which will cause
warnings if the no-address-of-packed is enabled. The structure
is all 32 bit values and the packed attribute has no impact
on the code layout; remove it.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/bus/vmbus/rte_vmbus_reg.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Wei Hu Oct. 22, 2024, 3:43 a.m. UTC | #1
> -----Original Message-----
> From: Stephen Hemminger <stephen@networkplumber.org>
> Sent: Tuesday, October 22, 2024 10:37 AM
> To: dev@dpdk.org
> Cc: Stephen Hemminger <stephen@networkplumber.org>; Long Li
> <longli@microsoft.com>; Wei Hu <weh@microsoft.com>
> Subject: [PATCH] bus/vmbus: remove unnecessary packed attribute
> 
> The VMBus ring structure was marked packed which will cause warnings if the
> no-address-of-packed is enabled. The structure is all 32 bit values and the
> packed attribute has no impact on the code layout; remove it.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>  drivers/bus/vmbus/rte_vmbus_reg.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/bus/vmbus/rte_vmbus_reg.h
> b/drivers/bus/vmbus/rte_vmbus_reg.h
> index e3299aa871..c4f2fa4c7e 100644
> --- a/drivers/bus/vmbus/rte_vmbus_reg.h
> +++ b/drivers/bus/vmbus/rte_vmbus_reg.h
> @@ -108,7 +108,7 @@ struct vmbus_bufring {
>  	 * !!! DO NOT place any fields below this !!!
>  	 */
>  	uint8_t data[];
> -} __rte_packed;
> +};
> 
>  /*
>   * Channel packets
> --
> 2.45.2

Reviewed-by: Wei Hu <weh@microsoft.com>
  
David Marchand Oct. 30, 2024, 9:26 a.m. UTC | #2
On Tue, Oct 22, 2024 at 4:37 AM Stephen Hemminger
<stephen@networkplumber.org> wrote:
>
> The VMBus ring structure was marked packed which will cause
> warnings if the no-address-of-packed is enabled. The structure
> is all 32 bit values and the packed attribute has no impact
> on the code layout; remove it.
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

- Why only clean this structure in this header?
I see many others which could get cleaned wrt __rte_packed.

(There are some unused structs too and it would be better not to keep
unused code around).


- On a separate note, I wonder why the vmbus headers are exported as
public headers.
All those seem to be for use only in drivers, for resources attached
on such a bus.
Would an application benefit from talking directly to the hyperv?
  
Stephen Hemminger Oct. 30, 2024, 3:05 p.m. UTC | #3
On Wed, 30 Oct 2024 10:26:38 +0100
David Marchand <david.marchand@redhat.com> wrote:

> On Tue, Oct 22, 2024 at 4:37 AM Stephen Hemminger
> <stephen@networkplumber.org> wrote:
> >
> > The VMBus ring structure was marked packed which will cause
> > warnings if the no-address-of-packed is enabled. The structure
> > is all 32 bit values and the packed attribute has no impact
> > on the code layout; remove it.
> >
> > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>  
> 
> - Why only clean this structure in this header?
> I see many others which could get cleaned wrt __rte_packed.

Not sure, think these headers got inherited from the FreeBSD driver,
and the FreeBSD driver got these from Windows. And Windows code
always uses packed.

> 
> (There are some unused structs too and it would be better not to keep
> unused code around).

Yes, cleanup would be good.

> 
> - On a separate note, I wonder why the vmbus headers are exported as
> public headers.
> All those seem to be for use only in drivers, for resources attached
> on such a bus.
> Would an application benefit from talking directly to the hyperv?

Probably no need to export, Long can look into it.
  
Stephen Hemminger Oct. 30, 2024, 3:26 p.m. UTC | #4
On Wed, 30 Oct 2024 10:26:38 +0100
David Marchand <david.marchand@redhat.com> wrote:

> On Tue, Oct 22, 2024 at 4:37 AM Stephen Hemminger
> <stephen@networkplumber.org> wrote:
> >
> > The VMBus ring structure was marked packed which will cause
> > warnings if the no-address-of-packed is enabled. The structure
> > is all 32 bit values and the packed attribute has no impact
> > on the code layout; remove it.
> >
> > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>  
> 
> - Why only clean this structure in this header?

The patch was addressing the warning generated when the address
of packed member is re-enabled. The other usages are less of a problem
and cause no errors.
  

Patch

diff --git a/drivers/bus/vmbus/rte_vmbus_reg.h b/drivers/bus/vmbus/rte_vmbus_reg.h
index e3299aa871..c4f2fa4c7e 100644
--- a/drivers/bus/vmbus/rte_vmbus_reg.h
+++ b/drivers/bus/vmbus/rte_vmbus_reg.h
@@ -108,7 +108,7 @@  struct vmbus_bufring {
 	 * !!! DO NOT place any fields below this !!!
 	 */
 	uint8_t data[];
-} __rte_packed;
+};
 
 /*
  * Channel packets