1/*
2 * Copyright (c) 2014 ETH Zurich.
3 * All rights reserved.
4 *
5 * This file is distributed under the terms in the attached LICENSE file.
6 * If you do not find this file, copies can be found by writing to:
7 * ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
8 */
9
10#ifndef BULK_NET_TRANSFER_H
11#define BULK_NET_TRANSFER_H
12
13#include <barrelfish/barrelfish.h>
14#include <bulk_transfer/bulk_transfer.h>
15
16#include "bulk_net_backend.h"
17#include "bulk_net_e10k.h"
18
19
20
21struct bulk_net_control
22{
23    struct bulk_e10k transfer;
24
25    size_t buffer_size;
26    size_t buffer_count;
27
28    struct waitset *ws;
29
30    struct stack_allocator rb_stack;
31    struct transmit_buffer *tb;
32    struct stack_allocator tb_stack;
33
34    const char *card;
35    uint8_t queue;
36    uint8_t max_queues;
37    uint8_t num_queues;
38    uint16_t l_port;
39    uint16_t r_port;
40    uint32_t l_ip;
41    uint32_t r_ip;
42    uint64_t l_mac;
43    uint64_t r_mac;
44};
45
46errval_t bulk_net_transfer_bind(struct bulk_net_control *tc,
47                                void (*tx_cb)(struct bulk_e10k *bu,
48                                              void *opaque),
49                                void (*rx_cb)(struct bulk_e10k* bu,
50                                              struct bulk_net_msgdesc *msg));
51
52errval_t bulk_net_transfer_export(struct bulk_net_control *tc,
53                                  void (*tx_cb)(struct bulk_e10k *bu,
54                                                void *opaque),
55                                  void (*rx_cb)(struct bulk_e10k* bu,
56                                                struct bulk_net_msgdesc *msg));
57
58errval_t bulk_net_transfer_init(struct bulk_net_control *tc,
59                                void (*tx_cb)(struct bulk_e10k *bu,
60                                              void *opaque),
61                                void (*rx_cb)(struct bulk_e10k* bu,
62                                              struct bulk_net_msgdesc *msg));
63
64void bulk_net_transfer_strip_padding(struct bulk_net_msgdesc *msg);
65
66void bulk_net_transfer_add_header(struct bulk_net_msgdesc *msg);
67
68void bulk_net_transfer_update_tx_headers(struct bulk_net_control *p);
69
70void bulk_net_transfer_free_rb(struct bulk_net_control *tc,
71                               struct receive_buffer *rb);
72
73void bulk_net_transfer_free_rx(struct bulk_net_control *tc,
74                               struct bulk_net_msgdesc *msg);
75
76#endif /* BULK_NET_TRANSFER_H */
77