From patchwork Sat Oct 17 06:27:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Venkat Duvvuru X-Patchwork-Id: 81186 X-Patchwork-Delegate: ajit.khaparde@broadcom.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4CC89A04DB; Sat, 17 Oct 2020 08:29:46 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 28010E2F5; Sat, 17 Oct 2020 08:28:24 +0200 (CEST) Received: from relay.smtp-ext.broadcom.com (unknown [192.19.221.30]) by dpdk.org (Postfix) with ESMTP id B062CC9B8 for ; Sat, 17 Oct 2020 08:28:13 +0200 (CEST) Received: from S60.dhcp.broadcom.net (unknown [10.123.66.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by relay.smtp-ext.broadcom.com (Postfix) with ESMTPS id 7364D82CE7; Fri, 16 Oct 2020 23:28:12 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com 7364D82CE7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1602916092; bh=lULk0YiTcAj5Q1ukY3OF06iCBiZE2N9m6dwh+mkOoJY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Jts6AcAy++retSWfFlqux+06+J46z1KR7f7HRxsKa5ZJfEnoGR4FHdnege7EsEo9E zZ5bRcYYVmLJS0qYgHd02XN1TNl38s5Kprp3bTXaFSFC4Kb5toE4J5O1Lsl0maEDQj A8g1O/MAF2rpu+hnKZB13i1tvWI3TTS9/f+ofX/4= From: Venkat Duvvuru To: dev@dpdk.org Cc: Farah Smith Date: Sat, 17 Oct 2020 11:57:59 +0530 Message-Id: <1602916089-18576-5-git-send-email-venkatkumar.duvvuru@broadcom.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1602916089-18576-1-git-send-email-venkatkumar.duvvuru@broadcom.com> References: <1602916089-18576-1-git-send-email-venkatkumar.duvvuru@broadcom.com> Subject: [dpdk-dev] [PATCH 04/14] net/bnxt: map table scope API X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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: Farah Smith New API to map a PARIF to an EEM table scope (set of rx and tx EEM base addresses). Uses HWRM_TF_GLOBAL_CFG_SET HWRM to configure. Adjustments to tf_global_cfg_set() to reduce overhead and nominal name clarification. Signed-off-by: Farah Smith Reviewed-by: Randy Schacher --- drivers/net/bnxt/tf_core/tf_core.c | 54 +++++++++++++++----- drivers/net/bnxt/tf_core/tf_core.h | 55 +++++++++++++++++--- drivers/net/bnxt/tf_core/tf_device.h | 43 +++++++++++++++- drivers/net/bnxt/tf_core/tf_device_p4.c | 44 ++++++++++++++++ drivers/net/bnxt/tf_core/tf_em.h | 19 ++++++- drivers/net/bnxt/tf_core/tf_em_common.c | 88 ++++++++++++++++++++++++++++++++ drivers/net/bnxt/tf_core/tf_global_cfg.c | 4 +- drivers/net/bnxt/tf_core/tf_global_cfg.h | 42 ++++----------- drivers/net/bnxt/tf_core/tf_msg.c | 13 ++++- drivers/net/bnxt/tf_core/tf_msg.h | 4 +- 10 files changed, 304 insertions(+), 62 deletions(-) diff --git a/drivers/net/bnxt/tf_core/tf_core.c b/drivers/net/bnxt/tf_core/tf_core.c index 788335b..0f49a00 100644 --- a/drivers/net/bnxt/tf_core/tf_core.c +++ b/drivers/net/bnxt/tf_core/tf_core.c @@ -303,7 +303,6 @@ int tf_get_global_cfg(struct tf *tfp, int rc = 0; struct tf_session *tfs; struct tf_dev_info *dev; - struct tf_dev_global_cfg_parms gparms = { 0 }; TF_CHECK_PARMS2(tfp, parms); @@ -342,12 +341,7 @@ int tf_get_global_cfg(struct tf *tfp, return -EOPNOTSUPP; } - gparms.dir = parms->dir; - gparms.type = parms->type; - gparms.offset = parms->offset; - gparms.config = parms->config; - gparms.config_sz_in_bytes = parms->config_sz_in_bytes; - rc = dev->ops->tf_dev_get_global_cfg(tfp, &gparms); + rc = dev->ops->tf_dev_get_global_cfg(tfp, parms); if (rc) { TFP_DRV_LOG(ERR, "%s: Global Cfg get failed, rc:%s\n", @@ -371,7 +365,6 @@ int tf_set_global_cfg(struct tf *tfp, int rc = 0; struct tf_session *tfs; struct tf_dev_info *dev; - struct tf_dev_global_cfg_parms gparms = { 0 }; TF_CHECK_PARMS2(tfp, parms); @@ -410,12 +403,7 @@ int tf_set_global_cfg(struct tf *tfp, return -EOPNOTSUPP; } - gparms.dir = parms->dir; - gparms.type = parms->type; - gparms.offset = parms->offset; - gparms.config = parms->config; - gparms.config_sz_in_bytes = parms->config_sz_in_bytes; - rc = dev->ops->tf_dev_set_global_cfg(tfp, &gparms); + rc = dev->ops->tf_dev_set_global_cfg(tfp, parms); if (rc) { TFP_DRV_LOG(ERR, "%s: Global Cfg set failed, rc:%s\n", @@ -1352,6 +1340,44 @@ tf_alloc_tbl_scope(struct tf *tfp, return rc; } +int +tf_map_tbl_scope(struct tf *tfp, + struct tf_map_tbl_scope_parms *parms) +{ + struct tf_session *tfs; + struct tf_dev_info *dev; + int rc; + + TF_CHECK_PARMS2(tfp, parms); + + /* Retrieve the session information */ + rc = tf_session_get_session(tfp, &tfs); + if (rc) { + TFP_DRV_LOG(ERR, + "Failed to lookup session, rc:%s\n", + strerror(-rc)); + return rc; + } + + /* Retrieve the device information */ + rc = tf_session_get_device(tfs, &dev); + if (rc) { + TFP_DRV_LOG(ERR, + "Failed to lookup device, rc:%s\n", + strerror(-rc)); + return rc; + } + + if (dev->ops->tf_dev_map_tbl_scope != NULL) { + rc = dev->ops->tf_dev_map_tbl_scope(tfp, parms); + } else { + TFP_DRV_LOG(ERR, + "Map table scope not supported by device\n"); + return -EINVAL; + } + + return rc; +} int tf_free_tbl_scope(struct tf *tfp, diff --git a/drivers/net/bnxt/tf_core/tf_core.h b/drivers/net/bnxt/tf_core/tf_core.h index 65be8f5..fa8ab52 100644 --- a/drivers/net/bnxt/tf_core/tf_core.h +++ b/drivers/net/bnxt/tf_core/tf_core.h @@ -898,7 +898,9 @@ struct tf_alloc_tbl_scope_parms { */ uint32_t tbl_scope_id; }; - +/** + * tf_free_tbl_scope_parms definition + */ struct tf_free_tbl_scope_parms { /** * [in] table scope identifier @@ -907,6 +909,21 @@ struct tf_free_tbl_scope_parms { }; /** + * tf_map_tbl_scope_parms definition + */ +struct tf_map_tbl_scope_parms { + /** + * [in] table scope identifier + */ + uint32_t tbl_scope_id; + /** + * [in] Which parifs are associated with this table scope. Bit 0 + * indicates parif 0. + */ + uint16_t parif_bitmask; +}; + +/** * allocate a table scope * * On SR2 Firmware will allocate a scope ID. On other devices, the scope @@ -915,13 +932,13 @@ struct tf_free_tbl_scope_parms { * device constraints based upon calculations using either the number of flows * requested or the size of memory indicated. Other parameters passed in * determine the configuration (maximum key size, maximum external action record - * size. + * size). * - * This API will allocate the table region in - * DRAM, program the PTU page table entries, and program the number of static - * buckets (if SR2) in the RX and TX CFAs. Buckets are assumed to start at - * 0 in the EM memory for the scope. Upon successful completion of this API, - * hash tables are fully initialized and ready for entries to be inserted. + * This API will allocate the table region in DRAM, program the PTU page table + * entries, and program the number of static buckets (if SR2) in the RX and TX + * CFAs. Buckets are assumed to start at 0 in the EM memory for the scope. + * Upon successful completion of this API, hash tables are fully initialized and + * ready for entries to be inserted. * * A single API is used to allocate a common table scope identifier in both * receive and transmit CFA. The scope identifier is common due to nature of @@ -944,7 +961,25 @@ struct tf_free_tbl_scope_parms { int tf_alloc_tbl_scope(struct tf *tfp, struct tf_alloc_tbl_scope_parms *parms); +/** + * map a table scope (legacy device only Wh+/SR) + * + * Map a table scope to one or more partition interfaces (parifs). + * The parif can be remapped in the L2 context lookup for legacy devices. This + * API allows a number of parifs to be mapped to the same table scope. On + * legacy devices a table scope identifies one of 16 sets of EEM table base + * addresses and is associated with a PF communication channel. The associated + * PF must be configured for the table scope to operate. + * + * An L2 context TCAM lookup returns a remapped parif value used to + * index into the set of 16 parif_to_pf registers which are used to map to one + * of the 16 table scopes. This API allows the user to map the parifs in the + * mask to the previously allocated table scope (EEM table). + * Returns success or failure code. + */ +int tf_map_tbl_scope(struct tf *tfp, + struct tf_map_tbl_scope_parms *parms); /** * free a table scope * @@ -1909,6 +1944,12 @@ struct tf_global_cfg_parms { */ uint8_t *config; /** + * [in] Configuration mask + * set - Read, Modify with mask and Write + * get - unused + */ + uint8_t *config_mask; + /** * [in] struct containing size */ uint16_t config_sz_in_bytes; diff --git a/drivers/net/bnxt/tf_core/tf_device.h b/drivers/net/bnxt/tf_core/tf_device.h index fce7f25..cf7c36e 100644 --- a/drivers/net/bnxt/tf_core/tf_device.h +++ b/drivers/net/bnxt/tf_core/tf_device.h @@ -573,6 +573,45 @@ struct tf_dev_ops { */ int (*tf_dev_alloc_tbl_scope)(struct tf *tfp, struct tf_alloc_tbl_scope_parms *parms); + /** + * Map EEM parif + * + * [in] tfp + * Pointer to TF handle + * + * [in] parms + * Pointer to table scope map parameters + * + * [in/out] pointer to the parif_2_pf data to be updated + * + * [in/out] pointer to the parif_2_pf mask to be updated + * + * [in] sz_in_bytes - number of bytes to be written + * + * returns: + * 0 - Success + * -EINVAL - Error + */ + int (*tf_dev_map_parif)(struct tf *tfp, + struct tf_map_tbl_scope_parms *parms, + uint8_t *data, + uint8_t *mask, + uint16_t sz_in_bytes); + /** + * Map EEM table scope + * + * [in] tfp + * Pointer to TF handle + * + * [in] parms + * Pointer to table scope map parameters + * + * returns: + * 0 - Success + * -EINVAL - Error + */ + int (*tf_dev_map_tbl_scope)(struct tf *tfp, + struct tf_map_tbl_scope_parms *parms); /** * Free EEM table scope @@ -642,7 +681,7 @@ struct tf_dev_ops { * -EINVAL - Error */ int (*tf_dev_set_global_cfg)(struct tf *tfp, - struct tf_dev_global_cfg_parms *parms); + struct tf_global_cfg_parms *parms); /** * Get global cfg @@ -658,7 +697,7 @@ struct tf_dev_ops { * -EINVAL - Error */ int (*tf_dev_get_global_cfg)(struct tf *tfp, - struct tf_dev_global_cfg_parms *parms); + struct tf_global_cfg_parms *parms); }; /** diff --git a/drivers/net/bnxt/tf_core/tf_device_p4.c b/drivers/net/bnxt/tf_core/tf_device_p4.c index 0344565..07c8d02 100644 --- a/drivers/net/bnxt/tf_core/tf_device_p4.c +++ b/drivers/net/bnxt/tf_core/tf_device_p4.c @@ -12,6 +12,10 @@ #include "tf_tcam.h" #include "tf_em.h" #include "tf_if_tbl.h" +#include "tfp.h" + +#define TF_DEV_P4_PARIF_MAX 16 +#define TF_DEV_P4_PF_MASK 0xfUL /** * Device specific function that retrieves the MAX number of HCAPI @@ -97,6 +101,42 @@ tf_dev_p4_get_tcam_slice_info(struct tf *tfp __rte_unused, return 0; } +static int +tf_dev_p4_map_parif(struct tf *tfp __rte_unused, + struct tf_map_tbl_scope_parms *parms, + uint8_t *data, + uint8_t *mask, + uint16_t sz_in_bytes) +{ + uint32_t parif_pf[2] = { 0 }; + uint32_t parif_pf_mask[2] = { 0 }; + uint32_t parif; + uint32_t shift; + uint32_t scope_id = (uint32_t)(parms->tbl_scope_id); + + if (sz_in_bytes != sizeof(uint64_t)) + return -ENOTSUP; + + for (parif = 0; parif < TF_DEV_P4_PARIF_MAX; parif++) { + if (parms->parif_bitmask & (1UL << parif)) { + if (parif < 8) { + shift = 4 * parif; + parif_pf_mask[0] |= TF_DEV_P4_PF_MASK << shift; + parif_pf[0] |= scope_id << shift; + } else { + shift = 4 * (parif - 8); + parif_pf_mask[1] |= TF_DEV_P4_PF_MASK << shift; + parif_pf[1] |= scope_id << shift; + } + } + } + tfp_memcpy(data, parif_pf, sz_in_bytes); + tfp_memcpy(mask, parif_pf_mask, sz_in_bytes); + + return 0; +} + + /** * Truflow P4 device specific functions */ @@ -125,6 +165,8 @@ const struct tf_dev_ops tf_dev_ops_p4_init = { .tf_dev_insert_ext_em_entry = NULL, .tf_dev_delete_ext_em_entry = NULL, .tf_dev_alloc_tbl_scope = NULL, + .tf_dev_map_tbl_scope = NULL, + .tf_dev_map_parif = NULL, .tf_dev_free_tbl_scope = NULL, .tf_dev_set_if_tbl = NULL, .tf_dev_get_if_tbl = NULL, @@ -160,6 +202,8 @@ const struct tf_dev_ops tf_dev_ops_p4 = { .tf_dev_insert_ext_em_entry = tf_em_insert_ext_entry, .tf_dev_delete_ext_em_entry = tf_em_delete_ext_entry, .tf_dev_alloc_tbl_scope = tf_em_ext_common_alloc, + .tf_dev_map_tbl_scope = tf_em_ext_map_tbl_scope, + .tf_dev_map_parif = tf_dev_p4_map_parif, .tf_dev_free_tbl_scope = tf_em_ext_common_free, .tf_dev_set_if_tbl = tf_if_tbl_set, .tf_dev_get_if_tbl = tf_if_tbl_get, diff --git a/drivers/net/bnxt/tf_core/tf_em.h b/drivers/net/bnxt/tf_core/tf_em.h index 51b0813..8820b28 100644 --- a/drivers/net/bnxt/tf_core/tf_em.h +++ b/drivers/net/bnxt/tf_core/tf_em.h @@ -358,7 +358,7 @@ int tf_em_ext_free(struct tf *tfp, struct tf_free_tbl_scope_parms *parms); /** - * Common free for external EEM using host or system memory + * Common free table scope for external EEM using host or system memory * * [in] tfp * Pointer to TruFlow handle @@ -374,7 +374,7 @@ int tf_em_ext_common_free(struct tf *tfp, struct tf_free_tbl_scope_parms *parms); /** - * Common alloc for external EEM using host or system memory + * Common alloc table scope for external EEM using host or system memory * * [in] tfp * Pointer to TruFlow handle @@ -388,6 +388,21 @@ int tf_em_ext_common_free(struct tf *tfp, */ int tf_em_ext_common_alloc(struct tf *tfp, struct tf_alloc_tbl_scope_parms *parms); +/** + * Map a set of parifs to a set of EEM base addresses (table scope) + * + * [in] tfp + * Pointer to TruFlow handle + * + * [in] parms + * Pointer to input parameters + * + * Returns: + * 0 - Success + * -EINVAL - Parameter error + */ +int tf_em_ext_map_tbl_scope(struct tf *tfp, + struct tf_map_tbl_scope_parms *parms); /** * Allocate External Tbl entry from the scope pool. diff --git a/drivers/net/bnxt/tf_core/tf_em_common.c b/drivers/net/bnxt/tf_core/tf_em_common.c index 0f4b121..c4f3de0 100644 --- a/drivers/net/bnxt/tf_core/tf_em_common.c +++ b/drivers/net/bnxt/tf_core/tf_em_common.c @@ -1046,3 +1046,91 @@ tf_em_ext_common_free(struct tf *tfp, { return tf_em_ext_free(tfp, parms); } + +int tf_em_ext_map_tbl_scope(struct tf *tfp, + struct tf_map_tbl_scope_parms *parms) +{ + int rc = 0; + struct tf_session *tfs; + struct tf_tbl_scope_cb *tbl_scope_cb; + struct tf_global_cfg_parms gcfg_parms = { 0 }; + struct tfp_calloc_parms aparms; + uint32_t *data, *mask; + uint32_t sz_in_bytes = 8; + struct tf_dev_info *dev; + + tbl_scope_cb = tbl_scope_cb_find(parms->tbl_scope_id); + + if (tbl_scope_cb == NULL) { + TFP_DRV_LOG(ERR, "Invalid tbl_scope_cb tbl_scope_id(%d)\n", + parms->tbl_scope_id); + return -EINVAL; + } + + /* Retrieve the session information */ + rc = tf_session_get_session_internal(tfp, &tfs); + if (rc) + return rc; + + /* Retrieve the device information */ + rc = tf_session_get_device(tfs, &dev); + if (rc) + return rc; + + if (dev->ops->tf_dev_map_tbl_scope == NULL) { + rc = -EOPNOTSUPP; + TFP_DRV_LOG(ERR, + "Map table scope operation not supported, rc:%s\n", + strerror(-rc)); + return rc; + } + + aparms.nitems = 2; + aparms.size = sizeof(uint32_t); + aparms.alignment = 0; + + if (tfp_calloc(&aparms) != 0) { + TFP_DRV_LOG(ERR, "Map tbl scope alloc data error %s\n", + strerror(ENOMEM)); + return -ENOMEM; + } + data = aparms.mem_va; + + if (tfp_calloc(&aparms) != 0) { + TFP_DRV_LOG(ERR, "Map tbl scope alloc mask error %s\n", + strerror(ENOMEM)); + rc = -ENOMEM; + goto clean; + } + mask = aparms.mem_va; + + rc = dev->ops->tf_dev_map_parif(tfp, parms, (uint8_t *)data, + (uint8_t *)mask, sz_in_bytes); + + if (rc) { + TFP_DRV_LOG(ERR, + "Map table scope config failure, rc:%s\n", + strerror(-rc)); + goto cleaner; + } + + gcfg_parms.type = TF_GLOBAL_CFG_INTERNAL_PARIF_2_PF; + gcfg_parms.offset = 0; + gcfg_parms.config = (uint8_t *)data; + gcfg_parms.config_mask = (uint8_t *)mask; + gcfg_parms.config_sz_in_bytes = sizeof(uint64_t); + + + rc = tf_msg_set_global_cfg(tfp, &gcfg_parms); + if (rc) { + TFP_DRV_LOG(ERR, + "Map tbl scope, set failed, rc:%s\n", + strerror(-rc)); + } +cleaner: + tfp_free(mask); +clean: + tfp_free(data); + + return rc; +} diff --git a/drivers/net/bnxt/tf_core/tf_global_cfg.c b/drivers/net/bnxt/tf_core/tf_global_cfg.c index 4ed4039..ebd1a86 100644 --- a/drivers/net/bnxt/tf_core/tf_global_cfg.c +++ b/drivers/net/bnxt/tf_core/tf_global_cfg.c @@ -113,7 +113,7 @@ tf_global_cfg_unbind(struct tf *tfp __rte_unused) int tf_global_cfg_set(struct tf *tfp, - struct tf_dev_global_cfg_parms *parms) + struct tf_global_cfg_parms *parms) { int rc; struct tf_global_cfg_get_hcapi_parms hparms; @@ -156,7 +156,7 @@ tf_global_cfg_set(struct tf *tfp, int tf_global_cfg_get(struct tf *tfp, - struct tf_dev_global_cfg_parms *parms) + struct tf_global_cfg_parms *parms) { int rc; diff --git a/drivers/net/bnxt/tf_core/tf_global_cfg.h b/drivers/net/bnxt/tf_core/tf_global_cfg.h index 5c73bb1..685f38d 100644 --- a/drivers/net/bnxt/tf_core/tf_global_cfg.h +++ b/drivers/net/bnxt/tf_core/tf_global_cfg.h @@ -13,7 +13,15 @@ * The global cfg module provides processing of global cfg types. */ -struct tf; +/* struct tf; */ + +/* Internal type not available to user + * but available internally within Truflow + */ +enum tf_global_config_internal_type { + TF_GLOBAL_CFG_INTERNAL_PARIF_2_PF = TF_GLOBAL_CFG_TYPE_MAX, + TF_GLOBAL_CFG_INTERNAL_TYPE_MAX +}; /** * Global cfg configuration enumeration. @@ -62,34 +70,6 @@ struct tf_global_cfg_cfg_parms { }; /** - * global cfg parameters - */ -struct tf_dev_global_cfg_parms { - /** - * [in] Receive or transmit direction - */ - enum tf_dir dir; - /** - * [in] Global config type - */ - enum tf_global_config_type type; - /** - * [in] Offset @ the type - */ - uint32_t offset; - /** - * [in/out] Value of the configuration - * set - Read, Modify and Write - * get - Read the full configuration - */ - uint8_t *config; - /** - * [in] struct containing size - */ - uint16_t config_sz_in_bytes; -}; - -/** * @page global cfg * * @ref tf_global_cfg_bind @@ -149,7 +129,7 @@ tf_global_cfg_unbind(struct tf *tfp); * - (-EINVAL) on failure. */ int tf_global_cfg_set(struct tf *tfp, - struct tf_dev_global_cfg_parms *parms); + struct tf_global_cfg_parms *parms); /** * Get global configuration @@ -165,6 +145,6 @@ int tf_global_cfg_set(struct tf *tfp, * - (-EINVAL) on failure. */ int tf_global_cfg_get(struct tf *tfp, - struct tf_dev_global_cfg_parms *parms); + struct tf_global_cfg_parms *parms); #endif /* TF_GLOBAL_CFG_H */ diff --git a/drivers/net/bnxt/tf_core/tf_msg.c b/drivers/net/bnxt/tf_core/tf_msg.c index 7c2ad17..5615eed 100644 --- a/drivers/net/bnxt/tf_core/tf_msg.c +++ b/drivers/net/bnxt/tf_core/tf_msg.c @@ -1075,7 +1075,7 @@ tf_msg_get_tbl_entry(struct tf *tfp, int tf_msg_get_global_cfg(struct tf *tfp, - struct tf_dev_global_cfg_parms *params) + struct tf_global_cfg_parms *params) { int rc = 0; struct tfp_send_msg_parms parms = { 0 }; @@ -1133,7 +1133,7 @@ tf_msg_get_global_cfg(struct tf *tfp, int tf_msg_set_global_cfg(struct tf *tfp, - struct tf_dev_global_cfg_parms *params) + struct tf_global_cfg_parms *params) { int rc = 0; struct tfp_send_msg_parms parms = { 0 }; @@ -1173,6 +1173,15 @@ tf_msg_set_global_cfg(struct tf *tfp, tfp_memcpy(req.data, params->config, params->config_sz_in_bytes); + + /* Only set mask if pointer is provided + */ + if (params->config_mask) { + tfp_memcpy(req.data + params->config_sz_in_bytes, + params->config_mask, + params->config_sz_in_bytes); + } + req.size = tfp_cpu_to_le_32(params->config_sz_in_bytes); parms.tf_type = HWRM_TF_GLOBAL_CFG_SET; diff --git a/drivers/net/bnxt/tf_core/tf_msg.h b/drivers/net/bnxt/tf_core/tf_msg.h index 195710e..72bf850 100644 --- a/drivers/net/bnxt/tf_core/tf_msg.h +++ b/drivers/net/bnxt/tf_core/tf_msg.h @@ -462,7 +462,7 @@ int tf_msg_get_tbl_entry(struct tf *tfp, * 0 on Success else internal Truflow error */ int tf_msg_get_global_cfg(struct tf *tfp, - struct tf_dev_global_cfg_parms *params); + struct tf_global_cfg_parms *params); /** * Sends global cfg update request to Firmware @@ -477,7 +477,7 @@ int tf_msg_get_global_cfg(struct tf *tfp, * 0 on Success else internal Truflow error */ int tf_msg_set_global_cfg(struct tf *tfp, - struct tf_dev_global_cfg_parms *params); + struct tf_global_cfg_parms *params); /** * Sends bulk get message of a Table Type element to the firmware.