Why not create net device for port1~port5 in linux

in openwrt , driver only create net device for eth0, but there are exactly 5 physical ports,
why not to create ethernet1~ehternet5 in kernel so as to operate them by ioctl and socket

This is completely device dependent. If your device has 5 network adapters you will get 5 ports.

A switch controller will usually only present a single device, that manages the switching itself. It isn’t a bunch of network adapters

3 Likes

since openwrt and linux support dsa now, i think switch port should be visible in system now :sweat_smile:

Wishes and dreams don’t write kernel module code.

Submit patches or take it up with the manufacturer

The Asus WL500G is a 32/4 Broadcom device, and was last supported years ago. So you will not find a DSA supporting recent linux kernel for that, I'm afraid.

3 Likes

My guess is that because the switch chip completes Layer 2 forwarding without the need for Linux kernel intervention, there is no need to create netdev( for layer 2 port ). However, Layer 3 forwarding functionalities, such as NAT, rely on the Linux kernel's protocol stack, so a netdev needs to be created.

OpenWrt/swconfig – Gateworks

Because swconfig does not create a network interface per switch port, it can not support STP, LLDP, 802.1x, or other protocols that operate at a network device layer as the CPU can't send/receive packets to/from individual ports on the switch chip.