MCPcopy Create free account
hub / github.com/F-Stack/f-stack / idpf_send_vc_msg

Function idpf_send_vc_msg

dpdk/drivers/common/idpf/idpf_common_virtchnl.c:39–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37}
38
39static int
40idpf_send_vc_msg(struct idpf_adapter *adapter, uint32_t op,
41 uint16_t msg_size, uint8_t *msg)
42{
43 struct idpf_ctlq_msg *ctlq_msg;
44 struct idpf_dma_mem *dma_mem;
45 int err;
46
47 err = idpf_vc_clean(adapter);
48 if (err != 0)
49 goto err;
50
51 ctlq_msg = rte_zmalloc(NULL, sizeof(struct idpf_ctlq_msg), 0);
52 if (ctlq_msg == NULL) {
53 err = -ENOMEM;
54 goto err;
55 }
56
57 dma_mem = rte_zmalloc(NULL, sizeof(struct idpf_dma_mem), 0);
58 if (dma_mem == NULL) {
59 err = -ENOMEM;
60 goto dma_mem_error;
61 }
62
63 dma_mem->size = IDPF_DFLT_MBX_BUF_SIZE;
64 idpf_alloc_dma_mem(&adapter->hw, dma_mem, dma_mem->size);
65 if (dma_mem->va == NULL) {
66 err = -ENOMEM;
67 goto dma_alloc_error;
68 }
69
70 memcpy(dma_mem->va, msg, msg_size);
71
72 ctlq_msg->opcode = idpf_mbq_opc_send_msg_to_pf;
73 ctlq_msg->func_id = 0;
74 ctlq_msg->data_len = msg_size;
75 ctlq_msg->cookie.mbx.chnl_opcode = op;
76 ctlq_msg->cookie.mbx.chnl_retval = VIRTCHNL_STATUS_SUCCESS;
77 ctlq_msg->ctx.indirect.payload = dma_mem;
78
79 err = idpf_ctlq_send(&adapter->hw, adapter->hw.asq, 1, ctlq_msg);
80 if (err != 0)
81 goto send_error;
82
83 return 0;
84
85send_error:
86 idpf_free_dma_mem(&adapter->hw, dma_mem);
87dma_alloc_error:
88 rte_free(dma_mem);
89dma_mem_error:
90 rte_free(ctlq_msg);
91err:
92 return err;
93}
94
95static enum idpf_vc_result
96idpf_read_msg_from_cp(struct idpf_adapter *adapter, uint16_t buf_len,

Callers 1

idpf_vc_cmd_executeFunction · 0.85

Calls 7

idpf_vc_cleanFunction · 0.85
rte_zmallocFunction · 0.85
idpf_alloc_dma_memFunction · 0.85
idpf_ctlq_sendFunction · 0.85
idpf_free_dma_memFunction · 0.85
rte_freeFunction · 0.85
memcpyFunction · 0.50

Tested by

no test coverage detected