aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/configs/lx2160ardb.h5
-rw-r--r--include/fsl-mc/fsl_dpbp.h207
-rw-r--r--include/fsl-mc/fsl_dpio.h266
-rw-r--r--include/fsl-mc/fsl_dpmac.h365
-rw-r--r--include/fsl-mc/fsl_dpmng.h13
-rw-r--r--include/fsl-mc/fsl_dpni.h1660
-rw-r--r--include/fsl-mc/fsl_dprc.h935
-rw-r--r--include/fsl-mc/fsl_dpsparser.h139
-rw-r--r--include/fsl-mc/fsl_mc_cmd.h47
-rw-r--r--include/net.h6
10 files changed, 984 insertions, 2659 deletions
diff --git a/include/configs/lx2160ardb.h b/include/configs/lx2160ardb.h
index 8cc4e0db03..6404b35911 100644
--- a/include/configs/lx2160ardb.h
+++ b/include/configs/lx2160ardb.h
@@ -11,6 +11,11 @@
/* RTC */
#define CFG_SYS_RTC_BUS_NUM 4
+#if defined(CONFIG_FSL_MC_ENET)
+#define AQR113C_PHY_ADDR1 0x0
+#define AQR113C_PHY_ADDR2 0x08
+#endif
+
/* EMC2305 */
#define I2C_MUX_CH_EMC2305 0x09
#define I2C_EMC2305_ADDR 0x4D
diff --git a/include/fsl-mc/fsl_dpbp.h b/include/fsl-mc/fsl_dpbp.h
index 2278ac952e..3f3e6c4070 100644
--- a/include/fsl-mc/fsl_dpbp.h
+++ b/include/fsl-mc/fsl_dpbp.h
@@ -1,14 +1,13 @@
/* SPDX-License-Identifier: GPL-2.0+ */
/*
* Freescale Layerscape MC I/O wrapper
+ * Data Path Buffer Pool API
+ * Contains initialization APIs and runtime control APIs for DPBP
*
* Copyright 2013-2016 Freescale Semiconductor, Inc.
- * Copyright 2017 NXP
- */
-/*!
- * @file fsl_dpbp.h
- * @brief Data Path Buffer Pool API
+ * Copyright 2017-2023 NXP
*/
+
#ifndef __FSL_DPBP_H
#define __FSL_DPBP_H
@@ -27,160 +26,50 @@
#define DPBP_CMDID_DISABLE 0x0031
#define DPBP_CMDID_GET_ATTR 0x0041
#define DPBP_CMDID_RESET 0x0051
-#define DPBP_CMDID_IS_ENABLED 0x0061
-/* cmd, param, offset, width, type, arg_name */
-#define DPBP_CMD_OPEN(cmd, dpbp_id) \
- MC_CMD_OP(cmd, 0, 0, 32, int, dpbp_id)
+#pragma pack(push, 1)
+
+struct dpbp_cmd_open {
+ __le32 dpbp_id;
+};
-/* 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)
+struct dpbp_cmd_destroy {
+ __le32 object_id;
+};
-/* Data Path Buffer Pool API
- * Contains initialization APIs and runtime control APIs for DPBP
- */
+struct dpbp_rsp_get_attributes {
+ __le16 pad;
+ __le16 bpid;
+ __le32 id;
+};
+
+#pragma pack(pop)
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, u32 cmd_flags, int dpbp_id, u16 *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, u32 cmd_flags, u16 token);
/**
* struct dpbp_cfg - Structure representing DPBP configuration
* @options: place holder
*/
struct dpbp_cfg {
- uint32_t options;
+ u32 options;
};
-/**
- * dpbp_create() - Create the DPBP object.
- * @mc_io: Pointer to MC portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @cfg: Configuration structure
- * @token: Returned token; use in subsequent API calls
- *
- * 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.
- * 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 calls to
- * this specific object. For objects that are created using the
- * DPL file, call dpbp_open function to get an authentication
- * token first.
- *
- * 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, u16 dprc_token, u32 cmd_flags,
+ const struct dpbp_cfg *cfg, u32 *obj_id);
-/**
- * dpbp_destroy() - Destroy the DPBP object and release all its resources.
- * @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_destroy(struct fsl_mc_io *mc_io,
- uint16_t dprc_token,
- uint32_t cmd_flags,
- uint32_t obj_id);
+int dpbp_destroy(struct fsl_mc_io *mc_io, u16 dprc_token, u32 cmd_flags,
+ u32 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, u32 cmd_flags, u16 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);
-
-/**
- * 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);
-
-/**
- * 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_disable(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token);
+int dpbp_reset(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token);
/**
* struct dpbp_attr - Structure representing DPBP attributes
@@ -190,40 +79,14 @@ int dpbp_reset(struct fsl_mc_io *mc_io,
* acquire/release operations on buffers
*/
struct dpbp_attr {
- uint32_t id;
- uint16_t bpid;
+ u32 id;
+ u16 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);
-
-/**
- * dpbp_get_api_version - Retrieve DPBP Major and Minor version info.
- *
- * @mc_io: Pointer to MC portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @major_ver: DPBP major version
- * @minor_ver: DPBP minor version
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dpbp_get_api_version(struct fsl_mc_io *mc_io,
- u32 cmd_flags,
- u16 *major_ver,
- u16 *minor_ver);
+int dpbp_get_attributes(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token,
+ struct dpbp_attr *attr);
-/** @} */
+int dpbp_get_api_version(struct fsl_mc_io *mc_io, u32 cmd_flags,
+ u16 *major_ver, u16 *minor_ver);
#endif /* __FSL_DPBP_H */
diff --git a/include/fsl-mc/fsl_dpio.h b/include/fsl-mc/fsl_dpio.h
index 7788e1962e..375590fd97 100644
--- a/include/fsl-mc/fsl_dpio.h
+++ b/include/fsl-mc/fsl_dpio.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0+ */
/*
* Copyright 2013-2016 Freescale Semiconductor, Inc.
- * Copyright 2017 NXP
+ * Copyright 2017, 2023 NXP
*/
#ifndef _FSL_DPIO_H
@@ -21,31 +21,53 @@
#define DPIO_CMDID_ENABLE 0x0021
#define DPIO_CMDID_DISABLE 0x0031
#define DPIO_CMDID_GET_ATTR 0x0041
-#define DPIO_CMDID_RESET 0x0051
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPIO_CMD_OPEN(cmd, dpio_id) \
- MC_CMD_OP(cmd, 0, 0, 32, int, dpio_id)
-
-/* 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)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPIO_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_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, 32, 32, uint32_t, attr->qbman_version);\
-} 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)
+
+#pragma pack(push, 1)
+struct dpio_cmd_open {
+ __le32 dpio_id;
+};
+
+#define DPIO_CHANNEL_MODE_SHIFT 0
+#define DPIO_CHANNEL_MODE_SIZE 2
+
+struct dpio_cmd_create {
+ __le16 pad1;
+ /* from LSB: channel_mode:2 */
+ u8 channel_mode;
+ u8 pad2;
+ u8 num_priorities;
+};
+
+struct dpio_cmd_destroy {
+ __le32 dpio_id;
+};
+
+#define DPIO_ATTR_CHANNEL_MODE_SHIFT 0
+#define DPIO_ATTR_CHANNEL_MODE_SIZE 4
+
+struct dpio_rsp_get_attr {
+ __le32 id;
+ __le16 qbman_portal_id;
+ u8 num_priorities;
+ /* from LSB: channel_mode:4 */
+ u8 channel_mode;
+ __le64 qbman_portal_ce_offset;
+ __le64 qbman_portal_ci_offset;
+ __le32 qbman_version;
+ __le32 pad;
+ __le32 clk;
+};
+
+#pragma pack(pop)
/* Data Path I/O Portal API
* Contains initialization APIs and runtime control APIs for DPIO
@@ -53,44 +75,15 @@ do { \
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 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 dpio_open(struct fsl_mc_io *mc_io,
- uint32_t cmd_flags,
- uint32_t dpio_id,
- uint16_t *token);
+int dpio_open(struct fsl_mc_io *mc_io, u32 cmd_flags, int dpio_id,
+ u16 *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, u32 cmd_flags, u16 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
*/
@@ -101,143 +94,52 @@ 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;
+ u8 num_priorities;
};
-/**
- * dpio_create() - Create the DPIO object.
- * @mc_io: Pointer to MC portal's I/O object
- * @token: Authentication token.
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @cfg: Configuration structure
- * @obj_id: Returned obj_id; use in subsequent API calls
- *
- * 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.
- *
- * 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 calls to
- * this specific object. For objects that are created using the
- * DPL file, call dpio_open() function to get an authentication
- * token first.
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dpio_create(struct fsl_mc_io *mc_io,
- uint16_t 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
- * @token: Authentication token.
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @obj_id: Object ID of DPIO
- *
- * Return: '0' on Success; Error code otherwise
- */
-int dpio_destroy(struct fsl_mc_io *mc_io,
- uint16_t token,
- uint32_t cmd_flags,
- uint32_t obj_id);
+int dpio_create(struct fsl_mc_io *mc_io, u16 dprc_token, u32 cmd_flags,
+ const struct dpio_cfg *cfg, u32 *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, u16 dprc_token, u32 cmd_flags,
+ u32 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, u32 cmd_flags, u16 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_disable(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token);
/**
* struct dpio_attr - Structure representing DPIO attributes
- * @id: DPIO object ID
- * @version: DPIO version
- * @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 {
- uint32_t id;
- uint64_t qbman_portal_ce_offset;
- uint64_t qbman_portal_ci_offset;
- uint16_t qbman_portal_id;
+ int id;
+ u64 qbman_portal_ce_offset;
+ u64 qbman_portal_ci_offset;
+ u16 qbman_portal_id;
enum dpio_channel_mode channel_mode;
- uint8_t num_priorities;
- uint32_t qbman_version;
+ u8 num_priorities;
+ u32 qbman_version;
+ u32 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);
-
-/**
- * dpio_get_api_version - Retrieve DPIO Major and Minor version info.
- *
- * @mc_io: Pointer to MC portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @major_ver: DPIO major version
- * @minor_ver: DPIO minor version
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dpio_get_api_version(struct fsl_mc_io *mc_io,
- u32 cmd_flags,
- u16 *major_ver,
- u16 *minor_ver);
+int dpio_get_attributes(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token,
+ struct dpio_attr *attr);
+int dpio_get_api_version(struct fsl_mc_io *mc_io, u32 cmd_flags,
+ u16 *major_ver, u16 *minor_ver);
#endif /* _FSL_DPIO_H */
diff --git a/include/fsl-mc/fsl_dpmac.h b/include/fsl-mc/fsl_dpmac.h
index 1cea123a31..a8e9e4684a 100644
--- a/include/fsl-mc/fsl_dpmac.h
+++ b/include/fsl-mc/fsl_dpmac.h
@@ -21,74 +21,59 @@
#define DPMAC_CMDID_DESTROY 0x98c1
#define DPMAC_CMDID_GET_API_VERSION 0xa0c1
-#define DPMAC_CMDID_GET_ATTR 0x0041
#define DPMAC_CMDID_RESET 0x0051
-#define DPMAC_CMDID_MDIO_READ 0x0c01
-#define DPMAC_CMDID_MDIO_WRITE 0x0c11
-#define DPMAC_CMDID_GET_LINK_CFG 0x0c21
#define DPMAC_CMDID_SET_LINK_STATE 0x0c31
#define DPMAC_CMDID_GET_COUNTER 0x0c41
-/* cmd, param, offset, width, type, arg_name */
-#define DPMAC_CMD_CREATE(cmd, cfg) \
- MC_CMD_OP(cmd, 0, 0, 16, uint16_t, cfg->mac_id)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPMAC_CMD_OPEN(cmd, dpmac_id) \
- MC_CMD_OP(cmd, 0, 0, 32, int, dpmac_id)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPMAC_RSP_GET_ATTRIBUTES(cmd, attr) \
-do { \
- MC_RSP_OP(cmd, 0, 0, 32, int, attr->phy_id);\
- MC_RSP_OP(cmd, 0, 32, 32, int, attr->id);\
- MC_RSP_OP(cmd, 1, 32, 8, enum dpmac_link_type, attr->link_type);\
- MC_RSP_OP(cmd, 1, 40, 8, enum dpmac_eth_if, attr->eth_if);\
- MC_RSP_OP(cmd, 2, 0, 32, uint32_t, attr->max_rate);\
-} while (0)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPMAC_CMD_MDIO_READ(cmd, cfg) \
-do { \
- MC_CMD_OP(cmd, 0, 0, 8, uint8_t, cfg->phy_addr); \
- MC_CMD_OP(cmd, 0, 8, 8, uint8_t, cfg->reg); \
-} while (0)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPMAC_RSP_MDIO_READ(cmd, data) \
- MC_RSP_OP(cmd, 0, 16, 16, uint16_t, data)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPMAC_CMD_MDIO_WRITE(cmd, cfg) \
-do { \
- MC_CMD_OP(cmd, 0, 0, 8, uint8_t, cfg->phy_addr); \
- MC_CMD_OP(cmd, 0, 8, 8, uint8_t, cfg->reg); \
- MC_CMD_OP(cmd, 0, 16, 16, uint16_t, cfg->data); \
-} while (0)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPMAC_RSP_GET_LINK_CFG(cmd, cfg) \
-do { \
- MC_RSP_OP(cmd, 0, 0, 64, uint64_t, cfg->options); \
- MC_RSP_OP(cmd, 1, 0, 32, uint32_t, cfg->rate); \
-} while (0)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPMAC_CMD_SET_LINK_STATE(cmd, cfg) \
-do { \
- MC_CMD_OP(cmd, 0, 0, 64, uint64_t, cfg->options); \
- MC_CMD_OP(cmd, 1, 0, 32, uint32_t, cfg->rate); \
- MC_CMD_OP(cmd, 2, 0, 1, int, cfg->up); \
-} while (0)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPMAC_CMD_GET_COUNTER(cmd, type) \
- MC_CMD_OP(cmd, 1, 0, 64, enum dpmac_counter, type)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPMAC_RSP_GET_COUNTER(cmd, counter) \
- MC_RSP_OP(cmd, 1, 0, 64, uint64_t, counter)
+/* Macros for accessing command fields smaller than 1byte */
+#define DPMAC_MASK(field) \
+ GENMASK(DPMAC_##field##_SHIFT + DPMAC_##field##_SIZE - 1, \
+ DPMAC_##field##_SHIFT)
+#define dpmac_set_field(var, field, val) \
+ ((var) |= (((val) << DPMAC_##field##_SHIFT) & DPMAC_MASK(field)))
+#define dpmac_get_field(var, field) \
+ (((var) & DPMAC_MASK(field)) >> DPMAC_##field##_SHIFT)
+
+#pragma pack(push, 1)
+struct dpmac_cmd_open {
+ __le32 dpmac_id;
+};
+
+struct dpmac_cmd_create {
+ __le32 mac_id;
+};
+
+struct dpmac_cmd_destroy {
+ __le32 dpmac_id;
+};
+
+#define DPMAC_STATE_SIZE 1
+#define DPMAC_STATE_SHIFT 0
+#define DPMAC_STATE_VALID_SIZE 1
+#define DPMAC_STATE_VALID_SHIFT 1
+
+struct dpmac_cmd_set_link_state {
+ __le64 options;
+ __le32 rate;
+ __le32 pad;
+ /* only least significant bit is valid */
+ u8 up;
+ u8 pad0[7];
+ __le64 supported;
+ __le64 advertising;
+};
+
+struct dpmac_cmd_get_counter {
+ u8 type;
+};
+
+struct dpmac_rsp_get_counter {
+ __le64 pad;
+ __le64 counter;
+};
+
+#pragma pack(pop)
/* Data Path MAC API
* Contains initialization APIs and runtime control APIs for DPMAC
@@ -96,42 +81,27 @@ do { \
struct fsl_mc_io;
-/**
- * dpmac_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_'
- * @dpmac_id: DPMAC 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 dpmac_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 dpmac_open(struct fsl_mc_io *mc_io,
- uint32_t cmd_flags,
- int dpmac_id,
- uint16_t *token);
+int dpmac_open(struct fsl_mc_io *mc_io, u32 cmd_flags, int dpmac_id, u16 *token);
+
+int dpmac_close(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token);
/**
- * dpmac_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 DPMAC 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.
+ * struct dpmac_cfg - Structure representing DPMAC configuration
+ * @mac_id: Represents the Hardware MAC ID; in case of multiple WRIOP,
+ * the MAC IDs are continuous.
+ * For example: 2 WRIOPs, 16 MACs in each:
+ * MAC IDs for the 1st WRIOP: 1-16,
+ * MAC IDs for the 2nd WRIOP: 17-32.
*/
-int dpmac_close(struct fsl_mc_io *mc_io,
- uint32_t cmd_flags,
- uint16_t token);
+struct dpmac_cfg {
+ int mac_id;
+};
+
+int dpmac_create(struct fsl_mc_io *mc_io, u16 dprc_token, u32 cmd_flags,
+ const struct dpmac_cfg *cfg, u32 *obj_id);
+
+int dpmac_destroy(struct fsl_mc_io *mc_io, u16 dprc_token, u32 cmd_flags,
+ u32 object_id);
/**
* enum dpmac_link_type - DPMAC link type
@@ -171,60 +141,6 @@ enum dpmac_eth_if {
DPMAC_ETH_IF_XFI
};
-/**
- * struct dpmac_cfg - Structure representing DPMAC configuration
- * @mac_id: Represents the Hardware MAC ID; in case of multiple WRIOP,
- * the MAC IDs are continuous.
- * For example: 2 WRIOPs, 16 MACs in each:
- * MAC IDs for the 1st WRIOP: 1-16,
- * MAC IDs for the 2nd WRIOP: 17-32.
- */
-struct dpmac_cfg {
- int mac_id;
-};
-
-/**
- * dpmac_create() - Create the DPMAC object.
- * @mc_io: Pointer to MC portal's I/O object
- * @token: Authentication token.
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @cfg: Configuration structure
- * @obj_id: Returned obj_id; use in subsequent API calls
- *
- * Create the DPMAC 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 returns a unique authentication token,
- * associated with the specific object ID and the specific MC
- * portal; this token must be used in all subsequent calls to
- * this specific object. For objects that are created using the
- * DPL file, call dpmac_open function to get an authentication
- * token first.
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dpmac_create(struct fsl_mc_io *mc_io,
- uint16_t token,
- uint32_t cmd_flags,
- const struct dpmac_cfg *cfg,
- uint32_t *obj_id);
-
-/**
- * dpmac_destroy() - Destroy the DPMAC object and release all its resources.
- * @mc_io: Pointer to MC portal's I/O object
- * @token: Authentication token.
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @obj_id: DPMAC object id
- *
- * Return: '0' on Success; error code otherwise.
- */
-int dpmac_destroy(struct fsl_mc_io *mc_io,
- uint16_t token,
- uint32_t cmd_flags,
- uint32_t obj_id);
-
/* DPMAC IRQ Index and Events */
/* IRQ index */
@@ -248,65 +164,9 @@ struct dpmac_attr {
int phy_id;
enum dpmac_link_type link_type;
enum dpmac_eth_if eth_if;
- uint32_t max_rate;
+ u32 max_rate;
};
-/**
- * dpmac_get_attributes - Retrieve DPMAC 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 DPMAC object
- * @attr: Returned object's attributes
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dpmac_get_attributes(struct fsl_mc_io *mc_io,
- uint32_t cmd_flags,
- uint16_t token,
- struct dpmac_attr *attr);
-
-/**
- * struct dpmac_mdio_cfg - DPMAC MDIO read/write parameters
- * @phy_addr: MDIO device address
- * @reg: Address of the register within the Clause 45 PHY device from which data
- * is to be read
- * @data: Data read/write from/to MDIO
- */
-struct dpmac_mdio_cfg {
- uint8_t phy_addr;
- uint8_t reg;
- uint16_t data;
-};
-
-/**
- * dpmac_mdio_read() - Perform MDIO read transaction
- * @mc_io: Pointer to opaque I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @token: Token of DPMAC object
- * @cfg: Structure with MDIO transaction parameters
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dpmac_mdio_read(struct fsl_mc_io *mc_io,
- uint32_t cmd_flags,
- uint16_t token,
- struct dpmac_mdio_cfg *cfg);
-
-/**
- * dpmac_mdio_write() - Perform MDIO write transaction
- * @mc_io: Pointer to opaque I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @token: Token of DPMAC object
- * @cfg: Structure with MDIO transaction parameters
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dpmac_mdio_write(struct fsl_mc_io *mc_io,
- uint32_t cmd_flags,
- uint16_t token,
- struct dpmac_mdio_cfg *cfg);
-
/* DPMAC link configuration/state options */
/* Enable auto-negotiation */
@@ -319,55 +179,25 @@ int dpmac_mdio_write(struct fsl_mc_io *mc_io,
#define DPMAC_LINK_OPT_ASYM_PAUSE 0x0000000000000008ULL
/**
- * struct dpmac_link_cfg - Structure representing DPMAC link configuration
- * @rate: Link's rate - in Mbps
- * @options: Enable/Disable DPMAC link cfg features (bitmap)
- */
-struct dpmac_link_cfg {
- uint32_t rate;
- uint64_t options;
-};
-
-/**
- * dpmac_get_link_cfg() - Get Ethernet link configuration
- * @mc_io: Pointer to opaque I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @token: Token of DPMAC object
- * @cfg: Returned structure with the link configuration
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dpmac_get_link_cfg(struct fsl_mc_io *mc_io,
- uint32_t cmd_flags,
- uint16_t token,
- struct dpmac_link_cfg *cfg);
-
-/**
* struct dpmac_link_state - DPMAC link configuration request
* @rate: Rate in Mbps
* @options: Enable/Disable DPMAC link cfg features (bitmap)
* @up: Link state
+ * @state_valid: Ignore/Update the state of the link
+ * @supported: Speeds capability of the phy (bitmap)
+ * @advertising: Speeds that are advertised for autoneg (bitmap)
*/
struct dpmac_link_state {
- uint32_t rate;
- uint64_t options;
- int up;
+ u32 rate;
+ u64 options;
+ int up;
+ int state_valid;
+ u64 supported;
+ u64 advertising;
};
-/**
- * dpmac_set_link_state() - Set the Ethernet link status
- * @mc_io: Pointer to opaque I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @token: Token of DPMAC object
- * @link_state: Link state configuration
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dpmac_set_link_state(struct fsl_mc_io *mc_io,
- uint32_t cmd_flags,
- uint16_t token,
- struct dpmac_link_state *link_state);
-
+int dpmac_set_link_state(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token,
+ struct dpmac_link_state *link_state);
/**
* enum dpni_counter - DPNI counter types
* @DPMAC_CNT_ING_FRAME_64: counts 64-octet frame, good or bad.
@@ -412,6 +242,8 @@ int dpmac_set_link_state(struct fsl_mc_io *mc_io,
* @DPMAC_CNT_EGR_ERR_FRAME: counts frame transmitted with an error
* @DPMAC_CNT_ING_GOOD_FRAME: counts frame received without error, including
* pause frames.
+ * @DPMAC_CNT_EGR_GOOD_FRAME: counts frames transmitted without error, including
+ * pause frames.
*/
enum dpmac_counter {
DPMAC_CNT_ING_FRAME_64,
@@ -440,37 +272,14 @@ enum dpmac_counter {
DPMAC_CNT_EGR_BCAST_FRAME,
DPMAC_CNT_EGR_UCAST_FRAME,
DPMAC_CNT_EGR_ERR_FRAME,
- DPMAC_CNT_ING_GOOD_FRAME
+ DPMAC_CNT_ING_GOOD_FRAME,
+ DPMAC_CNT_EGR_GOOD_FRAME,
};
-/**
- * dpmac_get_counter() - Read a specific DPMAC counter
- * @mc_io: Pointer to opaque I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @token: Token of DPMAC object
- * @type: The requested counter
- * @counter: Returned counter value
- *
- * Return: The requested counter; '0' otherwise.
- */
-int dpmac_get_counter(struct fsl_mc_io *mc_io,
- uint32_t cmd_flags,
- uint16_t token,
- enum dpmac_counter type,
- uint64_t *counter);
-/**
- * dpmac_get_api_version - Retrieve DPMAC Major and Minor version info.
- *
- * @mc_io: Pointer to MC portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @major_ver: DPMAC major version
- * @minor_ver: DPMAC minor version
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dpmac_get_api_version(struct fsl_mc_io *mc_io,
- uint32_t cmd_flags,
- uint16_t *major_ver,
- uint16_t *minor_ver);
+int dpmac_get_counter(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token,
+ enum dpmac_counter type, u64 *counter);
+
+int dpmac_get_api_version(struct fsl_mc_io *mc_io, u32 cmd_flags,
+ u16 *major_ver, u16 *minor_ver);
#endif /* __FSL_DPMAC_H */
diff --git a/include/fsl-mc/fsl_dpmng.h b/include/fsl-mc/fsl_dpmng.h
index 2148601e8a..5dfc9ecc42 100644
--- a/include/fsl-mc/fsl_dpmng.h
+++ b/include/fsl-mc/fsl_dpmng.h
@@ -30,17 +30,6 @@ struct mc_version {
uint32_t revision;
};
-/**
- * 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);
+int mc_get_version(struct fsl_mc_io *mc_io, uint32_t cmd_flags, struct mc_version *mc_ver_info);
#endif /* __FSL_DPMNG_H */
diff --git a/include/fsl-mc/fsl_dpni.h b/include/fsl-mc/fsl_dpni.h
index e5e7338192..9bc475475d 100644
--- a/include/fsl-mc/fsl_dpni.h
+++ b/include/fsl-mc/fsl_dpni.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0+ */
/*
* Copyright 2013-2016 Freescale Semiconductor, Inc.
- * Copyright 2017 NXP
+ * Copyright 2017, 2023 NXP
*/
#ifndef _FSL_DPNI_H
#define _FSL_DPNI_H
@@ -24,303 +24,243 @@
#define DPNI_CMDID_SET_POOLS 0x2002
#define DPNI_CMDID_SET_BUFFER_LAYOUT 0x2651
-#define DPNI_CMDID_GET_BUFFER_LAYOUT 0x2641
-#define DPNI_CMDID_SET_ERRORS_BEHAVIOR 0x20B1
#define DPNI_CMDID_GET_QDID 0x2101
#define DPNI_CMDID_GET_TX_DATA_OFFSET 0x2121
#define DPNI_CMDID_GET_LINK_STATE 0x2151
#define DPNI_CMDID_SET_LINK_CFG 0x21A1
-#define DPNI_CMDID_SET_PRIM_MAC 0x2241
-#define DPNI_CMDID_GET_PRIM_MAC 0x2251
#define DPNI_CMDID_ADD_MAC_ADDR 0x2261
-#define DPNI_CMDID_REMOVE_MAC_ADDR 0x2271
#define DPNI_CMDID_GET_STATISTICS 0x25D1
-#define DPNI_CMDID_RESET_STATISTICS 0x25E1
#define DPNI_CMDID_GET_QUEUE 0x25F1
#define DPNI_CMDID_SET_QUEUE 0x2601
#define DPNI_CMDID_SET_TX_CONFIRMATION_MODE 0x2661
-/* cmd, param, offset, width, type, arg_name */
-#define DPNI_CMD_OPEN(cmd, dpni_id) \
- MC_CMD_OP(cmd, 0, 0, 32, int, dpni_id)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPNI_PREP_CFG(param, cfg) \
-do { \
- MC_PREP_OP(param, 0, 0, 32, uint16_t, cfg->adv.options); \
- MC_PREP_OP(param, 0, 32, 8, uint16_t, cfg->adv.num_queues); \
- MC_PREP_OP(param, 0, 40, 8, uint16_t, cfg->adv.num_tcs); \
- MC_PREP_OP(param, 0, 48, 8, uint16_t, cfg->adv.mac_entries); \
- MC_PREP_OP(param, 1, 0, 8, uint16_t, cfg->adv.vlan_entries); \
- MC_PREP_OP(param, 1, 16, 8, uint16_t, cfg->adv.qos_entries); \
- MC_PREP_OP(param, 1, 32, 16, uint16_t, cfg->adv.fs_entries); \
-} while (0)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPNI_EXT_CFG(param, cfg) \
-do { \
- MC_EXT_OP(param, 0, 0, 32, uint16_t, cfg->adv.options); \
- MC_EXT_OP(param, 0, 32, 8, uint16_t, cfg->adv.num_queues); \
- MC_EXT_OP(param, 0, 40, 8, uint16_t, cfg->adv.num_tcs); \
- MC_EXT_OP(param, 0, 48, 8, uint16_t, cfg->adv.mac_entries); \
- MC_EXT_OP(param, 1, 0, 8, uint16_t, cfg->adv.vlan_entries); \
- MC_EXT_OP(param, 1, 16, 8, uint16_t, cfg->adv.qos_entries); \
- MC_EXT_OP(param, 1, 32, 16, uint16_t, cfg->adv.fs_entries); \
-} while (0)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPNI_CMD_CREATE(cmd, cfg) \
-do { \
- MC_CMD_OP(cmd, 0, 0, 32, uint32_t, cfg->adv.options); \
- MC_CMD_OP(cmd, 0, 32, 8, uint8_t, cfg->adv.num_queues); \
- MC_CMD_OP(cmd, 0, 40, 8, uint8_t, cfg->adv.num_tcs); \
- MC_CMD_OP(cmd, 0, 48, 8, uint8_t, cfg->adv.mac_entries); \
- MC_CMD_OP(cmd, 1, 0, 8, uint8_t, cfg->adv.vlan_entries); \
- MC_CMD_OP(cmd, 1, 16, 8, uint8_t, cfg->adv.qos_entries); \
- MC_CMD_OP(cmd, 1, 32, 16, uint8_t, cfg->adv.fs_entries); \
-} while (0)
-
-/* 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)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPNI_RSP_GET_ATTR(cmd, attr) \
-do { \
- MC_RSP_OP(cmd, 0, 0, 32, int, attr->options);\
- MC_RSP_OP(cmd, 0, 32, 8, uint8_t, attr->max_num_queues); \
- MC_RSP_OP(cmd, 0, 40, 8, uint8_t, attr->max_num_tcs); \
- MC_RSP_OP(cmd, 0, 48, 8, uint8_t, attr->max_mac_entries); \
- MC_RSP_OP(cmd, 1, 0, 8, uint8_t, attr->max_vlan_entries); \
- MC_RSP_OP(cmd, 1, 16, 8, uint8_t, attr->max_qos_entries); \
- MC_RSP_OP(cmd, 1, 32, 16, uint16_t, attr->max_fs_entries); \
- MC_RSP_OP(cmd, 2, 0, 8, uint8_t, attr->max_qos_key_size); \
- MC_RSP_OP(cmd, 2, 8, 8, uint8_t, attr->max_fs_key_size); \
- MC_RSP_OP(cmd, 2, 16, 16, uint16_t, attr->wriop_version); \
-} while (0)
-
-/* 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)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPNI_CMD_SET_BUFFER_LAYOUT(cmd, layout, queue) \
-do { \
- MC_CMD_OP(cmd, 0, 0, 8, enum dpni_queue_type, queue); \
- 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, 0, 32, 16, uint16_t, layout->options); \
- MC_CMD_OP(cmd, 0, 48, 1, int, layout->pass_timestamp); \
- MC_CMD_OP(cmd, 0, 49, 1, int, layout->pass_parser_result); \
- MC_CMD_OP(cmd, 0, 50, 1, int, layout->pass_frame_status); \
- 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)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPNI_RSP_GET_QDID(cmd, qdid) \
- MC_RSP_OP(cmd, 0, 0, 16, uint16_t, qdid)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPNI_RSP_GET_TX_DATA_OFFSET(cmd, data_offset) \
- MC_RSP_OP(cmd, 0, 0, 16, uint16_t, data_offset)
-
-/* 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)
-
-/* 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)
-
-/* 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)
-
-/* 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)
-
-/* 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)
-
-/* 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)
-
-#define DPNI_CMD_GET_QUEUE(cmd, type, tc, index) \
-do { \
- MC_CMD_OP(cmd, 0, 0, 8, enum dpni_queue_type, type); \
- MC_CMD_OP(cmd, 0, 8, 8, uint8_t, tc); \
- MC_CMD_OP(cmd, 0, 16, 8, uint8_t, index); \
-} while (0)
-
-#define DPNI_RSP_GET_QUEUE(cmd, queue) \
-do { \
- MC_RSP_OP(cmd, 1, 0, 32, uint32_t, (queue)->destination.id); \
- MC_RSP_OP(cmd, 1, 56, 4, enum dpni_dest, (queue)->destination.type); \
- MC_RSP_OP(cmd, 1, 62, 1, char, (queue)->destination.stash_ctrl); \
- MC_RSP_OP(cmd, 1, 63, 1, char, (queue)->destination.hold_active); \
- MC_RSP_OP(cmd, 2, 0, 64, uint64_t, (queue)->flc); \
- MC_RSP_OP(cmd, 3, 0, 64, uint64_t, (queue)->user_context); \
- MC_RSP_OP(cmd, 4, 0, 32, uint32_t, (queue)->fqid); \
- MC_RSP_OP(cmd, 4, 32, 16, uint16_t, (queue)->qdbin); \
-} while (0)
-
-#define DPNI_CMD_SET_QUEUE(cmd, type, tc, index, queue) \
-do { \
- MC_CMD_OP(cmd, 0, 0, 8, enum dpni_queue_type, type); \
- 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, (queue)->options); \
- MC_CMD_OP(cmd, 1, 0, 32, uint32_t, (queue)->destination.id); \
- MC_CMD_OP(cmd, 1, 56, 4, enum dpni_dest, (queue)->destination.type); \
- MC_CMD_OP(cmd, 1, 62, 1, char, (queue)->destination.stash_ctrl); \
- MC_CMD_OP(cmd, 1, 63, 1, char, (queue)->destination.hold_active); \
- MC_CMD_OP(cmd, 1, 0, 32, uint32_t, (queue)->destination.id); \
- MC_CMD_OP(cmd, 2, 0, 64, uint64_t, (queue)->flc); \
- MC_CMD_OP(cmd, 3, 0, 64, uint64_t, (queue)->user_context); \
-} while (0)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPNI_CMD_GET_STATISTICS(cmd, page) \
- MC_CMD_OP(cmd, 0, 0, 8, uint8_t, page)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPNI_RSP_GET_STATISTICS(cmd, stat) \
-do { \
- MC_RSP_OP(cmd, 0, 0, 64, uint64_t, (stat)->counter0); \
- MC_RSP_OP(cmd, 1, 0, 64, uint64_t, (stat)->counter1); \
- MC_RSP_OP(cmd, 2, 0, 64, uint64_t, (stat)->counter2); \
- MC_RSP_OP(cmd, 3, 0, 64, uint64_t, (stat)->counter3); \
- MC_RSP_OP(cmd, 4, 0, 64, uint64_t, (stat)->counter4); \
- MC_RSP_OP(cmd, 5, 0, 64, uint64_t, (stat)->counter5); \
- MC_RSP_OP(cmd, 6, 0, 64, uint64_t, (stat)->counter6); \
-} while (0)
-
-enum net_prot {
- NET_PROT_NONE = 0,
- NET_PROT_PAYLOAD,
- NET_PROT_ETH,
- NET_PROT_VLAN,
- NET_PROT_IPV4,
- NET_PROT_IPV6,
- NET_PROT_IP,
- NET_PROT_TCP,
- NET_PROT_UDP,
- NET_PROT_UDP_LITE,
- NET_PROT_IPHC,
- NET_PROT_SCTP,
- NET_PROT_SCTP_CHUNK_DATA,
- NET_PROT_PPPOE,
- NET_PROT_PPP,
- NET_PROT_PPPMUX,
- NET_PROT_PPPMUX_SUBFRM,
- NET_PROT_L2TPV2,
- NET_PROT_L2TPV3_CTRL,
- NET_PROT_L2TPV3_SESS,
- NET_PROT_LLC,
- NET_PROT_LLC_SNAP,
- NET_PROT_NLPID,
- NET_PROT_SNAP,
- NET_PROT_MPLS,
- NET_PROT_IPSEC_AH,
- NET_PROT_IPSEC_ESP,
- NET_PROT_UDP_ENC_ESP, /* RFC 3948 */
- NET_PROT_MACSEC,
- NET_PROT_GRE,
- NET_PROT_MINENCAP,
- NET_PROT_DCCP,
- NET_PROT_ICMP,
- NET_PROT_IGMP,
- NET_PROT_ARP,
- NET_PROT_CAPWAP_DATA,
- NET_PROT_CAPWAP_CTRL,
- NET_PROT_RFC2684,
- NET_PROT_ICMPV6,
- NET_PROT_FCOE,
- NET_PROT_FIP,
- NET_PROT_ISCSI,
- NET_PROT_GTP,
- NET_PROT_USER_DEFINED_L2,
- NET_PROT_USER_DEFINED_L3,
- NET_PROT_USER_DEFINED_L4,
- NET_PROT_USER_DEFINED_L5,
- NET_PROT_USER_DEFINED_SHIM1,
- NET_PROT_USER_DEFINED_SHIM2,
-
- NET_PROT_DUMMY_LAST
+/* 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)
+
+#pragma pack(push, 1)
+struct dpni_cmd_open {
+ __le32 dpni_id;
};
+struct dpni_cmd_create {
+ __le32 options;
+ u8 num_queues;
+ u8 num_tcs;
+ u8 mac_filter_entries;
+ u8 num_channels;
+ u8 vlan_filter_entries;
+ u8 pad2;
+ u8 qos_entries;
+ u8 pad3;
+ __le16 fs_entries;
+ u8 num_rx_tcs;
+ u8 pad4;
+ u8 num_cgs;
+ __le16 num_opr;
+ u8 dist_key_size;
+};
+
+struct dpni_cmd_destroy {
+ __le32 dpni_id;
+};
+
+#define DPNI_BACKUP_POOL(val, order) (((val) & 0x1) << (order))
+
+struct dpni_cmd_pool {
+ __le16 dpbp_id;
+ u8 priority_mask;
+ u8 pad;
+};
+
+struct dpni_cmd_set_pools {
+ u8 num_dpbp;
+ u8 backup_pool_mask;
+ u8 pad;
+ u8 pool_options;
+ struct dpni_cmd_pool pool[8];
+ __le16 buffer_size[8];
+};
+
+struct dpni_rsp_get_attr {
+ /* response word 0 */
+ __le32 options;
+ u8 num_queues;
+ u8 num_rx_tcs;
+ u8 mac_filter_entries;
+ u8 num_tx_tcs;
+ /* response word 1 */
+ u8 vlan_filter_entries;
+ u8 num_channels;
+ u8 qos_entries;
+ u8 pad2;
+ __le16 fs_entries;
+ __le16 num_opr;
+ /* response word 2 */
+ u8 qos_key_size;
+ u8 fs_key_size;
+ __le16 wriop_version;
+ u8 num_cgs;
+};
+
+/* 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_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
+#define DPNI_PASS_SWO_SHIFT 3
+#define DPNI_PASS_SWO_SIZE 1
+
+struct dpni_cmd_set_buffer_layout {
+ /* cmd word 0 */
+ u8 qtype;
+ u8 pad0[3];
+ __le16 options;
+ /* from LSB: pass_timestamp:1, parser_result:1, frame_status:1 */
+ u8 flags;
+ u8 pad1;
+ /* cmd word 1 */
+ __le16 private_data_size;
+ __le16 data_align;
+ __le16 head_room;
+ __le16 tail_room;
+};
+
+struct dpni_cmd_get_qdid {
+ u8 qtype;
+};
+
+struct dpni_rsp_get_qdid {
+ __le16 qdid;
+};
+
+struct dpni_rsp_get_tx_data_offset {
+ __le16 data_offset;
+};
+
+struct dpni_cmd_set_link_cfg {
+ __le64 pad0;
+ __le32 rate;
+ __le32 pad1;
+ __le64 options;
+ __le64 advertising;
+};
+
+#define DPNI_LINK_STATE_SHIFT 0
+#define DPNI_LINK_STATE_SIZE 1
+#define DPNI_STATE_VALID_SHIFT 1
+#define DPNI_STATE_VALID_SIZE 1
+
+struct dpni_rsp_get_link_state {
+ __le32 pad0;
+ /* from LSB: up:1 */
+ u8 flags;
+ u8 pad1[3];
+ __le32 rate;
+ __le32 pad2;
+ __le64 options;
+ __le64 supported;
+ __le64 advertising;
+};
+
+struct dpni_cmd_add_mac_addr {
+ u8 flags;
+ u8 pad;
+ u8 mac_addr[6];
+ u8 tc_id;
+ u8 fq_id;
+};
+
+struct dpni_cmd_get_queue {
+ u8 qtype;
+ u8 tc;
+ u8 index;
+ u8 channel_id;
+};
+
+#define DPNI_DEST_TYPE_SHIFT 0
+#define DPNI_DEST_TYPE_SIZE 4
+#define DPNI_CGID_VALID_SHIFT 5
+#define DPNI_CGID_VALID_SIZE 1
+#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 */
+ __le64 pad0;
+ /* response word 1 */
+ __le32 dest_id;
+ __le16 pad1;
+ u8 dest_prio;
+ /* From LSB: dest_type:4, pad:1, cgid_valid:1, flc_stash_ctrl:1, hold_active:1 */
+ u8 flags;
+ /* response word 2 */
+ __le64 flc;
+ /* response word 3 */
+ __le64 user_context;
+ /* response word 4 */
+ __le32 fqid;
+ __le16 qdbin;
+ __le16 pad2;
+ /* response word 5*/
+ u8 cgid;
+};
+
+struct dpni_cmd_set_queue {
+ /* cmd word 0 */
+ u8 qtype;
+ u8 tc;
+ u8 index;
+ u8 options;
+ __le32 pad0;
+ /* cmd word 1 */
+ __le32 dest_id;
+ __le16 pad1;
+ u8 dest_prio;
+ u8 flags;
+ /* cmd word 2 */
+ __le64 flc;
+ /* cmd word 3 */
+ __le64 user_context;
+ /* cmd word 4 */
+ u8 cgid;
+ u8 channel_id;
+};
+
+struct dpni_tx_confirmation_mode {
+ u8 ceetm_ch_idx;
+ u8 pad1;
+ __le16 pad2;
+ u8 confirmation_mode;
+};
+
+struct dpni_cmd_get_statistics {
+ u8 page_number;
+ __le16 param;
+};
+
+struct dpni_rsp_get_statistics {
+ __le64 counter[7];
+};
+
+#pragma pack(pop)
+
/**
* Data Path Network Interface API
* Contains initialization APIs and runtime control APIs for DPNI
@@ -336,50 +276,17 @@ struct fsl_mc_io;
#define DPNI_MAX_DPBP 8
/* All traffic classes considered; see dpni_set_rx_flow() */
-#define DPNI_ALL_TCS (uint8_t)(-1)
+#define DPNI_ALL_TCS (u8)(-1)
/* All flows within traffic class considered; see dpni_set_rx_flow() */
-#define DPNI_ALL_TC_FLOWS (uint16_t)(-1)
+#define DPNI_ALL_TC_FLOWS (u16)(-1)
/* Generate new flow ID; see dpni_set_tx_flow() */
-#define DPNI_NEW_FLOW_ID (uint16_t)(-1)
+#define DPNI_NEW_FLOW_ID (u16)(-1)
/* use for common tx-conf queue; see dpni_set_tx_conf_<x>() */
-#define DPNI_COMMON_TX_CONF (uint16_t)(-1)
+#define DPNI_COMMON_TX_CONF (u16)(-1)
-/**
- * dpni_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_'
- * @dpni_id: DPNI 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 dpni_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 dpni_open(struct fsl_mc_io *mc_io,
- uint32_t cmd_flags,
- int dpni_id,
- uint16_t *token);
+int dpni_open(struct fsl_mc_io *mc_io, u32 cmd_flags, int dpni_id, u16 *token);
-/**
- * dpni_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 DPNI 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 dpni_close(struct fsl_mc_io *mc_io,
- uint32_t cmd_flags,
- uint16_t token);
+int dpni_close(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token);
/* DPNI configuration options */
@@ -442,57 +349,84 @@ enum dpni_queue_type {
DPNI_QUEUE_RX_ERR,
};
-struct dpni_cfg {
- uint8_t mac_addr[6];
- struct {
- uint32_t options;
- uint16_t fs_entries;
- uint8_t num_queues;
- uint8_t num_tcs;
- uint8_t mac_entries;
- uint8_t vlan_entries;
- uint8_t qos_entries;
- } adv;
-};
-
/**
- * struct dpni_extended_cfg - Structure representing extended DPNI configuration
- * @tc_cfg: TCs configuration
- * @ipr_cfg: IP reassembly configuration
+ * struct dpni_cfg - Structure representing DPNI configuration
+ * @options: Any combination of the following options:
+ * DPNI_OPT_TX_FRM_RELEASE
+ * DPNI_OPT_NO_MAC_FILTER
+ * DPNI_OPT_HAS_POLICING
+ * DPNI_OPT_SHARED_CONGESTION
+ * DPNI_OPT_HAS_KEY_MASKING
+ * DPNI_OPT_NO_FS
+ * DPNI_OPT_SINGLE_SENDER
+ * DPNI_OPT_STASHING_DIS
+ * @fs_entries: Number of entries in the flow steering table.
+ * This table is used to select the ingress queue for
+ * ingress traffic, targeting a GPP core or another.
+ * In addition it can be used to discard traffic that
+ * matches the set rule. It is either an exact match table
+ * or a TCAM table, depending on DPNI_OPT_ HAS_KEY_MASKING
+ * bit in OPTIONS field. This field is ignored if
+ * DPNI_OPT_NO_FS bit is set in OPTIONS field. Otherwise,
+ * value 0 defaults to 64. Maximum supported value is 1024.
+ * Note that the total number of entries is limited on the
+ * SoC to as low as 512 entries if TCAM is used.
+ * @vlan_filter_entries: Number of entries in the VLAN address filtering
+ * table. This is an exact match table used to filter
+ * ingress traffic based on VLAN IDs. Value 0 disables VLAN
+ * filtering. Maximum supported value is 16.
+ * @mac_filter_entries: Number of entries in the MAC address filtering
+ * table. This is an exact match table and allows both
+ * unicast and multicast entries. The primary MAC address
+ * of the network interface is not part of this table,
+ * this contains only entries in addition to it. This
+ * field is ignored if DPNI_OPT_ NO_MAC_FILTER is set in
+ * OPTIONS field. Otherwise, value 0 defaults to 80.
+ * Maximum supported value is 80.
+ * @num_queues: Number of Tx and Rx queues used for traffic
+ * distribution. This is orthogonal to QoS and is only
+ * used to distribute traffic to multiple GPP cores.
+ * This configuration affects the number of Tx queues
+ * (logical FQs, all associated with a single CEETM queue),
+ * Rx queues and Tx confirmation queues, if applicable.
+ * Value 0 defaults to one queue. Maximum supported value
+ * is 8.
+ * @num_tcs: Number of traffic classes (TCs), reserved for the DPNI.
+ * TCs can have different priority levels for the purpose
+ * of Tx scheduling (see DPNI_SET_TX_PRIORITIES), different
+ * BPs (DPNI_ SET_POOLS), policers. There are dedicated QM
+ * queues for traffic classes (including class queues on
+ * Tx). Value 0 defaults to one TC. Maximum supported value
+ * is 16. There are maximum 16 TCs for Tx and 8 TCs for Rx.
+ * When num_tcs>8 Tx will use this value but Rx will have
+ * only 8 traffic classes.
+ * @num_rx_tcs: if set to other value than zero represents number
+ * of TCs used for Rx. Maximum value is 8. If set to zero the
+ * number of Rx TCs will be initialized with the value provided
+ * in num_tcs parameter.
+ * @qos_entries: Number of entries in the QoS classification table. This
+ * table is used to select the TC for ingress traffic. It
+ * is either an exact match or a TCAM table, depending on
+ * DPNI_OPT_ HAS_KEY_MASKING bit in OPTIONS field. This
+ * field is ignored if the DPNI has a single TC. Otherwise,
+ * a value of 0 defaults to 64. Maximum supported value
+ * is 64.
+ * @num_channels: Number of egress channels used by this dpni object. If
+ * set to zero the dpni object will use a single CEETM channel.
*/
-struct dpni_extended_cfg {
- /**
- * struct tc_cfg - TC configuration
- * @max_dist: Maximum distribution size for Rx traffic class;
- * supported values: 1,2,3,4,6,7,8,12,14,16,24,28,32,48,56,64,96,
- * 112,128,192,224,256,384,448,512,768,896,1024;
- * value '0' will be treated as '1'.
- * other unsupported values will be round down to the nearest
- * supported value.
- * @max_fs_entries: Maximum FS entries for Rx traffic class;
- * '0' means no support for this TC;
- */
- struct {
- uint16_t max_dist;
- uint16_t max_fs_entries;
- } tc_cfg[DPNI_MAX_TC];
- /**
- * struct ipr_cfg - Structure representing IP reassembly configuration
- * @max_reass_frm_size: Maximum size of the reassembled frame
- * @min_frag_size_ipv4: Minimum fragment size of IPv4 fragments
- * @min_frag_size_ipv6: Minimum fragment size of IPv6 fragments
- * @max_open_frames_ipv4: Maximum concurrent IPv4 packets in reassembly
- * process
- * @max_open_frames_ipv6: Maximum concurrent IPv6 packets in reassembly
- * process
- */
- struct {
- uint16_t max_reass_frm_size;
- uint16_t min_frag_size_ipv4;
- uint16_t min_frag_size_ipv6;
- uint16_t max_open_frames_ipv4;
- uint16_t max_open_frames_ipv6;
- } ipr_cfg;
+struct dpni_cfg {
+ u32 options;
+ u16 fs_entries;
+ u8 vlan_filter_entries;
+ u8 mac_filter_entries;
+ u8 num_queues;
+ u8 num_tcs;
+ u8 num_rx_tcs;
+ u8 qos_entries;
+ u8 num_cgs;
+ u16 num_opr;
+ u8 dist_key_size;
+ u8 num_channels;
};
/**
@@ -503,249 +437,108 @@ struct dpni_extended_cfg {
* This function has to be called before dpni_create()
*/
int dpni_prepare_cfg(const struct dpni_cfg *cfg,
- uint8_t *cfg_buf);
-/**
- * dpni_create() - Create the DPNI object
- * @mc_io: Pointer to MC portal's I/O object
- * @token: Authentication token.
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @cfg: Configuration structure
- * @obj_id: Returned obj_id; use in subsequent API calls
- *
- * Create the DPNI 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 returns a unique authentication token,
- * associated with the specific object ID and the specific MC
- * portal; this token must be used in all subsequent calls to
- * this specific object. For objects that are created using the
- * DPL file, call dpni_open() function to get an authentication
- * token first.
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dpni_create(struct fsl_mc_io *mc_io,
- uint16_t token,
- uint32_t cmd_flags,
- const struct dpni_cfg *cfg,
- uint32_t *obj_id);
+ u8 *cfg_buf);
-/**
- * dpni_destroy() - Destroy the DPNI object and release all its resources.
- * @mc_io: Pointer to MC portal's I/O object
- * @token: Authentication token.
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @obj_id: Returned obj_id; use in subsequent API calls
- *
- * Return: '0' on Success; error code otherwise.
- */
-int dpni_destroy(struct fsl_mc_io *mc_io,
- uint16_t token,
- uint32_t cmd_flags,
- uint32_t obj_id);
+int dpni_create(struct fsl_mc_io *mc_io, u16 dprc_token, u32 cmd_flags,
+ const struct dpni_cfg *cfg, u32 *obj_id);
+
+int dpni_destroy(struct fsl_mc_io *mc_io, u16 dprc_token, u32 cmd_flags,
+ u32 object_id);
/**
* struct dpni_pools_cfg - Structure representing buffer pools configuration
- * @num_dpbp: Number of DPBPs
- * @pools: Array of buffer pools parameters; The number of valid entries
- * must match 'num_dpbp' value
+ * @num_dpbp: Number of DPBPs
+ * @pool_options: Buffer assignment options
+ * This field is a combination of DPNI_POOL_ASSOC_flags
+ * @pools: Array of buffer pools parameters; The number of valid entries
+ * must match 'num_dpbp' value
+ * @pools.dpbp_id: DPBP object ID
+ * @pools.priority: Priority mask that indicates TC's used with this buffer.
+ * I set to 0x00 MC will assume value 0xff.
+ * @pools.buffer_size: Buffer size
+ * @pools.backup_pool: Backup pool
*/
+
+#define DPNI_POOL_ASSOC_QPRI 0
+#define DPNI_POOL_ASSOC_QDBIN 1
+
struct dpni_pools_cfg {
- uint8_t num_dpbp;
- /**
- * struct pools - Buffer pools parameters
- * @dpbp_id: DPBP object ID
- * @buffer_size: Buffer size
- * @backup_pool: Backup pool
- */
+ u8 num_dpbp;
+ u8 pool_options;
struct {
int dpbp_id;
- uint16_t buffer_size;
+ u8 priority_mask;
+ u16 buffer_size;
int backup_pool;
} pools[DPNI_MAX_DPBP];
};
-/**
- * dpni_set_pools() - Set buffer pools 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 DPNI object
- * @cfg: Buffer pools configuration
- *
- * mandatory for DPNI operation
- * warning:Allowed only when DPNI is disabled
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dpni_set_pools(struct fsl_mc_io *mc_io,
- uint32_t cmd_flags,
- uint16_t token,
- const struct dpni_pools_cfg *cfg);
+int dpni_set_pools(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token,
+ const struct dpni_pools_cfg *cfg);
-/**
- * dpni_enable() - Enable the DPNI, 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 DPNI object
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dpni_enable(struct fsl_mc_io *mc_io,
- uint32_t cmd_flags,
- uint16_t token);
+int dpni_enable(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token);
-/**
- * dpni_disable() - Disable the DPNI, 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 DPNI object
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dpni_disable(struct fsl_mc_io *mc_io,
- uint32_t cmd_flags,
- uint16_t token);
+int dpni_disable(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token);
-
-/**
- * dpni_reset() - Reset the DPNI, 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 DPNI object
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dpni_reset(struct fsl_mc_io *mc_io,
- uint32_t cmd_flags,
- uint16_t token);
+int dpni_reset(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token);
/**
* struct dpni_attr - Structure representing DPNI attributes
- * @options: Mask of available options; reflects the value as was given in
- * object's creation
- * @max_num_queues: Number of queues available (for both Tx and Rx)
- * @max_num_tcs: Maximum number of traffic classes (for both Tx and Rx)
- * @max_mac_entries: Maximum number of traffic classes (for both Tx and Rx)
- * @max_unicast_filters: Maximum number of unicast filters
- * @max_multicast_filters: Maximum number of multicast filters
- * @max_vlan_entries: Maximum number of VLAN filters
- * @max_qos_entries: if 'max_tcs > 1', declares the maximum entries in QoS table
- * @max_fs_entries: declares the maximum entries in flow steering table
- * @max_qos_key_size: Maximum key size for the QoS look-up
- * @max_fs_key_size: Maximum key size for the flow steering
- * @wriop_version: Indicates revision of WRIOP hardware block
+ * @options: Any combination of the following options:
+ * DPNI_OPT_TX_FRM_RELEASE
+ * DPNI_OPT_NO_MAC_FILTER
+ * DPNI_OPT_HAS_POLICING
+ * DPNI_OPT_SHARED_CONGESTION
+ * DPNI_OPT_HAS_KEY_MASKING
+ * DPNI_OPT_NO_FS
+ * DPNI_OPT_STASHING_DIS
+ * @num_queues: Number of Tx and Rx queues used for traffic distribution.
+ * @num_rx_tcs: Number of RX traffic classes (TCs), reserved for the DPNI.
+ * @num_tx_tcs: Number of TX traffic classes (TCs), reserved for the DPNI.
+ * @mac_filter_entries: Number of entries in the MAC address filtering
+ * table.
+ * @vlan_filter_entries: Number of entries in the VLAN address filtering
+ * table.
+ * @qos_entries: Number of entries in the QoS classification table.
+ * @fs_entries: Number of entries in the flow steering table.
+ * @qos_key_size: Size, in bytes, of the QoS look-up key. Defining a key larger
+ * than this when adding QoS entries will result
+ * in an error.
+ * @fs_key_size: Size, in bytes, of the flow steering look-up key. Defining a
+ * key larger than this when composing the hash + FS key
+ * will result in an error.
+ * @wriop_version: Version of WRIOP HW block.
+ * The 3 version values are stored on 6, 5, 5 bits
+ * respectively.
+ * Values returned:
+ * - 0x400 - WRIOP version 1.0.0, used on LS2080 and
+ * variants,
+ * - 0x421 - WRIOP version 1.1.1, used on LS2088 and
+ * variants,
+ * - 0x422 - WRIOP version 1.1.2, used on LS1088 and
+ * variants.
+ * - 0xC00 - WRIOP version 3.0.0, used on LX2160 and
+ * variants.
*/
struct dpni_attr {
- uint32_t id;
- uint32_t options;
- uint8_t max_num_queues;
- uint8_t max_num_tcs;
- uint8_t max_mac_entries;
- uint8_t max_vlan_entries;
- uint8_t max_qos_entries;
- uint16_t max_fs_entries;
- uint8_t max_qos_key_size;
- uint8_t max_fs_key_size;
- uint16_t wriop_version;
-};
-
-/**
- * dpni_get_attributes() - Retrieve DPNI 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 DPNI object
- * @attr: Object's attributes
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dpni_get_attributes(struct fsl_mc_io *mc_io,
- uint32_t cmd_flags,
- uint16_t token,
- struct dpni_attr *attr);
-
-/**
- * dpni_extract_cfg() - extract the parameters
- * @cfg: cfg structure
- * @cfg_buf: 256 bytes of DMA-able memory
- *
- * This function has to be called after dpni_get_attributes()
- */
-int dpni_extract_cfg(struct dpni_cfg *cfg,
- const uint8_t *cfg_buf);
-
-/**
- * DPNI errors
- */
-
-/**
- * Extract out of frame header error
- */
-#define DPNI_ERROR_EOFHE 0x00020000
-/**
- * Frame length error
- */
-#define DPNI_ERROR_FLE 0x00002000
-/**
- * Frame physical error
- */
-#define DPNI_ERROR_FPE 0x00001000
-/**
- * Parsing header error
- */
-#define DPNI_ERROR_PHE 0x00000020
-/**
- * Parser L3 checksum error
- */
-#define DPNI_ERROR_L3CE 0x00000004
-/**
- * Parser L3 checksum error
- */
-#define DPNI_ERROR_L4CE 0x00000001
-
-/**
- * enum dpni_error_action - Defines DPNI behavior for errors
- * @DPNI_ERROR_ACTION_DISCARD: Discard the frame
- * @DPNI_ERROR_ACTION_CONTINUE: Continue with the normal flow
- * @DPNI_ERROR_ACTION_SEND_TO_ERROR_QUEUE: Send the frame to the error queue
- */
-enum dpni_error_action {
- DPNI_ERROR_ACTION_DISCARD = 0,
- DPNI_ERROR_ACTION_CONTINUE = 1,
- DPNI_ERROR_ACTION_SEND_TO_ERROR_QUEUE = 2
+ u32 options;
+ u8 num_queues;
+ u8 num_rx_tcs;
+ u8 num_tx_tcs;
+ u8 mac_filter_entries;
+ u8 vlan_filter_entries;
+ u8 qos_entries;
+ u16 fs_entries;
+ u16 num_opr;
+ u8 qos_key_size;
+ u8 fs_key_size;
+ u16 wriop_version;
+ u8 num_cgs;
+ u8 num_channels;
};
-/**
- * struct dpni_error_cfg - Structure representing DPNI errors treatment
- * @errors: Errors mask; use 'DPNI_ERROR__<X>
- * @error_action: The desired action for the errors mask
- * @set_frame_annotation: Set to '1' to mark the errors in frame annotation
- * status (FAS); relevant only for the non-discard action
- */
-struct dpni_error_cfg {
- uint32_t errors;
- enum dpni_error_action error_action;
- int set_frame_annotation;
-};
-
-/**
- * dpni_set_errors_behavior() - Set errors behavior
- * @mc_io: Pointer to MC portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @token: Token of DPNI object
- * @cfg: Errors configuration
- *
- * this function may be called numerous times with different
- * error masks
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dpni_set_errors_behavior(struct fsl_mc_io *mc_io,
- uint32_t cmd_flags,
- uint16_t token,
- struct dpni_error_cfg *cfg);
+int dpni_get_attributes(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token,
+ struct dpni_attr *attr);
/* DPNI buffer layout modification options */
@@ -763,93 +556,45 @@ int dpni_set_errors_behavior(struct fsl_mc_io *mc_io,
#define DPNI_BUF_LAYOUT_OPT_DATA_HEAD_ROOM 0x00000020
/*!< Select to modify the data-tail-room setting */
#define DPNI_BUF_LAYOUT_OPT_DATA_TAIL_ROOM 0x00000040
+/* Select to modify the sw-opaque value setting */
+#define DPNI_BUF_LAYOUT_OPT_SW_OPAQUE 0x00000080
+/* Select to disable Scatter Gather and use single buffer */
+#define DPNI_BUF_LAYOUT_OPT_NO_SG 0x00000100
/**
* struct dpni_buffer_layout - Structure representing DPNI buffer layout
- * @options: Flags representing the suggested modifications to the buffer
- * layout; Use any combination of 'DPNI_BUF_LAYOUT_OPT_<X>' flags
- * @pass_timestamp: Pass timestamp value
- * @pass_parser_result: Pass parser results
- * @pass_frame_status: Pass frame status
- * @private_data_size: Size kept for private data (in bytes)
- * @data_align: Data alignment
- * @data_head_room: Data head room
- * @data_tail_room: Data tail room
+ * @options: Flags representing the suggested modifications to the
+ * buffer layout;
+ * Use any combination of 'DPNI_BUF_LAYOUT_OPT_<X>' flags
+ * @pass_timestamp: Pass timestamp value
+ * @pass_parser_result: Pass parser results
+ * @pass_frame_status: Pass frame status
+ * @private_data_size: Size kept for private data (in bytes)
+ * @data_align: Data alignment
+ * @data_head_room: Data head room
+ * @data_tail_room: Data tail room
*/
struct dpni_buffer_layout {
- uint16_t options;
+ u32 options;
int pass_timestamp;
int pass_parser_result;
int pass_frame_status;
- uint16_t private_data_size;
- uint16_t data_align;
- uint16_t data_head_room;
- uint16_t data_tail_room;
+ int pass_sw_opaque;
+ u16 private_data_size;
+ u16 data_align;
+ u16 data_head_room;
+ u16 data_tail_room;
};
-/**
- * dpni_get_buffer_layout() - Retrieve buffer layout 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 DPNI object
- * @layout: Returns buffer layout attributes
- * @type: DPNI queue type
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dpni_get_buffer_layout(struct fsl_mc_io *mc_io,
- uint32_t cmd_flags,
- uint16_t token,
- const struct dpni_buffer_layout *layout,
- enum dpni_queue_type type);
-
-/**
- * dpni_set_buffer_layout() - Set buffer layout 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 DPNI object
- * @layout: Buffer layout configuration
- * @type: DPNI queue type
- *
- * Return: '0' on Success; Error code otherwise.
- *
- * @warning Allowed only when DPNI is disabled
- */
-int dpni_set_buffer_layout(struct fsl_mc_io *mc_io,
- uint32_t cmd_flags,
- uint16_t token,
- const struct dpni_buffer_layout *layout,
- enum dpni_queue_type type);
+int dpni_set_buffer_layout(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token,
+ enum dpni_queue_type qtype,
+ const struct dpni_buffer_layout *layout);
-/**
- * dpni_get_qdid() - Get the Queuing Destination ID (QDID) that should be used
- * for enqueue 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 DPNI object
- * @qdid: Returned virtual QDID value that should be used as an argument
- * in all enqueue operations
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dpni_get_qdid(struct fsl_mc_io *mc_io,
- uint32_t cmd_flags,
- uint16_t token,
- uint16_t *qdid);
+int dpni_get_qdid(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token,
+ enum dpni_queue_type qtype, u16 *qdid);
-/**
- * dpni_get_tx_data_offset() - Get the Tx data offset (from start of buffer)
- * @mc_io: Pointer to MC portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @token: Token of DPNI object
- * @data_offset: Tx data offset (from start of buffer)
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dpni_get_tx_data_offset(struct fsl_mc_io *mc_io,
- uint32_t cmd_flags,
- uint16_t token,
- uint16_t *data_offset);
+int dpni_get_tx_data_offset(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token,
+ u16 *data_offset);
/* Enable auto-negotiation */
#define DPNI_LINK_OPT_AUTONEG 0x0000000000000001ULL
@@ -864,107 +609,44 @@ int dpni_get_tx_data_offset(struct fsl_mc_io *mc_io,
* struct - Structure representing DPNI link configuration
* @rate: Rate
* @options: Mask of available options; use 'DPNI_LINK_OPT_<X>' values
+ * @advertising: Speeds that are advertised for autoneg (bitmap)
*/
struct dpni_link_cfg {
- uint32_t rate;
- uint64_t options;
+ u32 rate;
+ u64 options;
+ u64 advertising;
};
-/**
- * dpni_set_link_cfg() - set the link 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 DPNI object
- * @cfg: Link configuration
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dpni_set_link_cfg(struct fsl_mc_io *mc_io,
- uint32_t cmd_flags,
- uint16_t token,
- const struct dpni_link_cfg *cfg);
+int dpni_set_link_cfg(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token,
+ const struct dpni_link_cfg *cfg);
/**
* struct dpni_link_state - Structure representing DPNI link state
- * @rate: Rate
- * @options: Mask of available options; use 'DPNI_LINK_OPT_<X>' values
- * @up: Link state; '0' for down, '1' for up
+ * @rate: Rate
+ * @options: Mask of available options; use 'DPNI_LINK_OPT_<X>' values
+ * @up: Link state; '0' for down, '1' for up
+ * @state_valid: Ignore/Update the state of the link
+ * @supported: Speeds capability of the phy (bitmap)
+ * @advertising: Speeds that are advertised for autoneg (bitmap)
*/
struct dpni_link_state {
- uint32_t rate;
- uint64_t options;
+ u32 rate;
+ u64 options;
int up;
+ int state_valid;
+ u64 supported;
+ u64 advertising;
};
-/**
- * dpni_get_link_state() - Return the link state (either up or down)
- * @mc_io: Pointer to MC portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @token: Token of DPNI object
- * @state: Returned link state;
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dpni_get_link_state(struct fsl_mc_io *mc_io,
- uint32_t cmd_flags,
- uint16_t token,
- struct dpni_link_state *state);
+int dpni_get_link_state(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token,
+ struct dpni_link_state *state);
-/**
- * dpni_set_primary_mac_addr() - Set the primary MAC address
- * @mc_io: Pointer to MC portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @token: Token of DPNI object
- * @mac_addr: MAC address to set as primary address
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dpni_set_primary_mac_addr(struct fsl_mc_io *mc_io,
- uint32_t cmd_flags,
- uint16_t token,
- const uint8_t mac_addr[6]);
-
-/**
- * dpni_get_primary_mac_addr() - Get the primary MAC address
- * @mc_io: Pointer to MC portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @token: Token of DPNI object
- * @mac_addr: Returned MAC address
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dpni_get_primary_mac_addr(struct fsl_mc_io *mc_io,
- uint32_t cmd_flags,
- uint16_t token,
- uint8_t mac_addr[6]);
+int dpni_add_mac_addr(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token,
+ const u8 mac_addr[6], u8 flags,
+ u8 tc_id, u8 flow_id);
-/**
- * dpni_add_mac_addr() - Add MAC address filter
- * @mc_io: Pointer to MC portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @token: Token of DPNI object
- * @mac_addr: MAC address to add
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dpni_add_mac_addr(struct fsl_mc_io *mc_io,
- uint32_t cmd_flags,
- uint16_t token,
- const uint8_t mac_addr[6]);
-
-/**
- * dpni_remove_mac_addr() - Remove MAC address filter
- * @mc_io: Pointer to MC portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @token: Token of DPNI object
- * @mac_addr: MAC address to remove
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dpni_remove_mac_addr(struct fsl_mc_io *mc_io,
- uint32_t cmd_flags,
- uint16_t token,
- const uint8_t mac_addr[6]);
+int dpni_get_api_version(struct fsl_mc_io *mc_io, u32 cmd_flags,
+ u16 *major_ver, u16 *minor_ver);
/**
* enum dpni_dest - DPNI destination types
@@ -985,137 +667,6 @@ enum dpni_dest {
DPNI_DEST_DPCON = 2
};
-/**
- * struct dpni_dest_cfg - Structure representing DPNI 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 'DPNI_DEST_NONE' option
- */
-struct dpni_dest_cfg {
- enum dpni_dest dest_type;
- int dest_id;
- uint8_t priority;
-};
-
-/**
- * enum dpni_flc_type - DPNI FLC types
- * @DPNI_FLC_USER_DEFINED: select the FLC to be used for user defined value
- * @DPNI_FLC_STASH: select the FLC to be used for stash control
- */
-enum dpni_flc_type {
- DPNI_FLC_USER_DEFINED = 0,
- DPNI_FLC_STASH = 1,
-};
-
-/**
- * enum dpni_stash_size - DPNI FLC stashing size
- * @DPNI_STASH_SIZE_0B: no stash
- * @DPNI_STASH_SIZE_64B: stashes 64 bytes
- * @DPNI_STASH_SIZE_128B: stashes 128 bytes
- * @DPNI_STASH_SIZE_192B: stashes 192 bytes
- */
-enum dpni_stash_size {
- DPNI_STASH_SIZE_0B = 0,
- DPNI_STASH_SIZE_64B = 1,
- DPNI_STASH_SIZE_128B = 2,
- DPNI_STASH_SIZE_192B = 3,
-};
-
-/* DPNI FLC stash options */
-
-/* stashes the whole annotation area (up to 192 bytes) */
-#define DPNI_FLC_STASH_FRAME_ANNOTATION 0x00000001
-
-/**
- * struct dpni_flc_cfg - Structure representing DPNI FLC configuration
- * @flc_type: FLC type
- * @options: Mask of available options;
- * use 'DPNI_FLC_STASH_<X>' values
- * @frame_data_size: Size of frame data to be stashed
- * @flow_context_size: Size of flow context to be stashed
- * @flow_context: 1. In case flc_type is 'DPNI_FLC_USER_DEFINED':
- * this value will be provided in the frame descriptor
- * (FD[FLC])
- * 2. In case flc_type is 'DPNI_FLC_STASH':
- * this value will be I/O virtual address of the
- * flow-context;
- * Must be cacheline-aligned and DMA-able memory
- */
-struct dpni_flc_cfg {
- enum dpni_flc_type flc_type;
- uint32_t options;
- enum dpni_stash_size frame_data_size;
- enum dpni_stash_size flow_context_size;
- uint64_t flow_context;
-};
-
-/* DPNI queue modification options */
-
-/* Select to modify the user's context associated with the queue */
-#define DPNI_QUEUE_OPT_USER_CTX 0x00000001
-/* Select to modify the queue's destination */
-#define DPNI_QUEUE_OPT_DEST 0x00000002
-/** Select to modify the flow-context parameters;
- * not applicable for Tx-conf/Err queues as the FD comes from the user
- */
-#define DPNI_QUEUE_OPT_FLC 0x00000004
-/* Select to modify the queue's order preservation */
-#define DPNI_QUEUE_OPT_ORDER_PRESERVATION 0x00000008
-/* Select to modify the queue's tail-drop threshold */
-#define DPNI_QUEUE_OPT_TAILDROP_THRESHOLD 0x00000010
-
-/**
- * struct dpni_queue_cfg - Structure representing queue configuration
- * @options: Flags representing the suggested modifications to the queue;
- * Use any combination of 'DPNI_QUEUE_OPT_<X>' flags
- * @user_ctx: User context value provided in the frame descriptor of each
- * dequeued frame; valid only if 'DPNI_QUEUE_OPT_USER_CTX'
- * is contained in 'options'
- * @dest_cfg: Queue destination parameters;
- * valid only if 'DPNI_QUEUE_OPT_DEST' is contained in 'options'
- * @flc_cfg: Flow context configuration; in case the TC's distribution
- * is either NONE or HASH the FLC's settings of flow#0 are used.
- * in the case of FS (flow-steering) the flow's FLC settings
- * are used.
- * valid only if 'DPNI_QUEUE_OPT_FLC' is contained in 'options'
- * @order_preservation_en: enable/disable order preservation;
- * valid only if 'DPNI_QUEUE_OPT_ORDER_PRESERVATION' is contained
- * in 'options'
- * @tail_drop_threshold: set the queue's tail drop threshold in bytes;
- * '0' value disable the threshold; maximum value is 0xE000000;
- * valid only if 'DPNI_QUEUE_OPT_TAILDROP_THRESHOLD' is contained
- * in 'options'
- */
-struct dpni_queue_cfg {
- uint32_t options;
- uint64_t user_ctx;
- struct dpni_dest_cfg dest_cfg;
- struct dpni_flc_cfg flc_cfg;
- int order_preservation_en;
- uint32_t tail_drop_threshold;
-};
-
-/**
- * struct dpni_queue_attr - Structure representing queue attributes
- * @user_ctx: User context value provided in the frame descriptor of each
- * dequeued frame
- * @dest_cfg: Queue destination configuration
- * @flc_cfg: Flow context configuration
- * @order_preservation_en: enable/disable order preservation
- * @tail_drop_threshold: queue's tail drop threshold in bytes;
- * @fqid: Virtual fqid value to be used for dequeue operations
- */
-struct dpni_queue_attr {
- uint64_t user_ctx;
- struct dpni_dest_cfg dest_cfg;
- struct dpni_flc_cfg flc_cfg;
- int order_preservation_en;
- uint32_t tail_drop_threshold;
- uint32_t fqid;
-};
-
/* DPNI Tx flow modification options */
/* Select to modify the settings for dedicate Tx confirmation/error */
@@ -1126,21 +677,6 @@ struct dpni_queue_attr {
#define DPNI_TX_FLOW_OPT_L4_CHKSUM_GEN 0x00000020
/**
- * dpni_get_api_version - Retrieve DPNI Major and Minor version info.
- *
- * @mc_io: Pointer to MC portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @major_ver: DPNI major version
- * @minor_ver: DPNI minor version
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dpni_get_api_version(struct fsl_mc_io *mc_io,
- u32 cmd_flags,
- u16 *major_ver,
- u16 *minor_ver);
-
-/**
* enum dpni_confirmation_mode - Defines DPNI options supported for Tx
* confirmation
* @DPNI_CONF_AFFINE: For each Tx queue set associated with a sender there is
@@ -1149,7 +685,7 @@ int dpni_get_api_version(struct fsl_mc_io *mc_io,
* confirmation queue
* @DPNI_CONF_DISABLE: Tx frames are not confirmed. This must be associated
* with proper FD set-up to have buffers release to a Buffer Pool, otherwise
- * buffers will be leaked.
+ * buffers will be leaked
*/
enum dpni_confirmation_mode {
DPNI_CONF_AFFINE,
@@ -1157,168 +693,194 @@ enum dpni_confirmation_mode {
DPNI_CONF_DISABLE,
};
-struct dpni_tx_confirmation_mode {
- uint32_t pad;
- uint8_t confirmation_mode;
-};
+/**
+ * stashes the whole annotation area (up to 192 bytes)
+ */
+#define DPNI_FLC_STASH_FRAME_ANNOTATION 0x00000001
/**
* struct dpni_queue - Queue structure
- * @fqid: FQID used for enqueueing to and/or configuration of this specific FQ
- * @qdbin: Queueing bin, used to enqueue using QDID, DQBIN, QPRI. Only relevant
- * for Tx queues.
- * @flc: FLC value for traffic dequeued from this queue.
- * @user_context: User data, presented to the user along with any frames
- * from this queue. Not relevant for Tx queues.
+ * @destination - Destination structure
+ * @destination.id: ID of the destination, only relevant if DEST_TYPE is > 0.
+ * Identifies either a DPIO or a DPCON object.
+ * Not relevant for Tx queues.
+ * @destination.type: May be one of the following:
+ * 0 - No destination, queue can be manually
+ * queried, but will not push traffic or
+ * notifications to a DPIO;
+ * 1 - The destination is a DPIO. When traffic
+ * becomes available in the queue a FQDAN
+ * (FQ data available notification) will be
+ * generated to selected DPIO;
+ * 2 - The destination is a DPCON. The queue is
+ * associated with a DPCON object for the
+ * purpose of scheduling between multiple
+ * queues. The DPCON may be independently
+ * configured to generate notifications.
+ * Not relevant for Tx queues.
+ * @destination.hold_active: Hold active, maintains a queue scheduled for longer
+ * in a DPIO during dequeue to reduce spread of traffic.
+ * Only relevant if queues are
+ * not affined to a single DPIO.
+ * @user_context: User data, presented to the user along with any frames
+ * from this queue. Not relevant for Tx queues.
+ * @flc: FD FLow Context structure
+ * @flc.value: Default FLC value for traffic dequeued from
+ * this queue. Please check description of FD
+ * structure for more information.
+ * Note that FLC values set using dpni_add_fs_entry,
+ * if any, take precedence over values per queue.
+ * @flc.stash_control: Boolean, indicates whether the 6 lowest
+ * - significant bits are used for stash control.
+ * significant bits are used for stash control. If set, the 6
+ * least significant bits in value are interpreted as follows:
+ * - bits 0-1: indicates the number of 64 byte units of context
+ * that are stashed. FLC value is interpreted as a memory address
+ * in this case, excluding the 6 LS bits.
+ * - bits 2-3: indicates the number of 64 byte units of frame
+ * annotation to be stashed. Annotation is placed at FD[ADDR].
+ * - bits 4-5: indicates the number of 64 byte units of frame
+ * data to be stashed. Frame data is placed at FD[ADDR] +
+ * FD[OFFSET].
+ * For more details check the Frame Descriptor section in the
+ * hardware documentation.
+ *@cgid :indicate the cgid to set relative to dpni
*/
struct dpni_queue {
- /**
- * struct destination - Destination structure
- * @id: ID of the destination, only relevant if DEST_TYPE is > 0.
- * Identifies either a DPIO or a DPCON object. Not relevant for Tx
- * queues.
- * @type: May be one of the following:
- * 0 - No destination, queue can be manually queried, but won't
- * push traffic or notifications to a DPIO;
- * 1 - The destination is DPIO. When traffic becomes available in
- * the queue a FQDAN (FQ data available notification) will be
- * generated to selected DPIO;
- * 2 - The destination is a DPCON. The queue is associated with a
- * DPCON object for purpose of scheduling between multiple
- * queues. The DPCON may be independently configured to
- * generate notifications. Not relevant for Tx queues.
- * @hold_active: Hold active
- */
struct {
- uint32_t id;
+ u16 id;
enum dpni_dest type;
char hold_active;
- char stash_ctrl;
+ u8 priority;
} destination;
- uint8_t options;
- uint32_t fqid;
- uint16_t qdbin;
- uint64_t flc;
- uint64_t user_context;
+ u64 user_context;
+ struct {
+ u64 value;
+ char stash_control;
+ } flc;
+ int cgid;
};
/**
- * dpni_set_queue() - Set queue parameters
- * @mc_io: Pointer to MC portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @token: Token of DPNI object
- * @type: Type of queue
- * @tc: Traffic class, in range 0 to NUM_TCS - 1
- * @index: Selects the specific queue out of the set allocated for the same
- * TC. Value must be in range 0 to NUM_QUEUES - 1
- * @queue: Queue structure
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dpni_set_queue(struct fsl_mc_io *mc_io,
- uint32_t cmd_flags,
- uint16_t token,
- enum dpni_queue_type type,
- uint8_t tc,
- uint8_t index,
- const struct dpni_queue *queue);
-
-/**
- * dpni_get_queue() - Get queue parameters
- * @mc_io: Pointer to MC portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @token: Token of DPNI object
- * @type: Type of queue
- * @tc: Traffic class, in range 0 to NUM_TCS - 1
- * @index: Selects the specific queue out of the set allocated for the same
- * TC. Value must be in range 0 to NUM_QUEUES - 1
- * @queue: Queue structure
- *
- * Return: '0' on Success; Error code otherwise.
+ * struct dpni_queue_id - Queue identification, used for enqueue commands
+ * or queue control
+ * @fqid: FQID used for enqueueing to and/or configuration of this
+ * specific FQ
+ * @qdbin: Queueing bin, used to enqueue using QDID, DQBIN, QPRI.
+ * Only relevant for Tx queues.
*/
-int dpni_get_queue(struct fsl_mc_io *mc_io,
- uint32_t cmd_flags,
- uint16_t token,
- enum dpni_queue_type type,
- uint8_t tc,
- uint8_t index,
- struct dpni_queue *queue);
-
-/**
- * dpni_set_tx_confirmation_mode() - Set TX conf mode
- * @mc_io: Pointer to MC portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @token: Token of DPNI object
- * @mode: DPNI confirmation mode type
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dpni_set_tx_confirmation_mode(struct fsl_mc_io *mc_io,
- uint32_t cmd_flags,
- uint16_t token,
- enum dpni_confirmation_mode mode);
-struct dpni_statistics {
- /**
- * Page_0 statistics structure
- * @ingress_all_frames: Ingress frame count
- * @ingress_all_bytes: Ingress byte count
- * @ingress_multicast_frames: Ingress multicast frame count
- * @ingress_multicast_bytes: Ingress multicast byte count
- * @ingress_broadcast_frames: Ingress broadcast frame count
- * @ingress_broadcast_bytes: Ingress broadcast byte count
- *
- * Page_1 statistics structure
- * @egress_all_frames: Egress frame count
- * @egress_all_bytes: Egress byte count
- * @egress_multicast_frames: Egress multicast frame count
- * @egress_multicast_bytes: Egress multicast byte count
- * @egress_broadcast_frames: Egress broadcast frame count
- * @egress_broadcast_bytes: Egress broadcast byte count
- *
- * Page_2 statistics structure
- * @ingress_filtered_frames: Ingress filtered frame count
- * @ingress_discarded_frames: Ingress discarded frame count
- * @ingress_nobuffer_discards: Ingress discarded frame count due to
- * lack of buffers.
- * @egress_discarded_frames: Egress discarded frame count
- * @egress_confirmed_frames: Egress confirmed frame count
- */
-
- uint64_t counter0;
- uint64_t counter1;
- uint64_t counter2;
- uint64_t counter3;
- uint64_t counter4;
- uint64_t counter5;
- uint64_t counter6;
+struct dpni_queue_id {
+ u32 fqid;
+ u16 qdbin;
};
-/**
- * dpni_get_statistics() - Get DPNI statistics
- * @mc_io: Pointer to MC portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @token: Token of DPNI object
- * @page: Selects the statistics page to retrieve, see DPNI_GET_STATISTICS
- * output. Pages are numbered 0 to 2.
- * @stat: Structure containing the statistics
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dpni_get_statistics(struct fsl_mc_io *mc_io,
- uint32_t cmd_flags,
- uint16_t token,
- uint8_t page,
- struct dpni_statistics *stat);
+int dpni_set_queue(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token,
+ enum dpni_queue_type qtype, u16 param, u8 index,
+ u8 options, const struct dpni_queue *queue);
+
+int dpni_get_queue(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token,
+ enum dpni_queue_type qtype, u16 param, u8 index,
+ struct dpni_queue *queue, struct dpni_queue_id *qid);
+
+int dpni_set_tx_confirmation_mode(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token,
+ u8 ceetm_ch_idx, enum dpni_confirmation_mode mode);
+
+#define DPNI_STATISTICS_CNT 7
+
+/**
+ * union dpni_statistics - Union describing the DPNI statistics
+ * @page_0: Page_0 statistics structure
+ * @page_0.ingress_all_frames: Ingress frame count
+ * @page_0.ingress_all_bytes: Ingress byte count
+ * @page_0.ingress_multicast_frames: Ingress multicast frame count
+ * @page_0.ingress_multicast_bytes: Ingress multicast byte count
+ * @page_0.ingress_broadcast_frames: Ingress broadcast frame count
+ * @page_0.ingress_broadcast_bytes: Ingress broadcast byte count
+ * @page_1: Page_1 statistics structure
+ * @page_1.egress_all_frames: Egress frame count
+ * @page_1.egress_all_bytes: Egress byte count
+ * @page_1.egress_multicast_frames: Egress multicast frame count
+ * @page_1.egress_multicast_bytes: Egress multicast byte count
+ * @page_1.egress_broadcast_frames: Egress broadcast frame count
+ * @page_1.egress_broadcast_bytes: Egress broadcast byte count
+ * @page_2: Page_2 statistics structure
+ * @page_2.ingress_filtered_frames: Ingress filtered frame count
+ * @page_2.ingress_discarded_frames: Ingress discarded frame count
+ * @page_2.ingress_nobuffer_discards: Ingress discarded frame count due to
+ * lack of buffers
+ * @page_2.egress_discarded_frames: Egress discarded frame count
+ * @page_2.egress_confirmed_frames: Egress confirmed frame count
+ * @page_3: Page_3 statistics structure
+ * @page_3.egress_dequeue_bytes: Cumulative count of the number of bytes
+ * dequeued from egress FQs
+ * @page_3.egress_dequeue_frames: Cumulative count of the number of frames
+ * dequeued from egress FQs
+ * @page_3.egress_reject_bytes: Cumulative count of the number of bytes in
+ * egress frames whose enqueue was rejected
+ * @page_3.egress_reject_frames: Cumulative count of the number of egress
+ * frames whose enqueue was rejected
+ * @page_4: Page_4 statistics structure: congestion points
+ * @page_4.cgr_reject_frames: number of rejected frames due to congestion point
+ * @page_4.cgr_reject_bytes: number of rejected bytes due to congestion point
+ * @page_5: Page_5 statistics structure: policer
+ * @page_5.policer_cnt_red: NUmber of red colored frames
+ * @page_5.policer_cnt_yellow: number of yellow colored frames
+ * @page_5.policer_cnt_green: number of green colored frames
+ * @page_5.policer_cnt_re_red: number of recolored red frames
+ * @page_5.policer_cnt_re_yellow: number of recolored yellow frames
+ * @page_6: Page_6 statistics structure
+ * @page_6.tx_pending_frames: total number of frames pending in egress FQs
+ * @raw: raw statistics structure, used to index counters
+ */
+union dpni_statistics {
+ struct {
+ u64 ingress_all_frames;
+ u64 ingress_all_bytes;
+ u64 ingress_multicast_frames;
+ u64 ingress_multicast_bytes;
+ u64 ingress_broadcast_frames;
+ u64 ingress_broadcast_bytes;
+ } page_0;
+ struct {
+ u64 egress_all_frames;
+ u64 egress_all_bytes;
+ u64 egress_multicast_frames;
+ u64 egress_multicast_bytes;
+ u64 egress_broadcast_frames;
+ u64 egress_broadcast_bytes;
+ } page_1;
+ struct {
+ u64 ingress_filtered_frames;
+ u64 ingress_discarded_frames;
+ u64 ingress_nobuffer_discards;
+ u64 egress_discarded_frames;
+ u64 egress_confirmed_frames;
+ } page_2;
+ struct {
+ u64 egress_dequeue_bytes;
+ u64 egress_dequeue_frames;
+ u64 egress_reject_bytes;
+ u64 egress_reject_frames;
+ } page_3;
+ struct {
+ u64 cgr_reject_frames;
+ u64 cgr_reject_bytes;
+ } page_4;
+ struct {
+ u64 policer_cnt_red;
+ u64 policer_cnt_yellow;
+ u64 policer_cnt_green;
+ u64 policer_cnt_re_red;
+ u64 policer_cnt_re_yellow;
+ } page_5;
+ struct {
+ u64 tx_pending_frames;
+ } page_6;
+ struct {
+ u64 counter[DPNI_STATISTICS_CNT];
+ } raw;
+};
-/**
- * dpni_reset_statistics() - Clears DPNI statistics
- * @mc_io: Pointer to MC portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @token: Token of DPNI object
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dpni_reset_statistics(struct fsl_mc_io *mc_io,
- uint32_t cmd_flags,
- uint16_t token);
+int dpni_get_statistics(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token,
+ u8 page, u16 param, union dpni_statistics *stat);
#endif /* _FSL_DPNI_H */
diff --git a/include/fsl-mc/fsl_dprc.h b/include/fsl-mc/fsl_dprc.h
index 950ecb0756..fb95ac544a 100644
--- a/include/fsl-mc/fsl_dprc.h
+++ b/include/fsl-mc/fsl_dprc.h
@@ -3,7 +3,7 @@
* Freescale Layerscape MC I/O wrapper
*
* Copyright 2013-2016 Freescale Semiconductor, Inc.
- * Copyright 2017 NXP
+ * Copyright 2017, 2023 NXP
*/
#ifndef _FSL_DPRC_H
#define _FSL_DPRC_H
@@ -15,442 +15,82 @@
/* Command IDs */
#define DPRC_CMDID_CLOSE 0x8001
#define DPRC_CMDID_OPEN 0x8051
-#define DPRC_CMDID_CREATE 0x9051
-#define DPRC_CMDID_GET_ATTR 0x0041
-#define DPRC_CMDID_RESET_CONT 0x0051
#define DPRC_CMDID_GET_API_VERSION 0xa051
#define DPRC_CMDID_CREATE_CONT 0x1511
#define DPRC_CMDID_DESTROY_CONT 0x1521
#define DPRC_CMDID_GET_CONT_ID 0x8301
-#define DPRC_CMDID_GET_OBJ_COUNT 0x1591
-#define DPRC_CMDID_GET_OBJ 0x15A1
-#define DPRC_CMDID_GET_RES_COUNT 0x15B1
-#define DPRC_CMDID_GET_RES_IDS 0x15C1
-#define DPRC_CMDID_GET_OBJ_REG 0x15E1
#define DPRC_CMDID_CONNECT 0x1671
#define DPRC_CMDID_DISCONNECT 0x1681
#define DPRC_CMDID_GET_CONNECTION 0x16C1
-/* cmd, param, offset, width, type, arg_name */
-#define DPRC_RSP_GET_CONTAINER_ID(cmd, container_id) \
- MC_RSP_OP(cmd, 0, 0, 32, int, container_id)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPRC_CMD_OPEN(cmd, container_id) \
- MC_CMD_OP(cmd, 0, 0, 32, int, container_id)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPRC_CMD_CREATE_CONTAINER(cmd, cfg) \
-do { \
- MC_CMD_OP(cmd, 0, 32, 16, uint16_t, cfg->icid); \
- MC_CMD_OP(cmd, 0, 0, 32, uint32_t, cfg->options); \
- MC_CMD_OP(cmd, 1, 32, 32, int, cfg->portal_id); \
- MC_CMD_OP(cmd, 2, 0, 8, char, cfg->label[0]);\
- MC_CMD_OP(cmd, 2, 8, 8, char, cfg->label[1]);\
- MC_CMD_OP(cmd, 2, 16, 8, char, cfg->label[2]);\
- MC_CMD_OP(cmd, 2, 24, 8, char, cfg->label[3]);\
- MC_CMD_OP(cmd, 2, 32, 8, char, cfg->label[4]);\
- MC_CMD_OP(cmd, 2, 40, 8, char, cfg->label[5]);\
- MC_CMD_OP(cmd, 2, 48, 8, char, cfg->label[6]);\
- MC_CMD_OP(cmd, 2, 56, 8, char, cfg->label[7]);\
- MC_CMD_OP(cmd, 3, 0, 8, char, cfg->label[8]);\
- MC_CMD_OP(cmd, 3, 8, 8, char, cfg->label[9]);\
- MC_CMD_OP(cmd, 3, 16, 8, char, cfg->label[10]);\
- MC_CMD_OP(cmd, 3, 24, 8, char, cfg->label[11]);\
- MC_CMD_OP(cmd, 3, 32, 8, char, cfg->label[12]);\
- MC_CMD_OP(cmd, 3, 40, 8, char, cfg->label[13]);\
- MC_CMD_OP(cmd, 3, 48, 8, char, cfg->label[14]);\
- MC_CMD_OP(cmd, 3, 56, 8, char, cfg->label[15]);\
-} while (0)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPRC_RSP_CREATE_CONTAINER(cmd, child_container_id, child_portal_offset)\
-do { \
- MC_RSP_OP(cmd, 1, 0, 32, int, child_container_id); \
- MC_RSP_OP(cmd, 2, 0, 64, uint64_t, child_portal_offset);\
-} while (0)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPRC_CMD_DESTROY_CONTAINER(cmd, child_container_id) \
- MC_CMD_OP(cmd, 0, 0, 32, int, child_container_id)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPRC_CMD_RESET_CONTAINER(cmd, child_container_id) \
- MC_CMD_OP(cmd, 0, 0, 32, int, child_container_id)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPRC_RSP_GET_ATTRIBUTES(cmd, attr) \
-do { \
- MC_RSP_OP(cmd, 0, 0, 32, int, attr->container_id); \
- MC_RSP_OP(cmd, 0, 32, 16, uint16_t, attr->icid); \
- MC_RSP_OP(cmd, 1, 0, 32, uint32_t, attr->options);\
- MC_RSP_OP(cmd, 1, 32, 32, int, attr->portal_id); \
-} while (0)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPRC_RSP_GET_OBJ_COUNT(cmd, obj_count) \
- MC_RSP_OP(cmd, 0, 32, 32, int, obj_count)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPRC_CMD_GET_OBJ(cmd, obj_index) \
- MC_CMD_OP(cmd, 0, 0, 32, int, obj_index)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPRC_RSP_GET_OBJ(cmd, obj_desc) \
-do { \
- MC_RSP_OP(cmd, 0, 32, 32, int, obj_desc->id); \
- MC_RSP_OP(cmd, 1, 0, 16, uint16_t, obj_desc->vendor); \
- MC_RSP_OP(cmd, 1, 16, 8, uint8_t, obj_desc->irq_count); \
- MC_RSP_OP(cmd, 1, 24, 8, uint8_t, obj_desc->region_count); \
- MC_RSP_OP(cmd, 1, 32, 32, uint32_t, obj_desc->state);\
- MC_RSP_OP(cmd, 2, 0, 16, uint16_t, obj_desc->ver_major);\
- MC_RSP_OP(cmd, 2, 16, 16, uint16_t, obj_desc->ver_minor);\
- MC_RSP_OP(cmd, 2, 32, 16, uint16_t, obj_desc->flags); \
- MC_RSP_OP(cmd, 3, 0, 8, char, obj_desc->type[0]);\
- MC_RSP_OP(cmd, 3, 8, 8, char, obj_desc->type[1]);\
- MC_RSP_OP(cmd, 3, 16, 8, char, obj_desc->type[2]);\
- MC_RSP_OP(cmd, 3, 24, 8, char, obj_desc->type[3]);\
- MC_RSP_OP(cmd, 3, 32, 8, char, obj_desc->type[4]);\
- MC_RSP_OP(cmd, 3, 40, 8, char, obj_desc->type[5]);\
- MC_RSP_OP(cmd, 3, 48, 8, char, obj_desc->type[6]);\
- MC_RSP_OP(cmd, 3, 56, 8, char, obj_desc->type[7]);\
- MC_RSP_OP(cmd, 4, 0, 8, char, obj_desc->type[8]);\
- MC_RSP_OP(cmd, 4, 8, 8, char, obj_desc->type[9]);\
- MC_RSP_OP(cmd, 4, 16, 8, char, obj_desc->type[10]);\
- MC_RSP_OP(cmd, 4, 24, 8, char, obj_desc->type[11]);\
- MC_RSP_OP(cmd, 4, 32, 8, char, obj_desc->type[12]);\
- MC_RSP_OP(cmd, 4, 40, 8, char, obj_desc->type[13]);\
- MC_RSP_OP(cmd, 4, 48, 8, char, obj_desc->type[14]);\
- MC_RSP_OP(cmd, 4, 56, 8, char, obj_desc->type[15]);\
- MC_RSP_OP(cmd, 5, 0, 8, char, obj_desc->label[0]);\
- MC_RSP_OP(cmd, 5, 8, 8, char, obj_desc->label[1]);\
- MC_RSP_OP(cmd, 5, 16, 8, char, obj_desc->label[2]);\
- MC_RSP_OP(cmd, 5, 24, 8, char, obj_desc->label[3]);\
- MC_RSP_OP(cmd, 5, 32, 8, char, obj_desc->label[4]);\
- MC_RSP_OP(cmd, 5, 40, 8, char, obj_desc->label[5]);\
- MC_RSP_OP(cmd, 5, 48, 8, char, obj_desc->label[6]);\
- MC_RSP_OP(cmd, 5, 56, 8, char, obj_desc->label[7]);\
- MC_RSP_OP(cmd, 6, 0, 8, char, obj_desc->label[8]);\
- MC_RSP_OP(cmd, 6, 8, 8, char, obj_desc->label[9]);\
- MC_RSP_OP(cmd, 6, 16, 8, char, obj_desc->label[10]);\
- MC_RSP_OP(cmd, 6, 24, 8, char, obj_desc->label[11]);\
- MC_RSP_OP(cmd, 6, 32, 8, char, obj_desc->label[12]);\
- MC_RSP_OP(cmd, 6, 40, 8, char, obj_desc->label[13]);\
- MC_RSP_OP(cmd, 6, 48, 8, char, obj_desc->label[14]);\
- MC_RSP_OP(cmd, 6, 56, 8, char, obj_desc->label[15]);\
-} while (0)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPRC_CMD_GET_OBJ_DESC(cmd, obj_type, obj_id) \
-do { \
- MC_CMD_OP(cmd, 0, 0, 32, int, obj_id);\
- MC_CMD_OP(cmd, 1, 0, 8, char, obj_type[0]);\
- MC_CMD_OP(cmd, 1, 8, 8, char, obj_type[1]);\
- MC_CMD_OP(cmd, 1, 16, 8, char, obj_type[2]);\
- MC_CMD_OP(cmd, 1, 24, 8, char, obj_type[3]);\
- MC_CMD_OP(cmd, 1, 32, 8, char, obj_type[4]);\
- MC_CMD_OP(cmd, 1, 40, 8, char, obj_type[5]);\
- MC_CMD_OP(cmd, 1, 48, 8, char, obj_type[6]);\
- MC_CMD_OP(cmd, 1, 56, 8, char, obj_type[7]);\
- MC_CMD_OP(cmd, 2, 0, 8, char, obj_type[8]);\
- MC_CMD_OP(cmd, 2, 8, 8, char, obj_type[9]);\
- MC_CMD_OP(cmd, 2, 16, 8, char, obj_type[10]);\
- MC_CMD_OP(cmd, 2, 24, 8, char, obj_type[11]);\
- MC_CMD_OP(cmd, 2, 32, 8, char, obj_type[12]);\
- MC_CMD_OP(cmd, 2, 40, 8, char, obj_type[13]);\
- MC_CMD_OP(cmd, 2, 48, 8, char, obj_type[14]);\
- MC_CMD_OP(cmd, 2, 56, 8, char, obj_type[15]);\
-} while (0)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPRC_RSP_GET_OBJ_DESC(cmd, obj_desc) \
-do { \
- MC_RSP_OP(cmd, 0, 32, 32, int, obj_desc->id); \
- MC_RSP_OP(cmd, 1, 0, 16, uint16_t, obj_desc->vendor); \
- MC_RSP_OP(cmd, 1, 16, 8, uint8_t, obj_desc->irq_count); \
- MC_RSP_OP(cmd, 1, 24, 8, uint8_t, obj_desc->region_count); \
- MC_RSP_OP(cmd, 1, 32, 32, uint32_t, obj_desc->state);\
- MC_RSP_OP(cmd, 2, 0, 16, uint16_t, obj_desc->ver_major);\
- MC_RSP_OP(cmd, 2, 16, 16, uint16_t, obj_desc->ver_minor);\
- MC_RSP_OP(cmd, 2, 32, 16, uint16_t, obj_desc->flags); \
- MC_RSP_OP(cmd, 3, 0, 8, char, obj_desc->type[0]);\
- MC_RSP_OP(cmd, 3, 8, 8, char, obj_desc->type[1]);\
- MC_RSP_OP(cmd, 3, 16, 8, char, obj_desc->type[2]);\
- MC_RSP_OP(cmd, 3, 24, 8, char, obj_desc->type[3]);\
- MC_RSP_OP(cmd, 3, 32, 8, char, obj_desc->type[4]);\
- MC_RSP_OP(cmd, 3, 40, 8, char, obj_desc->type[5]);\
- MC_RSP_OP(cmd, 3, 48, 8, char, obj_desc->type[6]);\
- MC_RSP_OP(cmd, 3, 56, 8, char, obj_desc->type[7]);\
- MC_RSP_OP(cmd, 4, 0, 8, char, obj_desc->type[8]);\
- MC_RSP_OP(cmd, 4, 8, 8, char, obj_desc->type[9]);\
- MC_RSP_OP(cmd, 4, 16, 8, char, obj_desc->type[10]);\
- MC_RSP_OP(cmd, 4, 24, 8, char, obj_desc->type[11]);\
- MC_RSP_OP(cmd, 4, 32, 8, char, obj_desc->type[12]);\
- MC_RSP_OP(cmd, 4, 40, 8, char, obj_desc->type[13]);\
- MC_RSP_OP(cmd, 4, 48, 8, char, obj_desc->type[14]);\
- MC_RSP_OP(cmd, 4, 56, 8, char, obj_desc->type[15]);\
- MC_RSP_OP(cmd, 5, 0, 8, char, obj_desc->label[0]);\
- MC_RSP_OP(cmd, 5, 8, 8, char, obj_desc->label[1]);\
- MC_RSP_OP(cmd, 5, 16, 8, char, obj_desc->label[2]);\
- MC_RSP_OP(cmd, 5, 24, 8, char, obj_desc->label[3]);\
- MC_RSP_OP(cmd, 5, 32, 8, char, obj_desc->label[4]);\
- MC_RSP_OP(cmd, 5, 40, 8, char, obj_desc->label[5]);\
- MC_RSP_OP(cmd, 5, 48, 8, char, obj_desc->label[6]);\
- MC_RSP_OP(cmd, 5, 56, 8, char, obj_desc->label[7]);\
- MC_RSP_OP(cmd, 6, 0, 8, char, obj_desc->label[8]);\
- MC_RSP_OP(cmd, 6, 8, 8, char, obj_desc->label[9]);\
- MC_RSP_OP(cmd, 6, 16, 8, char, obj_desc->label[10]);\
- MC_RSP_OP(cmd, 6, 24, 8, char, obj_desc->label[11]);\
- MC_RSP_OP(cmd, 6, 32, 8, char, obj_desc->label[12]);\
- MC_RSP_OP(cmd, 6, 40, 8, char, obj_desc->label[13]);\
- MC_RSP_OP(cmd, 6, 48, 8, char, obj_desc->label[14]);\
- MC_RSP_OP(cmd, 6, 56, 8, char, obj_desc->label[15]);\
-} while (0)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPRC_CMD_GET_RES_COUNT(cmd, type) \
-do { \
- MC_CMD_OP(cmd, 1, 0, 8, char, type[0]);\
- MC_CMD_OP(cmd, 1, 8, 8, char, type[1]);\
- MC_CMD_OP(cmd, 1, 16, 8, char, type[2]);\
- MC_CMD_OP(cmd, 1, 24, 8, char, type[3]);\
- MC_CMD_OP(cmd, 1, 32, 8, char, type[4]);\
- MC_CMD_OP(cmd, 1, 40, 8, char, type[5]);\
- MC_CMD_OP(cmd, 1, 48, 8, char, type[6]);\
- MC_CMD_OP(cmd, 1, 56, 8, char, type[7]);\
- MC_CMD_OP(cmd, 2, 0, 8, char, type[8]);\
- MC_CMD_OP(cmd, 2, 8, 8, char, type[9]);\
- MC_CMD_OP(cmd, 2, 16, 8, char, type[10]);\
- MC_CMD_OP(cmd, 2, 24, 8, char, type[11]);\
- MC_CMD_OP(cmd, 2, 32, 8, char, type[12]);\
- MC_CMD_OP(cmd, 2, 40, 8, char, type[13]);\
- MC_CMD_OP(cmd, 2, 48, 8, char, type[14]);\
- MC_CMD_OP(cmd, 2, 56, 8, char, type[15]);\
-} while (0)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPRC_RSP_GET_RES_COUNT(cmd, res_count) \
- MC_RSP_OP(cmd, 0, 0, 32, int, res_count)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPRC_CMD_GET_RES_IDS(cmd, range_desc, type) \
-do { \
- MC_CMD_OP(cmd, 0, 42, 7, enum dprc_iter_status, \
- range_desc->iter_status); \
- MC_CMD_OP(cmd, 1, 0, 32, int, range_desc->base_id); \
- MC_CMD_OP(cmd, 1, 32, 32, int, range_desc->last_id);\
- MC_CMD_OP(cmd, 2, 0, 8, char, type[0]);\
- MC_CMD_OP(cmd, 2, 8, 8, char, type[1]);\
- MC_CMD_OP(cmd, 2, 16, 8, char, type[2]);\
- MC_CMD_OP(cmd, 2, 24, 8, char, type[3]);\
- MC_CMD_OP(cmd, 2, 32, 8, char, type[4]);\
- MC_CMD_OP(cmd, 2, 40, 8, char, type[5]);\
- MC_CMD_OP(cmd, 2, 48, 8, char, type[6]);\
- MC_CMD_OP(cmd, 2, 56, 8, char, type[7]);\
- MC_CMD_OP(cmd, 3, 0, 8, char, type[8]);\
- MC_CMD_OP(cmd, 3, 8, 8, char, type[9]);\
- MC_CMD_OP(cmd, 3, 16, 8, char, type[10]);\
- MC_CMD_OP(cmd, 3, 24, 8, char, type[11]);\
- MC_CMD_OP(cmd, 3, 32, 8, char, type[12]);\
- MC_CMD_OP(cmd, 3, 40, 8, char, type[13]);\
- MC_CMD_OP(cmd, 3, 48, 8, char, type[14]);\
- MC_CMD_OP(cmd, 3, 56, 8, char, type[15]);\
-} while (0)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPRC_RSP_GET_RES_IDS(cmd, range_desc) \
-do { \
- MC_RSP_OP(cmd, 0, 42, 7, enum dprc_iter_status, \
- range_desc->iter_status);\
- MC_RSP_OP(cmd, 1, 0, 32, int, range_desc->base_id); \
- MC_RSP_OP(cmd, 1, 32, 32, int, range_desc->last_id);\
-} while (0)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPRC_CMD_GET_OBJ_REGION(cmd, obj_type, obj_id, region_index) \
-do { \
- MC_CMD_OP(cmd, 0, 0, 32, int, obj_id); \
- MC_CMD_OP(cmd, 0, 48, 8, uint8_t, region_index);\
- MC_CMD_OP(cmd, 3, 0, 8, char, obj_type[0]);\
- MC_CMD_OP(cmd, 3, 8, 8, char, obj_type[1]);\
- MC_CMD_OP(cmd, 3, 16, 8, char, obj_type[2]);\
- MC_CMD_OP(cmd, 3, 24, 8, char, obj_type[3]);\
- MC_CMD_OP(cmd, 3, 32, 8, char, obj_type[4]);\
- MC_CMD_OP(cmd, 3, 40, 8, char, obj_type[5]);\
- MC_CMD_OP(cmd, 3, 48, 8, char, obj_type[6]);\
- MC_CMD_OP(cmd, 3, 56, 8, char, obj_type[7]);\
- MC_CMD_OP(cmd, 4, 0, 8, char, obj_type[8]);\
- MC_CMD_OP(cmd, 4, 8, 8, char, obj_type[9]);\
- MC_CMD_OP(cmd, 4, 16, 8, char, obj_type[10]);\
- MC_CMD_OP(cmd, 4, 24, 8, char, obj_type[11]);\
- MC_CMD_OP(cmd, 4, 32, 8, char, obj_type[12]);\
- MC_CMD_OP(cmd, 4, 40, 8, char, obj_type[13]);\
- MC_CMD_OP(cmd, 4, 48, 8, char, obj_type[14]);\
- MC_CMD_OP(cmd, 4, 56, 8, char, obj_type[15]);\
-} while (0)
-
-/* param, offset, width, type, arg_name */
-#define DPRC_RSP_GET_OBJ_REGION(cmd, region_desc) \
-do { \
- MC_RSP_OP(cmd, 1, 0, 32, uint32_t, region_desc->base_offset);\
- MC_RSP_OP(cmd, 2, 0, 32, uint32_t, region_desc->size); \
- MC_RSP_OP(cmd, 2, 32, 4, enum dprc_region_type, region_desc->type);\
- MC_RSP_OP(cmd, 3, 0, 32, uint32_t, region_desc->flags);\
-} while (0)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPRC_CMD_SET_OBJ_LABEL(cmd, obj_type, obj_id, label) \
-do { \
- MC_CMD_OP(cmd, 0, 0, 32, int, obj_id); \
- MC_CMD_OP(cmd, 1, 0, 8, char, label[0]);\
- MC_CMD_OP(cmd, 1, 8, 8, char, label[1]);\
- MC_CMD_OP(cmd, 1, 16, 8, char, label[2]);\
- MC_CMD_OP(cmd, 1, 24, 8, char, label[3]);\
- MC_CMD_OP(cmd, 1, 32, 8, char, label[4]);\
- MC_CMD_OP(cmd, 1, 40, 8, char, label[5]);\
- MC_CMD_OP(cmd, 1, 48, 8, char, label[6]);\
- MC_CMD_OP(cmd, 1, 56, 8, char, label[7]);\
- MC_CMD_OP(cmd, 2, 0, 8, char, label[8]);\
- MC_CMD_OP(cmd, 2, 8, 8, char, label[9]);\
- MC_CMD_OP(cmd, 2, 16, 8, char, label[10]);\
- MC_CMD_OP(cmd, 2, 24, 8, char, label[11]);\
- MC_CMD_OP(cmd, 2, 32, 8, char, label[12]);\
- MC_CMD_OP(cmd, 2, 40, 8, char, label[13]);\
- MC_CMD_OP(cmd, 2, 48, 8, char, label[14]);\
- MC_CMD_OP(cmd, 2, 56, 8, char, label[15]);\
- MC_CMD_OP(cmd, 3, 0, 8, char, obj_type[0]);\
- MC_CMD_OP(cmd, 3, 8, 8, char, obj_type[1]);\
- MC_CMD_OP(cmd, 3, 16, 8, char, obj_type[2]);\
- MC_CMD_OP(cmd, 3, 24, 8, char, obj_type[3]);\
- MC_CMD_OP(cmd, 3, 32, 8, char, obj_type[4]);\
- MC_CMD_OP(cmd, 3, 40, 8, char, obj_type[5]);\
- MC_CMD_OP(cmd, 3, 48, 8, char, obj_type[6]);\
- MC_CMD_OP(cmd, 3, 56, 8, char, obj_type[7]);\
- MC_CMD_OP(cmd, 4, 0, 8, char, obj_type[8]);\
- MC_CMD_OP(cmd, 4, 8, 8, char, obj_type[9]);\
- MC_CMD_OP(cmd, 4, 16, 8, char, obj_type[10]);\
- MC_CMD_OP(cmd, 4, 24, 8, char, obj_type[11]);\
- MC_CMD_OP(cmd, 4, 32, 8, char, obj_type[12]);\
- MC_CMD_OP(cmd, 4, 40, 8, char, obj_type[13]);\
- MC_CMD_OP(cmd, 4, 48, 8, char, obj_type[14]);\
- MC_CMD_OP(cmd, 4, 56, 8, char, obj_type[15]);\
-} while (0)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPRC_CMD_CONNECT(cmd, endpoint1, endpoint2, cfg) \
-do { \
- MC_CMD_OP(cmd, 0, 0, 32, int, endpoint1->id); \
- MC_CMD_OP(cmd, 0, 32, 32, int, endpoint1->if_id); \
- MC_CMD_OP(cmd, 1, 0, 32, int, endpoint2->id); \
- MC_CMD_OP(cmd, 1, 32, 32, int, endpoint2->if_id); \
- MC_CMD_OP(cmd, 2, 0, 8, char, endpoint1->type[0]); \
- MC_CMD_OP(cmd, 2, 8, 8, char, endpoint1->type[1]); \
- MC_CMD_OP(cmd, 2, 16, 8, char, endpoint1->type[2]); \
- MC_CMD_OP(cmd, 2, 24, 8, char, endpoint1->type[3]); \
- MC_CMD_OP(cmd, 2, 32, 8, char, endpoint1->type[4]); \
- MC_CMD_OP(cmd, 2, 40, 8, char, endpoint1->type[5]); \
- MC_CMD_OP(cmd, 2, 48, 8, char, endpoint1->type[6]); \
- MC_CMD_OP(cmd, 2, 56, 8, char, endpoint1->type[7]); \
- MC_CMD_OP(cmd, 3, 0, 8, char, endpoint1->type[8]); \
- MC_CMD_OP(cmd, 3, 8, 8, char, endpoint1->type[9]); \
- MC_CMD_OP(cmd, 3, 16, 8, char, endpoint1->type[10]); \
- MC_CMD_OP(cmd, 3, 24, 8, char, endpoint1->type[11]); \
- MC_CMD_OP(cmd, 3, 32, 8, char, endpoint1->type[12]); \
- MC_CMD_OP(cmd, 3, 40, 8, char, endpoint1->type[13]); \
- MC_CMD_OP(cmd, 3, 48, 8, char, endpoint1->type[14]); \
- MC_CMD_OP(cmd, 3, 56, 8, char, endpoint1->type[15]); \
- MC_CMD_OP(cmd, 4, 0, 32, uint32_t, cfg->max_rate); \
- MC_CMD_OP(cmd, 4, 32, 32, uint32_t, cfg->committed_rate); \
- MC_CMD_OP(cmd, 5, 0, 8, char, endpoint2->type[0]); \
- MC_CMD_OP(cmd, 5, 8, 8, char, endpoint2->type[1]); \
- MC_CMD_OP(cmd, 5, 16, 8, char, endpoint2->type[2]); \
- MC_CMD_OP(cmd, 5, 24, 8, char, endpoint2->type[3]); \
- MC_CMD_OP(cmd, 5, 32, 8, char, endpoint2->type[4]); \
- MC_CMD_OP(cmd, 5, 40, 8, char, endpoint2->type[5]); \
- MC_CMD_OP(cmd, 5, 48, 8, char, endpoint2->type[6]); \
- MC_CMD_OP(cmd, 5, 56, 8, char, endpoint2->type[7]); \
- MC_CMD_OP(cmd, 6, 0, 8, char, endpoint2->type[8]); \
- MC_CMD_OP(cmd, 6, 8, 8, char, endpoint2->type[9]); \
- MC_CMD_OP(cmd, 6, 16, 8, char, endpoint2->type[10]); \
- MC_CMD_OP(cmd, 6, 24, 8, char, endpoint2->type[11]); \
- MC_CMD_OP(cmd, 6, 32, 8, char, endpoint2->type[12]); \
- MC_CMD_OP(cmd, 6, 40, 8, char, endpoint2->type[13]); \
- MC_CMD_OP(cmd, 6, 48, 8, char, endpoint2->type[14]); \
- MC_CMD_OP(cmd, 6, 56, 8, char, endpoint2->type[15]); \
-} while (0)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPRC_CMD_DISCONNECT(cmd, endpoint) \
-do { \
- MC_CMD_OP(cmd, 0, 0, 32, int, endpoint->id); \
- MC_CMD_OP(cmd, 0, 32, 16, uint16_t, endpoint->if_id); \
- MC_CMD_OP(cmd, 1, 0, 8, char, endpoint->type[0]); \
- MC_CMD_OP(cmd, 1, 8, 8, char, endpoint->type[1]); \
- MC_CMD_OP(cmd, 1, 16, 8, char, endpoint->type[2]); \
- MC_CMD_OP(cmd, 1, 24, 8, char, endpoint->type[3]); \
- MC_CMD_OP(cmd, 1, 32, 8, char, endpoint->type[4]); \
- MC_CMD_OP(cmd, 1, 40, 8, char, endpoint->type[5]); \
- MC_CMD_OP(cmd, 1, 48, 8, char, endpoint->type[6]); \
- MC_CMD_OP(cmd, 1, 56, 8, char, endpoint->type[7]); \
- MC_CMD_OP(cmd, 2, 0, 8, char, endpoint->type[8]); \
- MC_CMD_OP(cmd, 2, 8, 8, char, endpoint->type[9]); \
- MC_CMD_OP(cmd, 2, 16, 8, char, endpoint->type[10]); \
- MC_CMD_OP(cmd, 2, 24, 8, char, endpoint->type[11]); \
- MC_CMD_OP(cmd, 2, 32, 8, char, endpoint->type[12]); \
- MC_CMD_OP(cmd, 2, 40, 8, char, endpoint->type[13]); \
- MC_CMD_OP(cmd, 2, 48, 8, char, endpoint->type[14]); \
- MC_CMD_OP(cmd, 2, 56, 8, char, endpoint->type[15]); \
-} while (0)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPRC_CMD_GET_CONNECTION(cmd, endpoint1) \
-do { \
- MC_CMD_OP(cmd, 0, 0, 32, int, endpoint1->id); \
- MC_CMD_OP(cmd, 0, 32, 32, int, endpoint1->if_id); \
- MC_CMD_OP(cmd, 1, 0, 8, char, endpoint1->type[0]); \
- MC_CMD_OP(cmd, 1, 8, 8, char, endpoint1->type[1]); \
- MC_CMD_OP(cmd, 1, 16, 8, char, endpoint1->type[2]); \
- MC_CMD_OP(cmd, 1, 24, 8, char, endpoint1->type[3]); \
- MC_CMD_OP(cmd, 1, 32, 8, char, endpoint1->type[4]); \
- MC_CMD_OP(cmd, 1, 40, 8, char, endpoint1->type[5]); \
- MC_CMD_OP(cmd, 1, 48, 8, char, endpoint1->type[6]); \
- MC_CMD_OP(cmd, 1, 56, 8, char, endpoint1->type[7]); \
- MC_CMD_OP(cmd, 2, 0, 8, char, endpoint1->type[8]); \
- MC_CMD_OP(cmd, 2, 8, 8, char, endpoint1->type[9]); \
- MC_CMD_OP(cmd, 2, 16, 8, char, endpoint1->type[10]); \
- MC_CMD_OP(cmd, 2, 24, 8, char, endpoint1->type[11]); \
- MC_CMD_OP(cmd, 2, 32, 8, char, endpoint1->type[12]); \
- MC_CMD_OP(cmd, 2, 40, 8, char, endpoint1->type[13]); \
- MC_CMD_OP(cmd, 2, 48, 8, char, endpoint1->type[14]); \
- MC_CMD_OP(cmd, 2, 56, 8, char, endpoint1->type[15]); \
-} while (0)
-
-/* cmd, param, offset, width, type, arg_name */
-#define DPRC_RSP_GET_CONNECTION(cmd, endpoint2, state) \
-do { \
- MC_RSP_OP(cmd, 3, 0, 32, int, endpoint2->id); \
- MC_RSP_OP(cmd, 3, 32, 16, uint16_t, endpoint2->if_id); \
- MC_RSP_OP(cmd, 4, 0, 8, char, endpoint2->type[0]); \
- MC_RSP_OP(cmd, 4, 8, 8, char, endpoint2->type[1]); \
- MC_RSP_OP(cmd, 4, 16, 8, char, endpoint2->type[2]); \
- MC_RSP_OP(cmd, 4, 24, 8, char, endpoint2->type[3]); \
- MC_RSP_OP(cmd, 4, 32, 8, char, endpoint2->type[4]); \
- MC_RSP_OP(cmd, 4, 40, 8, char, endpoint2->type[5]); \
- MC_RSP_OP(cmd, 4, 48, 8, char, endpoint2->type[6]); \
- MC_RSP_OP(cmd, 4, 56, 8, char, endpoint2->type[7]); \
- MC_RSP_OP(cmd, 5, 0, 8, char, endpoint2->type[8]); \
- MC_RSP_OP(cmd, 5, 8, 8, char, endpoint2->type[9]); \
- MC_RSP_OP(cmd, 5, 16, 8, char, endpoint2->type[10]); \
- MC_RSP_OP(cmd, 5, 24, 8, char, endpoint2->type[11]); \
- MC_RSP_OP(cmd, 5, 32, 8, char, endpoint2->type[12]); \
- MC_RSP_OP(cmd, 5, 40, 8, char, endpoint2->type[13]); \
- MC_RSP_OP(cmd, 5, 48, 8, char, endpoint2->type[14]); \
- MC_RSP_OP(cmd, 5, 56, 8, char, endpoint2->type[15]); \
- MC_RSP_OP(cmd, 6, 0, 32, int, state); \
-} while (0)
+#pragma pack(push, 1)
+struct dprc_cmd_open {
+ __le32 container_id;
+};
+
+struct dprc_cmd_create_container {
+ __le32 options;
+ __le32 icid;
+ __le32 pad1;
+ __le32 portal_id;
+ u8 label[16];
+};
+
+struct dprc_rsp_create_container {
+ __le64 pad0;
+ __le32 child_container_id;
+ __le32 pad1;
+ __le64 child_portal_addr;
+};
+
+struct dprc_cmd_destroy_container {
+ __le32 child_container_id;
+};
+
+struct dprc_cmd_connect {
+ __le32 ep1_id;
+ __le16 ep1_interface_id;
+ __le16 pad0;
+
+ __le32 ep2_id;
+ __le16 ep2_interface_id;
+ __le16 pad1;
+
+ u8 ep1_type[16];
+
+ __le32 max_rate;
+ __le32 committed_rate;
+
+ u8 ep2_type[16];
+};
+
+struct dprc_cmd_disconnect {
+ __le32 id;
+ __le32 interface_id;
+ u8 type[16];
+};
+
+struct dprc_cmd_get_connection {
+ __le32 ep1_id;
+ __le16 ep1_interface_id;
+ __le16 pad;
+
+ u8 ep1_type[16];
+};
+
+struct dprc_rsp_get_connection {
+ __le64 pad[3];
+ __le32 ep2_id;
+ __le16 ep2_interface_id;
+ __le16 pad1;
+ u8 ep2_type[16];
+ __le32 state;
+};
+
+#pragma pack(pop)
/* Data Path Resource Container API
* Contains DPRC API for managing and querying DPAA resources
@@ -463,7 +103,7 @@ struct fsl_mc_io;
* container, in case the ICID is not selected by the user and should be
* allocated by the DPRC from the pool of ICIDs.
*/
-#define DPRC_GET_ICID_FROM_POOL (uint16_t)(~(0))
+#define DPRC_GET_ICID_FROM_POOL (u16)(~(0))
/**
* Set this value as the portal_id value in dprc_cfg structure when creating a
@@ -472,48 +112,11 @@ struct fsl_mc_io;
*/
#define DPRC_GET_PORTAL_ID_FROM_POOL (int)(~(0))
-/**
- * dprc_get_container_id() - Get container ID associated with a given portal.
- * @mc_io: Pointer to MC portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @container_id: Requested container ID
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dprc_get_container_id(struct fsl_mc_io *mc_io,
- uint32_t cmd_flags,
- int *container_id);
+int dprc_get_container_id(struct fsl_mc_io *mc_io, u32 cmd_flags, int *container_id);
-/**
- * dprc_open() - Open DPRC object for use
- * @mc_io: Pointer to MC portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @container_id: Container ID to open
- * @token: Returned token of DPRC object
- *
- * Return: '0' on Success; Error code otherwise.
- *
- * @warning Required before any operation on the object.
- */
-int dprc_open(struct fsl_mc_io *mc_io,
- uint32_t cmd_flags,
- int container_id,
- uint16_t *token);
+int dprc_open(struct fsl_mc_io *mc_io, u32 cmd_flags, int container_id, u16 *token);
-/**
- * dprc_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 DPRC 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 dprc_close(struct fsl_mc_io *mc_io,
- uint32_t cmd_flags,
- uint16_t token);
+int dprc_close(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token);
/**
* Container general options
@@ -563,395 +166,57 @@ int dprc_close(struct fsl_mc_io *mc_io,
* @label: Object's label
*/
struct dprc_cfg {
- uint16_t icid;
- int portal_id;
- uint64_t options;
- char label[16];
-};
-
-/**
- * dprc_create_container() - Create child container
- * @mc_io: Pointer to MC portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @token: Token of DPRC object
- * @cfg: Child container configuration
- * @child_container_id: Returned child container ID
- * @child_portal_offset: Returned child portal offset from MC portal base
- *
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dprc_create_container(struct fsl_mc_io *mc_io,
- uint32_t cmd_flags,
- uint16_t token,
- struct dprc_cfg *cfg,
- int *child_container_id,
- uint64_t *child_portal_offset);
-
-/**
- * dprc_destroy_container() - Destroy child container.
- * @mc_io: Pointer to MC portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @token: Token of DPRC object
- * @child_container_id: ID of the container to destroy
- *
- * This function terminates the child container, so following this call the
- * child container ID becomes invalid.
- *
- * Notes:
- * - All resources and objects of the destroyed container are returned to the
- * parent container or destroyed if were created be the destroyed container.
- * - This function destroy all the child containers of the specified
- * container prior to destroying the container itself.
- *
- * warning: Only the parent container is allowed to destroy a child policy
- * Container 0 can't be destroyed
- *
- * Return: '0' on Success; Error code otherwise.
- *
- */
-int dprc_destroy_container(struct fsl_mc_io *mc_io,
- uint32_t cmd_flags,
- uint16_t token,
- int child_container_id);
-
-/**
- * dprc_reset_container - Reset child container.
- * @mc_io: Pointer to MC portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @token: Token of DPRC object
- * @child_container_id: ID of the container to reset
- *
- * In case a software context crashes or becomes non-responsive, the parent
- * may wish to reset its resources container before the software context is
- * restarted.
- *
- * This routine informs all objects assigned to the child container that the
- * container is being reset, so they may perform any cleanup operations that are
- * needed. All objects handles that were owned by the child container shall be
- * closed.
- *
- * Note that such request may be submitted even if the child software context
- * has not crashed, but the resulting object cleanup operations will not be
- * aware of that.
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dprc_reset_container(struct fsl_mc_io *mc_io,
- uint32_t cmd_flags,
- uint16_t token,
- int child_container_id);
-
-/**
- * struct dprc_attributes - Container attributes
- * @container_id: Container's ID
- * @icid: Container's ICID
- * @portal_id: Container's portal ID
- * @options: Container's options as set at container's creation
- * @version: DPRC version
- */
-struct dprc_attributes {
- int container_id;
- uint16_t icid;
+ u16 icid;
int portal_id;
uint64_t options;
-};
-
-/**
- * dprc_get_attributes() - Obtains container 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 DPRC object
- * @attributes: Returned container attributes
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dprc_get_attributes(struct fsl_mc_io *mc_io,
- uint32_t cmd_flags,
- uint16_t token,
- struct dprc_attributes *attributes);
-
-/**
- * dprc_get_obj_count() - Obtains the number of objects in the DPRC
- * @mc_io: Pointer to MC portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @token: Token of DPRC object
- * @obj_count: Number of objects assigned to the DPRC
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dprc_get_obj_count(struct fsl_mc_io *mc_io,
- uint32_t cmd_flags,
- uint16_t token,
- int *obj_count);
-
-/* Objects Attributes Flags */
-
-/* Opened state - Indicates that an object is open by at least one owner */
-#define DPRC_OBJ_STATE_OPEN 0x00000001
-/* Plugged state - Indicates that the object is plugged */
-#define DPRC_OBJ_STATE_PLUGGED 0x00000002
-
-/**
- * Shareability flag - Object flag indicating no memory shareability.
- * the object generates memory accesses that are non coherent with other
- * masters;
- * user is responsible for proper memory handling through IOMMU configuration.
- */
-#define DPRC_OBJ_FLAG_NO_MEM_SHAREABILITY 0x0001
-
-/**
- * struct dprc_obj_desc - Object descriptor, returned from dprc_get_obj()
- * @type: Type of object: NULL terminated string
- * @id: ID of logical object resource
- * @vendor: Object vendor identifier
- * @ver_major: Major version number
- * @ver_minor: Minor version number
- * @irq_count: Number of interrupts supported by the object
- * @region_count: Number of mappable regions supported by the object
- * @state: Object state: combination of DPRC_OBJ_STATE_ states
- * @label: Object label
- * @flags: Object's flags
- */
-struct dprc_obj_desc {
- char type[16];
- int id;
- uint16_t vendor;
- uint16_t ver_major;
- uint16_t ver_minor;
- uint8_t irq_count;
- uint8_t region_count;
- uint32_t state;
char label[16];
- uint16_t flags;
};
-/**
- * dprc_get_obj() - Get general information on an 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 DPRC object
- * @obj_index: Index of the object to be queried (< obj_count)
- * @obj_desc: Returns the requested object descriptor
- *
- * The object descriptors are retrieved one by one by incrementing
- * obj_index up to (not including) the value of obj_count returned
- * from dprc_get_obj_count(). dprc_get_obj_count() must
- * be called prior to dprc_get_obj().
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dprc_get_obj(struct fsl_mc_io *mc_io,
- uint32_t cmd_flags,
- uint16_t token,
- int obj_index,
- struct dprc_obj_desc *obj_desc);
-
-/**
- * dprc_get_res_count() - Obtains the number of free resources that are
- * assigned to this container, by pool type
- * @mc_io: Pointer to MC portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @token: Token of DPRC object
- * @type: pool type
- * @res_count: Returned number of free resources of the given
- * resource type that are assigned to this DPRC
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dprc_get_res_count(struct fsl_mc_io *mc_io,
- uint32_t cmd_flags,
- uint16_t token,
- char *type,
- int *res_count);
-
-/**
- * enum dprc_iter_status - Iteration status
- * @DPRC_ITER_STATUS_FIRST: Perform first iteration
- * @DPRC_ITER_STATUS_MORE: Indicates more/next iteration is needed
- * @DPRC_ITER_STATUS_LAST: Indicates last iteration
- */
-enum dprc_iter_status {
- DPRC_ITER_STATUS_FIRST = 0,
- DPRC_ITER_STATUS_MORE = 1,
- DPRC_ITER_STATUS_LAST = 2
-};
-
-/**
- * struct dprc_res_ids_range_desc - Resource ID range descriptor
- * @base_id: Base resource ID of this range
- * @last_id: Last resource ID of this range
- * @iter_status: Iteration status - should be set to DPRC_ITER_STATUS_FIRST at
- * first iteration; while the returned marker is DPRC_ITER_STATUS_MORE,
- * additional iterations are needed, until the returned marker is
- * DPRC_ITER_STATUS_LAST
- */
-struct dprc_res_ids_range_desc {
- int base_id;
- int last_id;
- enum dprc_iter_status iter_status;
-};
-
-/**
- * dprc_get_res_ids() - Obtains IDs of free resources in the container
- * @mc_io: Pointer to MC portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @token: Token of DPRC object
- * @type: pool type
- * @range_desc: range descriptor
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dprc_get_res_ids(struct fsl_mc_io *mc_io,
- uint32_t cmd_flags,
- uint16_t token,
- char *type,
- struct dprc_res_ids_range_desc *range_desc);
-
-/* Region flags */
-/* Cacheable - Indicates that region should be mapped as cacheable */
-#define DPRC_REGION_CACHEABLE 0x00000001
+int dprc_create_container(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token,
+ struct dprc_cfg *cfg, int *child_container_id,
+ uint64_t *child_portal_offset);
-/**
- * enum dprc_region_type - Region type
- * @DPRC_REGION_TYPE_MC_PORTAL: MC portal region
- * @DPRC_REGION_TYPE_QBMAN_PORTAL: Qbman portal region
- */
-enum dprc_region_type {
- DPRC_REGION_TYPE_MC_PORTAL,
- DPRC_REGION_TYPE_QBMAN_PORTAL
-};
+int dprc_destroy_container(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token,
+ int child_container_id);
/**
- * struct dprc_region_desc - Mappable region descriptor
- * @base_offset: Region offset from region's base address.
- * For DPMCP and DPRC objects, region base is offset from SoC MC portals
- * base address; For DPIO, region base is offset from SoC QMan portals
- * base address
- * @size: Region size (in bytes)
- * @flags: Region attributes
- * @type: Portal region type
+ * struct dprc_connection_cfg - Connection configuration.
+ * Used for virtual connections only
+ * @committed_rate: Committed rate (Mbits/s)
+ * @max_rate: Maximum rate (Mbits/s)
*/
-struct dprc_region_desc {
- uint32_t base_offset;
- uint32_t size;
- uint32_t flags;
- enum dprc_region_type type;
+struct dprc_connection_cfg {
+ u32 committed_rate;
+ u32 max_rate;
};
/**
- * dprc_get_obj_region() - Get region information for a specified 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 DPRC object
- * @obj_type: Object type as returned in dprc_get_obj()
- * @obj_id: Unique object instance as returned in dprc_get_obj()
- * @region_index: The specific region to query
- * @region_desc: Returns the requested region descriptor
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dprc_get_obj_region(struct fsl_mc_io *mc_io,
- uint32_t cmd_flags,
- uint16_t token,
- char *obj_type,
- int obj_id,
- uint8_t region_index,
- struct dprc_region_desc *region_desc);
-/**
* struct dprc_endpoint - Endpoint description for link connect/disconnect
* operations
- * @type: Endpoint object type: NULL terminated string
- * @id: Endpoint object ID
- * @if_id: Interface ID; should be set for endpoints with multiple
+ * @type: Endpoint object type: NULL terminated string
+ * @id: Endpoint object ID
+ * @if_id: Interface ID; should be set for endpoints with multiple
* interfaces ("dpsw", "dpdmux"); for others, always set to 0
*/
struct dprc_endpoint {
- char type[16];
- int id;
- uint16_t if_id;
-};
-
-/**
- * struct dprc_connection_cfg - Connection configuration.
- * Used for virtual connections only
- * @committed_rate: Committed rate (Mbits/s)
- * @max_rate: Maximum rate (Mbits/s)
- */
-struct dprc_connection_cfg {
- uint32_t committed_rate;
- uint32_t max_rate;
+ char type[16];
+ int id;
+ u16 if_id;
};
-/**
- * dprc_connect() - Connect two endpoints to create a network link between them
- * @mc_io: Pointer to MC portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @token: Token of DPRC object
- * @endpoint1: Endpoint 1 configuration parameters
- * @endpoint2: Endpoint 2 configuration parameters
- * @cfg: Connection configuration. The connection configuration is ignored for
- * connections made to DPMAC objects, where rate is retrieved from the
- * MAC configuration.
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dprc_connect(struct fsl_mc_io *mc_io,
- uint32_t cmd_flags,
- uint16_t token,
- const struct dprc_endpoint *endpoint1,
- const struct dprc_endpoint *endpoint2,
- const struct dprc_connection_cfg *cfg);
+int dprc_connect(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token,
+ const struct dprc_endpoint *endpoint1,
+ const struct dprc_endpoint *endpoint2,
+ const struct dprc_connection_cfg *cfg);
-/**
- * dprc_disconnect() - Disconnect one endpoint to remove its network connection
- * @mc_io: Pointer to MC portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @token: Token of DPRC object
- * @endpoint: Endpoint configuration parameters
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dprc_disconnect(struct fsl_mc_io *mc_io,
- uint32_t cmd_flags,
- uint16_t token,
- const struct dprc_endpoint *endpoint);
+int dprc_disconnect(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token,
+ const struct dprc_endpoint *endpoint);
-/**
-* dprc_get_connection() - Get connected endpoint and link status if connection
-* exists.
-* @mc_io: Pointer to MC portal's I/O object
-* @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
-* @token: Token of DPRC object
-* @endpoint1: Endpoint 1 configuration parameters
-* @endpoint2: Returned endpoint 2 configuration parameters
-* @state: Returned link state:
-* 1 - link is up;
-* 0 - link is down;
-* -1 - no connection (endpoint2 information is irrelevant)
-*
-* Return: '0' on Success; -ENAVAIL if connection does not exist.
-*/
-int dprc_get_connection(struct fsl_mc_io *mc_io,
- uint32_t cmd_flags,
- uint16_t token,
- const struct dprc_endpoint *endpoint1,
- struct dprc_endpoint *endpoint2,
- int *state);
+int dprc_get_connection(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token,
+ const struct dprc_endpoint *endpoint1,
+ struct dprc_endpoint *endpoint2, int *state);
-/**
- * dprc_get_api_version - Retrieve DPRC Major and Minor version info.
- *
- * @mc_io: Pointer to MC portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @major_ver: DPRC major version
- * @minor_ver: DPRC minor version
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dprc_get_api_version(struct fsl_mc_io *mc_io,
- u32 cmd_flags,
- u16 *major_ver,
- u16 *minor_ver);
+int dprc_get_api_version(struct fsl_mc_io *mc_io, u32 cmd_flags,
+ u16 *major_ver, u16 *minor_ver);
#endif /* _FSL_DPRC_H */
diff --git a/include/fsl-mc/fsl_dpsparser.h b/include/fsl-mc/fsl_dpsparser.h
index 48fb495059..9619bb1413 100644
--- a/include/fsl-mc/fsl_dpsparser.h
+++ b/include/fsl-mc/fsl_dpsparser.h
@@ -2,7 +2,7 @@
/*
* Data Path Soft Parser API
*
- * Copyright 2018 NXP
+ * Copyright 2018, 2023 NXP
*/
#ifndef _FSL_DPSPARSER_H
#define _FSL_DPSPARSER_H
@@ -20,13 +20,26 @@
#define DPSPARSER_CMDID_APPLY_SPB 0x1181
-/* cmd, param, offset, width, type, arg_name */
-#define DPSPARSER_CMD_BLOB_SET_ADDR(cmd, addr) \
- MC_CMD_OP(cmd, 0, 0, 64, u64, addr)
+#pragma pack(push, 1)
-/* cmd, param, offset, width, type, arg_name */
-#define DPSPARSER_CMD_BLOB_REPORT_ERROR(cmd, err) \
- MC_RSP_OP(cmd, 0, 0, 16, u16, err)
+struct dpsparser_cmd_destroy {
+ __le32 dpsparser_id;
+};
+
+struct dpsparser_cmd_blob_set_address {
+ __le64 blob_addr;
+};
+
+struct dpsparser_rsp_blob_report_error {
+ __le16 error;
+};
+
+struct dpsparser_rsp_get_api_version {
+ __le16 major;
+ __le16 minor;
+};
+
+#pragma pack(pop)
/* Data Path Soft Parser API
* Contains initialization APIs and runtime control APIs for DPSPARSER
@@ -99,110 +112,20 @@ struct fsl_mc_io;
NULL, \
}
-/**
- * dpsparser_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_'
- * @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 dpsparser_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 dpsparser_open(struct fsl_mc_io *mc_io,
- u32 cmd_flags,
- u16 *token);
-
-/**
- * dpsparser_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 DPSPARSER 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 dpsparser_close(struct fsl_mc_io *mc_io,
- u32 cmd_flags,
- u16 token);
-
-/**
- * dpsparser_create() - Create the DPSPARSER object.
- * @mc_io: Pointer to MC portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @token: Returned token; use in subsequent API calls
- *
- * Create the DPSPARSER 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 returns a unique authentication token,
- * associated with the specific object ID and the specific MC
- * portal; this token must be used in all subsequent calls to
- * this specific object. For objects that are created using the
- * DPL file, call dpsparser_open function to get an authentication
- * token first.
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dpsparser_create(struct fsl_mc_io *mc_io,
- u16 token,
- u32 cmd_flags,
+int dpsparser_open(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 *token);
+
+int dpsparser_close(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token);
+
+int dpsparser_create(struct fsl_mc_io *mc_io, u16 token, u32 cmd_flags,
u32 *obj_id);
-/**
- * dpsparser_destroy() - Destroy the DPSPARSER object and release all its
- * resources.
- * @mc_io: Pointer to MC portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @token: Token of DPSPARSER object
- *
- * Return: '0' on Success; error code otherwise.
- */
-int dpsparser_destroy(struct fsl_mc_io *mc_io,
- u16 token,
- u32 cmd_flags,
+int dpsparser_destroy(struct fsl_mc_io *mc_io, u16 token, u32 cmd_flags,
u32 obj_id);
-/**
- * dpsparser_apply_spb() - Applies the Soft Parser Blob loaded at specified
- * address.
- * @mc_io: Pointer to MC portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @token: Token of DPSPARSER object
- * @blob_addr: Blob loading address
- * @error: Error reported by MC related to SP Blob parsing and apply
- *
- * Return: '0' on Success; error code otherwise.
- */
-int dpsparser_apply_spb(struct fsl_mc_io *mc_io,
- u32 cmd_flags,
- u16 token,
- u64 blob_addr,
- u16 *error);
-
-/**
- * dpsparser_get_api_version - Retrieve DPSPARSER Major and Minor version info.
- *
- * @mc_io: Pointer to MC portal's I/O object
- * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
- * @major_ver: DPSPARSER major version
- * @minor_ver: DPSPARSER minor version
- *
- * Return: '0' on Success; Error code otherwise.
- */
-int dpsparser_get_api_version(struct fsl_mc_io *mc_io,
- u32 cmd_flags,
- u16 *major_ver,
- u16 *minor_ver);
+int dpsparser_apply_spb(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token,
+ u64 blob_addr, u16 *error);
+
+int dpsparser_get_api_version(struct fsl_mc_io *mc_io, u32 cmd_flags,
+ u16 *major_ver, u16 *minor_ver);
#endif /* _FSL_DPSPARSER_H */
diff --git a/include/fsl-mc/fsl_mc_cmd.h b/include/fsl-mc/fsl_mc_cmd.h
index 591cda9685..c239595ed5 100644
--- a/include/fsl-mc/fsl_mc_cmd.h
+++ b/include/fsl-mc/fsl_mc_cmd.h
@@ -19,6 +19,15 @@ static inline uint64_t mc_dec(uint64_t val, int lsoffset, int width)
return (uint64_t)((val >> lsoffset) & MAKE_UMASK64(width));
}
+struct mc_cmd_header {
+ u8 src_id;
+ u8 flags_hw;
+ u8 status;
+ u8 flags_sw;
+ __le16 token;
+ __le16 cmd_id;
+};
+
struct mc_command {
uint64_t header;
uint64_t params[MC_CMD_NUM_OF_PARAMS];
@@ -74,29 +83,6 @@ enum mc_cmd_status {
((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 MC_CMD_READ_OBJ_ID(cmd, obj_id) \
- MC_RSP_OP(cmd, 0, 0, 32, uint32_t, obj_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)
-
static inline uint64_t mc_encode_cmd_header(uint16_t cmd_id,
uint32_t cmd_flags,
uint16_t token)
@@ -179,4 +165,19 @@ static inline void mc_cmd_read_api_version(struct mc_command *cmd,
*minor_ver = le16_to_cpu(rsp_params->minor_ver);
}
+static inline uint16_t mc_cmd_hdr_read_token(struct mc_command *cmd)
+{
+ struct mc_cmd_header *hdr = (struct mc_cmd_header *)&cmd->header;
+ u16 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);
+}
#endif /* __FSL_MC_CMD_H */
diff --git a/include/net.h b/include/net.h
index 785cb1059e..e254df7d7f 100644
--- a/include/net.h
+++ b/include/net.h
@@ -167,6 +167,9 @@ enum eth_recv_flags {
* to the network stack. This function should fill in the
* eth_pdata::enetaddr field - optional
* set_promisc: Enable or Disable promiscuous mode
+ * get_sset_count: Number of statistics counters
+ * get_string: Names of the statistic counters
+ * get_stats: The values of the statistic counters
*/
struct eth_ops {
int (*start)(struct udevice *dev);
@@ -178,6 +181,9 @@ struct eth_ops {
int (*write_hwaddr)(struct udevice *dev);
int (*read_rom_hwaddr)(struct udevice *dev);
int (*set_promisc)(struct udevice *dev, bool enable);
+ int (*get_sset_count)(struct udevice *dev);
+ void (*get_strings)(struct udevice *dev, u8 *data);
+ void (*get_stats)(struct udevice *dev, u64 *data);
};
#define eth_get_ops(dev) ((struct eth_ops *)(dev)->driver->ops)