net/szedata2: do not affect Ethernet interfaces
[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
17 /* PCI Device IDs */
18 #define PCI_DEVICE_ID_NETCOPE_COMBO80G 0xcb80
19 #define PCI_DEVICE_ID_NETCOPE_COMBO100G 0xc1c1
20 #define PCI_DEVICE_ID_NETCOPE_COMBO100G2 0xc2c1
21
22 /* number of PCI resource used by COMBO card */
23 #define PCI_RESOURCE_NUMBER 0
24
25 /* szedata2_packet header length == 4 bytes == 2B segment size + 2B hw size */
26 #define RTE_SZE2_PACKET_HEADER_SIZE 4
27
28 #define RTE_SZE2_MMIO_MAX 10
29
30 /*!
31  * Round 'what' to the nearest larger (or equal) multiple of '8'
32  * (szedata2 packet is aligned to 8 bytes)
33  */
34 #define RTE_SZE2_ALIGN8(what) RTE_ALIGN(what, 8)
35
36 /*! main handle structure */
37 struct szedata {
38         int fd;
39         struct sze2_instance_info *info;
40         uint32_t *write_size;
41         void *space[RTE_SZE2_MMIO_MAX];
42         struct szedata_lock lock[2][2];
43
44         __u32 *rx_asize, *tx_asize;
45
46         /* szedata_read_next variables - to keep context (ct) */
47
48         /*
49          * rx
50          */
51         /** initial sze lock ptr */
52         const struct szedata_lock   *ct_rx_lck_orig;
53         /** current sze lock ptr (initial or next) */
54         const struct szedata_lock   *ct_rx_lck;
55         /** remaining bytes (not read) within current lock */
56         unsigned int                ct_rx_rem_bytes;
57         /** current pointer to locked memory */
58         unsigned char               *ct_rx_cur_ptr;
59         /**
60          * allocated buffer to store RX packet if it was split
61          * into 2 buffers
62          */
63         unsigned char               *ct_rx_buffer;
64         /** registered function to provide filtering based on hwdata */
65         int (*ct_rx_filter)(u_int16_t hwdata_len, u_char *hwdata);
66
67         /*
68          * tx
69          */
70         /**
71          * buffer for tx - packet is prepared here
72          * (in future for burst write)
73          */
74         unsigned char               *ct_tx_buffer;
75         /** initial sze TX lock ptrs - number according to TX interfaces */
76         const struct szedata_lock   **ct_tx_lck_orig;
77         /** current sze TX lock ptrs - number according to TX interfaces */
78         const struct szedata_lock   **ct_tx_lck;
79         /** already written bytes in both locks */
80         unsigned int                *ct_tx_written_bytes;
81         /** remaining bytes (not written) within current lock */
82         unsigned int                *ct_tx_rem_bytes;
83         /** current pointers to locked memory */
84         unsigned char               **ct_tx_cur_ptr;
85         /** NUMA node closest to PCIe device, or -1 */
86         int                         numa_node;
87 };
88
89 #endif /* RTE_PMD_SZEDATA2_H_ */