switchdev_port_obj_add(9)
Okay so bestie, this page from the Kernel API Manual is all about switchdev_port_obj_add(9). It's short, it's iconic, and the lock rule is absolutely the main character. Let's go. β¨
πΈ NAME πΈ
switchdev_port_obj_add β Add port object, periodt. π
π οΈ SYNOPSIS π οΈ
int switchdev_port_obj_add (struct net_device *dev , const struct
switchdev_obj *obj , struct netlink_ext_ack *extack );
That's the whole signature, no cap. π«Ά
π ARGUMENTS π
devβ port device. The device we're working with, bestie. π¦objβ object to add. The actual object, iykyk. πextackβ netlink extended ack. Yep, netlink extended ack. β¨
π DESCRIPTION π
Okay so here's the part where you need to pay attention, bestie, because this is not a drill: rtnl_lock must be held, and you must not be in an atomic section, in case the SWITCHDEV_F_DEFER flag is not set. That's the whole rule, fr fr. π₯
Vibe check: ifSWITCHDEV_F_DEFERis not set, don't be out here in an atomic section without holdingrtnl_lock. It's giving danger. π
π SEE ALSO π
You know we love a good link-up, so here's the whole squad:
- Kernel file
./net/switchdev/switchdev.c switchdev_deferred_process(9)switchdev_port_attr_set(9)switchdev_port_obj_del(9)switchdev_port_obj_act_is_deferred(9)register_switchdev_notifier(9)unregister_switchdev_notifier(9)call_switchdev_notifiers(9)
Go bother them next, iykyk. π§
That's the tea, bestie. This page comes from source ./net/switchdev and is dated October 2026 β catch you on the next man page. Stay hydrated, hold your locks, and slay. π
β¨π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms