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 EF40DA034C; Wed, 27 Apr 2022 16:58:44 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9BD50427FC; Wed, 27 Apr 2022 16:58:35 +0200 (CEST) Received: from relay.smtp-ext.broadcom.com (lpdvsmtp11.broadcom.com [192.19.166.231]) by mails.dpdk.org (Postfix) with ESMTP id D364A41145 for ; Wed, 27 Apr 2022 16:58:32 +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 67E33C0000E8; Wed, 27 Apr 2022 07:58:31 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com 67E33C0000E8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1651071512; bh=T4Im2iI3Of9tVERoQdTddQ9LEm8kOEgP0ANWJb7RgTk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pwcT9lPV12c8h6BPs2ska/MPS/gbOwXYT9S8BQkde2h0Q2qRrZsAOxKAcqVwUZFYX ScyfG0xNFhQwuEHtbFxveHUHWiuWNvQrv+UZEuM+wVAxwdXhmVWcM4sKo05mQl+Rb3 dHwB87Y3buFYyPWzjIiQPccGgvhD49pdnmLesBN8= From: Kalesh A P To: dev@dpdk.org Cc: ajit.khaparde@broadcom.com Subject: [PATCH 02/17] net/bnxt: fix device capability reporting Date: Wed, 27 Apr 2022 20:28:06 +0530 Message-Id: <20220427145821.5987-3-kalesh-anakkur.purayil@broadcom.com> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20220427145821.5987-1-kalesh-anakkur.purayil@broadcom.com> References: <20220427145821.5987-1-kalesh-anakkur.purayil@broadcom.com> 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: Kalesh AP 1. Added two functions bnxt_get_tx_port_offloads() and bnxt_get_rx_port_offloads() to report the device tx/rx offload capabilities to the application. 2. This avoids few duplicate code in the driver and make VF-rep capability the same as VF. 3. This will help in selectively reporting offload capabilities based on FW support. Fixes: 0a6d2a720078 ("net/bnxt: get device infos") Cc: stable@dpdk.org Signed-off-by: Kalesh AP Reviewed-by: Ajit Khaparde Reviewed-by: Somnath Kotur --- drivers/net/bnxt/bnxt.h | 24 ------------------------ drivers/net/bnxt/bnxt_ethdev.c | 10 ++-------- drivers/net/bnxt/bnxt_reps.c | 6 ++---- drivers/net/bnxt/bnxt_rxq.c | 25 +++++++++++++++++++++++++ drivers/net/bnxt/bnxt_rxq.h | 1 + drivers/net/bnxt/bnxt_txq.c | 23 +++++++++++++++++++++++ drivers/net/bnxt/bnxt_txq.h | 1 + 7 files changed, 54 insertions(+), 36 deletions(-) diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h index 44724a9..5eddb4f 100644 --- a/drivers/net/bnxt/bnxt.h +++ b/drivers/net/bnxt/bnxt.h @@ -580,30 +580,6 @@ struct bnxt_rep_info { RTE_ETH_RSS_NONFRAG_IPV6_UDP | \ RTE_ETH_RSS_LEVEL_MASK) -#define BNXT_DEV_TX_OFFLOAD_SUPPORT (RTE_ETH_TX_OFFLOAD_IPV4_CKSUM | \ - RTE_ETH_TX_OFFLOAD_TCP_CKSUM | \ - RTE_ETH_TX_OFFLOAD_UDP_CKSUM | \ - RTE_ETH_TX_OFFLOAD_TCP_TSO | \ - RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM | \ - RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO | \ - RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO | \ - RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO | \ - RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO | \ - RTE_ETH_TX_OFFLOAD_QINQ_INSERT | \ - RTE_ETH_TX_OFFLOAD_MULTI_SEGS) - -#define BNXT_DEV_RX_OFFLOAD_SUPPORT (RTE_ETH_RX_OFFLOAD_VLAN_FILTER | \ - RTE_ETH_RX_OFFLOAD_IPV4_CKSUM | \ - RTE_ETH_RX_OFFLOAD_UDP_CKSUM | \ - RTE_ETH_RX_OFFLOAD_TCP_CKSUM | \ - RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM | \ - RTE_ETH_RX_OFFLOAD_OUTER_UDP_CKSUM | \ - RTE_ETH_RX_OFFLOAD_KEEP_CRC | \ - RTE_ETH_RX_OFFLOAD_VLAN_EXTEND | \ - RTE_ETH_RX_OFFLOAD_TCP_LRO | \ - RTE_ETH_RX_OFFLOAD_SCATTER | \ - RTE_ETH_RX_OFFLOAD_RSS_HASH) - #define BNXT_HWRM_SHORT_REQ_LEN sizeof(struct hwrm_short_input) struct bnxt_flow_stat_info { diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 261fe0b..fac3925 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -971,16 +971,10 @@ static int bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev, dev_info->min_rx_bufsize = 1; dev_info->max_rx_pktlen = BNXT_MAX_PKT_LEN; - dev_info->rx_offload_capa = BNXT_DEV_RX_OFFLOAD_SUPPORT; - if (bp->flags & BNXT_FLAG_PTP_SUPPORTED) - dev_info->rx_offload_capa |= RTE_ETH_RX_OFFLOAD_TIMESTAMP; - if (bp->vnic_cap_flags & BNXT_VNIC_CAP_VLAN_RX_STRIP) - dev_info->rx_offload_capa |= RTE_ETH_RX_OFFLOAD_VLAN_STRIP; + dev_info->rx_offload_capa = bnxt_get_rx_port_offloads(bp); dev_info->tx_queue_offload_capa = RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE; - dev_info->tx_offload_capa = BNXT_DEV_TX_OFFLOAD_SUPPORT | + dev_info->tx_offload_capa = bnxt_get_tx_port_offloads(bp) | dev_info->tx_queue_offload_capa; - if (bp->fw_cap & BNXT_FW_CAP_VLAN_TX_INSERT) - dev_info->tx_offload_capa |= RTE_ETH_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_reps.c b/drivers/net/bnxt/bnxt_reps.c index e773932..8a5b777 100644 --- a/drivers/net/bnxt/bnxt_reps.c +++ b/drivers/net/bnxt/bnxt_reps.c @@ -567,10 +567,8 @@ int bnxt_rep_dev_info_get_op(struct rte_eth_dev *eth_dev, dev_info->min_rx_bufsize = 1; dev_info->max_rx_pktlen = BNXT_MAX_PKT_LEN; - dev_info->rx_offload_capa = BNXT_DEV_RX_OFFLOAD_SUPPORT; - if (parent_bp->flags & BNXT_FLAG_PTP_SUPPORTED) - dev_info->rx_offload_capa |= RTE_ETH_RX_OFFLOAD_TIMESTAMP; - dev_info->tx_offload_capa = BNXT_DEV_TX_OFFLOAD_SUPPORT; + dev_info->rx_offload_capa = bnxt_get_rx_port_offloads(parent_bp); + dev_info->tx_offload_capa = bnxt_get_tx_port_offloads(parent_bp); dev_info->flow_type_rss_offloads = BNXT_ETH_RSS_SUPPORT; dev_info->switch_info.name = eth_dev->device->name; diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c index cd3bb14..0cfd0e5 100644 --- a/drivers/net/bnxt/bnxt_rxq.c +++ b/drivers/net/bnxt/bnxt_rxq.c @@ -20,6 +20,31 @@ * RX Queues */ +uint64_t bnxt_get_rx_port_offloads(struct bnxt *bp) +{ + uint64_t rx_offload_capa; + + rx_offload_capa = RTE_ETH_RX_OFFLOAD_IPV4_CKSUM | + RTE_ETH_RX_OFFLOAD_UDP_CKSUM | + RTE_ETH_RX_OFFLOAD_TCP_CKSUM | + RTE_ETH_RX_OFFLOAD_KEEP_CRC | + RTE_ETH_RX_OFFLOAD_VLAN_FILTER | + RTE_ETH_RX_OFFLOAD_VLAN_EXTEND | + RTE_ETH_RX_OFFLOAD_TCP_LRO | + RTE_ETH_RX_OFFLOAD_SCATTER | + RTE_ETH_RX_OFFLOAD_RSS_HASH; + + rx_offload_capa |= RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM | + RTE_ETH_RX_OFFLOAD_OUTER_UDP_CKSUM; + + if (bp->flags & BNXT_FLAG_PTP_SUPPORTED) + rx_offload_capa |= RTE_ETH_RX_OFFLOAD_TIMESTAMP; + if (bp->vnic_cap_flags & BNXT_VNIC_CAP_VLAN_RX_STRIP) + rx_offload_capa |= RTE_ETH_RX_OFFLOAD_VLAN_STRIP; + + return rx_offload_capa; +} + /* Determine whether the current configuration needs aggregation ring in HW. */ int bnxt_need_agg_ring(struct rte_eth_dev *eth_dev) { diff --git a/drivers/net/bnxt/bnxt_rxq.h b/drivers/net/bnxt/bnxt_rxq.h index 0331c23..287df8d 100644 --- a/drivers/net/bnxt/bnxt_rxq.h +++ b/drivers/net/bnxt/bnxt_rxq.h @@ -65,4 +65,5 @@ int bnxt_rx_queue_stop(struct rte_eth_dev *dev, void bnxt_rx_queue_release_mbufs(struct bnxt_rx_queue *rxq); int bnxt_need_agg_ring(struct rte_eth_dev *eth_dev); void bnxt_free_rxq_mem(struct bnxt_rx_queue *rxq); +uint64_t bnxt_get_rx_port_offloads(struct bnxt *bp); #endif diff --git a/drivers/net/bnxt/bnxt_txq.c b/drivers/net/bnxt/bnxt_txq.c index 72a55ea..86073a5 100644 --- a/drivers/net/bnxt/bnxt_txq.c +++ b/drivers/net/bnxt/bnxt_txq.c @@ -17,6 +17,29 @@ * TX Queues */ +uint64_t bnxt_get_tx_port_offloads(struct bnxt *bp) +{ + uint64_t tx_offload_capa; + + tx_offload_capa = RTE_ETH_TX_OFFLOAD_IPV4_CKSUM | + RTE_ETH_TX_OFFLOAD_UDP_CKSUM | + RTE_ETH_TX_OFFLOAD_TCP_CKSUM | + RTE_ETH_TX_OFFLOAD_TCP_TSO | + RTE_ETH_TX_OFFLOAD_QINQ_INSERT | + RTE_ETH_TX_OFFLOAD_MULTI_SEGS; + + tx_offload_capa |= RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM | + RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO | + RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO | + RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO | + RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO; + + if (bp->fw_cap & BNXT_FW_CAP_VLAN_TX_INSERT) + tx_offload_capa |= RTE_ETH_TX_OFFLOAD_VLAN_INSERT; + + return tx_offload_capa; +} + void bnxt_free_txq_stats(struct bnxt_tx_queue *txq) { if (txq && txq->cp_ring && txq->cp_ring->hw_stats) diff --git a/drivers/net/bnxt/bnxt_txq.h b/drivers/net/bnxt/bnxt_txq.h index 67fd4cb..f3a0381 100644 --- a/drivers/net/bnxt/bnxt_txq.h +++ b/drivers/net/bnxt/bnxt_txq.h @@ -43,4 +43,5 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev, uint16_t nb_desc, unsigned int socket_id, const struct rte_eth_txconf *tx_conf); +uint64_t bnxt_get_tx_port_offloads(struct bnxt *bp); #endif -- 2.10.1