Skip to contentSkip to conversation

Sysfs is too restrictive

DISCUSSION Stephen Hemminger 3 participants 5 messages Feb 27, 2004

lore
Share & tools
lore
#0 lore raw

I have been experimenting with using sysfs to manage Ethernet bridge devices but have to conclude that sysfs is too restrictive to be useful for doing it. Maybe for 2.7, some of the implementation restrictions that tie kobjects directly to the file hierarchy can be lifted.

Here is what I want to do. Assume there are only two kobject's related to bridging. The first is the class device (inside the net_device) that contains "br0". The other is the bridge port which represents an interface in a bridge. The hack method of adding kobjects to create subdirectories would make the already painful ref count issues worse.

It is too hard to get the desired directory layout without re-implementing most of sysfs in the driver. This is what I want, and don't have Pat to kick around anymore.

class
`-- net

    |-- br0
    |   |-- addr_len
    |   |-- address
    |   |-- bridge
    |   |   |-- forward_delay
    |   |   |-- hello_time
    |   |   |-- id
    |   |   |-- max_age
    |   |   |-- port
    |   |   |   |-- cost
    |   |   |   |-- eth0 -> ../../../eth0
    |   |   |   |-- priority
    |   |   |   `-- stp
    |   |   `-- priority
    |   |-- broadcast
    |   |-- features
    |   |-- flags
    |   |-- ifindex
    |   |-- mtu
    |   |-- statistics
    |   |   |-- collisions
    |   |   |-- multicast
    |   |   |-- rx_bytes
    |   |   |-- rx_compressed
    |   |   |-- rx_crc_errors
    |   |   |-- rx_dropped
    |   |   |-- rx_errors
    |   |   |-- rx_fifo_errors
    |   |   |-- rx_frame_errors
    |   |   |-- rx_length_errors
    |   |   |-- rx_missed_errors
    |   |   |-- rx_over_errors
    |   |   |-- rx_packets
    |   |   |-- tx_aborted_errors
    |   |   |-- tx_bytes
    |   |   |-- tx_carrier_errors
    |   |   |-- tx_compressed
    |   |   |-- tx_dropped
    |   |   |-- tx_errors
    |   |   |-- tx_fifo_errors
    |   |   |-- tx_heartbeat_errors
    |   |   |-- tx_packets
    |   |   `-- tx_window_errors
    |   |-- tx_queue_len
    |   `-- type
    `-- eth0
        |-- addr_len
        |-- address
        |-- broadcast
        |-- device -> ../../../devices/pci0000:00/0000:00:1e.0/0000:04:04.0
        |-- driver -> ../../../bus/pci/drivers/e100
        |-- features
        |-- flags
        |-- ifindex
        |-- iflink
        |-- mtu
        |-- statistics
        |   |-- collisions
        |   |-- multicast
        |   |-- rx_bytes
        |   |-- rx_compressed
        |   |-- rx_crc_errors
        |   |-- rx_dropped
        |   |-- rx_errors
        |   |-- rx_fifo_errors
        |   |-- rx_frame_errors
        |   |-- rx_length_errors
        |   |-- rx_missed_errors
        |   |-- rx_over_errors
        |   |-- rx_packets
        |   |-- tx_aborted_errors
        |   |-- tx_bytes
        |   |-- tx_carrier_errors
        |   |-- tx_compressed
        |   |-- tx_dropped
        |   |-- tx_errors
        |   |-- tx_fifo_errors
        |   |-- tx_heartbeat_errors
        |   |-- tx_packets
        |   `-- tx_window_errors
        |-- tx_queue_len
        `-- type

8 directories, 75 files

#1 lore raw
Quoted 4 lines · Stephen Hemminger
    |   |-- bridge
    |   |   |-- forward_delay
    |   |   |-- hello_time
    |   |   |-- id
Quoted 8 lines
    |   |   |-- max_age
    |   |   |-- port
    |   |   |   |-- cost
    |   |   |   |-- eth0 -> ../../../eth0
    |   |   |   |-- priority
    |   |   |   `-- stp
    |   |   `-- priority
    |   |-- broadcast

Shouldn't you be seeing the other side of the bridge in here too ? Ie, if br0 is a bridge between eth0 and eth1, how does that fit your plan ?

Dave

#2 lore raw
Quoted 14 lines · On Fri, 27 Feb 2004 18:14:55 +0000 Dave Jones <[email protected]> wrote:
Quoted 4 lines · Stephen Hemminger
    |   |-- bridge
    |   |   |-- forward_delay
    |   |   |-- hello_time
    |   |   |-- id
Quoted 8 lines
    |   |   |-- max_age
    |   |   |-- port
    |   |   |   |-- cost
    |   |   |   |-- eth0 -> ../../../eth0
    |   |   |   |-- priority
    |   |   |   `-- stp
    |   |   `-- priority
    |   |-- broadcast
Quoted 3 lines

Shouldn't you be seeing the other side of the bridge in here too ? Ie, if br0 is a bridge between eth0 and eth1, how does that fit your plan ?

yes, there would be multiple interfaces in the port directory. More like this:

br0
`-- bridge

    |-- forward_delay
    |-- id
    |-- max_age
    |-- port
    |   |-- eth0
    |   |   |-- cost
    |   |   |-- interface -> ../../../../eth0
    |   |   |-- priority
    |   |   `-- stp
    |   `-- eth1
    |   |   |-- cost
    |   |   |-- interface -> ../../../../eth1
    |   |   |-- priority
    |   |   `-- stp

`-- priority

4 directories, 8 files

#3 lore raw
Quoted 6 lines · Stephen Hemminger
Quoted 3 lines

Shouldn't you be seeing the other side of the bridge in here too ? Ie, if br0 is a bridge between eth0 and eth1, how does that fit your plan ?

yes, there would be multiple interfaces in the port directory. More like this:

Ok, that makes more sense.

Dave

#4 lore raw
In reply to Stephen Hemminger
Quoted 4 lines · Stephen Hemminger

It is too hard to get the desired directory layout without re-implementing most of sysfs in the driver. This is what I want, and don't have Pat to kick around anymore.

Yes, I agree that it needs to be made much easier to create a subdirectory in sysfs using the driver model. I even filed a bug about that a long time ago :)

It's on my TODO list for 2.7, if that makes you feel any better. And if you want to try to implement it before I get to it, that would be great.

Sorry I don't have a solution for you to do this with today :(

greg k-h