patches for DPDK stable branches
 help / color / mirror / Atom feed
From: "Xueming(Steven) Li" <xuemingl@nvidia.com>
To: "Min Hu (Connor)" <humin29@huawei.com>,
	"stable@dpdk.org" <stable@dpdk.org>
Cc: "ferruh.yigit@intel.com" <ferruh.yigit@intel.com>
Subject: Re: [dpdk-stable] [PATCH 20.11 3/4] net/hns3: fix timing in mailbox
Date: Tue, 18 May 2021 04:27:01 +0000	[thread overview]
Message-ID: <BY5PR12MB4324C9A1013B427B611BEEBBA12C9@BY5PR12MB4324.namprd12.prod.outlook.com> (raw)
In-Reply-To: <1621259445-5182-3-git-send-email-humin29@huawei.com>

Thanks, merged

> -----Original Message-----
> From: Min Hu (Connor) <humin29@huawei.com>
> Sent: Monday, May 17, 2021 9:51 PM
> To: stable@dpdk.org
> Cc: ferruh.yigit@intel.com; Xueming(Steven) Li <xuemingl@nvidia.com>
> Subject: [PATCH 20.11 3/4] net/hns3: fix timing in mailbox
> 
> From: Chengchang Tang <tangchengchang@huawei.com>
> 
> [ upstream commit d566bfcff0c7bfe167f6c520d4fd5b0104130af6 ]
> 
> Currently, when processing MBX messages, the system timestamp is obtained to determine whether timeout occurs. However, the
> gettimeofday function is not monotonically increasing. Therefore, this may lead to incorrect judgment or difficulty exiting the loop.
> And actually, in this scenario, it is not necessary to obtain the timestamp.
> 
> This patch deletes the call to the gettimeofday function during MBX message processing.
> 
> Fixes: 463e748964f5 ("net/hns3: support mailbox")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
> ---
>  drivers/net/hns3/hns3_mbx.c | 13 +++++--------
>  1 file changed, 5 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/net/hns3/hns3_mbx.c b/drivers/net/hns3/hns3_mbx.c index 11e5235..2a479f2 100644
> --- a/drivers/net/hns3/hns3_mbx.c
> +++ b/drivers/net/hns3/hns3_mbx.c
> @@ -61,13 +61,12 @@ static int
>  hns3_get_mbx_resp(struct hns3_hw *hw, uint16_t code, uint16_t subcode,
>  		  uint8_t *resp_data, uint16_t resp_len)  {
> -#define HNS3_MAX_RETRY_MS	500
> +#define HNS3_MAX_RETRY_US	500000
>  #define HNS3_WAIT_RESP_US	100
>  	struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw);
>  	struct hns3_mbx_resp_status *mbx_resp;
> +	uint32_t wait_time = 0;
>  	bool received;
> -	uint64_t now;
> -	uint64_t end;
> 
>  	if (resp_len > HNS3_MBX_MAX_RESP_DATA_SIZE) {
>  		hns3_err(hw, "VF mbx response len(=%u) exceeds maximum(=%d)", @@ -75,9 +74,7 @@ hns3_get_mbx_resp(struct
> hns3_hw *hw, uint16_t code, uint16_t subcode,
>  		return -EINVAL;
>  	}
> 
> -	now = get_timeofday_ms();
> -	end = now + HNS3_MAX_RETRY_MS;
> -	while (now < end) {
> +	while (wait_time < HNS3_MAX_RETRY_US) {
>  		if (rte_atomic16_read(&hw->reset.disable_cmd)) {
>  			hns3_err(hw, "Don't wait for mbx respone because of "
>  				 "disable_cmd");
> @@ -103,10 +100,10 @@ hns3_get_mbx_resp(struct hns3_hw *hw, uint16_t code, uint16_t subcode,
>  		if (received)
>  			break;
> 
> -		now = get_timeofday_ms();
> +		wait_time += HNS3_WAIT_RESP_US;
>  	}
>  	hw->mbx_resp.req_msg_data = 0;
> -	if (now >= end) {
> +	if (wait_time >= HNS3_MAX_RETRY_US) {
>  		hns3_mbx_proc_timeout(hw, code, subcode);
>  		return -ETIME;
>  	}
> --
> 2.7.4


  reply	other threads:[~2021-05-18  4:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-17 13:50 [dpdk-stable] [PATCH 20.11 1/4] net/hns3: fix possible mismatched response of mailbox Min Hu (Connor)
2021-05-17 13:50 ` [dpdk-stable] [PATCH 20.11 2/4] net/hns3: fix VF handling LSC event in secondary process Min Hu (Connor)
2021-05-18  4:15   ` Xueming(Steven) Li
2021-05-17 13:50 ` [dpdk-stable] [PATCH 20.11 3/4] net/hns3: fix timing in mailbox Min Hu (Connor)
2021-05-18  4:27   ` Xueming(Steven) Li [this message]
2021-05-17 13:50 ` [dpdk-stable] [PATCH 20.11 4/4] net/hns3: fix verification of NEON support Min Hu (Connor)
2021-05-18  4:27   ` Xueming(Steven) Li
2021-05-18  4:14 ` [dpdk-stable] [PATCH 20.11 1/4] net/hns3: fix possible mismatched response of mailbox Xueming(Steven) Li

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=BY5PR12MB4324C9A1013B427B611BEEBBA12C9@BY5PR12MB4324.namprd12.prod.outlook.com \
    --to=xuemingl@nvidia.com \
    --cc=ferruh.yigit@intel.com \
    --cc=humin29@huawei.com \
    --cc=stable@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).