DPDK patches and discussions
 help / color / mirror / Atom feed
From: Huisong Li <lihuisong@huawei.com>
To: <dev@dpdk.org>, <ferruh.yigit@amd.com>,
	Aman Singh <aman.deep.singh@intel.com>,
	Yuying Zhang <yuying.zhang@intel.com>
Cc: <andrew.rybchenko@oktetlabs.ru>, <liuyonglong@huawei.com>,
	<lihuisong@huawei.com>
Subject: [PATCH] app/testpmd: add the check for port and queue Rx/Tx offload
Date: Wed, 15 Nov 2023 18:33:23 +0800	[thread overview]
Message-ID: <20231115103323.65182-1-lihuisong@huawei.com> (raw)

This patch adds the check for port and per queue Rx/Tx offload to avoid the
failure of "port start all" when config a offload driver didn't support.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
 app/test-pmd/cmdline.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index a231d112b0..c040de7a79 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -11186,6 +11186,11 @@ config_port_rx_offload(portid_t port_id, char *name, bool on)
 			fprintf(stderr, "Unknown offload name: %s\n", name);
 			return;
 		}
+		if ((offload & dev_info.rx_offload_capa) == 0) {
+			fprintf(stderr, "Error: port %u doesn't support offload: %s.\n",
+				port_id, name);
+			return;
+		}
 	}
 
 	nb_rx_queues = dev_info.nb_rx_queues;
@@ -11388,6 +11393,11 @@ cmd_config_per_queue_rx_offload_parsed(void *parsed_result,
 			fprintf(stderr, "Unknown offload name: %s\n", res->offload);
 			return;
 		}
+		if ((offload & dev_info.rx_queue_offload_capa) == 0) {
+			fprintf(stderr, "Error: port %u doesn't support per queue offload: %s.\n",
+				port_id, res->offload);
+			return;
+		}
 	}
 
 	if (!strcmp(res->on_off, "on"))
@@ -11698,6 +11708,11 @@ config_port_tx_offload(portid_t port_id, char *name, bool on)
 			fprintf(stderr, "Unknown offload name: %s\n", name);
 			return;
 		}
+		if ((offload & dev_info.tx_offload_capa) == 0) {
+			fprintf(stderr, "Error: port %u doesn't support offload: %s.\n",
+				port_id, name);
+			return;
+		}
 	}
 
 	nb_tx_queues = dev_info.nb_tx_queues;
@@ -11904,6 +11919,11 @@ cmd_config_per_queue_tx_offload_parsed(void *parsed_result,
 			fprintf(stderr, "Unknown offload name: %s\n", res->offload);
 			return;
 		}
+		if ((offload & dev_info.tx_queue_offload_capa) == 0) {
+			fprintf(stderr, "Error: port %u doesn't support per queue offload: %s.\n",
+				port_id, res->offload);
+			return;
+		}
 	}
 
 	if (!strcmp(res->on_off, "on"))
-- 
2.33.0


             reply	other threads:[~2023-11-15 10:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-15 10:33 Huisong Li [this message]
2023-11-15 12:50 ` Ferruh Yigit

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=20231115103323.65182-1-lihuisong@huawei.com \
    --to=lihuisong@huawei.com \
    --cc=aman.deep.singh@intel.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@amd.com \
    --cc=liuyonglong@huawei.com \
    --cc=yuying.zhang@intel.com \
    /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).