8 * On-wire encoding is little endian
11 uint16_t version; /* protocol version */
12 uint16_t opcode; /* command opcode */
13 uint32_t flags; /* modifier flags */
14 uint64_t serial; /* serial number */
16 uint32_t pdu_len; /* length of post-cmd layload */
17 uint32_t cmd_crc32; /* cmd checksum */
18 uint32_t pdu_crc32; /* payload checksum */
19 uint8_t payload[0]; /* payload */
26 FIO_SERVER_MAX_PDU = 4096,
30 FIO_NET_CMD_JOB_END = 3,
36 extern int fio_server(void);
37 extern void fio_server_text_output(const char *, unsigned int len);
39 extern int fio_client_connect(const char *);
40 extern int fio_client_send_ini(const char *);
41 extern int fio_handle_clients(void);
43 extern int fio_recv_data(int sk, void *p, unsigned int len);
44 extern int fio_send_data(int sk, const void *p, unsigned int len);
45 extern void fio_net_cmd_crc(struct fio_net_cmd *);
46 extern struct fio_net_cmd *fio_net_cmd_read(int sk);
48 extern int exit_backend;
49 extern int fio_net_port;
51 #if __BYTE_ORDER == __LITTLE_ENDIAN
52 #define le16_to_cpu(x) (x)
53 #define le32_to_cpu(x) (x)
54 #define le64_to_cpu(x) (x)
55 #define cpu_to_le16(x) (x)
56 #define cpu_to_le32(x) (x)
57 #define cpu_to_le64(x) (x)
58 #elif __BYTE_ORDER == __BIG_ENDIAN
59 #define le16_to_cpu(x) __bswap_16(x)
60 #define le32_to_cpu(x) __bswap_32(x)
61 #define le64_to_cpu(x) __bswap_64(x)
62 #define cpu_to_le16(x) __bswap_16(x)
63 #define cpu_to_le32(x) __bswap_32(x)
64 #define cpu_to_le64(x) __bswap_64(x)
66 #error "Endianness not detected"
69 static inline void fio_init_net_cmd(struct fio_net_cmd *cmd)
71 memset(cmd, 0, sizeof(*cmd));
72 cmd->version = cpu_to_le16(FIO_SERVER_VER1);