Open nicomedia opened 4 years ago
The MAC driver is probably not ported correctly. The tail tag should be added by the MAC driver. The switch driver provides a helper function for the MAC driver to pass along the socket buffer. The switch driver looks at the hardware configuration. If tail tagging is not enabled the socket buffer is unchanged and passed back. If tail tagging is enabled but PTP is not the switch driver adds only 1 byte to the end of frame. It PTP is enabled the switch adds 4 more bytes to the end of frame. Note the socket buffer size should be 60 if the original size is smaller than that. The MAC hardware can automatically pad the frame to 60, but software needs to do that when adding the tail tag. The switch driver uses a kernel API to add a buffer to the socket buffer. This may or not may not work. The latest kernels removed that API because nobody else is using it I think. The MAC hardware has hardware checksum generation which may require different implementation when adding the tail tag. For initial testing the F_SG scatter/gather option in the MAC driver should be disabled so that the socket buffer always contains a single buffer which makes it simple to detect any problem. Just before sending out that buffer print it out to make sure the tail tag is inserted properly. A simple program that can send multicast frame should be used to test the implementation. The "ptp" utility available here can be used. The CONFIG_KSZ_EMBEDDED configuration is no longer recommended although it does not affect anything.
Hello triha2work,
Thank you for interested in with my problem and point the problematic part. As you suggested, the problem was in MAC driver of my sistem. I had been checking skbuff and could not find the problem but the problem is in DMA mapping of the MAC driver. Now, if i able to make ptp4l work and sync the devices, everything would be fine. Thanks a lot again.
Hello ,
I am working on integrating KSZ8563 switch to Olimex A20-SOM which uses Allwinner chip and Linux-sunxi system which supports STMMAC (not macb or freescale) as MAC driver. So far, i have intorduced KSZ9897 driver into linux kernel and integrated into stmmac (dwmac-sunxi driver) with CONFIG_KSZ_EMBEDDED according to setup_sw.c and i have taken macb as a reference. I can see that driver is integrated successfully and ksz9897 driver functions can be called from stmmac driver successfully. If i set STP state FORWARDING and disable TAIL TAG, i can ping and communicate with host CPU without problems. I can also send all PTP messages with "ptp" application of the library or with "linuxptp" without problems.
When i activate IEEE1588 PTP and tail tagging (only for host port). I cannot ping or communicate with the device anymore. As errata indicates, LENGTH CHECK is disabled by driver and i checked it. When i try to send PTP messages from "ptp" application, i can see SYNC messages on remote but as malformed. When i compare received package with the transmitted, i see that last 10 bytes is removed by switch but i expect that switch should erase 5 bytes (4 bytes for PTP and 1 byte port tag). I cannot see any PTP messages like announce when i try to send it with "ptp" application. I can see the DHPC Requests on remote side but it is also malformed like SYNC. So, it seems some packets are dropped by switch (like ping or ANNOUNCE) and others sends in malformed way (like DHCP or SYNC) with 10 bytes removed from back (i expect 5 bytes only for tail tag). When i check mib stats of the ports, when i ping, host port TX count increases but TX count of switch or ports don't increase.
When i establish another setup i disabled PTP support and enable tail-tag, 1 byte is inserted at the end of every packet but 2 bytes are removed at the remote side. I again can get DHCP req but as malformed.
I try to explain the problem as far as i can but i stucked at this point. So could you tell me what could be the problem ?
Best Regards Fatih