.. | .. |
---|
69 | 69 | u32 status; |
---|
70 | 70 | u64 status64; |
---|
71 | 71 | |
---|
| 72 | + octeon_free_sc_done_list(octeon_dev); |
---|
| 73 | + |
---|
72 | 74 | ordered_sc_list = &octeon_dev->response_list[OCTEON_ORDERED_SC_LIST]; |
---|
73 | 75 | |
---|
74 | 76 | do { |
---|
.. | .. |
---|
111 | 113 | } |
---|
112 | 114 | } |
---|
113 | 115 | } |
---|
114 | | - } else if (force_quit || (sc->timeout && |
---|
115 | | - time_after(jiffies, (unsigned long)sc->timeout))) { |
---|
116 | | - dev_err(&octeon_dev->pci_dev->dev, "%s: cmd failed, timeout (%ld, %ld)\n", |
---|
117 | | - __func__, (long)jiffies, (long)sc->timeout); |
---|
| 116 | + } else if (unlikely(force_quit) || (sc->expiry_time && |
---|
| 117 | + time_after(jiffies, (unsigned long)sc->expiry_time))) { |
---|
| 118 | + struct octeon_instr_irh *irh = |
---|
| 119 | + (struct octeon_instr_irh *)&sc->cmd.cmd3.irh; |
---|
| 120 | + |
---|
| 121 | + dev_err(&octeon_dev->pci_dev->dev, "%s: ", __func__); |
---|
| 122 | + dev_err(&octeon_dev->pci_dev->dev, |
---|
| 123 | + "cmd %x/%x/%llx/%llx failed, ", |
---|
| 124 | + irh->opcode, irh->subcode, |
---|
| 125 | + sc->cmd.cmd3.ossp[0], sc->cmd.cmd3.ossp[1]); |
---|
| 126 | + dev_err(&octeon_dev->pci_dev->dev, |
---|
| 127 | + "timeout (%ld, %ld)\n", |
---|
| 128 | + (long)jiffies, (long)sc->expiry_time); |
---|
118 | 129 | status = OCTEON_REQUEST_TIMEOUT; |
---|
119 | 130 | } |
---|
120 | 131 | |
---|
121 | 132 | if (status != OCTEON_REQUEST_PENDING) { |
---|
| 133 | + sc->sc_status = status; |
---|
| 134 | + |
---|
122 | 135 | /* we have received a response or we have timed out */ |
---|
123 | 136 | /* remove node from linked list */ |
---|
124 | 137 | list_del(&sc->node); |
---|
125 | 138 | atomic_dec(&octeon_dev->response_list |
---|
126 | | - [OCTEON_ORDERED_SC_LIST]. |
---|
127 | | - pending_req_count); |
---|
128 | | - spin_unlock_bh |
---|
129 | | - (&ordered_sc_list->lock); |
---|
| 139 | + [OCTEON_ORDERED_SC_LIST]. |
---|
| 140 | + pending_req_count); |
---|
130 | 141 | |
---|
131 | | - if (sc->callback) |
---|
| 142 | + if (!sc->callback) { |
---|
| 143 | + atomic_inc(&octeon_dev->response_list |
---|
| 144 | + [OCTEON_DONE_SC_LIST]. |
---|
| 145 | + pending_req_count); |
---|
| 146 | + list_add_tail(&sc->node, |
---|
| 147 | + &octeon_dev->response_list |
---|
| 148 | + [OCTEON_DONE_SC_LIST].head); |
---|
| 149 | + |
---|
| 150 | + if (unlikely(READ_ONCE(sc->caller_is_done))) { |
---|
| 151 | + /* caller does not wait for response |
---|
| 152 | + * from firmware |
---|
| 153 | + */ |
---|
| 154 | + if (status != OCTEON_REQUEST_DONE) { |
---|
| 155 | + struct octeon_instr_irh *irh; |
---|
| 156 | + |
---|
| 157 | + irh = |
---|
| 158 | + (struct octeon_instr_irh *) |
---|
| 159 | + &sc->cmd.cmd3.irh; |
---|
| 160 | + dev_dbg |
---|
| 161 | + (&octeon_dev->pci_dev->dev, |
---|
| 162 | + "%s: sc failed: opcode=%x, ", |
---|
| 163 | + __func__, irh->opcode); |
---|
| 164 | + dev_dbg |
---|
| 165 | + (&octeon_dev->pci_dev->dev, |
---|
| 166 | + "subcode=%x, ossp[0]=%llx, ", |
---|
| 167 | + irh->subcode, |
---|
| 168 | + sc->cmd.cmd3.ossp[0]); |
---|
| 169 | + dev_dbg |
---|
| 170 | + (&octeon_dev->pci_dev->dev, |
---|
| 171 | + "ossp[1]=%llx, status=%d\n", |
---|
| 172 | + sc->cmd.cmd3.ossp[1], |
---|
| 173 | + status); |
---|
| 174 | + } |
---|
| 175 | + } else { |
---|
| 176 | + complete(&sc->complete); |
---|
| 177 | + } |
---|
| 178 | + |
---|
| 179 | + spin_unlock_bh(&ordered_sc_list->lock); |
---|
| 180 | + } else { |
---|
| 181 | + /* sc with callback function */ |
---|
| 182 | + if (status == OCTEON_REQUEST_TIMEOUT) { |
---|
| 183 | + atomic_inc(&octeon_dev->response_list |
---|
| 184 | + [OCTEON_ZOMBIE_SC_LIST]. |
---|
| 185 | + pending_req_count); |
---|
| 186 | + list_add_tail(&sc->node, |
---|
| 187 | + &octeon_dev->response_list |
---|
| 188 | + [OCTEON_ZOMBIE_SC_LIST]. |
---|
| 189 | + head); |
---|
| 190 | + } |
---|
| 191 | + |
---|
| 192 | + spin_unlock_bh(&ordered_sc_list->lock); |
---|
| 193 | + |
---|
132 | 194 | sc->callback(octeon_dev, status, |
---|
133 | 195 | sc->callback_arg); |
---|
| 196 | + /* sc is freed by caller */ |
---|
| 197 | + } |
---|
134 | 198 | |
---|
135 | 199 | request_complete++; |
---|
136 | 200 | |
---|