Path: blob/main/sys/compat/linuxkpi/common/include/net/page_pool.h
39604 views
/*-1* Copyright (c) 2023 Bjoern A. Zeeb2*3* Redistribution and use in source and binary forms, with or without4* modification, are permitted provided that the following conditions5* are met:6* 1. Redistributions of source code must retain the above copyright7* notice, this list of conditions and the following disclaimer.8* 2. Redistributions in binary form must reproduce the above copyright9* notice, this list of conditions and the following disclaimer in the10* documentation and/or other materials provided with the distribution.11*12* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND13* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE14* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE15* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE16* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL17* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS18* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)19* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT20* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY21* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF22* SUCH DAMAGE.23*/2425#ifndef _LINUXKPI_NET_PAGE_POOL_H26#define _LINUXKPI_NET_PAGE_POOL_H2728#include <linux/kernel.h> /* pr_debug */29#include <linux/types.h>30#include <linux/dma-mapping.h>31#include <linux/netdevice.h>3233struct device;3435struct page_pool_params {36struct device *dev;37uint32_t flags;38uint32_t order;39uint32_t pool_size;40uint32_t max_len;41uint32_t offset;42int nid; /* NUMA */43enum dma_data_direction dma_dir;44struct napi_struct *napi;45};4647struct page_pool {48};4950#define PP_FLAG_DMA_MAP BIT(0)51#define PP_FLAG_DMA_SYNC_DEV BIT(1)52#define PP_FLAG_PAGE_FRAG BIT(2)5354static inline struct page_pool *55page_pool_create(const struct page_pool_params *ppparams)56{5758pr_debug("%s: TODO\n", __func__);59return (NULL);60}6162static inline void63page_pool_destroy(struct page_pool *ppool)64{6566pr_debug("%s: TODO\n", __func__);67}6869static inline struct page *70page_pool_dev_alloc_frag(struct page_pool *ppool, uint32_t *offset,71size_t size)72{7374pr_debug("%s: TODO\n", __func__);75return (NULL);76}7778static inline dma_addr_t79page_pool_get_dma_addr(struct page *page)80{8182pr_debug("%s: TODO\n", __func__);83return (0);84}8586static inline enum dma_data_direction87page_pool_get_dma_dir(const struct page_pool *ppool)88{8990pr_debug("%s: TODO\n", __func__);91return (DMA_BIDIRECTIONAL);92}9394static inline void95page_pool_put_full_page(struct page_pool *ppool, struct page *page,96bool allow_direct)97{9899pr_debug("%s: TODO\n", __func__);100}101102static inline int103page_pool_ethtool_stats_get_count(void)104{105106pr_debug("%s: TODO\n", __func__);107return (0);108}109110static inline uint8_t *111page_pool_ethtool_stats_get_strings(uint8_t *x)112{113114pr_debug("%s: TODO\n", __func__);115return (x);116}117118#endif /* _LINUXKPI_NET_PAGE_POOL_H */119120121