mirror of https://github.com/acidanthera/audk.git
ShellPkg:Ping: Ping command hangs with intermittent packet losses
When we have intermittent loss of packets, ping command doesnt return to Shell prompt. It keeps looping in the while (Status ==EFI_NOT_READY) since Private->RxCount will never reach Private->SendNum. Addresses the issue with the use of a new varibale in the PRIVATE structure. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hegde, Nagaraj P <nagaraj-p.hegde@hpe.com> Reviewed-by: Sriram Subramanian <sriram-s@hpe.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
This commit is contained in:
parent
87bcfe1303
commit
80f7a8f5f9
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
(C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
|
(C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
|
||||||
Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||||
|
(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
|
||||||
|
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
@ -134,6 +135,7 @@ typedef struct _PING_PRIVATE_DATA {
|
||||||
UINT8 SrcAddress[MAX(sizeof(EFI_IPv6_ADDRESS) , sizeof(EFI_IPv4_ADDRESS) )];
|
UINT8 SrcAddress[MAX(sizeof(EFI_IPv6_ADDRESS) , sizeof(EFI_IPv4_ADDRESS) )];
|
||||||
UINT8 DstAddress[MAX(sizeof(EFI_IPv6_ADDRESS) , sizeof(EFI_IPv4_ADDRESS) )];
|
UINT8 DstAddress[MAX(sizeof(EFI_IPv6_ADDRESS) , sizeof(EFI_IPv4_ADDRESS) )];
|
||||||
PING_IPX_COMPLETION_TOKEN RxToken;
|
PING_IPX_COMPLETION_TOKEN RxToken;
|
||||||
|
UINT16 FailedCount;
|
||||||
} PING_PRIVATE_DATA;
|
} PING_PRIVATE_DATA;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -809,6 +811,9 @@ Ping6OnTimerRoutine (
|
||||||
RemoveEntryList (&TxInfo->Link);
|
RemoveEntryList (&TxInfo->Link);
|
||||||
PingDestroyTxInfo (TxInfo, Private->IpChoice);
|
PingDestroyTxInfo (TxInfo, Private->IpChoice);
|
||||||
|
|
||||||
|
Private->RxCount++;
|
||||||
|
Private->FailedCount++;
|
||||||
|
|
||||||
if (IsListEmpty (&Private->TxList) && (Private->TxCount == Private->SendNum)) {
|
if (IsListEmpty (&Private->TxList) && (Private->TxCount == Private->SendNum)) {
|
||||||
//
|
//
|
||||||
// All the left icmp6 echo request in the list timeout.
|
// All the left icmp6 echo request in the list timeout.
|
||||||
|
@ -1392,13 +1397,13 @@ ON_STAT:
|
||||||
STRING_TOKEN (STR_PING_STAT),
|
STRING_TOKEN (STR_PING_STAT),
|
||||||
gShellNetwork1HiiHandle,
|
gShellNetwork1HiiHandle,
|
||||||
Private->TxCount,
|
Private->TxCount,
|
||||||
Private->RxCount,
|
(Private->RxCount - Private->FailedCount),
|
||||||
(100 * (Private->TxCount - Private->RxCount)) / Private->TxCount,
|
(100 - ((100 * (Private->RxCount - Private->FailedCount)) / Private->TxCount)),
|
||||||
Private->RttSum
|
Private->RttSum
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Private->RxCount != 0) {
|
if (Private->RxCount > Private->FailedCount) {
|
||||||
ShellPrintHiiEx (
|
ShellPrintHiiEx (
|
||||||
-1,
|
-1,
|
||||||
-1,
|
-1,
|
||||||
|
@ -1407,7 +1412,7 @@ ON_STAT:
|
||||||
gShellNetwork1HiiHandle,
|
gShellNetwork1HiiHandle,
|
||||||
Private->RttMin,
|
Private->RttMin,
|
||||||
Private->RttMax,
|
Private->RttMax,
|
||||||
DivU64x64Remainder (Private->RttSum, Private->RxCount, NULL)
|
DivU64x64Remainder (Private->RttSum, (Private->RxCount - Private->FailedCount), NULL)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue