[PATCH net-next v1] net: stmmac: Programming sequence for VLAN packets with split header
Abhishek Chauhan (ABC)
quic_abchauha at quicinc.com
Tue Sep 10 16:19:46 PDT 2024
On 9/6/2024 3:28 AM, Simon Horman wrote:
> On Wed, Sep 04, 2024 at 04:54:56PM -0700, Abhishek Chauhan wrote:
>> Currently reset state configuration of split header works fine for
>> non-tagged packets and we see no corruption in payload of any size
>>
>> We need additional programming sequence with reset configuration to
>> handle VLAN tagged packets to avoid corruption in payload for packets
>> of size greater than 256 bytes.
>>
>> Without this change ping application complains about corruption
>> in payload when the size of the VLAN packet exceeds 256 bytes.
>>
>> With this change tagged and non-tagged packets of any size works fine
>> and there is no corruption seen.
>>
>> Signed-off-by: Abhishek Chauhan <quic_abchauha at quicinc.com>
>
> ...
>
>> 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;
>> + value |= GMAC_CONFIG1_SAVE_EN;
>> + writel(value, ioaddr + GMAC_EXT_CFG1);
>
> Hi Abhishek,
>
> Perhaps it is inconsistent with the code elsewhere in this file,
> in which case I would suggest a follow-up clean-up, but I
> expect that using FIELD_PREP would both lead to cleaner code here
> and remove the need for *_SHIFT.
>
Noted!
>> +
>> value = readl(ioaddr + DMA_CHAN_CONTROL(dwmac4_addrs, chan));
>> if (en)
>> value |= DMA_CONTROL_SPH;
>> --
>> 2.25.1
>>
>>
More information about the linux-arm-kernel
mailing list