blob: 5f98bdafe653160b71c9e848ae2ad6e2e2030170 [file] [log] [blame]
Thomas Gleixner4e43d772019-05-29 07:18:04 -07001/* SPDX-License-Identifier: GPL-2.0-only */
Caz Yokoyama8d497512013-09-05 16:42:39 -07002/*
3 * Intel MIC Platform Software Stack (MPSS)
4 *
5 * Copyright(c) 2013 Intel Corporation.
6 *
Caz Yokoyama8d497512013-09-05 16:42:39 -07007 * Intel MIC User Space Tools.
8 */
9#ifndef _MPSSD_H_
10#define _MPSSD_H_
11
12#include <stdio.h>
13#include <stdlib.h>
14#include <string.h>
15#include <fcntl.h>
16#include <unistd.h>
17#include <dirent.h>
18#include <libgen.h>
19#include <pthread.h>
20#include <stdarg.h>
21#include <time.h>
22#include <errno.h>
23#include <sys/dir.h>
24#include <sys/ioctl.h>
25#include <sys/poll.h>
26#include <sys/types.h>
27#include <sys/socket.h>
28#include <sys/stat.h>
Caz Yokoyama8d497512013-09-05 16:42:39 -070029#include <sys/mman.h>
30#include <sys/utsname.h>
31#include <sys/wait.h>
32#include <netinet/in.h>
33#include <arpa/inet.h>
34#include <netdb.h>
Caz Yokoyama8d497512013-09-05 16:42:39 -070035#include <signal.h>
36#include <limits.h>
37#include <syslog.h>
38#include <getopt.h>
39#include <net/if.h>
40#include <linux/if_tun.h>
Caz Yokoyama8d497512013-09-05 16:42:39 -070041#include <linux/virtio_ids.h>
42
43#define MICSYSFSDIR "/sys/class/mic"
44#define LOGFILE_NAME "/var/log/mpssd"
45#define PAGE_SIZE 4096
46
47struct mic_console_info {
48 pthread_t console_thread;
49 int virtio_console_fd;
50 void *console_dp;
51};
52
53struct mic_net_info {
54 pthread_t net_thread;
55 int virtio_net_fd;
56 int tap_fd;
57 void *net_dp;
58};
59
60struct mic_virtblk_info {
61 pthread_t block_thread;
62 int virtio_block_fd;
63 void *block_dp;
64 volatile sig_atomic_t signaled;
65 char *backend_file;
66 int backend;
67 void *backend_addr;
68 long backend_size;
69};
70
71struct mic_info {
72 int id;
73 char *name;
74 pthread_t config_thread;
Ashutosh Dixitf4a66c22015-09-29 18:14:30 -070075 pthread_t init_thread;
Caz Yokoyama8d497512013-09-05 16:42:39 -070076 pid_t pid;
77 struct mic_console_info mic_console;
78 struct mic_net_info mic_net;
79 struct mic_virtblk_info mic_virtblk;
80 int restart;
Dasaratharaman Chandramouliaf190492013-10-03 18:06:23 -070081 int boot_on_resume;
Caz Yokoyama8d497512013-09-05 16:42:39 -070082 struct mic_info *next;
83};
84
Sudeep Dutt6078e0b2013-10-02 16:09:00 -070085__attribute__((format(printf, 1, 2)))
Caz Yokoyama8d497512013-09-05 16:42:39 -070086void mpsslog(char *format, ...);
87char *readsysfs(char *dir, char *entry);
88int setsysfs(char *dir, char *entry, char *value);
89#endif