DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
SVR5

mdi_tx_if_init(D3mdi)


mdi_tx_if_init -- initialize an MDI MP-aware lock structure

Syntax

   #include <sys/types.h>
   #include <sys/stream.h>
   #include <sys/mdi.h>
   #include <sys/ddi.h>
   

int mdi_tx_if_init( mdi_tx_if_t * txint, mdi_tx_checkavail_t tx_avail, mdi_tx_processmsg_t process_msg, void * handle, int flags);

Description

The mdi_tx_if_init(D3mdi) function initializes an MDI MP-aware lock structure. The caller provides pointers to the data and routines used by the mdi_tx_if( ) routine.

This registration routine is called from the driver's open( ) routine.

Arguments


txint
pointer to an mdi_tx_if_t structure, which the driver declares as part of its per-device structure. This registration routine initializes this structure using the remaining parameters.

tx_avail
pointer to a function with prototype:
   void * (*tx_avail)(void * handle);
This routine is called with a single argument, handle, (described below) and must return non-zero if transmit resources are available, zero if not.

process_msg
is a pointer to a function with prototype:
   void (*process_msg)(void * handle, mblk_t * mp);
This routine accepts two arguments, handle (described below) and mp, a pointer to a transmit request STREAMS data message. This routine commits the request to the adapter, and can assume that at most one instance of it is active at any given time. That is, the process_msg function is single-threaded.

handle
pointer to a device-specific data structure required by the driver to identify a particular device (usually the device-table pointer)

flags
Indicates whether the driver is multithreaded. Valid values are:


MDI_TX_MP_SAFE
Driver is not multithreaded but will run on the primary CPU on a multiprocessor system.

MDITX_MP_MT
Driver is multithreaded. Drivers that set this flag must use one of the mp DDI versions (such as 7mp or 8mp).

Return values

On success, mdi_tx_if_init( ) returns 0. Otherwise, it returns a non-zero value from those documented on the errnos(D5) manual page.

Usage

This function is typically called from the MDI driver's config(D2mdi) (DDI 8) or _load(D2mdi) (DDI 7) entry point routine to initialize the MP-aware lock structure and populate the members of the mdi_tx_if structure as much as possible.

Drivers that call this function must set the D_MP flag in their drvinfo(D4) structure (DDI 8) or their devflag(D1) variable (DDI 7)

Context and synchronization

Blockable context.

Hardware applicability

All

Version applicability

mdi: 2, 2.1

Differences between versions

This function is not supported on SCO OpenServer systems, where similar functionality is provided by the mditx_register( ) and mditx_registerMT( ) routines.

References

mdi_tx_if(D3mdi), mdi_tx_if_deinit(D3mdi), mdi_tx_if_disable(D3mdi), mdi_tx_if_enable(D3mdi), mdi_tx_if_init(D3mdi),
19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - June 2005