2019-05-29 21:18:04 +07:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2013-09-06 06:42:39 +07:00
|
|
|
/*
|
|
|
|
* Intel MIC Platform Software Stack (MPSS)
|
|
|
|
*
|
|
|
|
* Copyright(c) 2013 Intel Corporation.
|
|
|
|
*
|
|
|
|
* Intel MIC User Space Tools.
|
|
|
|
*/
|
|
|
|
#ifndef _MPSSD_H_
|
|
|
|
#define _MPSSD_H_
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <dirent.h>
|
|
|
|
#include <libgen.h>
|
|
|
|
#include <pthread.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <time.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <sys/dir.h>
|
|
|
|
#include <sys/ioctl.h>
|
|
|
|
#include <sys/poll.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <sys/mman.h>
|
|
|
|
#include <sys/utsname.h>
|
|
|
|
#include <sys/wait.h>
|
|
|
|
#include <netinet/in.h>
|
|
|
|
#include <arpa/inet.h>
|
|
|
|
#include <netdb.h>
|
|
|
|
#include <signal.h>
|
|
|
|
#include <limits.h>
|
|
|
|
#include <syslog.h>
|
|
|
|
#include <getopt.h>
|
|
|
|
#include <net/if.h>
|
|
|
|
#include <linux/if_tun.h>
|
|
|
|
#include <linux/virtio_ids.h>
|
|
|
|
|
|
|
|
#define MICSYSFSDIR "/sys/class/mic"
|
|
|
|
#define LOGFILE_NAME "/var/log/mpssd"
|
|
|
|
#define PAGE_SIZE 4096
|
|
|
|
|
|
|
|
struct mic_console_info {
|
|
|
|
pthread_t console_thread;
|
|
|
|
int virtio_console_fd;
|
|
|
|
void *console_dp;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct mic_net_info {
|
|
|
|
pthread_t net_thread;
|
|
|
|
int virtio_net_fd;
|
|
|
|
int tap_fd;
|
|
|
|
void *net_dp;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct mic_virtblk_info {
|
|
|
|
pthread_t block_thread;
|
|
|
|
int virtio_block_fd;
|
|
|
|
void *block_dp;
|
|
|
|
volatile sig_atomic_t signaled;
|
|
|
|
char *backend_file;
|
|
|
|
int backend;
|
|
|
|
void *backend_addr;
|
|
|
|
long backend_size;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct mic_info {
|
|
|
|
int id;
|
|
|
|
char *name;
|
|
|
|
pthread_t config_thread;
|
2015-09-30 08:14:30 +07:00
|
|
|
pthread_t init_thread;
|
2013-09-06 06:42:39 +07:00
|
|
|
pid_t pid;
|
|
|
|
struct mic_console_info mic_console;
|
|
|
|
struct mic_net_info mic_net;
|
|
|
|
struct mic_virtblk_info mic_virtblk;
|
|
|
|
int restart;
|
2013-10-04 08:06:23 +07:00
|
|
|
int boot_on_resume;
|
2013-09-06 06:42:39 +07:00
|
|
|
struct mic_info *next;
|
|
|
|
};
|
|
|
|
|
2013-10-03 06:09:00 +07:00
|
|
|
__attribute__((format(printf, 1, 2)))
|
2013-09-06 06:42:39 +07:00
|
|
|
void mpsslog(char *format, ...);
|
|
|
|
char *readsysfs(char *dir, char *entry);
|
|
|
|
int setsysfs(char *dir, char *entry, char *value);
|
|
|
|
#endif
|