op_intrpt_strm()

Abstract

Obtains the stream index associated with the current interrupt of the invoking process.

Syntax

op_intrpt_strm ()
Argument Type Description
no arguments

Return Type

int

Stream index associated with the current interrupt.

[This value is either set explicitly when a packet is delivered to a specific input stream via the op_pk_deliver…() KPs, or implicitly when a packet is sent through a packet stream via the op_pk_send…() KPs, or a packet stream is accessed via op_strm_access().]

Example

Excerpt from: example model (models/std/eth_net); process model (eth_mac); state (TX_WAIT); exit execs.

/* if the event was an arrival from the physical */
/* layer, accept the packet and decapsulate it */
if (op_intrpt_type() == OPC_INTRPT_STRM &&
	op_intrpt_strm () == LOW_LAYER_INPUT_STREAM)
	{
	eth_mac_phys_pk_accept ();
	}

/* otherwise, if the event is an arrival from the */
/* higher layer, accept the packet and enqueue it */
else if (op_intrpt_type () == OPC_INTRPT_STRM &&
	op_intrpt_strm () == HIGH_LAYER_INPUT_STREAM)
	{
	eth_mac_llc_pk_accept ();
	}

Details

This KP will produce a valid result only when invoked after an interrupt that is associated with a stream. The two types of interrupts that are associated with streams are stream interrupts and access interrupts. In the former case, the stream associated with the interrupt will be an input stream on which a packet has arrived. In the latter case, the stream associated with the interrupt will be an output stream which is being accessed by the module to which it is connected.

Purpose

For stream interrupts, this KP provides the important service of determining which input stream a packet is arriving on (this information is needed to identify the stream to extract the packet via op_pk_get()). For access interrupts, this KP determines which output stream is being accessed by a connected processor or queue.

Errors

  • Program Abort: KP requires process context.
  • Recoverable Error: Current event is not a stream or access interrupt.

Reference

  • Use the KP op_intrpt_type() to determine the type of the current interrupt
  • Use the KP op_intrpt_code() to determine the numeric code associated with the current interrupt
  • Use the KP op_intrpt_stat() to determine the input statistic index associated with a statistic interrupt
  • Use the op_pk_send…() KPs and the op_pk_deliver…() KPs to send or deliver packets to a module input stream
  • Use the KP op_strm_access() to access an output stream of a processor or queue

本站文档由 北京智网畅联科技有限公司 整理、翻译并提供 · 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