[dpdk-dev] [PATCH v14 3/7] ethdev: log offloads that can't be disabled by PMD

pbhagavatula at marvell.com pbhagavatula at marvell.com
Tue Oct 29 06:03:07 CET 2019


From: Pavan Nikhilesh <pbhagavatula at marvell.com>

Some PMD can't work when certain offloads are disabled, to work around
this the PMD auto enable the offloads internally and expose it through
dev->data->dev_conf.rxmode.offloads.
After dev_configure is called compare the requested offloads to the
enabled offloads and log any offloads that have been enabled by the PMD.

Suggested-by: Andrew Rybchenko <arybchenko at solarflare.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula at marvell.com>
---
 lib/librte_ethdev/rte_ethdev.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index fef1dbb61..7dfc2f691 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -1142,6 +1142,8 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 	struct rte_eth_dev *dev;
 	struct rte_eth_dev_info dev_info;
 	struct rte_eth_conf orig_conf;
+	uint64_t offloads_force_ena;
+	uint64_t offload;
 	int diag;
 	int ret;
 
@@ -1357,6 +1359,26 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 		goto rollback;
 	}
 
+	/* Extract Rx offload bits that can't be disabled and log them */
+	offloads_force_ena = dev_conf->rxmode.offloads ^
+			dev->data->dev_conf.rxmode.offloads;
+	while (__builtin_popcount(offloads_force_ena)) {
+		offload = 1ULL << __builtin_ctzll(offloads_force_ena);
+		offloads_force_ena &= ~offload;
+		RTE_ETHDEV_LOG(INFO, "Port %u can't disable Rx offload %s\n",
+			       port_id, rte_eth_dev_rx_offload_name(offload));
+	}
+
+	/* Extract Tx offload bits that can't be disabled and log them */
+	offloads_force_ena = dev_conf->txmode.offloads ^
+				    dev->data->dev_conf.txmode.offloads;
+	while (__builtin_popcount(offloads_force_ena)) {
+		offload = 1ULL << __builtin_ctzll(offloads_force_ena);
+		offloads_force_ena &= ~offload;
+		RTE_ETHDEV_LOG(INFO, "Port %u can't disable Tx offload %s\n",
+			       port_id, rte_eth_dev_tx_offload_name(offload));
+	}
+
 	return 0;
 
 rollback:
-- 
2.17.1



More information about the dev mailing list