operstate

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
operstate [2018/08/26 17:17] – [Where is IF_OPER_DOWN set?] rpjdayoperstate [2018/08/27 11:07] (current) – [Testing under sysfs] rpjday
Line 66: Line 66:
  
 ==== include/uapi/linux/if.h ==== ==== include/uapi/linux/if.h ====
 +
 +Possible values for ''netdev%%->%%operstate'':
  
 <code> <code>
Line 116: Line 118:
 ===== Testing under sysfs ===== ===== Testing under sysfs =====
  
-Unplugging and plugging:+Unplugging and plugging (administratively, the interface remains UP the whole time):
  
 <code> <code>
Line 150: Line 152:
 </code> </code>
  
-This should be set by ''dev_open()'', so it should be up regardless.+This should be set by ''dev_open()'', so it should be up regardless. See usage [[https://elixir.bootlin.com/linux/latest/ident/__LINK_STATE_START|here]].
 ==== netif_oper_up() ==== ==== netif_oper_up() ====
  
-This is the important one related to plugging and unplugging:+This is the important one related to plugging and unplugging (ignore the possibility of ''IF_OPER_UNKNOWN'' for now):
  
 <code> <code>
Line 169: Line 171:
 </code> </code>
 ==== netif_carrier_ok() ==== ==== netif_carrier_ok() ====
 +
 +This routine becomes important shortly:
  
 <code> <code>
Line 199: Line 203:
         struct net_device *netdev = to_net_dev(dev);         struct net_device *netdev = to_net_dev(dev);
  
-        if (netif_running(netdev))  // if IFF_UP, which should be true+        if (netif_running(netdev))  // if __LINK_STATE_START, which should be true
                 return sprintf(buf, fmt_dec, !!netif_carrier_ok(netdev));                 return sprintf(buf, fmt_dec, !!netif_carrier_ok(netdev));
  
Line 277: Line 281:
 EXPORT_SYMBOL(netif_carrier_off); EXPORT_SYMBOL(netif_carrier_off);
 </code> </code>
 +
 +So who calls ''netif_carrier_off()''? Apparently, lots of people.
  • operstate.1535303853.txt.gz
  • Last modified: 2018/08/26 17:17
  • by rpjday