Skip to content

Conversation

@raghav-nexthop
Copy link
Contributor

@raghav-nexthop raghav-nexthop commented Sep 22, 2025

  • [PDDF] Structure and API for protocol modules to register their ops with the driver

  • [PDDF] Make multifpgapci i2c protocol handler a standalone kernel module

  • [PDDF] Make multifpgapci gpio protocol handler a standalone kernel module

  • [PDDF] Cleanup driver private data from having protocol info

Why I did it

Addition of new protocols requires changes to the multifpgapci driver including changes to the internal structure to be able to maintain protocol specific information. This affects speed and ease of development of features, long term maintainability and most importantly the code quality.

Work item tracking
  • Microsoft ADO (number only):

How I did it

Defined a set of operations in the driver that a protocol module should implement. These operations are registered by protocol modules with the driver using an API. As part of this change, all the protocol specific handling is moved to the modules -in this case i2c code is refactored out of the driver and into a separate module. Similarly, the gpio protocol code is converted into an independent loadable module.

How to verify it

Used the latest passing build to verify the loading of modules and detection of i2c devices:

i2c module logs:

[   11.111292] PDDF_MULTIFPGAPCI        [pddf_multifpgapci_i2c_attach] pci_dev 0000:03:00.0
[   11.111534] PDDF_MULTIFPGAPCI        [pddf_multifpgapci_i2c_attach] pci_dev 0000:04:00.0
[   12.489755] PDDF_MULTIFPGAPCI        [pddf_multifpgapci_i2c_map_bar] pci_dev 0000:03:00.0
[   14.547433] PDDF_MULTIFPGAPCI        [pddf_multifpgapci_i2c_map_bar] pci_dev 0000:04:00.0

gpio module logs

[   11.111278] PDDF_MULTIFPGAPCI        pddf_multifpgapci_gpio_attach start
[   11.111289] PDDF_MULTIFPGAPCI        pddf_multifpgapci_gpio_attach done!
[   11.111523] PDDF_MULTIFPGAPCI        pddf_multifpgapci_gpio_attach start
[   11.111532] PDDF_MULTIFPGAPCI        pddf_multifpgapci_gpio_attach done!

gpio devices

Controller: 7-0041, base=9955, ngpio=25
Controller: pddf-multifpgapci-gpio, base=9980, ngpio=4
Controller: AMDI0030:00, base=9984, ngpio=256

i2c devices

i2c-0   smbus           SMBus PIIX4 adapter port 0 at 0b00      SMBus adapter
i2c-1   smbus           SMBus PIIX4 adapter port 2 at 0b00      SMBus adapter
i2c-2   smbus           SMBus PIIX4 adapter port 1 at 0b20      SMBus adapter
i2c-3   i2c             Synopsys DesignWare I2C adapter         I2C adapter
i2c-4   i2c             i2c-pci-4                               I2C adapter
i2c-5   i2c             i2c-pci-5                               I2C adapter
i2c-6   i2c             i2c-pci-6                               I2C adapter
i2c-7   i2c             i2c-pci-7                               I2C adapter
i2c-8   i2c             i2c-pci-8                               I2C adapter
i2c-9   i2c             i2c-pci-9                               I2C adapter
i2c-10  i2c             i2c-pci-10                              I2C adapter
i2c-11  i2c             i2c-pci-11                              I2C adapter
i2c-19  i2c             i2c-pci-19                              I2C adapter
i2c-20  i2c             i2c-pci-20                              I2C adapter
i2c-21  i2c             i2c-pci-21                              I2C adapter
i2c-22  i2c             i2c-pci-22                              I2C adapter
i2c-23  i2c             i2c-pci-23                              I2C adapter
i2c-24  i2c             i2c-pci-24                              I2C adapter
i2c-25  i2c             i2c-pci-25                              I2C adapter
i2c-26  i2c             i2c-pci-26                              I2C adapter
i2c-27  i2c             i2c-pci-27                              I2C adapter
i2c-28  i2c             i2c-pci-28                              I2C adapter
i2c-29  i2c             i2c-pci-29                              I2C adapter
i2c-30  i2c             i2c-pci-30                              I2C adapter
i2c-31  i2c             i2c-pci-31                              I2C adapter
i2c-32  i2c             i2c-pci-32                              I2C adapter
i2c-33  i2c             i2c-pci-33                              I2C adapter
i2c-34  i2c             i2c-pci-34                              I2C adapter
i2c-35  i2c             i2c-pci-35                              I2C adapter
i2c-36  i2c             i2c-pci-36                              I2C adapter
i2c-37  i2c             i2c-pci-37                              I2C adapter
i2c-38  i2c             i2c-pci-38                              I2C adapter
i2c-39  i2c             i2c-pci-39                              I2C adapter
i2c-40  i2c             i2c-pci-40                              I2C adapter
i2c-41  i2c             i2c-pci-41                              I2C adapter
i2c-42  i2c             i2c-pci-42                              I2C adapter
i2c-43  i2c             i2c-pci-43                              I2C adapter
i2c-44  i2c             i2c-pci-44                              I2C adapter
i2c-45  i2c             i2c-pci-45                              I2C adapter
i2c-46  i2c             i2c-pci-46                              I2C adapter
i2c-47  i2c             i2c-pci-47                              I2C adapter
i2c-48  i2c             i2c-pci-48                              I2C adapter
i2c-49  i2c             i2c-pci-49                              I2C adapter
i2c-50  i2c             i2c-pci-50                              I2C adapter
i2c-51  i2c             i2c-pci-51                              I2C adapter
i2c-52  i2c             i2c-pci-52                              I2C adapter
i2c-53  i2c             i2c-pci-53                              I2C adapter
i2c-54  i2c             i2c-pci-54                              I2C adapter
i2c-55  i2c             i2c-pci-55                              I2C adapter
i2c-56  i2c             i2c-pci-56                              I2C adapter
i2c-57  i2c             i2c-pci-57                              I2C adapter

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

  • 202205
  • 202211
  • 202305
  • 202311
  • 202405
  • 202411
  • 202505

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)

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@raghav-nexthop raghav-nexthop marked this pull request as ready for review September 24, 2025 22:56
@raghav-nexthop
Copy link
Contributor Author

@geans-pin
Could you please review the PR when you get a chance?

- Accept upstream change for pddf-device.json (now auto-generated)
- Add multifpgapci protocol modules to pddf-device.json.j2 template:
  - pddf_multifpgapci_i2c_module
  - pddf_multifpgapci_gpio_module
  - pddf_multifpgapci_spi_module
@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

lotus-nexthop pushed a commit to nexthop-ai/sonic-buildimage that referenced this pull request Oct 27, 2025
lotus-nexthop pushed a commit to nexthop-ai/sonic-buildimage that referenced this pull request Oct 27, 2025
lotus-nexthop added a commit to nexthop-ai/sonic-buildimage that referenced this pull request Oct 27, 2025
@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@lotus-nexthop
Copy link
Contributor

I pulled out the MDIO change into #24348

@lotus-nexthop
Copy link
Contributor

HLD: sonic-net/SONiC#2090

Copy link
Contributor

@geans-pin geans-pin left a comment

Choose a reason for hiding this comment

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

Please provide UT verification log based on the PR changes

@lotus-nexthop
Copy link
Contributor

Please provide UT verification log based on the PR changes

Thanks @geans-pin , I have attachd the dmesg logs which show the pddf kernel module initialization.

It is running the image built from this PR itself.

admin@gold232-dut:~$ show version

SONiC Software Version: SONiC.master-24070.970012-25c2fed6d
SONiC OS Version: 12
Distribution: Debian 12.12
Kernel: 6.1.0-29-2-amd64
Build commit: 25c2fed6d
Build date: Mon Oct 27 06:51:02 UTC 2025
Built by: azureuser@7c5a19d2c000000

dmesg.txt

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@Praveen-Brcm Praveen-Brcm merged commit b5817ab into sonic-net:master Oct 31, 2025
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

7 participants