Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  * Linux WiMAX
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  * Implement and export a method for getting a WiMAX device current state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  * Copyright (C) 2009 Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8)  * Based on previous WiMAX core work by:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9)  *  Copyright (C) 2008 Intel Corporation <linux-wimax@intel.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)  *  Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <net/wimax.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <net/genetlink.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/wimax.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <linux/security.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include "wimax-internal.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #define D_SUBMODULE op_state_get
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include "debug-levels.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)  * Exporting to user space over generic netlink
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)  * Parse the state get command from user space, return a combination
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)  * value that describe the current state.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)  * No attributes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) int wimax_gnl_doit_state_get(struct sk_buff *skb, struct genl_info *info)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 	int result, ifindex;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	struct wimax_dev *wimax_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 	d_fnstart(3, NULL, "(skb %p info %p)\n", skb, info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 	result = -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 	if (info->attrs[WIMAX_GNL_STGET_IFIDX] == NULL) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 		pr_err("WIMAX_GNL_OP_STATE_GET: can't find IFIDX attribute\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 		goto error_no_wimax_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 	ifindex = nla_get_u32(info->attrs[WIMAX_GNL_STGET_IFIDX]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 	wimax_dev = wimax_dev_get_by_genl_info(info, ifindex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 	if (wimax_dev == NULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 		goto error_no_wimax_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 	/* Execute the operation and send the result back to user space */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 	result = wimax_state_get(wimax_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 	dev_put(wimax_dev->net_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) error_no_wimax_dev:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 	d_fnend(3, NULL, "(skb %p info %p) = %d\n", skb, info, result);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 	return result;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) }