target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/rtl930x.c
static void rtl930x_get_l3_router_mac(u32 idx, struct rtl93xx_rt_mac *m)
{
	u32 v, w;
	// Read L3_ROUTER_MAC table (0) via register RTL9300_TBL_1
	struct table_reg *r = rtl_table_get(RTL9300_TBL_1, 0);

	rtl_table_read(r, idx);
	// The table has a size of 7 registers, 64 entries
	v = sw_r32(rtl_table_data(r, 0));
	w = sw_r32(rtl_table_data(r, 3));
	m->valid = !!(v & BIT(20));
	if (!m->valid)
		goto out;

	m->p_type = !!(v & BIT(19));
	m->p_id = (v >> 13) & 0x3f;  // trunk id of port
	m->vid = v & 0xfff;
	m->vid_mask = w & 0xfff;
	m->action = sw_r32(rtl_table_data(r, 6)) & 0x7;
	m->mac_mask = ((((u64)sw_r32(rtl_table_data(r, 5))) << 32) & 0xffffffffffffULL)
			| (sw_r32(rtl_table_data(r, 4)));
	m->mac = ((((u64)sw_r32(rtl_table_data(r, 1))) << 32) & 0xffffffffffffULL)
			| (sw_r32(rtl_table_data(r, 2)));
	// Bits L3_INTF and BMSK_L3_INTF are 0

out:
	rtl_table_release(r);
}
/*
 * Reads a MAC entry for L3 termination as entry point for routing
 * from the hardware table
 * idx is the index into the L3_ROUTER_MAC table
 */
Reads a MAC entry for L3 termination as entry point for routing
from the hardware table
idx is the index into the L3_ROUTER_MAC table
Reads a MAC entry for L3 termination as entry point for routing from the hardware table idx is the index into the L3_ROUTER_MAC table
static void rtl930x_get_l3_router_mac(u32 idx, struct rtl93xx_rt_mac *m)
{
	u32 v, w;
	struct table_reg *r = rtl_table_get(RTL9300_TBL_1, 0);
	rtl_table_read(r, idx);
	v = sw_r32(rtl_table_data(r, 0));
	w = sw_r32(rtl_table_data(r, 3));
	m->valid = !!(v & BIT(20));
	if (!m->valid)
		goto out;
	m->p_type = !!(v & BIT(19));
	m->p_id = (v >> 13) & 0x3f;  
	m->vid = v & 0xfff;
	m->vid_mask = w & 0xfff;
	m->action = sw_r32(rtl_table_data(r, 6)) & 0x7;
	m->mac_mask = ((((u64)sw_r32(rtl_table_data(r, 5))) << 32) & 0xffffffffffffULL)
			| (sw_r32(rtl_table_data(r, 4)));
	m->mac = ((((u64)sw_r32(rtl_table_data(r, 1))) << 32) & 0xffffffffffffULL)
			| (sw_r32(rtl_table_data(r, 2)));
out:
	rtl_table_release(r);
}
static void rtl930x_get_l3_router_mac ( u32 idx , struct rtl93xx_rt_mac * m ) { u32 v , w ; struct table_reg * r = rtl_table_get ( RTL9300_TBL_1 , 0 ) ; rtl_table_read ( r , idx ) ; v = sw_r32 ( rtl_table_data ( r , 0 ) ) ; w = sw_r32 ( rtl_table_data ( r , 3 ) ) ; m -> valid = ! ! ( v & BIT ( 20 ) ) ; if ( ! m -> valid ) goto out ; m -> p_type = ! ! ( v & BIT ( 19 ) ) ; m -> p_id = ( v >> 13 ) & 0x3f ; m -> vid = v & 0xfff ; m -> vid_mask = w & 0xfff ; m -> action = sw_r32 ( rtl_table_data ( r , 6 ) ) & 0x7 ; m -> mac_mask = ( ( ( ( u64 ) sw_r32 ( rtl_table_data ( r , 5 ) ) ) << 32 ) & 0xffffffffffffULL ) | ( sw_r32 ( rtl_table_data ( r , 4 ) ) ) ; m -> mac = ( ( ( ( u64 ) sw_r32 ( rtl_table_data ( r , 1 ) ) ) << 32 ) & 0xffffffffffffULL ) | ( sw_r32 ( rtl_table_data ( r , 2 ) ) ) ; out : rtl_table_release ( r ) ; }
Reads a MAC entry for L3 termination as entry point for routing
 from the hardware table
 idx is the index into the L3_ROUTER_MAC table
Reads a MAC entry for L3 termination as entry point for routing from the hardware table idx is the index into the L3_ROUTER_MAC table
// Read L3_ROUTER_MAC table (0) via register RTL9300_TBL_1 // The table has a size of 7 registers, 64 entries // trunk id of port // Bits L3_INTF and BMSK_L3_INTF are 0