{"action":"closed","issue":{"url":"https://api.github.com/repos/RIOT-OS/RIOT/issues/2900","labels_url":"https://api.github.com/repos/RIOT-OS/RIOT/issues/2900/labels{/name}","comments_url":"https://api.github.com/repos/RIOT-OS/RIOT/issues/2900/comments","events_url":"https://api.github.com/repos/RIOT-OS/RIOT/issues/2900/events","html_url":"https://github.com/RIOT-OS/RIOT/issues/2900","id":72383820,"number":2900,"title":"netif auto-initialization suboptimal","user":{"login":"kaspar030","id":4679640,"avatar_url":"https://avatars.githubusercontent.com/u/4679640?v=3","gravatar_id":"","url":"https://api.github.com/users/kaspar030","html_url":"https://github.com/kaspar030","followers_url":"https://api.github.com/users/kaspar030/followers","following_url":"https://api.github.com/users/kaspar030/following{/other_user}","gists_url":"https://api.github.com/users/kaspar030/gists{/gist_id}","starred_url":"https://api.github.com/users/kaspar030/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaspar030/subscriptions","organizations_url":"https://api.github.com/users/kaspar030/orgs","repos_url":"https://api.github.com/users/kaspar030/repos","events_url":"https://api.github.com/users/kaspar030/events{/privacy}","received_events_url":"https://api.github.com/users/kaspar030/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/RIOT-OS/RIOT/labels/network","name":"network","color":"bfdadc"}],"state":"closed","locked":false,"assignee":{"login":"haukepetersen","id":620834,"avatar_url":"https://avatars.githubusercontent.com/u/620834?v=3","gravatar_id":"","url":"https://api.github.com/users/haukepetersen","html_url":"https://github.com/haukepetersen","followers_url":"https://api.github.com/users/haukepetersen/followers","following_url":"https://api.github.com/users/haukepetersen/following{/other_user}","gists_url":"https://api.github.com/users/haukepetersen/gists{/gist_id}","starred_url":"https://api.github.com/users/haukepetersen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haukepetersen/subscriptions","organizations_url":"https://api.github.com/users/haukepetersen/orgs","repos_url":"https://api.github.com/users/haukepetersen/repos","events_url":"https://api.github.com/users/haukepetersen/events{/privacy}","received_events_url":"https://api.github.com/users/haukepetersen/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/RIOT-OS/RIOT/milestones/12","html_url":"https://github.com/RIOT-OS/RIOT/milestones/Release%202015.08","labels_url":"https://api.github.com/repos/RIOT-OS/RIOT/milestones/12/labels","id":1088995,"number":12,"title":"Release 2015.08","description":"This release aims mainly to include the brand new network stack.","creator":{"login":"OlegHahm","id":1590423,"avatar_url":"https://avatars.githubusercontent.com/u/1590423?v=3","gravatar_id":"","url":"https://api.github.com/users/OlegHahm","html_url":"https://github.com/OlegHahm","followers_url":"https://api.github.com/users/OlegHahm/followers","following_url":"https://api.github.com/users/OlegHahm/following{/other_user}","gists_url":"https://api.github.com/users/OlegHahm/gists{/gist_id}","starred_url":"https://api.github.com/users/OlegHahm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OlegHahm/subscriptions","organizations_url":"https://api.github.com/users/OlegHahm/orgs","repos_url":"https://api.github.com/users/OlegHahm/repos","events_url":"https://api.github.com/users/OlegHahm/events{/privacy}","received_events_url":"https://api.github.com/users/OlegHahm/received_events","type":"User","site_admin":false},"open_issues":61,"closed_issues":289,"state":"open","created_at":"2015-04-29T10:11:27Z","updated_at":"2015-08-17T22:26:14Z","due_on":"2015-08-30T22:00:00Z","closed_at":null},"comments":2,"created_at":"2015-05-01T08:26:50Z","updated_at":"2015-08-17T22:26:14Z","closed_at":"2015-08-17T22:26:14Z","body":"Hauke, I'm sorry, but I see flaws in the new network stack auto initialization.\r\n\r\nYou basically put network stack initialization into the boards's directory.\r\nAlready you can see that every now supported board has basically the same ```auto_init_ng_netif()``` function, only differing in the actual driver initialization function call.\r\n\r\nThis will lead to massive code duplication.\r\nJust check the diff between the now-supported devices:\r\n```diff boards/iot-lab_M3/auto_init_ng_netif/netif_board.c boards/samr21-xpro/auto_init_ng_netif/netif_board.c```.\r\nThey are minimal, more impressive is the shared code.\r\n\r\nWant to change the nomac init call? Go change every supported driver.\r\n\r\nYour scheme:\r\n\r\n(board specific:)\r\n1. ```auto_init_ng_netif()``` sets up devices available on the board and\r\n2. starts the corresponding nomac thread.\r\n\r\nI propose a different scheme:\r\n\r\n(board specific):\r\nThe board makefile sets up ```USEMODULE += device_module``` and the corresponding defines for used pins.\r\n(generic:)\r\n1. there's a ```const static``` list of netdev devices somewhere in autoinit_netdev.c\r\n2. on USEMODULE += driver_module, that list gets entries for the available devices\r\n3. ```auto_init_ng_netif()``` calls the initialization function for used devices and\r\n4. starts the corresponding nomac thread.\r\n\r\nThat way, in every board/application, only ```USEMODULE += device_driver``` (and maybe the PIN defines) have to be set up, but starting of any thread is generic.\r\n\r\nWe *need* to keep platform specific code to a minimum. One developer can easily test generic code, but it's impossible to maintain code on different platforms if those platforms are not at hand.\r\n"}}