[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [lwip-users] Need help with tcp-raw-api app. Wrong checksum sometime
From: |
Bill Auerbach |
Subject: |
RE: [lwip-users] Need help with tcp-raw-api app. Wrong checksum sometimes calculatet ....THX !!! |
Date: |
Mon, 9 Nov 2009 08:28:16 -0500 |
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