|
From: | Steffen |
Subject: | Re: [lwip-users] Need help with tcp-raw-api app. Wrong checksum sometimes calculatet ....THX !!! |
Date: | Mon, 09 Nov 2009 22:05:12 +0100 |
User-agent: | Thunderbird 2.0.0.23 (Windows/20090812) |
Thx for your fast answeres ! I don't use an operating system, so i
don't have threads. The target is a PowerPc MPC5567. I call the
"SendDiagnoseMessage()" function, when results from another Bussystem
are available. My ETH Controller is in Interrupt mode ! When calling the "SendDiagnoseMessage()" function,it is possible i get interrupted by the receive Interrupt of the ETH controller, (I told you that the wrong checksum only occurs, when a paket is received 1ms bevor i send with"SendDiagnoseMessage()"). I think normaly this should be no problem because the receive function allocates a new pbuf which is another than the send pbuf. But the SEQ and ACK number is counted up at this time (i received a PSH/ACK packet 1 ms second bevor i send so i have to count up the SEQ ACK numbers too, to be synchron. Maybe my packet is build already at this time). This is only speculation i hope you have any idea, what i can do.. I know from other devices who work withz the same Pc app , they send two pakets in series. (In my code you can see, i send an reply in the "tcp_recv_diag" and when the result is available a result paket). So they wait till the result is availbale an then they send both packets in series without an ACK between them. I've tried this too, but the LWIP waits after one packet for an ACK and send the second after that. Isa it possible to send to PSH/ACK pakets diretly in series without an ACK between them. I think this will solve my problem. Steffen Bill Auerbach schrieb: Also, the target wasn't mentioned. This also sounds like a driver and/or hardware problem as well. Bill-----Original Message----- From: address@hidden [mailto:address@hidden] On Behalf Of address@hidden Sent: Sunday, November 08, 2009 12:29 PM To: Mailing list for lwIP users Subject: Re: [lwip-users] Need help with tcp-raw-api app. Wrong checksum sometimes calculatet ....THX !!! You didn't say from where you call the SendDiagnoseMessage() function (i.e. which thread). Most often, things like checksum corruption (or corruption of linked lists etc.) result from multiple threads being active in the lwIP code at the same time. You should make sure that this is not the case by using tcpip_callback() when another thread wants to execute SendDiagnoseMessage() (this makes sure the function runs in the correct thread context). Simon Steffen schrieb:[..] void SendDiagnoseMessage(u08 source_address, u08 destination_address, u08 *message, u16 length) { struct ETH_Diagnose_Struct *hs_send_diagnose_message; struct tcp_pcb *apcbs = tcp_active_pcbs; u32 i=0; while (apcbs != NULL) { if (apcbs->local_port == DIAGNOSE_TCP_PORT) { hs_send_diagnose_message = apcbs->callback_arg; if (hs_send_diagnose_message->file == NULL ) { /* build tcp_diag_response_header */ DiagResponseHeader->len = (u32)length +DIAG_ADDRESS_LEN;DiagResponseHeader->ctrl_word = DIAG_RESP_CW; DiagResponseHeader->source = source_address; DiagResponseHeader->target = destination_address; /* copy payload */ for(i=0; i < length; i++) { diag_buf[i+ HEADER_LEN + DIAG_ADDRESS_LEN] =*message;message++; } hs_send_diagnose_message->file = (u08*)&diag_buf; hs_send_diagnose_message->left = length + HEADER_LEN+DIAG_ADDRESS_LEN; if(hs_send_diagnose_message->left >0) { tcp_send_data_diag(apcbs,hs_send_diagnose_message);tcp_sent(apcbs, tcp_sent_diag); } } break; } apcbs = apcbs->next; } } _______________________________________________ lwip-users mailing list address@hidden http://lists.nongnu.org/mailman/listinfo/lwip-users_______________________________________________ lwip-users mailing list address@hidden http://lists.nongnu.org/mailman/listinfo/lwip-users_______________________________________________ lwip-users mailing list address@hidden http://lists.nongnu.org/mailman/listinfo/lwip-users |
[Prev in Thread] | Current Thread | [Next in Thread] |