[PATCH net v4 5/7] net: dsa: mt7530: fix handling of LLDP frames

Arınç ÜNAL arinc.unal at arinc9.com
Wed Jun 14 13:48:42 PDT 2023


On 14.06.2023 19:35, Russell King (Oracle) wrote:
> On Mon, Jun 12, 2023 at 10:59:43AM +0300, arinc9.unal at gmail.com wrote:
>> diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
>> index e4c169843f2e..8388b058fbe4 100644
>> --- a/drivers/net/dsa/mt7530.c
>> +++ b/drivers/net/dsa/mt7530.c
>> @@ -2261,7 +2261,11 @@ mt7530_setup(struct dsa_switch *ds)
>>   
>>   	/* Trap BPDUs to the CPU port */
>>   	mt7530_rmw(priv, MT753X_BPC, MT753X_BPDU_PORT_FW_MASK,
>> -		   MT753X_BPDU_CPU_ONLY);
>> +		   MT753X_PORT_FW_CPU_ONLY);
>> +
>> +	/* Trap LLDP frames with :0E MAC DA to the CPU port */
>> +	mt7530_rmw(priv, MT753X_RGAC2, MT753X_R0E_PORT_FW_MASK,
>> +		   MT753X_R0E_PORT_FW(MT753X_PORT_FW_CPU_ONLY));
>>   
>>   	/* Enable and reset MIB counters */
>>   	mt7530_mib_reset(ds);
>> @@ -2364,7 +2368,11 @@ mt7531_setup_common(struct dsa_switch *ds)
>>   
>>   	/* Trap BPDUs to the CPU port(s) */
>>   	mt7530_rmw(priv, MT753X_BPC, MT753X_BPDU_PORT_FW_MASK,
>> -		   MT753X_BPDU_CPU_ONLY);
>> +		   MT753X_PORT_FW_CPU_ONLY);
>> +
>> +	/* Trap LLDP frames with :0E MAC DA to the CPU port(s) */
>> +	mt7530_rmw(priv, MT753X_RGAC2, MT753X_R0E_PORT_FW_MASK,
>> +		   MT753X_R0E_PORT_FW(MT753X_PORT_FW_CPU_ONLY));
> 
> Looking at the above two hunks, they look 100% identical. Given that
> they are both setting up trapping to the CPU port, maybe they should
> be moved into their own common function called from both setup()
> functions?

Good idea, I shall make a function called something like 
mt753x_trap_frames() on my net-next series. For this series which is for 
net, I'd like my patches to fix the issue with as less structural 
changes as possible.

Arınç



More information about the linux-arm-kernel mailing list