|
|
| version 1.14, 2004/03/08 19:44:32 | version 1.15, 2004/03/14 07:57:26 |
|---|---|
| Line 785 tcp_close(tp) | Line 785 tcp_close(tp) |
| return ((struct tcpcb *)0); | return ((struct tcpcb *)0); |
| } | } |
| void | #ifdef SMP |
| tcp_drain() | struct netmsg_tcp_drain { |
| struct lwkt_msg nm_lmsg; | |
| netisr_fn_t nm_handler; | |
| struct inpcbhead *nm_head; | |
| }; | |
| static int /* really should be void XXX JH */ | |
| tcp_drain_handler(struct netmsg *msg0) | |
| { | |
| struct netmsg_tcp_drain *nm = (struct netmsg_tcp_drain *)msg0; | |
| tcp_drain_oncpu(nm->nm_head); | |
| return (0); /* dummy return value */ | |
| } | |
| #endif | |
| static __inline void | |
| tcp_drain_oncpu(struct inpcbhead *head) | |
| { | { |
| struct inpcb *inpb; | struct inpcb *inpb; |
| struct tcpcb *tcpb; | struct tcpcb *tcpb; |
| struct tseg_qent *te; | struct tseg_qent *te; |
| LIST_FOREACH(inpb, head, inp_list) { | |
| if ((tcpb = intotcpcb(inpb))) { | |
| while ((te = LIST_FIRST(&tcpb->t_segq)) != NULL) { | |
| LIST_REMOVE(te, tqe_q); | |
| m_freem(te->tqe_m); | |
| FREE(te, M_TSEGQ); | |
| tcp_reass_qsize--; | |
| } | |
| } | |
| } | |
| } | |
| void | |
| tcp_drain() | |
| { | |
| int cpu; | int cpu; |
| if (!do_tcpdrain) | if (!do_tcpdrain) |
| Line 804 tcp_drain() | Line 838 tcp_drain() |
| * where we're really low on mbufs, this is potentially | * where we're really low on mbufs, this is potentially |
| * usefull. | * usefull. |
| */ | */ |
| #ifdef SMP | |
| for (cpu = 0; cpu < ncpus2; cpu++) { | for (cpu = 0; cpu < ncpus2; cpu++) { |
| LIST_FOREACH(inpb, &tcbinfo[cpu].listhead, inp_list) { | struct netmsg_tcp_drain *msg; |
| if ((tcpb = intotcpcb(inpb))) { | |
| while ((te = LIST_FIRST(&tcpb->t_segq)) | if (cpu == mycpu->gd_cupid) { |
| != NULL) { | tcp_drain_oncpu(&tcbinfo[cpu].listhead); |
| LIST_REMOVE(te, tqe_q); | } else { |
| m_freem(te->tqe_m); | msg = malloc(sizeof(struct netmsg_tcp_drain), |
| FREE(te, M_TSEGQ); | M_LWKTMSG, M_NOWAIT); |
| tcp_reass_qsize--; | if (!msg) |
| } | continue; |
| } | lwkt_initmsg_rp(&msg->nm_lmsg, netisr_afree_rport, |
| CMD_NETMSG_TCP_DRAIN); | |
| msg->nm_handler = tcp_drain_handler; | |
| msg->nm_head = &tcbinfo[cpu].listhead; | |
| lwkt_sendmsg(tcp_cport(cpu), &msg->nm_lmsg); | |
| } | } |
| } | } |
| #else | |
| tcp_drain_oncpu(&tcbinfo[0].listhead); | |
| #endif | |
| } | } |
| /* | /* |