Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F157330690
D42949.id131115.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D42949.id131115.diff
View Options
diff --git a/sys/netinet/siftr.c b/sys/netinet/siftr.c
--- a/sys/netinet/siftr.c
+++ b/sys/netinet/siftr.c
@@ -445,10 +445,10 @@
{
STAILQ_HEAD(pkthead, pkt_node) tmp_pkt_queue =
STAILQ_HEAD_INITIALIZER(tmp_pkt_queue);
- struct pkt_node *pkt_node, *pkt_node_temp;
+ struct pkt_node *pkt_node;
uint8_t draining;
struct ale *log_buf;
- int ret_sz, cnt;
+ int ret_sz, cnt = 0;
char *bufp;
draining = 2;
@@ -485,17 +485,11 @@
*/
mtx_unlock(&siftr_pkt_mgr_mtx);
-try_again:
- pkt_node = STAILQ_FIRST(&tmp_pkt_queue);
- if (pkt_node != NULL) {
- if (STAILQ_NEXT(pkt_node, nodes) != NULL) {
- cnt = 3;
- } else {
- cnt = 1;
- }
+ while ((pkt_node = STAILQ_FIRST(&tmp_pkt_queue)) != NULL) {
- log_buf = alq_getn(siftr_alq, MAX_LOG_MSG_LEN * cnt,
- ALQ_WAITOK);
+ log_buf = alq_getn(siftr_alq, MAX_LOG_MSG_LEN *
+ ((STAILQ_NEXT(pkt_node, nodes) != NULL) ? 3 : 1),
+ ALQ_WAITOK);
if (log_buf != NULL) {
log_buf->ae_bytesused = 0;
@@ -509,27 +503,24 @@
}
/* Flush all pkt_nodes to the log file. */
- STAILQ_FOREACH_SAFE(pkt_node, &tmp_pkt_queue, nodes,
- pkt_node_temp) {
+ STAILQ_FOREACH(pkt_node, &tmp_pkt_queue, nodes) {
if (log_buf != NULL) {
ret_sz = siftr_process_pkt(pkt_node,
bufp);
bufp += ret_sz;
log_buf->ae_bytesused += ret_sz;
- cnt--;
- }
-
- STAILQ_REMOVE_HEAD(&tmp_pkt_queue, nodes);
- free(pkt_node, M_SIFTR_PKTNODE);
-
- if (cnt <= 0 && !STAILQ_EMPTY(&tmp_pkt_queue)) {
- alq_post_flags(siftr_alq, log_buf, 0);
- goto try_again;
}
+ if (++cnt >= 3)
+ break;
}
if (log_buf != NULL) {
alq_post_flags(siftr_alq, log_buf, 0);
}
+ for (;cnt > 0; cnt--) {
+ pkt_node = STAILQ_FIRST(&tmp_pkt_queue);
+ STAILQ_REMOVE_HEAD(&tmp_pkt_queue, nodes);
+ free(pkt_node, M_SIFTR_PKTNODE);
+ }
}
KASSERT(STAILQ_EMPTY(&tmp_pkt_queue),
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, May 21, 9:36 AM (10 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33384628
Default Alt Text
D42949.id131115.diff (1 KB)
Attached To
Mode
D42949: siftr: refactor batch log processing
Attached
Detach File
Event Timeline
Log In to Comment