1 /**************************************************************************/ 2 /* */ 3 /* Copyright (c) Microsoft Corporation. All rights reserved. */ 4 /* */ 5 /* This software is licensed under the Microsoft Software License */ 6 /* Terms for Microsoft Azure RTOS. Full text of the license can be */ 7 /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ 8 /* and in the root directory of this software. */ 9 /* */ 10 /**************************************************************************/ 11 12 13 /**************************************************************************/ 14 /**************************************************************************/ 15 /** */ 16 /** NetX Component */ 17 /** */ 18 /** Internet Protocol (IP) */ 19 /** */ 20 /**************************************************************************/ 21 /**************************************************************************/ 22 23 #define NX_SOURCE_CODE 24 25 /* Include necessary system files. */ 26 #include "nx_api.h" 27 #include "nx_tcp.h" 28 #include "nx_arp.h" 29 #include "nx_icmpv6.h" 30 31 32 /**************************************************************************/ 33 /* */ 34 /* FUNCTION RELEASE */ 35 /* */ 36 /* _nx_ip_diferred_link_status_process PORTABLE C */ 37 /* 6.1 */ 38 /* AUTHOR */ 39 /* */ 40 /* Yuxin Zhou, Microsoft Corporation */ 41 /* */ 42 /* DESCRIPTION */ 43 /* */ 44 /* This function processes link status change event. */ 45 /* */ 46 /* INPUT */ 47 /* */ 48 /* ip_ptr Pointer to IP control block */ 49 /* */ 50 /* OUTPUT */ 51 /* */ 52 /* None */ 53 /* */ 54 /* CALLS */ 55 /* */ 56 /* tx_mutex_get Obtain protection mutex */ 57 /* tx_mutex_put Release protection mutex */ 58 /* _nx_tcp_socket_connection_reset Reset TCP connection */ 59 /* _nx_arp_interface_entries_delete Remove specified ARP entries */ 60 /* _nx_nd_cache_interface_entries_delete Delete ND cache entries assoc-*/ 61 /* iated with specified interface*/ 62 /* link_driver_entry Link driver */ 63 /* memset Zero out the interface */ 64 /* */ 65 /* CALLED BY */ 66 /* */ 67 /* nx_ip_thread_entry */ 68 /* */ 69 /* RELEASE HISTORY */ 70 /* */ 71 /* DATE NAME DESCRIPTION */ 72 /* */ 73 /* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ 74 /* 09-30-2020 Yuxin Zhou Modified comment(s), */ 75 /* resulting in version 6.1 */ 76 /* */ 77 /**************************************************************************/ _nx_ip_deferred_link_status_process(NX_IP * ip_ptr)78VOID _nx_ip_deferred_link_status_process(NX_IP *ip_ptr) 79 { 80 81 UINT i; 82 NX_IP_DRIVER driver_request; 83 ULONG link_up; 84 85 if (ip_ptr -> nx_ip_link_status_change_callback == NX_NULL) 86 { 87 88 /* Callback function is not set. */ 89 return; 90 } 91 92 for (i = 0; i < NX_MAX_PHYSICAL_INTERFACES; i++) 93 { 94 if ((ip_ptr -> nx_ip_interface[i].nx_interface_valid) && 95 (ip_ptr -> nx_ip_interface[i].nx_interface_link_status_change)) 96 { 97 98 /* Reset the flag. */ 99 ip_ptr -> nx_ip_interface[i].nx_interface_link_status_change = NX_FALSE; 100 101 driver_request.nx_ip_driver_ptr = ip_ptr; 102 driver_request.nx_ip_driver_command = NX_LINK_GET_STATUS; 103 driver_request.nx_ip_driver_interface = &(ip_ptr -> nx_ip_interface[i]); 104 driver_request.nx_ip_driver_return_ptr = &link_up; 105 106 (ip_ptr -> nx_ip_interface[i].nx_interface_link_driver_entry)(&driver_request); 107 108 /* Invoke the callback function. */ 109 /*lint -e{644} suppress variable might not be initialized, since "link_up" was initialized in nx_interface_link_driver_entry. */ 110 ip_ptr -> nx_ip_link_status_change_callback(ip_ptr, i, link_up); 111 } 112 } 113 } 114 115