op_pk_send_forced()

Abstract

Forwards the specified packet through an output packet stream, forces an immediate arrival at the destination module which causes an invocation of the corresponding process, and releases ownership of the packet by the invoking process.

Syntax

op_pk_send_forced (pkptr, outstrm_index)
Argument Type Description
pkptr Packet* pointer to the packet-of-interest
[A pointer to a packet can be obtained from many KPs, including op_pk_create(), op_pk_create_fmt(), op_pk_copy(), op_pk_get(), op_subq_pk_access(), and op_subq_pk_remove().]
outstrm_index int index of an output packet stream of the surrounding module

Return Type

void

No return value.

Example

Excerpt from: example model (models/std/base); process model (acb_fifo); state (svc_compl); enter execs.

/* extract packet at head of queue */
/* this is the packet just finishing service */
pkptr = op_subq_pk_remove (0, OPC_QPOS_HEAD);

/* forward the packet on stream 0, */
/* causing an immediate interrupt at dest. */
op_pk_send_forced (pkptr, 0);

/* server is idle again. */
server_busy = 0;

Details

This KP forwards the specified packet to the destination module without any delay or scheduling. The resulting event is forced, so the simulation event list is not involved in this operation. The forced event causes an immediate invocation of the destination module's process with a stream interrupt. As with other KPs that cause forced interrupts, while the destination process responds, the invoking process is suspended; when the destination process completes the enter executives of an unforced state and releases control, this KP will return control to the invoking process, which will resume at the statement following the call to this KP.

Once a packet is passed to this KP, the invoking process loses ownership of the packet. Any KPs invoked by the sending process which are passed the same packet pointer will result in packet ownership errors. This KP requires a process context, and supports sending of both formatted and unformatted packets.

WARNING: Forced interrupts are inefficient and potentially dangerous in parallel simulations. To execute a forced interrupt, a particular thread of execution must set an execution lock on both current module and the module to which the forced interrupt is to be delivered. As a result, it is possible to run into a deadlock situation. For example, a deadlock will occur if thread 1 is executing an event for module A and attempts to issue a forced interrupt to module B at the same time that thread 2 is executing an event for module B and attempts to issue a forced interrupt to module A.

Purpose

Provides a mechanism to transfer packets within a single node between modules that are connected by packet streams. This KP is a variation of op_pk_send() and is useful in situations where the destination module must receive immediate notification of a packet's arrival, typically to "push through" other packets that are enqueued in the stream, or to allow the originating process to obtain a response before continuing. Other variants of op_pk_send() provide delayed or quiet arrivals at the destination module, and the alternative op_pk_deliver…() KPs provide transport of packets without requiring the presence of a physical stream object.

op_pk_send_forced() allows packets to be forwarded to other processes running in processors or queues, or to transmitter modules that provide an interface to communication links between nodes.

Errors

  • Program Abort: Segmentation violation. (due to an invalid packet pointer or malformed packet)
  • Program Abort: Packet pointer is NIL.
  • Program Abort: Packet pointer references destroyed packet.
  • Program Abort: Packet pointer references unowned packet (<pk_id>).
  • Program Abort: Packet pointer references static packet (<pk_id>).
  • Program Abort: Packet delivery failed at object (<mod_objid>), stream (<instrm_index>).
  • Program Abort: KP requires process context.
  • Recoverable Error: Output stream index (<outstrm_index>) is out-of-range.
  • Recoverable Error: Output stream index (<outstrm_index>) is unoccupied.

Reference

  • Use the KP op_pk_send() to send a packet through the normal event-scheduling technique
  • Use the KP op_pk_send_delayed() to send a packet with a delayed arrival
  • Use the KP op_pk_send_quiet() to send a packet without causing an interrupt at the destination module
  • Use the KP op_pk_deliver…() to forward packets to modules without using packet streams
  • Use the KP op_pk_get() to obtain a pointer to an arriving packet

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