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

[image_config]: Enable Receive Packet Steering (RPS) #20211

Merged
merged 7 commits into from
Nov 8, 2024

Conversation

prabhataravind
Copy link
Contributor

@prabhataravind prabhataravind commented Sep 10, 2024

Why I did it

To enable CPU to handle CPU bound packets more efficiently

Work item tracking
  • Microsoft ADO 27251849:

How I did it

By using a systemd service that enables RPS for all front-panel ports on a sonic switch

How to verify it

Verify that "/sys/class/net/Ethernet/queues/rx-0/rps_cpus" is set to all available CPU cores

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111
  • 202205
  • 202211
  • 202305

Tested branch (Please provide the tested image version)

  • Master

Description for the changelog

Link to config_db schema for YANG module changes

A picture of a cute animal (not mandatory but encouraged)

@prabhataravind prabhataravind force-pushed the paravind/rps branch 2 times, most recently from c4a780a to 982a451 Compare September 10, 2024 20:04
@prabhataravind prabhataravind force-pushed the paravind/rps branch 2 times, most recently from ea3735f to 0ec856b Compare October 16, 2024 03:25
@prabhataravind
Copy link
Contributor Author

/azpw run

@mssonicbld
Copy link
Collaborator

/AzurePipelines run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

 * This patch enables Receive Packet Steering (RPS) which helps to distribute
   softirq processing for CPU bound packets to all available cores. This will
   help prevent kernel packet drops when there are bouts of intense CPU bound
   packets.

   Ref: https://lwn.net/Articles/362339/
        https://docs.kernel.org/networking/scaling.html

Signed-off-by: Prabhat Aravind <paravind@microsoft.com>
@prabhataravind
Copy link
Contributor Author

/azpw run

@mssonicbld
Copy link
Collaborator

/AzurePipelines run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@prabhataravind prabhataravind marked this pull request as ready for review October 18, 2024 00:58
@prabhataravind
Copy link
Contributor Author

/azpw run

@mssonicbld
Copy link
Collaborator

/AzurePipelines run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@prsunny prsunny requested a review from prgeor October 24, 2024 21:33
Make sure the script is run only once per interface

Signed-off-by: Prabhat Aravind <paravind@microsoft.com>
num_rx_queues = len([q for q in queues if q.startswith("rx")])
for q in range(num_rx_queues):
rps_cpus_path = os.path.join(queues_path, "rx-{}", "rps_cpus").format(q)
with open(rps_cpus_path, 'w') as file:
Copy link
Contributor

Choose a reason for hiding this comment

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

Capture any system failures to open or to write the values to the file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

configure_rps is called within a try block and all exceptions/failures are caught and logged in main()

sys.exit(rv)


if __name__ == "__main__":
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you check warmboot with old image and new image and also sudo config reload scenarios.

Copy link
Contributor

Choose a reason for hiding this comment

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

This shouldn't affect any boot sequence as these are kernel changes, but better to validate and capture the logs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ack. Will do a warmboot test and confirm.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Verified both warm-reboot and config reload scenarios. No issues observed.

@kperumalbfn kperumalbfn merged commit c8e5888 into sonic-net:master Nov 8, 2024
22 checks passed
aidan-gallagher pushed a commit to aidan-gallagher/sonic-buildimage that referenced this pull request Nov 16, 2024
[image_config]: Enable Receive Packet Steering (RPS)

Signed-off-by: Prabhat Aravind <paravind@microsoft.com>
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