17978SPeter.Dunlap@Sun.COM /* 27978SPeter.Dunlap@Sun.COM * CDDL HEADER START 37978SPeter.Dunlap@Sun.COM * 47978SPeter.Dunlap@Sun.COM * The contents of this file are subject to the terms of the 57978SPeter.Dunlap@Sun.COM * Common Development and Distribution License (the "License"). 67978SPeter.Dunlap@Sun.COM * You may not use this file except in compliance with the License. 77978SPeter.Dunlap@Sun.COM * 87978SPeter.Dunlap@Sun.COM * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97978SPeter.Dunlap@Sun.COM * or http://www.opensolaris.org/os/licensing. 107978SPeter.Dunlap@Sun.COM * See the License for the specific language governing permissions 117978SPeter.Dunlap@Sun.COM * and limitations under the License. 127978SPeter.Dunlap@Sun.COM * 137978SPeter.Dunlap@Sun.COM * When distributing Covered Code, include this CDDL HEADER in each 147978SPeter.Dunlap@Sun.COM * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157978SPeter.Dunlap@Sun.COM * If applicable, add the following below this CDDL HEADER, with the 167978SPeter.Dunlap@Sun.COM * fields enclosed by brackets "[]" replaced with your own identifying 177978SPeter.Dunlap@Sun.COM * information: Portions Copyright [yyyy] [name of copyright owner] 187978SPeter.Dunlap@Sun.COM * 197978SPeter.Dunlap@Sun.COM * CDDL HEADER END 207978SPeter.Dunlap@Sun.COM */ 217978SPeter.Dunlap@Sun.COM /* 22*9247SPeter.Dunlap@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 237978SPeter.Dunlap@Sun.COM * Use is subject to license terms. 247978SPeter.Dunlap@Sun.COM */ 257978SPeter.Dunlap@Sun.COM 267978SPeter.Dunlap@Sun.COM #ifndef _IDM_SO_H 277978SPeter.Dunlap@Sun.COM #define _IDM_SO_H 287978SPeter.Dunlap@Sun.COM 297978SPeter.Dunlap@Sun.COM #ifdef __cplusplus 307978SPeter.Dunlap@Sun.COM extern "C" { 317978SPeter.Dunlap@Sun.COM #endif 327978SPeter.Dunlap@Sun.COM 337978SPeter.Dunlap@Sun.COM #include <sys/idm/idm_transport.h> 348348SEric.Yu@Sun.COM #include <sys/ksocket.h> 35*9247SPeter.Dunlap@Sun.COM 367978SPeter.Dunlap@Sun.COM /* 377978SPeter.Dunlap@Sun.COM * Define TCP window size (send and receive buffer sizes) 387978SPeter.Dunlap@Sun.COM */ 397978SPeter.Dunlap@Sun.COM 407978SPeter.Dunlap@Sun.COM #define IDM_RCVBUF_SIZE (256 * 1024) 417978SPeter.Dunlap@Sun.COM #define IDM_SNDBUF_SIZE (256 * 1024) 427978SPeter.Dunlap@Sun.COM 43*9247SPeter.Dunlap@Sun.COM /* 44*9247SPeter.Dunlap@Sun.COM * Lower and upper bounds to use the 128k buffer cache. Below the lower bound 45*9247SPeter.Dunlap@Sun.COM * allocations will use the built-in Solaris buffer caches. We don't expect 46*9247SPeter.Dunlap@Sun.COM * to see allocations above the upper bound because SBD currently allocates 47*9247SPeter.Dunlap@Sun.COM * 128k buffers. 48*9247SPeter.Dunlap@Sun.COM */ 49*9247SPeter.Dunlap@Sun.COM 50*9247SPeter.Dunlap@Sun.COM #define IDM_SO_BUF_CACHE_LB (32 * 1024) 51*9247SPeter.Dunlap@Sun.COM #define IDM_SO_BUF_CACHE_UB (128 * 1024) 52*9247SPeter.Dunlap@Sun.COM 537978SPeter.Dunlap@Sun.COM /* sockets-specific portion of idm_svc_t */ 547978SPeter.Dunlap@Sun.COM typedef struct idm_so_svc_s { 558348SEric.Yu@Sun.COM ksocket_t is_so; 567978SPeter.Dunlap@Sun.COM kthread_t *is_thread; 577978SPeter.Dunlap@Sun.COM kt_did_t is_thread_did; 587978SPeter.Dunlap@Sun.COM boolean_t is_thread_running; 597978SPeter.Dunlap@Sun.COM } idm_so_svc_t; 607978SPeter.Dunlap@Sun.COM 617978SPeter.Dunlap@Sun.COM /* sockets-specific portion of idm_conn_t */ 627978SPeter.Dunlap@Sun.COM typedef struct idm_so_conn_s { 638348SEric.Yu@Sun.COM ksocket_t ic_so; 647978SPeter.Dunlap@Sun.COM 657978SPeter.Dunlap@Sun.COM kthread_t *ic_tx_thread; 667978SPeter.Dunlap@Sun.COM kt_did_t ic_tx_thread_did; 677978SPeter.Dunlap@Sun.COM boolean_t ic_tx_thread_running; 687978SPeter.Dunlap@Sun.COM kmutex_t ic_tx_mutex; 697978SPeter.Dunlap@Sun.COM kcondvar_t ic_tx_cv; 707978SPeter.Dunlap@Sun.COM list_t ic_tx_list; /* List of PDUs for transmit */ 717978SPeter.Dunlap@Sun.COM 727978SPeter.Dunlap@Sun.COM kthread_t *ic_rx_thread; 737978SPeter.Dunlap@Sun.COM kt_did_t ic_rx_thread_did; 747978SPeter.Dunlap@Sun.COM boolean_t ic_rx_thread_running; 757978SPeter.Dunlap@Sun.COM } idm_so_conn_t; 767978SPeter.Dunlap@Sun.COM 777978SPeter.Dunlap@Sun.COM void idm_so_init(idm_transport_t *it); 787978SPeter.Dunlap@Sun.COM void idm_so_fini(); 797978SPeter.Dunlap@Sun.COM 807978SPeter.Dunlap@Sun.COM /* Socket functions */ 817978SPeter.Dunlap@Sun.COM 828348SEric.Yu@Sun.COM ksocket_t 837978SPeter.Dunlap@Sun.COM idm_socreate(int domain, int type, int protocol); 847978SPeter.Dunlap@Sun.COM 858348SEric.Yu@Sun.COM void idm_soshutdown(ksocket_t so); 867978SPeter.Dunlap@Sun.COM 878348SEric.Yu@Sun.COM void idm_sodestroy(ksocket_t so); 887978SPeter.Dunlap@Sun.COM 897978SPeter.Dunlap@Sun.COM int idm_get_ipaddr(idm_addr_list_t **); 907978SPeter.Dunlap@Sun.COM 918348SEric.Yu@Sun.COM int idm_sorecv(ksocket_t so, void *msg, size_t len); 927978SPeter.Dunlap@Sun.COM 938348SEric.Yu@Sun.COM int idm_sosendto(ksocket_t so, void *buff, size_t len, 947978SPeter.Dunlap@Sun.COM struct sockaddr *name, socklen_t namelen); 957978SPeter.Dunlap@Sun.COM 968348SEric.Yu@Sun.COM int idm_iov_sosend(ksocket_t so, iovec_t *iop, int iovlen, 977978SPeter.Dunlap@Sun.COM size_t total_len); 987978SPeter.Dunlap@Sun.COM 998348SEric.Yu@Sun.COM int idm_iov_sorecv(ksocket_t so, iovec_t *iop, int iovlen, 1007978SPeter.Dunlap@Sun.COM size_t total_len); 1017978SPeter.Dunlap@Sun.COM 1027978SPeter.Dunlap@Sun.COM void idm_sotx_thread(void *arg); 1037978SPeter.Dunlap@Sun.COM void idm_sorx_thread(void *arg); 1047978SPeter.Dunlap@Sun.COM 1057978SPeter.Dunlap@Sun.COM 1067978SPeter.Dunlap@Sun.COM int idm_sotx_pdu_constructor(void *hdl, void *arg, int flags); 1077978SPeter.Dunlap@Sun.COM 1087978SPeter.Dunlap@Sun.COM void idm_sotx_pdu_destructor(void *pdu_void, void *arg); 1097978SPeter.Dunlap@Sun.COM 1107978SPeter.Dunlap@Sun.COM int idm_sorx_pdu_constructor(void *hdl, void *arg, int flags); 1117978SPeter.Dunlap@Sun.COM 1127978SPeter.Dunlap@Sun.COM void idm_sorx_pdu_destructor(void *pdu_void, void *arg); 1137978SPeter.Dunlap@Sun.COM 1147978SPeter.Dunlap@Sun.COM void idm_so_svc_port_watcher(void *arg); 1157978SPeter.Dunlap@Sun.COM 1167978SPeter.Dunlap@Sun.COM 1177978SPeter.Dunlap@Sun.COM #ifdef __cplusplus 1187978SPeter.Dunlap@Sun.COM } 1197978SPeter.Dunlap@Sun.COM #endif 1207978SPeter.Dunlap@Sun.COM 1217978SPeter.Dunlap@Sun.COM #endif /* _IDM_SO_H */ 122