eth: fbnic: Add support to write TCE TCAM entries
Subsystems (3)
PATCH v3 1/1 eth: fbnic: Add support to write TCE TCAM entries
Add support for writing to the tce tcam to enable host to bmc traffic. Currently, we lack metadata to track where addresses have been written in the tcam, except for the last entry written. To address this issue, we start at the opposite end of the table in each pass, so that adding or deleting entries does not affect the availability of all entries, assuming there is no significant reordering of entries.
Signed-off-by Mohsin Bashir <[email protected]>
---
V3:
- Declare loop iterator in loop declaration
- Use unsigned type where possible
V2: https://lore.kernel.org/netdev/[email protected]
V1: https://lore.kernel.org/netdev/[email protected]
--- drivers/net/ethernet/meta/fbnic/fbnic.h | 1 + drivers/net/ethernet/meta/fbnic/fbnic_csr.h | 20 ++++ .../net/ethernet/meta/fbnic/fbnic_netdev.c | 1 + drivers/net/ethernet/meta/fbnic/fbnic_rpc.c | 105 ++++++++++++++++++ drivers/net/ethernet/meta/fbnic/fbnic_rpc.h | 4 + 5 files changed, 131 insertions(+)
drivers/net/ethernet/meta/fbnic/fbnic.h +1 -0
@@ -48,6 +48,7 @@ struct fbnic_dev {struct fbnic_act_tcam act_tcam[FBNIC_RPC_TCAM_ACT_NUM_ENTRIES ];struct fbnic_mac_addr mac_addr[FBNIC_RPC_TCAM_MACDA_NUM_ENTRIES ];u8 mac_addr_boundary; +u8 tce_tcam_last;/* Number of TCQs/RCQs available on hardware */ u16 max_num_queues;
drivers/net/ethernet/meta/fbnic/fbnic_csr.h +20 -0
@@ -397,6 +397,14 @@ enum {#define FBNIC_TCE_DROP_CTRL_TTI_FRM_DROP_EN CSR_BIT(1)#define FBNIC_TCE_DROP_CTRL_TTI_TBI_DROP_EN CSR_BIT(2) +#define FBNIC_TCE_TCAM_IDX2DEST_MAP 0x0404A/* 0x10128 */ +#define FBNIC_TCE_TCAM_IDX2DEST_MAP_DEST_ID_0 CSR_GENMASK(3, 0) +enum { +FBNIC_TCE_TCAM_DEST_MAC =1 , +FBNIC_TCE_TCAM_DEST_BMC =2 , +FBNIC_TCE_TCAM_DEST_FW =4 , +}; +#define FBNIC_TCE_TXB_TX_BMC_Q_CTRL 0x0404B/* 0x1012c */ #define FBNIC_TCE_TXB_BMC_DWRR_CTRL 0x0404C/* 0x10130 */ #define FBNIC_TCE_TXB_BMC_DWRR_CTRL_QUANTUM0 CSR_GENMASK(7, 0)
@@ -407,6 +415,18 @@ enum {#define FBNIC_TCE_TXB_BMC_DWRR_CTRL_EXT 0x0404F/* 0x1013c */ #define FBNIC_CSR_END_TCE 0x04050/* CSR section delimiter */ +/* TCE RAM registers */ +#define FBNIC_CSR_START_TCE_RAM 0x04200/* CSR section delimiter */ +#define FBNIC_TCE_RAM_TCAM (m, n) \ + (0x04200 + 0x8 * (n) + (m))/* 0x10800 + 32*n + 4*m */ +#define FBNIC_TCE_RAM_TCAM_MASK CSR_GENMASK(15, 0) +#define FBNIC_TCE_RAM_TCAM_VALUE CSR_GENMASK(31, 16) +#define FBNIC_TCE_RAM_TCAM3 (n) (0x04218 + (n))/* 0x010860 + 4*n */ +#define FBNIC_TCE_RAM_TCAM3_DEST_MASK CSR_GENMASK(5, 3) +#define FBNIC_TCE_RAM_TCAM3_MCQ_MASK CSR_BIT(7) +#define FBNIC_TCE_RAM_TCAM3_VALIDATE CSR_BIT(31) +#define FBNIC_CSR_END_TCE_RAM 0x0421F/* CSR section delimiter */ +/* TMI registers */ #define FBNIC_CSR_START_TMI 0x04400/* CSR section delimiter */ #define FBNIC_TMI_SOP_PROT_CTRL 0x04400/* 0x11000 */
drivers/net/ethernet/meta/fbnic/fbnic_netdev.c +1 -0
@@ -273,6 +273,7 @@ void __fbnic_set_rx_mode(struct net_device *netdev)/* Write updates to hardware */ fbnic_write_rules (fbd);fbnic_write_macda (fbd); +fbnic_write_tce_tcam (fbd); }static void fbnic_set_rx_mode (struct net_device *netdev)
drivers/net/ethernet/meta/fbnic/fbnic_rpc.c +105 -0
111 lines not on this page · raw message
drivers/net/ethernet/meta/fbnic/fbnic_rpc.h +4 -0
@@ -35,6 +35,9 @@ enum {#define FBNIC_RPC_TCAM_ACT_WORD_LEN 11#define FBNIC_RPC_TCAM_ACT_NUM_ENTRIES 64 +#define FBNIC_TCE_TCAM_WORD_LEN 3 +#define FBNIC_TCE_TCAM_NUM_ENTRIES 8 +struct fbnic_mac_addr {union {unsigned char addr8[ETH_ALEN ];
@@ -186,4 +189,5 @@ static inline int __fbnic_mc_unsync(struct fbnic_mac_addr *mac_addr)void fbnic_clear_rules (struct fbnic_dev *fbd);void fbnic_write_rules (struct fbnic_dev *fbd); +void fbnic_write_tce_tcam (struct fbnic_dev *fbd);#endif /* _FBNIC_RPC_H_ */
Signature · 1 line
2.43.5