switchdev_port_obj_add(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

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: if SWITCHDEV_F_DEFER is not set, don't be out here in an atomic section without holding rtnl_lock. It's giving danger. πŸ’€

🌈 SEE ALSO 🌈

You know we love a good link-up, so here's the whole squad:

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