vishvananda / netlink

Simple netlink library for go.
Apache License 2.0
2.81k stars 732 forks source link

how can i create different link.Attrs().Index for same nic? #953

Open lddlww opened 7 months ago

lddlww commented 7 months ago

for nic which has multi queues, it would be more index associate with one nic; i want to create different links using "eth0", but follow code always get same Index

link, err := netlink.LinkByName("eth0")
fmt.Println(link.Attrs().Index) // output: 2

link, err := netlink.LinkByName("eth0")
fmt.Println(link.Attrs().Index)// output: 2

how can i do ?

thediveo commented 2 months ago

This is not possible in Linux' current model. Queues are aggregated into netdevs to the best of my knowledge, and there isn't any virtual netdev kind that would allow extracting queues into new netdevs, not least as this would need removing queues, IRQ nightmares, and many follow-up problems.