Print this page
3903 DTrace SCTP Provider


 960         sctp_stack_t    *sctps = sctp->sctp_sctps;
 961 
 962         ASSERT(sctp->sctp_xmit_head != NULL);
 963         mp = sctp_find_fast_rexmit_mblks(sctp, &pktlen, &fp);
 964         if (mp == NULL) {
 965                 SCTP_KSTAT(sctps, sctp_fr_not_found);
 966                 return;
 967         }
 968         if ((head = sctp_add_proto_hdr(sctp, fp, mp, 0, NULL)) == NULL) {
 969                 freemsg(mp);
 970                 SCTP_KSTAT(sctps, sctp_fr_add_hdr);
 971                 return;
 972         }
 973         if ((pktlen > fp->sf_pmss) && fp->sf_isv4) {
 974                 ipha_t *iph = (ipha_t *)head->b_rptr;
 975 
 976                 iph->ipha_fragment_offset_and_flags = 0;
 977         }
 978 
 979         sctp_set_iplen(sctp, head, fp->sf_ixa);





 980         (void) conn_ip_output(head, fp->sf_ixa);
 981         BUMP_LOCAL(sctp->sctp_opkts);
 982         sctp->sctp_active = fp->sf_lastactive = ddi_get_lbolt64();
 983 }
 984 
 985 void
 986 sctp_output(sctp_t *sctp, uint_t num_pkt)
 987 {
 988         mblk_t                  *mp = NULL;
 989         mblk_t                  *nmp;
 990         mblk_t                  *head;
 991         mblk_t                  *meta = sctp->sctp_xmit_tail;
 992         mblk_t                  *fill = NULL;
 993         uint16_t                chunklen;
 994         uint32_t                cansend;
 995         int32_t                 seglen;
 996         int32_t                 xtralen;
 997         int32_t                 sacklen;
 998         int32_t                 pad = 0;
 999         int32_t                 pathmax;


1262                 }
1263                 if ((seglen > fp->sf_pmss) && fp->sf_isv4) {
1264                         ipha_t *iph = (ipha_t *)head->b_rptr;
1265 
1266                         /*
1267                          * Path MTU is different from what we thought it would
1268                          * be when we created chunks, or IP headers have grown.
1269                          * Need to clear the DF bit.
1270                          */
1271                         iph->ipha_fragment_offset_and_flags = 0;
1272                 }
1273                 /* xmit segment */
1274                 ASSERT(cansend >= seglen - pad - xtralen);
1275                 cansend -= (seglen - pad - xtralen);
1276                 dprint(2, ("sctp_output: Sending packet %d bytes, tsn %x "
1277                     "ssn %d to %p (rwnd %d, cansend %d, lastack_rxd %x)\n",
1278                     seglen - xtralen, ntohl(sdc->sdh_tsn),
1279                     ntohs(sdc->sdh_ssn), (void *)fp, sctp->sctp_frwnd,
1280                     cansend, sctp->sctp_lastack_rxd));
1281                 sctp_set_iplen(sctp, head, fp->sf_ixa);





1282                 (void) conn_ip_output(head, fp->sf_ixa);
1283                 BUMP_LOCAL(sctp->sctp_opkts);
1284                 /* arm rto timer (if not set) */
1285                 if (!fp->sf_timer_running)
1286                         SCTP_FADDR_TIMER_RESTART(sctp, fp, fp->sf_rto);
1287                 notsent = B_FALSE;
1288         }
1289         sctp->sctp_active = now;
1290         return;
1291 unsent_data:
1292         /* arm persist timer (if rto timer not set) */
1293         if (!fp->sf_timer_running)
1294                 SCTP_FADDR_TIMER_RESTART(sctp, fp, fp->sf_rto);
1295         if (head != NULL)
1296                 freemsg(head);
1297 }
1298 
1299 /*
1300  * The following two functions initialize and destroy the cache
1301  * associated with the sets used for PR-SCTP.


1786 
1787         /*
1788          * If we were probing for zero window, don't adjust retransmission
1789          * variables, but the timer is still backed off.
1790          */
1791         if (sctp->sctp_zero_win_probe) {
1792                 mblk_t  *pkt;
1793                 uint_t  pkt_len;
1794 
1795                 /*
1796                  * Get the Zero Win Probe for retrasmission, sctp_rxt_nxttsn
1797                  * and sctp_rxt_maxtsn will specify the ZWP packet.
1798                  */
1799                 fp = oldfp;
1800                 if (oldfp->sf_state != SCTP_FADDRS_ALIVE)
1801                         fp = sctp_rotate_faddr(sctp, oldfp);
1802                 pkt = sctp_rexmit_packet(sctp, &meta, &mp, fp, &pkt_len);
1803                 if (pkt != NULL) {
1804                         ASSERT(pkt_len <= fp->sf_pmss);
1805                         sctp_set_iplen(sctp, pkt, fp->sf_ixa);






1806                         (void) conn_ip_output(pkt, fp->sf_ixa);
1807                         BUMP_LOCAL(sctp->sctp_opkts);
1808                 } else {
1809                         SCTP_KSTAT(sctps, sctp_ss_rexmit_failed);
1810                 }
1811 
1812                 /*
1813                  * The strikes will be clear by sctp_faddr_alive() when the
1814                  * other side sends us an ack.
1815                  */
1816                 oldfp->sf_strikes++;
1817                 sctp->sctp_strikes++;
1818 
1819                 SCTP_CALC_RXT(sctp, oldfp, sctp->sctp_rto_max);
1820                 if (oldfp != fp && oldfp->sf_suna != 0)
1821                         SCTP_FADDR_TIMER_RESTART(sctp, oldfp, fp->sf_rto);
1822                 SCTP_FADDR_TIMER_RESTART(sctp, fp, fp->sf_rto);
1823                 SCTPS_BUMP_MIB(sctps, sctpOutWinProbe);
1824                 return;
1825         }


2006                 ipha_t *iph = (ipha_t *)head->b_rptr;
2007 
2008                 /*
2009                  * Path MTU is different from path we thought it would
2010                  * be when we created chunks, or IP headers have grown.
2011                  * Need to clear the DF bit.
2012                  */
2013                 iph->ipha_fragment_offset_and_flags = 0;
2014         }
2015         fp->sf_rxt_unacked += seglen;
2016 
2017         dprint(2, ("sctp_rexmit: Sending packet %d bytes, tsn %x "
2018             "ssn %d to %p (rwnd %d, lastack_rxd %x)\n",
2019             seglen, ntohl(sdc->sdh_tsn), ntohs(sdc->sdh_ssn),
2020             (void *)fp, sctp->sctp_frwnd, sctp->sctp_lastack_rxd));
2021 
2022         sctp->sctp_rexmitting = B_TRUE;
2023         sctp->sctp_rxt_nxttsn = first_ua_tsn;
2024         sctp->sctp_rxt_maxtsn = sctp->sctp_ltsn - 1;
2025         sctp_set_iplen(sctp, head, fp->sf_ixa);





2026         (void) conn_ip_output(head, fp->sf_ixa);
2027         BUMP_LOCAL(sctp->sctp_opkts);
2028 
2029         /*
2030          * Restart the oldfp timer with exponential backoff and
2031          * the new fp timer for the retransmitted chunks.
2032          */
2033 restart_timer:
2034         oldfp->sf_strikes++;
2035         sctp->sctp_strikes++;
2036         SCTP_CALC_RXT(sctp, oldfp, sctp->sctp_rto_max);
2037         /*
2038          * If there is still some data in the oldfp, restart the
2039          * retransmission timer.  If there is no data, the heartbeat will
2040          * continue to run so it will do its job in checking the reachability
2041          * of the oldfp.
2042          */
2043         if (oldfp != fp && oldfp->sf_suna != 0)
2044                 SCTP_FADDR_TIMER_RESTART(sctp, oldfp, oldfp->sf_rto);
2045 


2290 
2291 found_msg:
2292         if (!fp->sf_timer_running)
2293                 SCTP_FADDR_TIMER_RESTART(sctp, fp, fp->sf_rto);
2294         pkt = sctp_rexmit_packet(sctp, &meta, &mp, fp, &pkt_len);
2295         if (pkt == NULL) {
2296                 SCTP_KSTAT(sctps, sctp_ss_rexmit_failed);
2297                 return;
2298         }
2299         if ((pkt_len > fp->sf_pmss) && fp->sf_isv4) {
2300                 ipha_t  *iph = (ipha_t *)pkt->b_rptr;
2301 
2302                 /*
2303                  * Path MTU is different from path we thought it would
2304                  * be when we created chunks, or IP headers have grown.
2305                  *  Need to clear the DF bit.
2306                  */
2307                 iph->ipha_fragment_offset_and_flags = 0;
2308         }
2309         sctp_set_iplen(sctp, pkt, fp->sf_ixa);





2310         (void) conn_ip_output(pkt, fp->sf_ixa);
2311         BUMP_LOCAL(sctp->sctp_opkts);
2312 
2313         /* Check and see if there is more chunk to be retransmitted. */
2314         if (tot_wnd <= pkt_len || tot_wnd - pkt_len < fp->sf_pmss ||
2315             meta == NULL)
2316                 return;
2317         if (mp == NULL)
2318                 meta = meta->b_next;
2319         if (meta == NULL)
2320                 return;
2321 
2322         /* Retransmit another packet if the window allows. */
2323         for (tot_wnd -= pkt_len, burst = sctps->sctps_maxburst - 1;
2324             meta != NULL && burst > 0; meta = meta->b_next, burst--) {
2325                 if (mp == NULL)
2326                         mp = meta->b_cont;
2327                 for (; mp != NULL; mp = mp->b_next) {
2328                         /* Again, this may not be possible */
2329                         if (!SCTP_CHUNK_ISSENT(mp))


 960         sctp_stack_t    *sctps = sctp->sctp_sctps;
 961 
 962         ASSERT(sctp->sctp_xmit_head != NULL);
 963         mp = sctp_find_fast_rexmit_mblks(sctp, &pktlen, &fp);
 964         if (mp == NULL) {
 965                 SCTP_KSTAT(sctps, sctp_fr_not_found);
 966                 return;
 967         }
 968         if ((head = sctp_add_proto_hdr(sctp, fp, mp, 0, NULL)) == NULL) {
 969                 freemsg(mp);
 970                 SCTP_KSTAT(sctps, sctp_fr_add_hdr);
 971                 return;
 972         }
 973         if ((pktlen > fp->sf_pmss) && fp->sf_isv4) {
 974                 ipha_t *iph = (ipha_t *)head->b_rptr;
 975 
 976                 iph->ipha_fragment_offset_and_flags = 0;
 977         }
 978 
 979         sctp_set_iplen(sctp, head, fp->sf_ixa);
 980 
 981         DTRACE_SCTP5(send, mblk_t *, NULL, ip_xmit_attr_t *, fp->sf_ixa,
 982             void_ip_t *, mp->b_rptr, sctp_t *, sctp, sctp_hdr_t *,
 983             &mp->b_rptr[fp->sf_ixa->ixa_ip_hdr_length]);
 984 
 985         (void) conn_ip_output(head, fp->sf_ixa);
 986         BUMP_LOCAL(sctp->sctp_opkts);
 987         sctp->sctp_active = fp->sf_lastactive = ddi_get_lbolt64();
 988 }
 989 
 990 void
 991 sctp_output(sctp_t *sctp, uint_t num_pkt)
 992 {
 993         mblk_t                  *mp = NULL;
 994         mblk_t                  *nmp;
 995         mblk_t                  *head;
 996         mblk_t                  *meta = sctp->sctp_xmit_tail;
 997         mblk_t                  *fill = NULL;
 998         uint16_t                chunklen;
 999         uint32_t                cansend;
1000         int32_t                 seglen;
1001         int32_t                 xtralen;
1002         int32_t                 sacklen;
1003         int32_t                 pad = 0;
1004         int32_t                 pathmax;


1267                 }
1268                 if ((seglen > fp->sf_pmss) && fp->sf_isv4) {
1269                         ipha_t *iph = (ipha_t *)head->b_rptr;
1270 
1271                         /*
1272                          * Path MTU is different from what we thought it would
1273                          * be when we created chunks, or IP headers have grown.
1274                          * Need to clear the DF bit.
1275                          */
1276                         iph->ipha_fragment_offset_and_flags = 0;
1277                 }
1278                 /* xmit segment */
1279                 ASSERT(cansend >= seglen - pad - xtralen);
1280                 cansend -= (seglen - pad - xtralen);
1281                 dprint(2, ("sctp_output: Sending packet %d bytes, tsn %x "
1282                     "ssn %d to %p (rwnd %d, cansend %d, lastack_rxd %x)\n",
1283                     seglen - xtralen, ntohl(sdc->sdh_tsn),
1284                     ntohs(sdc->sdh_ssn), (void *)fp, sctp->sctp_frwnd,
1285                     cansend, sctp->sctp_lastack_rxd));
1286                 sctp_set_iplen(sctp, head, fp->sf_ixa);
1287 
1288                 DTRACE_SCTP5(send, mblk_t *, NULL, ip_xmit_attr_t *, fp->sf_ixa,
1289                     void_ip_t *, head->b_rptr, sctp_t *, sctp, sctp_hdr_t *,
1290                     &head->b_rptr[fp->sf_ixa->ixa_ip_hdr_length]);
1291 
1292                 (void) conn_ip_output(head, fp->sf_ixa);
1293                 BUMP_LOCAL(sctp->sctp_opkts);
1294                 /* arm rto timer (if not set) */
1295                 if (!fp->sf_timer_running)
1296                         SCTP_FADDR_TIMER_RESTART(sctp, fp, fp->sf_rto);
1297                 notsent = B_FALSE;
1298         }
1299         sctp->sctp_active = now;
1300         return;
1301 unsent_data:
1302         /* arm persist timer (if rto timer not set) */
1303         if (!fp->sf_timer_running)
1304                 SCTP_FADDR_TIMER_RESTART(sctp, fp, fp->sf_rto);
1305         if (head != NULL)
1306                 freemsg(head);
1307 }
1308 
1309 /*
1310  * The following two functions initialize and destroy the cache
1311  * associated with the sets used for PR-SCTP.


1796 
1797         /*
1798          * If we were probing for zero window, don't adjust retransmission
1799          * variables, but the timer is still backed off.
1800          */
1801         if (sctp->sctp_zero_win_probe) {
1802                 mblk_t  *pkt;
1803                 uint_t  pkt_len;
1804 
1805                 /*
1806                  * Get the Zero Win Probe for retrasmission, sctp_rxt_nxttsn
1807                  * and sctp_rxt_maxtsn will specify the ZWP packet.
1808                  */
1809                 fp = oldfp;
1810                 if (oldfp->sf_state != SCTP_FADDRS_ALIVE)
1811                         fp = sctp_rotate_faddr(sctp, oldfp);
1812                 pkt = sctp_rexmit_packet(sctp, &meta, &mp, fp, &pkt_len);
1813                 if (pkt != NULL) {
1814                         ASSERT(pkt_len <= fp->sf_pmss);
1815                         sctp_set_iplen(sctp, pkt, fp->sf_ixa);
1816 
1817                         DTRACE_SCTP5(send, mblk_t *, NULL,
1818                             ip_xmit_attr_t *, fp->sf_ixa,
1819                             void_ip_t *, mp->b_rptr, sctp_t *, sctp, sctp_hdr_t *,
1820                             &mp->b_rptr[fp->sf_ixa->ixa_ip_hdr_length]);
1821 
1822                         (void) conn_ip_output(pkt, fp->sf_ixa);
1823                         BUMP_LOCAL(sctp->sctp_opkts);
1824                 } else {
1825                         SCTP_KSTAT(sctps, sctp_ss_rexmit_failed);
1826                 }
1827 
1828                 /*
1829                  * The strikes will be clear by sctp_faddr_alive() when the
1830                  * other side sends us an ack.
1831                  */
1832                 oldfp->sf_strikes++;
1833                 sctp->sctp_strikes++;
1834 
1835                 SCTP_CALC_RXT(sctp, oldfp, sctp->sctp_rto_max);
1836                 if (oldfp != fp && oldfp->sf_suna != 0)
1837                         SCTP_FADDR_TIMER_RESTART(sctp, oldfp, fp->sf_rto);
1838                 SCTP_FADDR_TIMER_RESTART(sctp, fp, fp->sf_rto);
1839                 SCTPS_BUMP_MIB(sctps, sctpOutWinProbe);
1840                 return;
1841         }


2022                 ipha_t *iph = (ipha_t *)head->b_rptr;
2023 
2024                 /*
2025                  * Path MTU is different from path we thought it would
2026                  * be when we created chunks, or IP headers have grown.
2027                  * Need to clear the DF bit.
2028                  */
2029                 iph->ipha_fragment_offset_and_flags = 0;
2030         }
2031         fp->sf_rxt_unacked += seglen;
2032 
2033         dprint(2, ("sctp_rexmit: Sending packet %d bytes, tsn %x "
2034             "ssn %d to %p (rwnd %d, lastack_rxd %x)\n",
2035             seglen, ntohl(sdc->sdh_tsn), ntohs(sdc->sdh_ssn),
2036             (void *)fp, sctp->sctp_frwnd, sctp->sctp_lastack_rxd));
2037 
2038         sctp->sctp_rexmitting = B_TRUE;
2039         sctp->sctp_rxt_nxttsn = first_ua_tsn;
2040         sctp->sctp_rxt_maxtsn = sctp->sctp_ltsn - 1;
2041         sctp_set_iplen(sctp, head, fp->sf_ixa);
2042 
2043         DTRACE_SCTP5(send, mblk_t *, NULL, ip_xmit_attr_t *, fp->sf_ixa,
2044             void_ip_t *, mp->b_rptr, sctp_t *, sctp, sctp_hdr_t *,
2045             &mp->b_rptr[fp->sf_ixa->ixa_ip_hdr_length]);
2046 
2047         (void) conn_ip_output(head, fp->sf_ixa);
2048         BUMP_LOCAL(sctp->sctp_opkts);
2049 
2050         /*
2051          * Restart the oldfp timer with exponential backoff and
2052          * the new fp timer for the retransmitted chunks.
2053          */
2054 restart_timer:
2055         oldfp->sf_strikes++;
2056         sctp->sctp_strikes++;
2057         SCTP_CALC_RXT(sctp, oldfp, sctp->sctp_rto_max);
2058         /*
2059          * If there is still some data in the oldfp, restart the
2060          * retransmission timer.  If there is no data, the heartbeat will
2061          * continue to run so it will do its job in checking the reachability
2062          * of the oldfp.
2063          */
2064         if (oldfp != fp && oldfp->sf_suna != 0)
2065                 SCTP_FADDR_TIMER_RESTART(sctp, oldfp, oldfp->sf_rto);
2066 


2311 
2312 found_msg:
2313         if (!fp->sf_timer_running)
2314                 SCTP_FADDR_TIMER_RESTART(sctp, fp, fp->sf_rto);
2315         pkt = sctp_rexmit_packet(sctp, &meta, &mp, fp, &pkt_len);
2316         if (pkt == NULL) {
2317                 SCTP_KSTAT(sctps, sctp_ss_rexmit_failed);
2318                 return;
2319         }
2320         if ((pkt_len > fp->sf_pmss) && fp->sf_isv4) {
2321                 ipha_t  *iph = (ipha_t *)pkt->b_rptr;
2322 
2323                 /*
2324                  * Path MTU is different from path we thought it would
2325                  * be when we created chunks, or IP headers have grown.
2326                  *  Need to clear the DF bit.
2327                  */
2328                 iph->ipha_fragment_offset_and_flags = 0;
2329         }
2330         sctp_set_iplen(sctp, pkt, fp->sf_ixa);
2331 
2332         DTRACE_SCTP5(send, mblk_t *, NULL, ip_xmit_attr_t *, fp->sf_ixa,
2333             void_ip_t *, mp->b_rptr, sctp_t *, sctp, sctp_hdr_t *,
2334             &mp->b_rptr[fp->sf_ixa->ixa_ip_hdr_length]);
2335 
2336         (void) conn_ip_output(pkt, fp->sf_ixa);
2337         BUMP_LOCAL(sctp->sctp_opkts);
2338 
2339         /* Check and see if there is more chunk to be retransmitted. */
2340         if (tot_wnd <= pkt_len || tot_wnd - pkt_len < fp->sf_pmss ||
2341             meta == NULL)
2342                 return;
2343         if (mp == NULL)
2344                 meta = meta->b_next;
2345         if (meta == NULL)
2346                 return;
2347 
2348         /* Retransmit another packet if the window allows. */
2349         for (tot_wnd -= pkt_len, burst = sctps->sctps_maxburst - 1;
2350             meta != NULL && burst > 0; meta = meta->b_next, burst--) {
2351                 if (mp == NULL)
2352                         mp = meta->b_cont;
2353                 for (; mp != NULL; mp = mp->b_next) {
2354                         /* Again, this may not be possible */
2355                         if (!SCTP_CHUNK_ISSENT(mp))