4 * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
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
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.
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.
34 #ifndef _RTE_XEN_DUMMY_PMD_H
35 #define _RTE_XEN_DUMMY_PMD_H
39 #include <rte_common.h>
40 #include <rte_mempool.h>
41 #include <rte_ether.h>
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_"
61 * the pfn (page frame number) are bits 0-54 (see pagemap.txt in linux
64 #define PAGEMAP_PFN_BITS 54
65 #define PAGEMAP_PFN_MASK RTE_LEN2MASK(PAGEMAP_PFN_BITS, phys_addr_t)
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"
75 struct ether_addr addr;
78 extern int gntalloc_fd;
87 gntalloc(size_t sz, uint32_t *gref, uint64_t *start_index);
90 gntfree(void *va, size_t sz, uint64_t start_index);
96 xenstore_uninit(void);
99 xenstore_write(const char *key_str, const char *val_str);
102 get_phys_map(void *va, phys_addr_t pa[], uint32_t pg_num, uint32_t pg_sz);
105 get_xen_virtual(size_t size, size_t page_sz);
108 grefwatch_from_alloc(uint32_t *gref, void **pptr);
111 int grant_node_create(uint32_t pg_num, uint32_t *gref_arr, phys_addr_t *pa_arr, char *val_str, size_t str_size);
114 grant_gntalloc_mbuf_pool(struct rte_mempool *mpool, uint32_t pg_num, uint32_t *gref_arr, phys_addr_t *pa_arr, int mempool_idx);