aa4afcce26efdc1b7b0131c950470b3720e11577
[dpdk.git] / drivers / net / cxgbe / smt.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2020 Chelsio Communications.
3  * All rights reserved.
4  */
5 #ifndef __CXGBE_SMT_H_
6 #define __CXGBE_SMT_H_
7
8 enum {
9         SMT_STATE_SWITCHING,
10         SMT_STATE_UNUSED,
11         SMT_STATE_ERROR
12 };
13
14 enum {
15         SMT_SIZE = 256
16 };
17
18 struct smt_entry {
19         u16 state;
20         u16 idx;
21         u16 pfvf;
22         u16 hw_idx;
23         u8 src_mac[RTE_ETHER_ADDR_LEN];
24         rte_atomic32_t refcnt;
25         rte_spinlock_t lock;
26 };
27
28 struct smt_data {
29         unsigned int smt_size;
30         unsigned int smt_start;
31         rte_rwlock_t lock;
32         struct smt_entry smtab[0];
33 };
34
35 struct smt_data *t4_init_smt(u32 smt_start_idx, u32 smt_size);
36 void t4_cleanup_smt(struct adapter *adap);
37
38 #endif  /* __CXGBE_SMT_H_ */
39