blob: 2a333a6b48e0d3a0f6fed9106374fd26ae2313cf [file] [log] [blame]
Kristofer Jonsson3c6a2602022-03-10 11:17:29 +01001/*
2 * Copyright (c) 2022 ARM Limited.
3 *
4 * This program is free software and is provided to you under the terms of the
5 * GNU General Public License version 2 as published by the Free Software
6 * Foundation, and any use by you of this program is subject to the terms
7 * of such GNU licence.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, you can access it online at
16 * http://www.gnu.org/licenses/gpl-2.0.html.
17 *
18 * SPDX-License-Identifier: GPL-2.0-only
19 */
20
21#ifndef ETHOSU_NETWORK_INFO_H
22#define ETHOSU_NETWORK_INFO_H
23
24/****************************************************************************
25 * Includes
26 ****************************************************************************/
27
28#include "ethosu_core_interface.h"
29
30#include <linux/kref.h>
31#include <linux/types.h>
32#include <linux/completion.h>
33
34/****************************************************************************
35 * Types
36 ****************************************************************************/
37
38struct ethosu_device;
39struct ethosu_network;
40struct ethosu_uapi_network_info;
41
42struct ethosu_network_info {
43 struct ethosu_device *edev;
44 struct ethosu_network *net;
45 struct ethosu_uapi_network_info *uapi;
46 struct kref kref;
47 struct list_head list;
48 struct completion done;
49 int errno;
50};
51
52/****************************************************************************
53 * Functions
54 ****************************************************************************/
55
56/**
57 * ethosu_network_info_create() - Create network info
58 *
59 * This function must be called in the context of a user space process.
60 *
61 * Return: Valid pointer on success, else ERR_PTR.
62 */
63struct ethosu_network_info *ethosu_network_info_create(
64 struct ethosu_device *edev,
65 struct ethosu_network *net,
66 struct ethosu_uapi_network_info *uapi);
67
68/**
69 * ethosu_network_info_get() - Get network info
70 */
71void ethosu_network_info_get(struct ethosu_network_info *info);
72
73/**
74 * ethosu_network_info_put() - Put network info
75 */
76void ethosu_network_info_put(struct ethosu_network_info *info);
77
78/**
79 * ethosu_network_info_wait() - Get network info
80 */
81int ethosu_network_info_wait(struct ethosu_network_info *info,
82 int timeout);
83
84/**
85 * ethosu_network_info_rsp() - Handle network info response.
86 */
87void ethosu_network_info_rsp(struct ethosu_device *edev,
88 struct ethosu_core_network_info_rsp *rsp);
89
90#endif /* ETHOSU_NETWORK_INFO_H */