op_subq_index_map()

Abstract

Converts an abstract subqueue selection index into an explicit subqueue index.

Syntax

op_subq_index_map (subq_index)
Argument Type Description
subq_index int abstract numeric index of the subqueue-of-interest [This value should be an abstract subqueue selection index that specifies a particular subqueue by a unique property it has. The acceptable abstract subqueue selection indices are listed in Table 85 “Subqueue Selection Index Symbolic Constants“ on page 26.]

Return Type

int

Explicit numeric index of the specified subqueue. The constant OPC_INT_INVALID will be returned if a recoverable error occurs.

Example

/* extract the head of the slowest subqueue */
pkptr = op_subq_pk_remove (OPC_QSEL_MAX_AVG_DELAY, OPC_QPOS_HEAD);

/* determine packet type */
op_pk_nfd_get (pkptr, "operation", &pk_op);

switch (pk_op)
	{
	case DATA_STREAM_PURGE:
		/* forced flush of subqueue */
		mxdel_subq = op_subq_index_map (OPC_QSEL_MAX_AVG_DELAY);
		op_subq_flush (mxdel_subq);

		/* log statistic tagged with packet’s insert time */
		op_stat_write_t (mxdel_subq, 0.0, op_q_insert_time (pkptr));

		/* destroy the packet */
		op_pk_destroy (pkptr);
		break;
	/* ... */ }

Details

Subq package KPs must only be invoked within the context of a process running on a queue module (or from a function which is directly or indirectly invoked by a queue process); invoking them from a process running on a processor, or from a pipeline stage will cause an error.

If the argument flag is a positive value that corresponds one of the physical subqueues (i.e., if it is less than the number of subqueues), then this KP will simply return the value that it is passed.

Purpose

Provides a mechanism to convert an abstract subqueue specification into a concrete subqueue numeric index. Subqueues can be abstractly identified via their properties; for instance, a particular subqueue has the highest average delay (identified by the abstract subqueue selection index OPC_QSEL_MAX_AVG_DELAY) or the smallest number of bits (identified by the abstract subqueue selection index OPC_QSEL_MIN_BITSIZE). Most Subq package KPs accept abstract subqueue selection indices as arguments, allowing powerful combination statements. However, it is sometimes convenient to obtain the actual numeric index of a subqueue, especially if the subqueue’s identity is to be recorded for future reference when the selection conditions may no longer hold, or if the index needs to be used for several operations.

Errors

  • Program Abort: KP requires queue context.
  • Recoverable Error: Subqueue selection flag (<flag>) is unrecognized.

Reference

本站文档由 北京智网畅联科技有限公司 整理、翻译并提供 · Documentation compiled and provided by Beijing ZNetLink Technology Co., Ltd.

交流群 · QQ Group:OPNET/智网妙算网络仿真交流群(群号 486383494)

原文档 © 2017 Riverbed Technology · 本站为公益翻译,由 AI 辅助完成,请仔细甄别

Original documentation © 2017 Riverbed Technology. Community translation, AI-assisted. Contact: jiazequn@znetlink.com