mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-08-30 14:52:51 +08:00
port: read a trunk's members through one function
The member mask of an aggregation group is decoded by hand in two places, the lag command and the JSON behind the aggregation page, and every branch that touches trunks adds another copy. port_lag_members_get() sits next to port_lag_members_set() and both readers call it. It answers from the hardware, so it covers a group configured with lag and one a protocol brought up, without either having to say so. It reads through reg_read() rather than reg_read_m(), so sfr_data is left alone. Neither caller looked at it afterwards; both read the hash register next.
This commit is contained in:
@@ -733,6 +733,19 @@ void port_rldp_on(__xdata uint16_t p_ms)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Reads the member port bitmask of a Link Aggregation Group.
|
||||
* The groups have numbers 0-3; bit n is set when logical port n is a member.
|
||||
* The bitmask reflects what the hardware holds, so it covers groups set up
|
||||
* statically and groups a protocol brought up, without either having to say so.
|
||||
*/
|
||||
uint16_t port_lag_members_get(uint8_t lag) __banked
|
||||
{
|
||||
reg_read(RTL837X_TRK_MBR_CTRL_BASE + (lag << 2));
|
||||
return ((uint16_t)SFR_DATA_8 << 8) | SFR_DATA_0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Configure LAGs
|
||||
* Sets the members via port bitmask of a given Link Aggregation Group
|
||||
|
||||
Reference in New Issue
Block a user