[edk2] [Patch] MdeModulePkg/IpIoDxe: Update API description to match the function implementation.

Fu Siyuan posted 1 patch 6 years, 4 months ago
Failed in applying to current master (apply log)
MdeModulePkg/Include/Library/IpIoLib.h       |  4 ++++
MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c | 34 +++++++++++++++++++++-------
2 files changed, 30 insertions(+), 8 deletions(-)
[edk2] [Patch] MdeModulePkg/IpIoDxe: Update API description to match the function implementation.
Posted by Fu Siyuan 6 years, 4 months ago
This patch updates some API descriptions in DxeIpIoLib to match the real
implementation.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Cc: Wang Fan <fan.wang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
---
 MdeModulePkg/Include/Library/IpIoLib.h       |  4 ++++
 MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c | 34 +++++++++++++++++++++-------
 2 files changed, 30 insertions(+), 8 deletions(-)

diff --git a/MdeModulePkg/Include/Library/IpIoLib.h b/MdeModulePkg/Include/Library/IpIoLib.h
index aab0c68059..ecb3f11e5c 100644
--- a/MdeModulePkg/Include/Library/IpIoLib.h
+++ b/MdeModulePkg/Include/Library/IpIoLib.h
@@ -385,6 +385,7 @@ IpIoStop (
                                       successfully.
   @retval          EFI_ACCESS_DENIED  The IP_IO instance is configured; avoid  
                                       reopening it.
+  @retval          EFI_UNSUPPORTED    IPv4 RawData mode is no supported.
   @retval          Others             An error condition occurred.
 
 **/
@@ -416,6 +417,7 @@ IpIoOpen (
   @retval          EFI_SUCCESS           The operation completed successfully.
   @retval          EFI_NOT_STARTED       The IpIo is not configured.
   @retval          EFI_OUT_OF_RESOURCES  Failed due to resource limitations.
+  @retval          Others                Error condition occurred.
 
 **/
 EFI_STATUS
@@ -541,6 +543,7 @@ IpIoFindSender (
   @param[out]  IsHard                If TRUE, indicates that it is a hard error.
   @param[out]  Notify                If TRUE, SockError needs to be notified.
 
+  @retval EFI_UNSUPPORTED            Unrecognizable ICMP error code
   @return The ICMP Error Status, such as EFI_NETWORK_UNREACHABLE.
 
 **/
@@ -574,6 +577,7 @@ IpIoGetIcmpErrStatus (
   @retval      EFI_INVALID_PARAMETER The Neighbor Address is invalid.
   @retval      EFI_NOT_FOUND         The neighbor cache entry is not in the 
                                      neighbor table.  
+  @retval      EFI_UNSUPPORTED       IP version is IPv4, which doesn't support neighbor cache refresh.
   @retval      EFI_OUT_OF_RESOURCES  Failed due to resource limitations.
 
 **/
diff --git a/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c b/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c
index abc07fb0ff..c880818d42 100644
--- a/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c
+++ b/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c
@@ -129,6 +129,7 @@ IpIoTransmitHandler (
 
   @retval       EFI_SUCCESS        The IP child is created and the IP protocol
                                    interface is retrieved.
+  @retval       EFI_UNSUPPORTED    Upsupported IpVersion.
   @retval       Others             The required operation failed.
 
 **/
@@ -206,6 +207,7 @@ IpIoCreateIpChildOpenProtocol (
 
   @retval     EFI_SUCCESS         The IP protocol is closed and the relevant IP child
                                   is destroyed.
+  @retval     EFI_UNSUPPORTED     Upsupported IpVersion.
   @retval     Others              The required operation failed.
 
 **/
@@ -1276,6 +1278,7 @@ ReleaseIpIo:
                                       successfully.
   @retval          EFI_ACCESS_DENIED  The IP_IO instance is configured, avoid to 
                                       reopen it.
+  @retval          EFI_UNSUPPORTED    IPv4 RawData mode is no supported.
   @retval          Others             Error condition occurred.
 
 **/
@@ -1488,20 +1491,28 @@ IpIoDestroy (
   IN OUT IP_IO *IpIo
   )
 {
+  EFI_STATUS    Status;
+  
   //
   // Stop the IpIo.
   //
-  IpIoStop (IpIo);
+  Status = IpIoStop (IpIo);
+  if (EFI_ERROR (Status)) {
+    return Status;
+  }
 
   //
   // Close the IP protocol and destroy the child.
   //
-  IpIoCloseProtocolDestroyIpChild (
-    IpIo->Controller,
-    IpIo->Image,
-    IpIo->ChildHandle,
-    IpIo->IpVersion
-    );
+  Status = IpIoCloseProtocolDestroyIpChild (
+             IpIo->Controller,
+             IpIo->Image,
+             IpIo->ChildHandle,
+             IpIo->IpVersion
+             );
+  if (EFI_ERROR (Status)) {
+    return Status;
+  }
 
   gBS->FreePool (IpIo);
 
@@ -1530,6 +1541,7 @@ IpIoDestroy (
   @retval          EFI_SUCCESS           The operation is completed successfully.
   @retval          EFI_NOT_STARTED       The IpIo is not configured.
   @retval          EFI_OUT_OF_RESOURCES  Failed due to resource limit.
+  @retval          Others                Error condition occurred.
 
 **/
 EFI_STATUS
@@ -2044,6 +2056,7 @@ IpIoFindSender (
   @param[out]  IsHard                If TRUE, indicates that it is a hard error.
   @param[out]  Notify                If TRUE, SockError needs to be notified.
 
+  @retval EFI_UNSUPPORTED            Unrecognizable ICMP error code.
   @return ICMP Error Status, such as EFI_NETWORK_UNREACHABLE.
 
 **/
@@ -2162,6 +2175,7 @@ IpIoGetIcmpErrStatus (
   @retval      EFI_INVALID_PARAMETER Neighbor Address is invalid.
   @retval      EFI_NOT_FOUND         The neighbor cache entry is not in the 
                                      neighbor table.  
+  @retval      EFI_UNSUPPORTED       IP version is IPv4, which doesn't support neighbor cache refresh.
   @retval      EFI_OUT_OF_RESOURCES  Failed due to resource limit.
 
 **/
@@ -2174,10 +2188,14 @@ IpIoRefreshNeighbor (
 {
   EFI_IP6_PROTOCOL  *Ip;
 
-  if (!IpIo->IsConfigured || IpIo->IpVersion != IP_VERSION_6) {
+  if (!IpIo->IsConfigured) {
     return EFI_NOT_STARTED;
   }
 
+  if (IpIo->IpVersion != IP_VERSION_6) {
+    return EFI_UNSUPPORTED;
+  }
+
   Ip = IpIo->Ip.Ip6;
 
   return Ip->Neighbors (Ip, FALSE, &Neighbor->v6, NULL, Timeout, TRUE);
-- 
2.13.0.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [Patch] MdeModulePkg/IpIoDxe: Update API description to match the function implementation.
Posted by Wu, Jiaxin 6 years, 4 months ago
Hi Siyuan ,

I can't apply this patch, but looks good to me.

Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>


Thanks,
Jiaxin

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Fu,
> Siyuan
> Sent: Wednesday, December 13, 2017 3:31 PM
> To: edk2-devel@lists.01.org
> Cc: Ye, Ting <ting.ye@intel.com>; Wang, Fan <fan.wang@intel.com>; Wu,
> Jiaxin <jiaxin.wu@intel.com>
> Subject: [edk2] [Patch] MdeModulePkg/IpIoDxe: Update API description to
> match the function implementation.
> 
> This patch updates some API descriptions in DxeIpIoLib to match the real
> implementation.
> 
> Cc: Ye Ting <ting.ye@intel.com>
> Cc: Wu Jiaxin <jiaxin.wu@intel.com>
> Cc: Wang Fan <fan.wang@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
> ---
>  MdeModulePkg/Include/Library/IpIoLib.h       |  4 ++++
>  MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c | 34
> +++++++++++++++++++++-------
>  2 files changed, 30 insertions(+), 8 deletions(-)
> 
> diff --git a/MdeModulePkg/Include/Library/IpIoLib.h
> b/MdeModulePkg/Include/Library/IpIoLib.h
> index aab0c68059..ecb3f11e5c 100644
> --- a/MdeModulePkg/Include/Library/IpIoLib.h
> +++ b/MdeModulePkg/Include/Library/IpIoLib.h
> @@ -385,6 +385,7 @@ IpIoStop (
>                                        successfully.
>    @retval          EFI_ACCESS_DENIED  The IP_IO instance is configured; avoid
>                                        reopening it.
> +  @retval          EFI_UNSUPPORTED    IPv4 RawData mode is no supported.
>    @retval          Others             An error condition occurred.
> 
>  **/
> @@ -416,6 +417,7 @@ IpIoOpen (
>    @retval          EFI_SUCCESS           The operation completed successfully.
>    @retval          EFI_NOT_STARTED       The IpIo is not configured.
>    @retval          EFI_OUT_OF_RESOURCES  Failed due to resource limitations.
> +  @retval          Others                Error condition occurred.
> 
>  **/
>  EFI_STATUS
> @@ -541,6 +543,7 @@ IpIoFindSender (
>    @param[out]  IsHard                If TRUE, indicates that it is a hard error.
>    @param[out]  Notify                If TRUE, SockError needs to be notified.
> 
> +  @retval EFI_UNSUPPORTED            Unrecognizable ICMP error code
>    @return The ICMP Error Status, such as EFI_NETWORK_UNREACHABLE.
> 
>  **/
> @@ -574,6 +577,7 @@ IpIoGetIcmpErrStatus (
>    @retval      EFI_INVALID_PARAMETER The Neighbor Address is invalid.
>    @retval      EFI_NOT_FOUND         The neighbor cache entry is not in the
>                                       neighbor table.
> +  @retval      EFI_UNSUPPORTED       IP version is IPv4, which doesn't support
> neighbor cache refresh.
>    @retval      EFI_OUT_OF_RESOURCES  Failed due to resource limitations.
> 
>  **/
> diff --git a/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c
> b/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c
> index abc07fb0ff..c880818d42 100644
> --- a/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c
> +++ b/MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.c
> @@ -129,6 +129,7 @@ IpIoTransmitHandler (
> 
>    @retval       EFI_SUCCESS        The IP child is created and the IP protocol
>                                     interface is retrieved.
> +  @retval       EFI_UNSUPPORTED    Upsupported IpVersion.
>    @retval       Others             The required operation failed.
> 
>  **/
> @@ -206,6 +207,7 @@ IpIoCreateIpChildOpenProtocol (
> 
>    @retval     EFI_SUCCESS         The IP protocol is closed and the relevant IP
> child
>                                    is destroyed.
> +  @retval     EFI_UNSUPPORTED     Upsupported IpVersion.
>    @retval     Others              The required operation failed.
> 
>  **/
> @@ -1276,6 +1278,7 @@ ReleaseIpIo:
>                                        successfully.
>    @retval          EFI_ACCESS_DENIED  The IP_IO instance is configured, avoid to
>                                        reopen it.
> +  @retval          EFI_UNSUPPORTED    IPv4 RawData mode is no supported.
>    @retval          Others             Error condition occurred.
> 
>  **/
> @@ -1488,20 +1491,28 @@ IpIoDestroy (
>    IN OUT IP_IO *IpIo
>    )
>  {
> +  EFI_STATUS    Status;
> +
>    //
>    // Stop the IpIo.
>    //
> -  IpIoStop (IpIo);
> +  Status = IpIoStop (IpIo);
> +  if (EFI_ERROR (Status)) {
> +    return Status;
> +  }
> 
>    //
>    // Close the IP protocol and destroy the child.
>    //
> -  IpIoCloseProtocolDestroyIpChild (
> -    IpIo->Controller,
> -    IpIo->Image,
> -    IpIo->ChildHandle,
> -    IpIo->IpVersion
> -    );
> +  Status = IpIoCloseProtocolDestroyIpChild (
> +             IpIo->Controller,
> +             IpIo->Image,
> +             IpIo->ChildHandle,
> +             IpIo->IpVersion
> +             );
> +  if (EFI_ERROR (Status)) {
> +    return Status;
> +  }
> 
>    gBS->FreePool (IpIo);
> 
> @@ -1530,6 +1541,7 @@ IpIoDestroy (
>    @retval          EFI_SUCCESS           The operation is completed successfully.
>    @retval          EFI_NOT_STARTED       The IpIo is not configured.
>    @retval          EFI_OUT_OF_RESOURCES  Failed due to resource limit.
> +  @retval          Others                Error condition occurred.
> 
>  **/
>  EFI_STATUS
> @@ -2044,6 +2056,7 @@ IpIoFindSender (
>    @param[out]  IsHard                If TRUE, indicates that it is a hard error.
>    @param[out]  Notify                If TRUE, SockError needs to be notified.
> 
> +  @retval EFI_UNSUPPORTED            Unrecognizable ICMP error code.
>    @return ICMP Error Status, such as EFI_NETWORK_UNREACHABLE.
> 
>  **/
> @@ -2162,6 +2175,7 @@ IpIoGetIcmpErrStatus (
>    @retval      EFI_INVALID_PARAMETER Neighbor Address is invalid.
>    @retval      EFI_NOT_FOUND         The neighbor cache entry is not in the
>                                       neighbor table.
> +  @retval      EFI_UNSUPPORTED       IP version is IPv4, which doesn't support
> neighbor cache refresh.
>    @retval      EFI_OUT_OF_RESOURCES  Failed due to resource limit.
> 
>  **/
> @@ -2174,10 +2188,14 @@ IpIoRefreshNeighbor (
>  {
>    EFI_IP6_PROTOCOL  *Ip;
> 
> -  if (!IpIo->IsConfigured || IpIo->IpVersion != IP_VERSION_6) {
> +  if (!IpIo->IsConfigured) {
>      return EFI_NOT_STARTED;
>    }
> 
> +  if (IpIo->IpVersion != IP_VERSION_6) {
> +    return EFI_UNSUPPORTED;
> +  }
> +
>    Ip = IpIo->Ip.Ip6;
> 
>    return Ip->Neighbors (Ip, FALSE, &Neighbor->v6, NULL, Timeout, TRUE);
> --
> 2.13.0.windows.1
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel