Lines Matching defs:map
86 * We maintain a global counter that is incremented each time a congestion map
105 * - on map changes to inform conns of a new map to send
117 struct rdsv3_cong_map *map;
121 map = avl_find(&rdsv3_cong_tree, insert, &where);
122 if (map == NULL) {
129 map = avl_find(&rdsv3_cong_tree, &map1, &where);
132 return (map);
143 struct rdsv3_cong_map *map;
150 map = kmem_zalloc(sizeof (struct rdsv3_cong_map), KM_NOSLEEP);
151 if (!map)
154 map->m_addr = addr;
155 rdsv3_init_waitqueue(&map->m_waitq);
156 list_create(&map->m_conn_list, sizeof (struct rdsv3_connection),
163 map->m_page_addrs[i] = zp;
167 ret = rdsv3_cong_tree_walk(addr, map);
171 ret = map;
172 map = NULL;
176 if (map) {
177 for (i = 0; i < RDSV3_CONG_MAP_PAGES && map->m_page_addrs[i];
179 kmem_free((void *)map->m_page_addrs[i], PAGE_SIZE);
180 kmem_free(map, sizeof (*map));
183 RDSV3_DPRINTF5("rdsv3_cong_from_addr", "map %p for addr %x",
190 * Put the conn on its local map's list. This is called when the conn is
198 RDSV3_DPRINTF5("rdsv3_cong_add_conn", "conn %p now on map %p",
212 RDSV3_DPRINTF5("rdsv3_cong_remove_conn", "removing conn %p from map %p",
234 rdsv3_cong_queue_updates(struct rdsv3_cong_map *map)
238 RDSV3_DPRINTF4("rdsv3_cong_queue_updates", "Enter(map: %p)", map);
242 RDSV3_FOR_EACH_LIST_NODE(conn, &map->m_conn_list, c_map_item) {
251 RDSV3_DPRINTF4("rdsv3_cong_queue_updates", "Return(map: %p)", map);
255 rdsv3_cong_map_updated(struct rdsv3_cong_map *map, uint64_t portmask)
258 "waking map %p for %u.%u.%u.%u",
259 map, NIPQUAD(map->m_addr));
265 if (waitqueue_active(&map->m_waitq))
267 rdsv3_wake_up(&map->m_waitq);
285 RDSV3_DPRINTF4("rdsv3_cong_map_updated", "Return(map: %p)", map);
304 * the same per-address map.
307 rdsv3_cong_set_bit(struct rdsv3_cong_map *map, uint16_be_t port)
313 "setting congestion for %u.%u.%u.%u:%u in map %p",
314 NIPQUAD(map->m_addr), ntohs(port), map);
318 set_le_bit(off, (void *)map->m_page_addrs[i]);
322 rdsv3_cong_clear_bit(struct rdsv3_cong_map *map, uint16_be_t port)
328 "clearing congestion for %u.%u.%u.%u:%u in map %p\n",
329 NIPQUAD(map->m_addr), ntohs(port), map);
333 clear_le_bit(off, (void *)map->m_page_addrs[i]);
337 rdsv3_cong_test_bit(struct rdsv3_cong_map *map, uint16_be_t port)
348 return (test_le_bit(off, (void *)map->m_page_addrs[i]));
365 struct rdsv3_cong_map *map;
373 /* update congestion map for now-closed port */
375 map = rdsv3_cong_tree_walk(rs->rs_bound_addr, NULL);
378 if (map && rdsv3_cong_test_bit(map, rs->rs_bound_port)) {
379 rdsv3_cong_clear_bit(map, rs->rs_bound_port);
380 rdsv3_cong_queue_updates(map);
385 rdsv3_cong_wait(struct rdsv3_cong_map *map, uint16_be_t port, int nonblock,
393 if (!rdsv3_cong_test_bit(map, port))
410 if (!rdsv3_cong_test_bit(map, port))
418 RDSV3_DPRINTF3("rdsv3_cong_wait", "waiting on map %p for port %u",
419 map, ntohs(port));
422 ret = rdsv3_wait_sig(&map->m_waitq, !rdsv3_cong_test_bit(map, port));
427 mutex_enter(&map->m_waitq.waitq_mutex);
428 map->m_waitq.waitq_waiters++;
429 while (rdsv3_cong_test_bit(map, port)) {
430 ret = cv_wait_sig(&map->m_waitq.waitq_cv,
431 &map->m_waitq.waitq_mutex);
437 map->m_waitq.waitq_waiters--;
438 mutex_exit(&map->m_waitq.waitq_mutex);
446 struct rdsv3_cong_map *map;
451 while ((map = avl_first(&rdsv3_cong_tree))) {
452 RDSV3_DPRINTF5("rdsv3_cong_exit", "freeing map %p\n", map);
453 avl_remove(&rdsv3_cong_tree, map);
454 for (i = 0; i < RDSV3_CONG_MAP_PAGES && map->m_page_addrs[i];
456 kmem_free((void *)map->m_page_addrs[i], PAGE_SIZE);
457 kmem_free(map, sizeof (*map));
469 struct rdsv3_cong_map *map = conn->c_lcong;
472 rm = rdsv3_message_map_pages(map->m_page_addrs, RDSV3_CONG_MAP_BYTES);