The simple query of this function solves the problem I have encountered. Learn a lot about the knowledge and implementation of the SYS file system for the Linux kernel. Thanks to the @win of the crowd for their hints.
The network card has the function of carrier interception physically, when the network connection is complete or the network link is disconnected, the hardware of the NIC chip will automatically set the register mark bit to identify.
If the cable link is disconnected, the linksts will be cleared and the hardware will automatically place this position.
In this way, in the network card driver read and write the bit information can determine whether the network link to connect the road.
The NIC driver transmits information through the NETIF_CARRIER_ON/NETIF_CARRIER_OFF/NETIF_CARRIER_OK to the kernel network subsystem.
1 "netif_carrier_on
The function tells the kernel subsystem that the network link is complete.
2 "Netif_carrier_off
The function tells the kernel subsystem that the network is disconnected.
3 "Netif_carrier_ok
Role Query network disconnect or link.
The above function is mainly to change the state of Net_device Dev to tell the kernel link state changes.