ADC Home > Reference Library > Technical Q&As > Carbon > Networking >

T_DATA_REQ vs M_DATA TPI Message Blocks


Q: I'm writing an Open Transport module that conforms to the Transport Provider Interface (TPI). I find that OT passes data to my TPI using M_DATA message blocks, rather than M_PROTO message blocks with PRIM_type being T_DATA_REQ. What's going on?

A: The answer can be found at the bottom of the description of T_DATA_REQ (7tpi) in Appendix A-2 of STREAMS Modules and Drivers (Unix Press, ISBN 0-13-066879-6):

The transport provider must also recognize a message of one or more M_DATA message blocks without the leading M_PROTO message block as a T_DATA_REQ primitive. This message type will be initiated from the write (BA_OS) operating system service routine.

OT deliberately uses this variant behavior as an optimization. By using M_DATA, OT avoids allocating a buffer for the M_PROTO header. As every memory allocation takes time, avoiding this one makes the system faster.

This behavior isn't seen on expedited data, because the specification doesn't allow for this optimization on T_EXDATA_REQ.

[Nov 27 1996]


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.