1 /* 2 * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved. 3 * 4 * Permission to use, copy, modify, and/or distribute this software for 5 * any purpose with or without fee is hereby granted, provided that the 6 * above copyright notice and this permission notice appear in all 7 * copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 13 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 14 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 15 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 16 * PERFORMANCE OF THIS SOFTWARE. 17 */ 18 19 /** 20 * DOC: qdf_net_if 21 * QCA driver framework (QDF) network interface management APIs 22 */ 23 24 #if !defined(__I_QDF_NET_IF_H) 25 #define __I_QDF_NET_IF_H 26 27 /* Include Files */ 28 #include <qdf_types.h> 29 #include <qdf_util.h> 30 #include <linux/netdevice.h> 31 32 struct qdf_net_if; 33 34 /** 35 * __qdf_net_if_create_dummy_if() - create dummy interface 36 * @nif: interface handle 37 * 38 * This function will create a dummy network interface 39 * 40 * Return: QDF_STATUS_SUCCESS on success 41 */ 42 static inline QDF_STATUS 43 __qdf_net_if_create_dummy_if(struct qdf_net_if *nif) 44 { 45 int ret; 46 47 ret = init_dummy_netdev((struct net_device *)nif); 48 49 return qdf_status_from_os_return(ret); 50 } 51 52 /** 53 * qdf_net_if_get_dev_by_name() - Find a network device by its name 54 * @nif_name: network device name 55 * 56 * This function retrieves the network device by its name 57 * 58 * Return: qdf network device 59 */ 60 static inline struct qdf_net_if * 61 __qdf_net_if_get_dev_by_name(char *nif_name) 62 { 63 if (!nif_name) 64 return NULL; 65 66 return ((struct qdf_net_if *)dev_get_by_name(&init_net, nif_name)); 67 } 68 69 /** 70 * qdf_net_if_release_dev() - Release reference to network device 71 * @nif: network device 72 * 73 * This function releases reference to the network device 74 * 75 * Return: QDF_STATUS_SUCCESS on success 76 */ 77 static inline QDF_STATUS 78 __qdf_net_if_release_dev(struct qdf_net_if *nif) 79 { 80 if (!nif) 81 return QDF_STATUS_E_INVAL; 82 83 dev_put((struct net_device *)nif); 84 85 return QDF_STATUS_SUCCESS; 86 } 87 #endif /*__I_QDF_NET_IF_H */ 88