mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-01-14 18:36:27 +00:00
ip_input: check if a packet is for inp first before checking all other netifs on netif_list (speeds up packet receiving in most cases)
This commit is contained in:
parent
a72e4a406f
commit
f3f7bd00e5
@ -19,6 +19,10 @@ HISTORY
|
|||||||
|
|
||||||
++ New features:
|
++ New features:
|
||||||
|
|
||||||
|
2007-12-03 Simon Goldschmidt
|
||||||
|
* ip.c: ip_input: check if a packet is for inp first before checking all other
|
||||||
|
netifs on netif_list (speeds up packet receiving in most cases)
|
||||||
|
|
||||||
2007-11-30 Simon Goldschmidt
|
2007-11-30 Simon Goldschmidt
|
||||||
* udp.c, raw.c: task #7497: Sort lists (pcb, netif, ...) for faster access
|
* udp.c, raw.c: task #7497: Sort lists (pcb, netif, ...) for faster access
|
||||||
UDP: move a (connected) pcb selected for input to the front of the list of
|
UDP: move a (connected) pcb selected for input to the front of the list of
|
||||||
|
@ -239,7 +239,12 @@ ip_input(struct pbuf *p, struct netif *inp)
|
|||||||
} else
|
} else
|
||||||
#endif /* LWIP_IGMP */
|
#endif /* LWIP_IGMP */
|
||||||
{
|
{
|
||||||
for (netif = netif_list; netif != NULL; netif = netif->next) {
|
/* start trying with inp. if that's not acceptable, start walking the
|
||||||
|
list of configured netifs.
|
||||||
|
'first' is used as a boolean to mark whether we started walking the list */
|
||||||
|
int first = 1;
|
||||||
|
netif = inp;
|
||||||
|
do {
|
||||||
LWIP_DEBUGF(IP_DEBUG, ("ip_input: iphdr->dest 0x%"X32_F" netif->ip_addr 0x%"X32_F" (0x%"X32_F", 0x%"X32_F", 0x%"X32_F")\n",
|
LWIP_DEBUGF(IP_DEBUG, ("ip_input: iphdr->dest 0x%"X32_F" netif->ip_addr 0x%"X32_F" (0x%"X32_F", 0x%"X32_F", 0x%"X32_F")\n",
|
||||||
iphdr->dest.addr, netif->ip_addr.addr,
|
iphdr->dest.addr, netif->ip_addr.addr,
|
||||||
iphdr->dest.addr & netif->netmask.addr,
|
iphdr->dest.addr & netif->netmask.addr,
|
||||||
@ -258,7 +263,16 @@ ip_input(struct pbuf *p, struct netif *inp)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
if (first) {
|
||||||
|
first = 0;
|
||||||
|
netif = netif_list;
|
||||||
|
} else {
|
||||||
|
netif = netif->next;
|
||||||
|
}
|
||||||
|
if (netif == inp) {
|
||||||
|
netif = netif->next;
|
||||||
|
}
|
||||||
|
} while(netif != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if LWIP_DHCP
|
#if LWIP_DHCP
|
||||||
|
Loading…
Reference in New Issue
Block a user