[dpdk-dev,1/1] net/szedata2: convert to new offload API

Message ID 1522767981-23370-1-git-send-email-vido@cesnet.cz (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Matej Vido April 3, 2018, 3:06 p.m. UTC
Offload API is currently used only to setup correct receive function
for scattered packets.
Use offloads member instead of bitfield and advertise correct
capabilities.

Signed-off-by: Matej Vido <vido@cesnet.cz>
---
 drivers/net/szedata2/rte_eth_szedata2.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
  

Comments

Ferruh Yigit April 5, 2018, 5:02 p.m. UTC | #1
On 4/3/2018 4:06 PM, Matej Vido wrote:
> Offload API is currently used only to setup correct receive function
> for scattered packets.
> Use offloads member instead of bitfield and advertise correct
> capabilities.
> 
> Signed-off-by: Matej Vido <vido@cesnet.cz>

Applied to dpdk-next-net/master, thanks.
  

Patch

diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c
index 1d02aee..3cfe388 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1016,7 +1016,7 @@  struct pmd_internals {
 eth_dev_configure(struct rte_eth_dev *dev)
 {
 	struct rte_eth_dev_data *data = dev->data;
-	if (data->dev_conf.rxmode.enable_scatter == 1) {
+	if (data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_SCATTER) {
 		dev->rx_pkt_burst = eth_szedata2_rx_scattered;
 		data->scattered_rx = 1;
 	} else {
@@ -1031,6 +1031,7 @@  struct pmd_internals {
 		struct rte_eth_dev_info *dev_info)
 {
 	struct pmd_internals *internals = dev->data->dev_private;
+
 	dev_info->pci_dev = RTE_ETH_DEV_TO_PCI(dev);
 	dev_info->if_index = 0;
 	dev_info->max_mac_addrs = 1;
@@ -1038,6 +1039,10 @@  struct pmd_internals {
 	dev_info->max_rx_queues = internals->max_rx_queues;
 	dev_info->max_tx_queues = internals->max_tx_queues;
 	dev_info->min_rx_bufsize = 0;
+	dev_info->rx_offload_capa = DEV_RX_OFFLOAD_SCATTER;
+	dev_info->tx_offload_capa = 0;
+	dev_info->rx_queue_offload_capa = 0;
+	dev_info->tx_queue_offload_capa = 0;
 	dev_info->speed_capa = ETH_LINK_SPEED_100G;
 }
 
@@ -1514,14 +1519,10 @@  struct pmd_internals {
 			internals->max_rx_queues, internals->max_tx_queues);
 
 	/* Set rx, tx burst functions */
-	if (data->dev_conf.rxmode.enable_scatter == 1 ||
-		data->scattered_rx == 1) {
+	if (data->scattered_rx == 1)
 		dev->rx_pkt_burst = eth_szedata2_rx_scattered;
-		data->scattered_rx = 1;
-	} else {
+	else
 		dev->rx_pkt_burst = eth_szedata2_rx;
-		data->scattered_rx = 0;
-	}
 	dev->tx_pkt_burst = eth_szedata2_tx;
 
 	/* Set function callbacks for Ethernet API */