1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2018 Chelsio Communications.
6 #ifndef _CXGBE_MPSTCAM_H_
7 #define _CXGBE_MPSTCAM_H_
9 #include "base/common.h"
12 MPS_ENTRY_UNUSED, /* Keep this first so memset 0 renders
13 * the correct state. Other states can
14 * be added in future like MPS_ENTRY_BUSY
15 * to reduce contention while mboxing
16 * the request to f/w or to denote attributes
17 * for a specific entry
22 struct mps_tcam_entry {
26 /* add data here which uniquely defines an entry */
27 u8 eth_addr[RTE_ETHER_ADDR_LEN];
28 u8 mask[RTE_ETHER_ADDR_LEN];
30 struct mpstcam_table *mpstcam; /* backptr */
31 rte_atomic32_t refcnt;
34 struct mpstcam_table {
37 u16 free_idx; /* next free index */
38 bool full; /* since free index can be present
39 * anywhere in the table, size and
40 * free_idx cannot alone determine
41 * if the table is full
43 struct mps_tcam_entry entry[0];
46 struct mpstcam_table *t4_init_mpstcam(struct adapter *adap);
47 void t4_cleanup_mpstcam(struct adapter *adap);
48 int cxgbe_mpstcam_alloc(struct port_info *pi, const u8 *mac, const u8 *mask);
49 int cxgbe_mpstcam_remove(struct port_info *pi, u16 idx);
50 int cxgbe_mpstcam_modify(struct port_info *pi, int idx, const u8 *addr);
52 #endif /* _CXGBE_MPSTCAM_H_ */