From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5C22DA0C41; Wed, 6 Oct 2021 14:10:32 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 569F041157; Wed, 6 Oct 2021 14:10:27 +0200 (CEST) Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by mails.dpdk.org (Postfix) with ESMTP id 5AD1F41148 for ; Wed, 6 Oct 2021 14:10:25 +0200 (CEST) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 23694200FFF; Wed, 6 Oct 2021 14:10:25 +0200 (CEST) Received: from aprdc01srsp001v.ap-rdc01.nxp.com (aprdc01srsp001v.ap-rdc01.nxp.com [165.114.16.16]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 832BF201A26; Wed, 6 Oct 2021 14:10:24 +0200 (CEST) Received: from lsv03274.swis.in-blr01.nxp.com (lsv03274.swis.in-blr01.nxp.com [92.120.147.114]) by aprdc01srsp001v.ap-rdc01.nxp.com (Postfix) with ESMTP id 7FC14183AD05; Wed, 6 Oct 2021 20:10:23 +0800 (+08) From: nipun.gupta@nxp.com To: dev@dpdk.org Cc: thomas@monjalon.net, ferruh.yigit@intel.com, hemant.agrawal@nxp.com, sachin.saxena@nxp.com Date: Wed, 6 Oct 2021 17:40:13 +0530 Message-Id: <20211006121022.27119-2-nipun.gupta@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211006121022.27119-1-nipun.gupta@nxp.com> References: <20210927122650.30881-1-nipun.gupta@nxp.com> <20211006121022.27119-1-nipun.gupta@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH v2 01/10] bus/fslmc: updated MC FW to 10.28 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Hemant Agrawal Updating MC firmware support APIs to be latest. It supports improved DPDMUX (SRIOV equivalent) for traffic split between dpnis and additional PTP APIs. Signed-off-by: Hemant Agrawal --- drivers/bus/fslmc/mc/dpdmai.c | 4 +- drivers/bus/fslmc/mc/fsl_dpdmai.h | 21 ++++- drivers/bus/fslmc/mc/fsl_dpdmai_cmd.h | 15 ++-- drivers/bus/fslmc/mc/fsl_dpmng.h | 4 +- drivers/bus/fslmc/mc/fsl_dpopr.h | 7 +- drivers/net/dpaa2/dpaa2_ethdev.c | 2 +- drivers/net/dpaa2/mc/dpdmux.c | 43 +++++++++ drivers/net/dpaa2/mc/dpni.c | 48 ++++++---- drivers/net/dpaa2/mc/dprtc.c | 78 +++++++++++++++- drivers/net/dpaa2/mc/fsl_dpdmux.h | 6 ++ drivers/net/dpaa2/mc/fsl_dpdmux_cmd.h | 9 ++ drivers/net/dpaa2/mc/fsl_dpkg.h | 6 +- drivers/net/dpaa2/mc/fsl_dpni.h | 124 ++++++++++++++++++++++---- drivers/net/dpaa2/mc/fsl_dpni_cmd.h | 55 +++++++++--- drivers/net/dpaa2/mc/fsl_dprtc.h | 19 +++- drivers/net/dpaa2/mc/fsl_dprtc_cmd.h | 25 +++++- 16 files changed, 401 insertions(+), 65 deletions(-) diff --git a/drivers/bus/fslmc/mc/dpdmai.c b/drivers/bus/fslmc/mc/dpdmai.c index dcb9d516a1..9c2f3bf9d5 100644 --- a/drivers/bus/fslmc/mc/dpdmai.c +++ b/drivers/bus/fslmc/mc/dpdmai.c @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause - * Copyright 2018 NXP + * Copyright 2018-2021 NXP */ #include @@ -116,6 +116,7 @@ int dpdmai_create(struct fsl_mc_io *mc_io, cmd_params->num_queues = cfg->num_queues; cmd_params->priorities[0] = cfg->priorities[0]; cmd_params->priorities[1] = cfg->priorities[1]; + cmd_params->options = cpu_to_le32(cfg->adv.options); /* send command to mc*/ err = mc_send_command(mc_io, &cmd); @@ -299,6 +300,7 @@ int dpdmai_get_attributes(struct fsl_mc_io *mc_io, attr->id = le32_to_cpu(rsp_params->id); attr->num_of_priorities = rsp_params->num_of_priorities; attr->num_of_queues = rsp_params->num_of_queues; + attr->options = le32_to_cpu(rsp_params->options); return 0; } diff --git a/drivers/bus/fslmc/mc/fsl_dpdmai.h b/drivers/bus/fslmc/mc/fsl_dpdmai.h index 19328c00a0..5af8ed48c0 100644 --- a/drivers/bus/fslmc/mc/fsl_dpdmai.h +++ b/drivers/bus/fslmc/mc/fsl_dpdmai.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause - * Copyright 2018 NXP + * Copyright 2018-2021 NXP */ #ifndef __FSL_DPDMAI_H @@ -36,15 +36,32 @@ int dpdmai_close(struct fsl_mc_io *mc_io, uint32_t cmd_flags, uint16_t token); +/* DPDMAI options */ + +/** + * Enable individual Congestion Groups usage per each priority queue + * If this option is not enabled then only one CG is used for all priority + * queues + * If this option is enabled then a separate specific CG is used for each + * individual priority queue. + * In this case the priority queue must be specified via congestion notification + * API + */ +#define DPDMAI_OPT_CG_PER_PRIORITY 0x00000001 + /** * struct dpdmai_cfg - Structure representing DPDMAI configuration * @priorities: Priorities for the DMA hardware processing; valid priorities are * configured with values 1-8; the entry following last valid entry * should be configured with 0 + * @options: dpdmai options */ struct dpdmai_cfg { uint8_t num_queues; uint8_t priorities[DPDMAI_PRIO_NUM]; + struct { + uint32_t options; + } adv; }; int dpdmai_create(struct fsl_mc_io *mc_io, @@ -81,11 +98,13 @@ int dpdmai_reset(struct fsl_mc_io *mc_io, * struct dpdmai_attr - Structure representing DPDMAI attributes * @id: DPDMAI object ID * @num_of_priorities: number of priorities + * @options: dpdmai options */ struct dpdmai_attr { int id; uint8_t num_of_priorities; uint8_t num_of_queues; + uint32_t options; }; __rte_internal diff --git a/drivers/bus/fslmc/mc/fsl_dpdmai_cmd.h b/drivers/bus/fslmc/mc/fsl_dpdmai_cmd.h index 7e122de4ef..c8f6b990f8 100644 --- a/drivers/bus/fslmc/mc/fsl_dpdmai_cmd.h +++ b/drivers/bus/fslmc/mc/fsl_dpdmai_cmd.h @@ -1,32 +1,33 @@ /* SPDX-License-Identifier: BSD-3-Clause - * Copyright 2018 NXP + * Copyright 2017-2018, 2020-2021 NXP */ - #ifndef _FSL_DPDMAI_CMD_H #define _FSL_DPDMAI_CMD_H /* DPDMAI Version */ #define DPDMAI_VER_MAJOR 3 -#define DPDMAI_VER_MINOR 3 +#define DPDMAI_VER_MINOR 4 /* Command versioning */ #define DPDMAI_CMD_BASE_VERSION 1 #define DPDMAI_CMD_VERSION_2 2 +#define DPDMAI_CMD_VERSION_3 3 #define DPDMAI_CMD_ID_OFFSET 4 #define DPDMAI_CMD(id) ((id << DPDMAI_CMD_ID_OFFSET) | DPDMAI_CMD_BASE_VERSION) #define DPDMAI_CMD_V2(id) ((id << DPDMAI_CMD_ID_OFFSET) | DPDMAI_CMD_VERSION_2) +#define DPDMAI_CMD_V3(id) ((id << DPDMAI_CMD_ID_OFFSET) | DPDMAI_CMD_VERSION_3) /* Command IDs */ #define DPDMAI_CMDID_CLOSE DPDMAI_CMD(0x800) #define DPDMAI_CMDID_OPEN DPDMAI_CMD(0x80E) -#define DPDMAI_CMDID_CREATE DPDMAI_CMD_V2(0x90E) +#define DPDMAI_CMDID_CREATE DPDMAI_CMD_V3(0x90E) #define DPDMAI_CMDID_DESTROY DPDMAI_CMD(0x98E) #define DPDMAI_CMDID_GET_API_VERSION DPDMAI_CMD(0xa0E) #define DPDMAI_CMDID_ENABLE DPDMAI_CMD(0x002) #define DPDMAI_CMDID_DISABLE DPDMAI_CMD(0x003) -#define DPDMAI_CMDID_GET_ATTR DPDMAI_CMD_V2(0x004) +#define DPDMAI_CMDID_GET_ATTR DPDMAI_CMD_V3(0x004) #define DPDMAI_CMDID_RESET DPDMAI_CMD(0x005) #define DPDMAI_CMDID_IS_ENABLED DPDMAI_CMD(0x006) @@ -51,6 +52,8 @@ struct dpdmai_cmd_open { struct dpdmai_cmd_create { uint8_t num_queues; uint8_t priorities[2]; + uint8_t pad; + uint32_t options; }; struct dpdmai_cmd_destroy { @@ -69,6 +72,8 @@ struct dpdmai_rsp_get_attr { uint32_t id; uint8_t num_of_priorities; uint8_t num_of_queues; + uint16_t pad; + uint32_t options; }; #define DPDMAI_DEST_TYPE_SHIFT 0 diff --git a/drivers/bus/fslmc/mc/fsl_dpmng.h b/drivers/bus/fslmc/mc/fsl_dpmng.h index 8764ceaed9..7e9bd96429 100644 --- a/drivers/bus/fslmc/mc/fsl_dpmng.h +++ b/drivers/bus/fslmc/mc/fsl_dpmng.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) * * Copyright 2013-2015 Freescale Semiconductor Inc. - * Copyright 2017-2019 NXP + * Copyright 2017-2021 NXP * */ #ifndef __FSL_DPMNG_H @@ -20,7 +20,7 @@ struct fsl_mc_io; * Management Complex firmware version information */ #define MC_VER_MAJOR 10 -#define MC_VER_MINOR 18 +#define MC_VER_MINOR 28 /** * struct mc_version diff --git a/drivers/bus/fslmc/mc/fsl_dpopr.h b/drivers/bus/fslmc/mc/fsl_dpopr.h index fd727e011b..74dd32f783 100644 --- a/drivers/bus/fslmc/mc/fsl_dpopr.h +++ b/drivers/bus/fslmc/mc/fsl_dpopr.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) * * Copyright 2013-2015 Freescale Semiconductor Inc. - * Copyright 2018 NXP + * Copyright 2018-2021 NXP * */ #ifndef __FSL_DPOPR_H_ @@ -22,7 +22,10 @@ * Retire an existing Order Point Record option */ #define OPR_OPT_RETIRE 0x2 - +/** + * Assign an existing Order Point Record to a queue + */ +#define OPR_OPT_ASSIGN 0x4 /** * struct opr_cfg - Structure representing OPR configuration * @oprrws: Order point record (OPR) restoration window size (0 to 5) diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index c12169578e..560b79151b 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -2273,7 +2273,7 @@ int dpaa2_eth_eventq_attach(const struct rte_eth_dev *dev, ret = dpni_set_opr(dpni, CMD_PRI_LOW, eth_priv->token, dpaa2_ethq->tc_index, flow_id, - OPR_OPT_CREATE, &ocfg); + OPR_OPT_CREATE, &ocfg, 0); if (ret) { DPAA2_PMD_ERR("Error setting opr: ret: %d\n", ret); return ret; diff --git a/drivers/net/dpaa2/mc/dpdmux.c b/drivers/net/dpaa2/mc/dpdmux.c index 93912ef9d3..edbb01b45b 100644 --- a/drivers/net/dpaa2/mc/dpdmux.c +++ b/drivers/net/dpaa2/mc/dpdmux.c @@ -491,6 +491,49 @@ int dpdmux_set_max_frame_length(struct fsl_mc_io *mc_io, return mc_send_command(mc_io, &cmd); } +/** + * dpdmux_get_max_frame_length() - Return the maximum frame length for DPDMUX + * interface + * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @token: Token of DPDMUX object + * @if_id: Interface id + * @max_frame_length: maximum frame length + * + * When dpdmux object is in VEPA mode this function will ignore if_id parameter + * and will return maximum frame length for uplink interface (if_id==0). + * + * Return: '0' on Success; Error code otherwise. + */ +int dpdmux_get_max_frame_length(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint16_t if_id, + uint16_t *max_frame_length) +{ + struct mc_command cmd = { 0 }; + struct dpdmux_cmd_get_max_frame_len *cmd_params; + struct dpdmux_rsp_get_max_frame_len *rsp_params; + int err = 0; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPDMUX_CMDID_GET_MAX_FRAME_LENGTH, + cmd_flags, + token); + cmd_params = (struct dpdmux_cmd_get_max_frame_len *)cmd.params; + cmd_params->if_id = cpu_to_le16(if_id); + + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + rsp_params = (struct dpdmux_rsp_get_max_frame_len *)cmd.params; + *max_frame_length = le16_to_cpu(rsp_params->max_len); + + /* send command to mc*/ + return err; +} + /** * dpdmux_ul_reset_counters() - Function resets the uplink counter * @mc_io: Pointer to MC portal's I/O object diff --git a/drivers/net/dpaa2/mc/dpni.c b/drivers/net/dpaa2/mc/dpni.c index b254931386..60048d6c43 100644 --- a/drivers/net/dpaa2/mc/dpni.c +++ b/drivers/net/dpaa2/mc/dpni.c @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) * * Copyright 2013-2016 Freescale Semiconductor Inc. - * Copyright 2016-2020 NXP + * Copyright 2016-2021 NXP * */ #include @@ -126,6 +126,8 @@ int dpni_create(struct fsl_mc_io *mc_io, cmd_params->qos_entries = cfg->qos_entries; cmd_params->fs_entries = cpu_to_le16(cfg->fs_entries); cmd_params->num_cgs = cfg->num_cgs; + cmd_params->num_opr = cfg->num_opr; + cmd_params->dist_key_size = cfg->dist_key_size; /* send command to mc*/ err = mc_send_command(mc_io, &cmd); @@ -1829,6 +1831,7 @@ int dpni_add_fs_entry(struct fsl_mc_io *mc_io, cmd_params->options = cpu_to_le16(action->options); cmd_params->flow_id = cpu_to_le16(action->flow_id); cmd_params->flc = cpu_to_le64(action->flc); + cmd_params->redir_token = cpu_to_le16(action->redirect_obj_token); /* send command to mc*/ return mc_send_command(mc_io, &cmd); @@ -2442,7 +2445,7 @@ int dpni_reset_statistics(struct fsl_mc_io *mc_io, } /** - * dpni_set_taildrop() - Set taildrop per queue or TC + * dpni_set_taildrop() - Set taildrop per congestion group * * Setting a per-TC taildrop (cg_point = DPNI_CP_GROUP) will reset any current * congestion notification or early drop (WRED) configuration previously applied @@ -2451,13 +2454,14 @@ int dpni_reset_statistics(struct fsl_mc_io *mc_io, * @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 - * @cg_point: Congestion point, DPNI_CP_QUEUE is only supported in + * @cg_point: Congestion group identifier DPNI_CP_QUEUE is only supported in * combination with DPNI_QUEUE_RX. * @q_type: Queue type, can be DPNI_QUEUE_RX or DPNI_QUEUE_TX. * @tc: Traffic class to apply this taildrop to - * @q_index: Index of the queue if the DPNI supports multiple queues for + * @index/cgid: Index of the queue if the DPNI supports multiple queues for * traffic distribution. - * Ignored if CONGESTION_POINT is not DPNI_CP_QUEUE. + * If CONGESTION_POINT is DPNI_CP_CONGESTION_GROUP then it + * represent the cgid of the congestion point * @taildrop: Taildrop structure * * Return: '0' on Success; Error code otherwise. @@ -2577,7 +2581,8 @@ int dpni_set_opr(struct fsl_mc_io *mc_io, uint8_t tc, uint8_t index, uint8_t options, - struct opr_cfg *cfg) + struct opr_cfg *cfg, + uint8_t opr_id) { struct dpni_cmd_set_opr *cmd_params; struct mc_command cmd = { 0 }; @@ -2591,6 +2596,7 @@ int dpni_set_opr(struct fsl_mc_io *mc_io, cmd_params->tc_id = tc; cmd_params->index = index; cmd_params->options = options; + cmd_params->opr_id = opr_id; cmd_params->oloe = cfg->oloe; cmd_params->oeane = cfg->oeane; cmd_params->olws = cfg->olws; @@ -2621,7 +2627,9 @@ int dpni_get_opr(struct fsl_mc_io *mc_io, uint8_t tc, uint8_t index, struct opr_cfg *cfg, - struct opr_qry *qry) + struct opr_qry *qry, + uint8_t flags, + uint8_t opr_id) { struct dpni_rsp_get_opr *rsp_params; struct dpni_cmd_get_opr *cmd_params; @@ -2635,6 +2643,8 @@ int dpni_get_opr(struct fsl_mc_io *mc_io, cmd_params = (struct dpni_cmd_get_opr *)cmd.params; cmd_params->index = index; cmd_params->tc_id = tc; + cmd_params->flags = flags; + cmd_params->opr_id = opr_id; /* send command to mc*/ err = mc_send_command(mc_io, &cmd); @@ -2673,7 +2683,7 @@ int dpni_get_opr(struct fsl_mc_io *mc_io, * If the FS is already enabled with a previous call the classification * key will be changed but all the table rules are kept. If the * existing rules do not match the key the results will not be - * predictable. It is the user responsibility to keep key integrity + * predictable. It is the user responsibility to keep keyintegrity. * If cfg.enable is set to 1 the command will create a flow steering table * and will classify packets according to this table. The packets * that miss all the table rules will be classified according to @@ -2695,7 +2705,7 @@ int dpni_set_rx_fs_dist(struct fsl_mc_io *mc_io, uint32_t cmd_flags, cmd_params = (struct dpni_cmd_set_rx_fs_dist *)cmd.params; cmd_params->dist_size = cpu_to_le16(cfg->dist_size); dpni_set_field(cmd_params->enable, RX_FS_DIST_ENABLE, cfg->enable); - cmd_params->tc = cfg->tc; + cmd_params->tc = cfg->tc; cmd_params->miss_flow_id = cpu_to_le16(cfg->fs_miss_flow_id); cmd_params->key_cfg_iova = cpu_to_le64(cfg->key_cfg_iova); @@ -2710,9 +2720,9 @@ int dpni_set_rx_fs_dist(struct fsl_mc_io *mc_io, uint32_t cmd_flags, * @token: Token of DPNI object * @cfg: Distribution configuration * If cfg.enable is set to 1 the packets will be classified using a hash - * function based on the key received in cfg.key_cfg_iova parameter + * function based on the key received in cfg.key_cfg_iova parameter. * If cfg.enable is set to 0 the packets will be sent to the queue configured in - * dpni_set_rx_dist_default_queue() call + * dpni_set_rx_dist_default_queue() call */ int dpni_set_rx_hash_dist(struct fsl_mc_io *mc_io, uint32_t cmd_flags, uint16_t token, const struct dpni_rx_dist_cfg *cfg) @@ -2735,9 +2745,9 @@ int dpni_set_rx_hash_dist(struct fsl_mc_io *mc_io, uint32_t cmd_flags, } /** - * dpni_add_custom_tpid() - Configures a distinct Ethertype value - * (or TPID value) to indicate VLAN tag in addition to the common - * TPID values 0x8100 and 0x88A8 + * dpni_add_custom_tpid() - Configures a distinct Ethertype value (or TPID + * value) to indicate VLAN tag in adition to the common TPID values + * 0x81000 and 0x88A8 * @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 @@ -2745,8 +2755,8 @@ int dpni_set_rx_hash_dist(struct fsl_mc_io *mc_io, uint32_t cmd_flags, * * Only two custom values are accepted. If the function is called for the third * time it will return error. - * To replace an existing value use dpni_remove_custom_tpid() to remove - * a previous TPID and after that use again the function. + * To replace an existing value use dpni_remove_custom_tpid() to remove a + * previous TPID and after that use again the function. * * Return: '0' on Success; Error code otherwise. */ @@ -2769,7 +2779,7 @@ int dpni_add_custom_tpid(struct fsl_mc_io *mc_io, uint32_t cmd_flags, /** * dpni_remove_custom_tpid() - Removes a distinct Ethertype value added - * previously with dpni_add_custom_tpid() + * previously with dpni_add_custom_tpid() * @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 @@ -2798,8 +2808,8 @@ int dpni_remove_custom_tpid(struct fsl_mc_io *mc_io, uint32_t cmd_flags, } /** - * dpni_get_custom_tpid() - Returns custom TPID (vlan tags) values configured - * to detect 802.1q frames + * dpni_get_custom_tpid() - Returns custom TPID (vlan tags) values configured to + * detect 802.1q 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 diff --git a/drivers/net/dpaa2/mc/dprtc.c b/drivers/net/dpaa2/mc/dprtc.c index 42ac89150e..36e62eb0c3 100644 --- a/drivers/net/dpaa2/mc/dprtc.c +++ b/drivers/net/dpaa2/mc/dprtc.c @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) - * Copyright 2019 NXP + * Copyright 2019-2021 NXP */ #include #include @@ -521,3 +521,79 @@ int dprtc_get_api_version(struct fsl_mc_io *mc_io, return 0; } + +/** + * dprtc_get_ext_trigger_timestamp - Retrieve the Ext trigger timestamp status + * (timestamp + flag for unread timestamp in FIFO). + * + * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @token: Token of DPRTC object + * @id: External trigger id. + * @status: Returned object's external trigger status + * + * Return: '0' on Success; Error code otherwise. + */ +int dprtc_get_ext_trigger_timestamp(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint8_t id, + struct dprtc_ext_trigger_status *status) +{ + struct dprtc_rsp_ext_trigger_timestamp *rsp_params; + struct dprtc_cmd_ext_trigger_timestamp *cmd_params; + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPRTC_CMDID_GET_EXT_TRIGGER_TIMESTAMP, + cmd_flags, + token); + + cmd_params = (struct dprtc_cmd_ext_trigger_timestamp *)cmd.params; + cmd_params->id = id; + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + rsp_params = (struct dprtc_rsp_ext_trigger_timestamp *)cmd.params; + status->timestamp = le64_to_cpu(rsp_params->timestamp); + status->unread_valid_timestamp = rsp_params->unread_valid_timestamp; + + return 0; +} + +/** + * dprtc_set_fiper_loopback() - Set the fiper pulse as source of interrupt for + * External Trigger stamps + * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @token: Token of DPRTC object + * @id: External trigger id. + * @fiper_as_input: Bit used to control interrupt signal source: + * 0 = Normal operation, interrupt external source + * 1 = Fiper pulse is looped back into Trigger input + * + * Return: '0' on Success; Error code otherwise. + */ +int dprtc_set_fiper_loopback(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint8_t id, + uint8_t fiper_as_input) +{ + struct dprtc_ext_trigger_cfg *cmd_params; + struct mc_command cmd = { 0 }; + + cmd.header = mc_encode_cmd_header(DPRTC_CMDID_SET_FIPER_LOOPBACK, + cmd_flags, + token); + + cmd_params = (struct dprtc_ext_trigger_cfg *)cmd.params; + cmd_params->id = id; + cmd_params->fiper_as_input = fiper_as_input; + + return mc_send_command(mc_io, &cmd); +} diff --git a/drivers/net/dpaa2/mc/fsl_dpdmux.h b/drivers/net/dpaa2/mc/fsl_dpdmux.h index f4f9598a29..b01a98eb59 100644 --- a/drivers/net/dpaa2/mc/fsl_dpdmux.h +++ b/drivers/net/dpaa2/mc/fsl_dpdmux.h @@ -196,6 +196,12 @@ int dpdmux_set_max_frame_length(struct fsl_mc_io *mc_io, uint16_t token, uint16_t max_frame_length); +int dpdmux_get_max_frame_length(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint16_t if_id, + uint16_t *max_frame_length); + /** * enum dpdmux_counter_type - Counter types * @DPDMUX_CNT_ING_FRAME: Counts ingress frames diff --git a/drivers/net/dpaa2/mc/fsl_dpdmux_cmd.h b/drivers/net/dpaa2/mc/fsl_dpdmux_cmd.h index 2ab4d75dfb..f8a1b5b1ae 100644 --- a/drivers/net/dpaa2/mc/fsl_dpdmux_cmd.h +++ b/drivers/net/dpaa2/mc/fsl_dpdmux_cmd.h @@ -39,6 +39,7 @@ #define DPDMUX_CMDID_RESET DPDMUX_CMD(0x005) #define DPDMUX_CMDID_IS_ENABLED DPDMUX_CMD(0x006) #define DPDMUX_CMDID_SET_MAX_FRAME_LENGTH DPDMUX_CMD(0x0a1) +#define DPDMUX_CMDID_GET_MAX_FRAME_LENGTH DPDMUX_CMD(0x0a2) #define DPDMUX_CMDID_UL_RESET_COUNTERS DPDMUX_CMD(0x0a3) @@ -124,6 +125,14 @@ struct dpdmux_cmd_set_max_frame_length { uint16_t max_frame_length; }; +struct dpdmux_cmd_get_max_frame_len { + uint16_t if_id; +}; + +struct dpdmux_rsp_get_max_frame_len { + uint16_t max_len; +}; + #define DPDMUX_ACCEPTED_FRAMES_TYPE_SHIFT 0 #define DPDMUX_ACCEPTED_FRAMES_TYPE_SIZE 4 #define DPDMUX_UNACCEPTED_FRAMES_ACTION_SHIFT 4 diff --git a/drivers/net/dpaa2/mc/fsl_dpkg.h b/drivers/net/dpaa2/mc/fsl_dpkg.h index 02fe8d50e7..70f2339ea5 100644 --- a/drivers/net/dpaa2/mc/fsl_dpkg.h +++ b/drivers/net/dpaa2/mc/fsl_dpkg.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) * Copyright 2013-2015 Freescale Semiconductor Inc. - * Copyright 2016-2017 NXP + * Copyright 2016-2021 NXP * */ #ifndef __FSL_DPKG_H_ @@ -21,7 +21,7 @@ /** * Number of extractions per key profile */ -#define DPKG_MAX_NUM_OF_EXTRACTS 10 +#define DPKG_MAX_NUM_OF_EXTRACTS 20 /** * enum dpkg_extract_from_hdr_type - Selecting extraction by header types @@ -177,7 +177,7 @@ struct dpni_ext_set_rx_tc_dist { uint8_t num_extracts; uint8_t pad[7]; /* words 1..25 */ - struct dpni_dist_extract extracts[10]; + struct dpni_dist_extract extracts[DPKG_MAX_NUM_OF_EXTRACTS]; }; int dpkg_prepare_key_cfg(const struct dpkg_profile_cfg *cfg, diff --git a/drivers/net/dpaa2/mc/fsl_dpni.h b/drivers/net/dpaa2/mc/fsl_dpni.h index df42746c9a..34c6b20033 100644 --- a/drivers/net/dpaa2/mc/fsl_dpni.h +++ b/drivers/net/dpaa2/mc/fsl_dpni.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) * * Copyright 2013-2016 Freescale Semiconductor Inc. - * Copyright 2016-2020 NXP + * Copyright 2016-2021 NXP * */ #ifndef __FSL_DPNI_H @@ -19,6 +19,11 @@ struct fsl_mc_io; /** General DPNI macros */ +/** + * Maximum size of a key + */ +#define DPNI_MAX_KEY_SIZE 56 + /** * Maximum number of traffic classes */ @@ -95,8 +100,18 @@ struct fsl_mc_io; * Define a custom number of congestion groups */ #define DPNI_OPT_CUSTOM_CG 0x000200 - - +/** + * Define a custom number of order point records + */ +#define DPNI_OPT_CUSTOM_OPR 0x000400 +/** + * Hash key is shared between all traffic classes + */ +#define DPNI_OPT_SHARED_HASH_KEY 0x000800 +/** + * Flow steering table is shared between all traffic classes + */ +#define DPNI_OPT_SHARED_FS 0x001000 /** * Software sequence maximum layout size */ @@ -183,6 +198,8 @@ struct dpni_cfg { uint8_t num_rx_tcs; uint8_t qos_entries; uint8_t num_cgs; + uint16_t num_opr; + uint8_t dist_key_size; }; int dpni_create(struct fsl_mc_io *mc_io, @@ -366,28 +383,45 @@ int dpni_get_attributes(struct fsl_mc_io *mc_io, /** * Extract out of frame header error */ -#define DPNI_ERROR_EOFHE 0x00020000 +#define DPNI_ERROR_MS 0x40000000 +#define DPNI_ERROR_PTP 0x08000000 +/* Ethernet multicast frame */ +#define DPNI_ERROR_MC 0x04000000 +/* Ethernet broadcast frame */ +#define DPNI_ERROR_BC 0x02000000 +#define DPNI_ERROR_KSE 0x00040000 +#define DPNI_ERROR_EOFHE 0x00020000 +#define DPNI_ERROR_MNLE 0x00010000 +#define DPNI_ERROR_TIDE 0x00008000 +#define DPNI_ERROR_PIEE 0x00004000 /** * Frame length error */ -#define DPNI_ERROR_FLE 0x00002000 +#define DPNI_ERROR_FLE 0x00002000 /** * Frame physical error */ -#define DPNI_ERROR_FPE 0x00001000 +#define DPNI_ERROR_FPE 0x00001000 +#define DPNI_ERROR_PTE 0x00000080 +#define DPNI_ERROR_ISP 0x00000040 /** * Parsing header error */ -#define DPNI_ERROR_PHE 0x00000020 +#define DPNI_ERROR_PHE 0x00000020 + +#define DPNI_ERROR_BLE 0x00000010 /** * Parser L3 checksum error */ -#define DPNI_ERROR_L3CE 0x00000004 +#define DPNI_ERROR_L3CV 0x00000008 + +#define DPNI_ERROR_L3CE 0x00000004 /** - * Parser L3 checksum error + * Parser L4 checksum error */ -#define DPNI_ERROR_L4CE 0x00000001 +#define DPNI_ERROR_L4CV 0x00000002 +#define DPNI_ERROR_L4CE 0x00000001 /** * enum dpni_error_action - Defines DPNI behavior for errors * @DPNI_ERROR_ACTION_DISCARD: Discard the frame @@ -455,6 +489,10 @@ int dpni_set_errors_behavior(struct fsl_mc_io *mc_io, * 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 @@ -733,7 +771,7 @@ int dpni_get_link_state(struct fsl_mc_io *mc_io, /** * struct dpni_tx_shaping - Structure representing DPNI tx shaping configuration - * @rate_limit: Rate in Mbps + * @rate_limit: Rate in Mbits/s * @max_burst_size: Burst size in bytes (up to 64KB) */ struct dpni_tx_shaping_cfg { @@ -798,6 +836,11 @@ int dpni_get_primary_mac_addr(struct fsl_mc_io *mc_io, uint16_t token, uint8_t mac_addr[6]); +/** + * Set mac addr queue action + */ +#define DPNI_MAC_SET_QUEUE_ACTION 1 + int dpni_add_mac_addr(struct fsl_mc_io *mc_io, uint32_t cmd_flags, uint16_t token, @@ -1464,6 +1507,7 @@ int dpni_clear_qos_table(struct fsl_mc_io *mc_io, struct dpni_fs_action_cfg { uint64_t flc; uint16_t flow_id; + uint16_t redirect_obj_token; uint16_t options; }; @@ -1595,7 +1639,8 @@ int dpni_set_opr(struct fsl_mc_io *mc_io, uint8_t tc, uint8_t index, uint8_t options, - struct opr_cfg *cfg); + struct opr_cfg *cfg, + uint8_t opr_id); int dpni_get_opr(struct fsl_mc_io *mc_io, uint32_t cmd_flags, @@ -1603,7 +1648,9 @@ int dpni_get_opr(struct fsl_mc_io *mc_io, uint8_t tc, uint8_t index, struct opr_cfg *cfg, - struct opr_qry *qry); + struct opr_qry *qry, + uint8_t flags, + uint8_t opr_id); /** * When used for queue_idx in function dpni_set_rx_dist_default_queue will @@ -1779,14 +1826,57 @@ int dpni_get_sw_sequence_layout(struct fsl_mc_io *mc_io, /** * dpni_extract_sw_sequence_layout() - extract the software sequence layout - * @layout: software sequence layout - * @sw_sequence_layout_buf: Zeroed 264 bytes of memory before mapping it - * to DMA + * @layout: software sequence layout + * @sw_sequence_layout_buf:Zeroed 264 bytes of memory before mapping it to DMA * * This function has to be called after dpni_get_sw_sequence_layout - * */ void dpni_extract_sw_sequence_layout(struct dpni_sw_sequence_layout *layout, const uint8_t *sw_sequence_layout_buf); +/** + * struct dpni_ptp_cfg - configure single step PTP (IEEE 1588) + * @en: enable single step PTP. When enabled the PTPv1 functionality will + * not work. If the field is zero, offset and ch_update parameters + * will be ignored + * @offset: start offset from the beginning of the frame where timestamp + * field is found. The offset must respect all MAC headers, VLAN + * tags and other protocol headers + * @ch_update: when set UDP checksum will be updated inside packet + * @peer_delay: For peer-to-peer transparent clocks add this value to the + * correction field in addition to the transient time update. The + * value expresses nanoseconds. + */ +struct dpni_single_step_cfg { + uint8_t en; + uint8_t ch_update; + uint16_t offset; + uint32_t peer_delay; +}; + +int dpni_set_single_step_cfg(struct fsl_mc_io *mc_io, uint32_t cmd_flags, + uint16_t token, struct dpni_single_step_cfg *ptp_cfg); + +int dpni_get_single_step_cfg(struct fsl_mc_io *mc_io, uint32_t cmd_flags, + uint16_t token, struct dpni_single_step_cfg *ptp_cfg); + +/** + * loopback_en field is valid when calling function dpni_set_port_cfg + */ +#define DPNI_PORT_CFG_LOOPBACK 0x01 + +/** + * struct dpni_port_cfg - custom configuration for dpni physical port + * @loopback_en: port loopback enabled + */ +struct dpni_port_cfg { + int loopback_en; +}; + +int dpni_set_port_cfg(struct fsl_mc_io *mc_io, uint32_t cmd_flags, + uint16_t token, uint32_t flags, struct dpni_port_cfg *port_cfg); + +int dpni_get_port_cfg(struct fsl_mc_io *mc_io, uint32_t cmd_flags, + uint16_t token, struct dpni_port_cfg *port_cfg); + #endif /* __FSL_DPNI_H */ diff --git a/drivers/net/dpaa2/mc/fsl_dpni_cmd.h b/drivers/net/dpaa2/mc/fsl_dpni_cmd.h index c40090b8fe..6fbd93bb38 100644 --- a/drivers/net/dpaa2/mc/fsl_dpni_cmd.h +++ b/drivers/net/dpaa2/mc/fsl_dpni_cmd.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) * * Copyright 2013-2016 Freescale Semiconductor Inc. - * Copyright 2016-2020 NXP + * Copyright 2016-2021 NXP * */ #ifndef _FSL_DPNI_CMD_H @@ -9,21 +9,25 @@ /* DPNI Version */ #define DPNI_VER_MAJOR 7 -#define DPNI_VER_MINOR 13 +#define DPNI_VER_MINOR 17 #define DPNI_CMD_BASE_VERSION 1 #define DPNI_CMD_VERSION_2 2 #define DPNI_CMD_VERSION_3 3 +#define DPNI_CMD_VERSION_4 4 +#define DPNI_CMD_VERSION_5 5 #define DPNI_CMD_ID_OFFSET 4 #define DPNI_CMD(id) (((id) << DPNI_CMD_ID_OFFSET) | DPNI_CMD_BASE_VERSION) #define DPNI_CMD_V2(id) (((id) << DPNI_CMD_ID_OFFSET) | DPNI_CMD_VERSION_2) #define DPNI_CMD_V3(id) (((id) << DPNI_CMD_ID_OFFSET) | DPNI_CMD_VERSION_3) +#define DPNI_CMD_V4(id) (((id) << DPNI_CMD_ID_OFFSET) | DPNI_CMD_VERSION_4) +#define DPNI_CMD_V5(id) (((id) << DPNI_CMD_ID_OFFSET) | DPNI_CMD_VERSION_5) /* Command IDs */ #define DPNI_CMDID_OPEN DPNI_CMD(0x801) #define DPNI_CMDID_CLOSE DPNI_CMD(0x800) -#define DPNI_CMDID_CREATE DPNI_CMD_V3(0x901) +#define DPNI_CMDID_CREATE DPNI_CMD_V5(0x901) #define DPNI_CMDID_DESTROY DPNI_CMD(0x981) #define DPNI_CMDID_GET_API_VERSION DPNI_CMD(0xa01) @@ -67,7 +71,7 @@ #define DPNI_CMDID_REMOVE_VLAN_ID DPNI_CMD(0x232) #define DPNI_CMDID_CLR_VLAN_FILTERS DPNI_CMD(0x233) -#define DPNI_CMDID_SET_RX_TC_DIST DPNI_CMD_V3(0x235) +#define DPNI_CMDID_SET_RX_TC_DIST DPNI_CMD_V4(0x235) #define DPNI_CMDID_SET_RX_TC_POLICING DPNI_CMD(0x23E) @@ -75,7 +79,7 @@ #define DPNI_CMDID_ADD_QOS_ENT DPNI_CMD_V2(0x241) #define DPNI_CMDID_REMOVE_QOS_ENT DPNI_CMD(0x242) #define DPNI_CMDID_CLR_QOS_TBL DPNI_CMD(0x243) -#define DPNI_CMDID_ADD_FS_ENT DPNI_CMD(0x244) +#define DPNI_CMDID_ADD_FS_ENT DPNI_CMD_V2(0x244) #define DPNI_CMDID_REMOVE_FS_ENT DPNI_CMD(0x245) #define DPNI_CMDID_CLR_FS_ENT DPNI_CMD(0x246) @@ -140,7 +144,9 @@ struct dpni_cmd_create { uint16_t fs_entries; uint8_t num_rx_tcs; uint8_t pad4; - uint8_t num_cgs; + uint8_t num_cgs; + uint16_t num_opr; + uint8_t dist_key_size; }; struct dpni_cmd_destroy { @@ -411,8 +417,6 @@ struct dpni_rsp_get_port_mac_addr { uint8_t mac_addr[6]; }; -#define DPNI_MAC_SET_QUEUE_ACTION 1 - struct dpni_cmd_add_mac_addr { uint8_t flags; uint8_t pad; @@ -594,6 +598,7 @@ struct dpni_cmd_add_fs_entry { uint64_t key_iova; uint64_t mask_iova; uint64_t flc; + uint16_t redir_token; }; struct dpni_cmd_remove_fs_entry { @@ -779,7 +784,7 @@ struct dpni_rsp_get_congestion_notification { }; struct dpni_cmd_set_opr { - uint8_t pad0; + uint8_t opr_id; uint8_t tc_id; uint8_t index; uint8_t options; @@ -792,9 +797,10 @@ struct dpni_cmd_set_opr { }; struct dpni_cmd_get_opr { - uint8_t pad; + uint8_t flags; uint8_t tc_id; uint8_t index; + uint8_t opr_id; }; #define DPNI_RIP_SHIFT 0 @@ -911,5 +917,34 @@ struct dpni_sw_sequence_layout_entry { uint16_t pad; }; +#define DPNI_PTP_ENABLE_SHIFT 0 +#define DPNI_PTP_ENABLE_SIZE 1 +#define DPNI_PTP_CH_UPDATE_SHIFT 1 +#define DPNI_PTP_CH_UPDATE_SIZE 1 +struct dpni_cmd_single_step_cfg { + uint16_t flags; + uint16_t offset; + uint32_t peer_delay; +}; + +struct dpni_rsp_single_step_cfg { + uint16_t flags; + uint16_t offset; + uint32_t peer_delay; +}; + +#define DPNI_PORT_LOOPBACK_EN_SHIFT 0 +#define DPNI_PORT_LOOPBACK_EN_SIZE 1 + +struct dpni_cmd_set_port_cfg { + uint32_t flags; + uint32_t bit_params; +}; + +struct dpni_rsp_get_port_cfg { + uint32_t flags; + uint32_t bit_params; +}; + #pragma pack(pop) #endif /* _FSL_DPNI_CMD_H */ diff --git a/drivers/net/dpaa2/mc/fsl_dprtc.h b/drivers/net/dpaa2/mc/fsl_dprtc.h index 49edb5a050..84ab158444 100644 --- a/drivers/net/dpaa2/mc/fsl_dprtc.h +++ b/drivers/net/dpaa2/mc/fsl_dprtc.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) - * Copyright 2019 NXP + * Copyright 2019-2021 NXP */ #ifndef __FSL_DPRTC_H #define __FSL_DPRTC_H @@ -86,6 +86,23 @@ int dprtc_set_alarm(struct fsl_mc_io *mc_io, uint16_t token, uint64_t time); +struct dprtc_ext_trigger_status { + uint64_t timestamp; + uint8_t unread_valid_timestamp; +}; + +int dprtc_get_ext_trigger_timestamp(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint8_t id, + struct dprtc_ext_trigger_status *status); + +int dprtc_set_fiper_loopback(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint8_t id, + uint8_t fiper_as_input); + /** * struct dprtc_attr - Structure representing DPRTC attributes * @id: DPRTC object ID diff --git a/drivers/net/dpaa2/mc/fsl_dprtc_cmd.h b/drivers/net/dpaa2/mc/fsl_dprtc_cmd.h index eca12ff5ee..61aaa4daab 100644 --- a/drivers/net/dpaa2/mc/fsl_dprtc_cmd.h +++ b/drivers/net/dpaa2/mc/fsl_dprtc_cmd.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) - * Copyright 2019 NXP + * Copyright 2019-2021 NXP */ #include #ifndef _FSL_DPRTC_CMD_H @@ -7,13 +7,15 @@ /* DPRTC Version */ #define DPRTC_VER_MAJOR 2 -#define DPRTC_VER_MINOR 1 +#define DPRTC_VER_MINOR 3 /* Command versioning */ #define DPRTC_CMD_BASE_VERSION 1 +#define DPRTC_CMD_VERSION_2 2 #define DPRTC_CMD_ID_OFFSET 4 #define DPRTC_CMD(id) (((id) << DPRTC_CMD_ID_OFFSET) | DPRTC_CMD_BASE_VERSION) +#define DPRTC_CMD_V2(id) (((id) << DPRTC_CMD_ID_OFFSET) | DPRTC_CMD_VERSION_2) /* Command IDs */ #define DPRTC_CMDID_CLOSE DPRTC_CMD(0x800) @@ -39,6 +41,7 @@ #define DPRTC_CMDID_SET_EXT_TRIGGER DPRTC_CMD(0x1d8) #define DPRTC_CMDID_CLEAR_EXT_TRIGGER DPRTC_CMD(0x1d9) #define DPRTC_CMDID_GET_EXT_TRIGGER_TIMESTAMP DPRTC_CMD(0x1dA) +#define DPRTC_CMDID_SET_FIPER_LOOPBACK DPRTC_CMD(0x1dB) /* Macros for accessing command fields smaller than 1byte */ #define DPRTC_MASK(field) \ @@ -87,5 +90,23 @@ struct dprtc_rsp_get_api_version { uint16_t major; uint16_t minor; }; + +struct dprtc_cmd_ext_trigger_timestamp { + uint32_t pad; + uint8_t id; +}; + +struct dprtc_rsp_ext_trigger_timestamp { + uint8_t unread_valid_timestamp; + uint8_t pad1; + uint16_t pad2; + uint32_t pad3; + uint64_t timestamp; +}; + +struct dprtc_ext_trigger_cfg { + uint8_t id; + uint8_t fiper_as_input; +}; #pragma pack(pop) #endif /* _FSL_DPRTC_CMD_H */ -- 2.17.1