1118 mutex_enter(&ib_nodev_conns_lock);
1119 list_insert_tail(&ib_nodev_conns, ic);
1120 mutex_exit(&ib_nodev_conns_lock);
1121
1122 RDSV3_DPRINTF2("rdsv3_ib_conn_alloc", "conn %p conn ic %p",
1123 conn, conn->c_transport_data);
1124 return (0);
1125 }
1126
1127 /*
1128 * Free a connection. Connection must be shut down and not set for reconnect.
1129 */
1130 void
1131 rdsv3_ib_conn_free(void *arg)
1132 {
1133 struct rdsv3_ib_connection *ic = arg;
1134 kmutex_t *lock_ptr;
1135
1136 RDSV3_DPRINTF2("rdsv3_ib_conn_free", "ic %p\n", ic);
1137
1138 #ifndef __lock_lint
1139 /*
1140 * Conn is either on a dev's list or on the nodev list.
1141 * A race with shutdown() or connect() would cause problems
1142 * (since rds_ibdev would change) but that should never happen.
1143 */
1144 lock_ptr = ic->i_on_dev_list ?
1145 &ic->rds_ibdev->spinlock : &ib_nodev_conns_lock;
1146
1147 mutex_enter(lock_ptr);
1148 list_remove_node(&ic->ib_node);
1149 mutex_exit(lock_ptr);
1150 #endif
1151 kmem_free(ic, sizeof (*ic));
1152 }
1153
1154 /*
1155 * An error occurred on the connection
1156 */
1157 void
1158 __rdsv3_ib_conn_error(struct rdsv3_connection *conn)
1159 {
1160 rdsv3_conn_drop(conn);
1161 }
|
1118 mutex_enter(&ib_nodev_conns_lock);
1119 list_insert_tail(&ib_nodev_conns, ic);
1120 mutex_exit(&ib_nodev_conns_lock);
1121
1122 RDSV3_DPRINTF2("rdsv3_ib_conn_alloc", "conn %p conn ic %p",
1123 conn, conn->c_transport_data);
1124 return (0);
1125 }
1126
1127 /*
1128 * Free a connection. Connection must be shut down and not set for reconnect.
1129 */
1130 void
1131 rdsv3_ib_conn_free(void *arg)
1132 {
1133 struct rdsv3_ib_connection *ic = arg;
1134 kmutex_t *lock_ptr;
1135
1136 RDSV3_DPRINTF2("rdsv3_ib_conn_free", "ic %p\n", ic);
1137
1138 /*
1139 * Conn is either on a dev's list or on the nodev list.
1140 * A race with shutdown() or connect() would cause problems
1141 * (since rds_ibdev would change) but that should never happen.
1142 */
1143 lock_ptr = ic->i_on_dev_list ?
1144 &ic->rds_ibdev->spinlock : &ib_nodev_conns_lock;
1145
1146 mutex_enter(lock_ptr);
1147 list_remove_node(&ic->ib_node);
1148 mutex_exit(lock_ptr);
1149 kmem_free(ic, sizeof (*ic));
1150 }
1151
1152 /*
1153 * An error occurred on the connection
1154 */
1155 void
1156 __rdsv3_ib_conn_error(struct rdsv3_connection *conn)
1157 {
1158 rdsv3_conn_drop(conn);
1159 }
|