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 #include "base/t4_msg.h" 9 10 enum { 11 SMT_STATE_SWITCHING, 12 SMT_STATE_UNUSED, 13 SMT_STATE_ERROR 14 }; 15 16 enum { 17 SMT_SIZE = 256 18 }; 19 20 struct smt_entry { 21 u16 state; 22 u16 idx; 23 u16 pfvf; 24 u16 hw_idx; 25 u8 src_mac[RTE_ETHER_ADDR_LEN]; 26 RTE_ATOMIC(u32) refcnt; 27 rte_spinlock_t lock; 28 }; 29 30 struct smt_data { 31 unsigned int smt_size; 32 unsigned int smt_start; 33 rte_rwlock_t lock; 34 struct smt_entry smtab[]; 35 }; 36 37 struct smt_data *t4_init_smt(u32 smt_start_idx, u32 smt_size); 38 void t4_cleanup_smt(struct adapter *adap); 39 void cxgbe_do_smt_write_rpl(struct adapter *adap, 40 const struct cpl_smt_write_rpl *rpl); 41 struct smt_entry *cxgbe_smt_alloc_switching(struct rte_eth_dev *dev, u8 *smac); 42 void cxgbe_smt_release(struct smt_entry *e); 43 44 #endif /* __CXGBE_SMT_H_ */ 45