root/samples/mic/mpssd/mpssd.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /* SPDX-License-Identifier: GPL-2.0-only */
   2 /*
   3  * Intel MIC Platform Software Stack (MPSS)
   4  *
   5  * Copyright(c) 2013 Intel Corporation.
   6  *
   7  * 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>
  29 #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>
  35 #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>
  41 #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 
  47 struct mic_console_info {
  48         pthread_t       console_thread;
  49         int             virtio_console_fd;
  50         void            *console_dp;
  51 };
  52 
  53 struct mic_net_info {
  54         pthread_t       net_thread;
  55         int             virtio_net_fd;
  56         int             tap_fd;
  57         void            *net_dp;
  58 };
  59 
  60 struct 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 
  71 struct mic_info {
  72         int             id;
  73         char            *name;
  74         pthread_t       config_thread;
  75         pthread_t       init_thread;
  76         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;
  81         int             boot_on_resume;
  82         struct mic_info *next;
  83 };
  84 
  85 __attribute__((format(printf, 1, 2)))
  86 void mpsslog(char *format, ...);
  87 char *readsysfs(char *dir, char *entry);
  88 int setsysfs(char *dir, char *entry, char *value);
  89 #endif

/* [<][>][^][v][top][bottom][index][help] */