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

zebra: fix dpdk compilation error #17752

Merged
merged 1 commit into from
Jan 6, 2025

Conversation

raja-rajasekar
Copy link
Contributor

Fixing compilation error in a switch statement case

Fixes :aa4786642c9a65c282d0fd5247a35b0f14fa1c3c

@@ -400,7 +400,7 @@ static void zd_dpdk_rule_update(struct zebra_dplane_ctx *ctx)
case DPLANE_OP_INTF_INSTALL:
case DPLANE_OP_INTF_UPDATE:
case DPLANE_OP_INTF_DELETE:
case DPLANE_OP_VLAN_INSTALL,
case DPLANE_OP_VLAN_INSTALL:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the right fix for this is to avoid a switch that only uses three values. could we just test for the three values that are being used? then we'd never have to revisit this again...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't -Wswitch-enum catch this what you told @mjstapp? I think the reason here is that we do not test with DPDK compilation...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are several places that use a switch for these dataplane operation codes - but that only use one or two or three of the values. that means that every time we add a code point, every one of the switches has to be updated. that's just ... noisy, and unnecessary (imo)
if this particular code just did if ... else ... else ... instead, this problem would go away - forever.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can work on a different MR to address all switch statements in general to avoid using so many cases and move to if/if else condition.
But as to this, given the original code (aa47866 ) is already in, I want this to go in so people don't complain compilation fails with dpdk.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gosh, I don't really want to do another PR that undoes some work. let's just do this PR, for this file, once and for all - and not have to deal with this problem again?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Contributor

@mjstapp mjstapp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks very much - looks fine!

Fixing compilation error in a switch statement case

Fixes :aa4786642c9a65c282d0fd5247a35b0f14fa1c3c

Signed-off-by: Rajasekar Raja <[email protected]>
@raja-rajasekar
Copy link
Contributor Author

ci:rerun

1 similar comment
@raja-rajasekar
Copy link
Contributor Author

ci:rerun

@Jafaral Jafaral merged commit 8ca4c3d into FRRouting:master Jan 6, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants