xref: /f-stack/lib/ff_veth.h (revision 2317ada5)
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_VETH_H
28a9643ea8Slogwang #define _FSTACK_VETH_H
29a9643ea8Slogwang 
30a9643ea8Slogwang struct ff_port_cfg;
31a9643ea8Slogwang void *ff_veth_attach(struct ff_port_cfg *cfg);
32a9643ea8Slogwang int ff_veth_detach(void *arg);
33a9643ea8Slogwang 
34213fa7b3Slogwang void *ff_mbuf_gethdr(void *pkt, uint16_t total, void *data,
35213fa7b3Slogwang     uint16_t len, uint8_t rx_csum);
36fa552ee2SJianfeng Tan void *ff_mbuf_get(void *p, void *m, void *data, uint16_t len);
37a9643ea8Slogwang void ff_mbuf_free(void *m);
38a9643ea8Slogwang 
39a9643ea8Slogwang int ff_mbuf_copydata(void *m, void *data, int off, int len);
40ef5ab859S10077240 int ff_next_mbuf(void **mbuf_bsd, void **data, unsigned *len);
41ef5ab859S10077240 void* ff_mbuf_mtod(void* bsd_mbuf);
42ef5ab859S10077240 void* ff_rte_frm_extcl(void* mbuf);
43a9643ea8Slogwang 
44213fa7b3Slogwang struct ff_tx_offload;
45213fa7b3Slogwang void ff_mbuf_tx_offload(void *m, struct ff_tx_offload *offload);
46213fa7b3Slogwang 
47a9643ea8Slogwang void ff_veth_process_packet(void *arg, void *m);
48a9643ea8Slogwang 
49a9e7dcf4Slogwang void *ff_veth_softc_to_hostc(void *softc);
50a9e7dcf4Slogwang 
5149056e3aSHongBo Long void ff_mbuf_set_vlan_info(void *hdr, uint16_t vlan_tci);
52a9643ea8Slogwang 
53a9643ea8Slogwang #endif /* ifndef _FSTACK_VETH_H */
54