[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-devel] [bug #26132] Packet processing optimization using static me
From: |
Zhenwei Chu |
Subject: |
[lwip-devel] [bug #26132] Packet processing optimization using static message |
Date: |
Thu, 09 Apr 2009 13:59:19 +0000 |
User-agent: |
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; GTB5; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.2; OfficeLiveConnector.1.3; OfficeLivePatch.0.0) |
URL:
<http://savannah.nongnu.org/bugs/?26132>
Summary: Packet processing optimization using static message
Project: lwIP - A Lightweight TCP/IP stack
Submitted by: blackfin
Submitted on: Thu 09 Apr 2009 01:59:17 PM GMT
Category: None
Severity: 3 - Normal
Item Group: Change Request
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
Planned Release:
lwIP version: 1.3.0
_______________________________________________________
Details:
Packet processing optimization using static message (one for rx and one for
tx) from low level interrupt routine to the upper level lwip layers. As these
messages are marked with static flag they will never get destroyed (associated
semaphore will never get destroyed).
Description:
An additional field flag has been added in the tcpip_msg structure. If the
flag is marked as TCPIP_MSG_FLAG_STATIC then the message will not be freed.
During lwIP initialization two static messages were created one for Rx and one
for Tx. Both of these messages have the following values set
Message type: TCPIP_MSG_CALLBACK
Message flag: TCPIP_MSG_FLAG_STATIC
Handler(s): process_rcvd_packets (for rx message)
process_xmtd_packets (for tx message)
In case of reception the low level ISR queues up the packets and posts the rx
message. tcpip_thread upon receiving the message processes the packets by
invoking rx_processing_handler. If the queue is not empty then low level
layer will not post the message again but simply appends to the list.
Appropriate protection is adopted whilst manipulating the queue.
Similarly in case of transmit complete the buffer is returned back to the
lwip layer and tx_processing_handler is called to return back the buffer.
Some operating systems has special API to post semaphores from ISR domain so
we added sys_mbox_ISR_post() API to distinguish between ISR post’s to thread
level post’s.
Files changed:
lwipincludetcpip.h line 104
lwipapitcpip.c line 233,428
Changes:
lwipincludetcpip.h line 110
From:
struct tcpip_msg {
enum tcpip_msg_type type;
sys_sem_t *sem;
union {
…};
To:
enum tcpip_msg_flags {
TCPIP_MSG_FLAG_STATIC = 1 // msg area is in static storage, not memp
};
struct tcpip_msg {
enum tcpip_msg_type type;
u32_t flags;
union {
…};
tcpip.c
line 233:
From:
tcpip_thread(void *arg):
default:
break;
}
memp_free(MEMP_TCPIP_MSG, msg);
To:
tcpip_thread(void *arg):
default:
break;
}
if ((msg->flags & TCPIP_MSG_FLAG_STATIC) == 0)
memp_free(MEMP_TCPIP_MSG, msg);
From:
tcpip_input(struct pbuf *p, struct netif *inp) line 331:
msg->type = TCPIP_MSG_INPUT;
msg->msg.inp.p = p;
To:
tcpip_input(struct pbuf *p, struct netif *inp) line 331:
msg->type = TCPIP_MSG_INPUT;
msg->flags = 0;
msg->msg.inp.p = p;
From:
tcpip_callback(void (*f)(void *ctx), void *ctx) line 368:
msg->type = TCPIP_MSG_CALLBACK;
msg->msg.cb.f = f;
To:
tcpip_callback(void (*f)(void *ctx), void *ctx) line 368:
msg->type = TCPIP_MSG_CALLBACK;
msg->flags = 0;
msg->msg.cb.f = f;
From:
tcpip_apimsg(struct api_msg *apimsg) line 428:
msg->msg.apimsg = apimsg;
sys_mbox_post(mbox, msg);
}
To:
tcpip_apimsg(struct api_msg *apimsg) line 428:
msg->flags = 0;
msg->msg.apimsg = apimsg;
sys_mbox_post(mbox, msg);
}
_______________________________________________________
Reply to this item at:
<http://savannah.nongnu.org/bugs/?26132>
_______________________________________________
Message sent via/by Savannah
http://savannah.nongnu.org/
- [lwip-devel] [bug #26132] Packet processing optimization using static message,
Zhenwei Chu <=