Go to main content

man pages section 9: DDI and DKI Driver Entry Points

Exit Print View

Updated: Thursday, June 13, 2019
 
 

sofop_data_in(9E)

Name

sofop_data_in, sofop_data_in_proc, sofop_data_out - filter incoming and outgoing data

Synopsis

#include <sys/sockfilter.h>

mblk_t *prefix_data_in(sof_handle_t hdl, void *cookie, mblk_t *mp);
mblk_t *prefix_data_in_proc(sof_handle_t hdl, void *cookie,
     mblk_t *mp, cred_t *cr);
mblk_t *prefix_data_out(sof_handle_t hdl, void *cookie,
     mblk_t *mp, cred_t *cr, sof_rval_t *rvalp);

Parameters

hdl

per-socket filter handle

cookie

per-socket filter-private data

cr

pointer to the user credential structure for the operation

mp

pointer to msgb(9S) chain

msg

pointer to msghdr structure

rvalp

result parameter, modified on return to give reason for operation failure

Description

The sofop_data_in() entry point is called when data is received, but before the data is placed in the socket's receive buffer. sofop_data_in() may be called from the protocol data path, and the filter should perform minimum amount of processing to minimize the performance impact. Intensive data operations should be performed by sofop_data_in_proc(), if possible.

The sofop_data_in_proc() entry point is called before data is copied out from the socket's receive buffer.

The sofop_data_out() entry point is called before data is passed to the protocol for transmission. The filter can directly modify the content of the address and control buffers pointed to by the message header. If the buffers provided by the message header are insufficient, then the filter can return a control message block as described below.

The message chain passed to sofop_data_in(), sofop_data_in_proc(), and sofop_data_out() consist of one or more message blocks, linked together via b_cont. For sofop_data_in() and sofop_data_in_proc (), the first message block may be of a type other than M_DATA, indicating that control and/or address information may be present, and accessible via sof_mblk_msghdr(9F). In-place modification of a message block is only allowed if db_ref is 1 (see datab(9S)).

Returning a message chain resumes the data operation. The first message block may contain control and/or address information, which can be constructed from a message header structure using sof_mblk_create(9F). The filter can return NULL, which ends the data operation. It is the filter's responsibility to free any message blocks that are not returned to the framework. The filter must not return an empty message chain (a message chain containing no data). In such a case, the message chain should be freed and NULL is returned instead.

Return Values

The sofop_data_in(), sofop_data_in_proc(), and sofop_data_out() entry points return a message block chain on success and NULL if the original message was consumed or if an error occurred. If sofop_data_out() returns NULL, then rvalp must be set to one of the following:

SOF_RVAL_EINVAL

An argument was invalid.

SOF_RVAL_ENOMEM

There was insufficient memory for the operation to complete.

SOF_RVAL_EPERM

Permission was denied.

SOF_RVAL_RETURN

The filter satisfied the request.

Context

The sofop_data_in(), sofop_data_in_proc(), and sofop_data_out() entry points can be called from kernel or user context. The sofop_data_in() entry point can also be called from interrupt context.

Attributes

See attributes(7) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Availability
system/kernel
Interface Stability
Uncommitted

See Also

attributes(7), sof_flowctrl_data_in(9F), sof_inject_data_in(9F), sof_mblk_create(9F), sof_mblk_msghdr(9F), datab(9S), msgb(9S), sof_ops(9S)