Skip to content

common: service: support PLDM get PDR handler#1303

Closed
BonnieLo wants to merge 1 commit into
facebook:mainfrom
Wiwynn:Peter/common-pldm-pdr
Closed

common: service: support PLDM get PDR handler#1303
BonnieLo wants to merge 1 commit into
facebook:mainfrom
Wiwynn:Peter/common-pldm-pdr

Conversation

@BonnieLo

Copy link
Copy Markdown

Summary:

Description
Implement pldm get pdr info and get pdr handler.

Motivation

For implementing sensor monitoring, the BMC should get sensor information from the BIC.

Test Plan:

  • Build code: Pass
  • Add some PDR samples on platform and BMC get pdr from BIC: Pass

Log:

Get PDR info:
pldmtool raw -m 8 -d 0x80 0x02 0x50
pldmtool: Tx: 80 02 50
pldmtool: Rx: 00 02 50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03 00 00 00 44 01 00 00 6c 00 00 00 00

Get PDR:
pldmtool platform GetPDR -m 8 -a -v
[
pldmtool: Tx: 80 02 51 00 00 00 00 00 00 00 00 01 ff ff 00 00 Success in creating the socket : RC = 4
Write to socket successful : RC = 16
Total length:123
pldmtool: Rx: 00 02 51 00 01 00 00 00 00 00 00 00 05 6c 00 00 00 00 00 01 02 00 00 60 00 00 00 00 10 20 00 01 88 00 10 00 00 00 00 05 00 00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 7f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0d 00 90 08 0a 00 00 20 0a 00 a0 0d 0a 00 b0 1b 0e 00 4d 01 0a 00 5b 00
{
"nextRecordHandle": 1,
"responseCount": 108,
"recordHandle": 0,
"PDRHeaderVersion": 1,
"PDRType": "Numeric Sensor PDR",
"recordChangeNumber": 0,
"dataLength": 96
}
,pldmtool: Tx: 81 02 51 01 00 00 00 00 00 00 00 01 ff ff 00 00 Success in creating the socket : RC = 4
Write to socket successful : RC = 16
Total length:123
pldmtool: Rx: 01 02 51 00 02 00 00 00 00 00 00 00 05 6c 00 01 00 00 00 01 02 00 00 60 00 00 00 00 10 2d 00 01 88 00 10 00 00 00 00 05 00 00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 7f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 6e 03 01 00 ca 02 01 00 80 03 01 00 89 02 01 00 02 00 02 00 04 00 00 00
{
"nextRecordHandle": 2,
"responseCount": 108,
"recordHandle": 1,
"PDRHeaderVersion": 1,
"PDRType": "Numeric Sensor PDR",
"recordChangeNumber": 0,
"dataLength": 96
}
,pldmtool: Tx: 82 02 51 02 00 00 00 00 00 00 00 01 ff ff 00 00 Success in creating the socket : RC = 4
Write to socket successful : RC = 16
Total length:123
pldmtool: Rx: 02 02 51 00 00 00 00 00 00 00 00 00 05 6c 00 02 00 00 00 01 02 00 00 60 00 00 00 00 10 01 00 01 88 00 10 00 00 00 00 02 00 00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 29 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 34 00 00 00 96 00 00 00 00 00
{
"nextRecordHandle": 0,
"responseCount": 108,
"recordHandle": 2,
"PDRHeaderVersion": 1,
"PDRType": "Numeric Sensor PDR",
"recordChangeNumber": 0,
"dataLength": 96
}
]

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 23, 2023
@facebook-github-bot

Copy link
Copy Markdown
Contributor

@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

Comment thread common/service/pldm/pldm_monitor.h Outdated
uint32_t next_data_transfer_handle;
uint8_t transfer_flag;
uint16_t response_count;
uint8_t record_data[108];

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Can you please do #define for size.

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.

Done.

Comment thread common/service/pldm/pldm_monitor.h Outdated
struct pldm_get_pdr_info_resp {
uint8_t completion_code;
uint8_t repository_state;
uint8_t update_time[13];

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Can you please do #define for size.

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.

Done.

Comment thread common/service/pldm/pldm_monitor.h Outdated
uint8_t completion_code;
uint8_t repository_state;
uint8_t update_time[13];
uint8_t oem_update_time[13];

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Can you please do #define for size.

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.

Done.

Comment thread common/service/sensor/pdr.h Outdated
#include <stdbool.h>
#include <stdint.h>

extern uint32_t pdr_count;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Any specific reason you want to expose these extern vars rather than using an API? I already see an API with name plat_get_pdr_size, better to expose that, rather defining extern vars being used outside which impacts code readability and maintainability.
Same goes for other extern vars defined in file.

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.

Since some vars need to be initialized in platform layer, the vars are declared as extern variable for platform code to access.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

My suggestion is to define get , set APIs rather than externs. With extern vars the code browsing is hard.

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.

Done.

Comment thread common/service/sensor/pdr.c Outdated
extern PDR_numeric_sensor plat_pdr_table[];
extern const int PDR_TABLE_SIZE;

uint32_t pdr_count = 0;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Can pdr_count and pdr_config_size have different values or always same?

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.

The pdr_config_size was planned to be another sensor config table size. Since we are not having sensor config table for PDR, I deleted it in this commit.

Comment thread common/service/sensor/sensor.c Outdated
if (numeric_sensor_table != NULL) {
pdr_init();
} else {
LOG_ERR("numeric_sensor_table == NULL");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Do you want to continue on failure?

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.

Most platforms don't have PDR table now, so we make this continue on failure. We plan to implement another sensor service for PLDM PDR sensors. I leaved a TODO for indication.

@facebook-github-bot

Copy link
Copy Markdown
Contributor

@BonnieLo has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot

Copy link
Copy Markdown
Contributor

@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot

Copy link
Copy Markdown
Contributor

@BonnieLo has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot

Copy link
Copy Markdown
Contributor

@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

Summary:
Description
Implement pldm get pdr info and get pdr handler.

Motivation
For implementing sensor monitoring, the BMC should get sensor information from the BIC.

Test Plan:
- Build code: Pass
- Add some PDR samples on platform and BMC get pdr from BIC: Pass

Log:
Get PDR info:
pldmtool raw -m 8 -d 0x80 0x02 0x50
pldmtool: Tx: 80 02 50
pldmtool: Rx: 00 02 50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03 00 00 00 44 01 00 00 6c 00 00 00 00

Get PDR:
pldmtool platform GetPDR -m 8 -a -v
[
pldmtool: Tx: 80 02 51 00 00 00 00 00 00 00 00 01 ff ff 00 00
Success in creating the socket : RC = 4
Write to socket successful : RC = 16
Total length:123
pldmtool: Rx: 00 02 51 00 01 00 00 00 00 00 00 00 05 6c 00 00 00 00 00 01 02 00 00 60 00 00 00 00 10 20 00 01 88 00 10 00
00 00 00 05 00 00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3f 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 04 7f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0d 00 90 08 0a 00 00 20 0a 00 a0 0d 0a 00 b0 1b 0e 00 4d
01 0a 00 5b 00
{
    "nextRecordHandle": 1,
    "responseCount": 108,
    "recordHandle": 0,
    "PDRHeaderVersion": 1,
    "PDRType": "Numeric Sensor PDR",
    "recordChangeNumber": 0,
    "dataLength": 96
}
,pldmtool: Tx: 81 02 51 01 00 00 00 00 00 00 00 01 ff ff 00 00
Success in creating the socket : RC = 4
Write to socket successful : RC = 16
Total length:123
pldmtool: Rx: 01 02 51 00 02 00 00 00 00 00 00 00 05 6c 00 01 00 00 00 01 02 00 00 60 00 00 00 00 10 2d 00 01 88 00 10 00
00 00 00 05 00 00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 06 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 04 7f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 6e 03 01 00 ca 02 01 00 80 03 01 00 89 02 01 00 02 00 02
00 04 00 00 00
{
    "nextRecordHandle": 2,
    "responseCount": 108,
    "recordHandle": 1,
    "PDRHeaderVersion": 1,
    "PDRType": "Numeric Sensor PDR",
    "recordChangeNumber": 0,
    "dataLength": 96
}
,pldmtool: Tx: 82 02 51 02 00 00 00 00 00 00 00 01 ff ff 00 00
Success in creating the socket : RC = 4
Write to socket successful : RC = 16
Total length:123
pldmtool: Rx: 02 02 51 00 00 00 00 00 00 00 00 00 05 6c 00 02 00 00 00 01 02 00 00 60 00 00 00 00 10 01 00 01 88 00 10 00
00 00 00 02 00 00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 06 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 04 29 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 34 00 00 00 96
00 00 00 00 00
{
    "nextRecordHandle": 0,
    "responseCount": 108,
    "recordHandle": 2,
    "PDRHeaderVersion": 1,
    "PDRType": "Numeric Sensor PDR",
    "recordChangeNumber": 0,
    "dataLength": 96
}
]
@facebook-github-bot

Copy link
Copy Markdown
Contributor

@BonnieLo has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot

Copy link
Copy Markdown
Contributor

@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request has been merged in 3ed7191.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged

4 participants