New upstream version 18.08
[deb_dpdk.git] / drivers / net / cxgbe / clip_tbl.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2018 Chelsio Communications.
3  * All rights reserved.
4  */
5
6 #ifndef _CXGBE_CLIP_H_
7 #define _CXGBE_CLIP_H_
8
9 /*
10  * State for the corresponding entry of the HW CLIP table.
11  */
12 struct clip_entry {
13         enum filter_type type;       /* entry type */
14         u32 addr[4];                 /* IPV4 or IPV6 address */
15         rte_spinlock_t lock;         /* entry lock */
16         rte_atomic32_t refcnt;       /* entry reference count */
17 };
18
19 struct clip_tbl {
20         unsigned int clipt_start;     /* start index of CLIP table */
21         unsigned int clipt_size;      /* size of CLIP table */
22         rte_rwlock_t lock;            /* table rw lock */
23         struct clip_entry cl_list[0]; /* MUST BE LAST */
24 };
25
26 struct clip_tbl *t4_init_clip_tbl(unsigned int clipt_start,
27                                   unsigned int clipt_end);
28 void t4_cleanup_clip_tbl(struct adapter *adap);
29 struct clip_entry *cxgbe_clip_alloc(struct rte_eth_dev *dev, u32 *lip);
30 void cxgbe_clip_release(struct rte_eth_dev *dev, struct clip_entry *ce);
31 #endif /* _CXGBE_CLIP_H_ */