target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/rtl839x.c
static u64 rtl839x_read_l2_entry_using_hash(u32 hash, u32 pos, struct rtl838x_l2_entry *e)
{
	u32 r[3];
	struct table_reg *q = rtl_table_get(RTL8390_TBL_L2, 0);
	u32 idx = (0 << 14) | (hash << 2) | pos; // Search SRAM, with hash and at pos in bucket
	int i;

	rtl_table_read(q, idx);
	for (i= 0; i < 3; i++)
		r[i] = sw_r32(rtl_table_data(q, i));

	rtl_table_release(q);

	rtl839x_fill_l2_entry(r, e);
	if (!e->valid)
		return 0;

	return rtl839x_l2_hash_seed(ether_addr_to_u64(&e->mac[0]), e->rvid);
}
/*
 * Read an L2 UC or MC entry out of a hash bucket of the L2 forwarding table
 * hash is the id of the bucket and pos is the position of the entry in that bucket
 * The data read from the SoC is filled into rtl838x_l2_entry
 */
Read an L2 UC or MC entry out of a hash bucket of the L2 forwarding table
hash is the id of the bucket and pos is the position of the entry in that bucket
The data read from the SoC is filled into rtl838x_l2_entry
Read an L2 UC or MC entry out of a hash bucket of the L2 forwarding table hash is the id of the bucket and pos is the position of the entry in that bucket The data read from the SoC is filled into rtl838x_l2_entry
static u64 rtl839x_read_l2_entry_using_hash(u32 hash, u32 pos, struct rtl838x_l2_entry *e)
{
	u32 r[3];
	struct table_reg *q = rtl_table_get(RTL8390_TBL_L2, 0);
	u32 idx = (0 << 14) | (hash << 2) | pos; 
	int i;
	rtl_table_read(q, idx);
	for (i= 0; i < 3; i++)
		r[i] = sw_r32(rtl_table_data(q, i));
	rtl_table_release(q);
	rtl839x_fill_l2_entry(r, e);
	if (!e->valid)
		return 0;
	return rtl839x_l2_hash_seed(ether_addr_to_u64(&e->mac[0]), e->rvid);
}
static u64 rtl839x_read_l2_entry_using_hash ( u32 hash , u32 pos , struct rtl838x_l2_entry * e ) { u32 r [ 3 ] ; struct table_reg * q = rtl_table_get ( RTL8390_TBL_L2 , 0 ) ; u32 idx = ( 0 << 14 ) | ( hash << 2 ) | pos ; int i ; rtl_table_read ( q , idx ) ; for ( i = 0 ; i < 3 ; i ++ ) r [ i ] = sw_r32 ( rtl_table_data ( q , i ) ) ; rtl_table_release ( q ) ; rtl839x_fill_l2_entry ( r , e ) ; if ( ! e -> valid ) return 0 ; return rtl839x_l2_hash_seed ( ether_addr_to_u64 ( & e -> mac [ 0 ] ) , e -> rvid ) ; }
Read an L2 UC or MC entry out of a hash bucket of the L2 forwarding table
 hash is the id of the bucket and pos is the position of the entry in that bucket
 The data read from the SoC is filled into rtl838x_l2_entry
Read an L2 UC or MC entry out of a hash bucket of the L2 forwarding table hash is the id of the bucket and pos is the position of the entry in that bucket The data read from the SoC is filled into rtl838x_l2_entry
// Search SRAM, with hash and at pos in bucket