Author: rrs
Date: Fri Jan 28 20:49:15 2011
New Revision: 218037
URL: http://svn.freebsd.org/changeset/base/218037

Log:
  Fix a bug in the way ECN-Echo chunk
  sends were being accounted for. The
  counting was such that we counted only
  when we queued a chunk, not when we sent it.
  Now keep an additional counter for queuing and
  one for sending.
  
  MFC after:    1 week

Modified:
  head/sys/netinet/sctp_output.c
  head/sys/netinet/sctp_uio.h

Modified: head/sys/netinet/sctp_output.c
==============================================================================
--- head/sys/netinet/sctp_output.c      Fri Jan 28 20:22:03 2011        
(r218036)
+++ head/sys/netinet/sctp_output.c      Fri Jan 28 20:49:15 2011        
(r218037)
@@ -7809,6 +7809,20 @@ again_one_more_time:
                                        if (chk->rec.chunk_id.id == 
SCTP_COOKIE_ECHO) {
                                                cookie = 1;
                                                no_out_cnt = 1;
+                                       } else if (chk->rec.chunk_id.id == 
SCTP_ECN_ECHO) {
+                                               /*
+                                                * Increment ecne send count
+                                                * here this means we may be
+                                                * over-zealous in our
+                                                * counting if the send
+                                                * fails, but its the best
+                                                * place to do it (we used
+                                                * to do it in the queue of
+                                                * the chunk, but that did
+                                                * not tell how many times
+                                                * it was sent.
+                                                */
+                                               SCTP_STAT_INCR(sctps_sendecne);
                                        }
                                        chk->sent = SCTP_DATAGRAM_SENT;
                                        chk->snd_count++;
@@ -10751,6 +10765,7 @@ sctp_send_ecn_echo(struct sctp_tcb *stcb
                        /* found a previous ECN_ECHO update it if needed */
                        ecne = mtod(chk->data, struct sctp_ecne_chunk *);
                        ecne->tsn = htonl(high_tsn);
+                       SCTP_STAT_INCR(sctps_queue_upd_ecne);
                        return;
                }
        }
@@ -10760,7 +10775,7 @@ sctp_send_ecn_echo(struct sctp_tcb *stcb
                return;
        }
        chk->copy_by_ref = 0;
-       SCTP_STAT_INCR(sctps_sendecne);
+       SCTP_STAT_INCR(sctps_queue_upd_ecne);
        chk->rec.chunk_id.id = SCTP_ECN_ECHO;
        chk->rec.chunk_id.can_take_data = 0;
        chk->asoc = &stcb->asoc;

Modified: head/sys/netinet/sctp_uio.h
==============================================================================
--- head/sys/netinet/sctp_uio.h Fri Jan 28 20:22:03 2011        (r218036)
+++ head/sys/netinet/sctp_uio.h Fri Jan 28 20:49:15 2011        (r218037)
@@ -946,8 +946,9 @@ struct sctpstat {
                                         * max burst inflight to net */
        uint32_t sctps_fwdtsn_map_over; /* number of map array over-runs via
                                         * fwd-tsn's */
-
-       uint32_t sctps_reserved[32];    /* Future ABI compat - remove int's
+       uint32_t sctps_queue_upd_ecne;  /* Number of times we queued or
+                                        * updated an ECN chunk on send queue */
+       uint32_t sctps_reserved[31];    /* Future ABI compat - remove int's
                                         * from here when adding new */
 };
 
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to