[PATCH v4 04/15] net/xsc: add xsc dev ops to support VFIO driver
Stephen Hemminger
stephen at networkplumber.org
Fri Jan 3 20:02:47 CET 2025
On Fri, 03 Jan 2025 23:04:13 +0800
"WanRenyong" <wanry at 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().
More information about the dev
mailing list