The devlink part, which is minimal at this time giving just the driver name.
Unified · Split
| @@ -0,0 +1,40 @@ | |||
| 1 | // SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) | ||
| 2 | |||
| 3 | #include "funeth.h" | ||
| 4 | #include "funeth_devlink.h" | ||
| 5 | |||
| 6 | static int fun_dl_info_get(struct devlink *dl, struct devlink_info_req *req, | ||
| 7 | struct netlink_ext_ack *extack) | ||
| 8 | { | ||
| 9 | int err; | ||
| 10 | |||
| 11 | err = devlink_info_driver_name_put(req, KBUILD_MODNAME); | ||
| 12 | if (err) | ||
| 13 | return err; | ||
| 14 | |||
| 15 | return 0; | ||
| 16 | } | ||
| 17 | |||
| 18 | static const struct devlink_ops fun_dl_ops = { | ||
| 19 | .info_get = fun_dl_info_get, | ||
| 20 | }; | ||
| 21 | |||
| 22 | struct devlink *fun_devlink_alloc(struct device *dev) | ||
| 23 | { | ||
| 24 | return devlink_alloc(&fun_dl_ops, sizeof(struct fun_ethdev), dev); | ||
| 25 | } | ||
| 26 | |||
| 27 | void fun_devlink_free(struct devlink *devlink) | ||
| 28 | { | ||
| 29 | devlink_free(devlink); | ||
| 30 | } | ||
| 31 | |||
| 32 | void fun_devlink_register(struct devlink *devlink) | ||
| 33 | { | ||
| 34 | devlink_register(devlink); | ||
| 35 | } | ||
| 36 | |||
| 37 | void fun_devlink_unregister(struct devlink *devlink) | ||
| 38 | { | ||
| 39 | devlink_unregister(devlink); | ||
| 40 | } | ||
| @@ -0,0 +1,13 @@ | |||
| 1 | /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */ | ||
| 2 | |||
| 3 | #ifndef __FUNETH_DEVLINK_H | ||
| 4 | #define __FUNETH_DEVLINK_H | ||
| 5 | |||
| 6 | #include <net/devlink.h> | ||
| 7 | |||
| 8 | struct devlink *fun_devlink_alloc(struct device *dev); | ||
| 9 | void fun_devlink_free(struct devlink *devlink); | ||
| 10 | void fun_devlink_register(struct devlink *devlink); | ||
| 11 | void fun_devlink_unregister(struct devlink *devlink); | ||
| 12 | |||
| 13 | #endif /* __FUNETH_DEVLINK_H */ | ||