/** * hinic_register_mgmt_msg_cb - register msg handler for a msg from a module * @pf_to_mgmt: PF to MGMT channel * @mod: module in the chip that this handler will handle its messages * @handle: private data for the callback * @callback: the handler that will handle messages
**/ void hinic_register_mgmt_msg_cb(struct hinic_pf_to_mgmt *pf_to_mgmt, enum hinic_mod_type mod, void *handle, void (*callback)(void *handle,
u8 cmd, void *buf_in,
u16 in_size, void *buf_out,
u16 *out_size))
{ struct hinic_mgmt_cb *mgmt_cb = &pf_to_mgmt->mgmt_cb[mod];
/** * hinic_unregister_mgmt_msg_cb - unregister msg handler for a msg from a module * @pf_to_mgmt: PF to MGMT channel * @mod: module in the chip that this handler handles its messages
**/ void hinic_unregister_mgmt_msg_cb(struct hinic_pf_to_mgmt *pf_to_mgmt, enum hinic_mod_type mod)
{ struct hinic_mgmt_cb *mgmt_cb = &pf_to_mgmt->mgmt_cb[mod];
mgmt_cb->state &= ~HINIC_MGMT_CB_ENABLED;
while (mgmt_cb->state & HINIC_MGMT_CB_RUNNING)
schedule();
mgmt_cb->cb = NULL;
}
/** * prepare_header - prepare the header of the message * @pf_to_mgmt: PF to MGMT channel * @msg_len: the length of the message * @mod: module in the chip that will get the message * @ack_type: ask for response * @direction: the direction of the message * @cmd: command of the message * @msg_id: message id * * Return the prepared header value
**/ static u64 prepare_header(struct hinic_pf_to_mgmt *pf_to_mgmt,
u16 msg_len, enum hinic_mod_type mod, enum msg_ack_type ack_type, enum mgmt_direction_type direction,
u16 cmd, u16 msg_id)
{ struct hinic_hwif *hwif = pf_to_mgmt->hwif;
/** * prepare_mgmt_cmd - prepare the mgmt command * @mgmt_cmd: pointer to the command to prepare * @header: pointer of the header for the message * @msg: the data of the message * @msg_len: the length of the message
**/ staticvoid prepare_mgmt_cmd(u8 *mgmt_cmd, u64 *header, u8 *msg, u16 msg_len)
{
memset(mgmt_cmd, 0, MGMT_MSG_RSVD_FOR_DEV);
/** * send_msg_to_mgmt - send message to mgmt by API CMD * @pf_to_mgmt: PF to MGMT channel * @mod: module in the chip that will get the message * @cmd: command of the message * @data: the msg data * @data_len: the msg data length * @ack_type: ask for response * @direction: the direction of the original message * @resp_msg_id: msg id to response for * * Return 0 - Success, negative - Failure
**/ staticint send_msg_to_mgmt(struct hinic_pf_to_mgmt *pf_to_mgmt, enum hinic_mod_type mod, u8 cmd,
u8 *data, u16 data_len, enum msg_ack_type ack_type, enum mgmt_direction_type direction,
u16 resp_msg_id)
{ struct hinic_api_cmd_chain *chain;
u64 header;
u16 msg_id;
/** * msg_to_mgmt_sync - send sync message to mgmt * @pf_to_mgmt: PF to MGMT channel * @mod: module in the chip that will get the message * @cmd: command of the message * @buf_in: the msg data * @in_size: the msg data length * @buf_out: response * @out_size: response length * @direction: the direction of the original message * @resp_msg_id: msg id to response for * @timeout: time-out period of waiting for response * * Return 0 - Success, negative - Failure
**/ staticint msg_to_mgmt_sync(struct hinic_pf_to_mgmt *pf_to_mgmt, enum hinic_mod_type mod, u8 cmd,
u8 *buf_in, u16 in_size,
u8 *buf_out, u16 *out_size, enum mgmt_direction_type direction,
u16 resp_msg_id, u32 timeout)
{ struct hinic_hwif *hwif = pf_to_mgmt->hwif; struct pci_dev *pdev = hwif->pdev; struct hinic_recv_msg *recv_msg; struct completion *recv_done; unsignedlong timeo;
u16 msg_id; int err;
/* Lock the sync_msg_buf */
down(&pf_to_mgmt->sync_msg_lock);
/** * msg_to_mgmt_async - send message to mgmt without response * @pf_to_mgmt: PF to MGMT channel * @mod: module in the chip that will get the message * @cmd: command of the message * @buf_in: the msg data * @in_size: the msg data length * @direction: the direction of the original message * @resp_msg_id: msg id to response for * * Return 0 - Success, negative - Failure
**/ staticint msg_to_mgmt_async(struct hinic_pf_to_mgmt *pf_to_mgmt, enum hinic_mod_type mod, u8 cmd,
u8 *buf_in, u16 in_size, enum mgmt_direction_type direction,
u16 resp_msg_id)
{ int err;
/* Lock the sync_msg_buf */
down(&pf_to_mgmt->sync_msg_lock);
/** * mgmt_resp_msg_handler - handler for a response message from mgmt cpu * @pf_to_mgmt: PF to MGMT channel * @recv_msg: received message details
**/ staticvoid mgmt_resp_msg_handler(struct hinic_pf_to_mgmt *pf_to_mgmt, struct hinic_recv_msg *recv_msg)
{
wmb(); /* verify writing all, before reading */
complete(&recv_msg->recv_done);
}
/** * recv_mgmt_msg_handler - handler for a message from mgmt cpu * @pf_to_mgmt: PF to MGMT channel * @header: the header of the message * @recv_msg: received message details
**/ staticvoid recv_mgmt_msg_handler(struct hinic_pf_to_mgmt *pf_to_mgmt,
u64 *header, struct hinic_recv_msg *recv_msg)
{ struct hinic_hwif *hwif = pf_to_mgmt->hwif; struct pci_dev *pdev = hwif->pdev; int seq_id, seg_len;
u8 *msg_body;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.