/** * dpci_create() - Create the DPCI object. * @mc_io: Pointer to MC portal's I/O object * @dprc_token: Parent container token; '0' for default container * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @cfg: Configuration structure * @obj_id: Returned object id * * Create the DPCI object, allocate required resources and perform required * initialization. * * The object can be created either by declaring it in the * DPL file, or by calling this function. * * The function accepts an authentication token of a parent * container that this object should be assigned to. The token * can be '0' so the object will be assigned to the default container. * The newly created object can be opened with the returned * object id and using the container's associated tokens and MC portals. * * Return: '0' on Success; Error code otherwise. */ int dpci_create(struct fsl_mc_io *mc_io, uint16_t dprc_token, uint32_t cmd_flags, const struct dpci_cfg *cfg, uint32_t *obj_id) { struct dpci_cmd_create *cmd_params; struct mc_command cmd = { 0 }; int err; /* prepare command */ cmd.header = mc_encode_cmd_header(DPCI_CMDID_CREATE, cmd_flags, dprc_token); cmd_params = (struct dpci_cmd_create *)cmd.params; cmd_params->num_of_priorities = cfg->num_of_priorities; /* send command to mc*/ err = mc_send_command(mc_io, &cmd); if (err) return err; /* retrieve response parameters */ *obj_id = mc_cmd_read_object_id(&cmd); return 0; }
/** * dpbp_create() - Create the DPBP object. * @mc_io: Pointer to MC portal's I/O object * @dprc_token: Parent container token; '0' for default container * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @cfg: Configuration structure * @obj_id: Returned object id; use in subsequent API calls * * Create the DPBP object, allocate required resources and * perform required initialization. * * This function accepts an authentication token of a parent * container that this object should be assigned to and returns * an object id. This object_id will be used in all subsequent calls to * this specific object. * * Return: '0' on Success; Error code otherwise. */ int dpbp_create(struct fsl_mc_io *mc_io, uint16_t dprc_token, uint32_t cmd_flags, const struct dpbp_cfg *cfg, uint32_t *obj_id) { struct mc_command cmd = { 0 }; int err; (void)(cfg); /* unused */ /* prepare command */ cmd.header = mc_encode_cmd_header(DPBP_CMDID_CREATE, cmd_flags, dprc_token); /* send command to mc*/ err = mc_send_command(mc_io, &cmd); if (err) return err; /* retrieve response parameters */ *obj_id = mc_cmd_read_object_id(&cmd); return 0; }
/** * dpseci_create() - Create the DPSECI object * @mc_io: Pointer to MC portal's I/O object * @dprc_token: Parent container token; '0' for default container * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @cfg: Configuration structure * @obj_id: Returned object id * * Create the DPSECI object, allocate required resources and * perform required initialization. * * The object can be created either by declaring it in the * DPL file, or by calling this function. * * The function accepts an authentication token of a parent * container that this object should be assigned to. The token * can be '0' so the object will be assigned to the default container. * The newly created object can be opened with the returned * object id and using the container's associated tokens and MC portals. * * Return: '0' on Success; Error code otherwise. */ int dpseci_create(struct fsl_mc_io *mc_io, uint16_t dprc_token, uint32_t cmd_flags, const struct dpseci_cfg *cfg, uint32_t *obj_id) { struct dpseci_cmd_create *cmd_params; struct mc_command cmd = { 0 }; int err, i; /* prepare command */ cmd.header = mc_encode_cmd_header(DPSECI_CMDID_CREATE, cmd_flags, dprc_token); cmd_params = (struct dpseci_cmd_create *)cmd.params; for (i = 0; i < DPSECI_PRIO_NUM; i++) cmd_params->priorities[i] = cfg->priorities[i]; cmd_params->num_tx_queues = cfg->num_tx_queues; cmd_params->num_rx_queues = cfg->num_rx_queues; cmd_params->options = cfg->options; /* send command to mc*/ err = mc_send_command(mc_io, &cmd); if (err) return err; /* retrieve response parameters */ *obj_id = mc_cmd_read_object_id(&cmd); return 0; }
/** * dprc_get_container_id - Get container ID associated with a given portal. * @mc_io: Pointer to Mc portal's I/O object * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @container_id: Requested container id * * Return: '0' on Success; Error code otherwise. */ int dprc_get_container_id(struct fsl_mc_io *mc_io, u32 cmd_flags, int *container_id) { struct fsl_mc_command cmd = { 0 }; int err; /* prepare command */ cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_CONT_ID, cmd_flags, 0); /* send command to mc*/ err = mc_send_command(mc_io, &cmd); if (err) return err; /* retrieve response parameters */ *container_id = (int)mc_cmd_read_object_id(&cmd); return 0; }