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 OmniOS Community Edition (OmniOSce) Association. 16 * Copyright 2023 Oxide Computer Company 17 */ 18 19 #ifndef _VIONA_IO_H_ 20 #define _VIONA_IO_H_ 21 22 #define VNA_IOC (('V' << 16)|('C' << 8)) 23 #define VNA_IOC_CREATE (VNA_IOC | 0x01) 24 #define VNA_IOC_DELETE (VNA_IOC | 0x02) 25 #define VNA_IOC_VERSION (VNA_IOC | 0x03) 26 27 #define VNA_IOC_RING_INIT (VNA_IOC | 0x10) 28 #define VNA_IOC_RING_RESET (VNA_IOC | 0x11) 29 #define VNA_IOC_RING_KICK (VNA_IOC | 0x12) 30 #define VNA_IOC_RING_SET_MSI (VNA_IOC | 0x13) 31 #define VNA_IOC_RING_INTR_CLR (VNA_IOC | 0x14) 32 #define VNA_IOC_RING_SET_STATE (VNA_IOC | 0x15) 33 #define VNA_IOC_RING_GET_STATE (VNA_IOC | 0x16) 34 #define VNA_IOC_RING_PAUSE (VNA_IOC | 0x17) 35 36 #define VNA_IOC_INTR_POLL (VNA_IOC | 0x20) 37 #define VNA_IOC_SET_FEATURES (VNA_IOC | 0x21) 38 #define VNA_IOC_GET_FEATURES (VNA_IOC | 0x22) 39 #define VNA_IOC_SET_NOTIFY_IOP (VNA_IOC | 0x23) 40 #define VNA_IOC_SET_PROMISC (VNA_IOC | 0x24) 41 42 43 /* 44 * Viona Interface Version 45 * 46 * Like bhyve, viona exposes Private interfaces which are nonetheless consumed 47 * by out-of-gate consumers. While those consumers assume all risk of breakage 48 * incurred by subsequent changes, it would be nice to equip them to potentially 49 * detect (and handle) those modifications. 50 * 51 * There are no established criteria for the magnitude of change which requires 52 * this version to be incremented, and maintenance of it is considered a 53 * best-effort activity. Nothing is to be inferred about the magnitude of a 54 * change when the version is modified. It follows no rules like semver. 55 * 56 */ 57 #define VIONA_CURRENT_INTERFACE_VERSION 2 58 59 typedef struct vioc_create { 60 datalink_id_t c_linkid; 61 int c_vmfd; 62 } vioc_create_t; 63 64 typedef struct vioc_ring_init { 65 uint16_t ri_index; 66 uint16_t ri_qsize; 67 uint64_t ri_qaddr; 68 } vioc_ring_init_t; 69 70 typedef struct vioc_ring_state { 71 uint16_t vrs_index; 72 uint16_t vrs_avail_idx; 73 uint16_t vrs_used_idx; 74 uint16_t vrs_qsize; 75 uint64_t vrs_qaddr; 76 } vioc_ring_state_t; 77 78 typedef struct vioc_ring_msi { 79 uint16_t rm_index; 80 uint64_t rm_addr; 81 uint64_t rm_msg; 82 } vioc_ring_msi_t; 83 84 enum viona_vq_id { 85 VIONA_VQ_RX = 0, 86 VIONA_VQ_TX = 1, 87 VIONA_VQ_MAX = 2 88 }; 89 90 typedef enum { 91 VIONA_PROMISC_NONE = 0, 92 VIONA_PROMISC_MULTI, 93 VIONA_PROMISC_ALL, 94 VIONA_PROMISC_MAX, 95 } viona_promisc_t; 96 97 typedef struct vioc_intr_poll { 98 uint32_t vip_status[VIONA_VQ_MAX]; 99 } vioc_intr_poll_t; 100 101 102 #endif /* _VIONA_IO_H_ */ 103