From: Venkat Duvvuru Date: Sun, 30 May 2021 08:58:57 +0000 (+0530) Subject: net/bnxt: check FW capability to support TRUFLOW X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=da3731e2ea00dfb7e8ed2bb80a07340408f84567;p=dpdk.git net/bnxt: check FW capability to support TRUFLOW Currently, a devarg (host-based-truflow) is passed while launching the app to enable TRUFLOW feature. However, this mechanism adds an extra step in enabling TRUFLOW. This doesn't give a seamless experience when flow offloads has to work with FW that doesn't/does support TRUFLOW feature. Also, it's likely that customers may not want to use devarg to enable flow offloads. This patch fixes it by checking for TRUFLOW feature support in device's capabilities and configurations field of the hwrm_ver_get. Signed-off-by: Venkat Duvvuru Reviewed-by: Kalesh AP Reviewed-by: Somnath Kotur --- diff --git a/doc/guides/nics/bnxt.rst b/doc/guides/nics/bnxt.rst index feb0c6a765..e75f4fa9e3 100644 --- a/doc/guides/nics/bnxt.rst +++ b/doc/guides/nics/bnxt.rst @@ -658,8 +658,7 @@ which currently supports basic packet classification in the receive path. The feature uses a newly implemented control-plane firmware interface which optimizes flow insertions and deletions. -This is a tech preview feature, and is disabled by default. It can be enabled -using bnxt devargs. For ex: "-a 0000:0d:00.0,host-based-truflow=1”. +This is a tech preview feature. This feature is currently supported on Whitney+ and Stingray devices. diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h index e93a7eb933..532755467f 100644 --- a/drivers/net/bnxt/bnxt.h +++ b/drivers/net/bnxt/bnxt.h @@ -688,10 +688,9 @@ struct bnxt { #define BNXT_FLAG_RX_VECTOR_PKT_MODE BIT(24) #define BNXT_FLAG_FLOW_XSTATS_EN BIT(25) #define BNXT_FLAG_DFLT_MAC_SET BIT(26) -#define BNXT_FLAG_TRUFLOW_EN BIT(27) -#define BNXT_FLAG_GFID_ENABLE BIT(28) -#define BNXT_FLAG_RFS_NEEDS_VNIC BIT(29) -#define BNXT_FLAG_FLOW_CFA_RFS_RING_TBL_IDX_V2 BIT(30) +#define BNXT_FLAG_GFID_ENABLE BIT(27) +#define BNXT_FLAG_RFS_NEEDS_VNIC BIT(28) +#define BNXT_FLAG_FLOW_CFA_RFS_RING_TBL_IDX_V2 BIT(29) #define BNXT_RFS_NEEDS_VNIC(bp) ((bp)->flags & BNXT_FLAG_RFS_NEEDS_VNIC) #define BNXT_PF(bp) (!((bp)->flags & BNXT_FLAG_VF)) #define BNXT_VF(bp) ((bp)->flags & BNXT_FLAG_VF) @@ -707,7 +706,6 @@ struct bnxt { #define BNXT_HAS_RING_GRPS(bp) (!BNXT_CHIP_P5(bp)) #define BNXT_FLOW_XSTATS_EN(bp) ((bp)->flags & BNXT_FLAG_FLOW_XSTATS_EN) #define BNXT_HAS_DFLT_MAC_SET(bp) ((bp)->flags & BNXT_FLAG_DFLT_MAC_SET) -#define BNXT_TRUFLOW_EN(bp) ((bp)->flags & BNXT_FLAG_TRUFLOW_EN) #define BNXT_GFID_ENABLED(bp) ((bp)->flags & BNXT_FLAG_GFID_ENABLE) uint32_t flags2; @@ -729,6 +727,8 @@ struct bnxt { #define BNXT_FW_CAP_ADV_FLOW_MGMT BIT(5) #define BNXT_FW_CAP_ADV_FLOW_COUNTERS BIT(6) #define BNXT_FW_CAP_LINK_ADMIN BIT(7) +#define BNXT_FW_CAP_TRUFLOW_EN BIT(8) +#define BNXT_TRUFLOW_EN(bp) ((bp)->fw_cap & BNXT_FW_CAP_TRUFLOW_EN) pthread_mutex_t flow_lock; diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index c9536f7926..b77f12bbb4 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -87,7 +87,6 @@ static const struct rte_pci_id bnxt_pci_id_map[] = { { .vendor_id = 0, /* sentinel */ }, }; -#define BNXT_DEVARG_TRUFLOW "host-based-truflow" #define BNXT_DEVARG_FLOW_XSTAT "flow-xstat" #define BNXT_DEVARG_MAX_NUM_KFLOWS "max-num-kflows" #define BNXT_DEVARG_REPRESENTOR "representor" @@ -100,7 +99,6 @@ static const struct rte_pci_id bnxt_pci_id_map[] = { static const char *const bnxt_dev_args[] = { BNXT_DEVARG_REPRESENTOR, - BNXT_DEVARG_TRUFLOW, BNXT_DEVARG_FLOW_XSTAT, BNXT_DEVARG_MAX_NUM_KFLOWS, BNXT_DEVARG_REP_BASED_PF, @@ -112,12 +110,6 @@ static const char *const bnxt_dev_args[] = { NULL }; -/* - * truflow == false to disable the feature - * truflow == true to enable the feature - */ -#define BNXT_DEVARG_TRUFLOW_INVALID(truflow) ((truflow) > 1) - /* * flow_xstat == false to disable the feature * flow_xstat == true to enable the feature @@ -5261,45 +5253,6 @@ static int bnxt_init_resources(struct bnxt *bp, bool reconfig_dev) return 0; } -static int -bnxt_parse_devarg_truflow(__rte_unused const char *key, - const char *value, void *opaque_arg) -{ - struct bnxt *bp = opaque_arg; - unsigned long truflow; - char *end = NULL; - - if (!value || !opaque_arg) { - PMD_DRV_LOG(ERR, - "Invalid parameter passed to truflow devargs.\n"); - return -EINVAL; - } - - truflow = strtoul(value, &end, 10); - if (end == NULL || *end != '\0' || - (truflow == ULONG_MAX && errno == ERANGE)) { - PMD_DRV_LOG(ERR, - "Invalid parameter passed to truflow devargs.\n"); - return -EINVAL; - } - - if (BNXT_DEVARG_TRUFLOW_INVALID(truflow)) { - PMD_DRV_LOG(ERR, - "Invalid value passed to truflow devargs.\n"); - return -EINVAL; - } - - if (truflow) { - bp->flags |= BNXT_FLAG_TRUFLOW_EN; - PMD_DRV_LOG(INFO, "Host-based truflow feature enabled.\n"); - } else { - bp->flags &= ~BNXT_FLAG_TRUFLOW_EN; - PMD_DRV_LOG(INFO, "Host-based truflow feature disabled.\n"); - } - - return 0; -} - static int bnxt_parse_devarg_flow_xstat(__rte_unused const char *key, const char *value, void *opaque_arg) @@ -5607,15 +5560,6 @@ bnxt_parse_dev_args(struct bnxt *bp, struct rte_devargs *devargs) if (kvlist == NULL) return -EINVAL; - /* - * Handler for "truflow" devarg. - * Invoked as for ex: "-a 0000:00:0d.0,host-based-truflow=1" - */ - ret = rte_kvargs_process(kvlist, BNXT_DEVARG_TRUFLOW, - bnxt_parse_devarg_truflow, bp); - if (ret) - goto err; - /* * Handler for "flow_xstat" devarg. * Invoked as for ex: "-a 0000:00:0d.0,flow_xstat=1" diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index a65ac6c0ec..6eab2342f6 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -1349,6 +1349,12 @@ int bnxt_hwrm_ver_get(struct bnxt *bp, uint32_t timeout) bp->fw_cap |= BNXT_FW_CAP_ADV_FLOW_COUNTERS; } + if (dev_caps_cfg & + HWRM_VER_GET_OUTPUT_DEV_CAPS_CFG_CFA_TRUFLOW_SUPPORTED) { + PMD_DRV_LOG(DEBUG, "Host-based truflow feature enabled.\n"); + bp->fw_cap |= BNXT_FW_CAP_TRUFLOW_EN; + } + error: HWRM_UNLOCK(); return rc; @@ -4660,7 +4666,6 @@ int bnxt_hwrm_erase_nvram_directory(struct bnxt *bp, uint8_t index) return rc; } - int bnxt_hwrm_flash_nvram(struct bnxt *bp, uint16_t dir_type, uint16_t dir_ordinal, uint16_t dir_ext, uint16_t dir_attr, const uint8_t *data,