net: Use correct default-path macro for downscript
[qemu/ar7.git] / hw / net / rocker / rocker_desc.h
blob1dec33561493d580583c842ce3f58a2e93eb788e
1 /*
2 * QEMU rocker switch emulation - Descriptor ring support
4 * Copyright (c) 2014 Scott Feldman <sfeldma@gmail.com>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
17 #ifndef ROCKER_DESC_H
18 #define ROCKER_DESC_H
20 #include "rocker_hw.h"
22 typedef int (desc_ring_consume)(Rocker *r, DescInfo *info);
24 uint16_t desc_buf_size(DescInfo *info);
25 uint16_t desc_tlv_size(DescInfo *info);
26 char *desc_get_buf(DescInfo *info, bool read_only);
27 int desc_set_buf(DescInfo *info, size_t tlv_size);
28 DescRing *desc_get_ring(DescInfo *info);
30 int desc_ring_index(DescRing *ring);
31 bool desc_ring_set_base_addr(DescRing *ring, uint64_t base_addr);
32 uint64_t desc_ring_get_base_addr(DescRing *ring);
33 bool desc_ring_set_size(DescRing *ring, uint32_t size);
34 uint32_t desc_ring_get_size(DescRing *ring);
35 bool desc_ring_set_head(DescRing *ring, uint32_t new);
36 uint32_t desc_ring_get_head(DescRing *ring);
37 uint32_t desc_ring_get_tail(DescRing *ring);
38 void desc_ring_set_ctrl(DescRing *ring, uint32_t val);
39 bool desc_ring_ret_credits(DescRing *ring, uint32_t credits);
40 uint32_t desc_ring_get_credits(DescRing *ring);
42 DescInfo *desc_ring_fetch_desc(DescRing *ring);
43 bool desc_ring_post_desc(DescRing *ring, int status);
45 void desc_ring_set_consume(DescRing *ring, desc_ring_consume *consume,
46 unsigned vector);
47 unsigned desc_ring_get_msix_vector(DescRing *ring);
48 DescRing *desc_ring_alloc(Rocker *r, int index);
49 void desc_ring_free(DescRing *ring);
50 void desc_ring_reset(DescRing *ring);
52 #endif