* 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
| 103 | * Return: '0' on Success; Error code otherwise. |
| 104 | */ |
| 105 | int dpseci_create(struct fsl_mc_io *mc_io, |
| 106 | uint16_t dprc_token, |
| 107 | uint32_t cmd_flags, |
| 108 | const struct dpseci_cfg *cfg, |
| 109 | uint32_t *obj_id) |
| 110 | { |
| 111 | struct dpseci_cmd_create *cmd_params; |
| 112 | struct mc_command cmd = { 0 }; |
| 113 | int err, i; |
| 114 | |
| 115 | /* prepare command */ |
| 116 | cmd.header = mc_encode_cmd_header(DPSECI_CMDID_CREATE, |
| 117 | cmd_flags, |
| 118 | dprc_token); |
| 119 | cmd_params = (struct dpseci_cmd_create *)cmd.params; |
| 120 | for (i = 0; i < 8; i++) |
| 121 | cmd_params->priorities[i] = cfg->priorities[i]; |
| 122 | for (i = 0; i < 8; i++) |
| 123 | cmd_params->priorities2[i] = cfg->priorities[8 + i]; |
| 124 | cmd_params->num_tx_queues = cfg->num_tx_queues; |
| 125 | cmd_params->num_rx_queues = cfg->num_rx_queues; |
| 126 | cmd_params->options = cpu_to_le32(cfg->options); |
| 127 | |
| 128 | /* send command to mc*/ |
| 129 | err = mc_send_command(mc_io, &cmd); |
| 130 | if (err) |
| 131 | return err; |
| 132 | |
| 133 | /* retrieve response parameters */ |
| 134 | *obj_id = mc_cmd_read_object_id(&cmd); |
| 135 | |
| 136 | return 0; |
| 137 | } |
| 138 | |
| 139 | /** |
| 140 | * dpseci_destroy() - Destroy the DPSECI object and release all its resources. |
nothing calls this directly
no test coverage detected