18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * Copyright (c) 2003-2008 Chelsio, Inc. All rights reserved.
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * This software is available to you under a choice of one of two
58c2ecf20Sopenharmony_ci * licenses.  You may choose to be licensed under the terms of the GNU
68c2ecf20Sopenharmony_ci * General Public License (GPL) Version 2, available from the file
78c2ecf20Sopenharmony_ci * COPYING in the main directory of this source tree, or the
88c2ecf20Sopenharmony_ci * OpenIB.org BSD license below:
98c2ecf20Sopenharmony_ci *
108c2ecf20Sopenharmony_ci *     Redistribution and use in source and binary forms, with or
118c2ecf20Sopenharmony_ci *     without modification, are permitted provided that the following
128c2ecf20Sopenharmony_ci *     conditions are met:
138c2ecf20Sopenharmony_ci *
148c2ecf20Sopenharmony_ci *      - Redistributions of source code must retain the above
158c2ecf20Sopenharmony_ci *        copyright notice, this list of conditions and the following
168c2ecf20Sopenharmony_ci *        disclaimer.
178c2ecf20Sopenharmony_ci *
188c2ecf20Sopenharmony_ci *      - Redistributions in binary form must reproduce the above
198c2ecf20Sopenharmony_ci *        copyright notice, this list of conditions and the following
208c2ecf20Sopenharmony_ci *        disclaimer in the documentation and/or other materials
218c2ecf20Sopenharmony_ci *        provided with the distribution.
228c2ecf20Sopenharmony_ci *
238c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
248c2ecf20Sopenharmony_ci * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
258c2ecf20Sopenharmony_ci * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
268c2ecf20Sopenharmony_ci * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
278c2ecf20Sopenharmony_ci * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
288c2ecf20Sopenharmony_ci * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
298c2ecf20Sopenharmony_ci * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
308c2ecf20Sopenharmony_ci * SOFTWARE.
318c2ecf20Sopenharmony_ci */
328c2ecf20Sopenharmony_ci#ifndef __CHIOCTL_H__
338c2ecf20Sopenharmony_ci#define __CHIOCTL_H__
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci/*
368c2ecf20Sopenharmony_ci * Ioctl commands specific to this driver.
378c2ecf20Sopenharmony_ci */
388c2ecf20Sopenharmony_cienum {
398c2ecf20Sopenharmony_ci	CHELSIO_GETMTUTAB 		= 1029,
408c2ecf20Sopenharmony_ci	CHELSIO_SETMTUTAB 		= 1030,
418c2ecf20Sopenharmony_ci	CHELSIO_SET_PM 			= 1032,
428c2ecf20Sopenharmony_ci	CHELSIO_GET_PM			= 1033,
438c2ecf20Sopenharmony_ci	CHELSIO_GET_MEM			= 1038,
448c2ecf20Sopenharmony_ci	CHELSIO_LOAD_FW			= 1041,
458c2ecf20Sopenharmony_ci	CHELSIO_SET_TRACE_FILTER	= 1044,
468c2ecf20Sopenharmony_ci	CHELSIO_SET_QSET_PARAMS		= 1045,
478c2ecf20Sopenharmony_ci	CHELSIO_GET_QSET_PARAMS		= 1046,
488c2ecf20Sopenharmony_ci	CHELSIO_SET_QSET_NUM		= 1047,
498c2ecf20Sopenharmony_ci	CHELSIO_GET_QSET_NUM		= 1048,
508c2ecf20Sopenharmony_ci};
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_cistruct ch_reg {
538c2ecf20Sopenharmony_ci	uint32_t cmd;
548c2ecf20Sopenharmony_ci	uint32_t addr;
558c2ecf20Sopenharmony_ci	uint32_t val;
568c2ecf20Sopenharmony_ci};
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_cistruct ch_cntxt {
598c2ecf20Sopenharmony_ci	uint32_t cmd;
608c2ecf20Sopenharmony_ci	uint32_t cntxt_type;
618c2ecf20Sopenharmony_ci	uint32_t cntxt_id;
628c2ecf20Sopenharmony_ci	uint32_t data[4];
638c2ecf20Sopenharmony_ci};
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ci/* context types */
668c2ecf20Sopenharmony_cienum { CNTXT_TYPE_EGRESS, CNTXT_TYPE_FL, CNTXT_TYPE_RSP, CNTXT_TYPE_CQ };
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_cistruct ch_desc {
698c2ecf20Sopenharmony_ci	uint32_t cmd;
708c2ecf20Sopenharmony_ci	uint32_t queue_num;
718c2ecf20Sopenharmony_ci	uint32_t idx;
728c2ecf20Sopenharmony_ci	uint32_t size;
738c2ecf20Sopenharmony_ci	uint8_t data[128];
748c2ecf20Sopenharmony_ci};
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_cistruct ch_mem_range {
778c2ecf20Sopenharmony_ci	uint32_t cmd;
788c2ecf20Sopenharmony_ci	uint32_t mem_id;
798c2ecf20Sopenharmony_ci	uint32_t addr;
808c2ecf20Sopenharmony_ci	uint32_t len;
818c2ecf20Sopenharmony_ci	uint32_t version;
828c2ecf20Sopenharmony_ci	uint8_t buf[];
838c2ecf20Sopenharmony_ci};
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_cistruct ch_qset_params {
868c2ecf20Sopenharmony_ci	uint32_t cmd;
878c2ecf20Sopenharmony_ci	uint32_t qset_idx;
888c2ecf20Sopenharmony_ci	int32_t txq_size[3];
898c2ecf20Sopenharmony_ci	int32_t rspq_size;
908c2ecf20Sopenharmony_ci	int32_t fl_size[2];
918c2ecf20Sopenharmony_ci	int32_t intr_lat;
928c2ecf20Sopenharmony_ci	int32_t polling;
938c2ecf20Sopenharmony_ci	int32_t lro;
948c2ecf20Sopenharmony_ci	int32_t cong_thres;
958c2ecf20Sopenharmony_ci	int32_t  vector;
968c2ecf20Sopenharmony_ci	int32_t  qnum;
978c2ecf20Sopenharmony_ci};
988c2ecf20Sopenharmony_ci
998c2ecf20Sopenharmony_cistruct ch_pktsched_params {
1008c2ecf20Sopenharmony_ci	uint32_t cmd;
1018c2ecf20Sopenharmony_ci	uint8_t sched;
1028c2ecf20Sopenharmony_ci	uint8_t idx;
1038c2ecf20Sopenharmony_ci	uint8_t min;
1048c2ecf20Sopenharmony_ci	uint8_t max;
1058c2ecf20Sopenharmony_ci	uint8_t binding;
1068c2ecf20Sopenharmony_ci};
1078c2ecf20Sopenharmony_ci
1088c2ecf20Sopenharmony_ci#ifndef TCB_SIZE
1098c2ecf20Sopenharmony_ci# define TCB_SIZE   128
1108c2ecf20Sopenharmony_ci#endif
1118c2ecf20Sopenharmony_ci
1128c2ecf20Sopenharmony_ci/* TCB size in 32-bit words */
1138c2ecf20Sopenharmony_ci#define TCB_WORDS (TCB_SIZE / 4)
1148c2ecf20Sopenharmony_ci
1158c2ecf20Sopenharmony_cienum { MEM_CM, MEM_PMRX, MEM_PMTX };	/* ch_mem_range.mem_id values */
1168c2ecf20Sopenharmony_ci
1178c2ecf20Sopenharmony_cistruct ch_mtus {
1188c2ecf20Sopenharmony_ci	uint32_t cmd;
1198c2ecf20Sopenharmony_ci	uint32_t nmtus;
1208c2ecf20Sopenharmony_ci	uint16_t mtus[NMTUS];
1218c2ecf20Sopenharmony_ci};
1228c2ecf20Sopenharmony_ci
1238c2ecf20Sopenharmony_cistruct ch_pm {
1248c2ecf20Sopenharmony_ci	uint32_t cmd;
1258c2ecf20Sopenharmony_ci	uint32_t tx_pg_sz;
1268c2ecf20Sopenharmony_ci	uint32_t tx_num_pg;
1278c2ecf20Sopenharmony_ci	uint32_t rx_pg_sz;
1288c2ecf20Sopenharmony_ci	uint32_t rx_num_pg;
1298c2ecf20Sopenharmony_ci	uint32_t pm_total;
1308c2ecf20Sopenharmony_ci};
1318c2ecf20Sopenharmony_ci
1328c2ecf20Sopenharmony_cistruct ch_tcam {
1338c2ecf20Sopenharmony_ci	uint32_t cmd;
1348c2ecf20Sopenharmony_ci	uint32_t tcam_size;
1358c2ecf20Sopenharmony_ci	uint32_t nservers;
1368c2ecf20Sopenharmony_ci	uint32_t nroutes;
1378c2ecf20Sopenharmony_ci	uint32_t nfilters;
1388c2ecf20Sopenharmony_ci};
1398c2ecf20Sopenharmony_ci
1408c2ecf20Sopenharmony_cistruct ch_tcb {
1418c2ecf20Sopenharmony_ci	uint32_t cmd;
1428c2ecf20Sopenharmony_ci	uint32_t tcb_index;
1438c2ecf20Sopenharmony_ci	uint32_t tcb_data[TCB_WORDS];
1448c2ecf20Sopenharmony_ci};
1458c2ecf20Sopenharmony_ci
1468c2ecf20Sopenharmony_cistruct ch_tcam_word {
1478c2ecf20Sopenharmony_ci	uint32_t cmd;
1488c2ecf20Sopenharmony_ci	uint32_t addr;
1498c2ecf20Sopenharmony_ci	uint32_t buf[3];
1508c2ecf20Sopenharmony_ci};
1518c2ecf20Sopenharmony_ci
1528c2ecf20Sopenharmony_cistruct ch_trace {
1538c2ecf20Sopenharmony_ci	uint32_t cmd;
1548c2ecf20Sopenharmony_ci	uint32_t sip;
1558c2ecf20Sopenharmony_ci	uint32_t sip_mask;
1568c2ecf20Sopenharmony_ci	uint32_t dip;
1578c2ecf20Sopenharmony_ci	uint32_t dip_mask;
1588c2ecf20Sopenharmony_ci	uint16_t sport;
1598c2ecf20Sopenharmony_ci	uint16_t sport_mask;
1608c2ecf20Sopenharmony_ci	uint16_t dport;
1618c2ecf20Sopenharmony_ci	uint16_t dport_mask;
1628c2ecf20Sopenharmony_ci	uint32_t vlan:12;
1638c2ecf20Sopenharmony_ci	uint32_t vlan_mask:12;
1648c2ecf20Sopenharmony_ci	uint32_t intf:4;
1658c2ecf20Sopenharmony_ci	uint32_t intf_mask:4;
1668c2ecf20Sopenharmony_ci	uint8_t proto;
1678c2ecf20Sopenharmony_ci	uint8_t proto_mask;
1688c2ecf20Sopenharmony_ci	uint8_t invert_match:1;
1698c2ecf20Sopenharmony_ci	uint8_t config_tx:1;
1708c2ecf20Sopenharmony_ci	uint8_t config_rx:1;
1718c2ecf20Sopenharmony_ci	uint8_t trace_tx:1;
1728c2ecf20Sopenharmony_ci	uint8_t trace_rx:1;
1738c2ecf20Sopenharmony_ci};
1748c2ecf20Sopenharmony_ci
1758c2ecf20Sopenharmony_ci#define SIOCCHIOCTL SIOCDEVPRIVATE
1768c2ecf20Sopenharmony_ci
1778c2ecf20Sopenharmony_ci#endif
178