Skip to content

[Mellanox] Add support for new "nvidia-bluefield" platform.#18466

Merged
liat-grozovik merged 1 commit intosonic-net:masterfrom
oleksandrivantsiv:nvidia-bluefield-platform
Apr 16, 2024
Merged

[Mellanox] Add support for new "nvidia-bluefield" platform.#18466
liat-grozovik merged 1 commit intosonic-net:masterfrom
oleksandrivantsiv:nvidia-bluefield-platform

Conversation

@oleksandrivantsiv
Copy link
Copy Markdown
Collaborator

Why I did it

Add support for new Nvidia-bluefield BF-3 DPU.

Work item tracking
  • Microsoft ADO (number only):

How I did it

Define a new nvidia-bluefield platform with a set of makefiles to compile an image with all dependencies. Impleme PMON platform API

How to verify it

The added changes don't affect the compilation of the existing platforms.

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)

Description for the changelog

Link to config_db schema for YANG module changes

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

@lguohan
Copy link
Copy Markdown
Collaborator

lguohan commented Mar 26, 2024

@prgeor , @saiarcot895 , can you help to review it?

&& cd /opt \
&& wget https://raw.githubusercontent.com/p4lang/ptf/master/ptf_nn/ptf_nn_agent.py \
&& apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y \
&& rm -rf /root/deps
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I know that most of this came from another file (either Dockerfile or sonic-mgmt test case), but can this be replaced with steps to install nanomsg-utils or libnanomsg5 from the Debian repos instead?

Also, should this still be Python 2, or can it be changed to Python 3?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

We don't have a use case for the PRC image right now. I removed all related files. When it will be needed we will submit it in a separate PR.

{% endif %}

## Clean up
RUN apt-get clean -y && \
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please remove python3-pip, python3-dev, and python3-setuptools.

pushd mlnx_sai

# Build the package
debuild -e 'make_extra_flags="DEFS=-DACS_OS -DCONFIG_SYSLOG"' -us -uc -b -j$(SONIC_CONFIG_MAKE_JOBS) --admindir $(SONIC_DPKG_ADMINDIR)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cosnidering the rest of the repo uses dpkg-buildpackage, can that be used here instead of debuild?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Do you see any issues with the debuild utility? All the makefiles we have here are well-tested. Any change to the make files will require us to run the regression and qualify the changes.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No specific issues, just consistency.

# put a lock here because dpkg does not allow installing packages in parallel
while true; do
if mkdir $(DEST)/dpkg_lock &> /dev/null; then
{ sudo dpkg -i $(SRC_DEB) && rm -d $(DEST)/dpkg_lock && break; } || { rm -d $(DEST)/dpkg_lock && exit 1 ; }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If these packages need to be installed as build dependencies, can they be specified as such via the approprate rules.mk file, instead of installing them here?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It is impossible to do via rules.mk because the package installed here is a part of the archive we download. Theoretically, we can split this into two targets and create dependencies between them but this will require downloading the archive twice.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What about having a Makefile that only downloads the archive, extracts the packages, and then copies it to target/debs/...? rules.mk would call that Makefile and then expects the packages to get installed.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is a good idea. I updated the implementation

patch -p1 < ../0001-Remove-meson-from-dependencies.patch

# Build the Debs
PATH=/usr/bin/:$(PATH) dpkg-buildpackage -us -uc -b -j$(SONIC_CONFIG_MAKE_JOBS) --admindir $(SONIC_DPKG_ADMINDIR)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why the PATH change here?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

In this Makefile it is not needed. Removed

pushd $(OFED_SRC)/
find . -type f -exec touch {} +

sudo mv /bin/uname /bin/uname.orig
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If this needs to be done, I would highly recommend instead having this in some manually-created directory, and updating PATH so that that directory is checked first. (Ideally, any package build should allow for specifying the kernel version via an argument or an environment variable, as is usually done for external kernel module builds.)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I reworked the Makefile. Now this is removed.

@oleksandrivantsiv
Copy link
Copy Markdown
Collaborator Author

@saiarcot895 can you please check this PR?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

FYI, Python 3.9 and newer have this functionality in the stdlib: https://docs.python.org/3/library/functools.html#functools.cache

@saiarcot895
Copy link
Copy Markdown
Contributor

@prgeor for review of platform APIs

Copy link
Copy Markdown
Collaborator

@liat-grozovik liat-grozovik left a comment

Choose a reason for hiding this comment

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

please check the comment on all new files.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

new file cannot have such header.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

done

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

new file cannot have such header

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

done

@liat-grozovik liat-grozovik changed the title [nvidia-bluefield] Add support for new "nvidia-bluefield" platform. [Mellanox] Add support for new "nvidia-bluefield" platform. Apr 14, 2024
Signed-off-by: Oleksandr Ivantsiv <[email protected]>
Co-authored-by: Vivek Reddy <[email protected]>
Co-authored-by: Yakiv Huryk <[email protected]>
@oleksandrivantsiv oleksandrivantsiv force-pushed the nvidia-bluefield-platform branch from a0871d1 to 1f6e45c Compare April 16, 2024 00:55
@liat-grozovik liat-grozovik merged commit e7cf8cf into sonic-net:master Apr 16, 2024
@prgeor
Copy link
Copy Markdown
Contributor

prgeor commented Apr 22, 2024

I was indeed late to review this PR...@liat-grozovik I didn't understand the urgency in merging this PR

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.

5 participants