Forum Discussion
Altera_Forum
Honored Contributor
14 years agoIt looks like the driver incorrectly handles chains of short pbufs. The following code produces invalid TCP packets:
usleep(1000000);
netconn_write(com->conn, "a", 1, NETCONN_NOCOPY);
netconn_write(com->conn, "b", 1, NETCONN_NOCOPY);
netconn_write(com->conn, "c", 1, NETCONN_NOCOPY);
netconn_write(com->conn, "d", 1, NETCONN_NOCOPY);
netconn_write(com->conn, "e", 1, NETCONN_NOCOPY);
usleep(1000000);
09:41:10.544021 IP 169.254.177.104.23 > IM-W7.1166: P 154:155(1) ack 30 win 5811
0x0000: 4500 0029 001d 0000 4006 95a2 a9fe b168 E..)....@......h
0x0010: a9fe dfaa 0017 048e 0000 1a08 33eb a83c ............3..<
0x0020: 5018 16b3 5833 0000 6100 0000 0000 P...X3..a.....
09:41:10.745999 IP IM-W7.1166 > 169.254.177.104.23: . ack 155 win 64086
0x0000: 4500 0028 014d 4000 8006 0000 a9fe dfaa E..(.M@.........
0x0010: a9fe b168 048e 0017 33eb a83c 0000 1a09 ...h....3..<....
0x0020: 5010 fa56 e52a 0000 P..V.*..
09:41:10.746866 IP 169.254.177.104.23 > IM-W7.1166: P 155:159(4) ack 30 win 5811
0x0000: 4500 002c 001f 0000 4006 959d a9fe b168 E..,....@......h
0x0010: a9fe dfaa 0017 048e 0000 1a09 33eb a83c ............3..<
0x0020: 5018 16b3 f266 0000 6200 0000 6300 0000 P....f..b...c...
0x0030: 6400 0000 65 d...e
(this last packet is never ACKed by the host and connection freezes)With printf("<%d>", len); in tse_mac_raw_send() I see that the driver forwards to the sgdma the following pbuf sequence: <56><1> <56><1><1><1><1> According to Altera docs sgdma don’t like short transfers, and I think all these extra pad bytes are injected by sgdma. If this is the case, then the driver should provide some workaround, maybe by combining small chunks (if any) into single continuous sgdma request. Also, has anyone tried to use “On-Chip FIFO Memory Core” in place of sgdma for ethernet? I have never observed this behavior with copying tcp_write. But, does lwIP guarantee not to emit short pbufs for copying tcp flow? Igor