> >>>> - padlen = (skb->len >= ETH_ZLEN) ? 0 : ETH_ZLEN - skb->len; > >>>> + padlen = (skb->len >= VLAN_ETH_ZLEN) ? 0 : VLAN_ETH_ZLEN - skb- > >>>>> len; > > Oh so they add the internal VLAN at the end of the frame, not the > > beginning? That is quite surprising but that would not be the one single > > oddity found with CPSW I am afraid.. The way I would approach this is > > with layering where the padding needs to occur: > > > > - within the tag driver you need to make sure there is enough room to > > insert the KSZ tag > > > > - within the ethernet MAC driver (which comes last in the transmit > > path), you need to make sure there is enough room to insert that trailer > > VLAN tag to permit internal transmission > > So you think this is a bug in the CPSW instead ? >
I think what causes this problem. In the MAC controller driver cpsw.c the buffer is always padded to CPSW_MIN_PACKET_SIZE. Normally that size is 60 bytes, but after Linux 4.14 kernel it was changed to VLAN_ETH_ZLEN. The original size should work, but I do not know why it was changed. It seems there is a new function using the CPSW_RX_VLAN_ENCAP bit. It is similar to what I experienced with the Atmel MAC driver. The newer kernels added some changes that introduced a bug and broke the tail tagging code. I had to submit a fix to the MAC driver to correct that. I do not think this patch should apply generally, but I do not know how to fix the MAC driver to work in all cases. You can try temporarily to change CPSW_MIN_PACKET_SIZE back to 60. It is only used to assign to min_packet_size. It may be possible to use a different size like 60 instead of 64 in the skb_padto function.