bus/fslmc: restrict address translation to PA mode
[dpdk.git] / drivers / net / szedata2 / rte_eth_szedata2.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2015 - 2016 CESNET
3  */
4
5 #ifndef RTE_PMD_SZEDATA2_H_
6 #define RTE_PMD_SZEDATA2_H_
7
8 #include <stdint.h>
9
10 #include <libsze2.h>
11
12 #include <rte_common.h>
13
14 /* PCI Vendor ID */
15 #define PCI_VENDOR_ID_NETCOPE 0x1b26
16 #define PCI_VENDOR_ID_SILICOM 0x1c2c
17
18 /* PCI Device IDs */
19 #define PCI_DEVICE_ID_NETCOPE_COMBO80G 0xcb80
20 #define PCI_DEVICE_ID_NETCOPE_COMBO100G 0xc1c1
21 #define PCI_DEVICE_ID_NETCOPE_COMBO100G2 0xc2c1
22 #define PCI_DEVICE_ID_NETCOPE_NFB200G2QL 0xc250
23 #define PCI_DEVICE_ID_FB2CGG3 0x00d0
24 #define PCI_DEVICE_ID_FB2CGG3D 0xc240
25
26 /* szedata2_packet header length == 4 bytes == 2B segment size + 2B hw size */
27 #define RTE_SZE2_PACKET_HEADER_SIZE 4
28
29 #define RTE_SZE2_MMIO_MAX 10
30
31 /*!
32  * Round 'what' to the nearest larger (or equal) multiple of '8'
33  * (szedata2 packet is aligned to 8 bytes)
34  */
35 #define RTE_SZE2_ALIGN8(what) RTE_ALIGN(what, 8)
36
37 /*! main handle structure */
38 struct szedata {
39         int fd;
40         struct sze2_instance_info *info;
41         uint32_t *write_size;
42         void *space[RTE_SZE2_MMIO_MAX];
43         struct szedata_lock lock[2][2];
44
45         __u32 *rx_asize, *tx_asize;
46
47         /* szedata_read_next variables - to keep context (ct) */
48
49         /*
50          * rx
51          */
52         /** initial sze lock ptr */
53         const struct szedata_lock   *ct_rx_lck_orig;
54         /** current sze lock ptr (initial or next) */
55         const struct szedata_lock   *ct_rx_lck;
56         /** remaining bytes (not read) within current lock */
57         unsigned int                ct_rx_rem_bytes;
58         /** current pointer to locked memory */
59         unsigned char               *ct_rx_cur_ptr;
60         /**
61          * allocated buffer to store RX packet if it was split
62          * into 2 buffers
63          */
64         unsigned char               *ct_rx_buffer;
65         /** registered function to provide filtering based on hwdata */
66         int (*ct_rx_filter)(u_int16_t hwdata_len, u_char *hwdata);
67
68         /*
69          * tx
70          */
71         /**
72          * buffer for tx - packet is prepared here
73          * (in future for burst write)
74          */
75         unsigned char               *ct_tx_buffer;
76         /** initial sze TX lock ptrs - number according to TX interfaces */
77         const struct szedata_lock   **ct_tx_lck_orig;
78         /** current sze TX lock ptrs - number according to TX interfaces */
79         const struct szedata_lock   **ct_tx_lck;
80         /** already written bytes in both locks */
81         unsigned int                *ct_tx_written_bytes;
82         /** remaining bytes (not written) within current lock */
83         unsigned int                *ct_tx_rem_bytes;
84         /** current pointers to locked memory */
85         unsigned char               **ct_tx_cur_ptr;
86         /** NUMA node closest to PCIe device, or -1 */
87         int                         numa_node;
88 };
89
90 #endif /* RTE_PMD_SZEDATA2_H_ */