On 30 May 2018 at 07:17, Cédric Le Goater <c...@kaod.org> wrote: > The ftgmac100 NIC supports VLAN tag insertion and the MAC engine also > has a control to remove VLAN tags from received packets. > > The VLAN control bits and VLAN tag information are contained in the > second word of the transmit and receive descriptors. The Insert VLAN > bit and the VLAN Tag available bit are only valid in the first segment > of the packet. > > Signed-off-by: Cédric Le Goater <c...@kaod.org> > Reviewed-by: Philippe Mathieu-Daudé <f4...@amsat.org>
> + /* Check for VLAN */ > + if (bd.des0 & FTGMAC100_TXDES0_FTS && > + bd.des1 & FTGMAC100_TXDES1_INS_VLANTAG && > + be16_to_cpu(PKT_GET_ETH_HDR(ptr)->h_proto) != ETH_P_VLAN) { This is kind of bogus because there's no guarantee that h_proto here is sufficiently aligned to do a halfword load. However this is a problem common to all the PKT_GET_* macros so we should probably attack it separately to this series. Getting the ethernet h_proto field seems common enough that something like static inline uint16_t eth_get_proto(uint8_t *pkt) { return lduw_be_p(&PKT_GET_ETH_HDR(pkt)->h_proto); } would be handy in eth.h. Anyway, I've applied this series to target-arm.next. thanks -- PMM