Divy Le Ray | 4d22de3 | 2007-01-18 22:04:14 -0500 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the Chelsio T3 Ethernet driver for Linux. |
| 3 | * |
| 4 | * Copyright (C) 2003-2006 Chelsio Communications. All rights reserved. |
| 5 | * |
| 6 | * This program is distributed in the hope that it will be useful, but WITHOUT |
| 7 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 8 | * FITNESS FOR A PARTICULAR PURPOSE. See the LICENSE file included in this |
| 9 | * release for licensing terms and conditions. |
| 10 | */ |
| 11 | |
| 12 | #ifndef __CHIOCTL_H__ |
| 13 | #define __CHIOCTL_H__ |
| 14 | |
| 15 | /* |
| 16 | * Ioctl commands specific to this driver. |
| 17 | */ |
| 18 | enum { |
| 19 | CHELSIO_SETREG = 1024, |
| 20 | CHELSIO_GETREG, |
| 21 | CHELSIO_SETTPI, |
| 22 | CHELSIO_GETTPI, |
| 23 | CHELSIO_GETMTUTAB, |
| 24 | CHELSIO_SETMTUTAB, |
| 25 | CHELSIO_GETMTU, |
| 26 | CHELSIO_SET_PM, |
| 27 | CHELSIO_GET_PM, |
| 28 | CHELSIO_GET_TCAM, |
| 29 | CHELSIO_SET_TCAM, |
| 30 | CHELSIO_GET_TCB, |
| 31 | CHELSIO_GET_MEM, |
| 32 | CHELSIO_LOAD_FW, |
| 33 | CHELSIO_GET_PROTO, |
| 34 | CHELSIO_SET_PROTO, |
| 35 | CHELSIO_SET_TRACE_FILTER, |
| 36 | CHELSIO_SET_QSET_PARAMS, |
| 37 | CHELSIO_GET_QSET_PARAMS, |
| 38 | CHELSIO_SET_QSET_NUM, |
| 39 | CHELSIO_GET_QSET_NUM, |
| 40 | CHELSIO_SET_PKTSCHED, |
| 41 | }; |
| 42 | |
| 43 | struct ch_reg { |
| 44 | uint32_t cmd; |
| 45 | uint32_t addr; |
| 46 | uint32_t val; |
| 47 | }; |
| 48 | |
| 49 | struct ch_cntxt { |
| 50 | uint32_t cmd; |
| 51 | uint32_t cntxt_type; |
| 52 | uint32_t cntxt_id; |
| 53 | uint32_t data[4]; |
| 54 | }; |
| 55 | |
| 56 | /* context types */ |
| 57 | enum { CNTXT_TYPE_EGRESS, CNTXT_TYPE_FL, CNTXT_TYPE_RSP, CNTXT_TYPE_CQ }; |
| 58 | |
| 59 | struct ch_desc { |
| 60 | uint32_t cmd; |
| 61 | uint32_t queue_num; |
| 62 | uint32_t idx; |
| 63 | uint32_t size; |
| 64 | uint8_t data[128]; |
| 65 | }; |
| 66 | |
| 67 | struct ch_mem_range { |
| 68 | uint32_t cmd; |
| 69 | uint32_t mem_id; |
| 70 | uint32_t addr; |
| 71 | uint32_t len; |
| 72 | uint32_t version; |
| 73 | uint8_t buf[0]; |
| 74 | }; |
| 75 | |
| 76 | struct ch_qset_params { |
| 77 | uint32_t cmd; |
| 78 | uint32_t qset_idx; |
| 79 | int32_t txq_size[3]; |
| 80 | int32_t rspq_size; |
| 81 | int32_t fl_size[2]; |
| 82 | int32_t intr_lat; |
| 83 | int32_t polling; |
| 84 | int32_t cong_thres; |
| 85 | }; |
| 86 | |
| 87 | struct ch_pktsched_params { |
| 88 | uint32_t cmd; |
| 89 | uint8_t sched; |
| 90 | uint8_t idx; |
| 91 | uint8_t min; |
| 92 | uint8_t max; |
| 93 | uint8_t binding; |
| 94 | }; |
| 95 | |
| 96 | #ifndef TCB_SIZE |
| 97 | # define TCB_SIZE 128 |
| 98 | #endif |
| 99 | |
| 100 | /* TCB size in 32-bit words */ |
| 101 | #define TCB_WORDS (TCB_SIZE / 4) |
| 102 | |
| 103 | enum { MEM_CM, MEM_PMRX, MEM_PMTX }; /* ch_mem_range.mem_id values */ |
| 104 | |
| 105 | struct ch_mtus { |
| 106 | uint32_t cmd; |
| 107 | uint32_t nmtus; |
| 108 | uint16_t mtus[NMTUS]; |
| 109 | }; |
| 110 | |
| 111 | struct ch_pm { |
| 112 | uint32_t cmd; |
| 113 | uint32_t tx_pg_sz; |
| 114 | uint32_t tx_num_pg; |
| 115 | uint32_t rx_pg_sz; |
| 116 | uint32_t rx_num_pg; |
| 117 | uint32_t pm_total; |
| 118 | }; |
| 119 | |
| 120 | struct ch_tcam { |
| 121 | uint32_t cmd; |
| 122 | uint32_t tcam_size; |
| 123 | uint32_t nservers; |
| 124 | uint32_t nroutes; |
| 125 | uint32_t nfilters; |
| 126 | }; |
| 127 | |
| 128 | struct ch_tcb { |
| 129 | uint32_t cmd; |
| 130 | uint32_t tcb_index; |
| 131 | uint32_t tcb_data[TCB_WORDS]; |
| 132 | }; |
| 133 | |
| 134 | struct ch_tcam_word { |
| 135 | uint32_t cmd; |
| 136 | uint32_t addr; |
| 137 | uint32_t buf[3]; |
| 138 | }; |
| 139 | |
| 140 | struct ch_trace { |
| 141 | uint32_t cmd; |
| 142 | uint32_t sip; |
| 143 | uint32_t sip_mask; |
| 144 | uint32_t dip; |
| 145 | uint32_t dip_mask; |
| 146 | uint16_t sport; |
| 147 | uint16_t sport_mask; |
| 148 | uint16_t dport; |
| 149 | uint16_t dport_mask; |
| 150 | uint32_t vlan:12; |
| 151 | uint32_t vlan_mask:12; |
| 152 | uint32_t intf:4; |
| 153 | uint32_t intf_mask:4; |
| 154 | uint8_t proto; |
| 155 | uint8_t proto_mask; |
| 156 | uint8_t invert_match:1; |
| 157 | uint8_t config_tx:1; |
| 158 | uint8_t config_rx:1; |
| 159 | uint8_t trace_tx:1; |
| 160 | uint8_t trace_rx:1; |
| 161 | }; |
| 162 | |
| 163 | #define SIOCCHIOCTL SIOCDEVPRIVATE |
| 164 | |
| 165 | #endif |