Monday, May 25, 2009

link状态上报

在phy的内核线程里,会周期性的通过MII查询link状态.
        if (phydev->link) {
                phydev->state = PHY_RUNNING;
                netif_carrier_on(phydev->attached_dev);
            } else {
                phydev->state = PHY_NOLINK;
                netif_carrier_off(phydev->attached_dev);
            }

然后通过下面两个函数来进行处理:,
void netif_carrier_on(struct net_device *dev)
{
    if (test_and_clear_bit(__LINK_STATE_NOCARRIER, &dev->state))
        linkwatch_fire_event(dev);
    if (netif_running(dev))
        __netdev_watchdog_up(dev);
}

void netif_carrier_off(struct net_device *dev)
{
    if (!test_and_set_bit(__LINK_STATE_NOCARRIER, &dev->state))
        linkwatch_fire_event(dev);
}
会把状态设到dev->state里.  并调用linkwatch_fire_event来在list:lweventlist中添加一个节点.并由workqueue:linkwatch_work来处理.主要的处理流程为:进行一些协议栈方面的维护工作, 然后调用 netdev_state_change 来notify netdev_chain(事件为NETDEV_CHANGE),以及rtmsg_ifinfo来向group:RTNLGRP_LINK广播RTM_NEWLINK信息.   注册 netdev_chain的包括 rtnetlink. 但其在回调里没作处理. 用户程序通过netlink接收RTNLGRP_LINK的消息即可及时得到通知.

gnome的NetworkManager以及ifplugd间接或直接的使用这种机制.

6 comments:

Anonymous said...

the challenges in pharmacy http://drugstore4.com/fr/product/avapro.html clayton pharmacy [url=http://drugstore4.com/product/biaxin.html]biaxin[/url]
ohio pharmacy board http://drugstore4.com/fr/category/angoisse.html postgraduate degree in clinical pharmacy [url=http://drugstore4.com/de/product/himalaya-menosan.html]babis pharmacy in wynnewood[/url]
pharmacy fraud in credit card billing new york city http://drugstore4.com/product/alesse.html cvs pharmacy stores [url=http://drugstore4.com/de/product/prograf.html]prograf[/url]
cvs pharmacy and utah http://drugstore4.com/fr/product/cialis-super-active.html sav on pharmacy in murrieta california [url=http://drugstore4.com/category/allergies.html]new orleans pharmacy museum[/url]

Anonymous said...

movie theatres for sale http://moviestrawberry.com/films/film_trailer_park_of_terror/ caravan movie tibet [url=http://moviestrawberry.com/films/film_trick_or_treat/]trick or treat[/url]
beastiality movie http://moviestrawberry.com/films/film_shark_in_venice/ basic instinct movie clips [url=http://moviestrawberry.com/films/film_p2/]movie japanese heroes trailer[/url]
ago days evil homer world top yahoo chart movie film http://moviestrawberry.com/films/film_dirty_deeds/ gorillaz movie [url=http://moviestrawberry.com/films/film_the_unknown_marx_brothers/]the unknown marx brothers[/url]
primer movie http://moviestrawberry.com/films/film_ali_baba_goes_to_town/ time machine movie [url=http://moviestrawberry.com/films/film_wanted/]hbo movie line up[/url]
halloween movie download http://moviestrawberry.com/easy-downloads/letter_I/?page=6 download windos movie maker [url=http://moviestrawberry.com/films/film_twilight/]twilight[/url]
schweinehund animated movie by ravenstein http://moviestrawberry.com/hqmoviesbycountry/country_south_africa/ free bootleg movie sites [url=http://moviestrawberry.com/films/film_unholy/]full movie forumz[/url]

Anonymous said...

pocket pc software with mesengers http://freshoemsoftware.com/de/category-3/product-20803/AleoSoft-Flash-Slideshow-Gallery-Maker-1-3 point of sale software free [url=http://freshoemsoftware.com/de/category-7/product-13986/Autodesk-Civil-3D-2006]Autodesk Civil 3D 2006[/url]
Waves Diamond Bundle 5.0 http://freshoemsoftware.com/it/category-100-108/product-11646/Corel-WordPerfect-Office-X3-Standard-Edition network repair software [url=http://freshoemsoftware.com/category-100-112/Multimedia-and-Unterhaltung]mounting software[/url]
trax software http://freshoemsoftware.com/de/category-100-110/product-25827/ASE-ChartDirector-for-PHP-5-0 best programming software [url=http://freshoemsoftware.com/de/product-16334/Audio-Hijack-Pro-2-7-Mac]Audio Hijack Pro 2 7 Mac[/url]
telemarketing script software http://freshoemsoftware.com/category-1/Operation-Systems?page=2 financial case management software [url=http://freshoemsoftware.com/de/category-100-110/product-14347/Tracks-Eraser-Pro-7-1]AppPerfect AgentlessMonitor Professional 7.5[/url]
dbForge Schema Compare for SQL Server 1.1 http://freshoemsoftware.com/es/category-100-103/product-30822/Adobe-After-Effects-CS5-x64 free url submission software [url=http://freshoemsoftware.com/it/category-13/product-22789/American-Shareware-MP3-WAV-Converter-3-9]American Shareware MP3 WAV Converter 3 9[/url]
site software traffic web http://freshoemsoftware.com/es/manufacturer-9/product-13165/AutoCAD-2008 games software download includes suite tools free program card interface [url=http://freshoemsoftware.com/it/category-4/product-12277/Akvis-Coloriage-v1-3-For-Adobe-Photoshop-Cs2]FotoWare FotoStation Pro 5.2.89[/url]

Anonymous said...

reasons to choose free business software http://freshoemsoftware.com/manufacturer-2/product-13576/Office-2007-Enterprise-PL hp software update downloads [url=http://freshoemsoftware.com/category-100-104/product-11601/Flaming-Pear-SolarCell-1-60-for-Adobe-Photoshop]Flaming Pear SolarCell 1 60 for Adobe Photoshop[/url]
Asset Tracker For Networks 8.0 http://freshoemsoftware.com/category-100-108/product-14223/Triplehash-Hutmil-6-8 drive hard mechanic data software recovery repair [url=http://freshoemsoftware.com/fr/category-7/product-16529/ComponentOne-Studio-for-ActiveX-2007]SoapUI Pro 3.0 x64[/url]
Softgroup .NET Explorer Bar 3.0 http://goldoemsoftware.com/legal-software/microsoft-office-2007-enterprise-swedish.html AssetManage 2009 7.1 [url=http://freshoemsoftware.com/fr/category-13/product-18738/AudioProc-1-4]AudioProc 1 4[/url]
Stat-Ease Design Expert 7.0 http://freshoemsoftware.com/es/category-100-107/product-19774/Altova-MapForce-Enterprise-2009 spy software [url=http://freshoemsoftware.com/it/category-2/product-19942/Software-Beinhofer-MachCalc-2-0-Multilanguage]computer managed instruction software[/url]
free advertising software http://freshoemsoftware.com/fr/category-4/product-10463/Redfield-Jama-3D-1-6-for-Adobe-Photoshop management logistics software [url=http://freshoemsoftware.com/category-100-107/product-26777/Lingobit-Localizer-Enterprise-6-0]Lingobit Localizer Enterprise 6 0[/url]
marketing research software http://freshoemsoftware.com/fr/category-100-102/product-18756/Intuit-Turbo-Tax-2006-Home-and-Business barcode printing software [url=http://freshoemsoftware.com/it/category-100-110/product-20315/TurboFTP-6-0]open gl software[/url]

Anonymous said...

rock o n tv http://kzq.in/kiss/ashley/tisdale/and/vanessa/hudgens/kiss advanced mp3 recorder [url=http://kzq.in/madonna/madonna/topeless/fashion/show]madonna topeless fashion show[/url]
free pop up window killers http://kzq.in/jovi/back/stage/with/bon/jovi gothic dress up games [url=http://kzq.in/kylie-minogue/kylie/minogue/children]libra drum and bass[/url]
tupac poem critic reviews http://kzq.in/jimi-hendrix/did/jimi/hendrix leonard redman sacramento [url=http://kzq.in/michael-jackson/videos/con/michael/jackson]videos con michael jackson[/url]
call me crazy mp3 http://kzq.in/lupe-fiasco vital music [url=http://kzq.in/iron-maiden/iron/maiden/beer/mugs]loz sheet music[/url]
ancient quotes about music http://kzq.in/kiss/chocolate/kiss/mouse/treats gospel church 116th street harlem [url=http://kzq.in/kanye-west/kanye/west/stronger/glasses/for/sale]kanye west stronger glasses for sale[/url]
lyrics should i stay or should i go clash http://kzq.in/madonna/sexy/madonna/pictures download chronicles of narnia prince caspian [url=http://kzq.in/killers/killers/real/cast/crew/full/credit/fan/movie]traditional irish music courses[/url]

Anonymous said...

digital music store http://instrumental.kqc.in/whitney-houston-and-cece-winans-count-on-me-instrumental ipod nano applications [url=http://auto-audio.kqc.in/a-walk-through-hell-audio]a walk through hell audio[/url]
wooten future music brothers man instrument tax solo members pay http://dance.kqc.in/download-the-hamster-dance-song zapp i can make u dance mp3 [url=http://pop.kqc.in/pop-cosmetics]rock climbing stickers[/url]
mp3 vincent cheng seasons http://soul.kqc.in/old-soul-and-bisexuality gary mulholland rock list [url=http://dance.kqc.in/dance-music-stores-in-los-angeles]dance music stores in los angeles[/url]
protect all doors http://audio.kqc.in/innovation-audio-australia new ipod commercial [url=http://cassie.kqc.in/cassie-long-way-to-go-lyrics]christmas revels dance words[/url]
real player parameters to auto play audio http://gothic.kqc.in/gothic-examples philadelphia festival chorus [url=http://cassie.kqc.in/cassie-tucker-arrest]cassie tucker arrest[/url]
atma sphere mp3 http://whitney-houston.kqc.in/joy-whitney-houston naming movies for ipod touch [url=http://beyonce.kqc.in/til-the-end-of-time-beyonce]hip hop song list[/url]