forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/drivers/net/ethernet/cavium/liquidio/response_manager.c
....@@ -69,6 +69,8 @@
6969 u32 status;
7070 u64 status64;
7171
72
+ octeon_free_sc_done_list(octeon_dev);
73
+
7274 ordered_sc_list = &octeon_dev->response_list[OCTEON_ORDERED_SC_LIST];
7375
7476 do {
....@@ -111,26 +113,88 @@
111113 }
112114 }
113115 }
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);
118129 status = OCTEON_REQUEST_TIMEOUT;
119130 }
120131
121132 if (status != OCTEON_REQUEST_PENDING) {
133
+ sc->sc_status = status;
134
+
122135 /* we have received a response or we have timed out */
123136 /* remove node from linked list */
124137 list_del(&sc->node);
125138 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);
130141
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
+
132194 sc->callback(octeon_dev, status,
133195 sc->callback_arg);
196
+ /* sc is freed by caller */
197
+ }
134198
135199 request_complete++;
136200