[PATCH net-next v1] net: stmmac: Programming sequence for VLAN packets with split header

Abhishek Chauhan (ABC) quic_abchauha at quicinc.com
Wed Sep 4 19:05:22 PDT 2024



On 9/4/2024 6:12 PM, Sagar Cheluvegowda wrote:
> 
>> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c
>> index e0165358c4ac..dbd1be4e4a92 100644
>> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c
>> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c
>> @@ -526,6 +526,17 @@ static void dwmac4_enable_sph(struct stmmac_priv *priv, void __iomem *ioaddr,
>>  	value |= GMAC_CONFIG_HDSMS_256; /* Segment max 256 bytes */
>>  	writel(value, ioaddr + GMAC_EXT_CONFIG);
>>  
>> +	/* Additional configuration to handle VLAN tagged packets */
>> +	value = readl(ioaddr + GMAC_EXT_CFG1);
>> +	value &= ~GMAC_CONFIG1_SPLM;
>> +	/* Enable Split mode for header and payload at L2  */
>> +	value |= GMAC_CONFIG1_SPLM_L2OFST_EN << GMAC_CONFIG1_SPLM_SHIFT;
>> +	value &= ~GMAC_CONFIG1_SAVO;
>> +	/* Enables the MAC to distinguish between tagged vs untagged pkts */
>> +	value |= 4 << GMAC_CONFIG1_SAVO_SHIFT;
> I checked the data book internally and see SAVO bit is used to indicate the
> valueof the offset from the beginning of Length/Type field at which the header 
> should be split, i see the length/type field remains to be 2bytes even in case
> of tagged packets may be you need to keep the value of this field to 2bytes as
> it was before but one thing which i am still not able to understand is that even
> with the value of this field configured to 4 i don't see any packet corruption
> issue, something which needs to be checked with HW folks. 

Good catch Sagar. Let me check this internally and get back. 

>> +	value |= GMAC_CONFIG1_SAVE_EN;
>> +	writel(value, ioaddr + GMAC_EXT_CFG1);
>> +
>>  	value = readl(ioaddr + DMA_CHAN_CONTROL(dwmac4_addrs, chan));
>>  	if (en)
>>  		value |= DMA_CONTROL_SPH;



More information about the linux-arm-kernel mailing list