Ejemplo n.º 1
0
boolean_t osm_pkey_find_next_free_entry(IN osm_pkey_tbl_t * p_pkey_tbl,
					OUT uint16_t * p_block_idx,
					OUT uint8_t * p_pkey_idx)
{
	ib_pkey_table_t *p_new_block;

	CL_ASSERT(p_block_idx);
	CL_ASSERT(p_pkey_idx);

	while (*p_block_idx < p_pkey_tbl->max_blocks) {
		if (*p_pkey_idx > IB_NUM_PKEY_ELEMENTS_IN_BLOCK - 1) {
			*p_pkey_idx = 0;
			(*p_block_idx)++;
			if (*p_block_idx >= p_pkey_tbl->max_blocks)
				return FALSE;
		}

		p_new_block =
		    osm_pkey_tbl_new_block_get(p_pkey_tbl, *p_block_idx);

		if (!p_new_block ||
		    ib_pkey_is_invalid(p_new_block->pkey_entry[*p_pkey_idx]))
			return TRUE;
		else
			(*p_pkey_idx)++;
	}
	return FALSE;
}
Ejemplo n.º 2
0
/*
  Store the given pkey in the "new" blocks array.
  Also, make sure the regular block exists.
*/
ib_api_status_t osm_pkey_tbl_set_new_entry(IN osm_pkey_tbl_t * p_pkey_tbl,
					   IN uint16_t block_idx,
					   IN uint8_t pkey_idx,
					   IN uint16_t pkey)
{
	ib_pkey_table_t *p_block;

	if (!(p_block = osm_pkey_tbl_new_block_get(p_pkey_tbl, block_idx))) {
		p_block = (ib_pkey_table_t *) malloc(sizeof(ib_pkey_table_t));
		if (!p_block)
			return IB_ERROR;
		memset(p_block, 0, sizeof(ib_pkey_table_t));
		cl_ptr_vector_set(&p_pkey_tbl->new_blocks, block_idx, p_block);
	}

	p_block->pkey_entry[pkey_idx] = pkey;
	if (p_pkey_tbl->used_blocks <= block_idx)
		p_pkey_tbl->used_blocks = block_idx + 1;

	return IB_SUCCESS;
}
Ejemplo n.º 3
0
/** ===========================================================================
 */
static void dump_port_qos(osm_port_t *p_port)
{
#ifdef SSA_PLUGIN_VERBOSE_LOGGING
	const osm_pkey_tbl_t *p_pkey_tbl;
	const ib_pkey_table_t *block;
	//char *header_line =    "#in out : 0  1  2  3  4  5  6  7  8  9  10 11 12 13 14 15";
	//char *separator_line = "#--------------------------------------------------------";
	//ib_slvl_table_t *p_tbl;
	ib_net16_t pkey;
	uint16_t block_index, max_pkeys, pkey_idx;
	//uint8_t out_port, in_port, num_ports;
	//uint8_t n;

//	ssa_log(SSA_LOG_VERBOSE, "\t\t\tSLVL tables\n");
//	ssa_log(SSA_LOG_VERBOSE, "%s\n", header_line);
//	ssa_log(SSA_LOG_VERBOSE, "%s\n", separator_line);
//
//	out_port = p_port->p_physp->port_num;
//	num_ports = p_port->p_physp->p_node->node_info.num_ports;
//	if (osm_node_get_type(p_port->p_physp->p_node) ==
//		IB_NODE_TYPE_SWITCH) {
//		/* no need to print SL2VL table for port that is down */
//		/* TODO: not sure if it is needed */
//		/*if (!p_port->p_physp->p_remote_physp)
//			continue; */
//
//		for (in_port = 0; in_port <= num_ports; in_port++) {
//			p_tbl = osm_physp_get_slvl_tbl(p_port->p_physp,
//						       in_port);
//			for (i = 0, n = 0; i < 16; i++)
//				n += sprintf(buffer + n, " %-2d",
//					ib_slvl_table_get(p_tbl, i));
//				ssa_log(SSA_LOG_VERBOSE, "%-3d %-3d :%s\n",
//					in_port, out_port, buffer);
//		}
//	} else {
//		p_tbl = osm_physp_get_slvl_tbl(p_port->p_physp, 0);
//		for (i = 0, n = 0; i < 16; i++)
//			n += sprintf(buffer + n, " %-2d",
//					ib_slvl_table_get(p_tbl, i));
//			ssa_log(SSA_LOG_VERBOSE, "%-3d %-3d :%s\n", out_port,
//				out_port, buffer);
//	}
//
	max_pkeys = ntohs(p_port->p_node->node_info.partition_cap);
	ssa_log(SSA_LOG_VERBOSE, "PartitionCap %u\n", max_pkeys);
	p_pkey_tbl = osm_physp_get_pkey_tbl(p_port->p_physp);
	ssa_log(SSA_LOG_VERBOSE, "PKey Table %u used blocks\n",
		p_pkey_tbl->used_blocks);
	for (block_index = 0; block_index < p_pkey_tbl->used_blocks;
	     block_index++) {
		block = osm_pkey_tbl_new_block_get(p_pkey_tbl, block_index);
		if (!block)
			continue;
		for (pkey_idx = 0; pkey_idx < IB_NUM_PKEY_ELEMENTS_IN_BLOCK;
		     pkey_idx++) {
			pkey = block->pkey_entry[pkey_idx];
			if (ib_pkey_is_invalid(pkey))
				continue;
			ssa_log(SSA_LOG_VERBOSE, "PKey 0x%04x at block %u "
				"index %u\n", ntohs(pkey), block_index,
				pkey_idx);
		}
	}
#else
	(void)(p_port);
#endif
}