]> git.proxmox.com Git - ceph.git/blame - ceph/src/seastar/dpdk/drivers/net/xenvirt/rte_xen_lib.h
update download target update for octopus release
[ceph.git] / ceph / src / seastar / dpdk / drivers / net / xenvirt / rte_xen_lib.h
CommitLineData
7c673cae
FG
1/*-
2 * BSD LICENSE
3 *
4 * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
16 * distribution.
17 * * Neither the name of Intel Corporation nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */
33
34#ifndef _RTE_XEN_DUMMY_PMD_H
35#define _RTE_XEN_DUMMY_PMD_H
36
37#include <stdint.h>
38
39#include <rte_common.h>
40#include <rte_mempool.h>
41#include <rte_ether.h>
42
43#define PAGEMAP_FNAME "/proc/self/pagemap"
44#define XEN_GNTALLOC_FNAME "/dev/xen/gntalloc"
45#define DPDK_XENSTORE_PATH "/control/dpdk/"
46#define DPDK_XENSTORE_NODE "/control/dpdk"
47/*format 0_mempool_gref = "1537,1524,1533" */
48#define MEMPOOL_XENSTORE_STR "_mempool_gref"
49/*format 0_mempool_va = 0x80340000 */
50#define MEMPOOL_VA_XENSTORE_STR "_mempool_va"
51/*format 0_rx_vring_gref = "1537,1524,1533" */
52#define RXVRING_XENSTORE_STR "_rx_vring_gref"
53/*format 0_tx_vring_gref = "1537,1524,1533" */
54#define TXVRING_XENSTORE_STR "_tx_vring_gref"
55#define VRING_FLAG_STR "_vring_flag"
56/*format: event_type_start_0 = 1*/
57#define EVENT_TYPE_START_STR "event_type_start_"
58
59#define DOM0_DOMID 0
60/*
61 * the pfn (page frame number) are bits 0-54 (see pagemap.txt in linux
62 * Documentation).
63 */
64#define PAGEMAP_PFN_BITS 54
65#define PAGEMAP_PFN_MASK RTE_LEN2MASK(PAGEMAP_PFN_BITS, phys_addr_t)
66
67#define MAP_FLAG 0xA5
68
69#define RTE_ETH_XENVIRT_PAIRS_DELIM ';'
70#define RTE_ETH_XENVIRT_KEY_VALUE_DELIM '='
71#define RTE_ETH_XENVIRT_MAX_ARGS 1
72#define RTE_ETH_XENVIRT_MAC_PARAM "mac"
73struct xenvirt_dict {
74 uint8_t addr_valid;
75 struct ether_addr addr;
76};
77
78extern int gntalloc_fd;
79
80int
81gntalloc_open(void);
82
83void
84gntalloc_close(void);
85
86void *
87gntalloc(size_t sz, uint32_t *gref, uint64_t *start_index);
88
89void
90gntfree(void *va, size_t sz, uint64_t start_index);
91
92int
93xenstore_init(void);
94
95int
96xenstore_uninit(void);
97
98int
99xenstore_write(const char *key_str, const char *val_str);
100
101int
102get_phys_map(void *va, phys_addr_t pa[], uint32_t pg_num, uint32_t pg_sz);
103
104void *
105get_xen_virtual(size_t size, size_t page_sz);
106
107int
108grefwatch_from_alloc(uint32_t *gref, void **pptr);
109
110
111int grant_node_create(uint32_t pg_num, uint32_t *gref_arr, phys_addr_t *pa_arr, char *val_str, size_t str_size);
112
113int
114grant_gntalloc_mbuf_pool(struct rte_mempool *mpool, uint32_t pg_num, uint32_t *gref_arr, phys_addr_t *pa_arr, int mempool_idx);
115
116#endif