1a9643ea8Slogwang /* 2a9643ea8Slogwang * Copyright (C) 2017 THL A29 Limited, a Tencent company. 3a9643ea8Slogwang * All rights reserved. 4a9643ea8Slogwang * 5a9643ea8Slogwang * Redistribution and use in source and binary forms, with or without 6a9643ea8Slogwang * modification, are permitted provided that the following conditions are met: 7a9643ea8Slogwang * 8a9643ea8Slogwang * 1. Redistributions of source code must retain the above copyright notice, this 9a9643ea8Slogwang * list of conditions and the following disclaimer. 10a9643ea8Slogwang * 2. Redistributions in binary form must reproduce the above copyright notice, 11a9643ea8Slogwang * this list of conditions and the following disclaimer in the documentation 12a9643ea8Slogwang * and/or other materials provided with the distribution. 13a9643ea8Slogwang * 14a9643ea8Slogwang * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15a9643ea8Slogwang * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16a9643ea8Slogwang * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17a9643ea8Slogwang * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18a9643ea8Slogwang * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19a9643ea8Slogwang * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20a9643ea8Slogwang * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21a9643ea8Slogwang * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22a9643ea8Slogwang * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23a9643ea8Slogwang * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24a9643ea8Slogwang * 25a9643ea8Slogwang */ 26a9643ea8Slogwang 27a9643ea8Slogwang #ifndef _FSTACK_DPDK_KNI_H 28a9643ea8Slogwang #define _FSTACK_DPDK_KNI_H 29a9643ea8Slogwang 30a9643ea8Slogwang #include <rte_config.h> 31a9643ea8Slogwang #include <rte_mbuf.h> 32a9643ea8Slogwang #include <rte_mempool.h> 33a9643ea8Slogwang 34a9643ea8Slogwang enum FilterReturn { 35a9643ea8Slogwang FILTER_UNKNOWN = -1, 36a9643ea8Slogwang FILTER_ARP = 1, 37a9643ea8Slogwang FILTER_KNI = 2, 38a9643ea8Slogwang }; 39a9643ea8Slogwang 40a9643ea8Slogwang void ff_kni_init(uint16_t nb_ports, const char *tcp_ports, 41f47e38d9Slogwang const char *udp_ports); 42a9643ea8Slogwang 432bfe3f2eSlogwang void ff_kni_alloc(uint16_t port_id, unsigned socket_id, 44bed8feabSroot struct rte_mempool *mbuf_pool, unsigned ring_queue_size); 45a9643ea8Slogwang 462bfe3f2eSlogwang void ff_kni_process(uint16_t port_id, uint16_t queue_id, 47a9643ea8Slogwang struct rte_mbuf **pkts_burst, unsigned count); 48a9643ea8Slogwang 49*d7140ab7Sfengbojiang(姜凤波) enum FilterReturn ff_kni_proto_filter(const void *data, uint16_t len, uint16_t eth_frame_type); 50a9643ea8Slogwang 512bfe3f2eSlogwang int ff_kni_enqueue(uint16_t port_id, struct rte_mbuf *pkt); 52a9643ea8Slogwang 53a9643ea8Slogwang 54a9643ea8Slogwang #endif /* ifndef _FSTACK_DPDK_KNI_H */ 55