![]() |
|
|||
0001 /********************************************************************** 0002 * Author: Cavium, Inc. 0003 * 0004 * Contact: support@cavium.com 0005 * Please include "LiquidIO" in the subject. 0006 * 0007 * Copyright (c) 2003-2016 Cavium, Inc. 0008 * 0009 * This file is free software; you can redistribute it and/or modify 0010 * it under the terms of the GNU General Public License, Version 2, as 0011 * published by the Free Software Foundation. 0012 * 0013 * This file is distributed in the hope that it will be useful, but 0014 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty 0015 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or 0016 * NONINFRINGEMENT. See the GNU General Public License for more 0017 * details. 0018 **********************************************************************/ 0019 0020 /*! \file response_manager.h 0021 * \brief Host Driver: Response queues for host instructions. 0022 */ 0023 0024 #ifndef __RESPONSE_MANAGER_H__ 0025 #define __RESPONSE_MANAGER_H__ 0026 0027 /** Maximum ordered requests to process in every invocation of 0028 * lio_process_ordered_list(). The function will continue to process requests 0029 * as long as it can find one that has finished processing. If it keeps 0030 * finding requests that have completed, the function can run for ever. The 0031 * value defined here sets an upper limit on the number of requests it can 0032 * process before it returns control to the poll thread. 0033 */ 0034 #define MAX_ORD_REQS_TO_PROCESS 4096 0035 0036 /** Head of a response list. There are several response lists in the 0037 * system. One for each response order- Unordered, ordered 0038 * and 1 for noresponse entries on each instruction queue. 0039 */ 0040 struct octeon_response_list { 0041 /** List structure to add delete pending entries to */ 0042 struct list_head head; 0043 0044 /** A lock for this response list */ 0045 spinlock_t lock; 0046 0047 atomic_t pending_req_count; 0048 }; 0049 0050 /** The type of response list. 0051 */ 0052 enum { 0053 OCTEON_ORDERED_LIST = 0, 0054 OCTEON_UNORDERED_NONBLOCKING_LIST = 1, 0055 OCTEON_UNORDERED_BLOCKING_LIST = 2, 0056 OCTEON_ORDERED_SC_LIST = 3, 0057 OCTEON_DONE_SC_LIST = 4, 0058 OCTEON_ZOMBIE_SC_LIST = 5 0059 }; 0060 0061 /** Response Order values for a Octeon Request. */ 0062 enum { 0063 OCTEON_RESP_ORDERED = 0, 0064 OCTEON_RESP_UNORDERED = 1, 0065 OCTEON_RESP_NORESPONSE = 2 0066 }; 0067 0068 /** Error codes used in Octeon Host-Core communication. 0069 * 0070 * 31 16 15 0 0071 * --------------------------------- 0072 * | | | 0073 * --------------------------------- 0074 * Error codes are 32-bit wide. The upper 16-bits, called Major Error Number, 0075 * are reserved to identify the group to which the error code belongs. The 0076 * lower 16-bits, called Minor Error Number, carry the actual code. 0077 * 0078 * So error codes are (MAJOR NUMBER << 16)| MINOR_NUMBER. 0079 */ 0080 0081 /*------------ Error codes used by host driver -----------------*/ 0082 #define DRIVER_MAJOR_ERROR_CODE 0x0000 0083 /*------ Error codes used by firmware (bits 15..0 set by firmware */ 0084 #define FIRMWARE_MAJOR_ERROR_CODE 0x0001 0085 0086 /** A value of 0x00000000 indicates no error i.e. success */ 0087 #define DRIVER_ERROR_NONE 0x00000000 0088 0089 #define DRIVER_ERROR_REQ_PENDING 0x00000001 0090 #define DRIVER_ERROR_REQ_TIMEOUT 0x00000003 0091 #define DRIVER_ERROR_REQ_EINTR 0x00000004 0092 #define DRIVER_ERROR_REQ_ENXIO 0x00000006 0093 #define DRIVER_ERROR_REQ_ENOMEM 0x0000000C 0094 #define DRIVER_ERROR_REQ_EINVAL 0x00000016 0095 #define DRIVER_ERROR_REQ_FAILED 0x000000ff 0096 0097 /** Status for a request. 0098 * If a request is not queued to Octeon by the driver, the driver returns 0099 * an error condition that's describe by one of the OCTEON_REQ_ERR_* value 0100 * below. If the request is successfully queued, the driver will return 0101 * a OCTEON_REQUEST_PENDING status. OCTEON_REQUEST_TIMEOUT and 0102 * OCTEON_REQUEST_INTERRUPTED are only returned by the driver if the 0103 * response for request failed to arrive before a time-out period or if 0104 * the request processing * got interrupted due to a signal respectively. 0105 */ 0106 enum { 0107 OCTEON_REQUEST_DONE = (DRIVER_ERROR_NONE), 0108 OCTEON_REQUEST_PENDING = (DRIVER_ERROR_REQ_PENDING), 0109 OCTEON_REQUEST_TIMEOUT = (DRIVER_ERROR_REQ_TIMEOUT), 0110 OCTEON_REQUEST_INTERRUPTED = (DRIVER_ERROR_REQ_EINTR), 0111 OCTEON_REQUEST_NO_DEVICE = (0x00000021), 0112 OCTEON_REQUEST_NOT_RUNNING, 0113 OCTEON_REQUEST_INVALID_IQ, 0114 OCTEON_REQUEST_INVALID_BUFCNT, 0115 OCTEON_REQUEST_INVALID_RESP_ORDER, 0116 OCTEON_REQUEST_NO_MEMORY, 0117 OCTEON_REQUEST_INVALID_BUFSIZE, 0118 OCTEON_REQUEST_NO_PENDING_ENTRY, 0119 OCTEON_REQUEST_NO_IQ_SPACE = (0x7FFFFFFF) 0120 0121 }; 0122 0123 #define FIRMWARE_STATUS_CODE(status) \ 0124 ((FIRMWARE_MAJOR_ERROR_CODE << 16) | (status)) 0125 0126 /** Initialize the response lists. The number of response lists to create is 0127 * given by count. 0128 * @param octeon_dev - the octeon device structure. 0129 */ 0130 int octeon_setup_response_list(struct octeon_device *octeon_dev); 0131 0132 void octeon_delete_response_list(struct octeon_device *octeon_dev); 0133 0134 /** Check the status of first entry in the ordered list. If the instruction at 0135 * that entry finished processing or has timed-out, the entry is cleaned. 0136 * @param octeon_dev - the octeon device structure. 0137 * @param force_quit - the request is forced to timeout if this is 1 0138 * @return 1 if the ordered list is empty, 0 otherwise. 0139 */ 0140 int lio_process_ordered_list(struct octeon_device *octeon_dev, 0141 u32 force_quit); 0142 0143 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |