Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| operstate [2018/08/26 17:07] – [Where is IP_OPER_DOWN set?] rpjday | operstate [2018/08/27 11:07] (current) – [Testing under sysfs] rpjday | ||
|---|---|---|---|
| Line 66: | Line 66: | ||
| ==== include/ | ==== include/ | ||
| + | |||
| + | Possible values for '' | ||
| < | < | ||
| Line 116: | Line 118: | ||
| ===== Testing under sysfs ===== | ===== Testing under sysfs ===== | ||
| - | Unplugging and plugging: | + | Unplugging and plugging |
| < | < | ||
| Line 150: | Line 152: | ||
| </ | </ | ||
| - | This should be set by '' | + | This should be set by '' |
| ==== 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 |
| < | < | ||
| Line 169: | Line 171: | ||
| </ | </ | ||
| ==== netif_carrier_ok() ==== | ==== netif_carrier_ok() ==== | ||
| + | |||
| + | This routine becomes important shortly: | ||
| < | < | ||
| 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 (netif_running(netdev)) |
| return sprintf(buf, | return sprintf(buf, | ||
| Line 221: | Line 225: | ||
| < | < | ||
| - | |||
| static unsigned char default_operstate(const struct net_device *dev) | static unsigned char default_operstate(const struct net_device *dev) | ||
| { | { | ||
| Line 235: | Line 238: | ||
| </ | </ | ||
| - | which brings us back to who sets '' | + | which brings us back to who sets '' |
| + | |||
| + | ==== Setting/ | ||
| + | |||
| + | From '' | ||
| + | |||
| + | < | ||
| + | /** | ||
| + | | ||
| + | | ||
| + | * | ||
| + | * Device has detected that carrier. | ||
| + | */ | ||
| + | void netif_carrier_on(struct net_device *dev) | ||
| + | { | ||
| + | if (test_and_clear_bit(__LINK_STATE_NOCARRIER, & | ||
| + | if (dev-> | ||
| + | return; | ||
| + | atomic_inc(& | ||
| + | linkwatch_fire_event(dev); | ||
| + | if (netif_running(dev)) | ||
| + | __netdev_watchdog_up(dev); | ||
| + | } | ||
| + | } | ||
| + | EXPORT_SYMBOL(netif_carrier_on); | ||
| + | |||
| + | /** | ||
| + | | ||
| + | | ||
| + | * | ||
| + | * Device has detected loss of carrier. | ||
| + | */ | ||
| + | void netif_carrier_off(struct net_device *dev) | ||
| + | { | ||
| + | if (!test_and_set_bit(__LINK_STATE_NOCARRIER, | ||
| + | if (dev-> | ||
| + | return; | ||
| + | atomic_inc(& | ||
| + | linkwatch_fire_event(dev); | ||
| + | } | ||
| + | } | ||
| + | EXPORT_SYMBOL(netif_carrier_off); | ||
| + | </ | ||
| + | |||
| + | So who calls '' | ||