svn commit: r295739 - in head/sys: netinet sys

Sepherosa Ziehau sephe at freebsd.org
Thu Feb 18 07:47:21 UTC 2016


Sorry about the MFC note in the commit message.  This commit will
_not_ be MFCed.

Thanks,
sephe

On Thu, Feb 18, 2016 at 12:58 PM, Sepherosa Ziehau <sephe at freebsd.org> wrote:
> Author: sephe
> Date: Thu Feb 18 04:58:34 2016
> New Revision: 295739
> URL: https://svnweb.freebsd.org/changeset/base/295739
>
> Log:
>   tcp/lro: Allow drivers to set the TCP ACK/data segment aggregation limit
>
>   ACK aggregation limit is append count based, while the TCP data segment
>   aggregation limit is length based.  Unless the network driver sets these
>   two limits, it's an NO-OP.
>
>   Reviewed by:  adrian, gallatin (previous version), hselasky (previous version)
>   Approved by:  adrian (mentor)
>   MFC after:    1 week
>   Sponsored by: Microsoft OSTC
>   Differential Revision:        https://reviews.freebsd.org/D5185
>
> Modified:
>   head/sys/netinet/tcp_lro.c
>   head/sys/netinet/tcp_lro.h
>   head/sys/sys/param.h
>
> Modified: head/sys/netinet/tcp_lro.c
> ==============================================================================
> --- head/sys/netinet/tcp_lro.c  Thu Feb 18 03:05:08 2016        (r295738)
> +++ head/sys/netinet/tcp_lro.c  Thu Feb 18 04:58:34 2016        (r295739)
> @@ -88,6 +88,8 @@ tcp_lro_init_args(struct lro_ctrl *lc, s
>         lc->lro_mbuf_count = 0;
>         lc->lro_mbuf_max = lro_mbufs;
>         lc->lro_cnt = lro_entries;
> +       lc->lro_ackcnt_lim = TCP_LRO_ACKCNT_MAX;
> +       lc->lro_length_lim = TCP_LRO_LENGTH_MAX;
>         lc->ifp = ifp;
>         SLIST_INIT(&lc->lro_free);
>         SLIST_INIT(&lc->lro_active);
> @@ -610,7 +612,7 @@ tcp_lro_rx(struct lro_ctrl *lc, struct m
>                 }
>
>                 /* Flush now if appending will result in overflow. */
> -               if (le->p_len > (65535 - tcp_data_len)) {
> +               if (le->p_len > (lc->lro_length_lim - tcp_data_len)) {
>                         SLIST_REMOVE(&lc->lro_active, le, lro_entry, next);
>                         tcp_lro_flush(lc, le);
>                         break;
> @@ -648,6 +650,15 @@ tcp_lro_rx(struct lro_ctrl *lc, struct m
>
>                 if (tcp_data_len == 0) {
>                         m_freem(m);
> +                       /*
> +                        * Flush this LRO entry, if this ACK should not
> +                        * be further delayed.
> +                        */
> +                       if (le->append_cnt >= lc->lro_ackcnt_lim) {
> +                               SLIST_REMOVE(&lc->lro_active, le, lro_entry,
> +                                   next);
> +                               tcp_lro_flush(lc, le);
> +                       }
>                         return (0);
>                 }
>
> @@ -668,7 +679,7 @@ tcp_lro_rx(struct lro_ctrl *lc, struct m
>                  * If a possible next full length packet would cause an
>                  * overflow, pro-actively flush now.
>                  */
> -               if (le->p_len > (65535 - lc->ifp->if_mtu)) {
> +               if (le->p_len > (lc->lro_length_lim - lc->ifp->if_mtu)) {
>                         SLIST_REMOVE(&lc->lro_active, le, lro_entry, next);
>                         tcp_lro_flush(lc, le);
>                 } else
>
> Modified: head/sys/netinet/tcp_lro.h
> ==============================================================================
> --- head/sys/netinet/tcp_lro.h  Thu Feb 18 03:05:08 2016        (r295738)
> +++ head/sys/netinet/tcp_lro.h  Thu Feb 18 04:58:34 2016        (r295739)
> @@ -91,11 +91,16 @@ struct lro_ctrl {
>         unsigned        lro_cnt;
>         unsigned        lro_mbuf_count;
>         unsigned        lro_mbuf_max;
> +       unsigned short  lro_ackcnt_lim;         /* max # of aggregated ACKs */
> +       unsigned        lro_length_lim;         /* max len of aggregated data */
>
>         struct lro_head lro_active;
>         struct lro_head lro_free;
>  };
>
> +#define        TCP_LRO_LENGTH_MAX      65535
> +#define        TCP_LRO_ACKCNT_MAX      65535           /* unlimited */
> +
>  int tcp_lro_init(struct lro_ctrl *);
>  int tcp_lro_init_args(struct lro_ctrl *, struct ifnet *, unsigned, unsigned);
>  void tcp_lro_free(struct lro_ctrl *);
>
> Modified: head/sys/sys/param.h
> ==============================================================================
> --- head/sys/sys/param.h        Thu Feb 18 03:05:08 2016        (r295738)
> +++ head/sys/sys/param.h        Thu Feb 18 04:58:34 2016        (r295739)
> @@ -58,7 +58,7 @@
>   *             in the range 5 to 9.
>   */
>  #undef __FreeBSD_version
> -#define __FreeBSD_version 1100098      /* Master, propagated to newvers */
> +#define __FreeBSD_version 1100099      /* Master, propagated to newvers */
>
>  /*
>   * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
> _______________________________________________
> svn-src-all at freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/svn-src-all
> To unsubscribe, send any mail to "svn-src-all-unsubscribe at freebsd.org"



-- 
Tomorrow Will Never Die


More information about the svn-src-head mailing list