1 /* 2 * This file and its contents are supplied under the terms of the 3 * Common Development and Distribution License ("CDDL"), version 1.0. 4 * You may only use this file in accordance with the terms of version 5 * 1.0 of the CDDL. 6 * 7 * A full copy of the text of the CDDL should have accompanied this 8 * source. A copy of the CDDL is also available via the Internet at 9 * http://www.illumos.org/license/CDDL. 10 */ 11 12 /* 13 * Copyright 2013 Pluribus Networks Inc. 14 * Copyright 2018 Joyent, Inc. 15 * Copyright 2022 Oxide Computer Company 16 */ 17 18 #ifndef _VIONA_IO_H_ 19 #define _VIONA_IO_H_ 20 21 #define VNA_IOC (('V' << 16)|('C' << 8)) 22 #define VNA_IOC_CREATE (VNA_IOC | 0x01) 23 #define VNA_IOC_DELETE (VNA_IOC | 0x02) 24 #define VNA_IOC_VERSION (VNA_IOC | 0x03) 25 26 #define VNA_IOC_RING_INIT (VNA_IOC | 0x10) 27 #define VNA_IOC_RING_RESET (VNA_IOC | 0x11) 28 #define VNA_IOC_RING_KICK (VNA_IOC | 0x12) 29 #define VNA_IOC_RING_SET_MSI (VNA_IOC | 0x13) 30 #define VNA_IOC_RING_INTR_CLR (VNA_IOC | 0x14) 31 #define VNA_IOC_RING_SET_STATE (VNA_IOC | 0x15) 32 #define VNA_IOC_RING_GET_STATE (VNA_IOC | 0x16) 33 #define VNA_IOC_RING_PAUSE (VNA_IOC | 0x17) 34 35 #define VNA_IOC_INTR_POLL (VNA_IOC | 0x20) 36 #define VNA_IOC_SET_FEATURES (VNA_IOC | 0x21) 37 #define VNA_IOC_GET_FEATURES (VNA_IOC | 0x22) 38 #define VNA_IOC_SET_NOTIFY_IOP (VNA_IOC | 0x23) 39 40 41 /* 42 * Viona Interface Version 43 * 44 * Like bhyve, viona exposes Private interfaces which are nonetheless consumed 45 * by out-of-gate consumers. While those consumers assume all risk of breakage 46 * incurred by subsequent changes, it would be nice to equip them to potentially 47 * detect (and handle) those modifications. 48 * 49 * There are no established criteria for the magnitude of change which requires 50 * this version to be incremented, and maintenance of it is considered a 51 * best-effort activity. Nothing is to be inferred about the magnitude of a 52 * change when the version is modified. It follows no rules like semver. 53 * 54 */ 55 #define VIONA_CURRENT_INTERFACE_VERSION 1 56 57 typedef struct vioc_create { 58 datalink_id_t c_linkid; 59 int c_vmfd; 60 } vioc_create_t; 61 62 typedef struct vioc_ring_init { 63 uint16_t ri_index; 64 uint16_t ri_qsize; 65 uint64_t ri_qaddr; 66 } vioc_ring_init_t; 67 68 typedef struct vioc_ring_state { 69 uint16_t vrs_index; 70 uint16_t vrs_avail_idx; 71 uint16_t vrs_used_idx; 72 uint16_t vrs_qsize; 73 uint64_t vrs_qaddr; 74 } vioc_ring_state_t; 75 76 typedef struct vioc_ring_msi { 77 uint16_t rm_index; 78 uint64_t rm_addr; 79 uint64_t rm_msg; 80 } vioc_ring_msi_t; 81 82 enum viona_vq_id { 83 VIONA_VQ_RX = 0, 84 VIONA_VQ_TX = 1, 85 VIONA_VQ_MAX = 2 86 }; 87 88 typedef struct vioc_intr_poll { 89 uint32_t vip_status[VIONA_VQ_MAX]; 90 } vioc_intr_poll_t; 91 92 93 #endif /* _VIONA_IO_H_ */ 94