1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* Copyright (C) 2019-2021 Texas Instruments Incorporated - https://www.ti.com */ 3 #ifndef __NET_TI_PRUSS_FDB_TBL_H 4 #define __NET_TI_PRUSS_FDB_TBL_H 5 6 #include <linux/kernel.h> 7 #include <linux/debugfs.h> 8 #include "icssm_prueth.h" 9 10 /* 4 bytes */ 11 struct fdb_index_tbl_entry { 12 /* Bucket Table index of first Bucket with this MAC address */ 13 u16 bucket_idx; 14 u16 bucket_entries; /* Number of entries in this bucket */ 15 }; 16 17 /* 4 * 256 = 1024 = 0x200 bytes */ 18 struct fdb_index_array { 19 struct fdb_index_tbl_entry index_tbl_entry[FDB_INDEX_TBL_MAX_ENTRIES]; 20 }; 21 22 /* 10 bytes */ 23 struct fdb_mac_tbl_entry { 24 u8 mac[ETH_ALEN]; 25 u16 age; 26 u8 port; /* 0 based: 0=port1, 1=port2 */ 27 union { 28 struct { 29 u8 is_static:1; 30 u8 active:1; 31 }; 32 u8 flags; 33 }; 34 }; 35 36 /* 10 * 256 = 2560 = 0xa00 bytes */ 37 struct fdb_mac_tbl_array { 38 struct fdb_mac_tbl_entry mac_tbl_entry[FDB_MAC_TBL_MAX_ENTRIES]; 39 }; 40 41 /* 1 byte */ 42 struct fdb_stp_config { 43 u8 state; /* per-port STP state (defined in FW header) */ 44 }; 45 46 /* 1 byte */ 47 struct fdb_flood_config { 48 u8 host_flood_enable:1; 49 u8 port1_flood_enable:1; 50 u8 port2_flood_enable:1; 51 }; 52 53 /* 2 byte */ 54 struct fdb_arbitration { 55 u8 host_lock; 56 u8 pru_locks; 57 }; 58 59 struct fdb_tbl { 60 /* fdb index table */ 61 struct fdb_index_array __iomem *index_a; 62 /* fdb MAC table */ 63 struct fdb_mac_tbl_array __iomem *mac_tbl_a; 64 /* port 1 stp config */ 65 struct fdb_stp_config __iomem *port1_stp_cfg; 66 /* port 2 stp config */ 67 struct fdb_stp_config __iomem *port2_stp_cfg; 68 /* per-port flood enable */ 69 struct fdb_flood_config __iomem *flood_enable_flags; 70 /* fdb locking mechanism */ 71 struct fdb_arbitration __iomem *locks; 72 /* total number of entries in hash table */ 73 u16 total_entries; 74 }; 75 76 #endif 77