1a9643ea8Slogwang /* 2*2317ada5Sfengbojiang * Copyright (C) 2017-2021 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_IF_H 28a9643ea8Slogwang #define _FSTACK_DPDK_IF_H 29a9643ea8Slogwang 30a9643ea8Slogwang #include "ff_api.h" 31a9643ea8Slogwang 32a9643ea8Slogwang #define ff_IF_NAME "f-stack-%d" 33a9643ea8Slogwang 34a9643ea8Slogwang struct loop_routine { 35a9643ea8Slogwang loop_func_t loop; 36a9643ea8Slogwang void *arg; 37a9643ea8Slogwang }; 38a9643ea8Slogwang 39a9643ea8Slogwang int ff_dpdk_init(int argc, char **argv); 40a9643ea8Slogwang int ff_dpdk_if_up(void); 41a9643ea8Slogwang void ff_dpdk_run(loop_func_t loop, void *arg); 42a9643ea8Slogwang 43a9643ea8Slogwang struct ff_dpdk_if_context; 44a9643ea8Slogwang struct ff_port_cfg; 45a9643ea8Slogwang 46213fa7b3Slogwang struct ff_tx_offload { 47213fa7b3Slogwang uint8_t ip_csum; 48213fa7b3Slogwang uint8_t tcp_csum; 49213fa7b3Slogwang uint8_t udp_csum; 50213fa7b3Slogwang uint8_t sctp_csum; 51213fa7b3Slogwang uint16_t tso_seg_size; 52213fa7b3Slogwang }; 53213fa7b3Slogwang 54a9643ea8Slogwang struct ff_dpdk_if_context *ff_dpdk_register_if(void *sc, void *ifp, 55a9643ea8Slogwang struct ff_port_cfg *cfg); 56a9643ea8Slogwang void ff_dpdk_deregister_if(struct ff_dpdk_if_context *ctx); 57a9643ea8Slogwang 58a9643ea8Slogwang void ff_dpdk_set_if(struct ff_dpdk_if_context *ctx, void *sc, void *ifp); 59a9643ea8Slogwang 60a9643ea8Slogwang int ff_dpdk_if_send(struct ff_dpdk_if_context* ctx, void *buf, int total); 61a9643ea8Slogwang 62a9643ea8Slogwang void ff_dpdk_pktmbuf_free(void *m); 63a9643ea8Slogwang 64a9643ea8Slogwang 65a9643ea8Slogwang #endif /* ifndef _FSTACK_DPDK_IF_H */ 66