1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2020 Chelsio Communications.
6 #include "base/common.h"
10 * Initialize Source MAC Table
12 struct smt_data *t4_init_smt(u32 smt_start_idx, u32 smt_size)
17 s = t4_alloc_mem(sizeof(*s) + smt_size * sizeof(struct smt_entry));
21 s->smt_start = smt_start_idx;
22 s->smt_size = smt_size;
23 t4_os_rwlock_init(&s->lock);
25 for (i = 0; i < s->smt_size; ++i) {
27 s->smtab[i].hw_idx = smt_start_idx + i;
28 s->smtab[i].state = SMT_STATE_UNUSED;
29 memset(&s->smtab[i].src_mac, 0, RTE_ETHER_ADDR_LEN);
30 t4_os_lock_init(&s->smtab[i].lock);
31 rte_atomic32_set(&s->smtab[i].refcnt, 0);
37 * Cleanup Source MAC Table
39 void t4_cleanup_smt(struct adapter *adap)
42 t4_os_free(adap->smt);