On 2025/1/4 3:02, Stephen Hemminger wrote: > On Fri, 03 Jan 2025 23:04:13 +0800 > "WanRenyong" <wa...@yunsilicon.com> wrote: > >> +static int >> +xsc_vfio_destroy_qp(void *qp) >> +{ >> + int ret; >> + int in_len, out_len, cmd_len; >> + struct xsc_cmd_destroy_qp_mbox_in *in; >> + struct xsc_cmd_destroy_qp_mbox_out *out; >> + struct xsc_vfio_qp *data = (struct xsc_vfio_qp *)qp; >> + >> + in_len = sizeof(struct xsc_cmd_destroy_qp_mbox_in); >> + out_len = sizeof(struct xsc_cmd_destroy_qp_mbox_out); >> + cmd_len = RTE_MAX(in_len, out_len); >> + >> + in = malloc(cmd_len); >> + if (in == NULL) { >> + rte_errno = ENOMEM; >> + PMD_DRV_LOG(ERR, "Failed to alloc qp destroy cmd memory"); >> + return -rte_errno; >> + } >> + memset(in, 0, cmd_len); > If this data structure needs to be shared between primary and secondary > process, > then it needs to be allocated with rte_malloc(). If it does not need to be > shared, then it can come from heap with malloc(). no, this data structure is not shared between primary and secondary process. it is a temporary memory to initial mailbox data structure.
-- Thanks, WanRenyong