Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swss: Align STP structures and remove GCC diagnostic pragmas #3440

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

omaaartamer
Copy link

[swss]: Align STP Structures for bullseye/Broadcom & Remove GCC Diagnostic Pragmas

What I did

  • Updated stpmgr.h to replace packed structs with aligned structs
  • Replaced the old processStpPortAttr in stpmgr.cpp with a version that uses properly aligned STP_PORT_CONFIG_MSG allocations

How I did it

  • Ported the 202211 alignment fixes into master
  • Removed #pragma GCC diagnostic usage
  • Introduced ALIGNED(4) macros and added padding for the relevant STP_* structures

Why I did it

  • To resolve address-of-packed-member warnings that break builds on certain platforms (e.g., Broadcom)
  • Properly aligned data structures avoid misalignment issues and ensure stable builds

Target Platform/OS

  • Validated on bullseye
  • Tested on the Broadcom platform with no functionality changes

Test

  • Local builds and runtime tests confirmed successful compilation
  • Observed no regressions or functional impact

Signed-off-by: Omar Tamer <[email protected]>


What I did

  • Updated stpmgr.h to use aligned structs
  • Updated processStpPortAttr in stpmgr.cpp

Why I did it

  • To fix build issues on bullseye/Broadcom by removing packed-member warnings

How I verified it

  • Built and tested locally on Broadcom platform
  • Ensured correct runtime behavior with no functional changes

Details if related

  • No new features; this is a build fix only

What I did:
- Updated stpmgr.h to replace packed structs with aligned structs
- Replaced the old processStpPortAttr in stpmgr.cpp with a version
  that uses properly aligned STP_PORT_CONFIG_MSG allocations

How I did it:
- Applied the same alignment fixes from 202211 branch to master
- Removed #pragma GCC diagnostic usage and introduced ALIGNED(4)
  as well as padding fields in the relevant STP_* structures

Why I did it:
- To resolve address-of-packed-member warnings that break builds
  with certain compiler/platform configurations (e.g., Broadcom)
- Aligning data structures properly avoids potential misalignment errors

Signed-off-by: Omar Tamer <[email protected]>
Signed-off-by: omaaartamer <[email protected]>
@omaaartamer omaaartamer requested a review from prsunny as a code owner December 23, 2024 08:28
@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@prsunny prsunny requested a review from srj102 January 6, 2025 20:01
@prsunny
Copy link
Collaborator

prsunny commented Jan 6, 2025

@divyachandralekha , please review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants