Lee Noack | 17 Dec 11:19 2014
Picon

TM4C1294 LWIP Usage

Hi,


My goal is to receive data from the GPIO ports continuously, store it in dual buffers and feed this out the ethernet port continuously. I was hoping to use the enet-lwip example as a starting point but this does leave me with many questions and a steep learning curve. partially because the examples are generally web servers.

Firstly I understand LWIP is driven by callback functions. One of which is declared as

err_t (* accept) (void * arg, struct tcp_pcb *newpcb, err_t) 

It is not well documented what one is meant to do in these callback function although I have scoured the web and plagarised heavily as in the attached code.

Secondly where do you write the code when it is meant to called by the ethernet interrupt. I placed my initial trial code in the lwIPHostTimerHandler as the code was jumping to there after the call to lwIPInit() however that is obviously not the spot to place it eventually if I am to achieve my aim.

Thirdly my current problem aside from these issues is that I can establish a connection to a client that a colleague wrote for me however I cannot seem to send anything.

Some help and guidance at this early stage would be much appreciated.

Regards,
Lee.
Attachment (enet_lwip.c): text/x-csrc, 19 KiB
_______________________________________________
lwip-users mailing list
lwip-users@...
https://lists.nongnu.org/mailman/listinfo/lwip-users
Ivan Delamer | 15 Dec 16:39 2014

Re: ip6_addr_ismulticast_ doesn't allow for transient multicast address

Ian,

Can you file this as a bug in Savannah, so it doesn't get forgotten?

Ivan

> Date: Sun, 14 Dec 2014 15:20:34 +0000
> From: Ian <lwip@...>
> To: lwip-users@...
> Subject: Re: [lwip-users] ip6_addr_ismulticast_ doesn't allow for
> 	transient multicast address
> Message-ID: <548DAAC2.8010804@...>
> Content-Type: text/plain; charset="windows-1252"
> 
> If I'd read the current RFC (rfc4291 section 2.7) I might me better
> informed. There is also the P and R flags to be concerned with. 
> And-ing
> with 0xff8f0000UL may be more appropriate.
> 
> Regards,
> 
> Ian
> On 13/12/14 18:52, Ian wrote:
>> If I read RFC1884 (section 2.6) correctly the ip6_addr_ismulticast_*
>> macros need to allow for the T-bit=1 indicating that a transient
>> multicast address is being used. The following diff shows the changes
>> I've made locally.
>> 
>> Regards,
>> 
>> Ian
>> 
>> diff --git a/ethernet/lwip-git/src/include/ipv6/lwip/ip6_addr.h
>> b/ethernet/lwip-git/src/include/ipv6/lwip/ip6_addr.h
>> index 4e5f4a2..7046b57 100644
>> --- a/ethernet/lwip-git/src/include/ipv6/lwip/ip6_addr.h
>> +++ b/ethernet/lwip-git/src/include/ipv6/lwip/ip6_addr.h
>>  <at>  <at>  -195,12 +195,12  <at>  <at>  Little-endian version, stored in network order 
>> (no
>> htonl). */
>>  #define IP6_MULTICAST_SCOPE_ORGANIZATION_LOCAL  0x8
>>  #define IP6_MULTICAST_SCOPE_GLOBAL              0xe
>>  #define IP6_MULTICAST_SCOPE_RESERVEDF           0xf
>> -#define ip6_addr_ismulticast_iflocal(ip6addr) (((ip6addr)->addr[0] &
>> PP_HTONL(0xffff0000UL)) == PP_HTONL(0xff010000UL))
>> -#define ip6_addr_ismulticast_linklocal(ip6addr) (((ip6addr)->addr[0] 
>> &
>> PP_HTONL(0xffff0000UL)) == PP_HTONL(0xff020000UL))
>> -#define ip6_addr_ismulticast_adminlocal(ip6addr) 
>> (((ip6addr)->addr[0] &
>> PP_HTONL(0xffff0000UL)) == PP_HTONL(0xff040000UL))
>> -#define ip6_addr_ismulticast_sitelocal(ip6addr) (((ip6addr)->addr[0] 
>> &
>> PP_HTONL(0xffff0000UL)) == PP_HTONL(0xff050000UL))
>> -#define ip6_addr_ismulticast_orglocal(ip6addr) (((ip6addr)->addr[0] 
>> &
>> PP_HTONL(0xffff0000UL)) == PP_HTONL(0xff080000UL))
>> -#define ip6_addr_ismulticast_global(ip6addr) (((ip6addr)->addr[0] &
>> PP_HTONL(0xffff0000UL)) == PP_HTONL(0xff0e0000UL))
>> +#define ip6_addr_ismulticast_iflocal(ip6addr) (((ip6addr)->addr[0] &
>> PP_HTONL(0xffef0000UL)) == PP_HTONL(0xff010000UL))
>> +#define ip6_addr_ismulticast_linklocal(ip6addr) (((ip6addr)->addr[0] 
>> &
>> PP_HTONL(0xffef0000UL)) == PP_HTONL(0xff020000UL))
>> +#define ip6_addr_ismulticast_adminlocal(ip6addr) 
>> (((ip6addr)->addr[0] &
>> PP_HTONL(0xffef0000UL)) == PP_HTONL(0xff040000UL))
>> +#define ip6_addr_ismulticast_sitelocal(ip6addr) (((ip6addr)->addr[0] 
>> &
>> PP_HTONL(0xffef0000UL)) == PP_HTONL(0xff050000UL))
>> +#define ip6_addr_ismulticast_orglocal(ip6addr) (((ip6addr)->addr[0] 
>> &
>> PP_HTONL(0xffef0000UL)) == PP_HTONL(0xff080000UL))
>> +#define ip6_addr_ismulticast_global(ip6addr) (((ip6addr)->addr[0] &
>> PP_HTONL(0xffef0000UL)) == PP_HTONL(0xff0e0000UL))
>> 
>>  /* TODO define get/set for well-know multicast addresses, e.g. 
>> ff02::1 */
>>  #define ip6_addr_isallnodes_iflocal(ip6addr) (((ip6addr)->addr[0] ==
>> PP_HTONL(0xff010000UL)) && \
>> 
>> _______________________________________________
>> lwip-users mailing list
>> lwip-users@...
>> https://lists.nongnu.org/mailman/listinfo/lwip-users
> 
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: lwip-ismulticast.patch
> Type: text/x-patch
> Size: 2146 bytes
> Desc: not available
> URL:
> <http://lists.nongnu.org/archive/html/lwip-users/attachments/20141214/a43cd0d0/attachment.bin>
> 
> ------------------------------
> 
> _______________________________________________
> lwip-users mailing list
> lwip-users@...
> https://lists.nongnu.org/mailman/listinfo/lwip-users
> 
> End of lwip-users Digest, Vol 136, Issue 9
> ******************************************
Ian | 13 Dec 19:52 2014

ip6_addr_ismulticast_ doesn't allow for transient multicast address

If I read RFC1884 (section 2.6) correctly the ip6_addr_ismulticast_*
macros need to allow for the T-bit=1 indicating that a transient
multicast address is being used. The following diff shows the changes
I've made locally.

Regards,

Ian

diff --git a/ethernet/lwip-git/src/include/ipv6/lwip/ip6_addr.h
b/ethernet/lwip-git/src/include/ipv6/lwip/ip6_addr.h
index 4e5f4a2..7046b57 100644
--- a/ethernet/lwip-git/src/include/ipv6/lwip/ip6_addr.h
+++ b/ethernet/lwip-git/src/include/ipv6/lwip/ip6_addr.h
 <at>  <at>  -195,12 +195,12  <at>  <at>  Little-endian version, stored in network order (no
htonl). */
 #define IP6_MULTICAST_SCOPE_ORGANIZATION_LOCAL  0x8
 #define IP6_MULTICAST_SCOPE_GLOBAL              0xe
 #define IP6_MULTICAST_SCOPE_RESERVEDF           0xf
-#define ip6_addr_ismulticast_iflocal(ip6addr) (((ip6addr)->addr[0] &
PP_HTONL(0xffff0000UL)) == PP_HTONL(0xff010000UL))
-#define ip6_addr_ismulticast_linklocal(ip6addr) (((ip6addr)->addr[0] &
PP_HTONL(0xffff0000UL)) == PP_HTONL(0xff020000UL))
-#define ip6_addr_ismulticast_adminlocal(ip6addr) (((ip6addr)->addr[0] &
PP_HTONL(0xffff0000UL)) == PP_HTONL(0xff040000UL))
-#define ip6_addr_ismulticast_sitelocal(ip6addr) (((ip6addr)->addr[0] &
PP_HTONL(0xffff0000UL)) == PP_HTONL(0xff050000UL))
-#define ip6_addr_ismulticast_orglocal(ip6addr) (((ip6addr)->addr[0] &
PP_HTONL(0xffff0000UL)) == PP_HTONL(0xff080000UL))
-#define ip6_addr_ismulticast_global(ip6addr) (((ip6addr)->addr[0] &
PP_HTONL(0xffff0000UL)) == PP_HTONL(0xff0e0000UL))
+#define ip6_addr_ismulticast_iflocal(ip6addr) (((ip6addr)->addr[0] &
PP_HTONL(0xffef0000UL)) == PP_HTONL(0xff010000UL))
+#define ip6_addr_ismulticast_linklocal(ip6addr) (((ip6addr)->addr[0] &
PP_HTONL(0xffef0000UL)) == PP_HTONL(0xff020000UL))
+#define ip6_addr_ismulticast_adminlocal(ip6addr) (((ip6addr)->addr[0] &
PP_HTONL(0xffef0000UL)) == PP_HTONL(0xff040000UL))
+#define ip6_addr_ismulticast_sitelocal(ip6addr) (((ip6addr)->addr[0] &
PP_HTONL(0xffef0000UL)) == PP_HTONL(0xff050000UL))
+#define ip6_addr_ismulticast_orglocal(ip6addr) (((ip6addr)->addr[0] &
PP_HTONL(0xffef0000UL)) == PP_HTONL(0xff080000UL))
+#define ip6_addr_ismulticast_global(ip6addr) (((ip6addr)->addr[0] &
PP_HTONL(0xffef0000UL)) == PP_HTONL(0xff0e0000UL))

 /* TODO define get/set for well-know multicast addresses, e.g. ff02::1 */
 #define ip6_addr_isallnodes_iflocal(ip6addr) (((ip6addr)->addr[0] ==
PP_HTONL(0xff010000UL)) && \
mfkexpress | 9 Dec 08:22 2014
Picon

No case for IPv6 in ethernet_input()

Hi,

I think there is a bug in ethernet_input(). Because if there is etherent IP6
packet, then it should first go to ethernet_input() through tcpip_thread()
and than after ip6_input() mshould be called.

But there is no provision for ip6 packet. Only ip_input() is there. I
implemented something as follows in ethernet_input() function in my project:

           #if LWIP_IPV6
           case PP_HTONS(ETHTYPE_IPV6):
	/* skip Ethernet header */
             if(pbuf_header(p, -ip_hdr_offset)) {
                LWIP_ASSERT("Can't move over header in packet", 0);
                goto free_and_return;
            }
            else {
            /* pass to IP6 layer */
            ip6_input(p, netif);
            }
            break;
           #endif /* LWIP_IPV6 */

Before adding this, my ip6 packets were not processed.

Thanks & Regards,
Mohsin

--
View this message in context: http://lwip.100.n7.nabble.com/No-case-for-IPv6-in-ethernet-input-tp23597.html
Sent from the lwip-users mailing list archive at Nabble.com.
mfkexpress | 8 Dec 13:36 2014
Picon

Pinging for link-local IP6 address not working

Hi, 

I'm trying to implement IPv6 in my device. 

I've configured linklocal IP6 address using
netif_create_ip6_linklocal_address() function in my device.

When I ping from my PC to IP6 address of my device, I get "General failure"
reply. But still I can see NS/NA packets of my device on wireshark than why
it gives failure reply?

For IP6 communication, should IP6 address be configured as static(Unique
Local) or it should work with link-local also??

Any help would be highly appreciated...

Thanks & Regards, 
Mohsin 

--
View this message in context: http://lwip.100.n7.nabble.com/Pinging-for-link-local-IP6-address-not-working-tp23586.html
Sent from the lwip-users mailing list archive at Nabble.com.
mfkexpress | 8 Dec 13:31 2014
Picon

Pinging linklocal IP6 address gives "general failure" reply

Hi,

I'm trying to implement IPv6 in my device.

I've configured linklocal IP6 address using
netif_create_ip6_linklocal_address() function in my device.

When I ping from my PC to IP6 address of my device, I get "General failure"
reply.

Should IP6 address be configured as static(Unique Local) or it should work
with link-local also??

Any help would be highly appreciated..

Regards,
Mohsin

--
View this message in context: http://lwip.100.n7.nabble.com/Pinging-linklocal-IP6-address-gives-general-failure-reply-tp23585.html
Sent from the lwip-users mailing list archive at Nabble.com.
Karl Karpfen | 8 Dec 09:29 2014
Picon

Handling in case of disabled Nagle

Hi,

I found a strange problem related to Nagle-algorithm but possibly caused by host operating system. My application is as follows:

- host sends payload data to my lwIP-driven device in packets of 1460 bytes
- host sends state-requests to this device in packets of 3 bytes
- device sends state-response in packets of 40 bytes to host (which is waiting for them asynchronously, means receiving is done in an own thread)

Since all these packets have to be handled as fast as possible, I disabled Nagle on both ends (TCP_NODELAY on host side and tcp_nagle_disable() on device side).

Now there is a situation where host sends state-requests (3 bytes) to device quite fast. Under Linux host is able to receive the related state-response (40 bytes) wihtout problems, unter Windows at some point no more data are received, it seems disabled Nagle-algorithm seems to stall the receiving-side when many packets are sent. From device-side it seems it is not possible to send these data (means even to queue them). Since it works smoothly with Linux I think that happens because Windows no longer accepts any packets so that the lwIP-internal buffer becomes full at some point.

My current - really ugly - solution is to have a delay of at least 10 msec after submission of every send-request. This lets Windows receive the response without problems.

My question: did anybody notice such a behaviour? Is there anything I can do to avoid this and to enforce lwIP to send the response also when there are many packages received?

Thanks!

_______________________________________________
lwip-users mailing list
lwip-users@...
https://lists.nongnu.org/mailman/listinfo/lwip-users
Padmini Gaur | 3 Dec 19:29 2014
Picon

Query regarding internals of lwip-contrib: Unix port

Hello,
I have been using Unix platform to have a hands-on experience of lwip.
My aim is to study and analyze the lwip stack. Currently, I am trying
to analyze the performance of the lwip stack in Unix environment.
However, the stack is not the default one, and the tap0  interface can
not reach the outer network. I found a bridge creation technique in
which the interfaces are held up in promiscuous mode. But, I want to
communicate to the outer world using lwip stack. Is there any overview
of contrib code, any tutorial or user guide to throw some light and
provide insight to in-depth details and tell me how to configure
things to my requirement? Else, how can I proceed?
Thanks a lot!
--
Padmini Gaur
pgaur1411@...
Matthias Dübon | 3 Dec 09:26 2014
Picon

tcp listen backlog

Hello everyone,

I am using lwip for server application on raw API and want max. 1
active tcp connection.
Therefore I set the following defines in liwpopts.h:

#define TCP_LISTEN_BACKLOG              1
#define TCP_DEFAULT_LISTEN_BACKLOG      1

and I implemented my server with:

pcb = tcp_listen_with_backlog(pcb, 1);
tcp_accept(pcb, http_accept);

in http_accept I implement something like

err_t http_ssl_accept(void *arg, struct tcp_pcb *pcb, err_t err)
{
    static someCounter = 0;
    if (someCounter > 0) {
          // why am I here
    }
    someCounter = someCounter + 1;
    // some code
    someCounter =  someCounter - 1;
}

Now I would expect that the line "// why am I here" can never be
reached. But some test showed that this assumption is not true for my
setup. Do I understand something wrong the BACKLOGs?

best
Matthias
martinh | 1 Dec 18:07 2014

fnConnected not invoked

Hi
I am using TI's Starterware package with BeagleBoneBlack and need to
transfer big data packages using TCP.
Now the listener is working fine (I am using the Hercules setup utility to
check): Data is received and I also can send messages back from within the
listener function.

But I have to send data periodically from within the mainloop.
For some reason the 'Connected' function never is invoked.
Mostlikely it has something to do with the client on the remote Pc - it must
be there to accept the connection.
To run tcp_connect(), the pcb->state must be CLOSED, but for the listener
pcb it is LISTEN. Hence tcp_connect() is rejected.

This the initialisation code when I have an addional tcp_pcb just for
sending data. In this case Hercules on the remote pc has an additional TCP
client window opened. But I don't know if that is sufficient to accept a
connection:

//*********************************************************************
// Fkt.:	SesEnet_InitTx()
//          Verbindung initialisieren f. Versenden von Header u. Daten
// ein:		IP-Adr. ist bekannt (Se.dwIp)
//*********************************************************************
void SesEnet_InitTx(DWORD PortSrc) {
err_t err;

	pt_tcp_pcb_tx = tcp_new();
	tcp_bind(pt_tcp_pcb_tx, IPADDR_ANY, PORTSES_SRC_TX); // port is 9998

	//pcb = tcp_listen(pcb);

	tcp_arg(pt_tcp_pcb_tx, pt_tcp_pcb_tx); 
		//  Specifies the program specific state that should be passed to all
		//  other callback functions. The "pcb" argument is the current TCP
		//  connection control block, and the "arg" argument is the argument
		//  that will be passed to the callbacks.

	tcp_accept(pt_tcp_pcb_tx, TxListen_accept); // connection has been
connected to another host

	//--- connect -------------------------------------------------------
	Se.dwIp = 0xF273A8C0;   // destination IP address
	err = tcp_connect(	
		pt_tcp_pcb_tx,
		(ip_addr_t *) &Se.dwIp,
		PORTSES_DEST_TX,		// Port is 9998
		(tcp_connected_fn) Connected);

}

//**********************************************************************
// Fkt.:  TxListen_accept * A new incoming connection has been accepted.

//**********************************************************************
err_t TxListen_accept(void *arg, struct tcp_pcb *pcb, err_t err) {
	LWIP_UNUSED_ARG(err);

	/* Decrease the listen backlog counter */
	//tcp_accepted(((struct tcp_pcb_listen* )arg));

	tcp_setprio(pcb, SES_TCP_PRIO);

	/* Set up the various callback functions */
	//tcp_recv(pcb, CmdListen_recv);		// Callback-Fkt. bei Datenempfang
	tcp_err(pcb, Err_Tx);        	// NULL - keine Callback-Fkt. bei fatalem
Fehler

	tcp_poll(pcb, NULL, SES_POLL_INTERVAL);  // keine Fkt. periodisch aufrufen

	tcp_sent(pcb, SentTx); 

	return ERR_OK;

Can anybody tell me if there is anything wrong with the initialization?
How would one typically check such a data transfer from the remote
computer's point of view?
As there is no listener function for pt_tcp_pcb_tx, could tcp_accept() do
any harm?

Would it be possible to use the same tcp_pcb for listening and sending data
(but then how to run tcp_connect() with a pcb that is not closed)?

Every comment is very much appreciated!!!!!
I have already spent a lot of time on that issue but simply can't find a
solution.

Thank you.

Martin H.

--
View this message in context: http://lwip.100.n7.nabble.com/fnConnected-not-invoked-tp23566.html
Sent from the lwip-users mailing list archive at Nabble.com.
Mike Stitt | 30 Nov 20:51 2014

Netconn API, e.g. lwip_close, netconn_close, or netconn_delete, sometimes does not return, with suggested fixes.

Hello,

Using lwIP on top of FreeRTOS, I have been having problems where the Netconn API 
does not return to my application. 

This happens mostly on netconn_close and netconn_delete.

To cause the problem to happen more frequently, my network is setup like this:

internet <-> AppleAirPortExpress <-> EthernetSwitch <-> lwipUnitUnderTest
                 ^
                 |
                 WebPowerSwitch

A script controls the WebPowerSwitch and power cycles the 
AppleAirportExpress on for two minutes and then off for two minutes. 
During these power cycles the Ethernet Switch and the 
lwIP Unit Under Test remain powered on, and maintains an Ethernet Link.

My lwipopts.h is appended at the end of this email.  At the top level I have TCP_MSL 
set to 4000 msec because the embedded real time nature of my application is not tolerant
of blocking on hung TCP connections for long periods of time.  

My application uses the sockets API on top of the netconn API.  On lwip_send I
set a SO_SNDTIMEO of 500 msec.  

    uint32_t timeout = 500;
    socklen_t sizeOfTimeOut = sizeof(timeout);

    int result = setsockopt (sd, SOL_SOCKET, SO_SNDTIMEO, (char *)&timeout, sizeOfTimeOut);

The application thread detects that the internet is down (powered off Apple AirPort) by getting 
too many send timeouts, it then tries to close the socket, where I get this calling tree which never
returns: lwip_close->netconn_delete-> (mailbox to TCP/IP task)  lwip_netconn_do_delconn->
lwip_netconn_do_close_internal

lwip_netconn_do_close_internal calls this path: lwip_close->tcp_close_shutdown->tcp_send_fin->
tcp_enqueue_flags

Which returns an error, and lwip_netconn_do_close_internal decides to let tcp_slowtmr call
poll_tcp to finish the close, which it never does.

which does not seem to have been reproduced and fixed,  and also to 
be solved.

The tip of the tree lwIP does better than lwIP 1.4.1 because it does not allow TCP_SND_QUEUELEN
to block adding a segment to set FIN in tcp_enqueue_flags:

err_t
tcp_enqueue_flags(struct tcp_pcb *pcb, u8_t flags)
{
  /* ... snip ... */
  /* check for configured max queuelen and possible overflow (FIN flag should always come through!) */
  if (((pcb->snd_queuelen >= TCP_SND_QUEUELEN) || (pcb->snd_queuelen > TCP_SNDQUEUELEN_OVERFLOW)) &&
      ((flags & TCP_FIN) == 0)) {


I have suggested fixes to ensure that the netconn API and specifically netconn_delete and 
netconn_close always return.

on this commit: 


Within the suggested fixes, there are 3 areas of improvement

1)#define TCP_CLOSE_ALWAYS_RETURNS 1
Targets the cases where tcp_enqueue_flags can not allocate buffer space for the segment needed
to add the FIN bit. With TCP_CLOSE_ALWAYS_RETURNS, we choose to return an error in this case rather
than letting tcp_slowtmr try to resolve the memory issue later.

2)#define TCP_DO_NOT_ADD_FIN_TO_RST 1
Targets a corner case that occurs in this scenario where lwIP has decided that the connection should
be RST, but has not been able to push out the segment with the RST, and now on the close, wants to
add a FIN.  By setting TCP_DO_NOT_ADD_FIN_TO_RST we close the connection without trying to add the FIN
in this case.

3)#define LWIP_PCB_COMPLETED_BOOKKEEPING 1
Adds a more robust solution to the application to TCP/IP thread netconn interface. It adds a to_be_completed
byte to the netconn data structure. For the sockets and netconn API, it the keeps track of whether or not the 
application thread is blocked on the TCP/IP task for PCBs that are purged by tcp_slowtmr.  tcp_slowtmr calls
the pcb->errf which will sys_sem_signal the application thread with a ERR_ABRT when the pcb is purged. 

This ensures that the application netconn_close, netconn_delete or any socket/netconn API return
when a pcb is purged.

This is an important fix in my application because we do not want to have to reset the system to unblock 
the application when the Ethernet link stays up but the connection to the internet goes down.

Thanks for your consideration of these suggested fixes.


-best

-Mike

Mike Stitt | Engineering Lead
SpinDance, Inc. | Smart Choice. Smart Products.
SpinDance.com | #SMARTproduct

#--------------------
# my lwipopts.h:
#--------------------

#ifndef __LWIPOPTS_H__
#define __LWIPOPTS_H__

#include "autoconf.h"
#include "logger.h"
#include "quickStart.h"
#include "incidentLog/log.h"
#include "rnd/rnd.h"
#include <sys/time.h>

/**
 * TCP_CLOSE_ALWAYS_RETURNS==1: To force lwip_close and lwip_shutdown
 * to always return. Otherwise lwIP can be deadlocked when it can not allocate
 * the buffer space for the FIN to end a message.
 */
#define TCP_CLOSE_ALWAYS_RETURNS 1

/**
 * TCP_DO_NOT_ADD_FIN_TO_RST==1: When trying to close a connection, if
 * we have already set the RST flag don't expend the effort to try to allocate
 * a segment to add a RST. Just hang up quietly.
 */
#define TCP_DO_NOT_ADD_FIN_TO_RST 1

/**
 * LWIP should keep track of calling threads that are waiting on
 * a call back and return an error to threads that are waiting when the
 * pcb is purged.
 */
#define LWIP_PCB_COMPLETED_BOOKKEEPING 1

/**
 * SYS_LIGHTWEIGHT_PROT==1: if you want inter-task protection for certain
 * critical regions during buffer allocation, deallocation and memory
 * allocation and deallocation.
 */
#define SYS_LIGHTWEIGHT_PROT    1

#define ETHARP_TRUST_IP_MAC     0
#define ETHARP_SUPPORT_VLAN     0
#define IP_REASSEMBLY           0
#define IP_FRAG                 0
#define ARP_QUEUEING            0
#define TCP_LISTEN_BACKLOG      1

/**
 * LWIP_RAW==1: Enable application layer to hook into the IP layer itself.
 */
#define LWIP_RAW 0

/**
 * NO_SYS==1: Provides VERY minimal functionality. Otherwise,
 * use lwIP facilities.
 */
#define NO_SYS                  0

/* ---------- Memory options ---------- */
/* MEM_ALIGNMENT: should be set to the alignment of the CPU for which
   lwIP is compiled. 4 byte alignment -> define MEM_ALIGNMENT to 4, 2
   byte alignment -> define MEM_ALIGNMENT to 2. */
#define MEM_ALIGNMENT           4

/* MEM_SIZE: the size of the heap memory. If the application will send
a lot of data that needs to be copied, this should be set high. */
#define MEM_SIZE                (5*1024)

/* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
   sends a lot of data out of ROM (or other static memory), this
   should be set high. */
#define MEMP_NUM_PBUF           10
/* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
   per active UDP "connection". */
#define MEMP_NUM_UDP_PCB        6
/* MEMP_NUM_TCP_PCB: the number of simultaneously active TCP
   connections. */
#define MEMP_NUM_TCP_PCB        10
/* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP
   connections. */
#define MEMP_NUM_TCP_PCB_LISTEN 2
/* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP
   segments. */
#define MEMP_NUM_TCP_SEG        40
/* MEMP_NUM_SYS_TIMEOUT: the number of simultaneously active
   timeouts. */
#define MEMP_NUM_SYS_TIMEOUT    10

/* MEMP_NUM_NETCONN: the number of struct netconns.
 * (only needed if you use the sequential API, like api_lib.c) */
#define MEMP_NUM_NETCONN        5

/* The number of struct tcpip_msg,  which are used for ALL incoming packets.
 * Despite the name, this is NOT for TCP only,
 * but UDP and other inbound packet types as well.
 */
#define MEMP_NUM_TCPIP_MSG_INPKT  10


/* ---------- Pbuf options ---------- */
/* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
#define PBUF_POOL_SIZE          20

/* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
#define PBUF_POOL_BUFSIZE       500


/* ---------- TCP options ---------- */
#define LWIP_TCP                1
#define TCP_TTL                 255

/* The maximum segment lifetime in milliseconds */
#define TCP_MSL                 4000

/* Controls if TCP should queue segments that arrive out of
   order. Define to 0 if your device is low on memory. */
#define TCP_QUEUE_OOSEQ         0

/* TCP Maximum segment size. */
#define TCP_MSS                 (1500 - 40)   /* TCP_MSS = (Ethernet MTU - IP header size - TCP header size) */

/* TCP sender buffer space (bytes). */
#define TCP_SND_BUF             (2 * TCP_MSS)

/*  TCP_SND_QUEUELEN: TCP sender buffer space (pbufs). This must be at least
  as much as (2 * TCP_SND_BUF/TCP_MSS) for things to work. */

#define TCP_SND_QUEUELEN        (2 * TCP_SND_BUF/TCP_MSS)

/* TCP_SNDQUEUELOWAT: TCP writable bufs (pbuf count). This must be less
 * than TCP_SND_QUEUELEN. If the number of pbufs queued on a pcb drops below
 * this number, select returns writable (combined with TCP_SNDLOWAT).
 */
#define TCP_SNDQUEUELOWAT       3

/* TCP receive window. */
#define TCP_WND                 (2*TCP_MSS)

/* Random local ports */

#define LWIP_RANDOMIZE_INITIAL_LOCAL_PORTS 1
#define LWIP_RAND() rndGetNextRndUInt()

/* Random ISS - requires LWIP_RAND() */
#define LWIP_TCP_RANDOMIZE_INITIAL_ISS 1

/* value to increment ISS every coarse timer tick */
#define LWIP_TCP_ISS_TICK_MULTIPLIER 64000

/* ---------- ICMP options ---------- */
#define LWIP_ICMP                       1


/* ---------- DHCP options ---------- */
/* Define LWIP_DHCP to 1 if you want DHCP configuration of
   interfaces. */
#define LWIP_DHCP               CONFIG_LWIP_DHCP


/* Enable AUTOIP and DHCP/AUTOIP cooperation to enable fallback to AUTOIP when
   DHCP is not available. */
#define LWIP_AUTOIP             CONFIG_LWIP_AUTOIP
#define LWIP_DHCP_AUTOIP_COOP   (LWIP_DHCP && LWIP_AUTOIP)


/* Bump this down from the default of 9 to decrease the time it takes for DCHP
   to timeout and switch over to AUTOIP */
#define LWIP_DHCP_AUTOIP_COOP_TRIES     5

#define LWIP_AUTOIP_TRIES_UNTIL_TRY_STATIC     5

/* ---------- UDP options ---------- */
#define LWIP_UDP                1
#define UDP_TTL                 255


/* ---------- Statistics options ---------- */
#define LWIP_STATS CONFIG_LWIP_STATS
#define LWIP_PROVIDE_ERRNO 1

#if LWIP_STATS
#define LWIP_STATS_LARGE CONFIG_LWIP_STATS_LARGE

#define LINK_STATS CONFIG_LINK_STATS
#define ETHARP_STATS CONFIG_ETHARP_STATS
#define IPFRAG_STATS CONFIG_IPFRAG_STATS
#define IP_STATS CONFIG_IP_STATS
#define ICMP_STATS CONFIG_ICMP_STATS
#define IGMP_STATS CONFIG_IGMP_STATS
#define UDP_STATS CONFIG_UDP_STATS
#define TCP_STATS CONFIG_TCP_STATS
#define MEM_STATS CONFIG_MEM_STATS
#define MEMP_STATS CONFIG_MEMP_STATS
#define SYS_STATS CONFIG_SYS_STATS
#define LWIP_STATS_DISPLAY CONFIG_LWIP_STATS_DISPLAY
#endif

/* ---------- link callback options ---------- */
/* LWIP_NETIF_LINK_CALLBACK==1: Support a callback function from an interface
 * whenever the link changes (i.e., link down)
 */
#define LWIP_NETIF_LINK_CALLBACK        1

/*
   --------------------------------------
   ---------- Checksum options ----------
   --------------------------------------
*/

/* 
The STM32F4x7 allows computing and verifying the IP, UDP, TCP and ICMP checksums by hardware:
 - To use this feature let the following define uncommented.
 - To disable it and process by CPU comment the  the checksum.
*/
#define CHECKSUM_BY_HARDWARE 


#ifdef CHECKSUM_BY_HARDWARE
  /* CHECKSUM_GEN_IP==0: Generate checksums by hardware for outgoing IP packets.*/
  #define CHECKSUM_GEN_IP                 0
  /* CHECKSUM_GEN_UDP==0: Generate checksums by hardware for outgoing UDP packets.*/
  #define CHECKSUM_GEN_UDP                0
  /* CHECKSUM_GEN_TCP==0: Generate checksums by hardware for outgoing TCP packets.*/
  #define CHECKSUM_GEN_TCP                0 
  /* CHECKSUM_CHECK_IP==0: Check checksums by hardware for incoming IP packets.*/
  #define CHECKSUM_CHECK_IP               0
  /* CHECKSUM_CHECK_UDP==0: Check checksums by hardware for incoming UDP packets.*/
  #define CHECKSUM_CHECK_UDP              0
  /* CHECKSUM_CHECK_TCP==0: Check checksums by hardware for incoming TCP packets.*/
  #define CHECKSUM_CHECK_TCP              0
  /* CHECKSUM_CHECK_ICMP==0: Check checksums by hardware for incoming ICMP packets.*/
  #define CHECKSUM_GEN_ICMP               0
#else
  /* CHECKSUM_GEN_IP==1: Generate checksums in software for outgoing IP packets.*/
  #define CHECKSUM_GEN_IP                 1
  /* CHECKSUM_GEN_UDP==1: Generate checksums in software for outgoing UDP packets.*/
  #define CHECKSUM_GEN_UDP                1
  /* CHECKSUM_GEN_TCP==1: Generate checksums in software for outgoing TCP packets.*/
  #define CHECKSUM_GEN_TCP                1
  /* CHECKSUM_CHECK_IP==1: Check checksums in software for incoming IP packets.*/
  #define CHECKSUM_CHECK_IP               1
  /* CHECKSUM_CHECK_UDP==1: Check checksums in software for incoming UDP packets.*/
  #define CHECKSUM_CHECK_UDP              1
  /* CHECKSUM_CHECK_TCP==1: Check checksums in software for incoming TCP packets.*/
  #define CHECKSUM_CHECK_TCP              1
  /* CHECKSUM_CHECK_ICMP==1: Check checksums by hardware for incoming ICMP packets.*/
  #define CHECKSUM_GEN_ICMP               1
#endif


/*
   ------------------------------------
   ---------- LOOPIF options ----------
   ------------------------------------
*/
/**
 * LWIP_HAVE_LOOPIF==1: Support loop interface (127.0.0.1) and loopif.c
 */
#define LWIP_HAVE_LOOPIF                  1


/*
   ----------------------------------------------
   ---------- Sequential layer options ----------
   ----------------------------------------------
*/
/**
 * LWIP_NETCONN==1: Enable Netconn API (require to use api_lib.c)
 */
#define LWIP_NETCONN               1
#define LWIP_SO_RCVTIMEO           1
#define LWIP_SO_SNDTIMEO           1

/*
   ------------------------------------
   ---------- Socket options ----------
   ------------------------------------
*/

/**
 * LWIP_SOCKET==1: Enable Socket API (require to use sockets.c)
 */
#define LWIP_SOCKET            1

/**
 * LWIP_TIMEVAL_PRIVATE==1: Use the struct timeval provided in sockets.h
 * Otherwise include <sys/time.h> to use the one provided by C Library.
 */
#define LWIP_TIMEVAL_PRIVATE   0

/*
LWIP_DNS
  Required for librabbitmq to build.
*/
#define LWIP_DNS                        1

/*
   -----------------------------------
   ---------- DEBUG options ----------
   -----------------------------------
*/

#if defined CONFIG_LWIP_DEBUG && CONFIG_LWIP_DEBUG && defined CONFIG_LWIP_DIAG_TO_SERIAL && CONFIG_LWIP_DIAG_TO_SERIAL

#define LWIP_PLATFORM_DIAG(x) {lTimePrintf x;}

#elif defined CONFIG_LWIP_DEBUG && CONFIG_LWIP_DEBUG && defined CONFIG_LWIP_DIAG_TO_LOG && CONFIG_LWIP_DIAG_TO_LOG

#define LWIP_PLATFORM_DIAG(x) { char * msgP = lwipPrintf x ; \
    logCoreApi( \
        __FUNCTION__, \
        __LINE__, \
        eLogLevelInterface, \
        LOG_ALL_FLAGS_ON, \
        msgP ); }

#else

#define LWIP_PLATFORM_DIAG(x) { }

#endif

/**
 * Set LWIP_DEBUG to 1
 * and uncomment *_DEBUG feature lines
 * to enable debugging.
 *
 * TBDRMS debugging is also on with LWIP_DEBUG 0
 * and the feature lines uncommented. Hmmm....
 */

#if defined CONFIG_LWIP_DEBUG && CONFIG_LWIP_DEBUG
#    define LWIP_DEBUG                      1

#define LWIP_DBG_TYPES_ON               (LWIP_DBG_ON|LWIP_DBG_TRACE|LWIP_DBG_STATE|LWIP_DBG_FRESH)

///#define LWIP_DBG_MIN_LEVEL              LWIP_DBG_LEVEL_SEVERE
#define LWIP_DEBUG_TIMERNAMES           0

//#define ETHARP_DEBUG                    LWIP_DBG_ON
//#define NETIF_DEBUG                     LWIP_DBG_ON
//#define PBUF_DEBUG                      LWIP_DBG_ON
//#define API_LIB_DEBUG                   LWIP_DBG_ON
//#define API_MSG_DEBUG                   LWIP_DBG_ON
//#define SOCKETS_DEBUG                   LWIP_DBG_ON
//#define ICMP_DEBUG                      LWIP_DBG_ON
//#define IGMP_DEBUG                      LWIP_DBG_ON
//#define INET_DEBUG                      LWIP_DBG_ON
//#define IP_DEBUG                        LWIP_DBG_ON
//#define IP_REASS_DEBUG                  LWIP_DBG_ON
//#define RAW_DEBUG                       LWIP_DBG_ON
//#define MEM_DEBUG                       LWIP_DBG_ON
//#define MEMP_DEBUG                      LWIP_DBG_ON
//#define SYS_DEBUG                       LWIP_DBG_ON
//#define TIMERS_DEBUG                    LWIP_DBG_ON
#if 0
#    if defined CONFIG_INCDNTLOG_LWIP_TCP_GENERAL_DEBUG && CONFIG_INCDNTLOG_LWIP_TCP_GENERAL_DEBUG
#        define TCP_DEBUG                       LWIP_DBG_ON
#        define TCP_INPUT_DEBUG                 LWIP_DBG_ON
#        define TCP_FR_DEBUG                    LWIP_DBG_ON
#        define TCP_RTO_DEBUG                   LWIP_DBG_ON
#        define TCP_CWND_DEBUG                  LWIP_DBG_ON
#        define TCP_WND_DEBUG                   LWIP_DBG_ON
#        define TCP_OUTPUT_DEBUG                LWIP_DBG_ON
#        define TCP_RST_DEBUG                   LWIP_DBG_ON
#        define TCP_QLEN_DEBUG                  LWIP_DBG_ON
#    endif
#elif 1
#    if defined CONFIG_INCDNTLOG_LWIP_TCP_GENERAL_DEBUG && CONFIG_INCDNTLOG_LWIP_TCP_GENERAL_DEBUG
#        define TCP_CLOSE_DEBUG LWIP_DBG_ON
#    endif
#else
#    if defined CONFIG_INCDNTLOG_LWIP_TCP_GENERAL_DEBUG && CONFIG_INCDNTLOG_LWIP_TCP_GENERAL_DEBUG
#        define IP_DEBUG                        LWIP_DBG_ON
#        define TCP_DEBUG                       LWIP_DBG_ON
#        define TCP_INPUT_DEBUG                 LWIP_DBG_ON
//#        define TCP_FR_DEBUG                    LWIP_DBG_ON
//#        define TCP_RTO_DEBUG                   LWIP_DBG_ON
//#        define TCP_CWND_DEBUG                  LWIP_DBG_ON
//#        define TCP_WND_DEBUG                   LWIP_DBG_ON
#        define TCP_OUTPUT_DEBUG                LWIP_DBG_ON
//#        define TCP_RST_DEBUG                   LWIP_DBG_ON
//#        define TCP_QLEN_DEBUG                  LWIP_DBG_ON
#define SOCKETS_DEBUG                   LWIP_DBG_ON
#define TCPIP_DEBUG                     LWIP_DBG_ON
#define MEM_DEBUG                       LWIP_DBG_ON
#define MEMP_DEBUG                      LWIP_DBG_ON
#    endif

#endif

//#define UDP_DEBUG                       LWIP_DBG_ON
//#define TCPIP_DEBUG                     LWIP_DBG_ON
//#define PPP_DEBUG                       LWIP_DBG_ON
//#define SLIP_DEBUG                      LWIP_DBG_ON
//#define DHCP_DEBUG                      LWIP_DBG_ON
//#define AUTOIP_DEBUG                    LWIP_DBG_ON
//#define SNMP_MSG_DEBUG                  LWIP_DBG_ON
//#define SNMP_MIB_DEBUG                  LWIP_DBG_ON
//#define DNS_DEBUG                       LWIP_DBG_ON

#else

#    define LWIP_DEBUG                      0

#endif
/*
   ---------------------------------
   ---------- OS options ----------
   ---------------------------------
*/

#define TCPIP_THREAD_NAME              "TCP/IP"
#define TCPIP_THREAD_STACKSIZE          800
#define TCPIP_MBOX_SIZE                 40
#define DEFAULT_UDP_RECVMBOX_SIZE       6
#define DEFAULT_TCP_RECVMBOX_SIZE       6
#define DEFAULT_ACCEPTMBOX_SIZE         6
#define DEFAULT_THREAD_STACKSIZE        500
#ifndef TCPIP_THREAD_PRIO
#define TCPIP_THREAD_PRIO               (configMAX_PRIORITIES - 2)
#endif
#define LWIP_COMPAT_MUTEX               1
/*
   ---------------------------------
   --------- HTTPD options ---------
   ---------------------------------
*/

#define LWIP_HTTPD_SSI CONFIG_FACILITY_SSI
#define LWIP_HTTPD_SSI_MULTIPART CONFIG_FACILITY_SSI
#define HTTPD_USE_CUSTOM_FSDATA CONFIG_FACILITY_HTTPD

#define LWIP_HTTPD_CGI CONFIG_FACILITY_CGI
#define LWIP_HTTPD_CUSTOM_FILES CONFIG_FACILITY_CGI
#define LWIP_HTTPD_MAX_TAG_NAME_LEN 64
#define LWIP_HTTPD_DYNAMIC_FILE_READ 1
#define LWIP_HTTPD_MAX_TAG_INSERT_LEN 192
#define LWIP_HTTPD_DYNAMIC_HEADERS 0

#define LWIP_HTTPD_SUPPORT_POST 0



#endif /* __LWIPOPTS_H__ */

_______________________________________________
lwip-users mailing list
lwip-users@...
https://lists.nongnu.org/mailman/listinfo/lwip-users

Gmane