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

devmodelcommon.proto: Add types for CAN devices #44

Merged
merged 2 commits into from
Feb 23, 2024

Conversation

rene
Copy link
Contributor

@rene rene commented Feb 19, 2024

devmodelcommon.proto: Add types for CAN devices

Extended the API to support CAN Devices on EVE. The proposal is described
and discussed at LFEdge's EVE Wiki:

https://wiki.lfedge.org/display/EVE/CAN+Bus+support

Three new members are added to PhyIoType:

  • PHY_IO_TYPE_PHY_IO_CAN
  • PHY_IO_TYPE_PHY_IO_VCAN
  • PHY_IO_TYPE_PHY_IO_LCAN

Signed-off-by: Renê de Souza Pinto [email protected]

rene added 2 commits February 19, 2024 12:11
Extended the API to support CAN Devices on EVE. The proposal is described
and discussed at LFEdge's EVE Wiki:

https://wiki.lfedge.org/display/EVE/CAN+Bus+support

Three new members are added to PhyIoType:

- PHY_IO_TYPE_PHY_IO_CAN
- PHY_IO_TYPE_PHY_IO_VCAN
- PHY_IO_TYPE_PHY_IO_LCAN

Signed-off-by: Renê de Souza Pinto <[email protected]>
All changes after the 'make'.

Signed-off-by: Renê de Souza Pinto <[email protected]>
@rene rene requested a review from eriknordmark as a code owner February 19, 2024 12:36
Copy link
Contributor

@eriknordmark eriknordmark left a comment

Choose a reason for hiding this comment

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

We should ignore the buflint complaints about using PHY_IO_TYPE_ prefix etc since it makes more sense to follow the style for the existing enum values.

But a question.
Would a controller (and associated UI etc) want to know whether a device understands these new enum values before sending them in the API?
If so we should also add a new value in the API Capabilities enum in the API for CAN support.
But if we don't think the controller cares then that isn't needed.

@rene
Copy link
Contributor Author

rene commented Feb 19, 2024

We should ignore the buflint complaints about using PHY_IO_TYPE_ prefix etc since it makes more sense to follow the style for the existing enum values.

But a question. Would a controller (and associated UI etc) want to know whether a device understands these new enum values before sending them in the API? If so we should also add a new value in the API Capabilities enum in the API for CAN support. But if we don't think the controller cares then that isn't needed.

@eriknordmark , AFAU receiving a non supported I/O type is harmless because pillar will not perform any special handling of it... From what I see in the API we don't treat every single supported I/O type in capabilities, so I think we don't need any special treatment for CAN devices... but I don't have the full picture of the API, so I'm totally OK to accept the approach you and others point here as more adequate for this particular case...

@eriknordmark
Copy link
Contributor

@eriknordmark , AFAU receiving a non supported I/O type is harmless because pillar will not perform any special handling of it... From what I see in the API we don't treat every single supported I/O type in capabilities, so I think we don't need any special treatment for CAN devices... but I don't have the full picture of the API, so I'm totally OK to accept the approach you and others point here as more adequate for this particular case...

Does the EVE code not care if the I/O type is 17 (some undefined value) and still look at the pci addresses etc? If so we don't need a API capability.

@rene
Copy link
Contributor Author

rene commented Feb 23, 2024

@eriknordmark , AFAU receiving a non supported I/O type is harmless because pillar will not perform any special handling of it... From what I see in the API we don't treat every single supported I/O type in capabilities, so I think we don't need any special treatment for CAN devices... but I don't have the full picture of the API, so I'm totally OK to accept the approach you and others point here as more adequate for this particular case...

Does the EVE code not care if the I/O type is 17 (some undefined value) and still look at the pci addresses etc? If so we don't need a API capability.

I looked at domain manager's code and found basically two main functions that could potential fail due to an unknown IoType:
https://github.com/lf-edge/eve/blob/master/pkg/pillar/cmd/domainmgr/domainmgr.go#L2763 and
https://github.com/lf-edge/eve/blob/master/pkg/pillar/types/assignableadapters.go#L186

In the latter, there is this conversion ib.Type = IoType(phyAdapter.Ptype) , for unknown IoTypes, it will keep the phyAdapter.Ptype, i.e., any number above the known types, like 17, 18, etc...

There are a lot of checks for specific types, as I mentioned, but I couldn't find any returns or errors generated due to an unknown type... so I think we are safe....

@rene
Copy link
Contributor Author

rene commented Feb 23, 2024

@eriknordmark , btw I've found this https://github.com/lf-edge/eve/blob/master/pkg/pillar/types/assignableadapters.go#L237 :

        IoNVMEStorage IoType = 9
	IoSATAStorage IoType = 10
	IoNetEthPF    IoType = 11
	IoNetEthVF    IoType = 12
	IoNVME        IoType = 255
	IoOther       IoType = 255

IoNVME has the same value of IoOther.... I don't think that's on purpose, it is?

@eriknordmark
Copy link
Contributor

There are a lot of checks for specific types, as I mentioned, but I couldn't find any returns or errors generated due to an unknown type... so I think we are safe....

Thanks for checking.

@eriknordmark
Copy link
Contributor

@eriknordmark , btw I've found this https://github.com/lf-edge/eve/blob/master/pkg/pillar/types/assignableadapters.go#L237 :

        IoNVMEStorage IoType = 9
	IoSATAStorage IoType = 10
	IoNetEthPF    IoType = 11
	IoNetEthVF    IoType = 12
	IoNVME        IoType = 255
	IoOther       IoType = 255

IoNVME has the same value of IoOther.... I don't think that's on purpose, it is?

That was the purpose initially. But now we have the unique type IoNVMEStorage so this should be removed AFAIR. However, I see code in pkg/pillar/cmd/domainmgr/domainmgr.go which refers to IoNVME and not IoNVMEStorage. Can you check with Ioannis? If so he can remove it from the API and replace the usage in domainmgr.

Copy link
Contributor

@eriknordmark eriknordmark left a comment

Choose a reason for hiding this comment

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

LGTM

@eriknordmark eriknordmark merged commit a95e144 into lf-edge:main Feb 23, 2024
3 of 4 checks passed
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.

2 participants