f-stack/dpdk/drivers/net/cxgbe/mps_tcam.h

55 lines
1.5 KiB
C
Raw Normal View History

2019-06-25 11:12:58 +00:00
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright(c) 2018 Chelsio Communications.
* All rights reserved.
*/
#ifndef _CXGBE_MPSTCAM_H_
#define _CXGBE_MPSTCAM_H_
2020-06-18 16:55:50 +00:00
#include "base/common.h"
2019-06-25 11:12:58 +00:00
enum {
MPS_ENTRY_UNUSED, /* Keep this first so memset 0 renders
* the correct state. Other states can
* be added in future like MPS_ENTRY_BUSY
* to reduce contention while mboxing
* the request to f/w or to denote attributes
* for a specific entry
*/
MPS_ENTRY_USED,
2022-09-06 04:00:10 +00:00
MPS_ENTRY_RAWF, /* Reserved for RAW MAC Filters */
2019-06-25 11:12:58 +00:00
};
struct mps_tcam_entry {
u8 state;
u16 idx;
/* add data here which uniquely defines an entry */
2020-06-18 16:55:50 +00:00
u8 eth_addr[RTE_ETHER_ADDR_LEN];
u8 mask[RTE_ETHER_ADDR_LEN];
2019-06-25 11:12:58 +00:00
struct mpstcam_table *mpstcam; /* backptr */
2022-09-06 04:00:10 +00:00
u32 refcnt;
2019-06-25 11:12:58 +00:00
};
struct mpstcam_table {
u16 size;
rte_rwlock_t lock;
u16 free_idx; /* next free index */
bool full; /* since free index can be present
* anywhere in the table, size and
* free_idx cannot alone determine
* if the table is full
*/
struct mps_tcam_entry entry[0];
};
struct mpstcam_table *t4_init_mpstcam(struct adapter *adap);
void t4_cleanup_mpstcam(struct adapter *adap);
int cxgbe_mpstcam_alloc(struct port_info *pi, const u8 *mac, const u8 *mask);
int cxgbe_mpstcam_remove(struct port_info *pi, u16 idx);
int cxgbe_mpstcam_modify(struct port_info *pi, int idx, const u8 *addr);
2022-09-06 04:00:10 +00:00
int cxgbe_mpstcam_rawf_enable(struct port_info *pi);
int cxgbe_mpstcam_rawf_disable(struct port_info *pi);
2019-06-25 11:12:58 +00:00
#endif /* _CXGBE_MPSTCAM_H_ */