tfIoctlInterface

Jump to: navigation, search

Table of Contents >> Programmer's Reference


#include <trsocket.h>


int tfIoctlInterface (
ttUserInterface interfaceHandle,
int flag,
void * optionPtr,
int optionLen
);


Function Description

The function allows the user to call the driver special functions. An example of a special function would be to perform driver maintenance or refill a receive pool. This function is provided to allow the user to call the driver and be guaranteed that no other tasks are using the driver at the same time. The flag parameter if below 0x100 is driver specific and has no meaning to the TCP/IP stack.


Empty the Ring of Transmit Buffers

This function should also be called if the user uses the Treck device/interface transmit queue. In this case the user needs to periodically call tfIoctlInterface() to empty the device driver transmit queue as follows:

errorCode = tfIoctlInterface(interfaceHandle,
                             TM_DEV_IOCTL_EMPTY_XMIT_FLAG,
                             (void *)0,
                             0);

In this case the device driver ioctl function will not be called. The Treck stack will internally attempt to empty the device Treck device/interface transmit queue.


Refill the Treck ISR recv Pool

If the user need to get a Treck buffer from the receive ISR, and uses the Treck pre-allocated recv pool of buffers, then the user needs to periodically call tfIoctlInterface() to replenish the Treck ISR recv pool as follows:

errorCode = tfIoctlInterface(interfaceHandle,
                             TM_DEV_IOCTL_REFILL_POOL_FLAG,
                             (void *)0,
                             0);

In this case the device driver ioctl function will not be called. The pool refill will be done internally by the Treck stack.


Parameters

  • interfaceHandle
    The interface handle of the driver's ioctl routine to call.
  • flag
    See below.
  • optionPtr
    Pointer to a tfIoctlInterface() specific parameter.
  • optionLen
    Length of the option.


Flags

  • 0x0 through 0x100
    Device specific.
  • TM_DEV_IOCTL_EMPTY_XMIT_FLAG
    Empty the device driver transmit queue.
  • TM_DEV_IOCTL_REFILL_POOL_FLAG
    Refill the Treck recv pool.
  • TM_DEV_IOCTL_OFFLOAD_GET
    Query the device driver for offload capabilities.
  • TM_DEV_IOCTL_OFFLOAD_SET
    Set the device driver for offload.


Returns when using TM_DEV_IOCTL_EMPTY_XMIT_FLAG

  • TM_ENOERROR
    All buffers have been transmitted.
  • TM_EINPROGRESS
    Some buffers (but not all) have been transmitted.
  • TM_EPERM
    If the transmit queue is not enabled (i.e. the user did not call tfUseInterfaceXmitQueue() successfully).
  • TM_ENXIO
    The device/interface was not opened or configured.
  • (Other)
    As returned from the device driver send routine. Buffers are still in the interface transmit queue, none were sent.


Returns when using TM_DEV_IOCTL_REFILL_POOL_FLAG

  • TM_ENOERROR
    All buffers were allocated.
  • TM_EINPROGRESS
    Some buffers (but not all) have been allocated.
  • TM_EPERM
    The user did not create a recv pool.
  • TM_ENOBUFS
    No buffer could be allocated.
  • TM_ENXIO
    The device/interface was not opened or configured.
  • (Other)
    As returned from the device driver send routine. Buffers are still in the interface transmit queue, none were sent.


Table of Contents >> Programmer's Reference