From: Kalesh A P <kalesh-anakkur.purayil@broadcom.com>
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 [thread overview]
Message-ID: <20220427145821.5987-3-kalesh-anakkur.purayil@broadcom.com> (raw)
In-Reply-To: <20220427145821.5987-1-kalesh-anakkur.purayil@broadcom.com>
From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
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 <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
---
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
next prev parent reply other threads:[~2022-04-27 14:58 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-27 14:58 [dpdk-dev] [PATCH 00/17] bnxt PMD fixes Kalesh A P
2022-04-27 14:58 ` [PATCH 01/17] net/bnxt: update HWRM structures Kalesh A P
2022-04-27 14:58 ` Kalesh A P [this message]
2022-04-27 14:58 ` [PATCH 03/17] net/bnxt: fix to remove an unused macro Kalesh A P
2022-04-27 14:58 ` [PATCH 04/17] net/bnxt: fix Rxq configure Kalesh A P
2022-04-27 14:58 ` [PATCH 05/17] net/bnxt: fix support for tunnel stateless offloads Kalesh A P
2022-04-27 14:58 ` [PATCH 06/17] net/bnxt: remove support for COUNT action Kalesh A P
2022-04-27 14:58 ` [PATCH 07/17] net/bnxt: fix RSS action support Kalesh A P
2022-04-27 14:58 ` [PATCH 08/17] net/bnxt: fix to reconfigure the VNIC's default receive ring Kalesh A P
2022-04-27 14:58 ` [PATCH 09/17] net/bnxt: add check for dupliate queue ids Kalesh A P
2022-04-27 14:58 ` [PATCH 10/17] net/bnxt: fix to handle queue stop during RSS flow create Kalesh A P
2022-04-27 14:58 ` [PATCH 11/17] net/bnxt: avoid unnecessary endianness conversion Kalesh A P
2022-04-27 14:58 ` [PATCH 12/17] net/bnxt: fix setting autoneg speed Kalesh A P
2022-04-27 14:58 ` [PATCH 13/17] net/bnxt: force PHY update on certain configurations Kalesh A P
2022-04-27 14:58 ` [PATCH 14/17] net/bnxt: fix reporting link status when port is stopped Kalesh A P
2022-04-27 14:58 ` [PATCH 15/17] net/bnxt: recheck FW readiness if FW is in reset process Kalesh A P
2022-04-27 14:58 ` [PATCH 16/17] net/bnxt: fix freeing of VNIC filters Kalesh A P
2022-04-27 14:58 ` [PATCH 17/17] net/bnxt: don't wait for link up completion in dev start Kalesh A P
2022-05-10 5:16 ` [dpdk-dev] [PATCH 00/17] bnxt PMD fixes Ajit Khaparde
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220427145821.5987-3-kalesh-anakkur.purayil@broadcom.com \
--to=kalesh-anakkur.purayil@broadcom.com \
--cc=ajit.khaparde@broadcom.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).