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 0876BA0C4E for ; Sun, 5 Dec 2021 04:42:36 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C4DBB40040; Sun, 5 Dec 2021 04:42:36 +0100 (CET) Received: from relay.smtp-ext.broadcom.com (relay.smtp-ext.broadcom.com [192.19.166.228]) by mails.dpdk.org (Postfix) with ESMTP id 9576840040 for ; Sun, 5 Dec 2021 04:42:34 +0100 (CET) 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 42123C0008AD for ; Sat, 4 Dec 2021 19:42:33 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com 42123C0008AD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1638675753; bh=C+pys1MiFKGn5v16Prme8U9mrfdDiB44EFqlaJWrMdM=; h=From:To:Subject:Date:From; b=Qdqxrjcp+rZ1lJj5nRyIaB2BvjMs7jpvZL9vEDGUZOxnTvvqNTpuCCf0+uwoqP+3X iz0YWLzycd2ze8fM0OqCzq83rW9DQSjhRj/SvAGAdVKbXclK25IGm3+xSxoc6j7QBz HLJe2hJnNGZm9GVg6c9vyF9ZbmfAe9uZenjhNhdA= From: Kalesh A P To: stable@dpdk.org Subject: [PATCH 19.11 1/2] net/bnxt: check FW capability for VLAN offloads Date: Sun, 5 Dec 2021 09:32:05 +0530 Message-Id: <20211205040206.8050-1-kalesh-anakkur.purayil@broadcom.com> X-Mailer: git-send-email 2.10.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org From: Kalesh AP [ upstream commit baedf29794aa7cf8527d6362af17dce5046b1f51 ] 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") Signed-off-by: Kalesh AP Reviewed-by: Somnath Kotur Reviewed-by: Lance Richardson Reviewed-by: Ajit Khaparde --- drivers/net/bnxt/bnxt.h | 2 ++ drivers/net/bnxt/bnxt_ethdev.c | 8 +++++--- drivers/net/bnxt/bnxt_hwrm.c | 10 ++++++++++ drivers/net/bnxt/hsi_struct_def_dpdk.h | 3 +++ 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h index ceff0a7..63d7475 100644 --- a/drivers/net/bnxt/bnxt.h +++ b/drivers/net/bnxt/bnxt.h @@ -592,11 +592,13 @@ struct bnxt { #define BNXT_FW_CAP_IF_CHANGE BIT(1) #define BNXT_FW_CAP_ERROR_RECOVERY BIT(2) #define BNXT_FW_CAP_ERR_RECOVER_RELOAD BIT(3) +#define BNXT_FW_CAP_VLAN_TX_INSERT BIT(4) pthread_mutex_t flow_lock; uint32_t vnic_cap_flags; #define BNXT_VNIC_CAP_COS_CLASSIFY BIT(0) +#define BNXT_VNIC_CAP_VLAN_RX_STRIP BIT(1) 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 81f9886..d4c63fa 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -100,8 +100,7 @@ static const struct rte_pci_id bnxt_pci_id_map[] = { ETH_RSS_NONFRAG_IPV6_TCP | \ ETH_RSS_NONFRAG_IPV6_UDP) -#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 | \ @@ -114,7 +113,6 @@ static const struct rte_pci_id bnxt_pci_id_map[] = { 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 | \ @@ -587,7 +585,11 @@ 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_offload_capa = BNXT_DEV_TX_OFFLOAD_SUPPORT; + 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->default_rxconf = (struct rte_eth_rxconf) { diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index 844f1e8..25e6b8c 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -734,6 +734,10 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp) if (flags & HWRM_FUNC_QCAPS_OUTPUT_FLAGS_HOT_RESET_CAPABLE) bp->fw_cap |= BNXT_FW_CAP_HOT_RESET; + 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(); @@ -787,6 +791,12 @@ int bnxt_hwrm_vnic_qcaps(struct bnxt *bp) PMD_DRV_LOG(INFO, "CoS assignment capability enabled\n"); } + if (rte_le_to_cpu_32(resp->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(); diff --git a/drivers/net/bnxt/hsi_struct_def_dpdk.h b/drivers/net/bnxt/hsi_struct_def_dpdk.h index 6a16ea9..0935eb7 100644 --- a/drivers/net/bnxt/hsi_struct_def_dpdk.h +++ b/drivers/net/bnxt/hsi_struct_def_dpdk.h @@ -7441,6 +7441,9 @@ struct hwrm_func_qcaps_output { */ #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_NOTIFY_VF_DEF_VNIC_CHNG_SUPPORTED \ UINT32_C(0x4000000) + /* If set to 1, then the vlan acceleration for TX is disabled. */ + #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_VLAN_ACCELERATION_TX_DISABLED \ + UINT32_C(0x8000000) /* * This value is current MAC address configured for this * function. A value of 00-00-00-00-00-00 indicates no -- 2.10.1