Skip Navigation Links | |
Exit Print View | |
man pages section 9: DDI and DKI Kernel Functions Oracle Solaris 11.1 Information Library |
csx_AccessConfigurationRegister(9F)
csx_Parse_CISTPL_BYTEORDER(9F)
csx_Parse_CISTPL_CFTABLE_ENTRY(9F)
csx_Parse_CISTPL_DEVICEGEO(9F)
csx_Parse_CISTPL_DEVICEGEO_A(9F)
csx_Parse_CISTPL_DEVICE_OA(9F)
csx_Parse_CISTPL_DEVICE_OC(9F)
csx_Parse_CISTPL_LINKTARGET(9F)
csx_Parse_CISTPL_LONGLINK_A(9F)
csx_Parse_CISTPL_LONGLINK_C(9F)
csx_Parse_CISTPL_LONGLINK_MFC(9F)
ddi_get_soft_iblock_cookie(9F)
ddi_intr_get_supported_types(9F)
ddi_prop_lookup_byte_array(9F)
ddi_prop_lookup_int64_array(9F)
ddi_prop_lookup_string_array(9F)
ddi_prop_update_byte_array(9F)
ddi_prop_update_int64_array(9F)
ddi_prop_update_string_array(9F)
ldi_prop_lookup_byte_array(9F)
ldi_prop_lookup_int64_array(9F)
ldi_prop_lookup_string_array(9F)
mac_prop_info_set_default_link_flowctrl(9F)
mac_prop_info_set_default_str(9F)
mac_prop_info_set_default_uint8(9F)
mac_prop_info_set_range_uint32(9F)
net_event_notify_unregister(9F)
net_instance_notify_register(9F)
net_instance_notify_unregister(9F)
net_instance_protocol_unregister(9F)
net_protocol_notify_register(9F)
nvlist_lookup_boolean_array(9F)
nvlist_lookup_boolean_value(9F)
nvlist_lookup_nvlist_array(9F)
nvlist_lookup_string_array(9F)
nvlist_lookup_uint16_array(9F)
nvlist_lookup_uint32_array(9F)
nvlist_lookup_uint64_array(9F)
nvpair_value_boolean_array(9F)
pci_plist_lookup_int16_array(9F)
pci_plist_lookup_int32_array(9F)
pci_plist_lookup_int64_array(9F)
pci_plist_lookup_int8_array(9F)
pci_plist_lookup_string_array(9F)
pci_plist_lookup_uint16_array(9F)
pci_plist_lookup_uint32_array(9F)
pci_plist_lookup_uint64_array(9F)
pci_plist_lookup_uint8_array(9F)
scsi_get_device_type_scsi_options(9F)
scsi_get_device_type_string(9F)
scsi_sense_cmdspecific_uint64(9F)
usb_get_current_frame_number(9F)
usb_get_max_pkts_per_isoc_request(9F)
usb_pipe_get_max_bulk_transfer_size(9F)
usb_pipe_stop_intr_polling(9F)
usb_pipe_stop_isoc_polling(9F)
- Allow completion of pending pipe requests
#include <sys/usb/usba.h> int usb_pipe_drain_reqs(dev_info_t *dip, usb_pipe_handle_t pipe_handle, uint_t timeout, usb_flags_t usb_flags, void (*callback)(usb_pipe_handle_t pipe_handle, usb_opaque_t callback_arg, int rval, usb_cb_flags_t flags), usb_opaque_t callback_arg);
Solaris DDI specific (Solaris DDI)
Pointer to the device's dev_info structure.
Handle of the pipe containing pending requests.
Maximum wait time for requests to drain. Must be a non-negative value in seconds. Zero specifies no timeout.
USB_FLAGS_SLEEP is the only flag recognized. Wait for completion and do not call callback.
Callback handler to notify of asynchronous completion.
Second argument passed to callback function.
The usb_pipe_drain_reqs() function provides waits for pending requests to complete and then provides synchronous or asynchronous notification that all pending requests on a non-shared pipe indicated by pipe_handle have completed. For a shared pipe (such as the default control pipe used by multiple drivers each managing one interface of a device), this function provides notification that all pending requests on that pipe that are associated with a given dip are completed.
The usb_pipe_drain_reqs() function can be used to notify a close procedure when the default control pipe is clear during device closure, thereby allowing the close procedure to continue safely. Normally, a synchronous call to usb_pipe_close(9F) allows all requests in a pipe to finish before returning. However, a client driver cannot close the default control pipe.
If USB_FLAGS_SLEEP is set in flags, block until all pending requests are completed. Otherwise, return immediately and call the callback handler when all pending requests are completed.
The callback parameter accepts the asynchronous callback handler, which takes the following arguments:
Handle of the pipe to drain.
callback_arg specified to usb_pipe_drain_reqs().
Request status.
Status of the queueing operation. Can be:
Callback was uneventful.
Error starting asynchronous request.
Request is successful.
dip argument is NULL. USB_FLAGS_SLEEP is clear and callback is NULL.
Called from callback context with the USB_FLAGS_SLEEP flag set.
Pipe is not open, is closing or is closed.
May be called from user or kernel context.
If the USB_CB_ASYNC_REQ_FAILED bit is clear in usb_cb_flags_t, the callback, if supplied, can block because it is executing in kernel context. Otherwise the callback cannot block. Please see usb_callback_flags(9S) for more information on callbacks.
mydev_detach(dev_info_t *dip, ddi_detach_cmd_t cmd) { ... ... mydev_state->pipe_state = CLOSED; /* Wait for pending requests of a pipe to finish. Don't timeout. */ (void) usb_pipe_drain_reqs( dip, pipe_handle, 0, USB_FLAGS_SLEEP, NULL, 0); /* * Dismantle streams and tear down this instance, * now that all requests have been sent. */ qprocsoff(q); ... ... ddi_remove_minor_node(dip, NULL); ... ... }
For pipes other than the default control pipe, it is recommended to close the pipe using a synchronous usb_pipe_close(). usb_pipe_close() with the USB_FLAGS_SLEEP flag allows any pending requests in that pipe to complete before returning.
Do not call usb_pipe_drain_reqs() while additional requests are being submitted by a different thread. This action can stall the calling thread of usb_pipe_drain_reqs() unnecessarily.
See attributes(5) for descriptions of the following attributes:
|
attributes(5), usb_pipe_close(9F), usb_pipe_reset(9F), usb_callback_flags(9S)