The DPCON_CMDID_SET_NOTIFICATION command id and its wire struct were already present in the flib, but the dpcon_set_notification() function and the public dpcon_notification_cfg were never implemented. Add them so a DPCON channel can be pointed at a DPIO for CDAN delivery, which the net/dpaa2 Rx-queue-interrupt path needs.
Signed-off-by: Maxime Leroy <[email protected]> --- drivers/bus/fslmc/mc/dpcon.c | 31 +++++++++++++++++++++++++++++++ drivers/bus/fslmc/mc/fsl_dpcon.h | 18 ++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/drivers/bus/fslmc/mc/dpcon.c b/drivers/bus/fslmc/mc/dpcon.c index cd909fcac4..3ab2a12637 100644 --- a/drivers/bus/fslmc/mc/dpcon.c +++ b/drivers/bus/fslmc/mc/dpcon.c @@ -338,3 +338,34 @@ int dpcon_get_api_version(struct fsl_mc_io *mc_io, return 0; } + +/** + * dpcon_set_notification() - Set the DPCON notification destination + * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @token: Token of DPCON object + * @cfg: Notification parameters (DPIO, priority, user context) + * + * Return: '0' on Success; Error code otherwise + */ +RTE_EXPORT_INTERNAL_SYMBOL(dpcon_set_notification) +int dpcon_set_notification(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + const struct dpcon_notification_cfg *cfg) +{ + struct dpcon_cmd_set_notification *dpcon_cmd; + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPCON_CMDID_SET_NOTIFICATION, + cmd_flags, + token); + dpcon_cmd = (struct dpcon_cmd_set_notification *)cmd.params; + dpcon_cmd->dpio_id = cpu_to_le32(cfg->dpio_id); + dpcon_cmd->priority = cfg->priority; + dpcon_cmd->user_ctx = cpu_to_le64(cfg->user_ctx); + + /* send command to mc*/ + return mc_send_command(mc_io, &cmd); +} diff --git a/drivers/bus/fslmc/mc/fsl_dpcon.h b/drivers/bus/fslmc/mc/fsl_dpcon.h index f2668da1b1..3bef97f6f5 100644 --- a/drivers/bus/fslmc/mc/fsl_dpcon.h +++ b/drivers/bus/fslmc/mc/fsl_dpcon.h @@ -95,4 +95,22 @@ int dpcon_get_api_version(struct fsl_mc_io *mc_io, uint16_t *major_ver, uint16_t *minor_ver); +/** + * struct dpcon_notification_cfg - Notification parameters + * @dpio_id: DPIO object id that receives the channel's CDAN + * @priority: Priority within the DPIO channel (0-7) + * @user_ctx: User context provided with each CDAN message + */ +struct dpcon_notification_cfg { + int dpio_id; + uint8_t priority; + uint64_t user_ctx; +}; + +__rte_internal +int dpcon_set_notification(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + const struct dpcon_notification_cfg *cfg); + #endif /* __FSL_DPCON_H */ -- 2.43.0

