ethnl_req_get_phydev(9)
π ethnl_req_get_phydev(9)
okay so bestie, welcome to the Kernel API Manual β¨ this one's from the ethnl_req_get_phydev(9) page and it's literally all about grabbing the phy_device that this request is targeting β if there even is one π
πΈ NAME πΈ
ethnl_req_get_phydev β Gets the phy_device targeted by this request, if any. π¦
β¨ SYNOPSIS β¨
struct phy_device * ethnl_req_get_phydev (const struct ethnl_req_info
*req_info , struct nlattr **tb , unsigned int header , struct
netlink_ext_ack *extack );
π ARGUMENTS π
req_infoβ the ethnl request you're pulling the phy from π«Άtbβ the netlink attributes array, and it's here purely for error reporting πheaderβ the netlink header index, also used for error reporting πextackβ the netlink extended ACK, again for error reporting π¬
π DESCRIPTION π
so here's the vibe: if a phy_device is returned, the caller must hold rtnl_lock when calling this function β and must keep holding it until it's fully done interacting with the returned phy_device. π IOW, caller must hold rtnl_lock unless they know the netdev has no phy_device. no cap, this is the rule π
β οΈ fr fr, do not skip the lock thing. it's giving "hold rtnl_lock" for a reason π
π RETURN π
you get a phy_device pointer that corresponds either to the passed phy_index, if one is provided. if not? you get the phy_device attached to the net_device targeted by this request. π―
- if there's no targeted
net_device, or nophy_deviceis attached βNULLcomes back π - if the provided
phy_indexis invalid β an error pointer comes back π
π¦ SEE ALSO π¦
Kernel file ./net/ethtool/netlink.h, plus all these iconic siblings β¨:
ethnl_strz_size(9)ethnl_put_strz(9)ethnl_update_u32(9)ethnl_update_u8(9)ethnl_update_u8_u32(9)ethnl_update_bool32(9)ethnl_update_bool(9)ethnl_update_binary(9)ethnl_update_bitfield32(9)ethnl_reply_header_size(9)struct ethnl_req_info(9)struct ethnl_reply_data(9)struct ethnl_request_ops(9)
and that's the whole page, bestie π this one lives in ./net/ethtool, dated October 2026, and it's lowkey the ethnl_req_get_phydev(9) moment of all time π signed off with a π and a π§ β go hold that lock β¨
π¦ 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