cxgb_ioctl.h revision 169978
1/************************************************************************** 2 3Copyright (c) 2007, Chelsio Inc. 4All rights reserved. 5 6Redistribution and use in source and binary forms, with or without 7modification, are permitted provided that the following conditions are met: 8 9 1. Redistributions of source code must retain the above copyright notice, 10 this list of conditions and the following disclaimer. 11 12 2. Neither the name of the Chelsio Corporation nor the names of its 13 contributors may be used to endorse or promote products derived from 14 this software without specific prior written permission. 15 16THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26POSSIBILITY OF SUCH DAMAGE. 27 28$FreeBSD: head/sys/dev/cxgb/cxgb_ioctl.h 169978 2007-05-25 09:48:20Z kmacy $ 29 30***************************************************************************/ 31#ifndef __CHIOCTL_H__ 32#define __CHIOCTL_H__ 33 34/* 35 * Ioctl commands specific to this driver. 36 */ 37enum { 38 CH_SETREG = 0x40, 39 CH_GETREG, 40 CH_SETTPI, 41 CH_GETTPI, 42 CH_DEVUP, 43 CH_GETMTUTAB, 44 CH_SETMTUTAB, 45 CH_GETMTU, 46 CH_SET_PM, 47 CH_GET_PM, 48 CH_GET_TCAM, 49 CH_SET_TCAM, 50 CH_GET_TCB, 51 CH_READ_TCAM_WORD, 52 CH_GET_MEM, 53 CH_GET_SGE_CONTEXT, 54 CH_GET_SGE_DESC, 55 CH_LOAD_FW, 56 CH_GET_PROTO, 57 CH_SET_PROTO, 58 CH_SET_TRACE_FILTER, 59 CH_SET_QSET_PARAMS, 60 CH_GET_QSET_PARAMS, 61 CH_SET_QSET_NUM, 62 CH_GET_QSET_NUM, 63 CH_SET_PKTSCHED, 64 CH_IFCONF_GETREGS, 65 CH_GETMIIREGS, 66 CH_SETMIIREGS, 67 CH_SET_FILTER, 68 CH_SET_HW_SCHED, 69}; 70 71struct ch_reg { 72 uint32_t addr; 73 uint32_t val; 74}; 75 76struct ch_cntxt { 77 uint32_t cntxt_type; 78 uint32_t cntxt_id; 79 uint32_t data[4]; 80}; 81 82/* context types */ 83enum { CNTXT_TYPE_EGRESS, CNTXT_TYPE_FL, CNTXT_TYPE_RSP, CNTXT_TYPE_CQ }; 84 85struct ch_desc { 86 uint32_t cmd; 87 uint32_t queue_num; 88 uint32_t idx; 89 uint32_t size; 90 uint8_t data[128]; 91}; 92 93struct ch_mem_range { 94 uint32_t cmd; 95 uint32_t mem_id; 96 uint32_t addr; 97 uint32_t len; 98 uint32_t version; 99 uint8_t *buf; 100}; 101 102struct ch_qset_params { 103 uint32_t qset_idx; 104 int32_t txq_size[3]; 105 int32_t rspq_size; 106 int32_t fl_size[2]; 107 int32_t intr_lat; 108 int32_t polling; 109 int32_t cong_thres; 110 int32_t vector; 111 int32_t qnum; 112}; 113 114struct ch_pktsched_params { 115 uint32_t cmd; 116 uint8_t sched; 117 uint8_t idx; 118 uint8_t min; 119 uint8_t max; 120 uint8_t binding; 121}; 122 123struct ch_hw_sched { 124 uint32_t cmd; 125 uint8_t sched; 126 int8_t mode; 127 int8_t channel; 128 int32_t kbps; /* rate in Kbps */ 129 int32_t class_ipg; /* tenths of nanoseconds */ 130 int32_t flow_ipg; /* usec */ 131}; 132 133#ifndef TCB_SIZE 134# define TCB_SIZE 128 135#endif 136 137/* TCB size in 32-bit words */ 138#define TCB_WORDS (TCB_SIZE / 4) 139 140enum { MEM_CM, MEM_PMRX, MEM_PMTX }; /* ch_mem_range.mem_id values */ 141 142struct ch_mtus { 143 uint32_t cmd; 144 uint32_t nmtus; 145 uint16_t mtus[NMTUS]; 146}; 147 148struct ch_pm { 149 uint32_t cmd; 150 uint32_t tx_pg_sz; 151 uint32_t tx_num_pg; 152 uint32_t rx_pg_sz; 153 uint32_t rx_num_pg; 154 uint32_t pm_total; 155}; 156 157struct ch_tcam { 158 uint32_t cmd; 159 uint32_t tcam_size; 160 uint32_t nservers; 161 uint32_t nroutes; 162 uint32_t nfilters; 163}; 164 165struct ch_tcb { 166 uint32_t cmd; 167 uint32_t tcb_index; 168 uint32_t tcb_data[TCB_WORDS]; 169}; 170 171struct ch_tcam_word { 172 uint32_t cmd; 173 uint32_t addr; 174 uint32_t buf[3]; 175}; 176 177struct ch_trace { 178 uint32_t cmd; 179 uint32_t sip; 180 uint32_t sip_mask; 181 uint32_t dip; 182 uint32_t dip_mask; 183 uint16_t sport; 184 uint16_t sport_mask; 185 uint16_t dport; 186 uint16_t dport_mask; 187 uint32_t vlan:12, 188 vlan_mask:12, 189 intf:4, 190 intf_mask:4; 191 uint8_t proto; 192 uint8_t proto_mask; 193 uint8_t invert_match:1, 194 config_tx:1, 195 config_rx:1, 196 trace_tx:1, 197 trace_rx:1; 198}; 199 200#define REGDUMP_SIZE (4 * 1024) 201 202struct ifconf_regs { 203 uint32_t version; 204 uint32_t len; /* bytes */ 205 uint8_t *data; 206}; 207 208struct mii_data { 209 uint32_t phy_id; 210 uint32_t reg_num; 211 uint32_t val_in; 212 uint32_t val_out; 213}; 214 215#define CHELSIO_SETREG _IOW('f', CH_SETREG, struct ch_reg) 216#define CHELSIO_GETREG _IOWR('f', CH_GETREG, struct ch_reg) 217#define CHELSIO_READ_TCAM_WORD _IOR('f', CH_READ_TCAM_WORD, struct ch_tcam) 218#define CHELSIO_GET_MEM _IOWR('f', CH_GET_MEM, struct ch_mem_range) 219#define CHELSIO_GET_SGE_CONTEXT _IOWR('f', CH_GET_SGE_CONTEXT, struct ch_cntxt) 220#define CHELSIO_GET_SGE_DESC _IOWR('f', CH_GET_SGE_DESC, struct ch_desc) 221#define CHELSIO_GET_QSET_PARAMS _IOWR('f', CH_GET_QSET_PARAMS, struct ch_qset_params) 222#define CHELSIO_SET_QSET_PARAMS _IOW('f', CH_SET_QSET_PARAMS, struct ch_qset_params) 223#define CHELSIO_GET_QSET_NUM _IOWR('f', CH_GET_QSET_NUM, struct ch_reg) 224#define CHELSIO_SET_QSET_NUM _IOW('f', CH_SET_QSET_NUM, struct ch_reg) 225#define CHELSIO_GETMTUTAB _IOR('f', CH_GET_QSET_NUM, struct ch_mtus) 226#define CHELSIO_SETMTUTAB _IOW('f', CH_SET_QSET_NUM, struct ch_mtus) 227 228 229#define CHELSIO_SET_TRACE_FILTER _IOW('f', CH_SET_TRACE_FILTER, struct ch_trace) 230#define CHELSIO_SET_PKTSCHED _IOW('f', CH_SET_PKTSCHED, struct ch_pktsched_params) 231#define CHELSIO_IFCONF_GETREGS _IOWR('f', CH_IFCONF_GETREGS, struct ifconf_regs) 232#define SIOCGMIIREG _IOWR('f', CH_GETMIIREGS, struct mii_data) 233#define SIOCSMIIREG _IOWR('f', CH_SETMIIREGS, struct mii_data) 234#define CHELSIO_SET_HW_SCHED _IOWR('f', CH_SET_HW_SCHED, struct ch_hw_sched) 235#define CHELSIO_DEVUP _IO('f', CH_DEVUP) 236#endif 237