Ai
12 Star 23 Fork 91

openEuler/opensource-intern
关闭

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
l3mdev.rst 5.20 KB
一键复制 编辑 原始数据 按行查看 历史

l3mdev

l3mdev.c (L3 Master Device)

Function Description

The l3mdev.c file implements the L3 master device support, which allows the core networking code to interact with device drivers that manage L3 master devices like VRF. The following are key functions and their descriptions:

  • Function Explanation: This function registers a lookup function based on the table ID. It first checks if the L3 device type is valid, then locks the spinlock to protect the data structure. If a lookup function for the given type already exists, it returns -EBUSY. Otherwise, it stores the provided function pointer and unlocks the spinlock.
  • Open Capabilities: Developers can register their own lookup functions to extend the L3 device lookup logic.
  • Function Explanation: This function unregisters a lookup function based on the table ID. It checks the L3 device type, locks the spinlock, and if the stored function pointer matches the provided one, it sets it to NULL and unlocks the spinlock.
  • Open Capabilities: Developers can unregister previously registered lookup functions to clean up resources or change the lookup logic.
  • Function Explanation: This function looks up the device index based on the L3 device type, network namespace, and table ID. It checks the L3 device type, locks the spinlock, and if a lookup function is found, it calls the function and returns the result. If no lookup function is found, it returns -EINVAL.
  • Open Capabilities: Developers can use this function to look up the device index for different L3 device types and table IDs.
  • Function Explanation: This function gets the index of the L3 master device. If the device is an L3 master, it returns its index. If the device is an L3 slave, it finds its master and returns the master's index.
  • Open Capabilities: Developers can determine if a device is an L3 master or slave and get the index of the master device.
  • Function Explanation: This function retrieves the FIB table ID associated with the L3 master interface. If the device is an L3 master and has a defined l3mdev_fib_table function, it calls the function to get the FIB table ID. If the device is a slave, it finds its master and performs the same operation.
  • Open Capabilities: Developers can query the FIB table associated with the L3 master interface, potentially influencing routing decisions.
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/openeuler/opensource-intern.git
git@gitee.com:openeuler/opensource-intern.git
openeuler
opensource-intern
opensource-intern
master

搜索帮助