|
@@ -124,41 +124,6 @@ static void mlx_close ( struct net_device *netdev ) {
|
124
|
124
|
|
125
|
125
|
}
|
126
|
126
|
|
127
|
|
-#warning "Broadcast address?"
|
128
|
|
-static uint8_t ib_broadcast[IB_ALEN] = { 0xff, };
|
129
|
|
-
|
130
|
|
-
|
131
|
|
-/**
|
132
|
|
- * Transmit packet
|
133
|
|
- *
|
134
|
|
- * @v netdev Network device
|
135
|
|
- * @v iobuf I/O buffer
|
136
|
|
- * @ret rc Return status code
|
137
|
|
- */
|
138
|
|
-static int mlx_transmit ( struct net_device *netdev,
|
139
|
|
- struct io_buffer *iobuf ) {
|
140
|
|
- struct mlx_nic *mlx = netdev->priv;
|
141
|
|
- ud_send_wqe_t snd_wqe;
|
142
|
|
- int rc;
|
143
|
|
-
|
144
|
|
- snd_wqe = alloc_send_wqe ( mlx->ipoib_qph );
|
145
|
|
- if ( ! snd_wqe ) {
|
146
|
|
- DBGC ( mlx, "MLX %p out of TX WQEs\n", mlx );
|
147
|
|
- return -ENOBUFS;
|
148
|
|
- }
|
149
|
|
-
|
150
|
|
- prep_send_wqe_buf ( mlx->ipoib_qph, mlx->bcast_av, snd_wqe,
|
151
|
|
- iobuf->data, 0, iob_len ( iobuf ), 0 );
|
152
|
|
- if ( ( rc = post_send_req ( mlx->ipoib_qph, snd_wqe, 1 ) ) != 0 ) {
|
153
|
|
- DBGC ( mlx, "MLX %p could not post TX WQE %p: %s\n",
|
154
|
|
- mlx, snd_wqe, strerror ( rc ) );
|
155
|
|
- free_wqe ( snd_wqe );
|
156
|
|
- return rc;
|
157
|
|
- }
|
158
|
|
-
|
159
|
|
- return 0;
|
160
|
|
-}
|
161
|
|
-
|
162
|
127
|
static int arbel_post_send ( struct ib_device *ibdev,
|
163
|
128
|
struct ib_queue_pair *qp,
|
164
|
129
|
struct ib_address_vector *av,
|
|
@@ -187,53 +152,6 @@ static int mlx_transmit_direct ( struct net_device *netdev,
|
187
|
152
|
return rc;
|
188
|
153
|
}
|
189
|
154
|
|
190
|
|
-
|
191
|
|
-/**
|
192
|
|
- * Handle TX completion
|
193
|
|
- *
|
194
|
|
- * @v netdev Network device
|
195
|
|
- * @v ib_cqe Completion queue entry
|
196
|
|
- */
|
197
|
|
-static void mlx_tx_complete ( struct net_device *netdev,
|
198
|
|
- struct ib_cqe_st *ib_cqe ) {
|
199
|
|
- netdev_tx_complete_next_err ( netdev,
|
200
|
|
- ( ib_cqe->is_error ? -EIO : 0 ) );
|
201
|
|
-}
|
202
|
|
-
|
203
|
|
-/**
|
204
|
|
- * Handle RX completion
|
205
|
|
- *
|
206
|
|
- * @v netdev Network device
|
207
|
|
- * @v ib_cqe Completion queue entry
|
208
|
|
- */
|
209
|
|
-static void mlx_rx_complete ( struct net_device *netdev,
|
210
|
|
- struct ib_cqe_st *ib_cqe ) {
|
211
|
|
- unsigned int len;
|
212
|
|
- struct io_buffer *iobuf;
|
213
|
|
- void *buf;
|
214
|
|
-
|
215
|
|
- /* Check for errors */
|
216
|
|
- if ( ib_cqe->is_error ) {
|
217
|
|
- netdev_rx_err ( netdev, NULL, -EIO );
|
218
|
|
- return;
|
219
|
|
- }
|
220
|
|
-
|
221
|
|
- /* Allocate I/O buffer */
|
222
|
|
- len = ( ib_cqe->count - GRH_SIZE );
|
223
|
|
- iobuf = alloc_iob ( len );
|
224
|
|
- if ( ! iobuf ) {
|
225
|
|
- netdev_rx_err ( netdev, NULL, -ENOMEM );
|
226
|
|
- return;
|
227
|
|
- }
|
228
|
|
-
|
229
|
|
- /* Fill I/O buffer */
|
230
|
|
- buf = get_rcv_wqe_buf ( ib_cqe->wqe, 1 );
|
231
|
|
- memcpy ( iob_put ( iobuf, len ), buf, len );
|
232
|
|
-
|
233
|
|
- /* Hand off to network stack */
|
234
|
|
- netdev_rx ( netdev, iobuf );
|
235
|
|
-}
|
236
|
|
-
|
237
|
155
|
static void arbel_poll_cq ( struct ib_device *ibdev,
|
238
|
156
|
struct ib_completion_queue *cq,
|
239
|
157
|
ib_completer_t complete_send,
|
|
@@ -258,8 +176,6 @@ static void temp_complete_recv ( struct ib_device *ibdev __unused,
|
258
|
176
|
struct mlx_nic *mlx = netdev->priv;
|
259
|
177
|
|
260
|
178
|
DBG ( "Yay! RX completion on %p len %zx:\n", iobuf, completion->len );
|
261
|
|
- // DBG_HD ( iobuf, sizeof ( *iobuf ) );
|
262
|
|
- // DBG_HD ( iobuf->data, 256 );
|
263
|
179
|
if ( completion->syndrome ) {
|
264
|
180
|
netdev_rx_err ( netdev, iobuf, -EIO );
|
265
|
181
|
} else {
|
|
@@ -271,43 +187,6 @@ static void temp_complete_recv ( struct ib_device *ibdev __unused,
|
271
|
187
|
mlx->rx_fill--;
|
272
|
188
|
}
|
273
|
189
|
|
274
|
|
-#if 0
|
275
|
|
-/**
|
276
|
|
- * Poll completion queue
|
277
|
|
- *
|
278
|
|
- * @v netdev Network device
|
279
|
|
- * @v cq Completion queue
|
280
|
|
- * @v handler Completion handler
|
281
|
|
- */
|
282
|
|
-static void mlx_poll_cq ( struct net_device *netdev, cq_t cq,
|
283
|
|
- void ( * handler ) ( struct net_device *netdev,
|
284
|
|
- struct ib_cqe_st *ib_cqe ) ) {
|
285
|
|
- struct mlx_nic *mlx = netdev->priv;
|
286
|
|
- struct ib_cqe_st ib_cqe;
|
287
|
|
- uint8_t num_cqes;
|
288
|
|
-
|
289
|
|
- while ( 1 ) {
|
290
|
|
-
|
291
|
|
- /* Poll for single completion queue entry */
|
292
|
|
- ib_poll_cq ( cq, &ib_cqe, &num_cqes );
|
293
|
|
-
|
294
|
|
- /* Return if no entries in the queue */
|
295
|
|
- if ( ! num_cqes )
|
296
|
|
- return;
|
297
|
|
-
|
298
|
|
- DBGC ( mlx, "MLX %p cpl in %p: err %x send %x "
|
299
|
|
- "wqe %p count %lx\n", mlx, cq, ib_cqe.is_error,
|
300
|
|
- ib_cqe.is_send, ib_cqe.wqe, ib_cqe.count );
|
301
|
|
-
|
302
|
|
- /* Handle TX/RX completion */
|
303
|
|
- handler ( netdev, &ib_cqe );
|
304
|
|
-
|
305
|
|
- /* Free associated work queue entry */
|
306
|
|
- free_wqe ( ib_cqe.wqe );
|
307
|
|
- }
|
308
|
|
-}
|
309
|
|
-#endif
|
310
|
|
-
|
311
|
190
|
static int arbel_post_recv ( struct ib_device *ibdev,
|
312
|
191
|
struct ib_queue_pair *qp,
|
313
|
192
|
struct io_buffer *iobuf );
|
|
@@ -322,8 +201,6 @@ static void mlx_refill_rx ( struct net_device *netdev ) {
|
322
|
201
|
if ( ! iobuf )
|
323
|
202
|
break;
|
324
|
203
|
DBG ( "Posting RX buffer %p:\n", iobuf );
|
325
|
|
- // memset ( iobuf->data, 0xaa, 256 );
|
326
|
|
- // DBG_HD ( iobuf, sizeof ( *iobuf ) );
|
327
|
204
|
if ( ( rc = arbel_post_recv ( &static_ibdev, &static_ipoib_qp,
|
328
|
205
|
iobuf ) ) != 0 ) {
|
329
|
206
|
free_iob ( iobuf );
|