Changed loopback code (less difference between NO_SYS = 0 / 1), added setting LWIP_LOOPBACK_MAX_PBUFS to limit loopback-queued pbufs

This commit is contained in:
goldsimon
2008-06-17 19:39:22 +00:00
parent a8141c53a8
commit eba83ab740
5 changed files with 75 additions and 40 deletions

View File

@@ -167,11 +167,15 @@ struct netif {
#if LWIP_NETIF_HWADDRHINT
u8_t *addr_hint;
#endif /* LWIP_NETIF_HWADDRHINT */
#if ENABLE_LOOPBACK && !LWIP_NETIF_LOOPBACK_MULTITHREADING
#if ENABLE_LOOPBACK
/* List of packets to be queued for ourselves. */
struct pbuf *loop_first;
struct pbuf *loop_last;
#endif /* ENABLE_LOOPBACK && !LWIP_NETIF_LOOPBACK_MULTITHREADING */
#if LWIP_LOOPBACK_MAX_PBUFS
u16_t loop_cnt_max;
u16_t loop_cnt_current;
#endif /* LWIP_LOOPBACK_MAX_PBUFS */
#endif /* ENABLE_LOOPBACK */
};
#if LWIP_SNMP
@@ -251,9 +255,9 @@ void netif_set_link_callback(struct netif *netif, void (* link_callback)(struct
#if ENABLE_LOOPBACK
err_t netif_loop_output(struct netif *netif, struct pbuf *p, struct ip_addr *dest_ip);
void netif_poll(struct netif *netif);
#if !LWIP_NETIF_LOOPBACK_MULTITHREADING
void netif_poll_all(void);
void netif_poll(struct netif *netif);
#endif /* !LWIP_NETIF_LOOPBACK_MULTITHREADING */
#endif /* ENABLE_LOOPBACK */

View File

@@ -840,6 +840,14 @@
#define LWIP_NETIF_LOOPBACK 0
#endif
/**
* LWIP_LOOPBACK_MAX_PBUFS: Maximum number of pbufs on queue for loopback
* sending for each netif (0 = disabled)
*/
#ifndef LWIP_LOOPBACK_MAX_PBUFS
#define LWIP_LOOPBACK_MAX_PBUFS 0
#endif
/**
* LWIP_NETIF_LOOPBACK_MULTITHREADING: Indicates whether threading is enabled in
* the system, as netifs must change how they behave depending on this setting