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 8FEAEA0C56; Mon, 23 Aug 2021 09:51:52 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A33034114C; Mon, 23 Aug 2021 09:51:43 +0200 (CEST) Received: from relay.smtp-ext.broadcom.com (relay.smtp-ext.broadcom.com [192.19.166.231]) by mails.dpdk.org (Postfix) with ESMTP id BF0D541148 for ; Mon, 23 Aug 2021 09:51:41 +0200 (CEST) Received: from dhcp-10-123-153-22.dhcp.broadcom.net (bgccx-dev-host-lnx2.bec.broadcom.net [10.123.153.22]) by relay.smtp-ext.broadcom.com (Postfix) with ESMTP id 7E4972477B for ; Mon, 23 Aug 2021 00:51:40 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com 7E4972477B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1629705101; bh=+MTJOXFI0fLSpFjeu5rDwJxl+zPPH+ICBou3U7AG/1g=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ujRRUXNNIathI2MwK9oH5edBCBJhfALeXTCDoWIMS1DLPh2P7nYMrRo6NgWohC2Zw XofcBgjOiMIsgi6VLdLagZ/xO/Z2DGq5iBP3yQowUF5vMfkJ68wRS/fVwh9N7JyAXy H2ZGSG2Xjf4lm+7QeupMvII9fp0SgIhU9DbVRrEg= From: Kalesh A P To: dev@dpdk.org Date: Mon, 23 Aug 2021 13:42:13 +0530 Message-Id: <20210823081214.9725-3-kalesh-anakkur.purayil@broadcom.com> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20210823081214.9725-1-kalesh-anakkur.purayil@broadcom.com> References: <20210823081214.9725-1-kalesh-anakkur.purayil@broadcom.com> Subject: [dpdk-dev] [PATCH 2/3] net/bnxt: check FW capability for VLAN offloads 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: Kalesh AP VLAN offload capability may be disabled in the FW. The driver should not attempt to override or utilize this feature in such scenarios since it will not work as expected. Fixes: 0a6d2a720078 ("net/bnxt: get device infos") Cc: stable@dpdk.org Signed-off-by: Kalesh AP Reviewed-by: Somnath Kotur Reviewed-by: Lance Richardson Reviewed-by: Ajit Khaparde --- drivers/net/bnxt/bnxt.h | 6 +++--- drivers/net/bnxt/bnxt_ethdev.c | 4 ++++ drivers/net/bnxt/bnxt_hwrm.c | 9 +++++++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h index 494a1ef..3ccc06c 100644 --- a/drivers/net/bnxt/bnxt.h +++ b/drivers/net/bnxt/bnxt.h @@ -577,8 +577,7 @@ struct bnxt_rep_info { ETH_RSS_NONFRAG_IPV6_UDP | \ ETH_RSS_LEVEL_MASK) -#define BNXT_DEV_TX_OFFLOAD_SUPPORT (DEV_TX_OFFLOAD_VLAN_INSERT | \ - DEV_TX_OFFLOAD_IPV4_CKSUM | \ +#define BNXT_DEV_TX_OFFLOAD_SUPPORT (DEV_TX_OFFLOAD_IPV4_CKSUM | \ DEV_TX_OFFLOAD_TCP_CKSUM | \ DEV_TX_OFFLOAD_UDP_CKSUM | \ DEV_TX_OFFLOAD_TCP_TSO | \ @@ -591,7 +590,6 @@ struct bnxt_rep_info { DEV_TX_OFFLOAD_MULTI_SEGS) #define BNXT_DEV_RX_OFFLOAD_SUPPORT (DEV_RX_OFFLOAD_VLAN_FILTER | \ - DEV_RX_OFFLOAD_VLAN_STRIP | \ DEV_RX_OFFLOAD_IPV4_CKSUM | \ DEV_RX_OFFLOAD_UDP_CKSUM | \ DEV_RX_OFFLOAD_TCP_CKSUM | \ @@ -737,6 +735,7 @@ struct bnxt { #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_FW_CAP_VLAN_TX_INSERT BIT(9) #define BNXT_TRUFLOW_EN(bp) ((bp)->fw_cap & BNXT_FW_CAP_TRUFLOW_EN) pthread_mutex_t flow_lock; @@ -745,6 +744,7 @@ struct bnxt { #define BNXT_VNIC_CAP_COS_CLASSIFY BIT(0) #define BNXT_VNIC_CAP_OUTER_RSS BIT(1) #define BNXT_VNIC_CAP_RX_CMPL_V2 BIT(2) +#define BNXT_VNIC_CAP_VLAN_RX_STRIP BIT(3) unsigned int rx_nr_rings; unsigned int rx_cp_nr_rings; unsigned int rx_num_qs_per_vnic; diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index de34a2f..e072771 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -981,9 +981,13 @@ static int bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev, dev_info->rx_offload_capa = BNXT_DEV_RX_OFFLOAD_SUPPORT; if (bp->flags & BNXT_FLAG_PTP_SUPPORTED) dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_TIMESTAMP; + if (bp->vnic_cap_flags & BNXT_VNIC_CAP_VLAN_RX_STRIP) + dev_info->rx_offload_capa |= DEV_RX_OFFLOAD_VLAN_STRIP; dev_info->tx_queue_offload_capa = DEV_TX_OFFLOAD_MBUF_FAST_FREE; dev_info->tx_offload_capa = BNXT_DEV_TX_OFFLOAD_SUPPORT | dev_info->tx_queue_offload_capa; + if (bp->fw_cap & BNXT_FW_CAP_VLAN_TX_INSERT) + dev_info->tx_offload_capa |= DEV_TX_OFFLOAD_VLAN_INSERT; dev_info->flow_type_rss_offloads = BNXT_ETH_RSS_SUPPORT; dev_info->speed_capa = bnxt_get_speed_capabilities(bp); diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index 73deb41..d641d70 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -941,6 +941,10 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp) if (flags & HWRM_FUNC_QCAPS_OUTPUT_FLAGS_LINK_ADMIN_STATUS_SUPPORTED) bp->fw_cap |= BNXT_FW_CAP_LINK_ADMIN; + if (!(flags & HWRM_FUNC_QCAPS_OUTPUT_FLAGS_VLAN_ACCELERATION_TX_DISABLED)) { + bp->fw_cap |= BNXT_FW_CAP_VLAN_TX_INSERT; + PMD_DRV_LOG(DEBUG, "VLAN acceleration for TX is enabled\n"); + } unlock: HWRM_UNLOCK(); @@ -1001,6 +1005,11 @@ int bnxt_hwrm_vnic_qcaps(struct bnxt *bp) if (flags & HWRM_VNIC_QCAPS_OUTPUT_FLAGS_RX_CMPL_V2_CAP) bp->vnic_cap_flags |= BNXT_VNIC_CAP_RX_CMPL_V2; + if (flags & HWRM_VNIC_QCAPS_OUTPUT_FLAGS_VLAN_STRIP_CAP) { + bp->vnic_cap_flags |= BNXT_VNIC_CAP_VLAN_RX_STRIP; + PMD_DRV_LOG(DEBUG, "Rx VLAN strip capability enabled\n"); + } + bp->max_tpa_v2 = rte_le_to_cpu_16(resp->max_aggs_supported); HWRM_UNLOCK(); -- 2.10.1