DPDK patches and discussions
 help / color / mirror / Atom feed
From: Konstantin Ananyev <konstantin.ananyev@huawei.com>
To: Fengchengwen <fengchengwen@huawei.com>,
	"thomas@monjalon.net" <thomas@monjalon.net>,
	"ferruh.yigit@amd.com" <ferruh.yigit@amd.com>,
	"Aman Singh" <aman.deep.singh@intel.com>,
	Yuying Zhang <yuying.zhang@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: RE: [PATCH 5/5] app/testpmd: add error recovery usage demo
Date: Thu, 2 Mar 2023 13:01:47 +0000	[thread overview]
Message-ID: <27b5e0017a304183b812a7e45858e03a@huawei.com> (raw)
In-Reply-To: <20230301030610.49468-6-fengchengwen@huawei.com>



> 
> This patch adds error recovery usage demo which will:
> 1. stop packet forwarding when the RTE_ETH_EVENT_ERR_RECOVERING event
>    is received.
> 2. restart packet forwarding when the RTE_ETH_EVENT_RECOVERY_SUCCESS
>    event is received.
> 3. prompt the ports that fail to recovery and need to be removed when
>    the RTE_ETH_EVENT_RECOVERY_FAILED event is received.
> 
> In addition, a message is added to the printed information, requiring
> no command to be executed during the error recovery.
> 
> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
> ---
>  app/test-pmd/testpmd.c | 80 ++++++++++++++++++++++++++++++++++++++++++
>  app/test-pmd/testpmd.h |  4 ++-
>  2 files changed, 83 insertions(+), 1 deletion(-)
> 
> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
> index 0c14325b8d..fdc3ae604b 100644
> --- a/app/test-pmd/testpmd.c
> +++ b/app/test-pmd/testpmd.c
> @@ -3823,6 +3823,77 @@ rmv_port_callback(void *arg)
>  		start_packet_forwarding(0);
>  }
> 
> +static int need_start_when_recovery_over;
> +
> +static bool
> +has_port_in_err_recovering(void)
> +{
> +	struct rte_port *port;
> +	portid_t pid;
> +
> +	RTE_ETH_FOREACH_DEV(pid) {
> +		port = &ports[pid];
> +		if (port->err_recovering)
> +			return true;
> +	}
> +
> +	return false;
> +}
> +
> +static void
> +err_recovering_callback(portid_t port_id)
> +{
> +	if (!has_port_in_err_recovering())
> +		printf("Please stop executing any commands until recovery result events are received!\n");
> +
> +	ports[port_id].err_recovering = 1;
> +	ports[port_id].recover_failed = 0;
> +
> +	/* To simplify implementation, stop forwarding regardless of whether the port is used. */
> +	if (!test_done) {
> +		printf("Stop packet forwarding because some ports are in error recovering!\n");
> +		stop_packet_forwarding();
> +		need_start_when_recovery_over = 1;
> +	}
> +}

One thought I have - should we somehow stop user to attempt restart RX/TX while recovery
in progress?
But probably it is an overkill, and just documenting what is happening is enough....
Do we need to update testpmd UG with some short description?
Apart from that, LGTM:
Acked-by: Konstantin Ananyev <konstantin.ananyev@huawei.com>

> +
> +static void
> +recover_success_callback(portid_t port_id)
> +{
> +	ports[port_id].err_recovering = 0;
> +	if (has_port_in_err_recovering())
> +		return;
> +
> +	if (need_start_when_recovery_over) {
> +		printf("Recovery success! Restart packet forwarding!\n");
> +		start_packet_forwarding(0);
> +		need_start_when_recovery_over = 0;
> +	} else {
> +		printf("Recovery success!\n");
> +	}
> +}
> +
> +static void
> +recover_failed_callback(portid_t port_id)
> +{
> +	struct rte_port *port;
> +	portid_t pid;
> +
> +	ports[port_id].err_recovering = 0;
> +	ports[port_id].recover_failed = 1;
> +	if (has_port_in_err_recovering())
> +		return;
> +
> +	need_start_when_recovery_over = 0;
> +	printf("The ports:");
> +	RTE_ETH_FOREACH_DEV(pid) {
> +		port = &ports[pid];
> +		if (port->recover_failed)
> +			printf(" %u", pid);
> +	}
> +	printf(" recovery failed! Please remove them!\n");
> +}
> +
>  /* This function is used by the interrupt thread */
>  static int
>  eth_event_callback(portid_t port_id, enum rte_eth_event_type type, void *param,
> @@ -3878,6 +3949,15 @@ eth_event_callback(portid_t port_id, enum rte_eth_event_type type, void *param,
>  		}
>  		break;
>  	}
> +	case RTE_ETH_EVENT_ERR_RECOVERING:
> +		err_recovering_callback(port_id);
> +		break;
> +	case RTE_ETH_EVENT_RECOVERY_SUCCESS:
> +		recover_success_callback(port_id);
> +		break;
> +	case RTE_ETH_EVENT_RECOVERY_FAILED:
> +		recover_failed_callback(port_id);
> +		break;
>  	default:
>  		break;
>  	}
> diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
> index 329a6378a1..1bbf82a96c 100644
> --- a/app/test-pmd/testpmd.h
> +++ b/app/test-pmd/testpmd.h
> @@ -323,7 +323,9 @@ struct rte_port {
>  	uint8_t                 slave_flag : 1, /**< bonding slave port */
>  				bond_flag : 1, /**< port is bond device */
>  				fwd_mac_swap : 1, /**< swap packet MAC before forward */
> -				update_conf : 1; /**< need to update bonding device configuration */
> +				update_conf : 1, /**< need to update bonding device configuration */
> +				err_recovering : 1, /**< port is in error recovering */
> +				recover_failed : 1; /**< port recover failed */
>  	struct port_template    *pattern_templ_list; /**< Pattern templates. */
>  	struct port_template    *actions_templ_list; /**< Actions templates. */
>  	struct port_table       *table_list; /**< Flow tables. */
> --
> 2.17.1


  reply	other threads:[~2023-03-02 13:01 UTC|newest]

Thread overview: 86+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-01  3:06 [PATCH 0/5] fix race-condition of proactive error handling mode Chengwen Feng
2023-03-01  3:06 ` [PATCH 1/5] ethdev: " Chengwen Feng
2023-03-02 12:08   ` Konstantin Ananyev
2023-03-03 16:51     ` Ferruh Yigit
2023-03-05 14:53       ` Konstantin Ananyev
2023-03-06  8:55         ` Ferruh Yigit
2023-03-06 10:22           ` Konstantin Ananyev
2023-03-06 11:00             ` Ferruh Yigit
2023-03-06 11:05               ` Ajit Khaparde
2023-03-06 11:13                 ` Konstantin Ananyev
2023-03-07  8:25                   ` fengchengwen
2023-03-07  9:52                     ` Konstantin Ananyev
2023-03-07 10:11                       ` Konstantin Ananyev
2023-03-07 12:07                     ` Ferruh Yigit
2023-03-07 12:26                       ` fengchengwen
2023-03-07 12:39                         ` Konstantin Ananyev
2023-03-09  2:05                           ` Ajit Khaparde
2023-03-06  1:41       ` fengchengwen
2023-03-06  8:57         ` Ferruh Yigit
2023-03-06  9:10         ` Ferruh Yigit
2023-03-02 23:30   ` Honnappa Nagarahalli
2023-03-03  0:21     ` Konstantin Ananyev
2023-03-04  5:08       ` Honnappa Nagarahalli
2023-03-05 15:23         ` Konstantin Ananyev
2023-03-07  5:34           ` Honnappa Nagarahalli
2023-03-07  8:39             ` fengchengwen
2023-03-08  1:09               ` Honnappa Nagarahalli
2023-03-09  0:59                 ` fengchengwen
2023-03-09  3:03                   ` Honnappa Nagarahalli
2023-03-09 11:30                     ` fengchengwen
2023-03-10  3:25                       ` Honnappa Nagarahalli
2023-03-07  9:56             ` Konstantin Ananyev
2023-03-01  3:06 ` [PATCH 2/5] net/hns3: replace fp ops config function Chengwen Feng
2023-03-02  6:50   ` Dongdong Liu
2023-03-01  3:06 ` [PATCH 3/5] net/bnxt: fix race-condition when report error recovery Chengwen Feng
2023-03-02 12:23   ` Konstantin Ananyev
2023-03-01  3:06 ` [PATCH 4/5] net/bnxt: use fp ops setup function Chengwen Feng
2023-03-02 12:30   ` Konstantin Ananyev
2023-03-03  0:01     ` Konstantin Ananyev
2023-03-03  1:17       ` Ajit Khaparde
2023-03-03  2:02       ` fengchengwen
2023-03-03  1:38     ` fengchengwen
2023-03-05 15:57       ` Konstantin Ananyev
2023-03-06  2:47         ` Ajit Khaparde
2023-03-01  3:06 ` [PATCH 5/5] app/testpmd: add error recovery usage demo Chengwen Feng
2023-03-02 13:01   ` Konstantin Ananyev [this message]
2023-03-03  1:49     ` fengchengwen
2023-03-03 16:59       ` Ferruh Yigit
2023-09-21 11:12 ` [PATCH 0/5] fix race-condition of proactive error handling mode Ferruh Yigit
2023-10-07  2:32   ` fengchengwen
2023-10-20 10:07 ` [PATCH v2 0/7] " Chengwen Feng
2023-10-20 10:07   ` [PATCH v2 1/7] ethdev: " Chengwen Feng
2023-11-01  3:39     ` lihuisong (C)
2023-10-20 10:07   ` [PATCH v2 2/7] net/hns3: replace fp ops config function Chengwen Feng
2023-11-01  3:40     ` lihuisong (C)
2023-11-02 10:34     ` Konstantin Ananyev
2023-10-20 10:07   ` [PATCH v2 3/7] net/bnxt: fix race-condition when report error recovery Chengwen Feng
2023-11-02 16:28     ` Ajit Khaparde
2023-10-20 10:07   ` [PATCH v2 4/7] net/bnxt: use fp ops setup function Chengwen Feng
2023-11-01  3:48     ` lihuisong (C)
2023-11-02 10:34     ` Konstantin Ananyev
2023-11-02 16:29       ` Ajit Khaparde
2023-10-20 10:07   ` [PATCH v2 5/7] app/testpmd: add error recovery usage demo Chengwen Feng
2023-11-01  4:08     ` lihuisong (C)
2023-11-06 13:01       ` fengchengwen
2023-10-20 10:07   ` [PATCH v2 6/7] app/testpmd: extract event handling to event.c Chengwen Feng
2023-11-01  4:09     ` lihuisong (C)
2023-10-20 10:07   ` [PATCH v2 7/7] doc: testpmd support event handling section Chengwen Feng
2023-11-06  9:28     ` lihuisong (C)
2023-11-06 12:39       ` fengchengwen
2023-11-08  3:02         ` lihuisong (C)
2023-11-06  1:35   ` [PATCH v2 0/7] fix race-condition of proactive error handling mode fengchengwen
2023-11-06 13:11 ` [PATCH v3 " Chengwen Feng
2023-11-06 13:11   ` [PATCH v3 1/7] ethdev: " Chengwen Feng
2023-11-06 13:11   ` [PATCH v3 2/7] net/hns3: replace fp ops config function Chengwen Feng
2023-11-06 13:11   ` [PATCH v3 3/7] net/bnxt: fix race-condition when report error recovery Chengwen Feng
2023-11-06 13:11   ` [PATCH v3 4/7] net/bnxt: use fp ops setup function Chengwen Feng
2023-11-06 13:11   ` [PATCH v3 5/7] app/testpmd: add error recovery usage demo Chengwen Feng
2023-11-06 13:11   ` [PATCH v3 6/7] app/testpmd: extract event handling to event.c Chengwen Feng
2023-11-06 13:11   ` [PATCH v3 7/7] doc: testpmd support event handling section Chengwen Feng
2023-11-08  3:03     ` lihuisong (C)
2023-12-05  2:30   ` [PATCH v3 0/7] fix race-condition of proactive error handling mode fengchengwen
2024-01-15  1:44     ` fengchengwen
2024-01-29  1:16       ` fengchengwen
2024-02-18  3:41         ` fengchengwen
2024-05-08  9:22           ` fengchengwen

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=27b5e0017a304183b812a7e45858e03a@huawei.com \
    --to=konstantin.ananyev@huawei.com \
    --cc=aman.deep.singh@intel.com \
    --cc=dev@dpdk.org \
    --cc=fengchengwen@huawei.com \
    --cc=ferruh.yigit@amd.com \
    --cc=thomas@monjalon.net \
    --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).