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 6CBE8A0350; Mon, 3 Jan 2022 11:01:40 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 783B041140; Mon, 3 Jan 2022 11:01:35 +0100 (CET) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by mails.dpdk.org (Postfix) with ESMTP id 915DF4003C for ; Mon, 3 Jan 2022 11:01:33 +0100 (CET) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 65EDB1A1F29; Mon, 3 Jan 2022 11:01:33 +0100 (CET) Received: from aprdc01srsp001v.ap-rdc01.nxp.com (aprdc01srsp001v.ap-rdc01.nxp.com [165.114.16.16]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 0DA261A0926; Mon, 3 Jan 2022 11:01:33 +0100 (CET) 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 F1967183AC4C; Mon, 3 Jan 2022 18:01:31 +0800 (+08) From: nipun.gupta@nxp.com To: dev@dpdk.org Cc: thomas@monjalon.net, ferruh.yigit@intel.com, hemant.agrawal@nxp.com, stephen@networkplumber.org, Nipun Gupta , Gagandeep Singh Subject: [PATCH v3 01/15] bus/fslmc: update MC to 10.29 Date: Mon, 3 Jan 2022 15:31:15 +0530 Message-Id: <20220103100129.23965-2-nipun.gupta@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220103100129.23965-1-nipun.gupta@nxp.com> References: <20211206121824.3493-1-nipun.gupta@nxp.com> <20220103100129.23965-1-nipun.gupta@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP 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 From: Nipun Gupta update MC firmware library version to 10.29 Signed-off-by: Nipun Gupta Signed-off-by: Gagandeep Singh --- drivers/bus/fslmc/mc/fsl_dpmng.h | 2 +- drivers/net/dpaa2/mc/dpdmux.c | 8 ++ drivers/net/dpaa2/mc/dpkg.c | 7 +- drivers/net/dpaa2/mc/dpni.c | 111 ++++++++++++++++++++------ drivers/net/dpaa2/mc/fsl_dpdmux.h | 3 + drivers/net/dpaa2/mc/fsl_dpdmux_cmd.h | 5 +- drivers/net/dpaa2/mc/fsl_dpni.h | 54 ++++++++++--- drivers/net/dpaa2/mc/fsl_dpni_cmd.h | 57 +++++++------ 8 files changed, 181 insertions(+), 66 deletions(-) diff --git a/drivers/bus/fslmc/mc/fsl_dpmng.h b/drivers/bus/fslmc/mc/fsl_dpmng.h index 7e9bd96429..073d47efbf 100644 --- a/drivers/bus/fslmc/mc/fsl_dpmng.h +++ b/drivers/bus/fslmc/mc/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 28 +#define MC_VER_MINOR 29 /** * struct mc_version diff --git a/drivers/net/dpaa2/mc/dpdmux.c b/drivers/net/dpaa2/mc/dpdmux.c index edbb01b45b..1bb153cad7 100644 --- a/drivers/net/dpaa2/mc/dpdmux.c +++ b/drivers/net/dpaa2/mc/dpdmux.c @@ -398,6 +398,9 @@ int dpdmux_get_attributes(struct fsl_mc_io *mc_io, attr->num_ifs = le16_to_cpu(rsp_params->num_ifs); attr->mem_size = le16_to_cpu(rsp_params->mem_size); attr->default_if = le16_to_cpu(rsp_params->default_if); + attr->max_dmat_entries = le16_to_cpu(rsp_params->max_dmat_entries); + attr->max_mc_groups = le16_to_cpu(rsp_params->max_mc_groups); + attr->max_vlan_ids = le16_to_cpu(rsp_params->max_vlan_ids); return 0; } @@ -470,6 +473,11 @@ int dpdmux_if_disable(struct fsl_mc_io *mc_io, * will be updated with the minimum value of the mfls of the connected * dpnis and the actual value of dmux mfl. * + * If dpdmux object is created using DPDMUX_OPT_AUTO_MAX_FRAME_LEN and maximum + * frame length is changed for a dpni connected to dpdmux interface the change + * is propagated through dpdmux interfaces and will overwrite the value set using + * this API. + * * Return: '0' on Success; Error code otherwise. */ int dpdmux_set_max_frame_length(struct fsl_mc_io *mc_io, diff --git a/drivers/net/dpaa2/mc/dpkg.c b/drivers/net/dpaa2/mc/dpkg.c index 1e171eedc7..4789976b7d 100644 --- a/drivers/net/dpaa2/mc/dpkg.c +++ b/drivers/net/dpaa2/mc/dpkg.c @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) * - * Copyright 2017 NXP + * Copyright 2017-2021 NXP * */ #include @@ -63,10 +63,7 @@ dpkg_prepare_key_cfg(const struct dpkg_profile_cfg *cfg, uint8_t *key_cfg_buf) dpkg_set_field(extr->extract_type, EXTRACT_TYPE, cfg->extracts[i].type); - if (extr->num_of_byte_masks > DPKG_NUM_OF_MASKS) - return -EINVAL; - - for (j = 0; j < extr->num_of_byte_masks; j++) { + for (j = 0; j < DPKG_NUM_OF_MASKS; j++) { extr->masks[j].mask = cfg->extracts[i].masks[j].mask; extr->masks[j].offset = cfg->extracts[i].masks[j].offset; diff --git a/drivers/net/dpaa2/mc/dpni.c b/drivers/net/dpaa2/mc/dpni.c index 60048d6c43..cf78295d90 100644 --- a/drivers/net/dpaa2/mc/dpni.c +++ b/drivers/net/dpaa2/mc/dpni.c @@ -128,6 +128,7 @@ int dpni_create(struct fsl_mc_io *mc_io, cmd_params->num_cgs = cfg->num_cgs; cmd_params->num_opr = cfg->num_opr; cmd_params->dist_key_size = cfg->dist_key_size; + cmd_params->num_channels = cfg->num_channels; /* send command to mc*/ err = mc_send_command(mc_io, &cmd); @@ -203,7 +204,7 @@ int dpni_set_pools(struct fsl_mc_io *mc_io, cmd_params = (struct dpni_cmd_set_pools *)cmd.params; cmd_params->num_dpbp = cfg->num_dpbp; cmd_params->pool_options = cfg->pool_options; - for (i = 0; i < cmd_params->num_dpbp; i++) { + for (i = 0; i < DPNI_MAX_DPBP; i++) { cmd_params->pool[i].dpbp_id = cpu_to_le16(cfg->pools[i].dpbp_id); cmd_params->pool[i].priority_mask = @@ -592,6 +593,7 @@ int dpni_get_attributes(struct fsl_mc_io *mc_io, attr->num_tx_tcs = rsp_params->num_tx_tcs; attr->mac_filter_entries = rsp_params->mac_filter_entries; attr->vlan_filter_entries = rsp_params->vlan_filter_entries; + attr->num_channels = rsp_params->num_channels; attr->qos_entries = rsp_params->qos_entries; attr->fs_entries = le16_to_cpu(rsp_params->fs_entries); attr->qos_key_size = rsp_params->qos_key_size; @@ -815,6 +817,9 @@ int dpni_get_offload(struct fsl_mc_io *mc_io, * in all enqueue operations * * Return: '0' on Success; Error code otherwise. + * + * If dpni object is created using multiple Tc channels this function will return + * qdid value for the first channel */ int dpni_get_qdid(struct fsl_mc_io *mc_io, uint32_t cmd_flags, @@ -958,7 +963,12 @@ int dpni_get_link_state(struct fsl_mc_io *mc_io, * @token: Token of DPNI object * @tx_cr_shaper: TX committed rate shaping configuration * @tx_er_shaper: TX excess rate shaping configuration - * @coupled: Committed and excess rate shapers are coupled + * @param: Special parameters + * bit0: Committed and excess rates are coupled + * bit1: 1 modify LNI shaper, 0 modify channel shaper + * bit8-15: Tx channel to be shaped. Used only if bit1 is set to zero + * bits16-26: OAL (Overhead accounting length 11bit value). Used only + * when bit1 is set. * * Return: '0' on Success; Error code otherwise. */ @@ -967,10 +977,13 @@ int dpni_set_tx_shaping(struct fsl_mc_io *mc_io, uint16_t token, const struct dpni_tx_shaping_cfg *tx_cr_shaper, const struct dpni_tx_shaping_cfg *tx_er_shaper, - int coupled) + uint32_t param) { struct dpni_cmd_set_tx_shaping *cmd_params; struct mc_command cmd = { 0 }; + int coupled, lni_shaper; + uint8_t channel_id; + uint16_t oal; /* prepare command */ cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_TX_SHAPING, @@ -985,7 +998,18 @@ int dpni_set_tx_shaping(struct fsl_mc_io *mc_io, cpu_to_le32(tx_cr_shaper->rate_limit); cmd_params->tx_er_rate_limit = cpu_to_le32(tx_er_shaper->rate_limit); - dpni_set_field(cmd_params->coupled, COUPLED, coupled); + + coupled = !!(param & 0x01); + dpni_set_field(cmd_params->options, COUPLED, coupled); + + lni_shaper = !!((param >> 1) & 0x01); + dpni_set_field(cmd_params->options, LNI_SHAPER, lni_shaper); + + channel_id = (param >> 8) & 0xff; + cmd_params->channel_id = channel_id; + + oal = (param >> 16) & 0x7FF; + cmd_params->oal = cpu_to_le16(oal); /* send command to mc*/ return mc_send_command(mc_io, &cmd); @@ -1543,6 +1567,7 @@ int dpni_set_tx_priorities(struct fsl_mc_io *mc_io, cmd_flags, token); cmd_params = (struct dpni_cmd_set_tx_priorities *)cmd.params; + cmd_params->channel_idx = cfg->channel_idx; dpni_set_field(cmd_params->flags, SEPARATE_GRP, cfg->separate_groups); @@ -2053,7 +2078,13 @@ void dpni_extract_early_drop(struct dpni_early_drop_cfg *cfg, * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @qtype: Type of queue - only Rx and Tx types are supported - * @tc_id: Traffic class selection (0-7) + * @param: Traffic class and channel ID. + * MSB - channel id; used only for DPNI_QUEUE_TX and DPNI_QUEUE_TX_CONFIRM, + * ignored for the rest + * LSB - traffic class + * Use macro DPNI_BUILD_PARAM() to build correct value. + * If dpni uses a single channel (uses only channel zero) the parameter can receive + * traffic class directly. * @early_drop_iova: I/O virtual address of 256 bytes DMA-able memory filled * with the early-drop configuration by calling dpni_prepare_early_drop() * @@ -2066,7 +2097,7 @@ int dpni_set_early_drop(struct fsl_mc_io *mc_io, uint32_t cmd_flags, uint16_t token, enum dpni_queue_type qtype, - uint8_t tc_id, + uint16_t param, uint64_t early_drop_iova) { struct dpni_cmd_early_drop *cmd_params; @@ -2078,7 +2109,8 @@ int dpni_set_early_drop(struct fsl_mc_io *mc_io, token); cmd_params = (struct dpni_cmd_early_drop *)cmd.params; cmd_params->qtype = qtype; - cmd_params->tc = tc_id; + cmd_params->tc = (uint8_t)(param & 0xff); + cmd_params->channel_id = (uint8_t)((param >> 8) & 0xff); cmd_params->early_drop_iova = cpu_to_le64(early_drop_iova); /* send command to mc*/ @@ -2091,7 +2123,13 @@ int dpni_set_early_drop(struct fsl_mc_io *mc_io, * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @qtype: Type of queue - only Rx and Tx types are supported - * @tc_id: Traffic class selection (0-7) + * @param: Traffic class and channel ID. + * MSB - channel id; used only for DPNI_QUEUE_TX and DPNI_QUEUE_TX_CONFIRM, + * ignored for the rest + * LSB - traffic class + * Use macro DPNI_BUILD_PARAM() to build correct value. + * If dpni uses a single channel (uses only channel zero) the parameter can receive + * traffic class directly. * @early_drop_iova: I/O virtual address of 256 bytes DMA-able memory * * warning: After calling this function, call dpni_extract_early_drop() to @@ -2103,7 +2141,7 @@ int dpni_get_early_drop(struct fsl_mc_io *mc_io, uint32_t cmd_flags, uint16_t token, enum dpni_queue_type qtype, - uint8_t tc_id, + uint16_t param, uint64_t early_drop_iova) { struct dpni_cmd_early_drop *cmd_params; @@ -2115,7 +2153,8 @@ int dpni_get_early_drop(struct fsl_mc_io *mc_io, token); cmd_params = (struct dpni_cmd_early_drop *)cmd.params; cmd_params->qtype = qtype; - cmd_params->tc = tc_id; + cmd_params->tc = (uint8_t)(param & 0xff); + cmd_params->channel_id = (uint8_t)((param >> 8) & 0xff); cmd_params->early_drop_iova = cpu_to_le64(early_drop_iova); /* send command to mc*/ @@ -2138,8 +2177,8 @@ int dpni_set_congestion_notification(struct fsl_mc_io *mc_io, uint32_t cmd_flags, uint16_t token, enum dpni_queue_type qtype, - uint8_t tc_id, - const struct dpni_congestion_notification_cfg *cfg) + uint16_t param, + const struct dpni_congestion_notification_cfg *cfg) { struct dpni_cmd_set_congestion_notification *cmd_params; struct mc_command cmd = { 0 }; @@ -2151,7 +2190,8 @@ int dpni_set_congestion_notification(struct fsl_mc_io *mc_io, token); cmd_params = (struct dpni_cmd_set_congestion_notification *)cmd.params; cmd_params->qtype = qtype; - cmd_params->tc = tc_id; + cmd_params->tc = (uint8_t)(param & 0xff); + cmd_params->channel_id = (uint8_t)((param >> 8) & 0xff); cmd_params->congestion_point = cfg->cg_point; cmd_params->cgid = (uint8_t)cfg->cgid; cmd_params->dest_id = cpu_to_le32(cfg->dest_cfg.dest_id); @@ -2179,7 +2219,8 @@ int dpni_set_congestion_notification(struct fsl_mc_io *mc_io, * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @qtype: Type of queue - Rx, Tx and Tx confirm types are supported - * @tc_id: Traffic class selection (0-7) + * @param: Traffic class and channel. Bits[0-7] contain traaffic class, + * byte[8-15] contains channel id * @cfg: congestion notification configuration * * Return: '0' on Success; error code otherwise. @@ -2188,8 +2229,8 @@ int dpni_get_congestion_notification(struct fsl_mc_io *mc_io, uint32_t cmd_flags, uint16_t token, enum dpni_queue_type qtype, - uint8_t tc_id, - struct dpni_congestion_notification_cfg *cfg) + uint16_t param, + struct dpni_congestion_notification_cfg *cfg) { struct dpni_rsp_get_congestion_notification *rsp_params; struct dpni_cmd_get_congestion_notification *cmd_params; @@ -2203,7 +2244,8 @@ int dpni_get_congestion_notification(struct fsl_mc_io *mc_io, token); cmd_params = (struct dpni_cmd_get_congestion_notification *)cmd.params; cmd_params->qtype = qtype; - cmd_params->tc = tc_id; + cmd_params->tc = (uint8_t)(param & 0xff); + cmd_params->channel_id = (uint8_t)((param >> 8) & 0xff); cmd_params->congestion_point = cfg->cg_point; cmd_params->cgid = cfg->cgid; @@ -2280,7 +2322,7 @@ int dpni_set_queue(struct fsl_mc_io *mc_io, uint32_t cmd_flags, uint16_t token, enum dpni_queue_type qtype, - uint8_t tc, + uint16_t param, uint8_t index, uint8_t options, const struct dpni_queue *queue) @@ -2294,7 +2336,8 @@ int dpni_set_queue(struct fsl_mc_io *mc_io, token); cmd_params = (struct dpni_cmd_set_queue *)cmd.params; cmd_params->qtype = qtype; - cmd_params->tc = tc; + cmd_params->tc = (uint8_t)(param & 0xff); + cmd_params->channel_id = (uint8_t)((param >> 8) & 0xff); cmd_params->index = index; cmd_params->options = options; cmd_params->dest_id = cpu_to_le32(queue->destination.id); @@ -2317,7 +2360,13 @@ int dpni_set_queue(struct fsl_mc_io *mc_io, * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' * @token: Token of DPNI object * @qtype: Type of queue - all queue types are supported - * @tc: Traffic class, in range 0 to NUM_TCS - 1 + * @param: Traffic class and channel ID. + * MSB - channel id; used only for DPNI_QUEUE_TX and DPNI_QUEUE_TX_CONFIRM, + * ignored for the rest + * LSB - traffic class + * Use macro DPNI_BUILD_PARAM() to build correct value. + * If dpni uses a single channel (uses only channel zero) the parameter can receive + * traffic class directly. * @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 configuration structure @@ -2329,7 +2378,7 @@ int dpni_get_queue(struct fsl_mc_io *mc_io, uint32_t cmd_flags, uint16_t token, enum dpni_queue_type qtype, - uint8_t tc, + uint16_t param, uint8_t index, struct dpni_queue *queue, struct dpni_queue_id *qid) @@ -2345,8 +2394,9 @@ int dpni_get_queue(struct fsl_mc_io *mc_io, token); cmd_params = (struct dpni_cmd_get_queue *)cmd.params; cmd_params->qtype = qtype; - cmd_params->tc = tc; + cmd_params->tc = (uint8_t)(param & 0xff); cmd_params->index = index; + cmd_params->channel_id = (uint8_t)((param >> 8) & 0xff); /* send command to mc */ err = mc_send_command(mc_io, &cmd); @@ -2382,8 +2432,16 @@ int dpni_get_queue(struct fsl_mc_io *mc_io, * @token: Token of DPNI object * @page: Selects the statistics page to retrieve, see * DPNI_GET_STATISTICS output. Pages are numbered 0 to 6. - * @param: Custom parameter for some pages used to select - * a certain statistic source, for example the TC. + * @param: Custom parameter for some pages used to select + * a certain statistic source, for example the TC. + * - page_0: not used + * - page_1: not used + * - page_2: not used + * - page_3: high_byte - channel_id, low_byte - traffic class + * - page_4: high_byte - queue_index have meaning only if dpni is + * created using option DPNI_OPT_CUSTOM_CG, low_byte - traffic class + * - page_5: not used + * - page_6: not used * @stat: Structure containing the statistics * * Return: '0' on Success; Error code otherwise. @@ -2471,7 +2529,7 @@ int dpni_set_taildrop(struct fsl_mc_io *mc_io, uint16_t token, enum dpni_congestion_point cg_point, enum dpni_queue_type qtype, - uint8_t tc, + uint16_t param, uint8_t index, struct dpni_taildrop *taildrop) { @@ -2485,7 +2543,8 @@ int dpni_set_taildrop(struct fsl_mc_io *mc_io, cmd_params = (struct dpni_cmd_set_taildrop *)cmd.params; cmd_params->congestion_point = cg_point; cmd_params->qtype = qtype; - cmd_params->tc = tc; + cmd_params->tc = (uint8_t)(param & 0xff); + cmd_params->channel_id = (uint8_t)((param >> 8) & 0xff); cmd_params->index = index; cmd_params->units = taildrop->units; cmd_params->threshold = cpu_to_le32(taildrop->threshold); diff --git a/drivers/net/dpaa2/mc/fsl_dpdmux.h b/drivers/net/dpaa2/mc/fsl_dpdmux.h index b01a98eb59..4600ea94d4 100644 --- a/drivers/net/dpaa2/mc/fsl_dpdmux.h +++ b/drivers/net/dpaa2/mc/fsl_dpdmux.h @@ -184,6 +184,9 @@ struct dpdmux_attr { uint16_t num_ifs; uint16_t mem_size; uint16_t default_if; + uint16_t max_dmat_entries; + uint16_t max_mc_groups; + uint16_t max_vlan_ids; }; int dpdmux_get_attributes(struct fsl_mc_io *mc_io, diff --git a/drivers/net/dpaa2/mc/fsl_dpdmux_cmd.h b/drivers/net/dpaa2/mc/fsl_dpdmux_cmd.h index f8a1b5b1ae..bf6b8a20d1 100644 --- a/drivers/net/dpaa2/mc/fsl_dpdmux_cmd.h +++ b/drivers/net/dpaa2/mc/fsl_dpdmux_cmd.h @@ -35,7 +35,7 @@ #define DPDMUX_CMDID_ENABLE DPDMUX_CMD(0x002) #define DPDMUX_CMDID_DISABLE DPDMUX_CMD(0x003) -#define DPDMUX_CMDID_GET_ATTR DPDMUX_CMD_V2(0x004) +#define DPDMUX_CMDID_GET_ATTR DPDMUX_CMD_V3(0x004) #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) @@ -119,6 +119,9 @@ struct dpdmux_rsp_get_attr { uint32_t pad2; uint64_t options; + uint16_t max_dmat_entries; + uint16_t max_mc_groups; + uint16_t max_vlan_ids; }; struct dpdmux_cmd_set_max_frame_length { diff --git a/drivers/net/dpaa2/mc/fsl_dpni.h b/drivers/net/dpaa2/mc/fsl_dpni.h index 469ab9b3d4..8aead28261 100644 --- a/drivers/net/dpaa2/mc/fsl_dpni.h +++ b/drivers/net/dpaa2/mc/fsl_dpni.h @@ -36,6 +36,10 @@ struct fsl_mc_io; * Maximum number of storage-profiles per DPNI */ #define DPNI_MAX_SP 2 +/** + * Maximum number of Tx channels per DPNI + */ +#define DPNI_MAX_CHANNELS 16 /** * All traffic classes considered; see dpni_set_queue() @@ -117,6 +121,13 @@ struct fsl_mc_io; */ #define DPNI_SW_SEQUENCE_LAYOUT_SIZE 33 +/** + * Build a parameter from dpni channel and trafiic class. This parameter + * will be used to configure / query information from dpni objects created + * to support multiple channels. + */ +#define DPNI_BUILD_PARAM(channel, tc_id) (((channel) << 8) | (tc_id)) + int dpni_open(struct fsl_mc_io *mc_io, uint32_t cmd_flags, int dpni_id, @@ -187,6 +198,8 @@ int dpni_close(struct fsl_mc_io *mc_io, * 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_cfg { uint32_t options; @@ -200,6 +213,7 @@ struct dpni_cfg { uint8_t num_cgs; uint16_t num_opr; uint8_t dist_key_size; + uint8_t num_channels; }; int dpni_create(struct fsl_mc_io *mc_io, @@ -362,6 +376,7 @@ struct dpni_attr { uint8_t fs_key_size; uint16_t wriop_version; uint8_t num_cgs; + uint8_t num_channels; }; int dpni_get_attributes(struct fsl_mc_io *mc_io, @@ -779,12 +794,29 @@ struct dpni_tx_shaping_cfg { uint16_t max_burst_size; }; +/** + * Build the parameter for dpni_set_tx_shaping() call + * @oal: Overhead accounting length. 11bit value added to the size of + * each frame. Used only for LNI shaping. If set to zero, will use default + * value of 24. Ignored if shaping_lni is set to zero. + * @shaping_lni: 1 for LNI shaping (configure whole throughput of the dpni object) + * 0 for channel shaping (configure shaping for individual channels) + * Set to one only if dpni is connected to a dpmac object. + * @channel_id: Channel to be configured. Ignored shaping_lni is set to 1 + * @coupled: Committed and excess rates are coupled + */ +#define DPNI_TX_SHAPING_PARAM(oal, shaping_lni, channel_id, coupled) ( \ + ((uint32_t)(((oal) & 0x7ff) << 16)) | \ + ((uint32_t)((channel_id) & 0xff) << 8) | \ + ((uint32_t)(!!shaping_lni) << 1) | \ + ((uint32_t)!!coupled)) + int dpni_set_tx_shaping(struct fsl_mc_io *mc_io, uint32_t cmd_flags, uint16_t token, const struct dpni_tx_shaping_cfg *tx_cr_shaper, const struct dpni_tx_shaping_cfg *tx_er_shaper, - int coupled); + uint32_t param); int dpni_set_max_frame_length(struct fsl_mc_io *mc_io, uint32_t cmd_flags, @@ -918,12 +950,14 @@ struct dpni_tx_schedule_cfg { /** * struct dpni_tx_priorities_cfg - Structure representing transmission * priorities for DPNI TCs + * @channel_idx: channel to perform the configuration * @tc_sched: An array of traffic-classes * @prio_group_A: Priority of group A * @prio_group_B: Priority of group B * @separate_groups: Treat A and B groups as separate */ struct dpni_tx_priorities_cfg { + uint8_t channel_idx; struct dpni_tx_schedule_cfg tc_sched[DPNI_MAX_TC]; uint32_t prio_group_A; uint32_t prio_group_B; @@ -1155,14 +1189,14 @@ int dpni_set_early_drop(struct fsl_mc_io *mc_io, uint32_t cmd_flags, uint16_t token, enum dpni_queue_type qtype, - uint8_t tc_id, + uint16_t param, uint64_t early_drop_iova); int dpni_get_early_drop(struct fsl_mc_io *mc_io, uint32_t cmd_flags, uint16_t token, enum dpni_queue_type qtype, - uint8_t tc_id, + uint16_t param, uint64_t early_drop_iova); /** @@ -1290,15 +1324,15 @@ int dpni_set_congestion_notification(struct fsl_mc_io *mc_io, uint32_t cmd_flags, uint16_t token, enum dpni_queue_type qtype, - uint8_t tc_id, - const struct dpni_congestion_notification_cfg *cfg); + uint16_t param, + const struct dpni_congestion_notification_cfg *cfg); int dpni_get_congestion_notification(struct fsl_mc_io *mc_io, uint32_t cmd_flags, uint16_t token, enum dpni_queue_type qtype, - uint8_t tc_id, - struct dpni_congestion_notification_cfg *cfg); + uint16_t param, + struct dpni_congestion_notification_cfg *cfg); /* DPNI FLC stash options */ @@ -1590,7 +1624,7 @@ int dpni_set_queue(struct fsl_mc_io *mc_io, uint32_t cmd_flags, uint16_t token, enum dpni_queue_type qtype, - uint8_t tc, + uint16_t param, uint8_t index, uint8_t options, const struct dpni_queue *queue); @@ -1599,7 +1633,7 @@ int dpni_get_queue(struct fsl_mc_io *mc_io, uint32_t cmd_flags, uint16_t token, enum dpni_queue_type qtype, - uint8_t tc, + uint16_t param, uint8_t index, struct dpni_queue *queue, struct dpni_queue_id *qid); @@ -1643,7 +1677,7 @@ int dpni_set_taildrop(struct fsl_mc_io *mc_io, uint16_t token, enum dpni_congestion_point cg_point, enum dpni_queue_type q_type, - uint8_t tc, + uint16_t param, uint8_t q_index, struct dpni_taildrop *taildrop); diff --git a/drivers/net/dpaa2/mc/fsl_dpni_cmd.h b/drivers/net/dpaa2/mc/fsl_dpni_cmd.h index 6fbd93bb38..8bff2ec9af 100644 --- a/drivers/net/dpaa2/mc/fsl_dpni_cmd.h +++ b/drivers/net/dpaa2/mc/fsl_dpni_cmd.h @@ -8,14 +8,15 @@ #define _FSL_DPNI_CMD_H /* DPNI Version */ -#define DPNI_VER_MAJOR 7 -#define DPNI_VER_MINOR 17 +#define DPNI_VER_MAJOR 8 +#define DPNI_VER_MINOR 0 #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_VERSION_6 6 #define DPNI_CMD_ID_OFFSET 4 #define DPNI_CMD(id) (((id) << DPNI_CMD_ID_OFFSET) | DPNI_CMD_BASE_VERSION) @@ -23,17 +24,18 @@ #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) +#define DPNI_CMD_V6(id) (((id) << DPNI_CMD_ID_OFFSET) | DPNI_CMD_VERSION_6) /* Command IDs */ #define DPNI_CMDID_OPEN DPNI_CMD(0x801) #define DPNI_CMDID_CLOSE DPNI_CMD(0x800) -#define DPNI_CMDID_CREATE DPNI_CMD_V5(0x901) +#define DPNI_CMDID_CREATE DPNI_CMD_V6(0x901) #define DPNI_CMDID_DESTROY DPNI_CMD(0x981) #define DPNI_CMDID_GET_API_VERSION DPNI_CMD(0xa01) #define DPNI_CMDID_ENABLE DPNI_CMD(0x002) #define DPNI_CMDID_DISABLE DPNI_CMD(0x003) -#define DPNI_CMDID_GET_ATTR DPNI_CMD_V3(0x004) +#define DPNI_CMDID_GET_ATTR DPNI_CMD_V4(0x004) #define DPNI_CMDID_RESET DPNI_CMD(0x005) #define DPNI_CMDID_IS_ENABLED DPNI_CMD(0x006) @@ -54,7 +56,7 @@ #define DPNI_CMDID_SET_MAX_FRAME_LENGTH DPNI_CMD(0x216) #define DPNI_CMDID_GET_MAX_FRAME_LENGTH DPNI_CMD(0x217) #define DPNI_CMDID_SET_LINK_CFG DPNI_CMD_V2(0x21A) -#define DPNI_CMDID_SET_TX_SHAPING DPNI_CMD_V2(0x21B) +#define DPNI_CMDID_SET_TX_SHAPING DPNI_CMD_V3(0x21B) #define DPNI_CMDID_SET_MCAST_PROMISC DPNI_CMD(0x220) #define DPNI_CMDID_GET_MCAST_PROMISC DPNI_CMD(0x221) @@ -83,25 +85,25 @@ #define DPNI_CMDID_REMOVE_FS_ENT DPNI_CMD(0x245) #define DPNI_CMDID_CLR_FS_ENT DPNI_CMD(0x246) -#define DPNI_CMDID_SET_TX_PRIORITIES DPNI_CMD_V2(0x250) +#define DPNI_CMDID_SET_TX_PRIORITIES DPNI_CMD_V3(0x250) #define DPNI_CMDID_GET_RX_TC_POLICING DPNI_CMD(0x251) -#define DPNI_CMDID_GET_STATISTICS DPNI_CMD_V3(0x25D) +#define DPNI_CMDID_GET_STATISTICS DPNI_CMD_V4(0x25D) #define DPNI_CMDID_RESET_STATISTICS DPNI_CMD(0x25E) -#define DPNI_CMDID_GET_QUEUE DPNI_CMD_V2(0x25F) -#define DPNI_CMDID_SET_QUEUE DPNI_CMD_V2(0x260) +#define DPNI_CMDID_GET_QUEUE DPNI_CMD_V3(0x25F) +#define DPNI_CMDID_SET_QUEUE DPNI_CMD_V3(0x260) #define DPNI_CMDID_GET_TAILDROP DPNI_CMD_V2(0x261) -#define DPNI_CMDID_SET_TAILDROP DPNI_CMD_V2(0x262) +#define DPNI_CMDID_SET_TAILDROP DPNI_CMD_V3(0x262) #define DPNI_CMDID_GET_PORT_MAC_ADDR DPNI_CMD(0x263) #define DPNI_CMDID_GET_BUFFER_LAYOUT DPNI_CMD_V2(0x264) #define DPNI_CMDID_SET_BUFFER_LAYOUT DPNI_CMD_V2(0x265) -#define DPNI_CMDID_SET_CONGESTION_NOTIFICATION DPNI_CMD_V2(0x267) -#define DPNI_CMDID_GET_CONGESTION_NOTIFICATION DPNI_CMD_V2(0x268) -#define DPNI_CMDID_SET_EARLY_DROP DPNI_CMD_V2(0x269) -#define DPNI_CMDID_GET_EARLY_DROP DPNI_CMD_V2(0x26A) +#define DPNI_CMDID_SET_CONGESTION_NOTIFICATION DPNI_CMD_V3(0x267) +#define DPNI_CMDID_GET_CONGESTION_NOTIFICATION DPNI_CMD_V3(0x268) +#define DPNI_CMDID_SET_EARLY_DROP DPNI_CMD_V3(0x269) +#define DPNI_CMDID_GET_EARLY_DROP DPNI_CMD_V3(0x26A) #define DPNI_CMDID_GET_OFFLOAD DPNI_CMD(0x26B) #define DPNI_CMDID_SET_OFFLOAD DPNI_CMD(0x26C) #define DPNI_CMDID_SET_TX_CONFIRMATION_MODE DPNI_CMD(0x266) @@ -136,7 +138,7 @@ struct dpni_cmd_create { uint8_t num_queues; uint8_t num_tcs; uint8_t mac_filter_entries; - uint8_t pad1; + uint8_t num_channels; uint8_t vlan_filter_entries; uint8_t pad2; uint8_t qos_entries; @@ -230,7 +232,7 @@ struct dpni_rsp_get_attr { uint8_t num_tx_tcs; /* response word 1 */ uint8_t vlan_filter_entries; - uint8_t pad1; + uint8_t num_channels; uint8_t qos_entries; uint8_t pad2; uint16_t fs_entries; @@ -367,6 +369,8 @@ struct dpni_rsp_get_link_state { #define DPNI_COUPLED_SHIFT 0 #define DPNI_COUPLED_SIZE 1 +#define DPNI_LNI_SHAPER_SHIFT 1 +#define DPNI_LNI_SHAPER_SIZE 1 struct dpni_cmd_set_tx_shaping { uint16_t tx_cr_max_burst_size; @@ -374,8 +378,10 @@ struct dpni_cmd_set_tx_shaping { uint32_t pad; uint32_t tx_cr_rate_limit; uint32_t tx_er_rate_limit; - /* from LSB: coupled:1 */ - uint8_t coupled; + /* from LSB: coupled:1, lni_shaper: 1*/ + uint8_t options; + uint8_t channel_id; + uint16_t oal; }; struct dpni_cmd_set_max_frame_length { @@ -466,7 +472,8 @@ struct dpni_cmd_set_tx_priorities { uint16_t flags; uint8_t prio_group_A; uint8_t prio_group_B; - uint32_t pad0; + uint8_t channel_idx; + uint8_t pad0[3]; uint8_t modes[4]; uint32_t pad1; uint64_t pad2; @@ -499,6 +506,7 @@ struct dpni_cmd_get_queue { uint8_t qtype; uint8_t tc; uint8_t index; + uint8_t channel_id; }; #define DPNI_DEST_TYPE_SHIFT 0 @@ -551,6 +559,7 @@ struct dpni_cmd_set_queue { uint64_t user_context; /* cmd word 4 */ uint8_t cgid; + uint8_t channel_id; }; #define DPNI_DISCARD_ON_MISS_SHIFT 0 @@ -683,7 +692,8 @@ struct dpni_early_drop { struct dpni_cmd_early_drop { uint8_t qtype; uint8_t tc; - uint8_t pad[6]; + uint8_t channel_id; + uint8_t pad[5]; uint64_t early_drop_iova; }; @@ -723,7 +733,8 @@ struct dpni_cmd_set_taildrop { uint8_t qtype; uint8_t tc; uint8_t index; - uint32_t pad0; + uint8_t channel_id; + uint8_t pad0[3]; /* cmd word 1 */ /* from LSB: enable:1 oal_lo:7 */ uint8_t enable_oal_lo; @@ -747,7 +758,7 @@ struct dpni_tx_confirmation_mode { struct dpni_cmd_set_congestion_notification { uint8_t qtype; uint8_t tc; - uint8_t pad; + uint8_t channel_id; uint8_t congestion_point; uint8_t cgid; uint8_t pad2[3]; @@ -765,7 +776,7 @@ struct dpni_cmd_set_congestion_notification { struct dpni_cmd_get_congestion_notification { uint8_t qtype; uint8_t tc; - uint8_t pad; + uint8_t channel_id; uint8_t congestion_point; uint8_t cgid; }; -- 2.17.1