Blame include/opensm/osm_congestion_control.h

Packit 13e616
/*
Packit 13e616
 * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
Packit 13e616
 * Copyright (c) 2002-2008 Mellanox Technologies LTD. All rights reserved.
Packit 13e616
 * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
Packit 13e616
 * Copyright (c) 2012 Lawrence Livermore National Lab.  All rights reserved.
Packit 13e616
 *
Packit 13e616
 * This software is available to you under a choice of one of two
Packit 13e616
 * licenses.  You may choose to be licensed under the terms of the GNU
Packit 13e616
 * General Public License (GPL) Version 2, available from the file
Packit 13e616
 * COPYING in the main directory of this source tree, or the
Packit 13e616
 * OpenIB.org BSD license below:
Packit 13e616
 *
Packit 13e616
 *     Redistribution and use in source and binary forms, with or
Packit 13e616
 *     without modification, are permitted provided that the following
Packit 13e616
 *     conditions are met:
Packit 13e616
 *
Packit 13e616
 *      - Redistributions of source code must retain the above
Packit 13e616
 *        copyright notice, this list of conditions and the following
Packit 13e616
 *        disclaimer.
Packit 13e616
 *
Packit 13e616
 *      - Redistributions in binary form must reproduce the above
Packit 13e616
 *        copyright notice, this list of conditions and the following
Packit 13e616
 *        disclaimer in the documentation and/or other materials
Packit 13e616
 *        provided with the distribution.
Packit 13e616
 *
Packit 13e616
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
Packit 13e616
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
Packit 13e616
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
Packit 13e616
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
Packit 13e616
 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
Packit 13e616
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
Packit 13e616
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
Packit 13e616
 * SOFTWARE.
Packit 13e616
 *
Packit 13e616
 */
Packit 13e616
Packit 13e616
/*
Packit 13e616
 * Abstract:
Packit 13e616
 *    OSM Congestion Control types and prototypes
Packit 13e616
 *
Packit 13e616
 * Author:
Packit 13e616
 *    Albert Chu, LLNL
Packit 13e616
 */
Packit 13e616
Packit 13e616
#ifndef OSM_CONGESTION_CONTROL_H
Packit 13e616
#define OSM_CONGESTION_CONTROL_H
Packit 13e616
Packit 13e616
#include <iba/ib_types.h>
Packit 13e616
#include <complib/cl_types_osd.h>
Packit 13e616
#include <complib/cl_dispatcher.h>
Packit 13e616
#include <opensm/osm_subnet.h>
Packit 13e616
#include <opensm/osm_log.h>
Packit 13e616
#include <opensm/osm_sm.h>
Packit 13e616
#include <opensm/osm_base.h>
Packit 13e616
Packit 13e616
/****s* OpenSM: Base/OSM_DEFAULT_CC_KEY
Packit 13e616
 * NAME
Packit 13e616
 *       OSM_DEFAULT_CC_KEY
Packit 13e616
 *
Packit 13e616
 * DESCRIPTION
Packit 13e616
 *       Congestion Control Key used by OpenSM.
Packit 13e616
 *
Packit 13e616
 * SYNOPSIS
Packit 13e616
 */
Packit 13e616
#define OSM_DEFAULT_CC_KEY 0
Packit 13e616
Packit 13e616
#define OSM_CC_DEFAULT_MAX_OUTSTANDING_QUERIES 500
Packit 13e616
Packit 13e616
#define OSM_CC_TIMEOUT_COUNT_THRESHOLD 3
Packit 13e616
Packit 13e616
/****s* OpenSM: CongestionControl/osm_congestion_control_t
Packit 13e616
*  This object should be treated as opaque and should
Packit 13e616
*  be manipulated only through the provided functions.
Packit 13e616
*/
Packit 13e616
typedef struct osm_congestion_control {
Packit 13e616
	struct osm_opensm *osm;
Packit 13e616
	osm_subn_t *subn;
Packit 13e616
	osm_sm_t *sm;
Packit 13e616
	osm_log_t *log;
Packit 13e616
	osm_mad_pool_t *mad_pool;
Packit 13e616
	atomic32_t trans_id;
Packit 13e616
	osm_vendor_t *vendor;
Packit 13e616
	osm_bind_handle_t bind_handle;
Packit 13e616
	cl_disp_reg_handle_t cc_disp_h;
Packit 13e616
	ib_net64_t port_guid;
Packit 13e616
	atomic32_t outstanding_mads;
Packit 13e616
	atomic32_t outstanding_mads_on_wire;
Packit 13e616
	cl_qlist_t mad_queue;
Packit 13e616
	cl_spinlock_t mad_queue_lock;
Packit 13e616
	cl_event_t cc_poller_wakeup;
Packit 13e616
	cl_event_t outstanding_mads_done_event;
Packit 13e616
	cl_event_t sig_mads_on_wire_continue;
Packit 13e616
	cl_thread_t cc_poller;
Packit 13e616
	osm_thread_state_t thread_state;
Packit 13e616
	ib_sw_cong_setting_t sw_cong_setting;
Packit 13e616
	ib_ca_cong_setting_t ca_cong_setting;
Packit 13e616
	ib_cc_tbl_t cc_tbl[OSM_CCT_ENTRY_MAD_BLOCKS];
Packit 13e616
	unsigned int cc_tbl_mads;
Packit 13e616
} osm_congestion_control_t;
Packit 13e616
/*
Packit 13e616
* FIELDS
Packit 13e616
*       subn
Packit 13e616
*             Subnet object for this subnet.
Packit 13e616
*
Packit 13e616
*       log
Packit 13e616
*             Pointer to the log object.
Packit 13e616
*
Packit 13e616
*       mad_pool
Packit 13e616
*             Pointer to the MAD pool.
Packit 13e616
*
Packit 13e616
*       mad_ctrl
Packit 13e616
*             Mad Controller
Packit 13e616
*********/
Packit 13e616
Packit 13e616
struct osm_opensm;
Packit 13e616
Packit 13e616
int osm_congestion_control_setup(struct osm_opensm *osm);
Packit 13e616
Packit 13e616
int osm_congestion_control_wait_pending_transactions(struct osm_opensm *osm);
Packit 13e616
Packit 13e616
ib_api_status_t osm_congestion_control_init(osm_congestion_control_t * p_cc,
Packit 13e616
					    struct osm_opensm *osm,
Packit 13e616
					    const osm_subn_opt_t * p_opt);
Packit 13e616
Packit 13e616
ib_api_status_t osm_congestion_control_bind(osm_congestion_control_t * p_cc,
Packit 13e616
					    ib_net64_t port_guid);
Packit 13e616
Packit 13e616
void osm_congestion_control_shutdown(osm_congestion_control_t * p_cc);
Packit 13e616
Packit 13e616
void osm_congestion_control_destroy(osm_congestion_control_t * p_cc);
Packit 13e616
Packit 13e616
Packit 13e616
#endif				/* ifndef OSM_CONGESTION_CONTROL_H */