bus/fslmc: update MC to 10.3.x
Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
This commit is contained in:
parent
828d51d8fc
commit
16bbc98a3e
@ -58,6 +58,7 @@
|
||||
|
||||
#include "rte_fslmc.h"
|
||||
#include "fslmc_vfio.h"
|
||||
#include <mc/fsl_dpmng.h>
|
||||
|
||||
#include "portal/dpaa2_hw_pvt.h"
|
||||
#include "portal/dpaa2_hw_dpio.h"
|
||||
@ -417,6 +418,8 @@ fslmc_process_mcp(struct rte_dpaa2_device *dev)
|
||||
{
|
||||
int64_t v_addr;
|
||||
char *dev_name;
|
||||
struct fsl_mc_io dpmng = {0};
|
||||
struct mc_version mc_ver_info = {0};
|
||||
|
||||
rte_mcp_ptr_list = malloc(sizeof(void *) * 1);
|
||||
if (!rte_mcp_ptr_list) {
|
||||
@ -441,6 +444,22 @@ fslmc_process_mcp(struct rte_dpaa2_device *dev)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* check the MC version compatibility */
|
||||
dpmng.regs = (void *)v_addr;
|
||||
if (mc_get_version(&dpmng, CMD_PRI_LOW, &mc_ver_info))
|
||||
RTE_LOG(WARNING, PMD, "\tmc_get_version failed\n");
|
||||
|
||||
if ((mc_ver_info.major != MC_VER_MAJOR) ||
|
||||
(mc_ver_info.minor < MC_VER_MINOR)) {
|
||||
RTE_LOG(ERR, PMD, "DPAA2 MC version not compatible!"
|
||||
" Expected %d.%d.x, Detected %d.%d.%d\n",
|
||||
MC_VER_MAJOR, MC_VER_MINOR,
|
||||
mc_ver_info.major, mc_ver_info.minor,
|
||||
mc_ver_info.revision);
|
||||
free(rte_mcp_ptr_list);
|
||||
rte_mcp_ptr_list = NULL;
|
||||
return -1;
|
||||
}
|
||||
rte_mcp_ptr_list[0] = (void *)v_addr;
|
||||
|
||||
return 0;
|
||||
|
@ -5,7 +5,7 @@
|
||||
* BSD LICENSE
|
||||
*
|
||||
* Copyright 2013-2016 Freescale Semiconductor Inc.
|
||||
* Copyright 2016 NXP.
|
||||
* Copyright 2016-2017 NXP.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@ -42,19 +42,37 @@
|
||||
#include <fsl_dpbp.h>
|
||||
#include <fsl_dpbp_cmd.h>
|
||||
|
||||
/**
|
||||
* dpbp_open() - Open a control session for the specified object.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @dpbp_id: DPBP unique ID
|
||||
* @token: Returned token; use in subsequent API calls
|
||||
*
|
||||
* This function can be used to open a control session for an
|
||||
* already created object; an object may have been declared in
|
||||
* the DPL or by calling the dpbp_create function.
|
||||
* This function returns a unique authentication token,
|
||||
* associated with the specific object ID and the specific MC
|
||||
* portal; this token must be used in all subsequent commands for
|
||||
* this specific object
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpbp_open(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
int dpbp_id,
|
||||
uint16_t *token)
|
||||
{
|
||||
struct dpbp_cmd_open *cmd_params;
|
||||
struct mc_command cmd = { 0 };
|
||||
int err;
|
||||
|
||||
/* prepare command */
|
||||
cmd.header = mc_encode_cmd_header(DPBP_CMDID_OPEN,
|
||||
cmd_flags,
|
||||
0);
|
||||
DPBP_CMD_OPEN(cmd, dpbp_id);
|
||||
cmd_flags, 0);
|
||||
cmd_params = (struct dpbp_cmd_open *)cmd.params;
|
||||
cmd_params->dpbp_id = cpu_to_le32(dpbp_id);
|
||||
|
||||
/* send command to mc*/
|
||||
err = mc_send_command(mc_io, &cmd);
|
||||
@ -62,11 +80,22 @@ int dpbp_open(struct fsl_mc_io *mc_io,
|
||||
return err;
|
||||
|
||||
/* retrieve response parameters */
|
||||
*token = MC_CMD_HDR_READ_TOKEN(cmd.header);
|
||||
*token = mc_cmd_hdr_read_token(&cmd);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
/**
|
||||
* dpbp_close() - Close the control session of the object
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPBP object
|
||||
*
|
||||
* After this function is called, no further operations are
|
||||
* allowed on the object without opening a new control session.
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpbp_close(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token)
|
||||
@ -81,6 +110,24 @@ int dpbp_close(struct fsl_mc_io *mc_io,
|
||||
return mc_send_command(mc_io, &cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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,
|
||||
@ -94,8 +141,7 @@ int dpbp_create(struct fsl_mc_io *mc_io,
|
||||
|
||||
/* prepare command */
|
||||
cmd.header = mc_encode_cmd_header(DPBP_CMDID_CREATE,
|
||||
cmd_flags,
|
||||
dprc_token);
|
||||
cmd_flags, dprc_token);
|
||||
|
||||
/* send command to mc*/
|
||||
err = mc_send_command(mc_io, &cmd);
|
||||
@ -103,28 +149,47 @@ int dpbp_create(struct fsl_mc_io *mc_io,
|
||||
return err;
|
||||
|
||||
/* retrieve response parameters */
|
||||
CMD_CREATE_RSP_GET_OBJ_ID_PARAM0(cmd, *obj_id);
|
||||
*obj_id = mc_cmd_read_object_id(&cmd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* dpbp_destroy() - Destroy the DPBP object and release all its resources.
|
||||
* @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_'
|
||||
* @obj_id: ID of DPBP object
|
||||
*
|
||||
* Return: '0' on Success; error code otherwise.
|
||||
*/
|
||||
int dpbp_destroy(struct fsl_mc_io *mc_io,
|
||||
uint16_t dprc_token,
|
||||
uint32_t cmd_flags,
|
||||
uint32_t object_id)
|
||||
uint32_t cmd_flags,
|
||||
uint32_t obj_id)
|
||||
{
|
||||
struct dpbp_cmd_destroy *cmd_params;
|
||||
struct mc_command cmd = { 0 };
|
||||
|
||||
/* prepare command */
|
||||
cmd.header = mc_encode_cmd_header(DPBP_CMDID_DESTROY,
|
||||
cmd_flags,
|
||||
dprc_token);
|
||||
/* set object id to destroy */
|
||||
CMD_DESTROY_SET_OBJ_ID_PARAM0(cmd, object_id);
|
||||
cmd_flags, dprc_token);
|
||||
|
||||
cmd_params = (struct dpbp_cmd_destroy *)cmd.params;
|
||||
cmd_params->object_id = cpu_to_le32(obj_id);
|
||||
|
||||
/* send command to mc*/
|
||||
return mc_send_command(mc_io, &cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* dpbp_enable() - Enable the DPBP.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPBP object
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpbp_enable(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token)
|
||||
@ -139,6 +204,14 @@ int dpbp_enable(struct fsl_mc_io *mc_io,
|
||||
return mc_send_command(mc_io, &cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* dpbp_disable() - Disable the DPBP.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPBP object
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpbp_disable(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token)
|
||||
@ -147,20 +220,30 @@ int dpbp_disable(struct fsl_mc_io *mc_io,
|
||||
|
||||
/* prepare command */
|
||||
cmd.header = mc_encode_cmd_header(DPBP_CMDID_DISABLE,
|
||||
cmd_flags,
|
||||
token);
|
||||
cmd_flags, token);
|
||||
|
||||
/* send command to mc*/
|
||||
return mc_send_command(mc_io, &cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* dpbp_is_enabled() - Check if the DPBP is enabled.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPBP object
|
||||
* @en: Returns '1' if object is enabled; '0' otherwise
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpbp_is_enabled(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
int *en)
|
||||
{
|
||||
struct dpbp_rsp_is_enabled *rsp_params;
|
||||
struct mc_command cmd = { 0 };
|
||||
int err;
|
||||
|
||||
/* prepare command */
|
||||
cmd.header = mc_encode_cmd_header(DPBP_CMDID_IS_ENABLED, cmd_flags,
|
||||
token);
|
||||
@ -171,11 +254,20 @@ int dpbp_is_enabled(struct fsl_mc_io *mc_io,
|
||||
return err;
|
||||
|
||||
/* retrieve response parameters */
|
||||
DPBP_RSP_IS_ENABLED(cmd, *en);
|
||||
rsp_params = (struct dpbp_rsp_is_enabled *)cmd.params;
|
||||
*en = rsp_params->enabled & DPBP_ENABLE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* dpbp_reset() - Reset the DPBP, returns the object to initial state.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPBP object
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpbp_reset(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token)
|
||||
@ -184,8 +276,7 @@ int dpbp_reset(struct fsl_mc_io *mc_io,
|
||||
|
||||
/* prepare command */
|
||||
cmd.header = mc_encode_cmd_header(DPBP_CMDID_RESET,
|
||||
cmd_flags,
|
||||
token);
|
||||
cmd_flags, token);
|
||||
|
||||
/* send command to mc*/
|
||||
return mc_send_command(mc_io, &cmd);
|
||||
@ -195,13 +286,13 @@ int dpbp_get_attributes(struct fsl_mc_io *mc_io,
|
||||
uint16_t token,
|
||||
struct dpbp_attr *attr)
|
||||
{
|
||||
struct dpbp_rsp_get_attributes *rsp_params;
|
||||
struct mc_command cmd = { 0 };
|
||||
int err;
|
||||
|
||||
/* prepare command */
|
||||
cmd.header = mc_encode_cmd_header(DPBP_CMDID_GET_ATTR,
|
||||
cmd_flags,
|
||||
token);
|
||||
cmd_flags, token);
|
||||
|
||||
/* send command to mc*/
|
||||
err = mc_send_command(mc_io, &cmd);
|
||||
@ -209,38 +300,64 @@ int dpbp_get_attributes(struct fsl_mc_io *mc_io,
|
||||
return err;
|
||||
|
||||
/* retrieve response parameters */
|
||||
DPBP_RSP_GET_ATTRIBUTES(cmd, attr);
|
||||
rsp_params = (struct dpbp_rsp_get_attributes *)cmd.params;
|
||||
attr->bpid = le16_to_cpu(rsp_params->bpid);
|
||||
attr->id = le32_to_cpu(rsp_params->id);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* dpbp_get_api_version - Get Data Path Buffer Pool API version
|
||||
* @mc_io: Pointer to Mc portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @major_ver: Major version of Buffer Pool API
|
||||
* @minor_ver: Minor version of Buffer Pool API
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpbp_get_api_version(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t *major_ver,
|
||||
uint16_t *minor_ver)
|
||||
uint16_t *major_ver,
|
||||
uint16_t *minor_ver)
|
||||
{
|
||||
struct dpbp_rsp_get_api_version *rsp_params;
|
||||
struct mc_command cmd = { 0 };
|
||||
int err;
|
||||
|
||||
/* prepare command */
|
||||
cmd.header = mc_encode_cmd_header(DPBP_CMDID_GET_API_VERSION,
|
||||
cmd_flags,
|
||||
0);
|
||||
cmd_flags, 0);
|
||||
|
||||
/* send command to mc */
|
||||
err = mc_send_command(mc_io, &cmd);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
DPBP_RSP_GET_API_VERSION(cmd, *major_ver, *minor_ver);
|
||||
/* retrieve response parameters */
|
||||
rsp_params = (struct dpbp_rsp_get_api_version *)cmd.params;
|
||||
*major_ver = le16_to_cpu(rsp_params->major);
|
||||
*minor_ver = le16_to_cpu(rsp_params->minor);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int dpbp_get_num_free_bufs(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
/**
|
||||
* dpbp_get_num_free_bufs() - Get number of free buffers in the buffer pool
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPBP object
|
||||
* @num_free_bufs: Number of free buffers
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
|
||||
int dpbp_get_num_free_bufs(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
uint32_t *num_free_bufs)
|
||||
{
|
||||
struct dpbp_rsp_get_num_free_bufs *rsp_params;
|
||||
struct mc_command cmd = { 0 };
|
||||
int err;
|
||||
|
||||
@ -255,7 +372,8 @@ int dpbp_get_num_free_bufs(struct fsl_mc_io *mc_io,
|
||||
return err;
|
||||
|
||||
/* retrieve response parameters */
|
||||
DPBP_RSP_GET_NUM_FREE_BUFS(cmd, *num_free_bufs);
|
||||
rsp_params = (struct dpbp_rsp_get_num_free_bufs *)cmd.params;
|
||||
*num_free_bufs = le32_to_cpu(rsp_params->num_free_bufs);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -41,11 +41,29 @@
|
||||
#include <fsl_dpci.h>
|
||||
#include <fsl_dpci_cmd.h>
|
||||
|
||||
/**
|
||||
* dpci_open() - Open a control session for the specified object
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @dpci_id: DPCI unique ID
|
||||
* @token: Returned token; use in subsequent API calls
|
||||
*
|
||||
* This function can be used to open a control session for an
|
||||
* already created object; an object may have been declared in
|
||||
* the DPL or by calling the dpci_create() function.
|
||||
* This function returns a unique authentication token,
|
||||
* associated with the specific object ID and the specific MC
|
||||
* portal; this token must be used in all subsequent commands for
|
||||
* this specific object.
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpci_open(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
int dpci_id,
|
||||
uint16_t *token)
|
||||
{
|
||||
struct dpci_cmd_open *cmd_params;
|
||||
struct mc_command cmd = { 0 };
|
||||
int err;
|
||||
|
||||
@ -53,7 +71,8 @@ int dpci_open(struct fsl_mc_io *mc_io,
|
||||
cmd.header = mc_encode_cmd_header(DPCI_CMDID_OPEN,
|
||||
cmd_flags,
|
||||
0);
|
||||
DPCI_CMD_OPEN(cmd, dpci_id);
|
||||
cmd_params = (struct dpci_cmd_open *)cmd.params;
|
||||
cmd_params->dpci_id = cpu_to_le32(dpci_id);
|
||||
|
||||
/* send command to mc*/
|
||||
err = mc_send_command(mc_io, &cmd);
|
||||
@ -61,11 +80,22 @@ int dpci_open(struct fsl_mc_io *mc_io,
|
||||
return err;
|
||||
|
||||
/* retrieve response parameters */
|
||||
*token = MC_CMD_HDR_READ_TOKEN(cmd.header);
|
||||
*token = mc_cmd_hdr_read_token(&cmd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* dpci_close() - Close the control session of the object
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPCI object
|
||||
*
|
||||
* After this function is called, no further operations are
|
||||
* allowed on the object without opening a new control session.
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpci_close(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token)
|
||||
@ -81,12 +111,35 @@ int dpci_close(struct fsl_mc_io *mc_io,
|
||||
return mc_send_command(mc_io, &cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
@ -94,7 +147,8 @@ int dpci_create(struct fsl_mc_io *mc_io,
|
||||
cmd.header = mc_encode_cmd_header(DPCI_CMDID_CREATE,
|
||||
cmd_flags,
|
||||
dprc_token);
|
||||
DPCI_CMD_CREATE(cmd, cfg);
|
||||
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);
|
||||
@ -102,28 +156,53 @@ int dpci_create(struct fsl_mc_io *mc_io,
|
||||
return err;
|
||||
|
||||
/* retrieve response parameters */
|
||||
CMD_CREATE_RSP_GET_OBJ_ID_PARAM0(cmd, *obj_id);
|
||||
*obj_id = mc_cmd_read_object_id(&cmd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* dpci_destroy() - Destroy the DPCI object and release all its resources.
|
||||
* @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_'
|
||||
* @object_id: The object id; it must be a valid id within the container that
|
||||
* created this object;
|
||||
*
|
||||
* The function accepts the authentication token of the parent container that
|
||||
* created the object (not the one that currently owns the object). The object
|
||||
* is searched within parent using the provided 'object_id'.
|
||||
* All tokens to the object must be closed before calling destroy.
|
||||
*
|
||||
* Return: '0' on Success; error code otherwise.
|
||||
*/
|
||||
int dpci_destroy(struct fsl_mc_io *mc_io,
|
||||
uint16_t dprc_token,
|
||||
uint32_t cmd_flags,
|
||||
uint32_t object_id)
|
||||
uint32_t cmd_flags,
|
||||
uint32_t object_id)
|
||||
{
|
||||
struct dpci_cmd_destroy *cmd_params;
|
||||
struct mc_command cmd = { 0 };
|
||||
|
||||
/* prepare command */
|
||||
cmd.header = mc_encode_cmd_header(DPCI_CMDID_DESTROY,
|
||||
cmd_flags,
|
||||
dprc_token);
|
||||
/* set object id to destroy */
|
||||
CMD_DESTROY_SET_OBJ_ID_PARAM0(cmd, object_id);
|
||||
cmd_params = (struct dpci_cmd_destroy *)cmd.params;
|
||||
cmd_params->dpci_id = cpu_to_le32(object_id);
|
||||
|
||||
/* send command to mc*/
|
||||
return mc_send_command(mc_io, &cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* dpci_enable() - Enable the DPCI, allow sending and receiving frames.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPCI object
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpci_enable(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token)
|
||||
@ -139,6 +218,14 @@ int dpci_enable(struct fsl_mc_io *mc_io,
|
||||
return mc_send_command(mc_io, &cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* dpci_disable() - Disable the DPCI, stop sending and receiving frames.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPCI object
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpci_disable(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token)
|
||||
@ -154,13 +241,24 @@ int dpci_disable(struct fsl_mc_io *mc_io,
|
||||
return mc_send_command(mc_io, &cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* dpci_is_enabled() - Check if the DPCI is enabled.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPCI object
|
||||
* @en: Returns '1' if object is enabled; '0' otherwise
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpci_is_enabled(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
int *en)
|
||||
{
|
||||
struct dpci_rsp_is_enabled *rsp_params;
|
||||
struct mc_command cmd = { 0 };
|
||||
int err;
|
||||
|
||||
/* prepare command */
|
||||
cmd.header = mc_encode_cmd_header(DPCI_CMDID_IS_ENABLED, cmd_flags,
|
||||
token);
|
||||
@ -171,11 +269,20 @@ int dpci_is_enabled(struct fsl_mc_io *mc_io,
|
||||
return err;
|
||||
|
||||
/* retrieve response parameters */
|
||||
DPCI_RSP_IS_ENABLED(cmd, *en);
|
||||
rsp_params = (struct dpci_rsp_is_enabled *)cmd.params;
|
||||
*en = dpci_get_field(rsp_params->en, ENABLE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* dpci_reset() - Reset the DPCI, returns the object to initial state.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPCI object
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpci_reset(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token)
|
||||
@ -196,6 +303,7 @@ int dpci_get_attributes(struct fsl_mc_io *mc_io,
|
||||
uint16_t token,
|
||||
struct dpci_attr *attr)
|
||||
{
|
||||
struct dpci_rsp_get_attr *rsp_params;
|
||||
struct mc_command cmd = { 0 };
|
||||
int err;
|
||||
|
||||
@ -210,7 +318,9 @@ int dpci_get_attributes(struct fsl_mc_io *mc_io,
|
||||
return err;
|
||||
|
||||
/* retrieve response parameters */
|
||||
DPCI_RSP_GET_ATTRIBUTES(cmd, attr);
|
||||
rsp_params = (struct dpci_rsp_get_attr *)cmd.params;
|
||||
attr->id = le32_to_cpu(rsp_params->id);
|
||||
attr->num_of_priorities = rsp_params->num_of_priorities;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -221,24 +331,46 @@ int dpci_set_rx_queue(struct fsl_mc_io *mc_io,
|
||||
uint8_t priority,
|
||||
const struct dpci_rx_queue_cfg *cfg)
|
||||
{
|
||||
struct dpci_cmd_set_rx_queue *cmd_params;
|
||||
struct mc_command cmd = { 0 };
|
||||
|
||||
/* prepare command */
|
||||
cmd.header = mc_encode_cmd_header(DPCI_CMDID_SET_RX_QUEUE,
|
||||
cmd_flags,
|
||||
token);
|
||||
DPCI_CMD_SET_RX_QUEUE(cmd, priority, cfg);
|
||||
cmd_params = (struct dpci_cmd_set_rx_queue *)cmd.params;
|
||||
cmd_params->dest_id = cpu_to_le32(cfg->dest_cfg.dest_id);
|
||||
cmd_params->dest_priority = cfg->dest_cfg.priority;
|
||||
cmd_params->priority = priority;
|
||||
cmd_params->user_ctx = cpu_to_le64(cfg->user_ctx);
|
||||
cmd_params->options = cpu_to_le32(cfg->options);
|
||||
dpci_set_field(cmd_params->dest_type,
|
||||
DEST_TYPE,
|
||||
cfg->dest_cfg.dest_type);
|
||||
|
||||
/* send command to mc*/
|
||||
return mc_send_command(mc_io, &cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* dpci_get_rx_queue() - Retrieve Rx queue attributes.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPCI object
|
||||
* @priority: Select the queue relative to number of
|
||||
* priorities configured at DPCI creation
|
||||
* @attr: Returned Rx queue attributes
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpci_get_rx_queue(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
uint8_t priority,
|
||||
struct dpci_rx_queue_attr *attr)
|
||||
{
|
||||
struct dpci_cmd_get_queue *cmd_params;
|
||||
struct dpci_rsp_get_rx_queue *rsp_params;
|
||||
struct mc_command cmd = { 0 };
|
||||
int err;
|
||||
|
||||
@ -246,7 +378,8 @@ int dpci_get_rx_queue(struct fsl_mc_io *mc_io,
|
||||
cmd.header = mc_encode_cmd_header(DPCI_CMDID_GET_RX_QUEUE,
|
||||
cmd_flags,
|
||||
token);
|
||||
DPCI_CMD_GET_RX_QUEUE(cmd, priority);
|
||||
cmd_params = (struct dpci_cmd_get_queue *)cmd.params;
|
||||
cmd_params->priority = priority;
|
||||
|
||||
/* send command to mc*/
|
||||
err = mc_send_command(mc_io, &cmd);
|
||||
@ -254,17 +387,36 @@ int dpci_get_rx_queue(struct fsl_mc_io *mc_io,
|
||||
return err;
|
||||
|
||||
/* retrieve response parameters */
|
||||
DPCI_RSP_GET_RX_QUEUE(cmd, attr);
|
||||
rsp_params = (struct dpci_rsp_get_rx_queue *)cmd.params;
|
||||
attr->user_ctx = le64_to_cpu(rsp_params->user_ctx);
|
||||
attr->fqid = le32_to_cpu(rsp_params->fqid);
|
||||
attr->dest_cfg.dest_id = le32_to_cpu(rsp_params->dest_id);
|
||||
attr->dest_cfg.priority = rsp_params->dest_priority;
|
||||
attr->dest_cfg.dest_type = dpci_get_field(rsp_params->dest_type,
|
||||
DEST_TYPE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* dpci_get_tx_queue() - Retrieve Tx queue attributes.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPCI object
|
||||
* @priority: Select the queue relative to number of
|
||||
* priorities of the peer DPCI object
|
||||
* @attr: Returned Tx queue attributes
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpci_get_tx_queue(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
uint8_t priority,
|
||||
struct dpci_tx_queue_attr *attr)
|
||||
{
|
||||
struct dpci_cmd_get_queue *cmd_params;
|
||||
struct dpci_rsp_get_tx_queue *rsp_params;
|
||||
struct mc_command cmd = { 0 };
|
||||
int err;
|
||||
|
||||
@ -272,7 +424,8 @@ int dpci_get_tx_queue(struct fsl_mc_io *mc_io,
|
||||
cmd.header = mc_encode_cmd_header(DPCI_CMDID_GET_TX_QUEUE,
|
||||
cmd_flags,
|
||||
token);
|
||||
DPCI_CMD_GET_TX_QUEUE(cmd, priority);
|
||||
cmd_params = (struct dpci_cmd_get_queue *)cmd.params;
|
||||
cmd_params->priority = priority;
|
||||
|
||||
/* send command to mc*/
|
||||
err = mc_send_command(mc_io, &cmd);
|
||||
@ -280,16 +433,27 @@ int dpci_get_tx_queue(struct fsl_mc_io *mc_io,
|
||||
return err;
|
||||
|
||||
/* retrieve response parameters */
|
||||
DPCI_RSP_GET_TX_QUEUE(cmd, attr);
|
||||
rsp_params = (struct dpci_rsp_get_tx_queue *)cmd.params;
|
||||
attr->fqid = le32_to_cpu(rsp_params->fqid);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* dpci_get_api_version() - Get communication interface API version
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @major_ver: Major version of data path communication interface API
|
||||
* @minor_ver: Minor version of data path communication interface API
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpci_get_api_version(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t *major_ver,
|
||||
uint16_t *minor_ver)
|
||||
uint16_t *major_ver,
|
||||
uint16_t *minor_ver)
|
||||
{
|
||||
struct dpci_rsp_get_api_version *rsp_params;
|
||||
struct mc_command cmd = { 0 };
|
||||
int err;
|
||||
|
||||
@ -301,7 +465,9 @@ int dpci_get_api_version(struct fsl_mc_io *mc_io,
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
DPCI_RSP_GET_API_VERSION(cmd, *major_ver, *minor_ver);
|
||||
rsp_params = (struct dpci_rsp_get_api_version *)cmd.params;
|
||||
*major_ver = le16_to_cpu(rsp_params->major);
|
||||
*minor_ver = le16_to_cpu(rsp_params->minor);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -34,19 +34,38 @@
|
||||
#include <fsl_dpcon.h>
|
||||
#include <fsl_dpcon_cmd.h>
|
||||
|
||||
/**
|
||||
* dpcon_open() - Open a control session for the specified object
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @dpcon_id: DPCON unique ID
|
||||
* @token: Returned token; use in subsequent API calls
|
||||
*
|
||||
* This function can be used to open a control session for an
|
||||
* already created object; an object may have been declared in
|
||||
* the DPL or by calling the dpcon_create() function.
|
||||
* This function returns a unique authentication token,
|
||||
* associated with the specific object ID and the specific MC
|
||||
* portal; this token must be used in all subsequent commands for
|
||||
* this specific object.
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpcon_open(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
int dpcon_id,
|
||||
uint16_t *token)
|
||||
{
|
||||
struct mc_command cmd = { 0 };
|
||||
struct dpcon_cmd_open *dpcon_cmd;
|
||||
int err;
|
||||
|
||||
/* prepare command */
|
||||
cmd.header = mc_encode_cmd_header(DPCON_CMDID_OPEN,
|
||||
cmd_flags,
|
||||
0);
|
||||
DPCON_CMD_OPEN(cmd, dpcon_id);
|
||||
dpcon_cmd = (struct dpcon_cmd_open *)cmd.params;
|
||||
dpcon_cmd->dpcon_id = cpu_to_le32(dpcon_id);
|
||||
|
||||
/* send command to mc*/
|
||||
err = mc_send_command(mc_io, &cmd);
|
||||
@ -54,11 +73,22 @@ int dpcon_open(struct fsl_mc_io *mc_io,
|
||||
return err;
|
||||
|
||||
/* retrieve response parameters */
|
||||
*token = MC_CMD_HDR_READ_TOKEN(cmd.header);
|
||||
*token = mc_cmd_hdr_read_token(&cmd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* dpcon_close() - Close the control session of the object
|
||||
* @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
|
||||
*
|
||||
* After this function is called, no further operations are
|
||||
* allowed on the object without opening a new control session.
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpcon_close(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token)
|
||||
@ -74,12 +104,34 @@ int dpcon_close(struct fsl_mc_io *mc_io,
|
||||
return mc_send_command(mc_io, &cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* dpcon_create() - Create the DPCON 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 DPCON 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.
|
||||
*
|
||||
* 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 dpcon_create(struct fsl_mc_io *mc_io,
|
||||
uint16_t dprc_token,
|
||||
uint32_t cmd_flags,
|
||||
const struct dpcon_cfg *cfg,
|
||||
uint32_t *obj_id)
|
||||
uint32_t cmd_flags,
|
||||
const struct dpcon_cfg *cfg,
|
||||
uint32_t *obj_id)
|
||||
{
|
||||
struct dpcon_cmd_create *dpcon_cmd;
|
||||
struct mc_command cmd = { 0 };
|
||||
int err;
|
||||
|
||||
@ -87,7 +139,8 @@ int dpcon_create(struct fsl_mc_io *mc_io,
|
||||
cmd.header = mc_encode_cmd_header(DPCON_CMDID_CREATE,
|
||||
cmd_flags,
|
||||
dprc_token);
|
||||
DPCON_CMD_CREATE(cmd, cfg);
|
||||
dpcon_cmd = (struct dpcon_cmd_create *)cmd.params;
|
||||
dpcon_cmd->num_priorities = cfg->num_priorities;
|
||||
|
||||
/* send command to mc*/
|
||||
err = mc_send_command(mc_io, &cmd);
|
||||
@ -95,28 +148,47 @@ int dpcon_create(struct fsl_mc_io *mc_io,
|
||||
return err;
|
||||
|
||||
/* retrieve response parameters */
|
||||
CMD_CREATE_RSP_GET_OBJ_ID_PARAM0(cmd, *obj_id);
|
||||
*obj_id = mc_cmd_read_object_id(&cmd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* dpcon_destroy() - Destroy the DPCON object and release all its resources.
|
||||
* @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_'
|
||||
* @obj_id: ID of DPCON object
|
||||
*
|
||||
* Return: '0' on Success; error code otherwise.
|
||||
*/
|
||||
int dpcon_destroy(struct fsl_mc_io *mc_io,
|
||||
uint16_t dprc_token,
|
||||
uint32_t cmd_flags,
|
||||
uint32_t object_id)
|
||||
uint32_t cmd_flags,
|
||||
uint32_t obj_id)
|
||||
{
|
||||
struct dpcon_cmd_destroy *cmd_params;
|
||||
struct mc_command cmd = { 0 };
|
||||
|
||||
/* prepare command */
|
||||
cmd.header = mc_encode_cmd_header(DPCON_CMDID_DESTROY,
|
||||
cmd_flags,
|
||||
dprc_token);
|
||||
/* set object id to destroy */
|
||||
CMD_DESTROY_SET_OBJ_ID_PARAM0(cmd, object_id);
|
||||
cmd_params = (struct dpcon_cmd_destroy *)cmd.params;
|
||||
cmd_params->object_id = cpu_to_le32(obj_id);
|
||||
|
||||
/* send command to mc*/
|
||||
return mc_send_command(mc_io, &cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* dpcon_enable() - Enable the DPCON
|
||||
* @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
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise
|
||||
*/
|
||||
int dpcon_enable(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token)
|
||||
@ -132,6 +204,14 @@ int dpcon_enable(struct fsl_mc_io *mc_io,
|
||||
return mc_send_command(mc_io, &cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* dpcon_disable() - Disable the DPCON
|
||||
* @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
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise
|
||||
*/
|
||||
int dpcon_disable(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token)
|
||||
@ -147,13 +227,24 @@ int dpcon_disable(struct fsl_mc_io *mc_io,
|
||||
return mc_send_command(mc_io, &cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* dpcon_is_enabled() - Check if the DPCON is enabled.
|
||||
* @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
|
||||
* @en: Returns '1' if object is enabled; '0' otherwise
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpcon_is_enabled(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
int *en)
|
||||
{
|
||||
struct dpcon_rsp_is_enabled *dpcon_rsp;
|
||||
struct mc_command cmd = { 0 };
|
||||
int err;
|
||||
|
||||
/* prepare command */
|
||||
cmd.header = mc_encode_cmd_header(DPCON_CMDID_IS_ENABLED,
|
||||
cmd_flags,
|
||||
@ -165,11 +256,20 @@ int dpcon_is_enabled(struct fsl_mc_io *mc_io,
|
||||
return err;
|
||||
|
||||
/* retrieve response parameters */
|
||||
DPCON_RSP_IS_ENABLED(cmd, *en);
|
||||
dpcon_rsp = (struct dpcon_rsp_is_enabled *)cmd.params;
|
||||
*en = dpcon_rsp->enabled & DPCON_ENABLE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* dpcon_reset() - Reset the DPCON, returns the object to initial state.
|
||||
* @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
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpcon_reset(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token)
|
||||
@ -184,11 +284,21 @@ int dpcon_reset(struct fsl_mc_io *mc_io,
|
||||
return mc_send_command(mc_io, &cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* dpcon_get_attributes() - Retrieve DPCON attributes.
|
||||
* @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
|
||||
* @attr: Object's attributes
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpcon_get_attributes(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
struct dpcon_attr *attr)
|
||||
{
|
||||
struct dpcon_rsp_get_attr *dpcon_rsp;
|
||||
struct mc_command cmd = { 0 };
|
||||
int err;
|
||||
|
||||
@ -203,28 +313,45 @@ int dpcon_get_attributes(struct fsl_mc_io *mc_io,
|
||||
return err;
|
||||
|
||||
/* retrieve response parameters */
|
||||
DPCON_RSP_GET_ATTR(cmd, attr);
|
||||
dpcon_rsp = (struct dpcon_rsp_get_attr *)cmd.params;
|
||||
attr->id = le32_to_cpu(dpcon_rsp->id);
|
||||
attr->qbman_ch_id = le16_to_cpu(dpcon_rsp->qbman_ch_id);
|
||||
attr->num_priorities = dpcon_rsp->num_priorities;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* dpcon_get_api_version - Get Data Path Concentrator API version
|
||||
* @mc_io: Pointer to MC portal's DPCON object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @major_ver: Major version of DPCON API
|
||||
* @minor_ver: Minor version of DPCON API
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise
|
||||
*/
|
||||
int dpcon_get_api_version(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t *major_ver,
|
||||
uint16_t *minor_ver)
|
||||
uint16_t *major_ver,
|
||||
uint16_t *minor_ver)
|
||||
{
|
||||
struct dpcon_rsp_get_api_version *rsp_params;
|
||||
struct mc_command cmd = { 0 };
|
||||
int err;
|
||||
|
||||
/* prepare command */
|
||||
cmd.header = mc_encode_cmd_header(DPCON_CMDID_GET_API_VERSION,
|
||||
cmd_flags,
|
||||
0);
|
||||
cmd_flags, 0);
|
||||
|
||||
/* send command to mc */
|
||||
err = mc_send_command(mc_io, &cmd);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
DPCON_RSP_GET_API_VERSION(cmd, *major_ver, *minor_ver);
|
||||
/* retrieve response parameters */
|
||||
rsp_params = (struct dpcon_rsp_get_api_version *)cmd.params;
|
||||
*major_ver = le16_to_cpu(rsp_params->major);
|
||||
*minor_ver = le16_to_cpu(rsp_params->minor);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
* BSD LICENSE
|
||||
*
|
||||
* Copyright 2013-2016 Freescale Semiconductor Inc.
|
||||
* Copyright 2016 NXP.
|
||||
* Copyright 2016-2017 NXP.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@ -42,11 +42,29 @@
|
||||
#include <fsl_dpio.h>
|
||||
#include <fsl_dpio_cmd.h>
|
||||
|
||||
/**
|
||||
* dpio_open() - Open a control session for the specified object
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @dpio_id: DPIO unique ID
|
||||
* @token: Returned token; use in subsequent API calls
|
||||
*
|
||||
* This function can be used to open a control session for an
|
||||
* already created object; an object may have been declared in
|
||||
* the DPL or by calling the dpio_create() function.
|
||||
* This function returns a unique authentication token,
|
||||
* associated with the specific object ID and any MC portals
|
||||
* assigned to the parent container; this token must be used in
|
||||
* all subsequent commands for this specific object.
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpio_open(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
int dpio_id,
|
||||
uint16_t *token)
|
||||
{
|
||||
struct dpio_cmd_open *cmd_params;
|
||||
struct mc_command cmd = { 0 };
|
||||
int err;
|
||||
|
||||
@ -54,7 +72,8 @@ int dpio_open(struct fsl_mc_io *mc_io,
|
||||
cmd.header = mc_encode_cmd_header(DPIO_CMDID_OPEN,
|
||||
cmd_flags,
|
||||
0);
|
||||
DPIO_CMD_OPEN(cmd, dpio_id);
|
||||
cmd_params = (struct dpio_cmd_open *)cmd.params;
|
||||
cmd_params->dpio_id = cpu_to_le32(dpio_id);
|
||||
|
||||
/* send command to mc*/
|
||||
err = mc_send_command(mc_io, &cmd);
|
||||
@ -62,11 +81,19 @@ int dpio_open(struct fsl_mc_io *mc_io,
|
||||
return err;
|
||||
|
||||
/* retrieve response parameters */
|
||||
*token = MC_CMD_HDR_READ_TOKEN(cmd.header);
|
||||
*token = mc_cmd_hdr_read_token(&cmd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* dpio_close() - Close the control session of the object
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPIO object
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpio_close(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token)
|
||||
@ -82,12 +109,35 @@ int dpio_close(struct fsl_mc_io *mc_io,
|
||||
return mc_send_command(mc_io, &cmd);
|
||||
}
|
||||
|
||||
int dpio_create(struct fsl_mc_io *mc_io,
|
||||
uint16_t dprc_token,
|
||||
uint32_t cmd_flags,
|
||||
const struct dpio_cfg *cfg,
|
||||
uint32_t *obj_id)
|
||||
/**
|
||||
* dpio_create() - Create the DPIO 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 DPIO 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 dpio_create(struct fsl_mc_io *mc_io,
|
||||
uint16_t dprc_token,
|
||||
uint32_t cmd_flags,
|
||||
const struct dpio_cfg *cfg,
|
||||
uint32_t *obj_id)
|
||||
{
|
||||
struct dpio_cmd_create *cmd_params;
|
||||
struct mc_command cmd = { 0 };
|
||||
int err;
|
||||
|
||||
@ -95,7 +145,11 @@ int dpio_create(struct fsl_mc_io *mc_io,
|
||||
cmd.header = mc_encode_cmd_header(DPIO_CMDID_CREATE,
|
||||
cmd_flags,
|
||||
dprc_token);
|
||||
DPIO_CMD_CREATE(cmd, cfg);
|
||||
cmd_params = (struct dpio_cmd_create *)cmd.params;
|
||||
cmd_params->num_priorities = cfg->num_priorities;
|
||||
dpio_set_field(cmd_params->channel_mode,
|
||||
CHANNEL_MODE,
|
||||
cfg->channel_mode);
|
||||
|
||||
/* send command to mc*/
|
||||
err = mc_send_command(mc_io, &cmd);
|
||||
@ -103,28 +157,55 @@ int dpio_create(struct fsl_mc_io *mc_io,
|
||||
return err;
|
||||
|
||||
/* retrieve response parameters */
|
||||
CMD_CREATE_RSP_GET_OBJ_ID_PARAM0(cmd, *obj_id);
|
||||
*obj_id = mc_cmd_read_object_id(&cmd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int dpio_destroy(struct fsl_mc_io *mc_io,
|
||||
uint16_t dprc_token,
|
||||
uint32_t cmd_flags,
|
||||
uint32_t object_id)
|
||||
/**
|
||||
* dpio_destroy() - Destroy the DPIO object and release all its resources.
|
||||
* @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_'
|
||||
* @object_id: The object id; it must be a valid id within the container that
|
||||
* created this object;
|
||||
*
|
||||
* The function accepts the authentication token of the parent container that
|
||||
* created the object (not the one that currently owns the object). The object
|
||||
* is searched within parent using the provided 'object_id'.
|
||||
* All tokens to the object must be closed before calling destroy.
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise
|
||||
*/
|
||||
int dpio_destroy(struct fsl_mc_io *mc_io,
|
||||
uint16_t dprc_token,
|
||||
uint32_t cmd_flags,
|
||||
uint32_t object_id)
|
||||
{
|
||||
struct dpio_cmd_destroy *cmd_params;
|
||||
struct mc_command cmd = { 0 };
|
||||
|
||||
/* prepare command */
|
||||
cmd.header = mc_encode_cmd_header(DPIO_CMDID_DESTROY,
|
||||
cmd_flags,
|
||||
dprc_token);
|
||||
|
||||
/* set object id to destroy */
|
||||
CMD_DESTROY_SET_OBJ_ID_PARAM0(cmd, object_id);
|
||||
cmd_params = (struct dpio_cmd_destroy *)cmd.params;
|
||||
cmd_params->dpio_id = cpu_to_le32(object_id);
|
||||
|
||||
/* send command to mc*/
|
||||
return mc_send_command(mc_io, &cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* dpio_enable() - Enable the DPIO, allow I/O portal operations.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPIO object
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise
|
||||
*/
|
||||
int dpio_enable(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token)
|
||||
@ -140,6 +221,14 @@ int dpio_enable(struct fsl_mc_io *mc_io,
|
||||
return mc_send_command(mc_io, &cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* dpio_disable() - Disable the DPIO, stop any I/O portal operation.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPIO object
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise
|
||||
*/
|
||||
int dpio_disable(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token)
|
||||
@ -155,13 +244,24 @@ int dpio_disable(struct fsl_mc_io *mc_io,
|
||||
return mc_send_command(mc_io, &cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* dpio_is_enabled() - Check if the DPIO is enabled.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPIO object
|
||||
* @en: Returns '1' if object is enabled; '0' otherwise
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpio_is_enabled(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
int *en)
|
||||
{
|
||||
struct dpio_rsp_is_enabled *rsp_params;
|
||||
struct mc_command cmd = { 0 };
|
||||
int err;
|
||||
|
||||
/* prepare command */
|
||||
cmd.header = mc_encode_cmd_header(DPIO_CMDID_IS_ENABLED, cmd_flags,
|
||||
token);
|
||||
@ -172,11 +272,20 @@ int dpio_is_enabled(struct fsl_mc_io *mc_io,
|
||||
return err;
|
||||
|
||||
/* retrieve response parameters */
|
||||
DPIO_RSP_IS_ENABLED(cmd, *en);
|
||||
rsp_params = (struct dpio_rsp_is_enabled *)cmd.params;
|
||||
*en = dpio_get_field(rsp_params->en, ENABLE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* dpio_reset() - Reset the DPIO, returns the object to initial state.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPIO object
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpio_reset(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token)
|
||||
@ -197,6 +306,7 @@ int dpio_get_attributes(struct fsl_mc_io *mc_io,
|
||||
uint16_t token,
|
||||
struct dpio_attr *attr)
|
||||
{
|
||||
struct dpio_rsp_get_attr *rsp_params;
|
||||
struct mc_command cmd = { 0 };
|
||||
int err;
|
||||
|
||||
@ -211,33 +321,65 @@ int dpio_get_attributes(struct fsl_mc_io *mc_io,
|
||||
return err;
|
||||
|
||||
/* retrieve response parameters */
|
||||
DPIO_RSP_GET_ATTRIBUTES(cmd, attr);
|
||||
rsp_params = (struct dpio_rsp_get_attr *)cmd.params;
|
||||
attr->id = le32_to_cpu(rsp_params->id);
|
||||
attr->qbman_portal_id = le16_to_cpu(rsp_params->qbman_portal_id);
|
||||
attr->num_priorities = rsp_params->num_priorities;
|
||||
attr->qbman_portal_ce_offset =
|
||||
le64_to_cpu(rsp_params->qbman_portal_ce_offset);
|
||||
attr->qbman_portal_ci_offset =
|
||||
le64_to_cpu(rsp_params->qbman_portal_ci_offset);
|
||||
attr->qbman_version = le32_to_cpu(rsp_params->qbman_version);
|
||||
attr->clk = le32_to_cpu(rsp_params->clk);
|
||||
attr->channel_mode = dpio_get_field(rsp_params->channel_mode,
|
||||
ATTR_CHANNEL_MODE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* dpio_set_stashing_destination() - Set the stashing 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 DPIO object
|
||||
* @sdest: Stashing destination value
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpio_set_stashing_destination(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
uint8_t sdest)
|
||||
{
|
||||
struct dpio_stashing_dest *cmd_params;
|
||||
struct mc_command cmd = { 0 };
|
||||
|
||||
/* prepare command */
|
||||
cmd.header = mc_encode_cmd_header(DPIO_CMDID_SET_STASHING_DEST,
|
||||
cmd_flags,
|
||||
token);
|
||||
DPIO_CMD_SET_STASHING_DEST(cmd, sdest);
|
||||
cmd_params = (struct dpio_stashing_dest *)cmd.params;
|
||||
cmd_params->sdest = sdest;
|
||||
|
||||
/* send command to mc*/
|
||||
return mc_send_command(mc_io, &cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* dpio_get_stashing_destination() - Get the stashing 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 DPIO object
|
||||
* @sdest: Returns the stashing destination value
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpio_get_stashing_destination(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
uint8_t *sdest)
|
||||
{
|
||||
struct dpio_stashing_dest *rsp_params;
|
||||
struct mc_command cmd = { 0 };
|
||||
int err;
|
||||
|
||||
@ -252,17 +394,30 @@ int dpio_get_stashing_destination(struct fsl_mc_io *mc_io,
|
||||
return err;
|
||||
|
||||
/* retrieve response parameters */
|
||||
DPIO_RSP_GET_STASHING_DEST(cmd, *sdest);
|
||||
rsp_params = (struct dpio_stashing_dest *)cmd.params;
|
||||
*sdest = rsp_params->sdest;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* dpio_add_static_dequeue_channel() - Add a static dequeue channel.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPIO object
|
||||
* @dpcon_id: DPCON object ID
|
||||
* @channel_index: Returned channel index to be used in qbman API
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpio_add_static_dequeue_channel(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
int dpcon_id,
|
||||
uint8_t *channel_index)
|
||||
{
|
||||
struct dpio_rsp_add_static_dequeue_channel *rsp_params;
|
||||
struct dpio_cmd_static_dequeue_channel *cmd_params;
|
||||
struct mc_command cmd = { 0 };
|
||||
int err;
|
||||
|
||||
@ -270,7 +425,8 @@ int dpio_add_static_dequeue_channel(struct fsl_mc_io *mc_io,
|
||||
cmd.header = mc_encode_cmd_header(DPIO_CMDID_ADD_STATIC_DEQUEUE_CHANNEL,
|
||||
cmd_flags,
|
||||
token);
|
||||
DPIO_CMD_ADD_STATIC_DEQUEUE_CHANNEL(cmd, dpcon_id);
|
||||
cmd_params = (struct dpio_cmd_static_dequeue_channel *)cmd.params;
|
||||
cmd_params->dpcon_id = cpu_to_le32(dpcon_id);
|
||||
|
||||
/* send command to mc*/
|
||||
err = mc_send_command(mc_io, &cmd);
|
||||
@ -278,16 +434,27 @@ int dpio_add_static_dequeue_channel(struct fsl_mc_io *mc_io,
|
||||
return err;
|
||||
|
||||
/* retrieve response parameters */
|
||||
DPIO_RSP_ADD_STATIC_DEQUEUE_CHANNEL(cmd, *channel_index);
|
||||
rsp_params = (struct dpio_rsp_add_static_dequeue_channel *)cmd.params;
|
||||
*channel_index = rsp_params->channel_index;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* dpio_remove_static_dequeue_channel() - Remove a static dequeue channel.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPIO object
|
||||
* @dpcon_id: DPCON object ID
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpio_remove_static_dequeue_channel(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
int dpcon_id)
|
||||
{
|
||||
struct dpio_cmd_static_dequeue_channel *cmd_params;
|
||||
struct mc_command cmd = { 0 };
|
||||
|
||||
/* prepare command */
|
||||
@ -295,17 +462,28 @@ int dpio_remove_static_dequeue_channel(struct fsl_mc_io *mc_io,
|
||||
DPIO_CMDID_REMOVE_STATIC_DEQUEUE_CHANNEL,
|
||||
cmd_flags,
|
||||
token);
|
||||
DPIO_CMD_REMOVE_STATIC_DEQUEUE_CHANNEL(cmd, dpcon_id);
|
||||
cmd_params = (struct dpio_cmd_static_dequeue_channel *)cmd.params;
|
||||
cmd_params->dpcon_id = cpu_to_le32(dpcon_id);
|
||||
|
||||
/* send command to mc*/
|
||||
return mc_send_command(mc_io, &cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* dpio_get_api_version() - Get Data Path I/O API version
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @major_ver: Major version of data path i/o API
|
||||
* @minor_ver: Minor version of data path i/o API
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpio_get_api_version(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t *major_ver,
|
||||
uint16_t *minor_ver)
|
||||
uint16_t *major_ver,
|
||||
uint16_t *minor_ver)
|
||||
{
|
||||
struct dpio_rsp_get_api_version *rsp_params;
|
||||
struct mc_command cmd = { 0 };
|
||||
int err;
|
||||
|
||||
@ -317,7 +495,9 @@ int dpio_get_api_version(struct fsl_mc_io *mc_io,
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
DPIO_RSP_GET_API_VERSION(cmd, *major_ver, *minor_ver);
|
||||
rsp_params = (struct dpio_rsp_get_api_version *)cmd.params;
|
||||
*major_ver = le16_to_cpu(rsp_params->major);
|
||||
*minor_ver = le16_to_cpu(rsp_params->minor);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
* BSD LICENSE
|
||||
*
|
||||
* Copyright 2013-2015 Freescale Semiconductor Inc.
|
||||
* Copyright 2017 NXP.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@ -41,11 +42,21 @@
|
||||
#include <fsl_dpmng.h>
|
||||
#include <fsl_dpmng_cmd.h>
|
||||
|
||||
/**
|
||||
* mc_get_version() - Retrieves the Management Complex firmware
|
||||
* version information
|
||||
* @mc_io: Pointer to opaque I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @mc_ver_info: Returned version information structure
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int mc_get_version(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
struct mc_version *mc_ver_info)
|
||||
{
|
||||
struct mc_command cmd = { 0 };
|
||||
struct dpmng_rsp_get_version *rsp_params;
|
||||
int err;
|
||||
|
||||
/* prepare command */
|
||||
@ -59,15 +70,31 @@ int mc_get_version(struct fsl_mc_io *mc_io,
|
||||
return err;
|
||||
|
||||
/* retrieve response parameters */
|
||||
DPMNG_RSP_GET_VERSION(cmd, mc_ver_info);
|
||||
rsp_params = (struct dpmng_rsp_get_version *)cmd.params;
|
||||
mc_ver_info->revision = le32_to_cpu(rsp_params->revision);
|
||||
mc_ver_info->major = le32_to_cpu(rsp_params->version_major);
|
||||
mc_ver_info->minor = le32_to_cpu(rsp_params->version_minor);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* mc_get_soc_version() - Retrieves the Management Complex firmware
|
||||
* version information
|
||||
* @mc_io Pointer to opaque I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @mc_platform_info: Returned version information structure. The structure
|
||||
* contains the values of SVR and PVR registers.
|
||||
* Please consult platform specific reference manual
|
||||
* for detailed information.
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int mc_get_soc_version(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
struct mc_soc_version *mc_platform_info)
|
||||
{
|
||||
struct dpmng_rsp_get_soc_version *rsp_params;
|
||||
struct mc_command cmd = { 0 };
|
||||
int err;
|
||||
|
||||
@ -82,7 +109,9 @@ int mc_get_soc_version(struct fsl_mc_io *mc_io,
|
||||
return err;
|
||||
|
||||
/* retrieve response parameters */
|
||||
DPMNG_RSP_GET_SOC_VERSION(cmd, mc_platform_info);
|
||||
rsp_params = (struct dpmng_rsp_get_soc_version *)cmd.params;
|
||||
mc_platform_info->svr = le32_to_cpu(rsp_params->svr);
|
||||
mc_platform_info->pvr = le32_to_cpu(rsp_params->pvr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
* BSD LICENSE
|
||||
*
|
||||
* Copyright 2013-2016 Freescale Semiconductor Inc.
|
||||
* Copyright 2016 NXP.
|
||||
* Copyright 2016-2017 NXP.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@ -40,48 +40,21 @@
|
||||
#ifndef __FSL_DPBP_H
|
||||
#define __FSL_DPBP_H
|
||||
|
||||
/* Data Path Buffer Pool API
|
||||
/*
|
||||
* Data Path Buffer Pool API
|
||||
* Contains initialization APIs and runtime control APIs for DPBP
|
||||
*/
|
||||
|
||||
struct fsl_mc_io;
|
||||
|
||||
/**
|
||||
* dpbp_open() - Open a control session for the specified object.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @dpbp_id: DPBP unique ID
|
||||
* @token: Returned token; use in subsequent API calls
|
||||
*
|
||||
* This function can be used to open a control session for an
|
||||
* already created object; an object may have been declared in
|
||||
* the DPL or by calling the dpbp_create function.
|
||||
* This function returns a unique authentication token,
|
||||
* associated with the specific object ID and the specific MC
|
||||
* portal; this token must be used in all subsequent commands for
|
||||
* this specific object
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpbp_open(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
int dpbp_id,
|
||||
uint16_t *token);
|
||||
int dpbp_open(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
int dpbp_id,
|
||||
uint16_t *token);
|
||||
|
||||
/**
|
||||
* dpbp_close() - Close the control session of the object
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPBP object
|
||||
*
|
||||
* After this function is called, no further operations are
|
||||
* allowed on the object without opening a new control session.
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpbp_close(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token);
|
||||
int dpbp_close(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token);
|
||||
|
||||
/**
|
||||
* struct dpbp_cfg - Structure representing DPBP configuration
|
||||
@ -91,98 +64,33 @@ struct dpbp_cfg {
|
||||
uint32_t options;
|
||||
};
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
* Create the DPBP 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 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);
|
||||
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);
|
||||
|
||||
/**
|
||||
* dpbp_destroy() - Destroy the DPBP object and release all its resources.
|
||||
* @dprc_token: Parent container token; '0' for default container
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @object_id: The object id; it must be a valid id within the container that
|
||||
* created this object;
|
||||
*
|
||||
* Return: '0' on Success; error code otherwise.
|
||||
*/
|
||||
int dpbp_destroy(struct fsl_mc_io *mc_io,
|
||||
uint16_t dprc_token,
|
||||
uint32_t cmd_flags,
|
||||
uint32_t object_id);
|
||||
int dpbp_destroy(struct fsl_mc_io *mc_io,
|
||||
uint16_t dprc_token,
|
||||
uint32_t cmd_flags,
|
||||
uint32_t obj_id);
|
||||
|
||||
/**
|
||||
* dpbp_enable() - Enable the DPBP.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPBP object
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpbp_enable(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token);
|
||||
int dpbp_enable(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token);
|
||||
|
||||
/**
|
||||
* dpbp_disable() - Disable the DPBP.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPBP object
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpbp_disable(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token);
|
||||
int dpbp_disable(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token);
|
||||
|
||||
/**
|
||||
* dpbp_is_enabled() - Check if the DPBP is enabled.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPBP object
|
||||
* @en: Returns '1' if object is enabled; '0' otherwise
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpbp_is_enabled(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
int *en);
|
||||
int dpbp_is_enabled(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
int *en);
|
||||
|
||||
/**
|
||||
* dpbp_reset() - Reset the DPBP, returns the object to initial state.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPBP object
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpbp_reset(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token);
|
||||
int dpbp_reset(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token);
|
||||
|
||||
/**
|
||||
* struct dpbp_attr - Structure representing DPBP attributes
|
||||
@ -195,44 +103,23 @@ struct dpbp_attr {
|
||||
uint16_t bpid;
|
||||
};
|
||||
|
||||
/**
|
||||
* dpbp_get_attributes - Retrieve DPBP attributes.
|
||||
*
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPBP object
|
||||
* @attr: Returned object's attributes
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpbp_get_attributes(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
struct dpbp_attr *attr);
|
||||
int dpbp_get_attributes(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
struct dpbp_attr *attr);
|
||||
|
||||
/**
|
||||
* dpbp_get_api_version() - Get buffer pool API version
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @major_ver: Major version of data path buffer pool API
|
||||
* @minor_ver: Minor version of data path buffer pool API
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
* DPBP notifications options
|
||||
*/
|
||||
|
||||
/**
|
||||
* BPSCN write will attempt to allocate into a cache (coherent write)
|
||||
*/
|
||||
int dpbp_get_api_version(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t *major_ver,
|
||||
uint16_t *minor_ver);
|
||||
|
||||
/**
|
||||
* dpbp_get_num_free_bufs() - Get number of free buffers in the buffer pool
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPBP object
|
||||
* @num_free_bufs: Number of free buffers
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpbp_get_num_free_bufs(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
|
@ -5,7 +5,7 @@
|
||||
* BSD LICENSE
|
||||
*
|
||||
* Copyright 2013-2016 Freescale Semiconductor Inc.
|
||||
* Copyright 2016 NXP.
|
||||
* Copyright 2016-2017 NXP.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@ -42,47 +42,90 @@
|
||||
|
||||
/* DPBP Version */
|
||||
#define DPBP_VER_MAJOR 3
|
||||
#define DPBP_VER_MINOR 2
|
||||
#define DPBP_VER_MINOR 3
|
||||
|
||||
/* Command versioning */
|
||||
#define DPBP_CMD_BASE_VERSION 1
|
||||
#define DPBP_CMD_ID_OFFSET 4
|
||||
|
||||
#define DPBP_CMD(id) ((id << DPBP_CMD_ID_OFFSET) | DPBP_CMD_BASE_VERSION)
|
||||
|
||||
/* Command IDs */
|
||||
#define DPBP_CMDID_CLOSE 0x8001
|
||||
#define DPBP_CMDID_OPEN 0x8041
|
||||
#define DPBP_CMDID_CREATE 0x9041
|
||||
#define DPBP_CMDID_DESTROY 0x9841
|
||||
#define DPBP_CMDID_GET_API_VERSION 0xa041
|
||||
#define DPBP_CMDID_CLOSE DPBP_CMD(0x800)
|
||||
#define DPBP_CMDID_OPEN DPBP_CMD(0x804)
|
||||
#define DPBP_CMDID_CREATE DPBP_CMD(0x904)
|
||||
#define DPBP_CMDID_DESTROY DPBP_CMD(0x984)
|
||||
#define DPBP_CMDID_GET_API_VERSION DPBP_CMD(0xa04)
|
||||
|
||||
#define DPBP_CMDID_ENABLE 0x0021
|
||||
#define DPBP_CMDID_DISABLE 0x0031
|
||||
#define DPBP_CMDID_GET_ATTR 0x0041
|
||||
#define DPBP_CMDID_RESET 0x0051
|
||||
#define DPBP_CMDID_IS_ENABLED 0x0061
|
||||
#define DPBP_CMDID_ENABLE DPBP_CMD(0x002)
|
||||
#define DPBP_CMDID_DISABLE DPBP_CMD(0x003)
|
||||
#define DPBP_CMDID_GET_ATTR DPBP_CMD(0x004)
|
||||
#define DPBP_CMDID_RESET DPBP_CMD(0x005)
|
||||
#define DPBP_CMDID_IS_ENABLED DPBP_CMD(0x006)
|
||||
|
||||
#define DPBP_CMDID_GET_FREE_BUFFERS_NUM 0x1b21
|
||||
#define DPBP_CMDID_SET_IRQ_ENABLE DPBP_CMD(0x012)
|
||||
#define DPBP_CMDID_GET_IRQ_ENABLE DPBP_CMD(0x013)
|
||||
#define DPBP_CMDID_SET_IRQ_MASK DPBP_CMD(0x014)
|
||||
#define DPBP_CMDID_GET_IRQ_MASK DPBP_CMD(0x015)
|
||||
#define DPBP_CMDID_GET_IRQ_STATUS DPBP_CMD(0x016)
|
||||
#define DPBP_CMDID_CLEAR_IRQ_STATUS DPBP_CMD(0x017)
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPBP_CMD_OPEN(cmd, dpbp_id) \
|
||||
MC_CMD_OP(cmd, 0, 0, 32, int, dpbp_id)
|
||||
#define DPBP_CMDID_SET_NOTIFICATIONS DPBP_CMD(0x1b0)
|
||||
#define DPBP_CMDID_GET_NOTIFICATIONS DPBP_CMD(0x1b1)
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPBP_RSP_IS_ENABLED(cmd, en) \
|
||||
MC_RSP_OP(cmd, 0, 0, 1, int, en)
|
||||
#define DPBP_CMDID_GET_FREE_BUFFERS_NUM DPBP_CMD(0x1b2)
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPBP_RSP_GET_ATTRIBUTES(cmd, attr) \
|
||||
do { \
|
||||
MC_RSP_OP(cmd, 0, 16, 16, uint16_t, (attr)->bpid); \
|
||||
MC_RSP_OP(cmd, 0, 32, 32, int, (attr)->id);\
|
||||
} while (0)
|
||||
#pragma pack(push, 1)
|
||||
struct dpbp_cmd_open {
|
||||
uint32_t dpbp_id;
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPBP_RSP_GET_API_VERSION(cmd, major, minor) \
|
||||
do { \
|
||||
MC_RSP_OP(cmd, 0, 0, 16, uint16_t, major);\
|
||||
MC_RSP_OP(cmd, 0, 16, 16, uint16_t, minor);\
|
||||
} while (0)
|
||||
struct dpbp_cmd_destroy {
|
||||
uint32_t object_id;
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPBP_RSP_GET_NUM_FREE_BUFS(cmd, num_free_bufs) \
|
||||
MC_RSP_OP(cmd, 0, 0, 32, uint32_t, num_free_bufs)
|
||||
#define DPBP_ENABLE 0x1
|
||||
|
||||
struct dpbp_rsp_is_enabled {
|
||||
uint8_t enabled;
|
||||
};
|
||||
|
||||
struct dpbp_rsp_get_attributes {
|
||||
uint16_t pad;
|
||||
uint16_t bpid;
|
||||
uint32_t id;
|
||||
};
|
||||
|
||||
struct dpbp_cmd_set_notifications {
|
||||
uint32_t depletion_entry;
|
||||
uint32_t depletion_exit;
|
||||
uint32_t surplus_entry;
|
||||
uint32_t surplus_exit;
|
||||
uint16_t options;
|
||||
uint16_t pad[3];
|
||||
uint64_t message_ctx;
|
||||
uint64_t message_iova;
|
||||
};
|
||||
|
||||
struct dpbp_rsp_get_notifications {
|
||||
uint32_t depletion_entry;
|
||||
uint32_t depletion_exit;
|
||||
uint32_t surplus_entry;
|
||||
uint32_t surplus_exit;
|
||||
uint16_t options;
|
||||
uint16_t pad[3];
|
||||
uint64_t message_ctx;
|
||||
uint64_t message_iova;
|
||||
};
|
||||
|
||||
struct dpbp_rsp_get_api_version {
|
||||
uint16_t major;
|
||||
uint16_t minor;
|
||||
};
|
||||
|
||||
struct dpbp_rsp_get_num_free_bufs {
|
||||
uint32_t num_free_bufs;
|
||||
};
|
||||
|
||||
#pragma pack(pop)
|
||||
#endif /* _FSL_DPBP_CMD_H */
|
||||
|
@ -62,42 +62,14 @@ struct fsl_mc_io;
|
||||
*/
|
||||
#define DPCI_ALL_QUEUES (uint8_t)(-1)
|
||||
|
||||
/**
|
||||
* dpci_open() - Open a control session for the specified object
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @dpci_id: DPCI unique ID
|
||||
* @token: Returned token; use in subsequent API calls
|
||||
*
|
||||
* This function can be used to open a control session for an
|
||||
* already created object; an object may have been declared in
|
||||
* the DPL or by calling the dpci_create() function.
|
||||
* This function returns a unique authentication token,
|
||||
* associated with the specific object ID and the specific MC
|
||||
* portal; this token must be used in all subsequent commands for
|
||||
* this specific object.
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpci_open(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
int dpci_id,
|
||||
uint16_t *token);
|
||||
uint32_t cmd_flags,
|
||||
int dpci_id,
|
||||
uint16_t *token);
|
||||
|
||||
/**
|
||||
* dpci_close() - Close the control session of the object
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPCI object
|
||||
*
|
||||
* After this function is called, no further operations are
|
||||
* allowed on the object without opening a new control session.
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpci_close(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token);
|
||||
int dpci_close(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token);
|
||||
|
||||
/**
|
||||
* Enable the Order Restoration support
|
||||
@ -124,107 +96,37 @@ struct dpci_cfg {
|
||||
uint8_t num_of_priorities;
|
||||
};
|
||||
|
||||
/**
|
||||
* 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);
|
||||
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);
|
||||
|
||||
/**
|
||||
* dpci_destroy() - Destroy the DPCI object and release all its resources.
|
||||
* @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_'
|
||||
* @object_id: The object id; it must be a valid id within the container that
|
||||
* created this object;
|
||||
*
|
||||
* The function accepts the authentication token of the parent container that
|
||||
* created the object (not the one that currently owns the object). The object
|
||||
* is searched within parent using the provided 'object_id'.
|
||||
* All tokens to the object must be closed before calling destroy.
|
||||
*
|
||||
* Return: '0' on Success; error code otherwise.
|
||||
*/
|
||||
int dpci_destroy(struct fsl_mc_io *mc_io,
|
||||
uint16_t dprc_token,
|
||||
uint32_t cmd_flags,
|
||||
uint32_t object_id);
|
||||
int dpci_destroy(struct fsl_mc_io *mc_io,
|
||||
uint16_t dprc_token,
|
||||
uint32_t cmd_flags,
|
||||
uint32_t object_id);
|
||||
|
||||
/**
|
||||
* dpci_enable() - Enable the DPCI, allow sending and receiving frames.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPCI object
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpci_enable(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token);
|
||||
int dpci_enable(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token);
|
||||
|
||||
/**
|
||||
* dpci_disable() - Disable the DPCI, stop sending and receiving frames.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPCI object
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpci_disable(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token);
|
||||
int dpci_disable(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token);
|
||||
|
||||
/**
|
||||
* dpci_is_enabled() - Check if the DPCI is enabled.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPCI object
|
||||
* @en: Returns '1' if object is enabled; '0' otherwise
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpci_is_enabled(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
int *en);
|
||||
int dpci_is_enabled(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
int *en);
|
||||
|
||||
/**
|
||||
* dpci_reset() - Reset the DPCI, returns the object to initial state.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPCI object
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpci_reset(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token);
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token);
|
||||
|
||||
/**
|
||||
* struct dpci_attr - Structure representing DPCI attributes
|
||||
* @id: DPCI object ID
|
||||
* @id: DPCI object ID
|
||||
* @num_of_priorities: Number of receive priorities
|
||||
*/
|
||||
struct dpci_attr {
|
||||
@ -232,19 +134,10 @@ struct dpci_attr {
|
||||
uint8_t num_of_priorities;
|
||||
};
|
||||
|
||||
/**
|
||||
* dpci_get_attributes() - Retrieve DPCI attributes.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPCI object
|
||||
* @attr: Returned object's attributes
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpci_get_attributes(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
struct dpci_attr *attr);
|
||||
int dpci_get_attributes(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
struct dpci_attr *attr);
|
||||
|
||||
/**
|
||||
* enum dpci_dest - DPCI destination types
|
||||
@ -310,24 +203,11 @@ struct dpci_rx_queue_cfg {
|
||||
struct dpci_dest_cfg dest_cfg;
|
||||
};
|
||||
|
||||
/**
|
||||
* dpci_set_rx_queue() - Set Rx queue configuration
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPCI object
|
||||
* @priority: Select the queue relative to number of
|
||||
* priorities configured at DPCI creation; use
|
||||
* DPCI_ALL_QUEUES to configure all Rx queues
|
||||
* identically.
|
||||
* @cfg: Rx queue configuration
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpci_set_rx_queue(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
uint8_t priority,
|
||||
const struct dpci_rx_queue_cfg *cfg);
|
||||
int dpci_set_rx_queue(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
uint8_t priority,
|
||||
const struct dpci_rx_queue_cfg *cfg);
|
||||
|
||||
/**
|
||||
* struct dpci_rx_queue_attr - Structure representing Rx queue attributes
|
||||
@ -337,26 +217,15 @@ int dpci_set_rx_queue(struct fsl_mc_io *mc_io,
|
||||
* @fqid: Virtual FQID value to be used for dequeue operations
|
||||
*/
|
||||
struct dpci_rx_queue_attr {
|
||||
uint64_t user_ctx;
|
||||
struct dpci_dest_cfg dest_cfg;
|
||||
uint32_t fqid;
|
||||
uint64_t user_ctx;
|
||||
struct dpci_dest_cfg dest_cfg;
|
||||
uint32_t fqid;
|
||||
};
|
||||
|
||||
/**
|
||||
* dpci_get_rx_queue() - Retrieve Rx queue attributes.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPCI object
|
||||
* @priority: Select the queue relative to number of
|
||||
* priorities configured at DPCI creation
|
||||
* @attr: Returned Rx queue attributes
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpci_get_rx_queue(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
uint8_t priority,
|
||||
int dpci_get_rx_queue(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
uint8_t priority,
|
||||
struct dpci_rx_queue_attr *attr);
|
||||
|
||||
/**
|
||||
@ -370,35 +239,15 @@ struct dpci_tx_queue_attr {
|
||||
uint32_t fqid;
|
||||
};
|
||||
|
||||
/**
|
||||
* dpci_get_tx_queue() - Retrieve Tx queue attributes.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPCI object
|
||||
* @priority: Select the queue relative to number of
|
||||
* priorities of the peer DPCI object
|
||||
* @attr: Returned Tx queue attributes
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpci_get_tx_queue(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
uint8_t priority,
|
||||
struct dpci_tx_queue_attr *attr);
|
||||
int dpci_get_tx_queue(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
uint8_t priority,
|
||||
struct dpci_tx_queue_attr *attr);
|
||||
|
||||
/**
|
||||
* dpci_get_api_version() - Get communication interface API version
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @major_ver: Major version of data path communication interface API
|
||||
* @minor_ver: Minor version of data path communication interface API
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpci_get_api_version(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t *major_ver,
|
||||
uint16_t *minor_ver);
|
||||
int dpci_get_api_version(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t *major_ver,
|
||||
uint16_t *minor_ver);
|
||||
|
||||
#endif /* __FSL_DPCI_H */
|
||||
|
@ -40,108 +40,126 @@
|
||||
#define _FSL_DPCI_CMD_H
|
||||
|
||||
/* DPCI Version */
|
||||
#define DPCI_VER_MAJOR 3
|
||||
#define DPCI_VER_MINOR 3
|
||||
#define DPCI_VER_MAJOR 3
|
||||
#define DPCI_VER_MINOR 3
|
||||
|
||||
#define DPCI_CMD_BASE_VERSION 1
|
||||
#define DPCI_CMD_BASE_VERSION_V2 2
|
||||
#define DPCI_CMD_ID_OFFSET 4
|
||||
|
||||
#define DPCI_CMD_V1(id) ((id << DPCI_CMD_ID_OFFSET) | DPCI_CMD_BASE_VERSION)
|
||||
#define DPCI_CMD_V2(id) ((id << DPCI_CMD_ID_OFFSET) | DPCI_CMD_BASE_VERSION_V2)
|
||||
|
||||
/* Command IDs */
|
||||
#define DPCI_CMDID_CLOSE 0x8001
|
||||
#define DPCI_CMDID_OPEN 0x8071
|
||||
#define DPCI_CMDID_CREATE 0x9072
|
||||
#define DPCI_CMDID_DESTROY 0x9871
|
||||
#define DPCI_CMDID_GET_API_VERSION 0xa071
|
||||
#define DPCI_CMDID_CLOSE DPCI_CMD_V1(0x800)
|
||||
#define DPCI_CMDID_OPEN DPCI_CMD_V1(0x807)
|
||||
#define DPCI_CMDID_CREATE DPCI_CMD_V2(0x907)
|
||||
#define DPCI_CMDID_DESTROY DPCI_CMD_V1(0x987)
|
||||
#define DPCI_CMDID_GET_API_VERSION DPCI_CMD_V1(0xa07)
|
||||
|
||||
#define DPCI_CMDID_ENABLE 0x0021
|
||||
#define DPCI_CMDID_DISABLE 0x0031
|
||||
#define DPCI_CMDID_GET_ATTR 0x0041
|
||||
#define DPCI_CMDID_RESET 0x0051
|
||||
#define DPCI_CMDID_IS_ENABLED 0x0061
|
||||
#define DPCI_CMDID_ENABLE DPCI_CMD_V1(0x002)
|
||||
#define DPCI_CMDID_DISABLE DPCI_CMD_V1(0x003)
|
||||
#define DPCI_CMDID_GET_ATTR DPCI_CMD_V1(0x004)
|
||||
#define DPCI_CMDID_RESET DPCI_CMD_V1(0x005)
|
||||
#define DPCI_CMDID_IS_ENABLED DPCI_CMD_V1(0x006)
|
||||
|
||||
#define DPCI_CMDID_SET_IRQ_ENABLE 0x0121
|
||||
#define DPCI_CMDID_GET_IRQ_ENABLE 0x0131
|
||||
#define DPCI_CMDID_SET_IRQ_MASK 0x0141
|
||||
#define DPCI_CMDID_GET_IRQ_MASK 0x0151
|
||||
#define DPCI_CMDID_GET_IRQ_STATUS 0x0161
|
||||
#define DPCI_CMDID_CLEAR_IRQ_STATUS 0x0171
|
||||
#define DPCI_CMDID_SET_RX_QUEUE DPCI_CMD_V1(0x0e0)
|
||||
#define DPCI_CMDID_GET_LINK_STATE DPCI_CMD_V1(0x0e1)
|
||||
#define DPCI_CMDID_GET_PEER_ATTR DPCI_CMD_V1(0x0e2)
|
||||
#define DPCI_CMDID_GET_RX_QUEUE DPCI_CMD_V1(0x0e3)
|
||||
#define DPCI_CMDID_GET_TX_QUEUE DPCI_CMD_V1(0x0e4)
|
||||
|
||||
#define DPCI_CMDID_SET_RX_QUEUE 0x0e01
|
||||
#define DPCI_CMDID_GET_LINK_STATE 0x0e11
|
||||
#define DPCI_CMDID_GET_PEER_ATTR 0x0e21
|
||||
#define DPCI_CMDID_GET_RX_QUEUE 0x0e31
|
||||
#define DPCI_CMDID_GET_TX_QUEUE 0x0e41
|
||||
#define DPCI_CMDID_SET_OPR 0x0e51
|
||||
#define DPCI_CMDID_GET_OPR 0x0e61
|
||||
/* Macros for accessing command fields smaller than 1byte */
|
||||
#define DPCI_MASK(field) \
|
||||
GENMASK(DPCI_##field##_SHIFT + DPCI_##field##_SIZE - 1, \
|
||||
DPCI_##field##_SHIFT)
|
||||
#define dpci_set_field(var, field, val) \
|
||||
((var) |= (((val) << DPCI_##field##_SHIFT) & DPCI_MASK(field)))
|
||||
#define dpci_get_field(var, field) \
|
||||
(((var) & DPCI_MASK(field)) >> DPCI_##field##_SHIFT)
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPCI_CMD_OPEN(cmd, dpci_id) \
|
||||
MC_CMD_OP(cmd, 0, 0, 32, int, dpci_id)
|
||||
#pragma pack(push, 1)
|
||||
struct dpci_cmd_open {
|
||||
uint32_t dpci_id;
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPCI_CMD_CREATE(cmd, cfg) \
|
||||
do { \
|
||||
MC_CMD_OP(cmd, 0, 0, 8, uint8_t, cfg->num_of_priorities);\
|
||||
MC_CMD_OP(cmd, 2, 0, 32, uint32_t, cfg->options);\
|
||||
} while (0)
|
||||
struct dpci_cmd_create {
|
||||
uint8_t num_of_priorities;
|
||||
uint8_t pad[15];
|
||||
uint32_t options;
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPCI_RSP_IS_ENABLED(cmd, en) \
|
||||
MC_RSP_OP(cmd, 0, 0, 1, int, en)
|
||||
struct dpci_cmd_destroy {
|
||||
uint32_t dpci_id;
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPCI_RSP_GET_ATTRIBUTES(cmd, attr) \
|
||||
do { \
|
||||
MC_RSP_OP(cmd, 0, 0, 32, int, (attr)->id);\
|
||||
MC_RSP_OP(cmd, 0, 48, 8, uint8_t, (attr)->num_of_priorities);\
|
||||
} while (0)
|
||||
#define DPCI_ENABLE_SHIFT 0
|
||||
#define DPCI_ENABLE_SIZE 1
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPCI_RSP_GET_PEER_ATTR(cmd, attr) \
|
||||
do { \
|
||||
MC_RSP_OP(cmd, 0, 0, 32, int, attr->peer_id);\
|
||||
MC_RSP_OP(cmd, 1, 0, 8, uint8_t, attr->num_of_priorities);\
|
||||
} while (0)
|
||||
struct dpci_rsp_is_enabled {
|
||||
/* only the LSB bit */
|
||||
uint8_t en;
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPCI_RSP_GET_LINK_STATE(cmd, up) \
|
||||
MC_RSP_OP(cmd, 0, 0, 1, int, up)
|
||||
struct dpci_rsp_get_attr {
|
||||
uint32_t id;
|
||||
uint16_t pad;
|
||||
uint8_t num_of_priorities;
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPCI_CMD_SET_RX_QUEUE(cmd, priority, cfg) \
|
||||
do { \
|
||||
MC_CMD_OP(cmd, 0, 0, 32, int, cfg->dest_cfg.dest_id);\
|
||||
MC_CMD_OP(cmd, 0, 32, 8, uint8_t, cfg->dest_cfg.priority);\
|
||||
MC_CMD_OP(cmd, 0, 40, 8, uint8_t, priority);\
|
||||
MC_CMD_OP(cmd, 0, 48, 4, enum dpci_dest, cfg->dest_cfg.dest_type);\
|
||||
MC_CMD_OP(cmd, 1, 0, 64, uint64_t, cfg->user_ctx);\
|
||||
MC_CMD_OP(cmd, 2, 0, 32, uint32_t, cfg->options);\
|
||||
} while (0)
|
||||
struct dpci_rsp_get_peer_attr {
|
||||
uint32_t id;
|
||||
uint32_t pad;
|
||||
uint8_t num_of_priorities;
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPCI_CMD_GET_RX_QUEUE(cmd, priority) \
|
||||
MC_CMD_OP(cmd, 0, 40, 8, uint8_t, priority)
|
||||
#define DPCI_UP_SHIFT 0
|
||||
#define DPCI_UP_SIZE 1
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPCI_RSP_GET_RX_QUEUE(cmd, attr) \
|
||||
do { \
|
||||
MC_RSP_OP(cmd, 0, 0, 32, int, attr->dest_cfg.dest_id);\
|
||||
MC_RSP_OP(cmd, 0, 32, 8, uint8_t, attr->dest_cfg.priority);\
|
||||
MC_RSP_OP(cmd, 0, 48, 4, enum dpci_dest, attr->dest_cfg.dest_type);\
|
||||
MC_RSP_OP(cmd, 1, 0, 8, uint64_t, attr->user_ctx);\
|
||||
MC_RSP_OP(cmd, 2, 0, 32, uint32_t, attr->fqid);\
|
||||
} while (0)
|
||||
struct dpci_rsp_get_link_state {
|
||||
/* only the LSB bit */
|
||||
uint8_t up;
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPCI_CMD_GET_TX_QUEUE(cmd, priority) \
|
||||
MC_CMD_OP(cmd, 0, 40, 8, uint8_t, priority)
|
||||
#define DPCI_DEST_TYPE_SHIFT 0
|
||||
#define DPCI_DEST_TYPE_SIZE 4
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPCI_RSP_GET_TX_QUEUE(cmd, attr) \
|
||||
MC_RSP_OP(cmd, 0, 32, 32, uint32_t, attr->fqid)
|
||||
struct dpci_cmd_set_rx_queue {
|
||||
uint32_t dest_id;
|
||||
uint8_t dest_priority;
|
||||
uint8_t priority;
|
||||
/* from LSB: dest_type:4 */
|
||||
uint8_t dest_type;
|
||||
uint8_t pad;
|
||||
uint64_t user_ctx;
|
||||
uint32_t options;
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPCI_RSP_GET_API_VERSION(cmd, major, minor) \
|
||||
do { \
|
||||
MC_RSP_OP(cmd, 0, 0, 16, uint16_t, major);\
|
||||
MC_RSP_OP(cmd, 0, 16, 16, uint16_t, minor);\
|
||||
} while (0)
|
||||
struct dpci_cmd_get_queue {
|
||||
uint8_t pad[5];
|
||||
uint8_t priority;
|
||||
};
|
||||
|
||||
struct dpci_rsp_get_rx_queue {
|
||||
uint32_t dest_id;
|
||||
uint8_t dest_priority;
|
||||
uint8_t pad;
|
||||
/* from LSB: dest_type:4 */
|
||||
uint8_t dest_type;
|
||||
uint8_t pad1;
|
||||
uint64_t user_ctx;
|
||||
uint32_t fqid;
|
||||
};
|
||||
|
||||
struct dpci_rsp_get_tx_queue {
|
||||
uint32_t pad;
|
||||
uint32_t fqid;
|
||||
};
|
||||
|
||||
struct dpci_rsp_get_api_version {
|
||||
uint16_t major;
|
||||
uint16_t minor;
|
||||
};
|
||||
|
||||
#pragma pack(pop)
|
||||
#endif /* _FSL_DPCI_CMD_H */
|
||||
|
@ -52,42 +52,14 @@ struct fsl_mc_io;
|
||||
*/
|
||||
#define DPCON_INVALID_DPIO_ID (int)(-1)
|
||||
|
||||
/**
|
||||
* dpcon_open() - Open a control session for the specified object
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @dpcon_id: DPCON unique ID
|
||||
* @token: Returned token; use in subsequent API calls
|
||||
*
|
||||
* This function can be used to open a control session for an
|
||||
* already created object; an object may have been declared in
|
||||
* the DPL or by calling the dpcon_create() function.
|
||||
* This function returns a unique authentication token,
|
||||
* associated with the specific object ID and the specific MC
|
||||
* portal; this token must be used in all subsequent commands for
|
||||
* this specific object.
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpcon_open(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
int dpcon_id,
|
||||
uint16_t *token);
|
||||
uint32_t cmd_flags,
|
||||
int dpcon_id,
|
||||
uint16_t *token);
|
||||
|
||||
/**
|
||||
* dpcon_close() - Close the control session of the object
|
||||
* @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
|
||||
*
|
||||
* After this function is called, no further operations are
|
||||
* allowed on the object without opening a new control session.
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpcon_close(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token);
|
||||
int dpcon_close(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token);
|
||||
|
||||
/**
|
||||
* struct dpcon_cfg - Structure representing DPCON configuration
|
||||
@ -97,109 +69,39 @@ struct dpcon_cfg {
|
||||
uint8_t num_priorities;
|
||||
};
|
||||
|
||||
/**
|
||||
* dpcon_create() - Create the DPCON 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 DPCON 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 dpcon_create(struct fsl_mc_io *mc_io,
|
||||
uint16_t dprc_token,
|
||||
uint32_t cmd_flags,
|
||||
const struct dpcon_cfg *cfg,
|
||||
uint32_t *obj_id);
|
||||
int dpcon_create(struct fsl_mc_io *mc_io,
|
||||
uint16_t dprc_token,
|
||||
uint32_t cmd_flags,
|
||||
const struct dpcon_cfg *cfg,
|
||||
uint32_t *obj_id);
|
||||
|
||||
/**
|
||||
* dpcon_destroy() - Destroy the DPCON object and release all its resources.
|
||||
* @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_'
|
||||
* @object_id: The object id; it must be a valid id within the container that
|
||||
* created this object;
|
||||
*
|
||||
* The function accepts the authentication token of the parent container that
|
||||
* created the object (not the one that currently owns the object). The object
|
||||
* is searched within parent using the provided 'object_id'.
|
||||
* All tokens to the object must be closed before calling destroy.
|
||||
*
|
||||
* Return: '0' on Success; error code otherwise.
|
||||
*/
|
||||
int dpcon_destroy(struct fsl_mc_io *mc_io,
|
||||
uint16_t dprc_token,
|
||||
uint32_t cmd_flags,
|
||||
uint32_t object_id);
|
||||
int dpcon_destroy(struct fsl_mc_io *mc_io,
|
||||
uint16_t dprc_token,
|
||||
uint32_t cmd_flags,
|
||||
uint32_t obj_id);
|
||||
|
||||
/**
|
||||
* dpcon_enable() - Enable the DPCON
|
||||
* @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
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise
|
||||
*/
|
||||
int dpcon_enable(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token);
|
||||
int dpcon_enable(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token);
|
||||
|
||||
/**
|
||||
* dpcon_disable() - Disable the DPCON
|
||||
* @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
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise
|
||||
*/
|
||||
int dpcon_disable(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token);
|
||||
int dpcon_disable(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token);
|
||||
|
||||
/**
|
||||
* dpcon_is_enabled() - Check if the DPCON is enabled.
|
||||
* @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
|
||||
* @en: Returns '1' if object is enabled; '0' otherwise
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpcon_is_enabled(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
int *en);
|
||||
int dpcon_is_enabled(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
int *en);
|
||||
|
||||
/**
|
||||
* dpcon_reset() - Reset the DPCON, returns the object to initial state.
|
||||
* @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
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpcon_reset(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token);
|
||||
int dpcon_reset(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token);
|
||||
|
||||
/**
|
||||
* struct dpcon_attr - Structure representing DPCON attributes
|
||||
* @id: DPCON object ID
|
||||
* @qbman_ch_id: Channel ID to be used by dequeue operation
|
||||
* @num_priorities: Number of priorities for the DPCON channel (1-8)
|
||||
* @id: DPCON object ID
|
||||
* @qbman_ch_id: Channel ID to be used by dequeue operation
|
||||
* @num_priorities: Number of priorities for the DPCON channel (1-8)
|
||||
*/
|
||||
struct dpcon_attr {
|
||||
int id;
|
||||
@ -207,29 +109,11 @@ struct dpcon_attr {
|
||||
uint8_t num_priorities;
|
||||
};
|
||||
|
||||
/**
|
||||
* dpcon_get_attributes() - Retrieve DPCON attributes.
|
||||
* @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
|
||||
* @attr: Object's attributes
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpcon_get_attributes(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
struct dpcon_attr *attr);
|
||||
int dpcon_get_attributes(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
struct dpcon_attr *attr);
|
||||
|
||||
/**
|
||||
* dpcon_get_api_version() - Get Data Path Concentrator API version
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @major_ver: Major version of data path concentrator API
|
||||
* @minor_ver: Minor version of data path concentrator API
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpcon_get_api_version(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t *major_ver,
|
||||
|
@ -5,6 +5,7 @@
|
||||
* BSD LICENSE
|
||||
*
|
||||
* Copyright 2013-2016 Freescale Semiconductor Inc.
|
||||
* Copyright 2016-2017 NXP.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@ -40,136 +41,68 @@
|
||||
#define _FSL_DPCON_CMD_H
|
||||
|
||||
/* DPCON Version */
|
||||
#define DPCON_VER_MAJOR 3
|
||||
#define DPCON_VER_MINOR 2
|
||||
#define DPCON_VER_MAJOR 3
|
||||
#define DPCON_VER_MINOR 3
|
||||
|
||||
|
||||
/* Command versioning */
|
||||
#define DPCON_CMD_BASE_VERSION 1
|
||||
#define DPCON_CMD_ID_OFFSET 4
|
||||
|
||||
#define DPCON_CMD(id) ((id << DPCON_CMD_ID_OFFSET) | DPCON_CMD_BASE_VERSION)
|
||||
|
||||
/* Command IDs */
|
||||
#define DPCON_CMDID_CLOSE ((0x800 << 4) | (0x1))
|
||||
#define DPCON_CMDID_OPEN ((0x808 << 4) | (0x1))
|
||||
#define DPCON_CMDID_CREATE ((0x908 << 4) | (0x1))
|
||||
#define DPCON_CMDID_DESTROY ((0x988 << 4) | (0x1))
|
||||
#define DPCON_CMDID_GET_API_VERSION ((0xa08 << 4) | (0x1))
|
||||
#define DPCON_CMDID_CLOSE DPCON_CMD(0x800)
|
||||
#define DPCON_CMDID_OPEN DPCON_CMD(0x808)
|
||||
#define DPCON_CMDID_CREATE DPCON_CMD(0x908)
|
||||
#define DPCON_CMDID_DESTROY DPCON_CMD(0x988)
|
||||
#define DPCON_CMDID_GET_API_VERSION DPCON_CMD(0xa08)
|
||||
|
||||
#define DPCON_CMDID_ENABLE ((0x002 << 4) | (0x1))
|
||||
#define DPCON_CMDID_DISABLE ((0x003 << 4) | (0x1))
|
||||
#define DPCON_CMDID_GET_ATTR ((0x004 << 4) | (0x1))
|
||||
#define DPCON_CMDID_RESET ((0x005 << 4) | (0x1))
|
||||
#define DPCON_CMDID_IS_ENABLED ((0x006 << 4) | (0x1))
|
||||
#define DPCON_CMDID_ENABLE DPCON_CMD(0x002)
|
||||
#define DPCON_CMDID_DISABLE DPCON_CMD(0x003)
|
||||
#define DPCON_CMDID_GET_ATTR DPCON_CMD(0x004)
|
||||
#define DPCON_CMDID_RESET DPCON_CMD(0x005)
|
||||
#define DPCON_CMDID_IS_ENABLED DPCON_CMD(0x006)
|
||||
|
||||
#define DPCON_CMDID_SET_IRQ ((0x010 << 4) | (0x1))
|
||||
#define DPCON_CMDID_GET_IRQ ((0x011 << 4) | (0x1))
|
||||
#define DPCON_CMDID_SET_IRQ_ENABLE ((0x012 << 4) | (0x1))
|
||||
#define DPCON_CMDID_GET_IRQ_ENABLE ((0x013 << 4) | (0x1))
|
||||
#define DPCON_CMDID_SET_IRQ_MASK ((0x014 << 4) | (0x1))
|
||||
#define DPCON_CMDID_GET_IRQ_MASK ((0x015 << 4) | (0x1))
|
||||
#define DPCON_CMDID_GET_IRQ_STATUS ((0x016 << 4) | (0x1))
|
||||
#define DPCON_CMDID_CLEAR_IRQ_STATUS ((0x017 << 4) | (0x1))
|
||||
#define DPCON_CMDID_SET_NOTIFICATION DPCON_CMD(0x100)
|
||||
|
||||
#define DPCON_CMDID_SET_NOTIFICATION ((0x100 << 4) | (0x1))
|
||||
#pragma pack(push, 1)
|
||||
struct dpcon_cmd_open {
|
||||
uint32_t dpcon_id;
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPCON_CMD_OPEN(cmd, dpcon_id) \
|
||||
MC_CMD_OP(cmd, 0, 0, 32, int, dpcon_id)
|
||||
struct dpcon_cmd_create {
|
||||
uint8_t num_priorities;
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPCON_CMD_CREATE(cmd, cfg) \
|
||||
MC_CMD_OP(cmd, 0, 0, 8, uint8_t, cfg->num_priorities)
|
||||
struct dpcon_cmd_destroy {
|
||||
uint32_t object_id;
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPCON_RSP_IS_ENABLED(cmd, en) \
|
||||
MC_RSP_OP(cmd, 0, 0, 1, int, en)
|
||||
#define DPCON_ENABLE 1
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPCON_CMD_SET_IRQ(cmd, irq_index, irq_cfg) \
|
||||
do { \
|
||||
MC_CMD_OP(cmd, 0, 0, 8, uint8_t, irq_index);\
|
||||
MC_CMD_OP(cmd, 0, 32, 32, uint32_t, irq_cfg->val);\
|
||||
MC_CMD_OP(cmd, 1, 0, 64, uint64_t, irq_cfg->addr);\
|
||||
MC_CMD_OP(cmd, 2, 0, 32, int, irq_cfg->irq_num); \
|
||||
} while (0)
|
||||
struct dpcon_rsp_is_enabled {
|
||||
uint8_t enabled;
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPCON_CMD_GET_IRQ(cmd, irq_index) \
|
||||
MC_CMD_OP(cmd, 0, 32, 8, uint8_t, irq_index)
|
||||
struct dpcon_rsp_get_attr {
|
||||
uint32_t id;
|
||||
uint16_t qbman_ch_id;
|
||||
uint8_t num_priorities;
|
||||
uint8_t pad;
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPCON_RSP_GET_IRQ(cmd, type, irq_cfg) \
|
||||
do { \
|
||||
MC_RSP_OP(cmd, 0, 0, 32, uint32_t, irq_cfg->val);\
|
||||
MC_RSP_OP(cmd, 1, 0, 64, uint64_t, irq_cfg->addr);\
|
||||
MC_RSP_OP(cmd, 2, 0, 32, int, irq_cfg->irq_num); \
|
||||
MC_RSP_OP(cmd, 2, 32, 32, int, type);\
|
||||
} while (0)
|
||||
struct dpcon_cmd_set_notification {
|
||||
uint32_t dpio_id;
|
||||
uint8_t priority;
|
||||
uint8_t pad[3];
|
||||
uint64_t user_ctx;
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPCON_CMD_SET_IRQ_ENABLE(cmd, irq_index, en) \
|
||||
do { \
|
||||
MC_CMD_OP(cmd, 0, 0, 8, uint8_t, en); \
|
||||
MC_CMD_OP(cmd, 0, 32, 8, uint8_t, irq_index);\
|
||||
} while (0)
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPCON_CMD_GET_IRQ_ENABLE(cmd, irq_index) \
|
||||
MC_CMD_OP(cmd, 0, 32, 8, uint8_t, irq_index)
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPCON_RSP_GET_IRQ_ENABLE(cmd, en) \
|
||||
MC_RSP_OP(cmd, 0, 0, 8, uint8_t, en)
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPCON_CMD_SET_IRQ_MASK(cmd, irq_index, mask) \
|
||||
do { \
|
||||
MC_CMD_OP(cmd, 0, 0, 32, uint32_t, mask); \
|
||||
MC_CMD_OP(cmd, 0, 32, 8, uint8_t, irq_index);\
|
||||
} while (0)
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPCON_CMD_GET_IRQ_MASK(cmd, irq_index) \
|
||||
MC_CMD_OP(cmd, 0, 32, 8, uint8_t, irq_index)
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPCON_RSP_GET_IRQ_MASK(cmd, mask) \
|
||||
MC_RSP_OP(cmd, 0, 0, 32, uint32_t, mask)
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPCON_CMD_GET_IRQ_STATUS(cmd, irq_index, status) \
|
||||
do { \
|
||||
MC_CMD_OP(cmd, 0, 0, 32, uint32_t, status);\
|
||||
MC_CMD_OP(cmd, 0, 32, 8, uint8_t, irq_index);\
|
||||
} while (0)
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPCON_RSP_GET_IRQ_STATUS(cmd, status) \
|
||||
MC_RSP_OP(cmd, 0, 0, 32, uint32_t, status)
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPCON_CMD_CLEAR_IRQ_STATUS(cmd, irq_index, status) \
|
||||
do { \
|
||||
MC_CMD_OP(cmd, 0, 0, 32, uint32_t, status); \
|
||||
MC_CMD_OP(cmd, 0, 32, 8, uint8_t, irq_index);\
|
||||
} while (0)
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPCON_RSP_GET_ATTR(cmd, attr) \
|
||||
do { \
|
||||
MC_RSP_OP(cmd, 0, 0, 32, int, attr->id);\
|
||||
MC_RSP_OP(cmd, 0, 32, 16, uint16_t, attr->qbman_ch_id);\
|
||||
MC_RSP_OP(cmd, 0, 48, 8, uint8_t, attr->num_priorities);\
|
||||
} while (0)
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPCON_CMD_SET_NOTIFICATION(cmd, cfg) \
|
||||
do { \
|
||||
MC_CMD_OP(cmd, 0, 0, 32, int, cfg->dpio_id);\
|
||||
MC_CMD_OP(cmd, 0, 32, 8, uint8_t, cfg->priority);\
|
||||
MC_CMD_OP(cmd, 1, 0, 64, uint64_t, cfg->user_ctx);\
|
||||
} while (0)
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPCON_RSP_GET_API_VERSION(cmd, major, minor) \
|
||||
do { \
|
||||
MC_RSP_OP(cmd, 0, 0, 16, uint16_t, major);\
|
||||
MC_RSP_OP(cmd, 0, 16, 16, uint16_t, minor);\
|
||||
} while (0)
|
||||
struct dpcon_rsp_get_api_version {
|
||||
uint16_t major;
|
||||
uint16_t minor;
|
||||
};
|
||||
|
||||
#pragma pack(pop)
|
||||
#endif /* _FSL_DPCON_CMD_H */
|
||||
|
@ -5,7 +5,7 @@
|
||||
* BSD LICENSE
|
||||
*
|
||||
* Copyright 2013-2016 Freescale Semiconductor Inc.
|
||||
* Copyright 2016 NXP.
|
||||
* Copyright 2016-2017 NXP.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@ -46,44 +46,19 @@
|
||||
|
||||
struct fsl_mc_io;
|
||||
|
||||
/**
|
||||
* dpio_open() - Open a control session for the specified object
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @dpio_id: DPIO unique ID
|
||||
* @token: Returned token; use in subsequent API calls
|
||||
*
|
||||
* This function can be used to open a control session for an
|
||||
* already created object; an object may have been declared in
|
||||
* the DPL or by calling the dpio_create() function.
|
||||
* This function returns a unique authentication token,
|
||||
* associated with the specific object ID and any MC portals
|
||||
* assigned to the parent container; this token must be used in
|
||||
* all subsequent commands for this specific object.
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpio_open(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
int dpio_id,
|
||||
uint16_t *token);
|
||||
int dpio_open(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
int dpio_id,
|
||||
uint16_t *token);
|
||||
|
||||
/**
|
||||
* dpio_close() - Close the control session of the object
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPIO object
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpio_close(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token);
|
||||
int dpio_close(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token);
|
||||
|
||||
/**
|
||||
* enum dpio_channel_mode - DPIO notification channel mode
|
||||
* @DPIO_NO_CHANNEL: No support for notification channel
|
||||
* @DPIO_LOCAL_CHANNEL: Notifications on data availability can be received by a
|
||||
* @DPIO_NO_CHANNEL: No support for notification channel
|
||||
* @DPIO_LOCAL_CHANNEL: Notifications on data availability can be received by a
|
||||
* dedicated channel in the DPIO; user should point the queue's
|
||||
* destination in the relevant interface to this DPIO
|
||||
*/
|
||||
@ -94,216 +69,94 @@ enum dpio_channel_mode {
|
||||
|
||||
/**
|
||||
* struct dpio_cfg - Structure representing DPIO configuration
|
||||
* @channel_mode: Notification channel mode
|
||||
* @num_priorities: Number of priorities for the notification channel (1-8);
|
||||
* @channel_mode: Notification channel mode
|
||||
* @num_priorities: Number of priorities for the notification channel (1-8);
|
||||
* relevant only if 'channel_mode = DPIO_LOCAL_CHANNEL'
|
||||
*/
|
||||
struct dpio_cfg {
|
||||
enum dpio_channel_mode channel_mode;
|
||||
uint8_t num_priorities;
|
||||
enum dpio_channel_mode channel_mode;
|
||||
uint8_t num_priorities;
|
||||
};
|
||||
|
||||
/**
|
||||
* dpio_create() - Create the DPIO 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 DPIO 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 dpio_create(struct fsl_mc_io *mc_io,
|
||||
uint16_t dprc_token,
|
||||
uint32_t cmd_flags,
|
||||
const struct dpio_cfg *cfg,
|
||||
uint32_t *obj_id);
|
||||
|
||||
/**
|
||||
* dpio_destroy() - Destroy the DPIO object and release all its resources.
|
||||
* @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_'
|
||||
* @object_id: The object id; it must be a valid id within the container that
|
||||
* created this object;
|
||||
*
|
||||
* The function accepts the authentication token of the parent container that
|
||||
* created the object (not the one that currently owns the object). The object
|
||||
* is searched within parent using the provided 'object_id'.
|
||||
* All tokens to the object must be closed before calling destroy.
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise
|
||||
*/
|
||||
int dpio_destroy(struct fsl_mc_io *mc_io,
|
||||
uint16_t dprc_token,
|
||||
uint32_t cmd_flags,
|
||||
uint32_t object_id);
|
||||
int dpio_create(struct fsl_mc_io *mc_io,
|
||||
uint16_t dprc_token,
|
||||
uint32_t cmd_flags,
|
||||
const struct dpio_cfg *cfg,
|
||||
uint32_t *obj_id);
|
||||
|
||||
/**
|
||||
* dpio_enable() - Enable the DPIO, allow I/O portal operations.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPIO object
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise
|
||||
*/
|
||||
int dpio_enable(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token);
|
||||
int dpio_destroy(struct fsl_mc_io *mc_io,
|
||||
uint16_t dprc_token,
|
||||
uint32_t cmd_flags,
|
||||
uint32_t object_id);
|
||||
|
||||
/**
|
||||
* dpio_disable() - Disable the DPIO, stop any I/O portal operation.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPIO object
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise
|
||||
*/
|
||||
int dpio_disable(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token);
|
||||
int dpio_enable(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token);
|
||||
|
||||
/**
|
||||
* dpio_is_enabled() - Check if the DPIO is enabled.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPIO object
|
||||
* @en: Returns '1' if object is enabled; '0' otherwise
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpio_is_enabled(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
int *en);
|
||||
int dpio_disable(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token);
|
||||
|
||||
/**
|
||||
* dpio_reset() - Reset the DPIO, returns the object to initial state.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPIO object
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpio_reset(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token);
|
||||
int dpio_is_enabled(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
int *en);
|
||||
|
||||
/**
|
||||
* dpio_set_stashing_destination() - Set the stashing 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 DPIO object
|
||||
* @sdest: stashing destination value
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpio_set_stashing_destination(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
uint8_t sdest);
|
||||
int dpio_reset(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token);
|
||||
|
||||
/**
|
||||
* dpio_get_stashing_destination() - Get the stashing 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 DPIO object
|
||||
* @sdest: Returns the stashing destination value
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpio_get_stashing_destination(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
uint8_t *sdest);
|
||||
int dpio_set_stashing_destination(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
uint8_t sdest);
|
||||
|
||||
/**
|
||||
* dpio_add_static_dequeue_channel() - Add a static dequeue channel.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPIO object
|
||||
* @dpcon_id: DPCON object ID
|
||||
* @channel_index: Returned channel index to be used in qbman API
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpio_add_static_dequeue_channel(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
int dpcon_id,
|
||||
uint8_t *channel_index);
|
||||
int dpio_get_stashing_destination(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
uint8_t *sdest);
|
||||
|
||||
/**
|
||||
* dpio_remove_static_dequeue_channel() - Remove a static dequeue channel.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPIO object
|
||||
* @dpcon_id: DPCON object ID
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpio_remove_static_dequeue_channel(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
int dpcon_id);
|
||||
int dpio_add_static_dequeue_channel(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
int dpcon_id,
|
||||
uint8_t *channel_index);
|
||||
|
||||
int dpio_remove_static_dequeue_channel(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
int dpcon_id);
|
||||
|
||||
/**
|
||||
* struct dpio_attr - Structure representing DPIO attributes
|
||||
* @id: DPIO object ID
|
||||
* @qbman_portal_ce_offset: offset of the software portal cache-enabled area
|
||||
* @qbman_portal_ci_offset: offset of the software portal cache-inhibited area
|
||||
* @qbman_portal_id: Software portal ID
|
||||
* @channel_mode: Notification channel mode
|
||||
* @num_priorities: Number of priorities for the notification channel (1-8);
|
||||
* relevant only if 'channel_mode = DPIO_LOCAL_CHANNEL'
|
||||
* @qbman_version: QBMAN version
|
||||
* @id: DPIO object ID
|
||||
* @qbman_portal_ce_offset: Offset of the software portal cache-enabled area
|
||||
* @qbman_portal_ci_offset: Offset of the software portal
|
||||
* cache-inhibited area
|
||||
* @qbman_portal_id: Software portal ID
|
||||
* @channel_mode: Notification channel mode
|
||||
* @num_priorities: Number of priorities for the notification
|
||||
* channel (1-8); relevant only if
|
||||
* 'channel_mode = DPIO_LOCAL_CHANNEL'
|
||||
* @qbman_version: QBMAN version
|
||||
*/
|
||||
struct dpio_attr {
|
||||
int id;
|
||||
uint64_t qbman_portal_ce_offset;
|
||||
uint64_t qbman_portal_ci_offset;
|
||||
uint16_t qbman_portal_id;
|
||||
enum dpio_channel_mode channel_mode;
|
||||
uint8_t num_priorities;
|
||||
uint32_t qbman_version;
|
||||
uint32_t clk;
|
||||
int id;
|
||||
uint64_t qbman_portal_ce_offset;
|
||||
uint64_t qbman_portal_ci_offset;
|
||||
uint16_t qbman_portal_id;
|
||||
enum dpio_channel_mode channel_mode;
|
||||
uint8_t num_priorities;
|
||||
uint32_t qbman_version;
|
||||
uint32_t clk;
|
||||
};
|
||||
|
||||
/**
|
||||
* dpio_get_attributes() - Retrieve DPIO attributes
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPIO object
|
||||
* @attr: Returned object's attributes
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise
|
||||
*/
|
||||
int dpio_get_attributes(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
struct dpio_attr *attr);
|
||||
int dpio_get_attributes(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
struct dpio_attr *attr);
|
||||
|
||||
/**
|
||||
* dpio_get_api_version() - Get Data Path I/O API version
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @major_ver: Major version of data path i/o API
|
||||
* @minor_ver: Minor version of data path i/o API
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpio_get_api_version(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t *major_ver,
|
||||
|
@ -5,7 +5,7 @@
|
||||
* BSD LICENSE
|
||||
*
|
||||
* Copyright 2013-2016 Freescale Semiconductor Inc.
|
||||
* Copyright 2016 NXP.
|
||||
* Copyright 2016-2017 NXP.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@ -41,82 +41,108 @@
|
||||
#define _FSL_DPIO_CMD_H
|
||||
|
||||
/* DPIO Version */
|
||||
#define DPIO_VER_MAJOR 4
|
||||
#define DPIO_VER_MINOR 2
|
||||
#define DPIO_VER_MAJOR 4
|
||||
#define DPIO_VER_MINOR 2
|
||||
|
||||
#define DPIO_CMD_BASE_VERSION 1
|
||||
#define DPIO_CMD_ID_OFFSET 4
|
||||
|
||||
#define DPIO_CMD(id) (((id) << DPIO_CMD_ID_OFFSET) | DPIO_CMD_BASE_VERSION)
|
||||
|
||||
/* Command IDs */
|
||||
#define DPIO_CMDID_CLOSE 0x8001
|
||||
#define DPIO_CMDID_OPEN 0x8031
|
||||
#define DPIO_CMDID_CREATE 0x9031
|
||||
#define DPIO_CMDID_DESTROY 0x9831
|
||||
#define DPIO_CMDID_GET_API_VERSION 0xa031
|
||||
#define DPIO_CMDID_CLOSE DPIO_CMD(0x800)
|
||||
#define DPIO_CMDID_OPEN DPIO_CMD(0x803)
|
||||
#define DPIO_CMDID_CREATE DPIO_CMD(0x903)
|
||||
#define DPIO_CMDID_DESTROY DPIO_CMD(0x983)
|
||||
#define DPIO_CMDID_GET_API_VERSION DPIO_CMD(0xa03)
|
||||
|
||||
#define DPIO_CMDID_ENABLE 0x0021
|
||||
#define DPIO_CMDID_DISABLE 0x0031
|
||||
#define DPIO_CMDID_GET_ATTR 0x0041
|
||||
#define DPIO_CMDID_RESET 0x0051
|
||||
#define DPIO_CMDID_IS_ENABLED 0x0061
|
||||
#define DPIO_CMDID_ENABLE DPIO_CMD(0x002)
|
||||
#define DPIO_CMDID_DISABLE DPIO_CMD(0x003)
|
||||
#define DPIO_CMDID_GET_ATTR DPIO_CMD(0x004)
|
||||
#define DPIO_CMDID_RESET DPIO_CMD(0x005)
|
||||
#define DPIO_CMDID_IS_ENABLED DPIO_CMD(0x006)
|
||||
|
||||
#define DPIO_CMDID_SET_STASHING_DEST 0x1201
|
||||
#define DPIO_CMDID_GET_STASHING_DEST 0x1211
|
||||
#define DPIO_CMDID_ADD_STATIC_DEQUEUE_CHANNEL 0x1221
|
||||
#define DPIO_CMDID_REMOVE_STATIC_DEQUEUE_CHANNEL 0x1231
|
||||
#define DPIO_CMDID_SET_IRQ_ENABLE DPIO_CMD(0x012)
|
||||
#define DPIO_CMDID_GET_IRQ_ENABLE DPIO_CMD(0x013)
|
||||
#define DPIO_CMDID_SET_IRQ_MASK DPIO_CMD(0x014)
|
||||
#define DPIO_CMDID_GET_IRQ_MASK DPIO_CMD(0x015)
|
||||
#define DPIO_CMDID_GET_IRQ_STATUS DPIO_CMD(0x016)
|
||||
#define DPIO_CMDID_CLEAR_IRQ_STATUS DPIO_CMD(0x017)
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPIO_CMD_OPEN(cmd, dpio_id) \
|
||||
MC_CMD_OP(cmd, 0, 0, 32, uint32_t, dpio_id)
|
||||
#define DPIO_CMDID_SET_STASHING_DEST DPIO_CMD(0x120)
|
||||
#define DPIO_CMDID_GET_STASHING_DEST DPIO_CMD(0x121)
|
||||
#define DPIO_CMDID_ADD_STATIC_DEQUEUE_CHANNEL DPIO_CMD(0x122)
|
||||
#define DPIO_CMDID_REMOVE_STATIC_DEQUEUE_CHANNEL DPIO_CMD(0x123)
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPIO_CMD_CREATE(cmd, cfg) \
|
||||
do { \
|
||||
MC_CMD_OP(cmd, 0, 16, 2, enum dpio_channel_mode, \
|
||||
cfg->channel_mode);\
|
||||
MC_CMD_OP(cmd, 0, 32, 8, uint8_t, cfg->num_priorities);\
|
||||
} while (0)
|
||||
/* Macros for accessing command fields smaller than 1byte */
|
||||
#define DPIO_MASK(field) \
|
||||
GENMASK(DPIO_##field##_SHIFT + DPIO_##field##_SIZE - 1, \
|
||||
DPIO_##field##_SHIFT)
|
||||
#define dpio_set_field(var, field, val) \
|
||||
((var) |= (((val) << DPIO_##field##_SHIFT) & DPIO_MASK(field)))
|
||||
#define dpio_get_field(var, field) \
|
||||
(((var) & DPIO_MASK(field)) >> DPIO_##field##_SHIFT)
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPIO_RSP_IS_ENABLED(cmd, en) \
|
||||
MC_RSP_OP(cmd, 0, 0, 1, int, en)
|
||||
#pragma pack(push, 1)
|
||||
struct dpio_cmd_open {
|
||||
uint32_t dpio_id;
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPIO_RSP_GET_ATTRIBUTES(cmd, attr) \
|
||||
do { \
|
||||
MC_RSP_OP(cmd, 0, 0, 32, int, (attr)->id);\
|
||||
MC_RSP_OP(cmd, 0, 32, 16, uint16_t, (attr)->qbman_portal_id);\
|
||||
MC_RSP_OP(cmd, 0, 48, 8, uint8_t, (attr)->num_priorities);\
|
||||
MC_RSP_OP(cmd, 0, 56, 4, enum dpio_channel_mode,\
|
||||
(attr)->channel_mode);\
|
||||
MC_RSP_OP(cmd, 1, 0, 64, uint64_t, (attr)->qbman_portal_ce_offset);\
|
||||
MC_RSP_OP(cmd, 2, 0, 64, uint64_t, (attr)->qbman_portal_ci_offset);\
|
||||
MC_RSP_OP(cmd, 3, 0, 32, uint32_t, (attr)->qbman_version);\
|
||||
MC_RSP_OP(cmd, 4, 0, 32, uint32_t, (attr)->clk);\
|
||||
} while (0)
|
||||
#define DPIO_CHANNEL_MODE_SHIFT 0
|
||||
#define DPIO_CHANNEL_MODE_SIZE 2
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPIO_CMD_SET_STASHING_DEST(cmd, sdest) \
|
||||
MC_CMD_OP(cmd, 0, 0, 8, uint8_t, sdest)
|
||||
struct dpio_cmd_create {
|
||||
uint16_t pad1;
|
||||
/* from LSB: channel_mode:2 */
|
||||
uint8_t channel_mode;
|
||||
uint8_t pad2;
|
||||
uint8_t num_priorities;
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPIO_RSP_GET_STASHING_DEST(cmd, sdest) \
|
||||
MC_RSP_OP(cmd, 0, 0, 8, uint8_t, sdest)
|
||||
struct dpio_cmd_destroy {
|
||||
uint32_t dpio_id;
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPIO_CMD_ADD_STATIC_DEQUEUE_CHANNEL(cmd, dpcon_id) \
|
||||
MC_CMD_OP(cmd, 0, 0, 32, int, dpcon_id)
|
||||
#define DPIO_ENABLE_SHIFT 0
|
||||
#define DPIO_ENABLE_SIZE 1
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPIO_RSP_ADD_STATIC_DEQUEUE_CHANNEL(cmd, channel_index) \
|
||||
MC_RSP_OP(cmd, 0, 0, 8, uint8_t, channel_index)
|
||||
struct dpio_rsp_is_enabled {
|
||||
/* only the LSB */
|
||||
uint8_t en;
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPIO_CMD_REMOVE_STATIC_DEQUEUE_CHANNEL(cmd, dpcon_id) \
|
||||
MC_CMD_OP(cmd, 0, 0, 32, int, dpcon_id)
|
||||
#define DPIO_ATTR_CHANNEL_MODE_SHIFT 0
|
||||
#define DPIO_ATTR_CHANNEL_MODE_SIZE 4
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPIO_RSP_GET_API_VERSION(cmd, major, minor) \
|
||||
do { \
|
||||
MC_RSP_OP(cmd, 0, 0, 16, uint16_t, major);\
|
||||
MC_RSP_OP(cmd, 0, 16, 16, uint16_t, minor);\
|
||||
} while (0)
|
||||
struct dpio_rsp_get_attr {
|
||||
uint32_t id;
|
||||
uint16_t qbman_portal_id;
|
||||
uint8_t num_priorities;
|
||||
/* from LSB: channel_mode:4 */
|
||||
uint8_t channel_mode;
|
||||
uint64_t qbman_portal_ce_offset;
|
||||
uint64_t qbman_portal_ci_offset;
|
||||
uint32_t qbman_version;
|
||||
uint32_t pad;
|
||||
uint32_t clk;
|
||||
};
|
||||
|
||||
struct dpio_stashing_dest {
|
||||
uint8_t sdest;
|
||||
};
|
||||
|
||||
struct dpio_cmd_static_dequeue_channel {
|
||||
uint32_t dpcon_id;
|
||||
};
|
||||
|
||||
struct dpio_rsp_add_static_dequeue_channel {
|
||||
uint8_t channel_index;
|
||||
};
|
||||
|
||||
struct dpio_rsp_get_api_version {
|
||||
uint16_t major;
|
||||
uint16_t minor;
|
||||
};
|
||||
|
||||
#pragma pack(pop)
|
||||
#endif /* _FSL_DPIO_CMD_H */
|
||||
|
@ -5,6 +5,7 @@
|
||||
* BSD LICENSE
|
||||
*
|
||||
* Copyright 2013-2015 Freescale Semiconductor Inc.
|
||||
* Copyright 2017 NXP.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@ -39,7 +40,8 @@
|
||||
#ifndef __FSL_DPMNG_H
|
||||
#define __FSL_DPMNG_H
|
||||
|
||||
/* Management Complex General API
|
||||
/*
|
||||
* Management Complex General API
|
||||
* Contains general API for the Management Complex firmware
|
||||
*/
|
||||
|
||||
@ -49,10 +51,10 @@ struct fsl_mc_io;
|
||||
* Management Complex firmware version information
|
||||
*/
|
||||
#define MC_VER_MAJOR 10
|
||||
#define MC_VER_MINOR 1
|
||||
#define MC_VER_MINOR 3
|
||||
|
||||
/**
|
||||
* struct mc_versoin
|
||||
* struct mc_version
|
||||
* @major: Major version number: incremented on API compatibility changes
|
||||
* @minor: Minor version number: incremented on API additions (that are
|
||||
* backward compatible); reset when major version is incremented
|
||||
@ -65,42 +67,21 @@ struct mc_version {
|
||||
uint32_t revision;
|
||||
};
|
||||
|
||||
int mc_get_version(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
struct mc_version *mc_ver_info);
|
||||
|
||||
/**
|
||||
* struct mc_platform
|
||||
* @svr: system version (content of platform SVR register)
|
||||
* @pvr: processor version (content of platform PVR register)
|
||||
* @svr: System version (content of platform SVR register)
|
||||
* @pvr: Processor version (content of platform PVR register)
|
||||
*/
|
||||
struct mc_soc_version {
|
||||
uint32_t svr;
|
||||
uint32_t pvr;
|
||||
};
|
||||
|
||||
/**
|
||||
* mc_get_version() - Retrieves the Management Complex firmware
|
||||
* version information
|
||||
* @mc_io: Pointer to opaque I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @mc_ver_info: Returned version information structure
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int mc_get_version(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
struct mc_version *mc_ver_info);
|
||||
|
||||
/**
|
||||
* mc_get_soc_version() - Retrieves the Management Complex firmware
|
||||
* version information
|
||||
* @mc_io: Pointer to opaque I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @mc_platform_info: Returned version information structure. The structure
|
||||
* contains the values of SVR and PVR registers. Please consult platform
|
||||
* specific reference manual for detailed information.
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int mc_get_soc_version(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
struct mc_soc_version *mc_platform_info);
|
||||
|
||||
#endif /* __FSL_DPMNG_H */
|
||||
|
@ -5,6 +5,7 @@
|
||||
* BSD LICENSE
|
||||
*
|
||||
* Copyright 2013-2016 Freescale Semiconductor Inc.
|
||||
* Copyright 2017 NXP.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@ -36,26 +37,32 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __FSL_DPMNG_CMD_H
|
||||
#define __FSL_DPMNG_CMD_H
|
||||
|
||||
/* Command versioning */
|
||||
#define DPMNG_CMD_BASE_VERSION 1
|
||||
#define DPMNG_CMD_ID_OFFSET 4
|
||||
|
||||
#define DPMNG_CMD(id) ((id << DPMNG_CMD_ID_OFFSET) | DPMNG_CMD_BASE_VERSION)
|
||||
|
||||
/* Command IDs */
|
||||
#define DPMNG_CMDID_GET_VERSION 0x8311
|
||||
#define DPMNG_CMDID_GET_SOC_VERSION 0x8321
|
||||
#define DPMNG_CMDID_GET_VERSION DPMNG_CMD(0x831)
|
||||
#define DPMNG_CMDID_GET_SOC_VERSION DPMNG_CMD(0x832)
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPMNG_RSP_GET_VERSION(cmd, mc_ver_info) \
|
||||
do { \
|
||||
MC_RSP_OP(cmd, 0, 0, 32, uint32_t, mc_ver_info->revision); \
|
||||
MC_RSP_OP(cmd, 0, 32, 32, uint32_t, mc_ver_info->major); \
|
||||
MC_RSP_OP(cmd, 1, 0, 32, uint32_t, mc_ver_info->minor); \
|
||||
} while (0)
|
||||
#pragma pack(push, 1)
|
||||
struct dpmng_rsp_get_version {
|
||||
uint32_t revision;
|
||||
uint32_t version_major;
|
||||
uint32_t version_minor;
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPMNG_RSP_GET_SOC_VERSION(cmd, mc_soc_version) \
|
||||
do { \
|
||||
MC_RSP_OP(cmd, 0, 0, 32, uint32_t, mc_soc_version->svr); \
|
||||
MC_RSP_OP(cmd, 0, 32, 32, uint32_t, mc_soc_version->pvr); \
|
||||
} while (0)
|
||||
struct dpmng_rsp_get_soc_version {
|
||||
uint32_t svr;
|
||||
uint32_t pvr;
|
||||
};
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
#endif /* __FSL_DPMNG_CMD_H */
|
||||
|
@ -5,7 +5,7 @@
|
||||
* BSD LICENSE
|
||||
*
|
||||
* Copyright 2013-2016 Freescale Semiconductor Inc.
|
||||
* Copyright 2016 NXP.
|
||||
* Copyright 2016-2017 NXP.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@ -40,146 +40,118 @@
|
||||
#ifndef __FSL_MC_CMD_H
|
||||
#define __FSL_MC_CMD_H
|
||||
|
||||
#include <rte_byteorder.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define MC_CMD_NUM_OF_PARAMS 7
|
||||
|
||||
#define MAKE_UMASK64(_width) \
|
||||
((uint64_t)((_width) < 64 ? ((uint64_t)1 << (_width)) - 1 : \
|
||||
(uint64_t)-1))
|
||||
#define phys_addr_t uint64_t
|
||||
|
||||
static inline uint64_t mc_enc(int lsoffset, int width, uint64_t val)
|
||||
{
|
||||
return (uint64_t)(((uint64_t)val & MAKE_UMASK64(width)) << lsoffset);
|
||||
}
|
||||
#define u64 uint64_t
|
||||
#define u32 uint32_t
|
||||
#define u16 uint16_t
|
||||
#define u8 uint8_t
|
||||
|
||||
static inline uint64_t mc_dec(uint64_t val, int lsoffset, int width)
|
||||
{
|
||||
return (uint64_t)((val >> lsoffset) & MAKE_UMASK64(width));
|
||||
}
|
||||
#define cpu_to_le64 rte_cpu_to_le_64
|
||||
#define cpu_to_le32 rte_cpu_to_le_32
|
||||
#define cpu_to_le16 rte_cpu_to_le_16
|
||||
|
||||
#define le64_to_cpu rte_le_to_cpu_64
|
||||
#define le32_to_cpu rte_le_to_cpu_32
|
||||
#define le16_to_cpu rte_le_to_cpu_16
|
||||
|
||||
#define BITS_PER_LONG 64
|
||||
#define GENMASK(h, l) \
|
||||
(((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h))))
|
||||
|
||||
struct mc_cmd_header {
|
||||
union {
|
||||
struct {
|
||||
uint8_t src_id;
|
||||
uint8_t flags_hw;
|
||||
uint8_t status;
|
||||
uint8_t flags_sw;
|
||||
uint16_t token;
|
||||
uint16_t cmd_id;
|
||||
};
|
||||
uint32_t word[2];
|
||||
};
|
||||
};
|
||||
|
||||
struct mc_command {
|
||||
uint64_t header;
|
||||
uint64_t params[MC_CMD_NUM_OF_PARAMS];
|
||||
};
|
||||
|
||||
/**
|
||||
* enum mc_cmd_status - indicates MC status at command response
|
||||
* @MC_CMD_STATUS_OK: Completed successfully
|
||||
* @MC_CMD_STATUS_READY: Ready to be processed
|
||||
* @MC_CMD_STATUS_AUTH_ERR: Authentication error
|
||||
* @MC_CMD_STATUS_NO_PRIVILEGE: No privilege
|
||||
* @MC_CMD_STATUS_DMA_ERR: DMA or I/O error
|
||||
* @MC_CMD_STATUS_CONFIG_ERR: Configuration error
|
||||
* @MC_CMD_STATUS_TIMEOUT: Operation timed out
|
||||
* @MC_CMD_STATUS_NO_RESOURCE: No resources
|
||||
* @MC_CMD_STATUS_NO_MEMORY: No memory available
|
||||
* @MC_CMD_STATUS_BUSY: Device is busy
|
||||
* @MC_CMD_STATUS_UNSUPPORTED_OP: Unsupported operation
|
||||
* @MC_CMD_STATUS_INVALID_STATE: Invalid state
|
||||
*/
|
||||
enum mc_cmd_status {
|
||||
MC_CMD_STATUS_OK = 0x0,
|
||||
MC_CMD_STATUS_READY = 0x1,
|
||||
MC_CMD_STATUS_AUTH_ERR = 0x3,
|
||||
MC_CMD_STATUS_NO_PRIVILEGE = 0x4,
|
||||
MC_CMD_STATUS_DMA_ERR = 0x5,
|
||||
MC_CMD_STATUS_CONFIG_ERR = 0x6,
|
||||
MC_CMD_STATUS_TIMEOUT = 0x7,
|
||||
MC_CMD_STATUS_NO_RESOURCE = 0x8,
|
||||
MC_CMD_STATUS_NO_MEMORY = 0x9,
|
||||
MC_CMD_STATUS_BUSY = 0xA,
|
||||
MC_CMD_STATUS_UNSUPPORTED_OP = 0xB,
|
||||
MC_CMD_STATUS_INVALID_STATE = 0xC
|
||||
struct mc_rsp_create {
|
||||
uint32_t object_id;
|
||||
};
|
||||
|
||||
/* MC command flags */
|
||||
enum mc_cmd_status {
|
||||
MC_CMD_STATUS_OK = 0x0, /* Completed successfully */
|
||||
MC_CMD_STATUS_READY = 0x1, /* Ready to be processed */
|
||||
MC_CMD_STATUS_AUTH_ERR = 0x3, /* Authentication error */
|
||||
MC_CMD_STATUS_NO_PRIVILEGE = 0x4, /* No privilege */
|
||||
MC_CMD_STATUS_DMA_ERR = 0x5, /* DMA or I/O error */
|
||||
MC_CMD_STATUS_CONFIG_ERR = 0x6, /* Configuration error */
|
||||
MC_CMD_STATUS_TIMEOUT = 0x7, /* Operation timed out */
|
||||
MC_CMD_STATUS_NO_RESOURCE = 0x8, /* No resources */
|
||||
MC_CMD_STATUS_NO_MEMORY = 0x9, /* No memory available */
|
||||
MC_CMD_STATUS_BUSY = 0xA, /* Device is busy */
|
||||
MC_CMD_STATUS_UNSUPPORTED_OP = 0xB, /* Unsupported operation */
|
||||
MC_CMD_STATUS_INVALID_STATE = 0xC /* Invalid state */
|
||||
};
|
||||
|
||||
/**
|
||||
* High priority flag
|
||||
/*
|
||||
* MC command flags
|
||||
*/
|
||||
#define MC_CMD_FLAG_PRI 0x00008000
|
||||
/**
|
||||
* Command completion flag
|
||||
*/
|
||||
#define MC_CMD_FLAG_INTR_DIS 0x01000000
|
||||
|
||||
/**
|
||||
* Command ID field offset
|
||||
*/
|
||||
#define MC_CMD_HDR_CMDID_O 48
|
||||
/**
|
||||
* Command ID field size
|
||||
*/
|
||||
#define MC_CMD_HDR_CMDID_S 16
|
||||
/**
|
||||
* Token field offset
|
||||
*/
|
||||
#define MC_CMD_HDR_TOKEN_O 32
|
||||
/**
|
||||
* Token field size
|
||||
*/
|
||||
#define MC_CMD_HDR_TOKEN_S 16
|
||||
/**
|
||||
* Status field offset
|
||||
*/
|
||||
#define MC_CMD_HDR_STATUS_O 16
|
||||
/**
|
||||
* Status field size
|
||||
*/
|
||||
#define MC_CMD_HDR_STATUS_S 8
|
||||
/**
|
||||
* Flags field offset
|
||||
*/
|
||||
#define MC_CMD_HDR_FLAGS_O 0
|
||||
/**
|
||||
* Flags field size
|
||||
*/
|
||||
#define MC_CMD_HDR_FLAGS_S 32
|
||||
/**
|
||||
* Command flags mask
|
||||
*/
|
||||
/* High priority flag */
|
||||
#define MC_CMD_FLAG_PRI 0x80
|
||||
/* Command completion flag */
|
||||
#define MC_CMD_FLAG_INTR_DIS 0x01
|
||||
|
||||
#define MC_CMD_HDR_FLAGS_MASK 0xFF00FF00
|
||||
|
||||
#define MC_CMD_HDR_READ_STATUS(_hdr) \
|
||||
((enum mc_cmd_status)mc_dec((_hdr), \
|
||||
MC_CMD_HDR_STATUS_O, MC_CMD_HDR_STATUS_S))
|
||||
|
||||
#define MC_CMD_HDR_READ_TOKEN(_hdr) \
|
||||
((uint16_t)mc_dec((_hdr), MC_CMD_HDR_TOKEN_O, MC_CMD_HDR_TOKEN_S))
|
||||
|
||||
#define MC_PREP_OP(_ext, _param, _offset, _width, _type, _arg) \
|
||||
((_ext)[_param] |= cpu_to_le64(mc_enc((_offset), (_width), _arg)))
|
||||
|
||||
#define MC_EXT_OP(_ext, _param, _offset, _width, _type, _arg) \
|
||||
(_arg = (_type)mc_dec(cpu_to_le64(_ext[_param]), (_offset), (_width)))
|
||||
|
||||
#define MC_CMD_OP(_cmd, _param, _offset, _width, _type, _arg) \
|
||||
((_cmd).params[_param] |= mc_enc((_offset), (_width), _arg))
|
||||
|
||||
#define MC_RSP_OP(_cmd, _param, _offset, _width, _type, _arg) \
|
||||
(_arg = (_type)mc_dec(_cmd.params[_param], (_offset), (_width)))
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define CMD_CREATE_RSP_GET_OBJ_ID_PARAM0(cmd, object_id) \
|
||||
MC_RSP_OP(cmd, 0, 0, 32, uint32_t, object_id)
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define CMD_DESTROY_SET_OBJ_ID_PARAM0(cmd, object_id) \
|
||||
MC_CMD_OP(cmd, 0, 0, 32, uint32_t, object_id)
|
||||
int mc_send_command(struct fsl_mc_io *mc_io, struct mc_command *cmd);
|
||||
|
||||
static inline uint64_t mc_encode_cmd_header(uint16_t cmd_id,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token)
|
||||
{
|
||||
uint64_t hdr;
|
||||
uint64_t header = 0;
|
||||
struct mc_cmd_header *hdr = (struct mc_cmd_header *)&header;
|
||||
|
||||
hdr = mc_enc(MC_CMD_HDR_CMDID_O, MC_CMD_HDR_CMDID_S, cmd_id);
|
||||
hdr |= mc_enc(MC_CMD_HDR_FLAGS_O, MC_CMD_HDR_FLAGS_S,
|
||||
(cmd_flags & MC_CMD_HDR_FLAGS_MASK));
|
||||
hdr |= mc_enc(MC_CMD_HDR_TOKEN_O, MC_CMD_HDR_TOKEN_S, token);
|
||||
hdr |= mc_enc(MC_CMD_HDR_STATUS_O, MC_CMD_HDR_STATUS_S,
|
||||
MC_CMD_STATUS_READY);
|
||||
hdr->cmd_id = cpu_to_le16(cmd_id);
|
||||
hdr->token = cpu_to_le16(token);
|
||||
hdr->status = MC_CMD_STATUS_READY;
|
||||
hdr->word[0] |= cpu_to_le32(cmd_flags & MC_CMD_HDR_FLAGS_MASK);
|
||||
|
||||
return hdr;
|
||||
return header;
|
||||
}
|
||||
|
||||
static inline uint16_t mc_cmd_hdr_read_token(struct mc_command *cmd)
|
||||
{
|
||||
struct mc_cmd_header *hdr = (struct mc_cmd_header *)&cmd->header;
|
||||
uint16_t token = le16_to_cpu(hdr->token);
|
||||
|
||||
return token;
|
||||
}
|
||||
|
||||
static inline uint32_t mc_cmd_read_object_id(struct mc_command *cmd)
|
||||
{
|
||||
struct mc_rsp_create *rsp_params;
|
||||
|
||||
rsp_params = (struct mc_rsp_create *)cmd->params;
|
||||
return le32_to_cpu(rsp_params->object_id);
|
||||
}
|
||||
|
||||
static inline enum mc_cmd_status mc_cmd_read_status(struct mc_command *cmd)
|
||||
{
|
||||
struct mc_cmd_header *hdr = (struct mc_cmd_header *)&cmd->header;
|
||||
uint8_t status = hdr->status;
|
||||
|
||||
return (enum mc_cmd_status)status;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -191,20 +163,17 @@ static inline uint64_t mc_encode_cmd_header(uint16_t cmd_id,
|
||||
static inline void mc_write_command(struct mc_command __iomem *portal,
|
||||
struct mc_command *cmd)
|
||||
{
|
||||
int i;
|
||||
uint32_t word;
|
||||
struct mc_cmd_header *cmd_header = (struct mc_cmd_header *)&cmd->header;
|
||||
char *header = (char *)&portal->header;
|
||||
int i;
|
||||
|
||||
/* copy command parameters into the portal */
|
||||
for (i = 0; i < MC_CMD_NUM_OF_PARAMS; i++)
|
||||
iowrite64(cmd->params[i], &portal->params[i]);
|
||||
|
||||
/* submit the command by writing the header */
|
||||
word = (uint32_t)mc_dec(cmd->header, 32, 32);
|
||||
iowrite32(word, (((uint32_t *)header) + 1));
|
||||
|
||||
word = (uint32_t)mc_dec(cmd->header, 0, 32);
|
||||
iowrite32(word, (uint32_t *)header);
|
||||
iowrite32(le32_to_cpu(cmd_header->word[1]), (((uint32_t *)header) + 1));
|
||||
iowrite32(le32_to_cpu(cmd_header->word[0]), (uint32_t *)header);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -225,7 +194,7 @@ static inline enum mc_cmd_status mc_read_response(
|
||||
|
||||
/* Copy command response header from MC portal: */
|
||||
resp->header = ioread64(&portal->header);
|
||||
status = MC_CMD_HDR_READ_STATUS(resp->header);
|
||||
status = mc_cmd_read_status(resp);
|
||||
if (status != MC_CMD_STATUS_OK)
|
||||
return status;
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
* BSD LICENSE
|
||||
*
|
||||
* Copyright 2013-2015 Freescale Semiconductor Inc.
|
||||
* Copyright 2017 NXP.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@ -65,41 +66,32 @@ struct fsl_mc_io {
|
||||
#include <sys/uio.h>
|
||||
#include <linux/byteorder/little_endian.h>
|
||||
|
||||
#define cpu_to_le64(x) __cpu_to_le64(x)
|
||||
#ifndef dmb
|
||||
#define dmb() {__asm__ __volatile__("" : : : "memory"); }
|
||||
#endif
|
||||
#define __iormb() dmb()
|
||||
#define __iowmb() dmb()
|
||||
#define __arch_getq(a) (*(volatile unsigned long *)(a))
|
||||
#define __arch_putq(v, a) (*(volatile unsigned long *)(a) = (v))
|
||||
#define __arch_putq32(v, a) (*(volatile unsigned int *)(a) = (v))
|
||||
#define readq(c) \
|
||||
#define __iormb() dmb()
|
||||
#define __iowmb() dmb()
|
||||
#define __arch_getq(a) (*(volatile uint64_t *)(a))
|
||||
#define __arch_putq(v, a) (*(volatile uint64_t *)(a) = (v))
|
||||
#define __arch_putq32(v, a) (*(volatile uint32_t *)(a) = (v))
|
||||
#define readq(c) \
|
||||
({ uint64_t __v = __arch_getq(c); __iormb(); __v; })
|
||||
#define writeq(v, c) \
|
||||
#define writeq(v, c) \
|
||||
({ uint64_t __v = v; __iowmb(); __arch_putq(__v, c); __v; })
|
||||
#define writeq32(v, c) \
|
||||
({ uint32_t __v = v; __iowmb(); __arch_putq32(__v, c); __v; })
|
||||
#define ioread64(_p) readq(_p)
|
||||
#define iowrite64(_v, _p) writeq(_v, _p)
|
||||
#define iowrite32(_v, _p) writeq32(_v, _p)
|
||||
#define ioread64(_p) readq(_p)
|
||||
#define iowrite64(_v, _p) writeq(_v, _p)
|
||||
#define iowrite32(_v, _p) writeq32(_v, _p)
|
||||
#define __iomem
|
||||
|
||||
/*GPP is supposed to use MC commands with low priority*/
|
||||
#define CMD_PRI_LOW 0 /*!< Low Priority command indication */
|
||||
|
||||
struct fsl_mc_io {
|
||||
void *regs;
|
||||
};
|
||||
|
||||
#ifndef ENOTSUP
|
||||
#define ENOTSUP 95
|
||||
#endif
|
||||
|
||||
/*GPP is supposed to use MC commands with low priority*/
|
||||
#define CMD_PRI_LOW 0 /*!< Low Priority command indication */
|
||||
|
||||
struct mc_command;
|
||||
|
||||
int mc_send_command(struct fsl_mc_io *mc_io, struct mc_command *cmd);
|
||||
|
||||
#endif /* __linux_driver__ */
|
||||
|
||||
#endif /* _FSL_MC_SYS_H */
|
||||
|
@ -5,6 +5,7 @@
|
||||
* BSD LICENSE
|
||||
*
|
||||
* Copyright 2013-2015 Freescale Semiconductor Inc.
|
||||
* Copyright 2017 NXP.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@ -86,6 +87,7 @@ static int mc_status_to_error(enum mc_cmd_status status)
|
||||
int mc_send_command(struct fsl_mc_io *mc_io, struct mc_command *cmd)
|
||||
{
|
||||
enum mc_cmd_status status;
|
||||
uint64_t response;
|
||||
|
||||
if (!mc_io || !mc_io->regs)
|
||||
return -EACCES;
|
||||
@ -97,7 +99,8 @@ int mc_send_command(struct fsl_mc_io *mc_io, struct mc_command *cmd)
|
||||
|
||||
/* Spin until status changes */
|
||||
do {
|
||||
status = MC_CMD_HDR_READ_STATUS(ioread64(mc_io->regs));
|
||||
response = ioread64(mc_io->regs);
|
||||
status = mc_cmd_read_status((struct mc_command *)&response);
|
||||
|
||||
/* --- Call wait function here to prevent blocking ---
|
||||
* Change the loop condition accordingly to exit on timeout.
|
||||
|
@ -37,18 +37,34 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <fsl_mc_sys.h>
|
||||
#include <fsl_mc_cmd.h>
|
||||
#include <fsl_dpseci.h>
|
||||
#include <fsl_dpseci_cmd.h>
|
||||
|
||||
int
|
||||
dpseci_open(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
int dpseci_id,
|
||||
uint16_t *token)
|
||||
/**
|
||||
* dpseci_open() - Open a control session for the specified object
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @dpseci_id: DPSECI unique ID
|
||||
* @token: Returned token; use in subsequent API calls
|
||||
*
|
||||
* This function can be used to open a control session for an
|
||||
* already created object; an object may have been declared in
|
||||
* the DPL or by calling the dpseci_create() function.
|
||||
* This function returns a unique authentication token,
|
||||
* associated with the specific object ID and the specific MC
|
||||
* portal; this token must be used in all subsequent commands for
|
||||
* this specific object.
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpseci_open(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
int dpseci_id,
|
||||
uint16_t *token)
|
||||
{
|
||||
struct dpseci_cmd_open *cmd_params;
|
||||
struct mc_command cmd = { 0 };
|
||||
int err;
|
||||
|
||||
@ -56,23 +72,34 @@ dpseci_open(struct fsl_mc_io *mc_io,
|
||||
cmd.header = mc_encode_cmd_header(DPSECI_CMDID_OPEN,
|
||||
cmd_flags,
|
||||
0);
|
||||
DPSECI_CMD_OPEN(cmd, dpseci_id);
|
||||
cmd_params = (struct dpseci_cmd_open *)cmd.params;
|
||||
cmd_params->dpseci_id = cpu_to_le32(dpseci_id);
|
||||
|
||||
/* send command to mc */
|
||||
/* send command to mc*/
|
||||
err = mc_send_command(mc_io, &cmd);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
/* retrieve response parameters */
|
||||
*token = MC_CMD_HDR_READ_TOKEN(cmd.header);
|
||||
*token = mc_cmd_hdr_read_token(&cmd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
dpseci_close(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token)
|
||||
/**
|
||||
* dpseci_close() - Close the control session of the object
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPSECI object
|
||||
*
|
||||
* After this function is called, no further operations are
|
||||
* allowed on the object without opening a new control session.
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpseci_close(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token)
|
||||
{
|
||||
struct mc_command cmd = { 0 };
|
||||
|
||||
@ -81,59 +108,109 @@ dpseci_close(struct fsl_mc_io *mc_io,
|
||||
cmd_flags,
|
||||
token);
|
||||
|
||||
/* send command to mc */
|
||||
/* send command to mc*/
|
||||
return mc_send_command(mc_io, &cmd);
|
||||
}
|
||||
|
||||
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)
|
||||
/**
|
||||
* 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;
|
||||
int err, i;
|
||||
|
||||
/* prepare command */
|
||||
cmd.header = mc_encode_cmd_header(DPSECI_CMDID_CREATE,
|
||||
cmd_flags,
|
||||
dprc_token);
|
||||
DPSECI_CMD_CREATE(cmd, cfg);
|
||||
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 */
|
||||
/* send command to mc*/
|
||||
err = mc_send_command(mc_io, &cmd);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
/* retrieve response parameters */
|
||||
CMD_CREATE_RSP_GET_OBJ_ID_PARAM0(cmd, *obj_id);
|
||||
*obj_id = mc_cmd_read_object_id(&cmd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
dpseci_destroy(struct fsl_mc_io *mc_io,
|
||||
uint16_t dprc_token,
|
||||
uint32_t cmd_flags,
|
||||
uint32_t object_id)
|
||||
/**
|
||||
* dpseci_destroy() - Destroy the DPSECI object and release all its resources.
|
||||
* @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_'
|
||||
* @object_id: The object id; it must be a valid id within the container that
|
||||
* created this object;
|
||||
*
|
||||
* The function accepts the authentication token of the parent container that
|
||||
* created the object (not the one that currently owns the object). The object
|
||||
* is searched within parent using the provided 'object_id'.
|
||||
* All tokens to the object must be closed before calling destroy.
|
||||
*
|
||||
* Return: '0' on Success; error code otherwise.
|
||||
*/
|
||||
int dpseci_destroy(struct fsl_mc_io *mc_io,
|
||||
uint16_t dprc_token,
|
||||
uint32_t cmd_flags,
|
||||
uint32_t object_id)
|
||||
{
|
||||
struct dpseci_cmd_destroy *cmd_params;
|
||||
struct mc_command cmd = { 0 };
|
||||
|
||||
/* prepare command */
|
||||
cmd.header = mc_encode_cmd_header(DPSECI_CMDID_DESTROY,
|
||||
cmd_flags,
|
||||
dprc_token);
|
||||
/* set object id to destroy */
|
||||
CMD_DESTROY_SET_OBJ_ID_PARAM0(cmd, object_id);
|
||||
/* send command to mc */
|
||||
cmd_params = (struct dpseci_cmd_destroy *)cmd.params;
|
||||
cmd_params->dpseci_id = cpu_to_le32(object_id);
|
||||
|
||||
/* send command to mc*/
|
||||
return mc_send_command(mc_io, &cmd);
|
||||
}
|
||||
|
||||
int
|
||||
dpseci_enable(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token)
|
||||
/**
|
||||
* dpseci_enable() - Enable the DPSECI, allow sending and receiving frames.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPSECI object
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpseci_enable(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token)
|
||||
{
|
||||
struct mc_command cmd = { 0 };
|
||||
|
||||
@ -142,14 +219,21 @@ dpseci_enable(struct fsl_mc_io *mc_io,
|
||||
cmd_flags,
|
||||
token);
|
||||
|
||||
/* send command to mc */
|
||||
/* send command to mc*/
|
||||
return mc_send_command(mc_io, &cmd);
|
||||
}
|
||||
|
||||
int
|
||||
dpseci_disable(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token)
|
||||
/**
|
||||
* dpseci_disable() - Disable the DPSECI, stop sending and receiving frames.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPSECI object
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpseci_disable(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token)
|
||||
{
|
||||
struct mc_command cmd = { 0 };
|
||||
|
||||
@ -158,38 +242,56 @@ dpseci_disable(struct fsl_mc_io *mc_io,
|
||||
cmd_flags,
|
||||
token);
|
||||
|
||||
/* send command to mc */
|
||||
/* send command to mc*/
|
||||
return mc_send_command(mc_io, &cmd);
|
||||
}
|
||||
|
||||
int
|
||||
dpseci_is_enabled(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
int *en)
|
||||
/**
|
||||
* dpseci_is_enabled() - Check if the DPSECI is enabled.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPSECI object
|
||||
* @en: Returns '1' if object is enabled; '0' otherwise
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpseci_is_enabled(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
int *en)
|
||||
{
|
||||
struct dpseci_rsp_is_enabled *rsp_params;
|
||||
struct mc_command cmd = { 0 };
|
||||
int err;
|
||||
|
||||
/* prepare command */
|
||||
cmd.header = mc_encode_cmd_header(DPSECI_CMDID_IS_ENABLED,
|
||||
cmd_flags,
|
||||
token);
|
||||
|
||||
/* send command to mc */
|
||||
/* send command to mc*/
|
||||
err = mc_send_command(mc_io, &cmd);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
/* retrieve response parameters */
|
||||
DPSECI_RSP_IS_ENABLED(cmd, *en);
|
||||
rsp_params = (struct dpseci_rsp_is_enabled *)cmd.params;
|
||||
*en = dpseci_get_field(rsp_params->en, ENABLE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
dpseci_reset(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token)
|
||||
/**
|
||||
* dpseci_reset() - Reset the DPSECI, returns the object to initial state.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPSECI object
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpseci_reset(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token)
|
||||
{
|
||||
struct mc_command cmd = { 0 };
|
||||
|
||||
@ -198,201 +300,25 @@ dpseci_reset(struct fsl_mc_io *mc_io,
|
||||
cmd_flags,
|
||||
token);
|
||||
|
||||
/* send command to mc */
|
||||
/* send command to mc*/
|
||||
return mc_send_command(mc_io, &cmd);
|
||||
}
|
||||
|
||||
int
|
||||
dpseci_get_irq(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
uint8_t irq_index,
|
||||
int *type,
|
||||
struct dpseci_irq_cfg *irq_cfg)
|
||||
{
|
||||
struct mc_command cmd = { 0 };
|
||||
int err;
|
||||
|
||||
/* prepare command */
|
||||
cmd.header = mc_encode_cmd_header(DPSECI_CMDID_GET_IRQ,
|
||||
cmd_flags,
|
||||
token);
|
||||
DPSECI_CMD_GET_IRQ(cmd, irq_index);
|
||||
|
||||
/* send command to mc */
|
||||
err = mc_send_command(mc_io, &cmd);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
/* retrieve response parameters */
|
||||
DPSECI_RSP_GET_IRQ(cmd, *type, irq_cfg);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
dpseci_set_irq(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
uint8_t irq_index,
|
||||
struct dpseci_irq_cfg *irq_cfg)
|
||||
{
|
||||
struct mc_command cmd = { 0 };
|
||||
|
||||
/* prepare command */
|
||||
cmd.header = mc_encode_cmd_header(DPSECI_CMDID_SET_IRQ,
|
||||
cmd_flags,
|
||||
token);
|
||||
DPSECI_CMD_SET_IRQ(cmd, irq_index, irq_cfg);
|
||||
|
||||
/* send command to mc */
|
||||
return mc_send_command(mc_io, &cmd);
|
||||
}
|
||||
|
||||
int
|
||||
dpseci_get_irq_enable(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
uint8_t irq_index,
|
||||
uint8_t *en)
|
||||
{
|
||||
struct mc_command cmd = { 0 };
|
||||
int err;
|
||||
|
||||
/* prepare command */
|
||||
cmd.header = mc_encode_cmd_header(DPSECI_CMDID_GET_IRQ_ENABLE,
|
||||
cmd_flags,
|
||||
token);
|
||||
DPSECI_CMD_GET_IRQ_ENABLE(cmd, irq_index);
|
||||
|
||||
/* send command to mc */
|
||||
err = mc_send_command(mc_io, &cmd);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
/* retrieve response parameters */
|
||||
DPSECI_RSP_GET_IRQ_ENABLE(cmd, *en);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
dpseci_set_irq_enable(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
uint8_t irq_index,
|
||||
uint8_t en)
|
||||
{
|
||||
struct mc_command cmd = { 0 };
|
||||
|
||||
/* prepare command */
|
||||
cmd.header = mc_encode_cmd_header(DPSECI_CMDID_SET_IRQ_ENABLE,
|
||||
cmd_flags,
|
||||
token);
|
||||
DPSECI_CMD_SET_IRQ_ENABLE(cmd, irq_index, en);
|
||||
|
||||
/* send command to mc */
|
||||
return mc_send_command(mc_io, &cmd);
|
||||
}
|
||||
|
||||
int
|
||||
dpseci_get_irq_mask(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
uint8_t irq_index,
|
||||
uint32_t *mask)
|
||||
{
|
||||
struct mc_command cmd = { 0 };
|
||||
int err;
|
||||
|
||||
/* prepare command */
|
||||
cmd.header = mc_encode_cmd_header(DPSECI_CMDID_GET_IRQ_MASK,
|
||||
cmd_flags,
|
||||
token);
|
||||
DPSECI_CMD_GET_IRQ_MASK(cmd, irq_index);
|
||||
|
||||
/* send command to mc */
|
||||
err = mc_send_command(mc_io, &cmd);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
/* retrieve response parameters */
|
||||
DPSECI_RSP_GET_IRQ_MASK(cmd, *mask);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
dpseci_set_irq_mask(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
uint8_t irq_index,
|
||||
uint32_t mask)
|
||||
{
|
||||
struct mc_command cmd = { 0 };
|
||||
|
||||
/* prepare command */
|
||||
cmd.header = mc_encode_cmd_header(DPSECI_CMDID_SET_IRQ_MASK,
|
||||
cmd_flags,
|
||||
token);
|
||||
DPSECI_CMD_SET_IRQ_MASK(cmd, irq_index, mask);
|
||||
|
||||
/* send command to mc */
|
||||
return mc_send_command(mc_io, &cmd);
|
||||
}
|
||||
|
||||
int
|
||||
dpseci_get_irq_status(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
uint8_t irq_index,
|
||||
uint32_t *status)
|
||||
{
|
||||
struct mc_command cmd = { 0 };
|
||||
int err;
|
||||
|
||||
/* prepare command */
|
||||
cmd.header = mc_encode_cmd_header(DPSECI_CMDID_GET_IRQ_STATUS,
|
||||
cmd_flags,
|
||||
token);
|
||||
DPSECI_CMD_GET_IRQ_STATUS(cmd, irq_index, *status);
|
||||
|
||||
/* send command to mc */
|
||||
err = mc_send_command(mc_io, &cmd);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
/* retrieve response parameters */
|
||||
DPSECI_RSP_GET_IRQ_STATUS(cmd, *status);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
dpseci_clear_irq_status(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
uint8_t irq_index,
|
||||
uint32_t status)
|
||||
{
|
||||
struct mc_command cmd = { 0 };
|
||||
|
||||
/* prepare command */
|
||||
cmd.header = mc_encode_cmd_header(DPSECI_CMDID_CLEAR_IRQ_STATUS,
|
||||
cmd_flags,
|
||||
token);
|
||||
DPSECI_CMD_CLEAR_IRQ_STATUS(cmd, irq_index, status);
|
||||
|
||||
/* send command to mc */
|
||||
return mc_send_command(mc_io, &cmd);
|
||||
}
|
||||
|
||||
int
|
||||
dpseci_get_attributes(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
struct dpseci_attr *attr)
|
||||
/**
|
||||
* dpseci_get_attributes() - Retrieve DPSECI attributes.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPSECI object
|
||||
* @attr: Returned object's attributes
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpseci_get_attributes(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
struct dpseci_attr *attr)
|
||||
{
|
||||
struct dpseci_rsp_get_attr *rsp_params;
|
||||
struct mc_command cmd = { 0 };
|
||||
int err;
|
||||
|
||||
@ -401,43 +327,82 @@ dpseci_get_attributes(struct fsl_mc_io *mc_io,
|
||||
cmd_flags,
|
||||
token);
|
||||
|
||||
/* send command to mc */
|
||||
/* send command to mc*/
|
||||
err = mc_send_command(mc_io, &cmd);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
/* retrieve response parameters */
|
||||
DPSECI_RSP_GET_ATTR(cmd, attr);
|
||||
rsp_params = (struct dpseci_rsp_get_attr *)cmd.params;
|
||||
attr->id = le32_to_cpu(rsp_params->id);
|
||||
attr->options = rsp_params->options;
|
||||
attr->num_tx_queues = rsp_params->num_tx_queues;
|
||||
attr->num_rx_queues = rsp_params->num_rx_queues;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
dpseci_set_rx_queue(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
uint8_t queue,
|
||||
const struct dpseci_rx_queue_cfg *cfg)
|
||||
/**
|
||||
* dpseci_set_rx_queue() - Set Rx queue configuration
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPSECI object
|
||||
* @queue: Select the queue relative to number of
|
||||
* priorities configured at DPSECI creation; use
|
||||
* DPSECI_ALL_QUEUES to configure all Rx queues identically.
|
||||
* @cfg: Rx queue configuration
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpseci_set_rx_queue(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
uint8_t queue,
|
||||
const struct dpseci_rx_queue_cfg *cfg)
|
||||
{
|
||||
struct dpseci_cmd_set_rx_queue *cmd_params;
|
||||
struct mc_command cmd = { 0 };
|
||||
|
||||
/* prepare command */
|
||||
cmd.header = mc_encode_cmd_header(DPSECI_CMDID_SET_RX_QUEUE,
|
||||
cmd_flags,
|
||||
token);
|
||||
DPSECI_CMD_SET_RX_QUEUE(cmd, queue, cfg);
|
||||
cmd_params = (struct dpseci_cmd_set_rx_queue *)cmd.params;
|
||||
cmd_params->dest_id = cpu_to_le32(cfg->dest_cfg.dest_id);
|
||||
cmd_params->dest_priority = cfg->dest_cfg.priority;
|
||||
cmd_params->queue = queue;
|
||||
cmd_params->user_ctx = cpu_to_le64(cfg->user_ctx);
|
||||
cmd_params->options = cpu_to_le32(cfg->options);
|
||||
dpseci_set_field(cmd_params->dest_type,
|
||||
DEST_TYPE,
|
||||
cfg->dest_cfg.dest_type);
|
||||
dpseci_set_field(cmd_params->order_preservation_en,
|
||||
ORDER_PRESERVATION,
|
||||
cfg->order_preservation_en);
|
||||
|
||||
/* send command to mc */
|
||||
/* send command to mc*/
|
||||
return mc_send_command(mc_io, &cmd);
|
||||
}
|
||||
|
||||
int
|
||||
dpseci_get_rx_queue(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
uint8_t queue,
|
||||
struct dpseci_rx_queue_attr *attr)
|
||||
/**
|
||||
* dpseci_get_rx_queue() - Retrieve Rx queue attributes.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPSECI object
|
||||
* @queue: Select the queue relative to number of
|
||||
* priorities configured at DPSECI creation
|
||||
* @attr: Returned Rx queue attributes
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpseci_get_rx_queue(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
uint8_t queue,
|
||||
struct dpseci_rx_queue_attr *attr)
|
||||
{
|
||||
struct dpseci_rsp_get_rx_queue *rsp_params;
|
||||
struct dpseci_cmd_get_queue *cmd_params;
|
||||
struct mc_command cmd = { 0 };
|
||||
int err;
|
||||
|
||||
@ -445,26 +410,49 @@ dpseci_get_rx_queue(struct fsl_mc_io *mc_io,
|
||||
cmd.header = mc_encode_cmd_header(DPSECI_CMDID_GET_RX_QUEUE,
|
||||
cmd_flags,
|
||||
token);
|
||||
DPSECI_CMD_GET_RX_QUEUE(cmd, queue);
|
||||
cmd_params = (struct dpseci_cmd_get_queue *)cmd.params;
|
||||
cmd_params->queue = queue;
|
||||
|
||||
/* send command to mc */
|
||||
/* send command to mc*/
|
||||
err = mc_send_command(mc_io, &cmd);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
/* retrieve response parameters */
|
||||
DPSECI_RSP_GET_RX_QUEUE(cmd, attr);
|
||||
rsp_params = (struct dpseci_rsp_get_rx_queue *)cmd.params;
|
||||
attr->user_ctx = le64_to_cpu(rsp_params->user_ctx);
|
||||
attr->fqid = le32_to_cpu(rsp_params->fqid);
|
||||
attr->dest_cfg.dest_id = le32_to_cpu(rsp_params->dest_id);
|
||||
attr->dest_cfg.priority = rsp_params->dest_priority;
|
||||
attr->dest_cfg.dest_type =
|
||||
dpseci_get_field(rsp_params->dest_type,
|
||||
DEST_TYPE);
|
||||
attr->order_preservation_en =
|
||||
dpseci_get_field(rsp_params->order_preservation_en,
|
||||
ORDER_PRESERVATION);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
dpseci_get_tx_queue(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
uint8_t queue,
|
||||
struct dpseci_tx_queue_attr *attr)
|
||||
/**
|
||||
* dpseci_get_tx_queue() - Retrieve Tx queue attributes.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPSECI object
|
||||
* @queue: Select the queue relative to number of
|
||||
* priorities configured at DPSECI creation
|
||||
* @attr: Returned Tx queue attributes
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpseci_get_tx_queue(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
uint8_t queue,
|
||||
struct dpseci_tx_queue_attr *attr)
|
||||
{
|
||||
struct dpseci_rsp_get_tx_queue *rsp_params;
|
||||
struct dpseci_cmd_get_queue *cmd_params;
|
||||
struct mc_command cmd = { 0 };
|
||||
int err;
|
||||
|
||||
@ -472,25 +460,37 @@ dpseci_get_tx_queue(struct fsl_mc_io *mc_io,
|
||||
cmd.header = mc_encode_cmd_header(DPSECI_CMDID_GET_TX_QUEUE,
|
||||
cmd_flags,
|
||||
token);
|
||||
DPSECI_CMD_GET_TX_QUEUE(cmd, queue);
|
||||
cmd_params = (struct dpseci_cmd_get_queue *)cmd.params;
|
||||
cmd_params->queue = queue;
|
||||
|
||||
/* send command to mc */
|
||||
/* send command to mc*/
|
||||
err = mc_send_command(mc_io, &cmd);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
/* retrieve response parameters */
|
||||
DPSECI_RSP_GET_TX_QUEUE(cmd, attr);
|
||||
rsp_params = (struct dpseci_rsp_get_tx_queue *)cmd.params;
|
||||
attr->fqid = le32_to_cpu(rsp_params->fqid);
|
||||
attr->priority = rsp_params->priority;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
dpseci_get_sec_attr(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
struct dpseci_sec_attr *attr)
|
||||
/**
|
||||
* dpseci_get_sec_attr() - Retrieve SEC accelerator attributes.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPSECI object
|
||||
* @attr: Returned SEC attributes
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpseci_get_sec_attr(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
struct dpseci_sec_attr *attr)
|
||||
{
|
||||
struct dpseci_rsp_get_sec_attr *rsp_params;
|
||||
struct mc_command cmd = { 0 };
|
||||
int err;
|
||||
|
||||
@ -499,23 +499,49 @@ dpseci_get_sec_attr(struct fsl_mc_io *mc_io,
|
||||
cmd_flags,
|
||||
token);
|
||||
|
||||
/* send command to mc */
|
||||
/* send command to mc*/
|
||||
err = mc_send_command(mc_io, &cmd);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
/* retrieve response parameters */
|
||||
DPSECI_RSP_GET_SEC_ATTR(cmd, attr);
|
||||
rsp_params = (struct dpseci_rsp_get_sec_attr *)cmd.params;
|
||||
attr->ip_id = le16_to_cpu(rsp_params->ip_id);
|
||||
attr->major_rev = rsp_params->major_rev;
|
||||
attr->minor_rev = rsp_params->minor_rev;
|
||||
attr->era = rsp_params->era;
|
||||
attr->deco_num = rsp_params->deco_num;
|
||||
attr->zuc_auth_acc_num = rsp_params->zuc_auth_acc_num;
|
||||
attr->zuc_enc_acc_num = rsp_params->zuc_enc_acc_num;
|
||||
attr->snow_f8_acc_num = rsp_params->snow_f8_acc_num;
|
||||
attr->snow_f9_acc_num = rsp_params->snow_f9_acc_num;
|
||||
attr->crc_acc_num = rsp_params->crc_acc_num;
|
||||
attr->pk_acc_num = rsp_params->pk_acc_num;
|
||||
attr->kasumi_acc_num = rsp_params->kasumi_acc_num;
|
||||
attr->rng_acc_num = rsp_params->rng_acc_num;
|
||||
attr->md_acc_num = rsp_params->md_acc_num;
|
||||
attr->arc4_acc_num = rsp_params->arc4_acc_num;
|
||||
attr->des_acc_num = rsp_params->des_acc_num;
|
||||
attr->aes_acc_num = rsp_params->aes_acc_num;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
dpseci_get_sec_counters(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
struct dpseci_sec_counters *counters)
|
||||
/**
|
||||
* dpseci_get_sec_counters() - Retrieve SEC accelerator counters.
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @token: Token of DPSECI object
|
||||
* @counters: Returned SEC counters
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpseci_get_sec_counters(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
struct dpseci_sec_counters *counters)
|
||||
{
|
||||
struct dpseci_rsp_get_sec_counters *rsp_params;
|
||||
struct mc_command cmd = { 0 };
|
||||
int err;
|
||||
|
||||
@ -524,23 +550,40 @@ dpseci_get_sec_counters(struct fsl_mc_io *mc_io,
|
||||
cmd_flags,
|
||||
token);
|
||||
|
||||
/* send command to mc */
|
||||
/* send command to mc*/
|
||||
err = mc_send_command(mc_io, &cmd);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
/* retrieve response parameters */
|
||||
DPSECI_RSP_GET_SEC_COUNTERS(cmd, counters);
|
||||
rsp_params = (struct dpseci_rsp_get_sec_counters *)cmd.params;
|
||||
counters->dequeued_requests =
|
||||
le64_to_cpu(rsp_params->dequeued_requests);
|
||||
counters->ob_enc_requests = le64_to_cpu(rsp_params->ob_enc_requests);
|
||||
counters->ib_dec_requests = le64_to_cpu(rsp_params->ib_dec_requests);
|
||||
counters->ob_enc_bytes = le64_to_cpu(rsp_params->ob_enc_bytes);
|
||||
counters->ob_prot_bytes = le64_to_cpu(rsp_params->ob_prot_bytes);
|
||||
counters->ib_dec_bytes = le64_to_cpu(rsp_params->ib_dec_bytes);
|
||||
counters->ib_valid_bytes = le64_to_cpu(rsp_params->ib_valid_bytes);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
dpseci_get_api_version(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t *major_ver,
|
||||
uint16_t *minor_ver)
|
||||
/**
|
||||
* dpseci_get_api_version() - Get Data Path SEC Interface API version
|
||||
* @mc_io: Pointer to MC portal's I/O object
|
||||
* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @major_ver: Major version of data path sec API
|
||||
* @minor_ver: Minor version of data path sec API
|
||||
*
|
||||
* Return: '0' on Success; Error code otherwise.
|
||||
*/
|
||||
int dpseci_get_api_version(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t *major_ver,
|
||||
uint16_t *minor_ver)
|
||||
{
|
||||
struct dpseci_rsp_get_api_version *rsp_params;
|
||||
struct mc_command cmd = { 0 };
|
||||
int err;
|
||||
|
||||
@ -552,7 +595,82 @@ dpseci_get_api_version(struct fsl_mc_io *mc_io,
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
DPSECI_RSP_GET_API_VERSION(cmd, *major_ver, *minor_ver);
|
||||
rsp_params = (struct dpseci_rsp_get_api_version *)cmd.params;
|
||||
*major_ver = le16_to_cpu(rsp_params->major);
|
||||
*minor_ver = le16_to_cpu(rsp_params->minor);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int dpseci_set_congestion_notification(
|
||||
struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
const struct dpseci_congestion_notification_cfg *cfg)
|
||||
{
|
||||
struct dpseci_cmd_set_congestion_notification *cmd_params;
|
||||
struct mc_command cmd = { 0 };
|
||||
|
||||
/* prepare command */
|
||||
cmd.header = mc_encode_cmd_header(
|
||||
DPSECI_CMDID_SET_CONGESTION_NOTIFICATION,
|
||||
cmd_flags,
|
||||
token);
|
||||
|
||||
cmd_params =
|
||||
(struct dpseci_cmd_set_congestion_notification *)cmd.params;
|
||||
cmd_params->dest_id = cfg->dest_cfg.dest_id;
|
||||
cmd_params->dest_priority = cfg->dest_cfg.priority;
|
||||
cmd_params->message_ctx = cfg->message_ctx;
|
||||
cmd_params->message_iova = cfg->message_iova;
|
||||
cmd_params->notification_mode = cfg->notification_mode;
|
||||
cmd_params->threshold_entry = cfg->threshold_entry;
|
||||
cmd_params->threshold_exit = cfg->threshold_exit;
|
||||
dpseci_set_field(cmd_params->type_units,
|
||||
DEST_TYPE,
|
||||
cfg->dest_cfg.dest_type);
|
||||
dpseci_set_field(cmd_params->type_units,
|
||||
CG_UNITS,
|
||||
cfg->units);
|
||||
|
||||
/* send command to mc*/
|
||||
return mc_send_command(mc_io, &cmd);
|
||||
}
|
||||
|
||||
int dpseci_get_congestion_notification(
|
||||
struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
struct dpseci_congestion_notification_cfg *cfg)
|
||||
{
|
||||
struct dpseci_cmd_set_congestion_notification *rsp_params;
|
||||
struct mc_command cmd = { 0 };
|
||||
int err;
|
||||
|
||||
/* prepare command */
|
||||
cmd.header = mc_encode_cmd_header(
|
||||
DPSECI_CMDID_GET_CONGESTION_NOTIFICATION,
|
||||
cmd_flags,
|
||||
token);
|
||||
|
||||
/* send command to mc*/
|
||||
err = mc_send_command(mc_io, &cmd);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
rsp_params =
|
||||
(struct dpseci_cmd_set_congestion_notification *)cmd.params;
|
||||
|
||||
cfg->dest_cfg.dest_id = le32_to_cpu(rsp_params->dest_id);
|
||||
cfg->dest_cfg.priority = rsp_params->dest_priority;
|
||||
cfg->notification_mode = le16_to_cpu(rsp_params->notification_mode);
|
||||
cfg->message_ctx = le64_to_cpu(rsp_params->message_ctx);
|
||||
cfg->message_iova = le64_to_cpu(rsp_params->message_iova);
|
||||
cfg->threshold_entry = le32_to_cpu(rsp_params->threshold_entry);
|
||||
cfg->threshold_exit = le32_to_cpu(rsp_params->threshold_exit);
|
||||
cfg->units = dpseci_get_field(rsp_params->type_units, CG_UNITS);
|
||||
cfg->dest_cfg.dest_type = dpseci_get_field(rsp_params->type_units,
|
||||
DEST_TYPE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
* BSD LICENSE
|
||||
*
|
||||
* Copyright 2013-2016 Freescale Semiconductor Inc.
|
||||
* Copyright 2016 NXP.
|
||||
* Copyright 2016-2017 NXP.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@ -37,7 +37,6 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __FSL_DPSECI_H
|
||||
#define __FSL_DPSECI_H
|
||||
|
||||
@ -61,394 +60,89 @@ struct fsl_mc_io;
|
||||
*/
|
||||
#define DPSECI_ALL_QUEUES (uint8_t)(-1)
|
||||
|
||||
/**
|
||||
* dpseci_open() - Open a control session for the specified object
|
||||
* This function can be used to open a control session for an
|
||||
* already created object; an object may have been declared in
|
||||
* the DPL or by calling the dpseci_create() function.
|
||||
* This function returns a unique authentication token,
|
||||
* associated with the specific object ID and the specific MC
|
||||
* portal; this token must be used in all subsequent commands for
|
||||
* this specific object.
|
||||
*
|
||||
* @param mc_io Pointer to MC portal's I/O object
|
||||
* @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @param dpseci_id DPSECI unique ID
|
||||
* @param token Returned token; use in subsequent API calls
|
||||
*
|
||||
* @return:
|
||||
* - Return '0' on Success.
|
||||
* - Return Error code otherwise.
|
||||
*/
|
||||
int
|
||||
dpseci_open(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
int dpseci_id,
|
||||
uint16_t *token);
|
||||
int dpseci_open(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
int dpseci_id,
|
||||
uint16_t *token);
|
||||
|
||||
int dpseci_close(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token);
|
||||
|
||||
/**
|
||||
* dpseci_close() - Close the control session of the object
|
||||
* After this function is called, no further operations are
|
||||
* allowed on the object without opening a new control session.
|
||||
*
|
||||
* @param mc_io Pointer to MC portal's I/O object
|
||||
* @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @param token Token of DPSECI object
|
||||
*
|
||||
* @return:
|
||||
* - Return '0' on Success.
|
||||
* - Return Error code otherwise.
|
||||
* Enable the Congestion Group support
|
||||
*/
|
||||
int
|
||||
dpseci_close(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token);
|
||||
#define DPSECI_OPT_HAS_CG 0x000020
|
||||
|
||||
/**
|
||||
* struct dpseci_cfg - Structure representing DPSECI configuration
|
||||
* @options: Any combination of the following options:
|
||||
* DPSECI_OPT_HAS_CG
|
||||
* DPSECI_OPT_HAS_OPR
|
||||
* DPSECI_OPT_OPR_SHARED
|
||||
* @num_tx_queues: num of queues towards the SEC
|
||||
* @num_rx_queues: num of queues back from the SEC
|
||||
* @priorities: Priorities for the SEC hardware processing;
|
||||
* each place in the array is the priority of the tx queue
|
||||
* towards the SEC,
|
||||
* valid priorities are configured with values 1-8;
|
||||
*/
|
||||
struct dpseci_cfg {
|
||||
uint8_t num_tx_queues; /* num of queues towards the SEC */
|
||||
uint8_t num_rx_queues; /* num of queues back from the SEC */
|
||||
uint32_t options;
|
||||
uint8_t num_tx_queues;
|
||||
uint8_t num_rx_queues;
|
||||
uint8_t priorities[DPSECI_PRIO_NUM];
|
||||
/**< Priorities for the SEC hardware processing;
|
||||
* each place in the array is the priority of the tx queue
|
||||
* towards the SEC,
|
||||
* valid priorities are configured with values 1-8;
|
||||
*/
|
||||
};
|
||||
|
||||
/**
|
||||
* dpseci_create() - Create the DPSECI object
|
||||
* 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.
|
||||
*
|
||||
* @param mc_io Pointer to MC portal's I/O object
|
||||
* @param dprc_token Parent container token; '0' for default container
|
||||
* @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @param cfg Configuration structure
|
||||
* @param obj_id returned object id
|
||||
*
|
||||
* @return:
|
||||
* - Return '0' on Success.
|
||||
* - Return 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);
|
||||
|
||||
/**
|
||||
* dpseci_destroy() - Destroy the DPSECI object and release all its resources.
|
||||
* The function accepts the authentication token of the parent container that
|
||||
* created the object (not the one that currently owns the object). The object
|
||||
* is searched within parent using the provided 'object_id'.
|
||||
* All tokens to the object must be closed before calling destroy.
|
||||
*
|
||||
* @param mc_io Pointer to MC portal's I/O object
|
||||
* @param dprc_token Parent container token; '0' for default container
|
||||
* @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @param object_id The object id; it must be a valid id within the
|
||||
* container that created this object;
|
||||
*
|
||||
* @return:
|
||||
* - Return '0' on Success.
|
||||
* - Return Error code otherwise.
|
||||
*/
|
||||
int
|
||||
dpseci_destroy(struct fsl_mc_io *mc_io,
|
||||
uint16_t dprc_token,
|
||||
uint32_t cmd_flags,
|
||||
uint32_t object_id);
|
||||
|
||||
/**
|
||||
* dpseci_enable() - Enable the DPSECI, allow sending and receiving frames.
|
||||
* @param mc_io Pointer to MC portal's I/O object
|
||||
* @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @param token Token of DPSECI object
|
||||
*
|
||||
* @return:
|
||||
* - Return '0' on Success.
|
||||
* - Return Error code otherwise.
|
||||
*/
|
||||
int
|
||||
dpseci_enable(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token);
|
||||
|
||||
/**
|
||||
* dpseci_disable() - Disable the DPSECI, stop sending and receiving frames.
|
||||
* @param mc_io Pointer to MC portal's I/O object
|
||||
* @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @param token Token of DPSECI object
|
||||
*
|
||||
* @return:
|
||||
* - Return '0' on Success.
|
||||
* - Return Error code otherwise.
|
||||
*/
|
||||
int
|
||||
dpseci_disable(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token);
|
||||
|
||||
/**
|
||||
* dpseci_is_enabled() - Check if the DPSECI is enabled.
|
||||
* @param mc_io Pointer to MC portal's I/O object
|
||||
* @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @param token Token of DPSECI object
|
||||
* @param en Returns '1' if object is enabled; '0' otherwise
|
||||
*
|
||||
* @return:
|
||||
* - Return '0' on Success.
|
||||
* - Return Error code otherwise.
|
||||
*/
|
||||
int
|
||||
dpseci_is_enabled(struct fsl_mc_io *mc_io,
|
||||
int dpseci_create(struct fsl_mc_io *mc_io,
|
||||
uint16_t dprc_token,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
int *en);
|
||||
const struct dpseci_cfg *cfg,
|
||||
uint32_t *obj_id);
|
||||
|
||||
/**
|
||||
* dpseci_reset() - Reset the DPSECI, returns the object to initial state.
|
||||
* @param mc_io Pointer to MC portal's I/O object
|
||||
* @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @param token Token of DPSECI object
|
||||
*
|
||||
* @return:
|
||||
* - Return '0' on Success.
|
||||
* - Return Error code otherwise.
|
||||
*/
|
||||
int
|
||||
dpseci_reset(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token);
|
||||
int dpseci_destroy(struct fsl_mc_io *mc_io,
|
||||
uint16_t dprc_token,
|
||||
uint32_t cmd_flags,
|
||||
uint32_t object_id);
|
||||
|
||||
/**
|
||||
* struct dpseci_irq_cfg - IRQ configuration
|
||||
*/
|
||||
struct dpseci_irq_cfg {
|
||||
uint64_t addr;
|
||||
/* Address that must be written to signal a message-based interrupt */
|
||||
uint32_t val;
|
||||
/* Value to write into irq_addr address */
|
||||
int irq_num;
|
||||
/* A user defined number associated with this IRQ */
|
||||
};
|
||||
int dpseci_enable(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token);
|
||||
|
||||
/**
|
||||
* dpseci_set_irq() - Set IRQ information for the DPSECI to trigger an interrupt
|
||||
* @param mc_io Pointer to MC portal's I/O object
|
||||
* @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @param token Token of DPSECI object
|
||||
* @param irq_index Identifies the interrupt index to configure
|
||||
* @param irq_cfg IRQ configuration
|
||||
*
|
||||
* @return:
|
||||
* - Return '0' on Success.
|
||||
* - Return Error code otherwise.
|
||||
*/
|
||||
int
|
||||
dpseci_set_irq(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
uint8_t irq_index,
|
||||
struct dpseci_irq_cfg *irq_cfg);
|
||||
int dpseci_disable(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token);
|
||||
|
||||
/**
|
||||
* dpseci_get_irq() - Get IRQ information from the DPSECI
|
||||
*
|
||||
* @param mc_io Pointer to MC portal's I/O object
|
||||
* @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @param token Token of DPSECI object
|
||||
* @param irq_index The interrupt index to configure
|
||||
* @param type Interrupt type: 0 represents message interrupt
|
||||
* type (both irq_addr and irq_val are valid)
|
||||
* @param irq_cfg IRQ attributes
|
||||
*
|
||||
* @return:
|
||||
* - Return '0' on Success.
|
||||
* - Return Error code otherwise.
|
||||
*/
|
||||
int
|
||||
dpseci_get_irq(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
uint8_t irq_index,
|
||||
int *type,
|
||||
struct dpseci_irq_cfg *irq_cfg);
|
||||
|
||||
/**
|
||||
* dpseci_set_irq_enable() - Set overall interrupt state.
|
||||
* Allows GPP software to control when interrupts are generated.
|
||||
* Each interrupt can have up to 32 causes. The enable/disable control's the
|
||||
* overall interrupt state. if the interrupt is disabled no causes will cause
|
||||
* an interrupt
|
||||
*
|
||||
* @param mc_io Pointer to MC portal's I/O object
|
||||
* @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @param token Token of DPSECI object
|
||||
* @param irq_index The interrupt index to configure
|
||||
* @param en Interrupt state - enable = 1, disable = 0
|
||||
*
|
||||
* @return:
|
||||
* - Return '0' on Success.
|
||||
* - Return Error code otherwise.
|
||||
*/
|
||||
int
|
||||
dpseci_set_irq_enable(struct fsl_mc_io *mc_io,
|
||||
int dpseci_is_enabled(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
uint8_t irq_index,
|
||||
uint8_t en);
|
||||
int *en);
|
||||
|
||||
/**
|
||||
* dpseci_get_irq_enable() - Get overall interrupt state
|
||||
* @param mc_io Pointer to MC portal's I/O object
|
||||
* @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @param token Token of DPSECI object
|
||||
* @param irq_index The interrupt index to configure
|
||||
* @param en Returned Interrupt state - enable = 1,
|
||||
* disable = 0
|
||||
*
|
||||
* @return:
|
||||
* - Return '0' on Success.
|
||||
* - Return Error code otherwise.
|
||||
*/
|
||||
int
|
||||
dpseci_get_irq_enable(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
uint8_t irq_index,
|
||||
uint8_t *en);
|
||||
|
||||
/**
|
||||
* dpseci_set_irq_mask() - Set interrupt mask.
|
||||
* Every interrupt can have up to 32 causes and the interrupt model supports
|
||||
* masking/unmasking each cause independently
|
||||
*
|
||||
* @param mc_io Pointer to MC portal's I/O object
|
||||
* @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @param token Token of DPSECI object
|
||||
* @param irq_index The interrupt index to configure
|
||||
* @param mask event mask to trigger interrupt;
|
||||
* each bit:
|
||||
* 0 = ignore event
|
||||
* 1 = consider event for asserting IRQ
|
||||
*
|
||||
* @return:
|
||||
* - Return '0' on Success.
|
||||
* - Return Error code otherwise.
|
||||
*/
|
||||
int
|
||||
dpseci_set_irq_mask(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
uint8_t irq_index,
|
||||
uint32_t mask);
|
||||
|
||||
/**
|
||||
* dpseci_get_irq_mask() - Get interrupt mask.
|
||||
* Every interrupt can have up to 32 causes and the interrupt model supports
|
||||
* masking/unmasking each cause independently
|
||||
*
|
||||
* @param mc_io Pointer to MC portal's I/O object
|
||||
* @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @param token Token of DPSECI object
|
||||
* @param irq_index The interrupt index to configure
|
||||
* @param mask Returned event mask to trigger interrupt
|
||||
*
|
||||
* @return:
|
||||
* - Return '0' on Success.
|
||||
* - Return Error code otherwise.
|
||||
*/
|
||||
int
|
||||
dpseci_get_irq_mask(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
uint8_t irq_index,
|
||||
uint32_t *mask);
|
||||
|
||||
/**
|
||||
* dpseci_get_irq_status() - Get the current status of any pending interrupts
|
||||
* @param mc_io Pointer to MC portal's I/O object
|
||||
* @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @param token Token of DPSECI object
|
||||
* @param irq_index The interrupt index to configure
|
||||
* @param status Returned interrupts status - one bit per cause:
|
||||
* 0 = no interrupt pending
|
||||
* 1 = interrupt pending
|
||||
*
|
||||
* @return:
|
||||
* - Return '0' on Success.
|
||||
* - Return Error code otherwise.
|
||||
*/
|
||||
int
|
||||
dpseci_get_irq_status(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
uint8_t irq_index,
|
||||
uint32_t *status);
|
||||
|
||||
/**
|
||||
* dpseci_clear_irq_status() - Clear a pending interrupt's status
|
||||
* @param mc_io Pointer to MC portal's I/O object
|
||||
* @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @param token Token of DPSECI object
|
||||
* @param irq_index The interrupt index to configure
|
||||
* @param status bits to clear (W1C) - one bit per cause:
|
||||
* 0 = don't change
|
||||
* 1 = clear status bit
|
||||
*
|
||||
* @return:
|
||||
* - Return '0' on Success.
|
||||
* - Return Error code otherwise.
|
||||
*/
|
||||
int
|
||||
dpseci_clear_irq_status(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
uint8_t irq_index,
|
||||
uint32_t status);
|
||||
int dpseci_reset(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token);
|
||||
|
||||
/**
|
||||
* struct dpseci_attr - Structure representing DPSECI attributes
|
||||
* @param id: DPSECI object ID
|
||||
* @param num_tx_queues: number of queues towards the SEC
|
||||
* @param num_rx_queues: number of queues back from the SEC
|
||||
* @id: DPSECI object ID
|
||||
* @num_tx_queues: number of queues towards the SEC
|
||||
* @num_rx_queues: number of queues back from the SEC
|
||||
* @options: Any combination of the following options:
|
||||
* DPSECI_OPT_HAS_CG
|
||||
* DPSECI_OPT_HAS_OPR
|
||||
* DPSECI_OPT_OPR_SHARED
|
||||
*/
|
||||
struct dpseci_attr {
|
||||
int id; /* DPSECI object ID */
|
||||
uint8_t num_tx_queues; /* number of queues towards the SEC */
|
||||
uint8_t num_rx_queues; /* number of queues back from the SEC */
|
||||
int id;
|
||||
uint8_t num_tx_queues;
|
||||
uint8_t num_rx_queues;
|
||||
uint32_t options;
|
||||
};
|
||||
|
||||
/**
|
||||
* dpseci_get_attributes() - Retrieve DPSECI attributes.
|
||||
* @param mc_io Pointer to MC portal's I/O object
|
||||
* @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @param token Token of DPSECI object
|
||||
* @param attr Returned object's attributes
|
||||
*
|
||||
* @return:
|
||||
* - Return '0' on Success.
|
||||
* - Return Error code otherwise.
|
||||
*/
|
||||
int
|
||||
dpseci_get_attributes(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
struct dpseci_attr *attr);
|
||||
int dpseci_get_attributes(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
struct dpseci_attr *attr);
|
||||
|
||||
/**
|
||||
* enum dpseci_dest - DPSECI destination types
|
||||
@ -471,16 +165,16 @@ enum dpseci_dest {
|
||||
|
||||
/**
|
||||
* struct dpseci_dest_cfg - Structure representing DPSECI destination parameters
|
||||
* @dest_type: Destination type
|
||||
* @dest_id: Either DPIO ID or DPCON ID, depending on the destination type
|
||||
* @priority: Priority selection within the DPIO or DPCON channel; valid values
|
||||
* are 0-1 or 0-7, depending on the number of priorities in that
|
||||
* channel; not relevant for 'DPSECI_DEST_NONE' option
|
||||
*/
|
||||
struct dpseci_dest_cfg {
|
||||
enum dpseci_dest dest_type; /* Destination type */
|
||||
enum dpseci_dest dest_type;
|
||||
int dest_id;
|
||||
/* Either DPIO ID or DPCON ID, depending on the destination type */
|
||||
uint8_t priority;
|
||||
/* Priority selection within the DPIO or DPCON channel; valid values
|
||||
* are 0-1 or 0-7, depending on the number of priorities in that
|
||||
* channel; not relevant for 'DPSECI_DEST_NONE' option
|
||||
*/
|
||||
};
|
||||
|
||||
/**
|
||||
@ -504,243 +198,235 @@ struct dpseci_dest_cfg {
|
||||
|
||||
/**
|
||||
* struct dpseci_rx_queue_cfg - DPSECI RX queue configuration
|
||||
* @options: Flags representing the suggested modifications to the queue;
|
||||
* Use any combination of 'DPSECI_QUEUE_OPT_<X>' flags
|
||||
* @order_preservation_en: order preservation configuration for the rx queue
|
||||
* valid only if 'DPSECI_QUEUE_OPT_ORDER_PRESERVATION' is contained in 'options'
|
||||
* @user_ctx: User context value provided in the frame descriptor of each
|
||||
* dequeued frame;
|
||||
* valid only if 'DPSECI_QUEUE_OPT_USER_CTX' is contained in 'options'
|
||||
* @dest_cfg: Queue destination parameters;
|
||||
* valid only if 'DPSECI_QUEUE_OPT_DEST' is contained in 'options'
|
||||
*/
|
||||
struct dpseci_rx_queue_cfg {
|
||||
uint32_t options;
|
||||
/* Flags representing the suggested modifications to the queue;
|
||||
* Use any combination of 'DPSECI_QUEUE_OPT_<X>' flags
|
||||
*/
|
||||
int order_preservation_en;
|
||||
/* order preservation configuration for the rx queue
|
||||
* valid only if 'DPSECI_QUEUE_OPT_ORDER_PRESERVATION' is contained in
|
||||
* 'options'
|
||||
*/
|
||||
uint64_t user_ctx;
|
||||
/* User context value provided in the frame descriptor of each
|
||||
* dequeued frame;
|
||||
* valid only if 'DPSECI_QUEUE_OPT_USER_CTX' is contained in 'options'
|
||||
*/
|
||||
struct dpseci_dest_cfg dest_cfg;
|
||||
/* Queue destination parameters;
|
||||
* valid only if 'DPSECI_QUEUE_OPT_DEST' is contained in 'options'
|
||||
*/
|
||||
};
|
||||
|
||||
/**
|
||||
* dpseci_set_rx_queue() - Set Rx queue configuration
|
||||
* @param mc_io Pointer to MC portal's I/O object
|
||||
* @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @param token Token of DPSECI object
|
||||
* @param queue Select the queue relative to number of
|
||||
* priorities configured at DPSECI creation; use
|
||||
* DPSECI_ALL_QUEUES to configure all Rx queues
|
||||
* identically.
|
||||
* @param cfg Rx queue configuration
|
||||
*
|
||||
* @return:
|
||||
* - Return '0' on Success.
|
||||
* - Return Error code otherwise.
|
||||
*/
|
||||
int
|
||||
dpseci_set_rx_queue(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
uint8_t queue,
|
||||
const struct dpseci_rx_queue_cfg *cfg);
|
||||
int dpseci_set_rx_queue(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
uint8_t queue,
|
||||
const struct dpseci_rx_queue_cfg *cfg);
|
||||
|
||||
/**
|
||||
* struct dpseci_rx_queue_attr - Structure representing attributes of Rx queues
|
||||
* @user_ctx: User context value provided in the frame descriptor of each
|
||||
* dequeued frame
|
||||
* @order_preservation_en: Status of the order preservation configuration
|
||||
* on the queue
|
||||
* @dest_cfg: Queue destination configuration
|
||||
* @fqid: Virtual FQID value to be used for dequeue operations
|
||||
*/
|
||||
struct dpseci_rx_queue_attr {
|
||||
uint64_t user_ctx;
|
||||
/* User context value provided in the frame descriptor of
|
||||
* each dequeued frame
|
||||
*/
|
||||
int order_preservation_en;
|
||||
/* Status of the order preservation configuration on the queue */
|
||||
struct dpseci_dest_cfg dest_cfg;
|
||||
/* Queue destination configuration */
|
||||
struct dpseci_dest_cfg dest_cfg;
|
||||
uint32_t fqid;
|
||||
/* Virtual FQID value to be used for dequeue operations */
|
||||
};
|
||||
|
||||
/**
|
||||
* dpseci_get_rx_queue() - Retrieve Rx queue attributes.
|
||||
* @param mc_io Pointer to MC portal's I/O object
|
||||
* @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @param token Token of DPSECI object
|
||||
* @param queue Select the queue relative to number of
|
||||
* priorities configured at DPSECI creation
|
||||
* @param attr Returned Rx queue attributes
|
||||
*
|
||||
* @return:
|
||||
* - Return '0' on Success.
|
||||
* - Return Error code otherwise.
|
||||
*/
|
||||
int
|
||||
dpseci_get_rx_queue(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
uint8_t queue,
|
||||
struct dpseci_rx_queue_attr *attr);
|
||||
int dpseci_get_rx_queue(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
uint8_t queue,
|
||||
struct dpseci_rx_queue_attr *attr);
|
||||
|
||||
/**
|
||||
* struct dpseci_tx_queue_attr - Structure representing attributes of Tx queues
|
||||
* @fqid: Virtual FQID to be used for sending frames to SEC hardware
|
||||
* @priority: SEC hardware processing priority for the queue
|
||||
*/
|
||||
struct dpseci_tx_queue_attr {
|
||||
uint32_t fqid;
|
||||
/* Virtual FQID to be used for sending frames to SEC hardware */
|
||||
uint8_t priority;
|
||||
/* SEC hardware processing priority for the queue */
|
||||
};
|
||||
|
||||
/**
|
||||
* dpseci_get_tx_queue() - Retrieve Tx queue attributes.
|
||||
* @param mc_io Pointer to MC portal's I/O object
|
||||
* @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @param token Token of DPSECI object
|
||||
* @param queue Select the queue relative to number of
|
||||
* priorities configured at DPSECI creation
|
||||
* @param attr Returned Tx queue attributes
|
||||
*
|
||||
* @return:
|
||||
* - Return '0' on Success.
|
||||
* - Return Error code otherwise.
|
||||
*/
|
||||
int
|
||||
dpseci_get_tx_queue(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
uint8_t queue,
|
||||
struct dpseci_tx_queue_attr *attr);
|
||||
int dpseci_get_tx_queue(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
uint8_t queue,
|
||||
struct dpseci_tx_queue_attr *attr);
|
||||
|
||||
/**
|
||||
* struct dpseci_sec_attr - Structure representing attributes of the SEC
|
||||
* hardware accelerator
|
||||
*/
|
||||
* hardware accelerator
|
||||
* @ip_id: ID for SEC.
|
||||
* @major_rev: Major revision number for SEC.
|
||||
* @minor_rev: Minor revision number for SEC.
|
||||
* @era: SEC Era.
|
||||
* @deco_num: The number of copies of the DECO that are implemented
|
||||
* in this version of SEC.
|
||||
* @zuc_auth_acc_num: The number of copies of ZUCA that are implemented
|
||||
* in this version of SEC.
|
||||
* @zuc_enc_acc_num: The number of copies of ZUCE that are implemented
|
||||
* in this version of SEC.
|
||||
* @snow_f8_acc_num: The number of copies of the SNOW-f8 module that are
|
||||
* implemented in this version of SEC.
|
||||
* @snow_f9_acc_num: The number of copies of the SNOW-f9 module that are
|
||||
* implemented in this version of SEC.
|
||||
* @crc_acc_num: The number of copies of the CRC module that are
|
||||
* implemented in this version of SEC.
|
||||
* @pk_acc_num: The number of copies of the Public Key module that are
|
||||
* implemented in this version of SEC.
|
||||
* @kasumi_acc_num: The number of copies of the Kasumi module that are
|
||||
* implemented in this version of SEC.
|
||||
* @rng_acc_num: The number of copies of the Random Number Generator that
|
||||
* are implemented in this version of SEC.
|
||||
* @md_acc_num: The number of copies of the MDHA (Hashing module) that
|
||||
* are implemented in this version of SEC.
|
||||
* @arc4_acc_num: The number of copies of the ARC4 module that are
|
||||
* implemented in this version of SEC.
|
||||
* @des_acc_num: The number of copies of the DES module that are
|
||||
* implemented in this version of SEC.
|
||||
* @aes_acc_num: The number of copies of the AES module that are
|
||||
* implemented in this version of SEC.
|
||||
**/
|
||||
|
||||
struct dpseci_sec_attr {
|
||||
uint16_t ip_id; /* ID for SEC */
|
||||
uint8_t major_rev; /* Major revision number for SEC */
|
||||
uint8_t minor_rev; /* Minor revision number for SEC */
|
||||
uint8_t era; /* SEC Era */
|
||||
uint16_t ip_id;
|
||||
uint8_t major_rev;
|
||||
uint8_t minor_rev;
|
||||
uint8_t era;
|
||||
uint8_t deco_num;
|
||||
/* The number of copies of the DECO that are implemented in
|
||||
* this version of SEC
|
||||
*/
|
||||
uint8_t zuc_auth_acc_num;
|
||||
/* The number of copies of ZUCA that are implemented in this
|
||||
* version of SEC
|
||||
*/
|
||||
uint8_t zuc_enc_acc_num;
|
||||
/* The number of copies of ZUCE that are implemented in this
|
||||
* version of SEC
|
||||
*/
|
||||
uint8_t snow_f8_acc_num;
|
||||
/* The number of copies of the SNOW-f8 module that are
|
||||
* implemented in this version of SEC
|
||||
*/
|
||||
uint8_t snow_f9_acc_num;
|
||||
/* The number of copies of the SNOW-f9 module that are
|
||||
* implemented in this version of SEC
|
||||
*/
|
||||
uint8_t crc_acc_num;
|
||||
/* The number of copies of the CRC module that are implemented
|
||||
* in this version of SEC
|
||||
*/
|
||||
uint8_t pk_acc_num;
|
||||
/* The number of copies of the Public Key module that are
|
||||
* implemented in this version of SEC
|
||||
*/
|
||||
uint8_t kasumi_acc_num;
|
||||
/* The number of copies of the Kasumi module that are
|
||||
* implemented in this version of SEC
|
||||
*/
|
||||
uint8_t rng_acc_num;
|
||||
/* The number of copies of the Random Number Generator that are
|
||||
* implemented in this version of SEC
|
||||
*/
|
||||
uint8_t md_acc_num;
|
||||
/* The number of copies of the MDHA (Hashing module) that are
|
||||
* implemented in this version of SEC
|
||||
*/
|
||||
uint8_t arc4_acc_num;
|
||||
/* The number of copies of the ARC4 module that are implemented
|
||||
* in this version of SEC
|
||||
*/
|
||||
uint8_t des_acc_num;
|
||||
/* The number of copies of the DES module that are implemented
|
||||
* in this version of SEC
|
||||
*/
|
||||
uint8_t aes_acc_num;
|
||||
/* The number of copies of the AES module that are implemented
|
||||
* in this version of SEC
|
||||
*/
|
||||
};
|
||||
|
||||
/**
|
||||
* dpseci_get_sec_attr() - Retrieve SEC accelerator attributes.
|
||||
* @param mc_io Pointer to MC portal's I/O object
|
||||
* @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @param token Token of DPSECI object
|
||||
* @param attr Returned SEC attributes
|
||||
*
|
||||
* @return:
|
||||
* - Return '0' on Success.
|
||||
* - Return Error code otherwise.
|
||||
*/
|
||||
int
|
||||
dpseci_get_sec_attr(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
struct dpseci_sec_attr *attr);
|
||||
int dpseci_get_sec_attr(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
struct dpseci_sec_attr *attr);
|
||||
|
||||
/**
|
||||
* struct dpseci_sec_counters - Structure representing global SEC counters and
|
||||
* not per dpseci counters
|
||||
* @dequeued_requests: Number of Requests Dequeued
|
||||
* @ob_enc_requests: Number of Outbound Encrypt Requests
|
||||
* @ib_dec_requests: Number of Inbound Decrypt Requests
|
||||
* @ob_enc_bytes: Number of Outbound Bytes Encrypted
|
||||
* @ob_prot_bytes: Number of Outbound Bytes Protected
|
||||
* @ib_dec_bytes: Number of Inbound Bytes Decrypted
|
||||
* @ib_valid_bytes: Number of Inbound Bytes Validated
|
||||
*/
|
||||
struct dpseci_sec_counters {
|
||||
uint64_t dequeued_requests; /* Number of Requests Dequeued */
|
||||
uint64_t ob_enc_requests; /* Number of Outbound Encrypt Requests */
|
||||
uint64_t ib_dec_requests; /* Number of Inbound Decrypt Requests */
|
||||
uint64_t ob_enc_bytes; /* Number of Outbound Bytes Encrypted */
|
||||
uint64_t ob_prot_bytes; /* Number of Outbound Bytes Protected */
|
||||
uint64_t ib_dec_bytes; /* Number of Inbound Bytes Decrypted */
|
||||
uint64_t ib_valid_bytes; /* Number of Inbound Bytes Validated */
|
||||
uint64_t dequeued_requests;
|
||||
uint64_t ob_enc_requests;
|
||||
uint64_t ib_dec_requests;
|
||||
uint64_t ob_enc_bytes;
|
||||
uint64_t ob_prot_bytes;
|
||||
uint64_t ib_dec_bytes;
|
||||
uint64_t ib_valid_bytes;
|
||||
};
|
||||
|
||||
int dpseci_get_sec_counters(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
struct dpseci_sec_counters *counters);
|
||||
|
||||
int dpseci_get_api_version(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t *major_ver,
|
||||
uint16_t *minor_ver);
|
||||
/**
|
||||
* enum dpseci_congestion_unit - DPSECI congestion units
|
||||
* @DPSECI_CONGESTION_UNIT_BYTES: bytes units
|
||||
* @DPSECI_CONGESTION_UNIT_FRAMES: frames units
|
||||
*/
|
||||
enum dpseci_congestion_unit {
|
||||
DPSECI_CONGESTION_UNIT_BYTES = 0,
|
||||
DPSECI_CONGESTION_UNIT_FRAMES
|
||||
};
|
||||
|
||||
/**
|
||||
* dpseci_get_sec_counters() - Retrieve SEC accelerator counters.
|
||||
* @param mc_io Pointer to MC portal's I/O object
|
||||
* @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @param token Token of DPSECI object
|
||||
* @param counters Returned SEC counters
|
||||
*
|
||||
* @return:
|
||||
* - Return '0' on Success.
|
||||
* - Return Error code otherwise.
|
||||
* CSCN message is written to message_iova once entering a
|
||||
* congestion state (see 'threshold_entry')
|
||||
*/
|
||||
int
|
||||
dpseci_get_sec_counters(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
struct dpseci_sec_counters *counters);
|
||||
#define DPSECI_CGN_MODE_WRITE_MEM_ON_ENTER 0x00000001
|
||||
/**
|
||||
* CSCN message is written to message_iova once exiting a
|
||||
* congestion state (see 'threshold_exit')
|
||||
*/
|
||||
#define DPSECI_CGN_MODE_WRITE_MEM_ON_EXIT 0x00000002
|
||||
/**
|
||||
* CSCN write will attempt to allocate into a cache (coherent write);
|
||||
* valid only if 'DPSECI_CGN_MODE_WRITE_MEM_<X>' is selected
|
||||
*/
|
||||
#define DPSECI_CGN_MODE_COHERENT_WRITE 0x00000004
|
||||
/**
|
||||
* if 'dpseci_dest_cfg.dest_type != DPSECI_DEST_NONE' CSCN message is sent to
|
||||
* DPIO/DPCON's WQ channel once entering a congestion state
|
||||
* (see 'threshold_entry')
|
||||
*/
|
||||
#define DPSECI_CGN_MODE_NOTIFY_DEST_ON_ENTER 0x00000008
|
||||
/**
|
||||
* if 'dpseci_dest_cfg.dest_type != DPSECI_DEST_NONE' CSCN message is sent to
|
||||
* DPIO/DPCON's WQ channel once exiting a congestion state
|
||||
* (see 'threshold_exit')
|
||||
*/
|
||||
#define DPSECI_CGN_MODE_NOTIFY_DEST_ON_EXIT 0x00000010
|
||||
/**
|
||||
* if 'dpseci_dest_cfg.dest_type != DPSECI_DEST_NONE' when the CSCN is written
|
||||
* to the sw-portal's DQRR, the DQRI interrupt is asserted immediately
|
||||
* (if enabled)
|
||||
*/
|
||||
#define DPSECI_CGN_MODE_INTR_COALESCING_DISABLED 0x00000020
|
||||
|
||||
/**
|
||||
* dpseci_get_api_version() - Get Data Path SEC Interface API version
|
||||
* @param mc_io Pointer to MC portal's I/O object
|
||||
* @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_'
|
||||
* @param major_ver Major version of data path sec API
|
||||
* @param minor_ver Minor version of data path sec API
|
||||
*
|
||||
* @return:
|
||||
* - Return '0' on Success.
|
||||
* - Return Error code otherwise.
|
||||
* struct dpseci_congestion_notification_cfg - congestion notification
|
||||
* configuration
|
||||
* @units: units type
|
||||
* @threshold_entry: above this threshold we enter a congestion state.
|
||||
* set it to '0' to disable it
|
||||
* @threshold_exit: below this threshold we exit the congestion state.
|
||||
* @message_ctx: The context that will be part of the CSCN message
|
||||
* @message_iova: I/O virtual address (must be in DMA-able memory),
|
||||
* must be 16B aligned;
|
||||
* @dest_cfg: CSCN can be send to either DPIO or DPCON WQ channel
|
||||
* @notification_mode: Mask of available options; use 'DPSECI_CGN_MODE_<X>'
|
||||
* values
|
||||
*/
|
||||
int
|
||||
dpseci_get_api_version(struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t *major_ver,
|
||||
uint16_t *minor_ver);
|
||||
struct dpseci_congestion_notification_cfg {
|
||||
enum dpseci_congestion_unit units;
|
||||
uint32_t threshold_entry;
|
||||
uint32_t threshold_exit;
|
||||
uint64_t message_ctx;
|
||||
uint64_t message_iova;
|
||||
struct dpseci_dest_cfg dest_cfg;
|
||||
uint16_t notification_mode;
|
||||
};
|
||||
|
||||
int dpseci_set_congestion_notification(
|
||||
struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
const struct dpseci_congestion_notification_cfg *cfg);
|
||||
|
||||
int dpseci_get_congestion_notification(
|
||||
struct fsl_mc_io *mc_io,
|
||||
uint32_t cmd_flags,
|
||||
uint16_t token,
|
||||
struct dpseci_congestion_notification_cfg *cfg);
|
||||
|
||||
#endif /* __FSL_DPSECI_H */
|
||||
|
@ -5,7 +5,7 @@
|
||||
* BSD LICENSE
|
||||
*
|
||||
* Copyright 2013-2016 Freescale Semiconductor Inc.
|
||||
* Copyright 2016 NXP.
|
||||
* Copyright 2016-2017 NXP.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@ -37,220 +37,187 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _FSL_DPSECI_CMD_H
|
||||
#define _FSL_DPSECI_CMD_H
|
||||
|
||||
/* DPSECI Version */
|
||||
#define DPSECI_VER_MAJOR 5
|
||||
#define DPSECI_VER_MINOR 0
|
||||
#define DPSECI_VER_MAJOR 5
|
||||
#define DPSECI_VER_MINOR 1
|
||||
|
||||
/* Command versioning */
|
||||
#define DPSECI_CMD_BASE_VERSION 1
|
||||
#define DPSECI_CMD_BASE_VERSION_V2 2
|
||||
#define DPSECI_CMD_ID_OFFSET 4
|
||||
|
||||
#define DPSECI_CMD_V1(id) \
|
||||
((id << DPSECI_CMD_ID_OFFSET) | DPSECI_CMD_BASE_VERSION)
|
||||
#define DPSECI_CMD_V2(id) \
|
||||
((id << DPSECI_CMD_ID_OFFSET) | DPSECI_CMD_BASE_VERSION_V2)
|
||||
|
||||
/* Command IDs */
|
||||
#define DPSECI_CMDID_CLOSE ((0x800 << 4) | (0x1))
|
||||
#define DPSECI_CMDID_OPEN ((0x809 << 4) | (0x1))
|
||||
#define DPSECI_CMDID_CREATE ((0x909 << 4) | (0x1))
|
||||
#define DPSECI_CMDID_DESTROY ((0x989 << 4) | (0x1))
|
||||
#define DPSECI_CMDID_GET_API_VERSION ((0xa09 << 4) | (0x1))
|
||||
#define DPSECI_CMDID_CLOSE DPSECI_CMD_V1(0x800)
|
||||
#define DPSECI_CMDID_OPEN DPSECI_CMD_V1(0x809)
|
||||
#define DPSECI_CMDID_CREATE DPSECI_CMD_V2(0x909)
|
||||
#define DPSECI_CMDID_DESTROY DPSECI_CMD_V1(0x989)
|
||||
#define DPSECI_CMDID_GET_API_VERSION DPSECI_CMD_V1(0xa09)
|
||||
|
||||
#define DPSECI_CMDID_ENABLE ((0x002 << 4) | (0x1))
|
||||
#define DPSECI_CMDID_DISABLE ((0x003 << 4) | (0x1))
|
||||
#define DPSECI_CMDID_GET_ATTR ((0x004 << 4) | (0x1))
|
||||
#define DPSECI_CMDID_RESET ((0x005 << 4) | (0x1))
|
||||
#define DPSECI_CMDID_IS_ENABLED ((0x006 << 4) | (0x1))
|
||||
#define DPSECI_CMDID_ENABLE DPSECI_CMD_V1(0x002)
|
||||
#define DPSECI_CMDID_DISABLE DPSECI_CMD_V1(0x003)
|
||||
#define DPSECI_CMDID_GET_ATTR DPSECI_CMD_V1(0x004)
|
||||
#define DPSECI_CMDID_RESET DPSECI_CMD_V1(0x005)
|
||||
#define DPSECI_CMDID_IS_ENABLED DPSECI_CMD_V1(0x006)
|
||||
|
||||
#define DPSECI_CMDID_SET_IRQ ((0x010 << 4) | (0x1))
|
||||
#define DPSECI_CMDID_GET_IRQ ((0x011 << 4) | (0x1))
|
||||
#define DPSECI_CMDID_SET_IRQ_ENABLE ((0x012 << 4) | (0x1))
|
||||
#define DPSECI_CMDID_GET_IRQ_ENABLE ((0x013 << 4) | (0x1))
|
||||
#define DPSECI_CMDID_SET_IRQ_MASK ((0x014 << 4) | (0x1))
|
||||
#define DPSECI_CMDID_GET_IRQ_MASK ((0x015 << 4) | (0x1))
|
||||
#define DPSECI_CMDID_GET_IRQ_STATUS ((0x016 << 4) | (0x1))
|
||||
#define DPSECI_CMDID_CLEAR_IRQ_STATUS ((0x017 << 4) | (0x1))
|
||||
#define DPSECI_CMDID_SET_RX_QUEUE DPSECI_CMD_V1(0x194)
|
||||
#define DPSECI_CMDID_GET_RX_QUEUE DPSECI_CMD_V1(0x196)
|
||||
#define DPSECI_CMDID_GET_TX_QUEUE DPSECI_CMD_V1(0x197)
|
||||
#define DPSECI_CMDID_GET_SEC_ATTR DPSECI_CMD_V1(0x198)
|
||||
#define DPSECI_CMDID_GET_SEC_COUNTERS DPSECI_CMD_V1(0x199)
|
||||
|
||||
#define DPSECI_CMDID_SET_RX_QUEUE ((0x194 << 4) | (0x1))
|
||||
#define DPSECI_CMDID_GET_RX_QUEUE ((0x196 << 4) | (0x1))
|
||||
#define DPSECI_CMDID_GET_TX_QUEUE ((0x197 << 4) | (0x1))
|
||||
#define DPSECI_CMDID_GET_SEC_ATTR ((0x198 << 4) | (0x1))
|
||||
#define DPSECI_CMDID_GET_SEC_COUNTERS ((0x199 << 4) | (0x1))
|
||||
#define DPSECI_CMDID_SET_CONGESTION_NOTIFICATION DPSECI_CMD_V1(0x170)
|
||||
#define DPSECI_CMDID_GET_CONGESTION_NOTIFICATION DPSECI_CMD_V1(0x171)
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPSECI_CMD_OPEN(cmd, dpseci_id) \
|
||||
MC_CMD_OP(cmd, 0, 0, 32, int, dpseci_id)
|
||||
/* Macros for accessing command fields smaller than 1byte */
|
||||
#define DPSECI_MASK(field) \
|
||||
GENMASK(DPSECI_##field##_SHIFT + DPSECI_##field##_SIZE - 1, \
|
||||
DPSECI_##field##_SHIFT)
|
||||
#define dpseci_set_field(var, field, val) \
|
||||
((var) |= (((val) << DPSECI_##field##_SHIFT) & DPSECI_MASK(field)))
|
||||
#define dpseci_get_field(var, field) \
|
||||
(((var) & DPSECI_MASK(field)) >> DPSECI_##field##_SHIFT)
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPSECI_CMD_CREATE(cmd, cfg) \
|
||||
do { \
|
||||
MC_CMD_OP(cmd, 0, 0, 8, uint8_t, cfg->priorities[0]);\
|
||||
MC_CMD_OP(cmd, 0, 8, 8, uint8_t, cfg->priorities[1]);\
|
||||
MC_CMD_OP(cmd, 0, 16, 8, uint8_t, cfg->priorities[2]);\
|
||||
MC_CMD_OP(cmd, 0, 24, 8, uint8_t, cfg->priorities[3]);\
|
||||
MC_CMD_OP(cmd, 0, 32, 8, uint8_t, cfg->priorities[4]);\
|
||||
MC_CMD_OP(cmd, 0, 40, 8, uint8_t, cfg->priorities[5]);\
|
||||
MC_CMD_OP(cmd, 0, 48, 8, uint8_t, cfg->priorities[6]);\
|
||||
MC_CMD_OP(cmd, 0, 56, 8, uint8_t, cfg->priorities[7]);\
|
||||
MC_CMD_OP(cmd, 1, 0, 8, uint8_t, cfg->num_tx_queues);\
|
||||
MC_CMD_OP(cmd, 1, 8, 8, uint8_t, cfg->num_rx_queues);\
|
||||
} while (0)
|
||||
#pragma pack(push, 1)
|
||||
struct dpseci_cmd_open {
|
||||
uint32_t dpseci_id;
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPSECI_RSP_IS_ENABLED(cmd, en) \
|
||||
MC_RSP_OP(cmd, 0, 0, 1, int, en)
|
||||
struct dpseci_cmd_create {
|
||||
uint8_t priorities[8];
|
||||
uint8_t num_tx_queues;
|
||||
uint8_t num_rx_queues;
|
||||
uint8_t pad[6];
|
||||
uint32_t options;
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPSECI_CMD_SET_IRQ(cmd, irq_index, irq_cfg) \
|
||||
do { \
|
||||
MC_CMD_OP(cmd, 0, 0, 8, uint8_t, irq_index);\
|
||||
MC_CMD_OP(cmd, 0, 32, 32, uint32_t, irq_cfg->val);\
|
||||
MC_CMD_OP(cmd, 1, 0, 64, uint64_t, irq_cfg->addr);\
|
||||
MC_CMD_OP(cmd, 2, 0, 32, int, irq_cfg->irq_num); \
|
||||
} while (0)
|
||||
struct dpseci_cmd_destroy {
|
||||
uint32_t dpseci_id;
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPSECI_CMD_GET_IRQ(cmd, irq_index) \
|
||||
MC_CMD_OP(cmd, 0, 32, 8, uint8_t, irq_index)
|
||||
#define DPSECI_ENABLE_SHIFT 0
|
||||
#define DPSECI_ENABLE_SIZE 1
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPSECI_RSP_GET_IRQ(cmd, type, irq_cfg) \
|
||||
do { \
|
||||
MC_RSP_OP(cmd, 0, 0, 32, uint32_t, irq_cfg->val); \
|
||||
MC_RSP_OP(cmd, 1, 0, 64, uint64_t, irq_cfg->addr);\
|
||||
MC_RSP_OP(cmd, 2, 0, 32, int, irq_cfg->irq_num); \
|
||||
MC_RSP_OP(cmd, 2, 32, 32, int, type); \
|
||||
} while (0)
|
||||
struct dpseci_rsp_is_enabled {
|
||||
/* only the first LSB */
|
||||
uint8_t en;
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPSECI_CMD_SET_IRQ_ENABLE(cmd, irq_index, enable_state) \
|
||||
do { \
|
||||
MC_CMD_OP(cmd, 0, 0, 8, uint8_t, enable_state); \
|
||||
MC_CMD_OP(cmd, 0, 32, 8, uint8_t, irq_index); \
|
||||
} while (0)
|
||||
struct dpseci_rsp_get_attr {
|
||||
uint32_t id;
|
||||
uint32_t pad;
|
||||
uint8_t num_tx_queues;
|
||||
uint8_t num_rx_queues;
|
||||
uint8_t pad1[6];
|
||||
uint32_t options;
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPSECI_CMD_GET_IRQ_ENABLE(cmd, irq_index) \
|
||||
MC_CMD_OP(cmd, 0, 32, 8, uint8_t, irq_index)
|
||||
#define DPSECI_DEST_TYPE_SHIFT 0
|
||||
#define DPSECI_DEST_TYPE_SIZE 4
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPSECI_RSP_GET_IRQ_ENABLE(cmd, enable_state) \
|
||||
MC_RSP_OP(cmd, 0, 0, 8, uint8_t, enable_state)
|
||||
#define DPSECI_ORDER_PRESERVATION_SHIFT 0
|
||||
#define DPSECI_ORDER_PRESERVATION_SIZE 1
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPSECI_CMD_SET_IRQ_MASK(cmd, irq_index, mask) \
|
||||
do { \
|
||||
MC_CMD_OP(cmd, 0, 0, 32, uint32_t, mask); \
|
||||
MC_CMD_OP(cmd, 0, 32, 8, uint8_t, irq_index); \
|
||||
} while (0)
|
||||
struct dpseci_cmd_set_rx_queue {
|
||||
uint32_t dest_id;
|
||||
uint8_t dest_priority;
|
||||
uint8_t queue;
|
||||
/* from LSB: dest_type:4 */
|
||||
uint8_t dest_type;
|
||||
uint8_t pad;
|
||||
uint64_t user_ctx;
|
||||
uint32_t options;
|
||||
/* only the LSB */
|
||||
uint8_t order_preservation_en;
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPSECI_CMD_GET_IRQ_MASK(cmd, irq_index) \
|
||||
MC_CMD_OP(cmd, 0, 32, 8, uint8_t, irq_index)
|
||||
struct dpseci_cmd_get_queue {
|
||||
uint8_t pad[5];
|
||||
uint8_t queue;
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPSECI_RSP_GET_IRQ_MASK(cmd, mask) \
|
||||
MC_RSP_OP(cmd, 0, 0, 32, uint32_t, mask)
|
||||
struct dpseci_rsp_get_rx_queue {
|
||||
uint32_t dest_id;
|
||||
uint8_t dest_priority;
|
||||
uint8_t pad1;
|
||||
/* from LSB: dest_type:4 */
|
||||
uint8_t dest_type;
|
||||
uint8_t pad2;
|
||||
uint64_t user_ctx;
|
||||
uint32_t fqid;
|
||||
/* only the LSB */
|
||||
uint8_t order_preservation_en;
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPSECI_CMD_GET_IRQ_STATUS(cmd, irq_index, status) \
|
||||
do { \
|
||||
MC_CMD_OP(cmd, 0, 0, 32, uint32_t, status);\
|
||||
MC_CMD_OP(cmd, 0, 32, 8, uint8_t, irq_index);\
|
||||
} while (0)
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPSECI_RSP_GET_IRQ_STATUS(cmd, status) \
|
||||
MC_RSP_OP(cmd, 0, 0, 32, uint32_t, status)
|
||||
struct dpseci_rsp_get_tx_queue {
|
||||
uint32_t pad;
|
||||
uint32_t fqid;
|
||||
uint8_t priority;
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPSECI_CMD_CLEAR_IRQ_STATUS(cmd, irq_index, status) \
|
||||
do { \
|
||||
MC_CMD_OP(cmd, 0, 0, 32, uint32_t, status); \
|
||||
MC_CMD_OP(cmd, 0, 32, 8, uint8_t, irq_index); \
|
||||
} while (0)
|
||||
struct dpseci_rsp_get_sec_attr {
|
||||
uint16_t ip_id;
|
||||
uint8_t major_rev;
|
||||
uint8_t minor_rev;
|
||||
uint8_t era;
|
||||
uint8_t pad1[3];
|
||||
uint8_t deco_num;
|
||||
uint8_t zuc_auth_acc_num;
|
||||
uint8_t zuc_enc_acc_num;
|
||||
uint8_t pad2;
|
||||
uint8_t snow_f8_acc_num;
|
||||
uint8_t snow_f9_acc_num;
|
||||
uint8_t crc_acc_num;
|
||||
uint8_t pad3;
|
||||
uint8_t pk_acc_num;
|
||||
uint8_t kasumi_acc_num;
|
||||
uint8_t rng_acc_num;
|
||||
uint8_t pad4;
|
||||
uint8_t md_acc_num;
|
||||
uint8_t arc4_acc_num;
|
||||
uint8_t des_acc_num;
|
||||
uint8_t aes_acc_num;
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPSECI_RSP_GET_ATTR(cmd, attr) \
|
||||
do { \
|
||||
MC_RSP_OP(cmd, 0, 0, 32, int, attr->id); \
|
||||
MC_RSP_OP(cmd, 1, 0, 8, uint8_t, attr->num_tx_queues); \
|
||||
MC_RSP_OP(cmd, 1, 8, 8, uint8_t, attr->num_rx_queues); \
|
||||
} while (0)
|
||||
struct dpseci_rsp_get_sec_counters {
|
||||
uint64_t dequeued_requests;
|
||||
uint64_t ob_enc_requests;
|
||||
uint64_t ib_dec_requests;
|
||||
uint64_t ob_enc_bytes;
|
||||
uint64_t ob_prot_bytes;
|
||||
uint64_t ib_dec_bytes;
|
||||
uint64_t ib_valid_bytes;
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPSECI_CMD_SET_RX_QUEUE(cmd, queue, cfg) \
|
||||
do { \
|
||||
MC_CMD_OP(cmd, 0, 0, 32, int, cfg->dest_cfg.dest_id); \
|
||||
MC_CMD_OP(cmd, 0, 32, 8, uint8_t, cfg->dest_cfg.priority); \
|
||||
MC_CMD_OP(cmd, 0, 40, 8, uint8_t, queue); \
|
||||
MC_CMD_OP(cmd, 0, 48, 4, enum dpseci_dest, cfg->dest_cfg.dest_type); \
|
||||
MC_CMD_OP(cmd, 1, 0, 64, uint64_t, cfg->user_ctx); \
|
||||
MC_CMD_OP(cmd, 2, 0, 32, uint32_t, cfg->options);\
|
||||
MC_CMD_OP(cmd, 2, 32, 1, int, cfg->order_preservation_en);\
|
||||
} while (0)
|
||||
struct dpseci_rsp_get_api_version {
|
||||
uint16_t major;
|
||||
uint16_t minor;
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPSECI_CMD_GET_RX_QUEUE(cmd, queue) \
|
||||
MC_CMD_OP(cmd, 0, 40, 8, uint8_t, queue)
|
||||
#define DPSECI_DEST_TYPE_SHIFT 0
|
||||
#define DPSECI_DEST_TYPE_SIZE 4
|
||||
#define DPSECI_CG_UNITS_SHIFT 4
|
||||
#define DPSECI_CG_UNITS_SIZE 2
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPSECI_RSP_GET_RX_QUEUE(cmd, attr) \
|
||||
do { \
|
||||
MC_RSP_OP(cmd, 0, 0, 32, int, attr->dest_cfg.dest_id);\
|
||||
MC_RSP_OP(cmd, 0, 32, 8, uint8_t, attr->dest_cfg.priority);\
|
||||
MC_RSP_OP(cmd, 0, 48, 4, enum dpseci_dest, attr->dest_cfg.dest_type);\
|
||||
MC_RSP_OP(cmd, 1, 0, 8, uint64_t, attr->user_ctx);\
|
||||
MC_RSP_OP(cmd, 2, 0, 32, uint32_t, attr->fqid);\
|
||||
MC_RSP_OP(cmd, 2, 32, 1, int, attr->order_preservation_en);\
|
||||
} while (0)
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPSECI_CMD_GET_TX_QUEUE(cmd, queue) \
|
||||
MC_CMD_OP(cmd, 0, 40, 8, uint8_t, queue)
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPSECI_RSP_GET_TX_QUEUE(cmd, attr) \
|
||||
do { \
|
||||
MC_RSP_OP(cmd, 0, 32, 32, uint32_t, attr->fqid);\
|
||||
MC_RSP_OP(cmd, 1, 0, 8, uint8_t, attr->priority);\
|
||||
} while (0)
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPSECI_RSP_GET_SEC_ATTR(cmd, attr) \
|
||||
do { \
|
||||
MC_RSP_OP(cmd, 0, 0, 16, uint16_t, attr->ip_id);\
|
||||
MC_RSP_OP(cmd, 0, 16, 8, uint8_t, attr->major_rev);\
|
||||
MC_RSP_OP(cmd, 0, 24, 8, uint8_t, attr->minor_rev);\
|
||||
MC_RSP_OP(cmd, 0, 32, 8, uint8_t, attr->era);\
|
||||
MC_RSP_OP(cmd, 1, 0, 8, uint8_t, attr->deco_num);\
|
||||
MC_RSP_OP(cmd, 1, 8, 8, uint8_t, attr->zuc_auth_acc_num);\
|
||||
MC_RSP_OP(cmd, 1, 16, 8, uint8_t, attr->zuc_enc_acc_num);\
|
||||
MC_RSP_OP(cmd, 1, 32, 8, uint8_t, attr->snow_f8_acc_num);\
|
||||
MC_RSP_OP(cmd, 1, 40, 8, uint8_t, attr->snow_f9_acc_num);\
|
||||
MC_RSP_OP(cmd, 1, 48, 8, uint8_t, attr->crc_acc_num);\
|
||||
MC_RSP_OP(cmd, 2, 0, 8, uint8_t, attr->pk_acc_num);\
|
||||
MC_RSP_OP(cmd, 2, 8, 8, uint8_t, attr->kasumi_acc_num);\
|
||||
MC_RSP_OP(cmd, 2, 16, 8, uint8_t, attr->rng_acc_num);\
|
||||
MC_RSP_OP(cmd, 2, 32, 8, uint8_t, attr->md_acc_num);\
|
||||
MC_RSP_OP(cmd, 2, 40, 8, uint8_t, attr->arc4_acc_num);\
|
||||
MC_RSP_OP(cmd, 2, 48, 8, uint8_t, attr->des_acc_num);\
|
||||
MC_RSP_OP(cmd, 2, 56, 8, uint8_t, attr->aes_acc_num);\
|
||||
} while (0)
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPSECI_RSP_GET_SEC_COUNTERS(cmd, counters) \
|
||||
do { \
|
||||
MC_RSP_OP(cmd, 0, 0, 64, uint64_t, counters->dequeued_requests);\
|
||||
MC_RSP_OP(cmd, 1, 0, 64, uint64_t, counters->ob_enc_requests);\
|
||||
MC_RSP_OP(cmd, 2, 0, 64, uint64_t, counters->ib_dec_requests);\
|
||||
MC_RSP_OP(cmd, 3, 0, 64, uint64_t, counters->ob_enc_bytes);\
|
||||
MC_RSP_OP(cmd, 4, 0, 64, uint64_t, counters->ob_prot_bytes);\
|
||||
MC_RSP_OP(cmd, 5, 0, 64, uint64_t, counters->ib_dec_bytes);\
|
||||
MC_RSP_OP(cmd, 6, 0, 64, uint64_t, counters->ib_valid_bytes);\
|
||||
} while (0)
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPSECI_RSP_GET_API_VERSION(cmd, major, minor) \
|
||||
do { \
|
||||
MC_RSP_OP(cmd, 0, 0, 16, uint16_t, major);\
|
||||
MC_RSP_OP(cmd, 0, 16, 16, uint16_t, minor);\
|
||||
} while (0)
|
||||
struct dpseci_cmd_set_congestion_notification {
|
||||
uint32_t dest_id;
|
||||
uint16_t notification_mode;
|
||||
uint8_t dest_priority;
|
||||
/* from LSB: dest_type: 4 units:2 */
|
||||
uint8_t type_units;
|
||||
uint64_t message_iova;
|
||||
uint64_t message_ctx;
|
||||
uint32_t threshold_entry;
|
||||
uint32_t threshold_exit;
|
||||
};
|
||||
|
||||
#pragma pack(pop)
|
||||
#endif /* _FSL_DPSECI_CMD_H */
|
||||
|
@ -63,6 +63,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += base/dpaa2_hw_dpni.c
|
||||
SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += dpaa2_rxtx.c
|
||||
SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += dpaa2_ethdev.c
|
||||
SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += mc/dpni.c
|
||||
SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += mc/dpkg.c
|
||||
|
||||
LDLIBS += -lrte_bus_fslmc
|
||||
LDLIBS += -lrte_mempool_dpaa2
|
||||
|
@ -79,7 +79,7 @@ dpaa2_setup_flow_dist(struct rte_eth_dev *eth_dev,
|
||||
tc_cfg.dist_size = eth_dev->data->nb_rx_queues;
|
||||
tc_cfg.dist_mode = DPNI_DIST_MODE_HASH;
|
||||
|
||||
ret = dpni_prepare_key_cfg(&kg_cfg, p_params);
|
||||
ret = dpkg_prepare_key_cfg(&kg_cfg, p_params);
|
||||
if (ret) {
|
||||
RTE_LOG(ERR, PMD, "Unable to prepare extract parameters\n");
|
||||
rte_free(p_params);
|
||||
@ -118,12 +118,12 @@ int dpaa2_remove_flow_dist(
|
||||
}
|
||||
memset(p_params, 0, DIST_PARAM_IOVA_SIZE);
|
||||
memset(&tc_cfg, 0, sizeof(struct dpni_rx_tc_dist_cfg));
|
||||
|
||||
kg_cfg.num_extracts = 0;
|
||||
tc_cfg.key_cfg_iova = (uint64_t)(DPAA2_VADDR_TO_IOVA(p_params));
|
||||
tc_cfg.dist_size = 0;
|
||||
tc_cfg.dist_mode = DPNI_DIST_MODE_NONE;
|
||||
|
||||
ret = dpni_prepare_key_cfg(&kg_cfg, p_params);
|
||||
ret = dpkg_prepare_key_cfg(&kg_cfg, p_params);
|
||||
if (ret) {
|
||||
RTE_LOG(ERR, PMD, "Unable to prepare extract parameters\n");
|
||||
rte_free(p_params);
|
||||
@ -133,12 +133,10 @@ int dpaa2_remove_flow_dist(
|
||||
ret = dpni_set_rx_tc_dist(dpni, CMD_PRI_LOW, priv->token, tc_index,
|
||||
&tc_cfg);
|
||||
rte_free(p_params);
|
||||
if (ret) {
|
||||
if (ret)
|
||||
RTE_LOG(ERR, PMD,
|
||||
"Setting distribution for Rx failed with err: %d\n",
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -337,6 +335,7 @@ dpaa2_attach_bp_list(struct dpaa2_dev_priv *priv,
|
||||
bpool_cfg.pools[0].backup_pool = 0;
|
||||
bpool_cfg.pools[0].buffer_size = RTE_ALIGN_CEIL(bp_list->buf_pool.size,
|
||||
DPAA2_PACKET_LAYOUT_ALIGN);
|
||||
bpool_cfg.pools[0].priority_mask = 0;
|
||||
|
||||
retcode = dpni_set_pools(dpni, CMD_PRI_LOW, priv->token, &bpool_cfg);
|
||||
if (retcode != 0) {
|
||||
|
@ -941,7 +941,7 @@ void dpaa2_dev_stats_get(struct rte_eth_dev *dev,
|
||||
|
||||
/*Get Counters from page_0*/
|
||||
retcode = dpni_get_statistics(dpni, CMD_PRI_LOW, priv->token,
|
||||
page0, &value);
|
||||
page0, 0, &value);
|
||||
if (retcode)
|
||||
goto err;
|
||||
|
||||
@ -950,7 +950,7 @@ void dpaa2_dev_stats_get(struct rte_eth_dev *dev,
|
||||
|
||||
/*Get Counters from page_1*/
|
||||
retcode = dpni_get_statistics(dpni, CMD_PRI_LOW, priv->token,
|
||||
page1, &value);
|
||||
page1, 0, &value);
|
||||
if (retcode)
|
||||
goto err;
|
||||
|
||||
@ -959,7 +959,7 @@ void dpaa2_dev_stats_get(struct rte_eth_dev *dev,
|
||||
|
||||
/*Get Counters from page_2*/
|
||||
retcode = dpni_get_statistics(dpni, CMD_PRI_LOW, priv->token,
|
||||
page2, &value);
|
||||
page2, 0, &value);
|
||||
if (retcode)
|
||||
goto err;
|
||||
|
||||
@ -1384,22 +1384,19 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev)
|
||||
goto init_err;
|
||||
}
|
||||
|
||||
priv->num_tc = attr.num_tcs;
|
||||
priv->num_rx_tc = attr.num_rx_tcs;
|
||||
|
||||
/* Resetting the "num_rx_vqueues" to equal number of queues in first TC
|
||||
/* Resetting the "num_rx_queues" to equal number of queues in first TC
|
||||
* as only one TC is supported on Rx Side. Once Multiple TCs will be
|
||||
* in use for Rx processing then this will be changed or removed.
|
||||
*/
|
||||
priv->nb_rx_queues = attr.num_queues;
|
||||
|
||||
/* TODO:Using hard coded value for number of TX queues due to dependency
|
||||
* in MC.
|
||||
*/
|
||||
priv->nb_tx_queues = 8;
|
||||
/* Using number of TX queues as number of TX TCs */
|
||||
priv->nb_tx_queues = attr.num_tx_tcs;
|
||||
|
||||
PMD_INIT_LOG(DEBUG, "num TC - RX %d", priv->num_tc);
|
||||
PMD_INIT_LOG(DEBUG, "nb_tx_queues %d", priv->nb_tx_queues);
|
||||
PMD_INIT_LOG(DEBUG, "nb_rx_queues %d", priv->nb_rx_queues);
|
||||
PMD_DRV_LOG(DEBUG, "RX-TC= %d, nb_rx_queues= %d, nb_tx_queues=%d",
|
||||
priv->num_tc, priv->nb_rx_queues, priv->nb_tx_queues);
|
||||
|
||||
priv->hw = dpni_dev;
|
||||
priv->hw_id = hw_id;
|
||||
|
@ -87,7 +87,7 @@ struct dpaa2_dev_priv {
|
||||
uint32_t options;
|
||||
uint8_t max_mac_filters;
|
||||
uint8_t max_vlan_filters;
|
||||
uint8_t num_tc;
|
||||
uint8_t num_rx_tc;
|
||||
uint8_t flags; /*dpaa2 config flags */
|
||||
};
|
||||
|
||||
|
107
drivers/net/dpaa2/mc/dpkg.c
Normal file
107
drivers/net/dpaa2/mc/dpkg.c
Normal file
@ -0,0 +1,107 @@
|
||||
/*-
|
||||
* This file is provided under a dual BSD/GPLv2 license. When using or
|
||||
* redistributing this file, you may do so under either license.
|
||||
*
|
||||
* BSD LICENSE
|
||||
*
|
||||
* Copyright 2017 NXP
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the above-listed copyright holders nor the
|
||||
* names of any contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* GPL LICENSE SUMMARY
|
||||
*
|
||||
* ALTERNATIVELY, this software may be distributed under the terms of the
|
||||
* GNU General Public License ("GPL") as published by the Free Software
|
||||
* Foundation, either version 2 of that License or (at your option) any
|
||||
* later version.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include <fsl_mc_sys.h>
|
||||
#include <fsl_mc_cmd.h>
|
||||
#include <fsl_dpkg.h>
|
||||
|
||||
/**
|
||||
* dpkg_prepare_key_cfg() - function prepare extract parameters
|
||||
* @cfg: defining a full Key Generation profile (rule)
|
||||
* @key_cfg_buf: Zeroed 256 bytes of memory before mapping it to DMA
|
||||
*
|
||||
* This function has to be called before the following functions:
|
||||
* - dpni_set_rx_tc_dist()
|
||||
* - dpni_set_qos_table()
|
||||
* - dpkg_prepare_key_cfg()
|
||||
*/
|
||||
int
|
||||
dpkg_prepare_key_cfg(const struct dpkg_profile_cfg *cfg, uint8_t *key_cfg_buf)
|
||||
{
|
||||
int i, j;
|
||||
struct dpni_ext_set_rx_tc_dist *dpni_ext;
|
||||
struct dpni_dist_extract *extr;
|
||||
|
||||
if (cfg->num_extracts > DPKG_MAX_NUM_OF_EXTRACTS)
|
||||
return -EINVAL;
|
||||
|
||||
dpni_ext = (struct dpni_ext_set_rx_tc_dist *)key_cfg_buf;
|
||||
dpni_ext->num_extracts = cfg->num_extracts;
|
||||
|
||||
for (i = 0; i < cfg->num_extracts; i++) {
|
||||
extr = &dpni_ext->extracts[i];
|
||||
|
||||
switch (cfg->extracts[i].type) {
|
||||
case DPKG_EXTRACT_FROM_HDR:
|
||||
extr->prot = cfg->extracts[i].extract.from_hdr.prot;
|
||||
dpkg_set_field(extr->efh_type, EFH_TYPE,
|
||||
cfg->extracts[i].extract.from_hdr.type);
|
||||
extr->size = cfg->extracts[i].extract.from_hdr.size;
|
||||
extr->offset = cfg->extracts[i].extract.from_hdr.offset;
|
||||
extr->field = cpu_to_le32(
|
||||
cfg->extracts[i].extract.from_hdr.field);
|
||||
extr->hdr_index =
|
||||
cfg->extracts[i].extract.from_hdr.hdr_index;
|
||||
break;
|
||||
case DPKG_EXTRACT_FROM_DATA:
|
||||
extr->size = cfg->extracts[i].extract.from_data.size;
|
||||
extr->offset =
|
||||
cfg->extracts[i].extract.from_data.offset;
|
||||
break;
|
||||
case DPKG_EXTRACT_FROM_PARSE:
|
||||
extr->size = cfg->extracts[i].extract.from_parse.size;
|
||||
extr->offset =
|
||||
cfg->extracts[i].extract.from_parse.offset;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
extr->num_of_byte_masks = cfg->extracts[i].num_of_byte_masks;
|
||||
dpkg_set_field(extr->extract_type, EXTRACT_TYPE,
|
||||
cfg->extracts[i].type);
|
||||
|
||||
for (j = 0; j < DPKG_NUM_OF_MASKS; j++) {
|
||||
extr->masks[j].mask = cfg->extracts[i].masks[j].mask;
|
||||
extr->masks[j].offset =
|
||||
cfg->extracts[i].masks[j].offset;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -5,7 +5,7 @@
|
||||
* BSD LICENSE
|
||||
*
|
||||
* Copyright 2013-2015 Freescale Semiconductor Inc.
|
||||
* Copyright 2016 NXP.
|
||||
* Copyright 2016-2017 NXP.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@ -93,6 +93,15 @@ struct dpkg_mask {
|
||||
uint8_t offset;
|
||||
};
|
||||
|
||||
/* Macros for accessing command fields smaller than 1byte */
|
||||
#define DPKG_MASK(field) \
|
||||
GENMASK(DPKG_##field##_SHIFT + DPKG_##field##_SIZE - 1, \
|
||||
DPKG_##field##_SHIFT)
|
||||
#define dpkg_set_field(var, field, val) \
|
||||
((var) |= (((val) << DPKG_##field##_SHIFT) & DPKG_MASK(field)))
|
||||
#define dpkg_get_field(var, field) \
|
||||
(((var) & DPKG_MASK(field)) >> DPKG_##field##_SHIFT)
|
||||
|
||||
/**
|
||||
* struct dpkg_extract - A structure for defining a single extraction
|
||||
* @type: Determines how the union below is interpreted:
|
||||
@ -136,12 +145,12 @@ struct dpkg_extract {
|
||||
*/
|
||||
|
||||
struct {
|
||||
enum net_prot prot;
|
||||
enum net_prot prot;
|
||||
enum dpkg_extract_from_hdr_type type;
|
||||
uint32_t field;
|
||||
uint8_t size;
|
||||
uint8_t offset;
|
||||
uint8_t hdr_index;
|
||||
uint32_t field;
|
||||
uint8_t size;
|
||||
uint8_t offset;
|
||||
uint8_t hdr_index;
|
||||
} from_hdr;
|
||||
/**
|
||||
* struct from_data
|
||||
@ -166,8 +175,8 @@ struct dpkg_extract {
|
||||
} from_parse;
|
||||
} extract;
|
||||
|
||||
uint8_t num_of_byte_masks;
|
||||
struct dpkg_mask masks[DPKG_NUM_OF_MASKS];
|
||||
uint8_t num_of_byte_masks;
|
||||
struct dpkg_mask masks[DPKG_NUM_OF_MASKS];
|
||||
};
|
||||
|
||||
/**
|
||||
@ -181,4 +190,48 @@ struct dpkg_profile_cfg {
|
||||
struct dpkg_extract extracts[DPKG_MAX_NUM_OF_EXTRACTS];
|
||||
};
|
||||
|
||||
/* dpni_set_rx_tc_dist extension (structure of the DMA-able memory at
|
||||
* key_cfg_iova)
|
||||
*/
|
||||
struct dpni_mask_cfg {
|
||||
uint8_t mask;
|
||||
uint8_t offset;
|
||||
};
|
||||
|
||||
#define DPKG_EFH_TYPE_SHIFT 0
|
||||
#define DPKG_EFH_TYPE_SIZE 4
|
||||
#define DPKG_EXTRACT_TYPE_SHIFT 0
|
||||
#define DPKG_EXTRACT_TYPE_SIZE 4
|
||||
|
||||
struct dpni_dist_extract {
|
||||
/* word 0 */
|
||||
uint8_t prot;
|
||||
/* EFH type stored in the 4 least significant bits */
|
||||
uint8_t efh_type;
|
||||
uint8_t size;
|
||||
uint8_t offset;
|
||||
uint32_t field;
|
||||
/* word 1 */
|
||||
uint8_t hdr_index;
|
||||
uint8_t constant;
|
||||
uint8_t num_of_repeats;
|
||||
uint8_t num_of_byte_masks;
|
||||
/* Extraction type is stored in the 4 LSBs */
|
||||
uint8_t extract_type;
|
||||
uint8_t pad[3];
|
||||
/* word 2 */
|
||||
struct dpni_mask_cfg masks[4];
|
||||
};
|
||||
|
||||
struct dpni_ext_set_rx_tc_dist {
|
||||
/* extension word 0 */
|
||||
uint8_t num_extracts;
|
||||
uint8_t pad[7];
|
||||
/* words 1..25 */
|
||||
struct dpni_dist_extract extracts[10];
|
||||
};
|
||||
|
||||
int dpkg_prepare_key_cfg(const struct dpkg_profile_cfg *cfg,
|
||||
uint8_t *key_cfg_buf);
|
||||
|
||||
#endif /* __FSL_DPKG_H_ */
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -5,7 +5,7 @@
|
||||
* BSD LICENSE
|
||||
*
|
||||
* Copyright 2013-2016 Freescale Semiconductor Inc.
|
||||
* Copyright 2016 NXP.
|
||||
* Copyright 2016-2017 NXP.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@ -42,435 +42,547 @@
|
||||
|
||||
/* DPNI Version */
|
||||
#define DPNI_VER_MAJOR 7
|
||||
#define DPNI_VER_MINOR 0
|
||||
#define DPNI_VER_MINOR 3
|
||||
|
||||
#define DPNI_CMD_BASE_VERSION 1
|
||||
#define DPNI_CMD_VERSION_2 2
|
||||
#define DPNI_CMD_ID_OFFSET 4
|
||||
|
||||
#define DPNI_CMD(id) (((id) << DPNI_CMD_ID_OFFSET) | DPNI_CMD_BASE_VERSION)
|
||||
#define DPNI_CMD_V2(id) (((id) << DPNI_CMD_ID_OFFSET) | DPNI_CMD_VERSION_2)
|
||||
|
||||
/* Command IDs */
|
||||
#define DPNI_CMDID_OPEN ((0x801 << 4) | (0x1))
|
||||
#define DPNI_CMDID_CLOSE ((0x800 << 4) | (0x1))
|
||||
#define DPNI_CMDID_CREATE ((0x901 << 4) | (0x1))
|
||||
#define DPNI_CMDID_DESTROY ((0x981 << 4) | (0x1))
|
||||
#define DPNI_CMDID_GET_API_VERSION ((0xa01 << 4) | (0x1))
|
||||
#define DPNI_CMDID_OPEN DPNI_CMD(0x801)
|
||||
#define DPNI_CMDID_CLOSE DPNI_CMD(0x800)
|
||||
#define DPNI_CMDID_CREATE DPNI_CMD(0x901)
|
||||
#define DPNI_CMDID_DESTROY DPNI_CMD(0x981)
|
||||
#define DPNI_CMDID_GET_API_VERSION DPNI_CMD(0xa01)
|
||||
|
||||
#define DPNI_CMDID_ENABLE ((0x002 << 4) | (0x1))
|
||||
#define DPNI_CMDID_DISABLE ((0x003 << 4) | (0x1))
|
||||
#define DPNI_CMDID_GET_ATTR ((0x004 << 4) | (0x1))
|
||||
#define DPNI_CMDID_RESET ((0x005 << 4) | (0x1))
|
||||
#define DPNI_CMDID_IS_ENABLED ((0x006 << 4) | (0x1))
|
||||
#define DPNI_CMDID_ENABLE DPNI_CMD(0x002)
|
||||
#define DPNI_CMDID_DISABLE DPNI_CMD(0x003)
|
||||
#define DPNI_CMDID_GET_ATTR DPNI_CMD_V2(0x004)
|
||||
#define DPNI_CMDID_RESET DPNI_CMD(0x005)
|
||||
#define DPNI_CMDID_IS_ENABLED DPNI_CMD(0x006)
|
||||
|
||||
#define DPNI_CMDID_SET_POOLS ((0x200 << 4) | (0x1))
|
||||
#define DPNI_CMDID_SET_ERRORS_BEHAVIOR ((0x20B << 4) | (0x1))
|
||||
#define DPNI_CMDID_SET_POOLS DPNI_CMD_V2(0x200)
|
||||
#define DPNI_CMDID_SET_ERRORS_BEHAVIOR DPNI_CMD(0x20B)
|
||||
|
||||
#define DPNI_CMDID_GET_QDID ((0x210 << 4) | (0x1))
|
||||
#define DPNI_CMDID_GET_LINK_STATE ((0x215 << 4) | (0x1))
|
||||
#define DPNI_CMDID_SET_MAX_FRAME_LENGTH ((0x216 << 4) | (0x1))
|
||||
#define DPNI_CMDID_GET_MAX_FRAME_LENGTH ((0x217 << 4) | (0x1))
|
||||
#define DPNI_CMDID_SET_LINK_CFG ((0x21a << 4) | (0x1))
|
||||
#define DPNI_CMDID_GET_QDID DPNI_CMD(0x210)
|
||||
#define DPNI_CMDID_GET_SP_INFO DPNI_CMD(0x211)
|
||||
#define DPNI_CMDID_GET_TX_DATA_OFFSET DPNI_CMD(0x212)
|
||||
#define DPNI_CMDID_GET_LINK_STATE DPNI_CMD(0x215)
|
||||
#define DPNI_CMDID_SET_MAX_FRAME_LENGTH DPNI_CMD(0x216)
|
||||
#define DPNI_CMDID_GET_MAX_FRAME_LENGTH DPNI_CMD(0x217)
|
||||
#define DPNI_CMDID_SET_LINK_CFG DPNI_CMD(0x21A)
|
||||
#define DPNI_CMDID_SET_TX_SHAPING DPNI_CMD_V2(0x21B)
|
||||
|
||||
#define DPNI_CMDID_SET_MCAST_PROMISC ((0x220 << 4) | (0x1))
|
||||
#define DPNI_CMDID_GET_MCAST_PROMISC ((0x221 << 4) | (0x1))
|
||||
#define DPNI_CMDID_SET_UNICAST_PROMISC ((0x222 << 4) | (0x1))
|
||||
#define DPNI_CMDID_GET_UNICAST_PROMISC ((0x223 << 4) | (0x1))
|
||||
#define DPNI_CMDID_SET_PRIM_MAC ((0x224 << 4) | (0x1))
|
||||
#define DPNI_CMDID_GET_PRIM_MAC ((0x225 << 4) | (0x1))
|
||||
#define DPNI_CMDID_ADD_MAC_ADDR ((0x226 << 4) | (0x1))
|
||||
#define DPNI_CMDID_REMOVE_MAC_ADDR ((0x227 << 4) | (0x1))
|
||||
#define DPNI_CMDID_CLR_MAC_FILTERS ((0x228 << 4) | (0x1))
|
||||
#define DPNI_CMDID_SET_MCAST_PROMISC DPNI_CMD(0x220)
|
||||
#define DPNI_CMDID_GET_MCAST_PROMISC DPNI_CMD(0x221)
|
||||
#define DPNI_CMDID_SET_UNICAST_PROMISC DPNI_CMD(0x222)
|
||||
#define DPNI_CMDID_GET_UNICAST_PROMISC DPNI_CMD(0x223)
|
||||
#define DPNI_CMDID_SET_PRIM_MAC DPNI_CMD(0x224)
|
||||
#define DPNI_CMDID_GET_PRIM_MAC DPNI_CMD(0x225)
|
||||
#define DPNI_CMDID_ADD_MAC_ADDR DPNI_CMD(0x226)
|
||||
#define DPNI_CMDID_REMOVE_MAC_ADDR DPNI_CMD(0x227)
|
||||
#define DPNI_CMDID_CLR_MAC_FILTERS DPNI_CMD(0x228)
|
||||
|
||||
#define DPNI_CMDID_ENABLE_VLAN_FILTER ((0x230 << 4) | (0x1))
|
||||
#define DPNI_CMDID_ADD_VLAN_ID ((0x231 << 4) | (0x1))
|
||||
#define DPNI_CMDID_REMOVE_VLAN_ID ((0x232 << 4) | (0x1))
|
||||
#define DPNI_CMDID_CLR_VLAN_FILTERS ((0x233 << 4) | (0x1))
|
||||
#define DPNI_CMDID_ENABLE_VLAN_FILTER DPNI_CMD(0x230)
|
||||
#define DPNI_CMDID_ADD_VLAN_ID DPNI_CMD(0x231)
|
||||
#define DPNI_CMDID_REMOVE_VLAN_ID DPNI_CMD(0x232)
|
||||
#define DPNI_CMDID_CLR_VLAN_FILTERS DPNI_CMD(0x233)
|
||||
|
||||
#define DPNI_CMDID_SET_RX_TC_DIST ((0x235 << 4) | (0x1))
|
||||
#define DPNI_CMDID_SET_RX_TC_DIST DPNI_CMD_V2(0x235)
|
||||
|
||||
#define DPNI_CMDID_GET_STATISTICS ((0x25D << 4) | (0x1))
|
||||
#define DPNI_CMDID_RESET_STATISTICS ((0x25E << 4) | (0x1))
|
||||
#define DPNI_CMDID_GET_QUEUE ((0x25F << 4) | (0x1))
|
||||
#define DPNI_CMDID_SET_QUEUE ((0x260 << 4) | (0x1))
|
||||
#define DPNI_CMDID_GET_TAILDROP ((0x261 << 4) | (0x1))
|
||||
#define DPNI_CMDID_SET_TAILDROP ((0x262 << 4) | (0x1))
|
||||
#define DPNI_CMDID_GET_STATISTICS DPNI_CMD_V2(0x25D)
|
||||
#define DPNI_CMDID_RESET_STATISTICS DPNI_CMD(0x25E)
|
||||
#define DPNI_CMDID_GET_QUEUE DPNI_CMD(0x25F)
|
||||
#define DPNI_CMDID_SET_QUEUE DPNI_CMD(0x260)
|
||||
#define DPNI_CMDID_GET_TAILDROP DPNI_CMD_V2(0x261)
|
||||
#define DPNI_CMDID_SET_TAILDROP DPNI_CMD_V2(0x262)
|
||||
|
||||
#define DPNI_CMDID_GET_PORT_MAC_ADDR ((0x263 << 4) | (0x1))
|
||||
#define DPNI_CMDID_GET_PORT_MAC_ADDR DPNI_CMD(0x263)
|
||||
|
||||
#define DPNI_CMDID_GET_BUFFER_LAYOUT ((0x264 << 4) | (0x1))
|
||||
#define DPNI_CMDID_SET_BUFFER_LAYOUT ((0x265 << 4) | (0x1))
|
||||
#define DPNI_CMDID_GET_BUFFER_LAYOUT DPNI_CMD(0x264)
|
||||
#define DPNI_CMDID_SET_BUFFER_LAYOUT DPNI_CMD(0x265)
|
||||
|
||||
#define DPNI_CMDID_SET_CONGESTION_NOTIFICATION ((0x267 << 4) | (0x1))
|
||||
#define DPNI_CMDID_GET_CONGESTION_NOTIFICATION ((0x268 << 4) | (0x1))
|
||||
#define DPNI_CMDID_GET_OFFLOAD ((0x26B << 4) | (0x1))
|
||||
#define DPNI_CMDID_SET_OFFLOAD ((0x26C << 4) | (0x1))
|
||||
#define DPNI_CMDID_SET_TX_CONFIRMATION_MODE ((0x266 << 4) | (0x1))
|
||||
#define DPNI_CMDID_GET_TX_CONFIRMATION_MODE ((0x26D << 4) | (0x1))
|
||||
#define DPNI_CMDID_SET_CONGESTION_NOTIFICATION DPNI_CMD(0x267)
|
||||
#define DPNI_CMDID_GET_CONGESTION_NOTIFICATION DPNI_CMD(0x268)
|
||||
#define DPNI_CMDID_SET_EARLY_DROP DPNI_CMD_V2(0x269)
|
||||
#define DPNI_CMDID_GET_EARLY_DROP DPNI_CMD_V2(0x26A)
|
||||
#define DPNI_CMDID_GET_OFFLOAD DPNI_CMD(0x26B)
|
||||
#define DPNI_CMDID_SET_OFFLOAD DPNI_CMD(0x26C)
|
||||
#define DPNI_CMDID_SET_TX_CONFIRMATION_MODE DPNI_CMD(0x266)
|
||||
#define DPNI_CMDID_GET_TX_CONFIRMATION_MODE DPNI_CMD(0x26D)
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPNI_CMD_OPEN(cmd, dpni_id) \
|
||||
MC_CMD_OP(cmd, 0, 0, 32, int, dpni_id)
|
||||
/* Macros for accessing command fields smaller than 1byte */
|
||||
#define DPNI_MASK(field) \
|
||||
GENMASK(DPNI_##field##_SHIFT + DPNI_##field##_SIZE - 1, \
|
||||
DPNI_##field##_SHIFT)
|
||||
#define dpni_set_field(var, field, val) \
|
||||
((var) |= (((val) << DPNI_##field##_SHIFT) & DPNI_MASK(field)))
|
||||
#define dpni_get_field(var, field) \
|
||||
(((var) & DPNI_MASK(field)) >> DPNI_##field##_SHIFT)
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPNI_CMD_CREATE(cmd, cfg) \
|
||||
do { \
|
||||
MC_CMD_OP(cmd, 0, 0, 32, uint32_t, (cfg)->options); \
|
||||
MC_CMD_OP(cmd, 0, 32, 8, uint8_t, (cfg)->num_queues); \
|
||||
MC_CMD_OP(cmd, 0, 40, 8, uint8_t, (cfg)->num_tcs); \
|
||||
MC_CMD_OP(cmd, 0, 48, 8, uint8_t, (cfg)->mac_filter_entries); \
|
||||
MC_CMD_OP(cmd, 1, 0, 8, uint8_t, (cfg)->vlan_filter_entries); \
|
||||
MC_CMD_OP(cmd, 1, 16, 8, uint8_t, (cfg)->qos_entries); \
|
||||
MC_CMD_OP(cmd, 1, 32, 16, uint16_t, (cfg)->fs_entries); \
|
||||
} while (0)
|
||||
#pragma pack(push, 1)
|
||||
struct dpni_cmd_open {
|
||||
uint32_t dpni_id;
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPNI_CMD_SET_POOLS(cmd, cfg) \
|
||||
do { \
|
||||
MC_CMD_OP(cmd, 0, 0, 8, uint8_t, cfg->num_dpbp); \
|
||||
MC_CMD_OP(cmd, 0, 8, 1, int, cfg->pools[0].backup_pool); \
|
||||
MC_CMD_OP(cmd, 0, 9, 1, int, cfg->pools[1].backup_pool); \
|
||||
MC_CMD_OP(cmd, 0, 10, 1, int, cfg->pools[2].backup_pool); \
|
||||
MC_CMD_OP(cmd, 0, 11, 1, int, cfg->pools[3].backup_pool); \
|
||||
MC_CMD_OP(cmd, 0, 12, 1, int, cfg->pools[4].backup_pool); \
|
||||
MC_CMD_OP(cmd, 0, 13, 1, int, cfg->pools[5].backup_pool); \
|
||||
MC_CMD_OP(cmd, 0, 14, 1, int, cfg->pools[6].backup_pool); \
|
||||
MC_CMD_OP(cmd, 0, 15, 1, int, cfg->pools[7].backup_pool); \
|
||||
MC_CMD_OP(cmd, 0, 32, 32, int, cfg->pools[0].dpbp_id); \
|
||||
MC_CMD_OP(cmd, 4, 32, 16, uint16_t, cfg->pools[0].buffer_size);\
|
||||
MC_CMD_OP(cmd, 1, 0, 32, int, cfg->pools[1].dpbp_id); \
|
||||
MC_CMD_OP(cmd, 4, 48, 16, uint16_t, cfg->pools[1].buffer_size);\
|
||||
MC_CMD_OP(cmd, 1, 32, 32, int, cfg->pools[2].dpbp_id); \
|
||||
MC_CMD_OP(cmd, 5, 0, 16, uint16_t, cfg->pools[2].buffer_size);\
|
||||
MC_CMD_OP(cmd, 2, 0, 32, int, cfg->pools[3].dpbp_id); \
|
||||
MC_CMD_OP(cmd, 5, 16, 16, uint16_t, cfg->pools[3].buffer_size);\
|
||||
MC_CMD_OP(cmd, 2, 32, 32, int, cfg->pools[4].dpbp_id); \
|
||||
MC_CMD_OP(cmd, 5, 32, 16, uint16_t, cfg->pools[4].buffer_size);\
|
||||
MC_CMD_OP(cmd, 3, 0, 32, int, cfg->pools[5].dpbp_id); \
|
||||
MC_CMD_OP(cmd, 5, 48, 16, uint16_t, cfg->pools[5].buffer_size);\
|
||||
MC_CMD_OP(cmd, 3, 32, 32, int, cfg->pools[6].dpbp_id); \
|
||||
MC_CMD_OP(cmd, 6, 0, 16, uint16_t, cfg->pools[6].buffer_size);\
|
||||
MC_CMD_OP(cmd, 4, 0, 32, int, cfg->pools[7].dpbp_id); \
|
||||
MC_CMD_OP(cmd, 6, 16, 16, uint16_t, cfg->pools[7].buffer_size);\
|
||||
} while (0)
|
||||
struct dpni_cmd_create {
|
||||
uint32_t options;
|
||||
uint8_t num_queues;
|
||||
uint8_t num_tcs;
|
||||
uint8_t mac_filter_entries;
|
||||
uint8_t pad1;
|
||||
uint8_t vlan_filter_entries;
|
||||
uint8_t pad2;
|
||||
uint8_t qos_entries;
|
||||
uint8_t pad3;
|
||||
uint16_t fs_entries;
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPNI_RSP_IS_ENABLED(cmd, en) \
|
||||
MC_RSP_OP(cmd, 0, 0, 1, int, en)
|
||||
struct dpni_cmd_destroy {
|
||||
uint32_t dpsw_id;
|
||||
};
|
||||
|
||||
/* DPNI_CMD_GET_ATTR is not used, no input parameters */
|
||||
#define DPNI_BACKUP_POOL(val, order) (((val) & 0x1) << (order))
|
||||
|
||||
#define DPNI_RSP_GET_ATTR(cmd, attr) \
|
||||
do { \
|
||||
MC_RSP_OP(cmd, 0, 0, 32, uint32_t, (attr)->options); \
|
||||
MC_RSP_OP(cmd, 0, 32, 8, uint8_t, (attr)->num_queues); \
|
||||
MC_RSP_OP(cmd, 0, 40, 8, uint8_t, (attr)->num_tcs); \
|
||||
MC_RSP_OP(cmd, 0, 48, 8, uint8_t, (attr)->mac_filter_entries); \
|
||||
MC_RSP_OP(cmd, 1, 0, 8, uint8_t, (attr)->vlan_filter_entries); \
|
||||
MC_RSP_OP(cmd, 1, 16, 8, uint8_t, (attr)->qos_entries); \
|
||||
MC_RSP_OP(cmd, 1, 32, 16, uint16_t, (attr)->fs_entries); \
|
||||
MC_RSP_OP(cmd, 2, 0, 8, uint8_t, (attr)->qos_key_size); \
|
||||
MC_RSP_OP(cmd, 2, 8, 8, uint8_t, (attr)->fs_key_size); \
|
||||
MC_RSP_OP(cmd, 2, 16, 16, uint16_t, (attr)->wriop_version); \
|
||||
} while (0)
|
||||
struct dpni_cmd_pool {
|
||||
uint16_t dpbp_id;
|
||||
uint8_t priority_mask;
|
||||
uint8_t pad;
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPNI_CMD_SET_ERRORS_BEHAVIOR(cmd, cfg) \
|
||||
do { \
|
||||
MC_CMD_OP(cmd, 0, 0, 32, uint32_t, cfg->errors); \
|
||||
MC_CMD_OP(cmd, 0, 32, 4, enum dpni_error_action, cfg->error_action); \
|
||||
MC_CMD_OP(cmd, 0, 36, 1, int, cfg->set_frame_annotation); \
|
||||
} while (0)
|
||||
struct dpni_cmd_set_pools {
|
||||
uint8_t num_dpbp;
|
||||
uint8_t backup_pool_mask;
|
||||
uint16_t pad;
|
||||
struct dpni_cmd_pool pool[8];
|
||||
uint16_t buffer_size[8];
|
||||
};
|
||||
|
||||
#define DPNI_CMD_GET_BUFFER_LAYOUT(cmd, qtype) \
|
||||
MC_CMD_OP(cmd, 0, 0, 8, enum dpni_queue_type, qtype)
|
||||
/* The enable indication is always the least significant bit */
|
||||
#define DPNI_ENABLE_SHIFT 0
|
||||
#define DPNI_ENABLE_SIZE 1
|
||||
|
||||
#define DPNI_RSP_GET_BUFFER_LAYOUT(cmd, layout) \
|
||||
do { \
|
||||
MC_RSP_OP(cmd, 0, 48, 1, char, (layout)->pass_timestamp); \
|
||||
MC_RSP_OP(cmd, 0, 49, 1, char, (layout)->pass_parser_result); \
|
||||
MC_RSP_OP(cmd, 0, 50, 1, char, (layout)->pass_frame_status); \
|
||||
MC_RSP_OP(cmd, 1, 0, 16, uint16_t, (layout)->private_data_size); \
|
||||
MC_RSP_OP(cmd, 1, 16, 16, uint16_t, (layout)->data_align); \
|
||||
MC_RSP_OP(cmd, 1, 32, 16, uint16_t, (layout)->data_head_room); \
|
||||
MC_RSP_OP(cmd, 1, 48, 16, uint16_t, (layout)->data_tail_room); \
|
||||
} while (0)
|
||||
struct dpni_rsp_is_enabled {
|
||||
uint8_t enabled;
|
||||
};
|
||||
|
||||
#define DPNI_CMD_SET_BUFFER_LAYOUT(cmd, qtype, layout) \
|
||||
do { \
|
||||
MC_CMD_OP(cmd, 0, 0, 8, enum dpni_queue_type, qtype); \
|
||||
MC_CMD_OP(cmd, 0, 32, 16, uint16_t, (layout)->options); \
|
||||
MC_CMD_OP(cmd, 0, 48, 1, char, (layout)->pass_timestamp); \
|
||||
MC_CMD_OP(cmd, 0, 49, 1, char, (layout)->pass_parser_result); \
|
||||
MC_CMD_OP(cmd, 0, 50, 1, char, (layout)->pass_frame_status); \
|
||||
MC_CMD_OP(cmd, 1, 0, 16, uint16_t, (layout)->private_data_size); \
|
||||
MC_CMD_OP(cmd, 1, 16, 16, uint16_t, (layout)->data_align); \
|
||||
MC_CMD_OP(cmd, 1, 32, 16, uint16_t, (layout)->data_head_room); \
|
||||
MC_CMD_OP(cmd, 1, 48, 16, uint16_t, (layout)->data_tail_room); \
|
||||
} while (0)
|
||||
struct dpni_rsp_get_attr {
|
||||
/* response word 0 */
|
||||
uint32_t options;
|
||||
uint8_t num_queues;
|
||||
uint8_t num_rx_tcs;
|
||||
uint8_t mac_filter_entries;
|
||||
uint8_t num_tx_tcs;
|
||||
/* response word 1 */
|
||||
uint8_t vlan_filter_entries;
|
||||
uint8_t pad1;
|
||||
uint8_t qos_entries;
|
||||
uint8_t pad2;
|
||||
uint16_t fs_entries;
|
||||
uint16_t pad3;
|
||||
/* response word 2 */
|
||||
uint8_t qos_key_size;
|
||||
uint8_t fs_key_size;
|
||||
uint16_t wriop_version;
|
||||
};
|
||||
|
||||
#define DPNI_CMD_SET_OFFLOAD(cmd, type, config) \
|
||||
do { \
|
||||
MC_CMD_OP(cmd, 0, 24, 8, enum dpni_offload, type); \
|
||||
MC_CMD_OP(cmd, 0, 32, 32, uint32_t, config); \
|
||||
} while (0)
|
||||
#define DPNI_ERROR_ACTION_SHIFT 0
|
||||
#define DPNI_ERROR_ACTION_SIZE 4
|
||||
#define DPNI_FRAME_ANN_SHIFT 4
|
||||
#define DPNI_FRAME_ANN_SIZE 1
|
||||
|
||||
#define DPNI_CMD_GET_OFFLOAD(cmd, type) \
|
||||
MC_CMD_OP(cmd, 0, 24, 8, enum dpni_offload, type)
|
||||
struct dpni_cmd_set_errors_behavior {
|
||||
uint32_t errors;
|
||||
/* from least significant bit: error_action:4, set_frame_annotation:1 */
|
||||
uint8_t flags;
|
||||
};
|
||||
|
||||
#define DPNI_RSP_GET_OFFLOAD(cmd, config) \
|
||||
MC_RSP_OP(cmd, 0, 32, 32, uint32_t, config)
|
||||
/* There are 3 separate commands for configuring Rx, Tx and Tx confirmation
|
||||
* buffer layouts, but they all share the same parameters.
|
||||
* If one of the functions changes, below structure needs to be split.
|
||||
*/
|
||||
|
||||
#define DPNI_CMD_GET_QDID(cmd, qtype) \
|
||||
MC_CMD_OP(cmd, 0, 0, 8, enum dpni_queue_type, qtype)
|
||||
#define DPNI_PASS_TS_SHIFT 0
|
||||
#define DPNI_PASS_TS_SIZE 1
|
||||
#define DPNI_PASS_PR_SHIFT 1
|
||||
#define DPNI_PASS_PR_SIZE 1
|
||||
#define DPNI_PASS_FS_SHIFT 2
|
||||
#define DPNI_PASS_FS_SIZE 1
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPNI_RSP_GET_QDID(cmd, qdid) \
|
||||
MC_RSP_OP(cmd, 0, 0, 16, uint16_t, qdid)
|
||||
struct dpni_cmd_get_buffer_layout {
|
||||
uint8_t qtype;
|
||||
};
|
||||
|
||||
struct dpni_rsp_get_buffer_layout {
|
||||
/* response word 0 */
|
||||
uint8_t pad0[6];
|
||||
/* from LSB: pass_timestamp:1, parser_result:1, frame_status:1 */
|
||||
uint8_t flags;
|
||||
uint8_t pad1;
|
||||
/* response word 1 */
|
||||
uint16_t private_data_size;
|
||||
uint16_t data_align;
|
||||
uint16_t head_room;
|
||||
uint16_t tail_room;
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPNI_CMD_GET_STATISTICS(cmd, page) \
|
||||
MC_CMD_OP(cmd, 0, 0, 8, uint8_t, page)
|
||||
struct dpni_cmd_set_buffer_layout {
|
||||
/* cmd word 0 */
|
||||
uint8_t qtype;
|
||||
uint8_t pad0[3];
|
||||
uint16_t options;
|
||||
/* from LSB: pass_timestamp:1, parser_result:1, frame_status:1 */
|
||||
uint8_t flags;
|
||||
uint8_t pad1;
|
||||
/* cmd word 1 */
|
||||
uint16_t private_data_size;
|
||||
uint16_t data_align;
|
||||
uint16_t head_room;
|
||||
uint16_t tail_room;
|
||||
};
|
||||
|
||||
#define DPNI_RSP_GET_STATISTICS(cmd, stat) \
|
||||
do { \
|
||||
MC_RSP_OP(cmd, 0, 0, 64, uint64_t, (stat)->raw.counter[0]); \
|
||||
MC_RSP_OP(cmd, 1, 0, 64, uint64_t, (stat)->raw.counter[1]); \
|
||||
MC_RSP_OP(cmd, 2, 0, 64, uint64_t, (stat)->raw.counter[2]); \
|
||||
MC_RSP_OP(cmd, 3, 0, 64, uint64_t, (stat)->raw.counter[3]); \
|
||||
MC_RSP_OP(cmd, 4, 0, 64, uint64_t, (stat)->raw.counter[4]); \
|
||||
MC_RSP_OP(cmd, 5, 0, 64, uint64_t, (stat)->raw.counter[5]); \
|
||||
MC_RSP_OP(cmd, 6, 0, 64, uint64_t, (stat)->raw.counter[6]); \
|
||||
} while (0)
|
||||
struct dpni_cmd_set_offload {
|
||||
uint8_t pad[3];
|
||||
uint8_t dpni_offload;
|
||||
uint32_t config;
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPNI_CMD_SET_LINK_CFG(cmd, cfg) \
|
||||
do { \
|
||||
MC_CMD_OP(cmd, 1, 0, 32, uint32_t, cfg->rate);\
|
||||
MC_CMD_OP(cmd, 2, 0, 64, uint64_t, cfg->options);\
|
||||
} while (0)
|
||||
struct dpni_cmd_get_offload {
|
||||
uint8_t pad[3];
|
||||
uint8_t dpni_offload;
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPNI_RSP_GET_LINK_STATE(cmd, state) \
|
||||
do { \
|
||||
MC_RSP_OP(cmd, 0, 32, 1, int, state->up);\
|
||||
MC_RSP_OP(cmd, 1, 0, 32, uint32_t, state->rate);\
|
||||
MC_RSP_OP(cmd, 2, 0, 64, uint64_t, state->options);\
|
||||
} while (0)
|
||||
struct dpni_rsp_get_offload {
|
||||
uint32_t pad;
|
||||
uint32_t config;
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPNI_CMD_SET_MAX_FRAME_LENGTH(cmd, max_frame_length) \
|
||||
MC_CMD_OP(cmd, 0, 0, 16, uint16_t, max_frame_length)
|
||||
struct dpni_cmd_get_qdid {
|
||||
uint8_t qtype;
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPNI_RSP_GET_MAX_FRAME_LENGTH(cmd, max_frame_length) \
|
||||
MC_RSP_OP(cmd, 0, 0, 16, uint16_t, max_frame_length)
|
||||
struct dpni_rsp_get_qdid {
|
||||
uint16_t qdid;
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPNI_CMD_SET_MULTICAST_PROMISC(cmd, en) \
|
||||
MC_CMD_OP(cmd, 0, 0, 1, int, en)
|
||||
struct dpni_rsp_get_sp_info {
|
||||
uint16_t spids[2];
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPNI_RSP_GET_MULTICAST_PROMISC(cmd, en) \
|
||||
MC_RSP_OP(cmd, 0, 0, 1, int, en)
|
||||
struct dpni_rsp_get_tx_data_offset {
|
||||
uint16_t data_offset;
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPNI_CMD_SET_UNICAST_PROMISC(cmd, en) \
|
||||
MC_CMD_OP(cmd, 0, 0, 1, int, en)
|
||||
struct dpni_cmd_get_statistics {
|
||||
uint8_t page_number;
|
||||
uint8_t param;
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPNI_RSP_GET_UNICAST_PROMISC(cmd, en) \
|
||||
MC_RSP_OP(cmd, 0, 0, 1, int, en)
|
||||
struct dpni_rsp_get_statistics {
|
||||
uint64_t counter[7];
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPNI_CMD_SET_PRIMARY_MAC_ADDR(cmd, mac_addr) \
|
||||
do { \
|
||||
MC_CMD_OP(cmd, 0, 16, 8, uint8_t, mac_addr[5]); \
|
||||
MC_CMD_OP(cmd, 0, 24, 8, uint8_t, mac_addr[4]); \
|
||||
MC_CMD_OP(cmd, 0, 32, 8, uint8_t, mac_addr[3]); \
|
||||
MC_CMD_OP(cmd, 0, 40, 8, uint8_t, mac_addr[2]); \
|
||||
MC_CMD_OP(cmd, 0, 48, 8, uint8_t, mac_addr[1]); \
|
||||
MC_CMD_OP(cmd, 0, 56, 8, uint8_t, mac_addr[0]); \
|
||||
} while (0)
|
||||
struct dpni_cmd_set_link_cfg {
|
||||
uint64_t pad0;
|
||||
uint32_t rate;
|
||||
uint32_t pad1;
|
||||
uint64_t options;
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPNI_RSP_GET_PRIMARY_MAC_ADDR(cmd, mac_addr) \
|
||||
do { \
|
||||
MC_RSP_OP(cmd, 0, 16, 8, uint8_t, mac_addr[5]); \
|
||||
MC_RSP_OP(cmd, 0, 24, 8, uint8_t, mac_addr[4]); \
|
||||
MC_RSP_OP(cmd, 0, 32, 8, uint8_t, mac_addr[3]); \
|
||||
MC_RSP_OP(cmd, 0, 40, 8, uint8_t, mac_addr[2]); \
|
||||
MC_RSP_OP(cmd, 0, 48, 8, uint8_t, mac_addr[1]); \
|
||||
MC_RSP_OP(cmd, 0, 56, 8, uint8_t, mac_addr[0]); \
|
||||
} while (0)
|
||||
#define DPNI_LINK_STATE_SHIFT 0
|
||||
#define DPNI_LINK_STATE_SIZE 1
|
||||
|
||||
#define DPNI_RSP_GET_PORT_MAC_ADDR(cmd, mac_addr) \
|
||||
do { \
|
||||
MC_RSP_OP(cmd, 0, 16, 8, uint8_t, mac_addr[5]); \
|
||||
MC_RSP_OP(cmd, 0, 24, 8, uint8_t, mac_addr[4]); \
|
||||
MC_RSP_OP(cmd, 0, 32, 8, uint8_t, mac_addr[3]); \
|
||||
MC_RSP_OP(cmd, 0, 40, 8, uint8_t, mac_addr[2]); \
|
||||
MC_RSP_OP(cmd, 0, 48, 8, uint8_t, mac_addr[1]); \
|
||||
MC_RSP_OP(cmd, 0, 56, 8, uint8_t, mac_addr[0]); \
|
||||
} while (0)
|
||||
struct dpni_rsp_get_link_state {
|
||||
uint32_t pad0;
|
||||
/* from LSB: up:1 */
|
||||
uint8_t flags;
|
||||
uint8_t pad1[3];
|
||||
uint32_t rate;
|
||||
uint32_t pad2;
|
||||
uint64_t options;
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPNI_CMD_ADD_MAC_ADDR(cmd, mac_addr) \
|
||||
do { \
|
||||
MC_CMD_OP(cmd, 0, 16, 8, uint8_t, mac_addr[5]); \
|
||||
MC_CMD_OP(cmd, 0, 24, 8, uint8_t, mac_addr[4]); \
|
||||
MC_CMD_OP(cmd, 0, 32, 8, uint8_t, mac_addr[3]); \
|
||||
MC_CMD_OP(cmd, 0, 40, 8, uint8_t, mac_addr[2]); \
|
||||
MC_CMD_OP(cmd, 0, 48, 8, uint8_t, mac_addr[1]); \
|
||||
MC_CMD_OP(cmd, 0, 56, 8, uint8_t, mac_addr[0]); \
|
||||
} while (0)
|
||||
struct dpni_cmd_set_max_frame_length {
|
||||
uint16_t max_frame_length;
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPNI_CMD_REMOVE_MAC_ADDR(cmd, mac_addr) \
|
||||
do { \
|
||||
MC_CMD_OP(cmd, 0, 16, 8, uint8_t, mac_addr[5]); \
|
||||
MC_CMD_OP(cmd, 0, 24, 8, uint8_t, mac_addr[4]); \
|
||||
MC_CMD_OP(cmd, 0, 32, 8, uint8_t, mac_addr[3]); \
|
||||
MC_CMD_OP(cmd, 0, 40, 8, uint8_t, mac_addr[2]); \
|
||||
MC_CMD_OP(cmd, 0, 48, 8, uint8_t, mac_addr[1]); \
|
||||
MC_CMD_OP(cmd, 0, 56, 8, uint8_t, mac_addr[0]); \
|
||||
} while (0)
|
||||
struct dpni_rsp_get_max_frame_length {
|
||||
uint16_t max_frame_length;
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPNI_CMD_CLEAR_MAC_FILTERS(cmd, unicast, multicast) \
|
||||
do { \
|
||||
MC_CMD_OP(cmd, 0, 0, 1, int, unicast); \
|
||||
MC_CMD_OP(cmd, 0, 1, 1, int, multicast); \
|
||||
} while (0)
|
||||
struct dpni_cmd_set_multicast_promisc {
|
||||
uint8_t enable;
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPNI_CMD_ENABLE_VLAN_FILTER(cmd, en) \
|
||||
MC_CMD_OP(cmd, 0, 0, 1, int, en)
|
||||
struct dpni_rsp_get_multicast_promisc {
|
||||
uint8_t enabled;
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPNI_CMD_ADD_VLAN_ID(cmd, vlan_id) \
|
||||
MC_CMD_OP(cmd, 0, 32, 16, uint16_t, vlan_id)
|
||||
struct dpni_cmd_set_unicast_promisc {
|
||||
uint8_t enable;
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPNI_CMD_REMOVE_VLAN_ID(cmd, vlan_id) \
|
||||
MC_CMD_OP(cmd, 0, 32, 16, uint16_t, vlan_id)
|
||||
struct dpni_rsp_get_unicast_promisc {
|
||||
uint8_t enabled;
|
||||
};
|
||||
|
||||
struct dpni_cmd_set_primary_mac_addr {
|
||||
uint16_t pad;
|
||||
uint8_t mac_addr[6];
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPNI_CMD_SET_RX_TC_DIST(cmd, tc_id, cfg) \
|
||||
do { \
|
||||
MC_CMD_OP(cmd, 0, 0, 16, uint16_t, cfg->dist_size); \
|
||||
MC_CMD_OP(cmd, 0, 16, 8, uint8_t, tc_id); \
|
||||
MC_CMD_OP(cmd, 0, 24, 4, enum dpni_dist_mode, cfg->dist_mode); \
|
||||
MC_CMD_OP(cmd, 0, 28, 4, enum dpni_fs_miss_action, \
|
||||
cfg->fs_cfg.miss_action); \
|
||||
MC_CMD_OP(cmd, 0, 48, 16, uint16_t, cfg->fs_cfg.default_flow_id); \
|
||||
MC_CMD_OP(cmd, 6, 0, 64, uint64_t, cfg->key_cfg_iova); \
|
||||
} while (0)
|
||||
struct dpni_rsp_get_primary_mac_addr {
|
||||
uint16_t pad;
|
||||
uint8_t mac_addr[6];
|
||||
};
|
||||
|
||||
#define DPNI_CMD_GET_QUEUE(cmd, qtype, tc, index) \
|
||||
do { \
|
||||
MC_CMD_OP(cmd, 0, 0, 8, enum dpni_queue_type, qtype); \
|
||||
MC_CMD_OP(cmd, 0, 8, 8, uint8_t, tc); \
|
||||
MC_CMD_OP(cmd, 0, 16, 8, uint8_t, index); \
|
||||
} while (0)
|
||||
struct dpni_rsp_get_port_mac_addr {
|
||||
uint16_t pad;
|
||||
uint8_t mac_addr[6];
|
||||
};
|
||||
|
||||
#define DPNI_RSP_GET_QUEUE(cmd, queue, queue_id) \
|
||||
do { \
|
||||
MC_RSP_OP(cmd, 1, 0, 32, uint32_t, (queue)->destination.id); \
|
||||
MC_RSP_OP(cmd, 1, 48, 8, uint8_t, (queue)->destination.priority); \
|
||||
MC_RSP_OP(cmd, 1, 56, 4, enum dpni_dest, (queue)->destination.type); \
|
||||
MC_RSP_OP(cmd, 1, 62, 1, char, (queue)->flc.stash_control); \
|
||||
MC_RSP_OP(cmd, 1, 63, 1, char, (queue)->destination.hold_active); \
|
||||
MC_RSP_OP(cmd, 2, 0, 64, uint64_t, (queue)->flc.value); \
|
||||
MC_RSP_OP(cmd, 3, 0, 64, uint64_t, (queue)->user_context); \
|
||||
MC_RSP_OP(cmd, 4, 0, 32, uint32_t, (queue_id)->fqid); \
|
||||
MC_RSP_OP(cmd, 4, 32, 16, uint16_t, (queue_id)->qdbin); \
|
||||
} while (0)
|
||||
struct dpni_cmd_add_mac_addr {
|
||||
uint16_t pad;
|
||||
uint8_t mac_addr[6];
|
||||
};
|
||||
|
||||
#define DPNI_CMD_SET_QUEUE(cmd, qtype, tc, index, options, queue) \
|
||||
do { \
|
||||
MC_CMD_OP(cmd, 0, 0, 8, enum dpni_queue_type, qtype); \
|
||||
MC_CMD_OP(cmd, 0, 8, 8, uint8_t, tc); \
|
||||
MC_CMD_OP(cmd, 0, 16, 8, uint8_t, index); \
|
||||
MC_CMD_OP(cmd, 0, 24, 8, uint8_t, options); \
|
||||
MC_CMD_OP(cmd, 1, 0, 32, uint32_t, (queue)->destination.id); \
|
||||
MC_CMD_OP(cmd, 1, 48, 8, uint8_t, (queue)->destination.priority); \
|
||||
MC_CMD_OP(cmd, 1, 56, 4, enum dpni_dest, (queue)->destination.type); \
|
||||
MC_CMD_OP(cmd, 1, 62, 1, char, (queue)->flc.stash_control); \
|
||||
MC_CMD_OP(cmd, 1, 63, 1, char, (queue)->destination.hold_active); \
|
||||
MC_CMD_OP(cmd, 2, 0, 64, uint64_t, (queue)->flc.value); \
|
||||
MC_CMD_OP(cmd, 3, 0, 64, uint64_t, (queue)->user_context); \
|
||||
} while (0)
|
||||
struct dpni_cmd_remove_mac_addr {
|
||||
uint16_t pad;
|
||||
uint8_t mac_addr[6];
|
||||
};
|
||||
|
||||
/* cmd, param, offset, width, type, arg_name */
|
||||
#define DPNI_RSP_GET_API_VERSION(cmd, major, minor) \
|
||||
do { \
|
||||
MC_RSP_OP(cmd, 0, 0, 16, uint16_t, major);\
|
||||
MC_RSP_OP(cmd, 0, 16, 16, uint16_t, minor);\
|
||||
} while (0)
|
||||
#define DPNI_UNICAST_FILTERS_SHIFT 0
|
||||
#define DPNI_UNICAST_FILTERS_SIZE 1
|
||||
#define DPNI_MULTICAST_FILTERS_SHIFT 1
|
||||
#define DPNI_MULTICAST_FILTERS_SIZE 1
|
||||
|
||||
#define DPNI_CMD_GET_TAILDROP(cmd, cp, q_type, tc, q_index) \
|
||||
do { \
|
||||
MC_CMD_OP(cmd, 0, 0, 8, enum dpni_congestion_point, cp); \
|
||||
MC_CMD_OP(cmd, 0, 8, 8, enum dpni_queue_type, q_type); \
|
||||
MC_CMD_OP(cmd, 0, 16, 8, uint8_t, tc); \
|
||||
MC_CMD_OP(cmd, 0, 24, 8, uint8_t, q_index); \
|
||||
} while (0)
|
||||
struct dpni_cmd_clear_mac_filters {
|
||||
/* from LSB: unicast:1, multicast:1 */
|
||||
uint8_t flags;
|
||||
};
|
||||
|
||||
#define DPNI_RSP_GET_TAILDROP(cmd, taildrop) \
|
||||
do { \
|
||||
MC_RSP_OP(cmd, 1, 0, 1, char, (taildrop)->enable); \
|
||||
MC_RSP_OP(cmd, 1, 16, 8, enum dpni_congestion_unit, \
|
||||
(taildrop)->units); \
|
||||
MC_RSP_OP(cmd, 1, 32, 32, uint32_t, (taildrop)->threshold); \
|
||||
} while (0)
|
||||
struct dpni_cmd_enable_vlan_filter {
|
||||
/* only the LSB */
|
||||
uint8_t en;
|
||||
};
|
||||
|
||||
#define DPNI_CMD_SET_TAILDROP(cmd, cp, q_type, tc, q_index, taildrop) \
|
||||
do { \
|
||||
MC_CMD_OP(cmd, 0, 0, 8, enum dpni_congestion_point, cp); \
|
||||
MC_CMD_OP(cmd, 0, 8, 8, enum dpni_queue_type, q_type); \
|
||||
MC_CMD_OP(cmd, 0, 16, 8, uint8_t, tc); \
|
||||
MC_CMD_OP(cmd, 0, 24, 8, uint8_t, q_index); \
|
||||
MC_CMD_OP(cmd, 1, 0, 1, char, (taildrop)->enable); \
|
||||
MC_CMD_OP(cmd, 1, 16, 8, enum dpni_congestion_unit, \
|
||||
(taildrop)->units); \
|
||||
MC_CMD_OP(cmd, 1, 32, 32, uint32_t, (taildrop)->threshold); \
|
||||
} while (0)
|
||||
struct dpni_cmd_vlan_id {
|
||||
uint32_t pad;
|
||||
uint16_t vlan_id;
|
||||
};
|
||||
|
||||
#define DPNI_CMD_SET_TX_CONFIRMATION_MODE(cmd, mode) \
|
||||
MC_CMD_OP(cmd, 0, 32, 8, enum dpni_confirmation_mode, mode)
|
||||
#define DPNI_SEPARATE_GRP_SHIFT 0
|
||||
#define DPNI_SEPARATE_GRP_SIZE 1
|
||||
#define DPNI_MODE_1_SHIFT 0
|
||||
#define DPNI_MODE_1_SIZE 4
|
||||
#define DPNI_MODE_2_SHIFT 4
|
||||
#define DPNI_MODE_2_SIZE 4
|
||||
|
||||
#define DPNI_RSP_GET_TX_CONFIRMATION_MODE(cmd, mode) \
|
||||
MC_RSP_OP(cmd, 0, 32, 8, enum dpni_confirmation_mode, mode)
|
||||
struct dpni_cmd_set_tx_priorities {
|
||||
uint16_t flags;
|
||||
uint8_t prio_group_A;
|
||||
uint8_t prio_group_B;
|
||||
uint32_t pad0;
|
||||
uint8_t modes[4];
|
||||
uint32_t pad1;
|
||||
uint64_t pad2;
|
||||
uint16_t delta_bandwidth[8];
|
||||
};
|
||||
|
||||
#define DPNI_CMD_SET_CONGESTION_NOTIFICATION(cmd, qtype, tc, cfg) \
|
||||
do { \
|
||||
MC_CMD_OP(cmd, 0, 0, 8, enum dpni_queue_type, qtype); \
|
||||
MC_CMD_OP(cmd, 0, 8, 8, uint8_t, tc); \
|
||||
MC_CMD_OP(cmd, 1, 0, 32, uint32_t, (cfg)->dest_cfg.dest_id); \
|
||||
MC_CMD_OP(cmd, 1, 32, 16, uint16_t, (cfg)->notification_mode); \
|
||||
MC_CMD_OP(cmd, 1, 48, 8, uint8_t, (cfg)->dest_cfg.priority); \
|
||||
MC_CMD_OP(cmd, 1, 56, 4, enum dpni_dest, (cfg)->dest_cfg.dest_type); \
|
||||
MC_CMD_OP(cmd, 1, 60, 2, enum dpni_congestion_unit, (cfg)->units); \
|
||||
MC_CMD_OP(cmd, 2, 0, 64, uint64_t, (cfg)->message_iova); \
|
||||
MC_CMD_OP(cmd, 3, 0, 64, uint64_t, (cfg)->message_ctx); \
|
||||
MC_CMD_OP(cmd, 4, 0, 32, uint32_t, (cfg)->threshold_entry); \
|
||||
MC_CMD_OP(cmd, 4, 32, 32, uint32_t, (cfg)->threshold_exit); \
|
||||
} while (0)
|
||||
#define DPNI_DIST_MODE_SHIFT 0
|
||||
#define DPNI_DIST_MODE_SIZE 4
|
||||
#define DPNI_MISS_ACTION_SHIFT 4
|
||||
#define DPNI_MISS_ACTION_SIZE 4
|
||||
#define DPNI_KEEP_HASH_KEY_SHIFT 7
|
||||
#define DPNI_KEEP_HASH_KEY_SIZE 1
|
||||
|
||||
#define DPNI_CMD_GET_CONGESTION_NOTIFICATION(cmd, qtype, tc) \
|
||||
do { \
|
||||
MC_CMD_OP(cmd, 0, 0, 8, enum dpni_queue_type, qtype); \
|
||||
MC_CMD_OP(cmd, 0, 8, 8, uint8_t, tc); \
|
||||
} while (0)
|
||||
struct dpni_cmd_set_rx_tc_dist {
|
||||
uint16_t dist_size;
|
||||
uint8_t tc_id;
|
||||
/* from LSB: dist_mode:4, miss_action:4 */
|
||||
uint8_t flags;
|
||||
uint8_t pad0;
|
||||
/* only the LSB */
|
||||
uint8_t keep_hash_key;
|
||||
uint16_t default_flow_id;
|
||||
uint64_t pad1[5];
|
||||
uint64_t key_cfg_iova;
|
||||
};
|
||||
|
||||
#define DPNI_RSP_GET_CONGESTION_NOTIFICATION(cmd, cfg) \
|
||||
do { \
|
||||
MC_RSP_OP(cmd, 1, 0, 32, uint32_t, (cfg)->dest_cfg.dest_id); \
|
||||
MC_RSP_OP(cmd, 1, 0, 16, uint16_t, (cfg)->notification_mode); \
|
||||
MC_RSP_OP(cmd, 1, 48, 8, uint8_t, (cfg)->dest_cfg.priority); \
|
||||
MC_RSP_OP(cmd, 1, 56, 4, enum dpni_dest, (cfg)->dest_cfg.dest_type); \
|
||||
MC_RSP_OP(cmd, 1, 60, 2, enum dpni_congestion_unit, (cfg)->units); \
|
||||
MC_RSP_OP(cmd, 2, 0, 64, uint64_t, (cfg)->message_iova); \
|
||||
MC_RSP_OP(cmd, 3, 0, 64, uint64_t, (cfg)->message_ctx); \
|
||||
MC_RSP_OP(cmd, 4, 0, 32, uint32_t, (cfg)->threshold_entry); \
|
||||
MC_RSP_OP(cmd, 4, 32, 32, uint32_t, (cfg)->threshold_exit); \
|
||||
} while (0)
|
||||
struct dpni_cmd_get_queue {
|
||||
uint8_t qtype;
|
||||
uint8_t tc;
|
||||
uint8_t index;
|
||||
};
|
||||
|
||||
#define DPNI_DEST_TYPE_SHIFT 0
|
||||
#define DPNI_DEST_TYPE_SIZE 4
|
||||
#define DPNI_STASH_CTRL_SHIFT 6
|
||||
#define DPNI_STASH_CTRL_SIZE 1
|
||||
#define DPNI_HOLD_ACTIVE_SHIFT 7
|
||||
#define DPNI_HOLD_ACTIVE_SIZE 1
|
||||
|
||||
struct dpni_rsp_get_queue {
|
||||
/* response word 0 */
|
||||
uint64_t pad0;
|
||||
/* response word 1 */
|
||||
uint32_t dest_id;
|
||||
uint16_t pad1;
|
||||
uint8_t dest_prio;
|
||||
/* From LSB: dest_type:4, pad:2, flc_stash_ctrl:1, hold_active:1 */
|
||||
uint8_t flags;
|
||||
/* response word 2 */
|
||||
uint64_t flc;
|
||||
/* response word 3 */
|
||||
uint64_t user_context;
|
||||
/* response word 4 */
|
||||
uint32_t fqid;
|
||||
uint16_t qdbin;
|
||||
};
|
||||
|
||||
struct dpni_cmd_set_queue {
|
||||
/* cmd word 0 */
|
||||
uint8_t qtype;
|
||||
uint8_t tc;
|
||||
uint8_t index;
|
||||
uint8_t options;
|
||||
uint32_t pad0;
|
||||
/* cmd word 1 */
|
||||
uint32_t dest_id;
|
||||
uint16_t pad1;
|
||||
uint8_t dest_prio;
|
||||
uint8_t flags;
|
||||
/* cmd word 2 */
|
||||
uint64_t flc;
|
||||
/* cmd word 3 */
|
||||
uint64_t user_context;
|
||||
};
|
||||
|
||||
#define DPNI_DROP_ENABLE_SHIFT 0
|
||||
#define DPNI_DROP_ENABLE_SIZE 1
|
||||
#define DPNI_DROP_UNITS_SHIFT 2
|
||||
#define DPNI_DROP_UNITS_SIZE 2
|
||||
|
||||
struct dpni_early_drop {
|
||||
/* from LSB: enable:1 units:2 */
|
||||
uint8_t flags;
|
||||
uint8_t pad0[3];
|
||||
uint32_t pad1;
|
||||
uint8_t green_drop_probability;
|
||||
uint8_t pad2[7];
|
||||
uint64_t green_max_threshold;
|
||||
uint64_t green_min_threshold;
|
||||
uint64_t pad3;
|
||||
uint8_t yellow_drop_probability;
|
||||
uint8_t pad4[7];
|
||||
uint64_t yellow_max_threshold;
|
||||
uint64_t yellow_min_threshold;
|
||||
uint64_t pad5;
|
||||
uint8_t red_drop_probability;
|
||||
uint8_t pad6[7];
|
||||
uint64_t red_max_threshold;
|
||||
uint64_t red_min_threshold;
|
||||
};
|
||||
|
||||
struct dpni_cmd_early_drop {
|
||||
uint8_t qtype;
|
||||
uint8_t tc;
|
||||
uint8_t pad[6];
|
||||
uint64_t early_drop_iova;
|
||||
};
|
||||
|
||||
struct dpni_rsp_get_api_version {
|
||||
uint16_t major;
|
||||
uint16_t minor;
|
||||
};
|
||||
|
||||
struct dpni_cmd_get_taildrop {
|
||||
uint8_t congestion_point;
|
||||
uint8_t qtype;
|
||||
uint8_t tc;
|
||||
uint8_t index;
|
||||
};
|
||||
|
||||
struct dpni_rsp_get_taildrop {
|
||||
/* cmd word 0 */
|
||||
uint64_t pad0;
|
||||
/* cmd word 1 */
|
||||
/* from LSB: enable:1 oal_lo:7 */
|
||||
uint8_t enable_oal_lo;
|
||||
/* from LSB: oal_hi:5 */
|
||||
uint8_t oal_hi;
|
||||
uint8_t units;
|
||||
uint8_t pad2;
|
||||
uint32_t threshold;
|
||||
};
|
||||
|
||||
#define DPNI_OAL_LO_SHIFT 1
|
||||
#define DPNI_OAL_LO_SIZE 7
|
||||
#define DPNI_OAL_HI_SHIFT 0
|
||||
#define DPNI_OAL_HI_SIZE 5
|
||||
|
||||
struct dpni_cmd_set_taildrop {
|
||||
/* cmd word 0 */
|
||||
uint8_t congestion_point;
|
||||
uint8_t qtype;
|
||||
uint8_t tc;
|
||||
uint8_t index;
|
||||
uint32_t pad0;
|
||||
/* cmd word 1 */
|
||||
/* from LSB: enable:1 oal_lo:7 */
|
||||
uint8_t enable_oal_lo;
|
||||
/* from LSB: oal_hi:5 */
|
||||
uint8_t oal_hi;
|
||||
uint8_t units;
|
||||
uint8_t pad2;
|
||||
uint32_t threshold;
|
||||
};
|
||||
|
||||
struct dpni_tx_confirmation_mode {
|
||||
uint32_t pad;
|
||||
uint8_t confirmation_mode;
|
||||
};
|
||||
|
||||
#define DPNI_DEST_TYPE_SHIFT 0
|
||||
#define DPNI_DEST_TYPE_SIZE 4
|
||||
#define DPNI_CONG_UNITS_SHIFT 4
|
||||
#define DPNI_CONG_UNITS_SIZE 2
|
||||
|
||||
struct dpni_cmd_set_congestion_notification {
|
||||
uint8_t qtype;
|
||||
uint8_t tc;
|
||||
uint8_t pad[6];
|
||||
uint32_t dest_id;
|
||||
uint16_t notification_mode;
|
||||
uint8_t dest_priority;
|
||||
/* from LSB: dest_type: 4 units:2 */
|
||||
uint8_t type_units;
|
||||
uint64_t message_iova;
|
||||
uint64_t message_ctx;
|
||||
uint32_t threshold_entry;
|
||||
uint32_t threshold_exit;
|
||||
};
|
||||
|
||||
struct dpni_cmd_get_congestion_notification {
|
||||
uint8_t qtype;
|
||||
uint8_t tc;
|
||||
};
|
||||
|
||||
struct dpni_rsp_get_congestion_notification {
|
||||
uint64_t pad;
|
||||
uint32_t dest_id;
|
||||
uint16_t notification_mode;
|
||||
uint8_t dest_priority;
|
||||
/* from LSB: dest_type: 4 units:2 */
|
||||
uint8_t type_units;
|
||||
uint64_t message_iova;
|
||||
uint64_t message_ctx;
|
||||
uint32_t threshold_entry;
|
||||
uint32_t threshold_exit;
|
||||
};
|
||||
|
||||
#pragma pack(pop)
|
||||
#endif /* _FSL_DPNI_CMD_H */
|
||||
|
@ -213,7 +213,7 @@
|
||||
#define NH_FLD_SCTP_CHUNK_DATA_STREAM_SQN (NH_FLD_SCTP_CHUNK_DATA_TYPE << 5)
|
||||
#define NH_FLD_SCTP_CHUNK_DATA_PAYLOAD_PID (NH_FLD_SCTP_CHUNK_DATA_TYPE << 6)
|
||||
#define NH_FLD_SCTP_CHUNK_DATA_UNORDERED (NH_FLD_SCTP_CHUNK_DATA_TYPE << 7)
|
||||
#define NH_FLD_SCTP_CHUNK_DATA_BEGINNING (NH_FLD_SCTP_CHUNK_DATA_TYPE << 8)
|
||||
#define NH_FLD_SCTP_CHUNK_DATA_BEGGINNING (NH_FLD_SCTP_CHUNK_DATA_TYPE << 8)
|
||||
#define NH_FLD_SCTP_CHUNK_DATA_END (NH_FLD_SCTP_CHUNK_DATA_TYPE << 9)
|
||||
#define NH_FLD_SCTP_CHUNK_DATA_ALL_FIELDS \
|
||||
((NH_FLD_SCTP_CHUNK_DATA_TYPE << 10) - 1)
|
||||
|
Loading…
Reference in New Issue
Block a user